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
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 31f4974..bcbcf31 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -16,9 +16,12 @@
#ifndef LLVM_CODEGEN_MACHINEINSTR_H
#define LLVM_CODEGEN_MACHINEINSTR_H
-#include "llvm/ADT/alist.h"
+#include "llvm/ADT/ilist.h"
+#include "llvm/ADT/ilist_node.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineMemOperand.h"
+#include <list>
#include <vector>
namespace llvm {
@@ -31,13 +34,13 @@
//===----------------------------------------------------------------------===//
/// MachineInstr - Representation of each machine instruction.
///
-class MachineInstr {
+class MachineInstr : public ilist_node<MachineInstr> {
const TargetInstrDesc *TID; // Instruction descriptor.
unsigned short NumImplicitOps; // Number of implicit operands (which
// are determined at construction time).
std::vector<MachineOperand> Operands; // the operands
- alist<MachineMemOperand> MemOperands; // information on memory references
+ std::list<MachineMemOperand> MemOperands; // information on memory references
MachineBasicBlock *Parent; // Pointer to the owning basic block.
// OperandComplete - Return true if it's illegal to add a new operand
@@ -47,8 +50,9 @@
void operator=(const MachineInstr&); // DO NOT IMPLEMENT
// Intrusive list support
- friend struct alist_traits<MachineInstr>;
- friend struct alist_traits<MachineBasicBlock>;
+ friend struct ilist_traits<MachineInstr>;
+ friend struct ilist_traits<MachineBasicBlock>;
+ friend struct ilist_sentinel_traits<MachineInstr>;
void setParent(MachineBasicBlock *P) { Parent = P; }
/// MachineInstr ctor - This constructor creates a copy of the given
@@ -105,13 +109,13 @@
unsigned getNumExplicitOperands() const;
/// Access to memory operands of the instruction
- alist<MachineMemOperand>::iterator memoperands_begin()
+ std::list<MachineMemOperand>::iterator memoperands_begin()
{ return MemOperands.begin(); }
- alist<MachineMemOperand>::iterator memoperands_end()
+ std::list<MachineMemOperand>::iterator memoperands_end()
{ return MemOperands.end(); }
- alist<MachineMemOperand>::const_iterator memoperands_begin() const
+ std::list<MachineMemOperand>::const_iterator memoperands_begin() const
{ return MemOperands.begin(); }
- alist<MachineMemOperand>::const_iterator memoperands_end() const
+ std::list<MachineMemOperand>::const_iterator memoperands_end() const
{ return MemOperands.end(); }
bool memoperands_empty() const { return MemOperands.empty(); }