16 #ifndef LLVM_MC_MCINST_H
17 #define LLVM_MC_MCINST_H
21 #include "llvm/Support/DataTypes.h"
34 enum MachineOperandType {
55 bool isValid()
const {
return Kind != kInvalid; }
56 bool isReg()
const {
return Kind == kRegister; }
57 bool isImm()
const {
return Kind == kImmediate; }
58 bool isFPImm()
const {
return Kind == kFPImmediate; }
59 bool isExpr()
const {
return Kind == kExpr; }
60 bool isInst()
const {
return Kind == kInst; }
64 assert(
isReg() &&
"This is not a register operand!");
70 assert(
isReg() &&
"This is not a register operand!");
75 assert(
isImm() &&
"This is not an immediate");
79 assert(
isImm() &&
"This is not an immediate");
84 assert(
isFPImm() &&
"This is not an FP immediate");
89 assert(
isFPImm() &&
"This is not an FP immediate");
94 assert(
isExpr() &&
"This is not an expression");
98 assert(
isExpr() &&
"This is not an expression");
103 assert(
isInst() &&
"This is not a sub-instruction");
107 assert(
isInst() &&
"This is not a sub-instruction");
119 Op.Kind = kImmediate;
125 Op.Kind = kFPImmediate;
168 Operands.push_back(Op);
172 size_t size() {
return Operands.size(); }
178 return Operands.insert(I, Op);
static MCOperand CreateReg(unsigned Reg)
void setInst(const MCInst *Val)
static MCOperand CreateExpr(const MCExpr *Val)
print alias Alias Set Printer
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
MCOperand & getOperand(unsigned i)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
void setFPImm(double Val)
unsigned getReg() const
getReg - Returns the register number.
iterator insert(iterator I, const MCOperand &Op)
SmallVectorImpl< MCOperand >::iterator iterator
const MCExpr * getExpr() const
void setOpcode(unsigned Op)
unsigned getOpcode() const
void dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI=0, const MCInstPrinter *Printer=0, StringRef Separator=" ") const
Dump the MCInst as prettily as possible using the additional MC structures, if given. Operators are separated by the Separator string.
static MCOperand CreateImm(int64_t Val)
unsigned getNumOperands() const
const MCInst * getInst() const
static MCOperand CreateFPImm(double Val)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
void setReg(unsigned Reg)
setReg - Set the register number.
void addOperand(const MCOperand &Op)
Represents a location in source code.
const MCOperand & getOperand(unsigned i) const
static MCOperand CreateInst(const MCInst *Val)
void setExpr(const MCExpr *Val)