From fed90b6d097d50881afb45e4d79f430db66dd741 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 28 Jul 2008 21:51:04 +0000 Subject: Fold the useful features of alist and alist_node into ilist, and a new ilist_node class, and remove them. Unlike alist_node, ilist_node doesn't attempt to manage storage itself, so it avoids the associated problems, including being opaque in gdb. Adjust the Recycler class so that it doesn't depend on alist_node. Also, change it to use explicit Size and Align parameters, allowing it to work when the largest-sized node doesn't have the greatest alignment requirement. Change MachineInstr's MachineMemOperand list from a pool-backed alist to a std::list for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54146 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineFunction.h | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'include/llvm/CodeGen/MachineFunction.h') diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 98f3a94839..7b24600b49 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -18,7 +18,7 @@ #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H #define LLVM_CODEGEN_MACHINEFUNCTION_H -#include "llvm/ADT/alist.h" +#include "llvm/ADT/ilist.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/Annotation.h" #include "llvm/Support/Allocator.h" @@ -34,15 +34,18 @@ class MachineConstantPool; class MachineJumpTableInfo; template <> -class alist_traits { - typedef alist_iterator iterator; +class ilist_traits + : public ilist_default_traits { + mutable MachineBasicBlock Sentinel; public: + MachineBasicBlock *createSentinel() const { return &Sentinel; } + void destroySentinel(MachineBasicBlock *) const {} + void addNodeToList(MachineBasicBlock* MBB); void removeNodeFromList(MachineBasicBlock* MBB); - void transferNodesFromList(alist_traits &, - iterator, - iterator) {} void deleteNode(MachineBasicBlock *MBB); +private: + void createNode(const MachineBasicBlock &); }; /// MachineFunctionInfo - This class can be derived from and used by targets to @@ -87,11 +90,8 @@ class MachineFunction : private Annotation { // Allocation management for basic blocks in function. Recycler BasicBlockRecycler; - // Allocation management for memoperands in function. - Recycler MemOperandRecycler; - // List of machine basic blocks in function - typedef alist BasicBlockListType; + typedef ilist BasicBlockListType; BasicBlockListType BasicBlocks; public: @@ -302,15 +302,6 @@ public: /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock. /// void DeleteMachineBasicBlock(MachineBasicBlock *MBB); - - /// CreateMachineMemOperand - Allocate a new MachineMemOperand. Use this - /// instead of `new MachineMemOperand'. - /// - MachineMemOperand *CreateMachineMemOperand(const MachineMemOperand &MMO); - - /// DeleteMachineMemOperand - Delete the given MachineMemOperand. - /// - void DeleteMachineMemOperand(MachineMemOperand *MMO); }; //===--------------------------------------------------------------------===// -- cgit v1.2.3