16 #ifndef LLVM_MC_MCINST_H
17 #define LLVM_MC_MCINST_H
21 #include "llvm/Support/DataTypes.h"
34 enum MachineOperandType :
unsigned char {
42 MachineOperandType Kind;
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;
174 size_t size()
const {
return Operands.size(); }
180 return Operands.insert(I, Op);
static MCOperand createExpr(const MCExpr *Val)
void setInst(const MCInst *Val)
const_iterator begin() const
print alias Alias Set Printer
void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ") const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
MCOperand & getOperand(unsigned i)
static MCOperand createReg(unsigned Reg)
Base class for the full range of assembler expressions which are needed for parsing.
Reg
All possible values of the reg field in the ModR/M byte.
void setFPImm(double Val)
unsigned getReg() const
Returns the register number.
iterator insert(iterator I, const MCOperand &Op)
Instances of this class represent a single low-level machine instruction.
SmallVectorImpl< MCOperand >::iterator iterator
const MCExpr * getExpr() const
void print(raw_ostream &OS) const
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
void setOpcode(unsigned Op)
SmallVectorImpl< MCOperand >::const_iterator const_iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static MCOperand createFPImm(double Val)
const_iterator end() const
unsigned getOpcode() const
void print(raw_ostream &OS) const
static MCOperand createInst(const MCInst *Val)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
unsigned getNumOperands() const
const MCInst * getInst() const
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
void setReg(unsigned Reg)
Set the register number.
This class implements an extremely fast bulk output stream that can only output to a stream...
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
Represents a location in source code.
Instances of this class represent operands of the MCInst class.
static MCOperand createImm(int64_t Val)
const MCOperand & getOperand(unsigned i) const
void setExpr(const MCExpr *Val)