//
//===----------------------------------------------------------------------===//
-
#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"
kInvalid, ///< Uninitialized.
kRegister, ///< Register operand.
kImmediate, ///< Immediate operand.
- kMBBLabel ///< Basic block label.
+ kMBBLabel, ///< Basic block label.
+ kMCValue ///< Relocatable immediate operand.
};
unsigned char Kind;
union {
unsigned RegVal;
int64_t ImmVal;
+ MCValue MCValueVal;
struct {
unsigned FunctionNo;
unsigned BlockNo;
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 {
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;
MBBLabel.FunctionNo = Fn;
MBBLabel.BlockNo = MBB;
}
+ void MakeMCValue(const MCValue &Val) {
+ Kind = kMCValue;
+ MCValueVal = Val;
+ }
};
void addOperand(const MCOperand &Op) {
Operands.push_back(Op);
}
-
};