[llvm-commits] [llvm] r74572 - /llvm/trunk/include/llvm/MC/MCInst.h

Daniel Dunbar daniel at zuster.org
Tue Jun 30 16:37:44 PDT 2009


Author: ddunbar
Date: Tue Jun 30 18:37:44 2009
New Revision: 74572

URL: http://llvm.org/viewvc/llvm-project?rev=74572&view=rev
Log:
Fill in some methods for the MCValue field of an MCOperand.

Modified:
    llvm/trunk/include/llvm/MC/MCInst.h

Modified: llvm/trunk/include/llvm/MC/MCInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInst.h?rev=74572&r1=74571&r2=74572&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCInst.h (original)
+++ llvm/trunk/include/llvm/MC/MCInst.h Tue Jun 30 18:37:44 2009
@@ -31,7 +31,7 @@
     kRegister,                ///< Register operand.
     kImmediate,               ///< Immediate operand.
     kMBBLabel,                ///< Basic block label.
-    kMCValue
+    kMCValue                  ///< Relocatable immediate operand.
   };
   unsigned char Kind;
   
@@ -49,9 +49,11 @@
   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 isMCValue() const { return Kind == kMCValue; }
   
   /// getReg - Returns the register number.
   unsigned getReg() const {
@@ -82,6 +84,15 @@
     assert(isMBBLabel() && "Wrong accessor");
     return MBBLabel.BlockNo; 
   }
+
+  const MCValue &getMCValue() const {
+    assert(isMCValue() && "This is not an MCValue");
+    return MCValueVal;
+  }
+  void setMCValue(const MCValue &Val) {
+    assert(isMCValue() && "This is not an MCValue");
+    MCValueVal = Val;
+  }
   
   void MakeReg(unsigned Reg) {
     Kind = kRegister;
@@ -96,6 +107,10 @@
     MBBLabel.FunctionNo = Fn;
     MBBLabel.BlockNo = MBB;
   }
+  void MakeMCValue(const MCValue &Val) {
+    Kind = kMCValue;
+    MCValueVal = Val;
+  }
 };
 
   
@@ -119,7 +134,6 @@
   void addOperand(const MCOperand &Op) {
     Operands.push_back(Op);
   }
-  
 };
 
 





More information about the llvm-commits mailing list