MC: Allow modifiers in MCSymbolRefExpr, and eliminate X86MCTargetExpr.
[oota-llvm.git] / include / llvm / MC / MCInst.h
index 7c1cb136d6974b4c122e5ac8e217935d68e4f142..29b38dd15d119b224e957c30c7511aca7ea9ad5d 100644 (file)
 #define LLVM_MC_MCINST_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/DebugLoc.h"
+#include "llvm/System/DataTypes.h"
 
 namespace llvm {
 class raw_ostream;
+class MCAsmInfo;
 class MCExpr;
 
 /// MCOperand - Instances of this class represent operands of the MCInst class.
@@ -31,7 +31,6 @@ class MCOperand {
     kInvalid,                 ///< Uninitialized.
     kRegister,                ///< Register operand.
     kImmediate,               ///< Immediate operand.
-    kMBBLabel,                ///< Basic block label.
     kExpr                     ///< Relocatable immediate operand.
   };
   unsigned char Kind;
@@ -40,20 +39,14 @@ class MCOperand {
     unsigned RegVal;
     int64_t ImmVal;
     const MCExpr *ExprVal;
-    struct {
-      unsigned FunctionNo;
-      unsigned BlockNo;
-    } MBBLabel;
   };
 public:
   
   MCOperand() : Kind(kInvalid) {}
-  MCOperand(const MCOperand &RHS) { *this = RHS; }
 
   bool isValid() const { return Kind != kInvalid; }
   bool isReg() const { return Kind == kRegister; }
   bool isImm() const { return Kind == kImmediate; }
-  bool isMBBLabel() const { return Kind == kMBBLabel; }
   bool isExpr() const { return Kind == kExpr; }
   
   /// getReg - Returns the register number.
@@ -77,15 +70,6 @@ public:
     ImmVal = Val;
   }
   
-  unsigned getMBBLabelFunction() const {
-    assert(isMBBLabel() && "This is not a machine basic block");
-    return MBBLabel.FunctionNo; 
-  }
-  unsigned getMBBLabelBlock() const {
-    assert(isMBBLabel() && "This is not a machine basic block");
-    return MBBLabel.BlockNo; 
-  }
-
   const MCExpr *getExpr() const {
     assert(isExpr() && "This is not an expression");
     return ExprVal;
@@ -107,13 +91,6 @@ public:
     Op.ImmVal = Val;
     return Op;
   }
-  static MCOperand CreateMBBLabel(unsigned Fn, unsigned MBB) {
-    MCOperand Op;
-    Op.Kind = kMBBLabel;
-    Op.MBBLabel.FunctionNo = Fn;
-    Op.MBBLabel.BlockNo = MBB;
-    return Op;
-  }
   static MCOperand CreateExpr(const MCExpr *Val) {
     MCOperand Op;
     Op.Kind = kExpr;
@@ -121,7 +98,7 @@ public:
     return Op;
   }
 
-  void print(raw_ostream &OS) const;
+  void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
   void dump() const;
 };
 
@@ -132,13 +109,12 @@ class MCInst {
   unsigned Opcode;
   SmallVector<MCOperand, 8> Operands;
 public:
-  MCInst() : Opcode(~0U) {}
+  MCInst() : Opcode(0) {}
   
   void setOpcode(unsigned Op) { Opcode = Op; }
   
   unsigned getOpcode() const { return Opcode; }
-  DebugLoc getDebugLoc() const { return DebugLoc(); }
-  
+
   const MCOperand &getOperand(unsigned i) const { return Operands[i]; }
   MCOperand &getOperand(unsigned i) { return Operands[i]; }
   unsigned getNumOperands() const { return Operands.size(); }
@@ -147,7 +123,7 @@ public:
     Operands.push_back(Op);
   }
 
-  void print(raw_ostream &OS) const;
+  void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
   void dump() const;
 };