//===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the Instruction class, which is the
// base class for all of the LLVM instructions.
#define LLVM_INSTRUCTION_H
#include "llvm/User.h"
+#include "Support/Annotation.h"
+
+namespace llvm {
+
+class AssemblyAnnotationWriter;
template<typename SC> struct ilist_traits;
template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
typename SubClass> class SymbolTableListTraits;
-class Instruction : public User {
+class Instruction : public User, public Annotable {
BasicBlock *Parent;
Instruction *Prev, *Next; // Next and Prev links for our intrusive linked list
Instruction(const Type *Ty, unsigned iType, const std::string &Name = "",
Instruction *InsertBefore = 0);
public:
- virtual ~Instruction() {
- assert(Parent == 0 && "Instruction still embedded in basic block!");
- }
// Specialize setName to handle symbol table majik...
virtual void setName(const std::string &name, SymbolTable *ST = 0);
bool isCommutative() const { return isCommutative(getOpcode()); }
static bool isCommutative(unsigned op);
+ /// isRelational - Return true if the instruction is a Set* instruction:
+ ///
+ bool isRelational() const { return isRelational(getOpcode()); }
+ static bool isRelational(unsigned op);
- virtual void print(std::ostream &OS) const;
+
+ /// isTrappingInstruction - 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, AssemblyAnnotationWriter *AAW) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Instruction *I) { return true; }
};
};
+} // End llvm namespace
+
#endif