#define LLVM_INSTRUCTION_H
#include "llvm/User.h"
+#include "llvm/ADT/ilist_node.h"
namespace llvm {
-struct AssemblyAnnotationWriter;
-
template<typename ValueSubClass, typename ItemParentClass>
class SymbolTableListTraits;
-class Instruction : public User {
+class Instruction : public User, public ilist_node<Instruction> {
void operator=(const Instruction &); // Do not implement
Instruction(const Instruction &); // Do not implement
BasicBlock *Parent;
- Instruction *Prev, *Next; // Next and Prev links for our intrusive linked list
-
- void setNext(Instruction *N) { Next = N; }
- void setPrev(Instruction *N) { Prev = N; }
friend class SymbolTableListTraits<Instruction, BasicBlock>;
void setParent(BasicBlock *P);
bool isCommutative() const { return isCommutative(getOpcode()); }
static bool isCommutative(unsigned op);
- /// isTrappingInstruction - Return true if the instruction may trap.
+ /// isTrapping - Return true if the instruction may trap.
///
bool isTrapping() const {
return isTrapping(getOpcode());
}
static bool isTrapping(unsigned op);
- virtual void print(std::ostream &OS) const { print(OS, 0); }
- void print(std::ostream *OS) const { if (OS) print(*OS); }
- void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Instruction *) { return true; }
static inline bool classof(const Value *V) {
#define LAST_OTHER_INST(N) OtherOpsEnd = N+1
#include "llvm/Instruction.def"
};
-
-private:
- // getNext/Prev - Return the next or previous instruction in the list. The
- // last node in the list is a terminator instruction.
- Instruction *getNext() { return Next; }
- const Instruction *getNext() const { return Next; }
- Instruction *getPrev() { return Prev; }
- const Instruction *getPrev() const { return Prev; }
};
} // End llvm namespace