LLVM: include/llvm/MC/MCInst.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_MC_MCINST_H

16#define LLVM_MC_MCINST_H

17

25#include

26#include

27#include

28

29namespace llvm {

30

37

38

39

41 enum MachineOperandType : unsigned char {

42 kInvalid,

43 kRegister,

44 kImmediate,

45 kSFPImmediate,

46 kDFPImmediate,

47 kExpr,

48 kInst

49 };

50 MachineOperandType Kind = kInvalid;

51

52 union {

59 };

60

61public:

63

64 bool isValid() const { return Kind != kInvalid; }

65 bool isReg() const { return Kind == kRegister; }

66 bool isImm() const { return Kind == kImmediate; }

67 bool isSFPImm() const { return Kind == kSFPImmediate; }

68 bool isDFPImm() const { return Kind == kDFPImmediate; }

69 bool isExpr() const { return Kind == kExpr; }

70 bool isInst() const { return Kind == kInst; }

71

72

74 assert(isReg() && "This is not a register operand!");

76 }

77

78

80 assert(isReg() && "This is not a register operand!");

82 }

83

88

93

98

103

108

117

122

127

129 assert(isInst() && "This is not a sub-instruction");

131 }

132

134 assert(isInst() && "This is not a sub-instruction");

136 }

137

140 Op.Kind = kRegister;

141 Op.RegVal = Reg.id();

142 return Op;

143 }

144

147 Op.Kind = kImmediate;

148 Op.ImmVal = Val;

149 return Op;

150 }

151

154 Op.Kind = kSFPImmediate;

155 Op.SFPImmVal = Val;

156 return Op;

157 }

158

161 Op.Kind = kDFPImmediate;

162 Op.FPImmVal = Val;

163 return Op;

164 }

165

168 Op.Kind = kExpr;

169 Op.ExprVal = Val;

170 return Op;

171 }

172

175 Op.Kind = kInst;

176 Op.InstVal = Val;

177 return Op;

178 }

179

184};

185

186

187

189 unsigned Opcode = 0;

190

191

192

193 unsigned Flags = 0;

194

197

198public:

200

202 unsigned getOpcode() const { return Opcode; }

203

205 unsigned getFlags() const { return Flags; }

206

209

213

217 Operands.assign(Ops.begin(), Ops.end());

218 }

219

222

223 void clear() { Operands.clear(); }

226 size_t size() const { return Operands.size(); }

231

233 return Operands.insert(I, Op);

234 }

235

238

239

240

241

245 const MCContext *Ctx = nullptr) const;

248 const MCContext *Ctx = nullptr) const;

249};

250

255

257 MI.print(OS);

258 return OS;

259}

260

261}

262

263#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

dxil pretty DXIL Metadata Pretty Printer

const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]

This file defines the SmallVector class.

This file implements the C++20 header.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Context object for machine code objects.

Base class for the full range of assembler expressions which are needed for parsing.

This is an instance of a target assembly language printer that converts an MCInst to valid target ass...

Instances of this class represent a single low-level machine instruction.

Definition MCInst.h:188

LLVM_ABI void print(raw_ostream &OS, const MCContext *Ctx=nullptr) const

const_iterator end() const

Definition MCInst.h:230

void erase(iterator I)

Definition MCInst.h:224

MCOperand & getOperand(unsigned i)

Definition MCInst.h:211

unsigned getNumOperands() const

Definition MCInst.h:212

SMLoc getLoc() const

Definition MCInst.h:208

SmallVectorImpl< MCOperand >::iterator iterator

Definition MCInst.h:220

unsigned getFlags() const

Definition MCInst.h:205

void setLoc(SMLoc loc)

Definition MCInst.h:207

unsigned getOpcode() const

Definition MCInst.h:202

LLVM_ABI void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ", const MCContext *Ctx=nullptr) const

Dump the MCInst as prettily as possible using the additional MC structures, if given.

void erase(iterator First, iterator Last)

Definition MCInst.h:225

ArrayRef< MCOperand > getOperands() const

Definition MCInst.h:214

const_iterator begin() const

Definition MCInst.h:228

iterator insert(iterator I, const MCOperand &Op)

Definition MCInst.h:232

void setFlags(unsigned F)

Definition MCInst.h:204

void setOperands(ArrayRef< MCOperand > Ops)

Definition MCInst.h:216

LLVM_ABI void dump() const

void addOperand(const MCOperand Op)

Definition MCInst.h:215

iterator begin()

Definition MCInst.h:227

iterator end()

Definition MCInst.h:229

SmallVectorImpl< MCOperand >::const_iterator const_iterator

Definition MCInst.h:221

size_t size() const

Definition MCInst.h:226

void setOpcode(unsigned Op)

Definition MCInst.h:201

void clear()

Definition MCInst.h:223

const MCOperand & getOperand(unsigned i) const

Definition MCInst.h:210

Instances of this class represent operands of the MCInst class.

Definition MCInst.h:40

bool isSFPImm() const

Definition MCInst.h:67

MCOperand()

Definition MCInst.h:62

unsigned RegVal

Definition MCInst.h:53

const MCExpr * ExprVal

Definition MCInst.h:57

void setImm(int64_t Val)

Definition MCInst.h:89

static MCOperand createExpr(const MCExpr *Val)

Definition MCInst.h:166

LLVM_ABI bool isBareSymbolRef() const

static MCOperand createSFPImm(uint32_t Val)

Definition MCInst.h:152

LLVM_ABI void print(raw_ostream &OS, const MCContext *Ctx=nullptr) const

void setExpr(const MCExpr *Val)

Definition MCInst.h:123

int64_t getImm() const

Definition MCInst.h:84

static MCOperand createReg(MCRegister Reg)

Definition MCInst.h:138

static MCOperand createImm(int64_t Val)

Definition MCInst.h:145

bool isImm() const

Definition MCInst.h:66

void setReg(MCRegister Reg)

Set the register number.

Definition MCInst.h:79

uint32_t SFPImmVal

Definition MCInst.h:55

int64_t ImmVal

Definition MCInst.h:54

bool isInst() const

Definition MCInst.h:70

bool isReg() const

Definition MCInst.h:65

void setInst(const MCInst *Val)

Definition MCInst.h:133

MCRegister getReg() const

Returns the register number.

Definition MCInst.h:73

void setSFPImm(uint32_t Val)

Definition MCInst.h:99

uint64_t FPImmVal

Definition MCInst.h:56

LLVM_ABI bool evaluateAsConstantImm(int64_t &Imm) const

bool isDFPImm() const

Definition MCInst.h:68

LLVM_ABI void dump() const

const MCInst * getInst() const

Definition MCInst.h:128

bool isValid() const

Definition MCInst.h:64

void setDFPImm(uint64_t Val)

Definition MCInst.h:109

const MCExpr * getExpr() const

Definition MCInst.h:118

void setFPImm(double Val)

Definition MCInst.h:113

uint32_t getSFPImm() const

Definition MCInst.h:94

static MCOperand createDFPImm(uint64_t Val)

Definition MCInst.h:159

uint64_t getDFPImm() const

Definition MCInst.h:104

bool isExpr() const

Definition MCInst.h:69

static MCOperand createInst(const MCInst *Val)

Definition MCInst.h:173

const MCInst * InstVal

Definition MCInst.h:58

MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...

Wrapper class representing physical registers. Should be passed by value.

Represents a location in source code.

typename SuperClass::const_iterator const_iterator

typename SuperClass::iterator iterator

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

This class implements an extremely fast bulk output stream that can only output to a stream.

This is an optimization pass for GlobalISel generic memory operations.

@ First

Helpers to iterate all locations in the MemoryEffectsBase class.

To bit_cast(const From &from) noexcept

DWARFExpression::Operation Op

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)