diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
commit | cd749a9c07f1de2fb8affde90537efa4bc3e7c54 (patch) | |
tree | b21f6de4e08b89bb7931806bab798fc2a5e3a686 /include/llvm/MC/MCInst.h | |
parent | 72621d11de5b873f1695f391eb95f0b336c3d2d4 (diff) | |
download | FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.zip FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.tar.gz |
Update llvm to r84119.
Diffstat (limited to 'include/llvm/MC/MCInst.h')
-rw-r--r-- | include/llvm/MC/MCInst.h | 78 |
1 files changed, 35 insertions, 43 deletions
diff --git a/include/llvm/MC/MCInst.h b/include/llvm/MC/MCInst.h index 8b638d4..0fc4d18 100644 --- a/include/llvm/MC/MCInst.h +++ b/include/llvm/MC/MCInst.h @@ -16,12 +16,13 @@ #ifndef LLVM_MC_MCINST_H #define LLVM_MC_MCINST_H -#include "llvm/MC/MCValue.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/DataTypes.h" -#include "llvm/Support/DebugLoc.h" namespace llvm { +class raw_ostream; +class MCAsmInfo; +class MCExpr; /// MCOperand - Instances of this class represent operands of the MCInst class. /// This is a simple discriminated union. @@ -30,19 +31,14 @@ class MCOperand { kInvalid, ///< Uninitialized. kRegister, ///< Register operand. kImmediate, ///< Immediate operand. - kMBBLabel, ///< Basic block label. - kMCValue ///< Relocatable immediate operand. + kExpr ///< Relocatable immediate operand. }; unsigned char Kind; union { unsigned RegVal; int64_t ImmVal; - MCValue MCValueVal; - struct { - unsigned FunctionNo; - unsigned BlockNo; - } MBBLabel; + const MCExpr *ExprVal; }; public: @@ -52,8 +48,7 @@ public: 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; } + bool isExpr() const { return Kind == kExpr; } /// getReg - Returns the register number. unsigned getReg() const { @@ -76,41 +71,36 @@ public: ImmVal = Val; } - unsigned getMBBLabelFunction() const { - assert(isMBBLabel() && "Wrong accessor"); - return MBBLabel.FunctionNo; + const MCExpr *getExpr() const { + assert(isExpr() && "This is not an expression"); + return ExprVal; } - unsigned getMBBLabelBlock() const { - 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 setExpr(const MCExpr *Val) { + assert(isExpr() && "This is not an expression"); + ExprVal = Val; } - void MakeReg(unsigned Reg) { - Kind = kRegister; - RegVal = Reg; - } - void MakeImm(int64_t Val) { - Kind = kImmediate; - ImmVal = Val; + static MCOperand CreateReg(unsigned Reg) { + MCOperand Op; + Op.Kind = kRegister; + Op.RegVal = Reg; + return Op; } - void MakeMBBLabel(unsigned Fn, unsigned MBB) { - Kind = kMBBLabel; - MBBLabel.FunctionNo = Fn; - MBBLabel.BlockNo = MBB; + static MCOperand CreateImm(int64_t Val) { + MCOperand Op; + Op.Kind = kImmediate; + Op.ImmVal = Val; + return Op; } - void MakeMCValue(const MCValue &Val) { - Kind = kMCValue; - MCValueVal = Val; + static MCOperand CreateExpr(const MCExpr *Val) { + MCOperand Op; + Op.Kind = kExpr; + Op.ExprVal = Val; + return Op; } + + void print(raw_ostream &OS, const MCAsmInfo *MAI) const; + void dump() const; }; @@ -120,13 +110,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(); } @@ -134,6 +123,9 @@ public: void addOperand(const MCOperand &Op) { Operands.push_back(Op); } + + void print(raw_ostream &OS, const MCAsmInfo *MAI) const; + void dump() const; }; |