LLVM: include/llvm/IR/InlineAsm.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_IR_INLINEASM_H

16#define LLVM_IR_INLINEASM_H

17

24#include

25#include

26#include

27

28namespace llvm {

29

34

35class InlineAsm final : public Value {

36public:

41

42private:

45

46 std::string AsmString, Constraints;

48 bool HasSideEffects;

49 bool IsAlignStack;

51 bool CanThrow;

52

53 InlineAsm(FunctionType *Ty, const std::string &AsmString,

56

57

58

59 void destroyConstant();

60

61public:

63 InlineAsm &operator=(const InlineAsm &) = delete;

64

65

66

72

76 bool canThrow() const { return CanThrow; }

77

78

79

83

84

85

87

91

92

93

95

96

103

105

107

108

109

110

112

113

114

116

117

119 };

120

124

126

127

129

130

131

133

134

135

136

137

139

140

141

143

144

145

147

148

149

150

151

153

154

155

157

158

160

161

162

164

165

167

168

170

171

172

173

175

176

177

179

180

184 };

185

186

187

188

191

192

193

197

198

200 return V->getValueID() == Value::InlineAsmVal;

201 }

202

204

208 Op_ExtraInfo = 3,

210

211

215

216

223 };

224

225

226

227

237

238

239

240

241

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

315

316

320

321 public:

342 return "reguse";

344 return "regdef";

346 return "regdef-ec";

348 return "clobber";

350 return "imm";

353 return "mem";

354 }

356 }

357

358

359

363

364

365

367 if (!isMatched())

368 return false;

369 Idx = getMatchedOperandNo();

370 return true;

371 }

372

373

374

376 if (isMatched())

377 return false;

378

379

380 if (!getRegClass())

381 return false;

382 RC = getRegClass() - 1;

383 return true;

384 }

385

388 "Not expected mem or function flag!");

390 }

391

392

393

395 assert(getMatchedOperandNo() == 0 && "Matching operand already set");

398 }

399

400

401

402

404 assert(isImmKind() && "Immediates cannot have a register class");

405 assert(isMemKind() && "Memory operand cannot have a register class");

406 assert(getRegClass() == 0 && "Register class already set");

407

409 }

410

411

412

417

418

421 "Flag is not a memory or function constraint!");

423 }

424

425

426

427

428

429

430

431

432

433

436 "Must be reg");

438 }

441 "Must be reg");

443 }

444 };

445

447 std::vector Result;

449 Result.push_back("sideeffect");

451 Result.push_back("mayload");

453 Result.push_back("maystore");

455 Result.push_back("isconvergent");

457 Result.push_back("alignstack");

458

461

463 Result.push_back("attdialect");

465 Result.push_back("inteldialect");

466

467 return Result;

468 }

469

471 switch (C) {

473 return "es";

475 return "i";

477 return "k";

479 return "m";

481 return "o";

483 return "v";

485 return "A";

487 return "Q";

489 return "R";

491 return "S";

493 return "T";

495 return "Um";

497 return "Un";

499 return "Uq";

501 return "Us";

503 return "Ut";

505 return "Uv";

507 return "Uy";

509 return "X";

511 return "Z";

513 return "ZB";

515 return "ZC";

517 return "Zy";

519 return "p";

521 return "ZQ";

523 return "ZR";

525 return "ZS";

527 return "ZT";

528 default:

530 }

531 }

532};

533

534}

535

536#endif

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

This file implements methods to test, set and extract typed bits from packed unsigned integers.

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

const size_t AbstractManglingParser< Derived, Alloc >::NumOps

This file defines the SmallVector class.

Lightweight error class with error context and mandatory checking.

Class to represent function types.

void setRegMayBeFolded(bool B)

Set a bit to denote that while this operand is some kind of register (use, def, .....

Definition InlineAsm.h:434

bool isImmKind() const

Definition InlineAsm.h:336

bool isClobberKind() const

Definition InlineAsm.h:335

void setRegClass(unsigned RC)

setRegClass - Augment an existing flag with the required register class for the following register op...

Definition InlineAsm.h:403

StringRef getKindName() const

Definition InlineAsm.h:339

void clearMemConstraint()

clearMemConstraint - Similar to setMemConstraint(0), but without the assertion checking that the cons...

Definition InlineAsm.h:419

Kind getKind() const

Definition InlineAsm.h:329

Flag(enum Kind K, unsigned NumOps)

Definition InlineAsm.h:324

bool hasRegClassConstraint(unsigned &RC) const

hasRegClassConstraint - Returns true if the flag contains a register class constraint.

Definition InlineAsm.h:375

bool isRegUseKind() const

Definition InlineAsm.h:330

bool isMemKind() const

Definition InlineAsm.h:337

void setMatchingOp(unsigned OperandNo)

setMatchingOp - Augment an existing flag with information indicating that this input operand is tied ...

Definition InlineAsm.h:394

void setMemConstraint(ConstraintCode C)

setMemConstraint - Augment an existing flag with the constraint code for a memory constraint.

Definition InlineAsm.h:413

ConstraintCode getMemoryConstraintID() const

Definition InlineAsm.h:386

Flag()

Definition InlineAsm.h:322

bool getRegMayBeFolded() const

Definition InlineAsm.h:439

bool isUseOperandTiedToDef(unsigned &Idx) const

isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...

Definition InlineAsm.h:366

bool isFuncKind() const

Definition InlineAsm.h:338

unsigned getNumOperandRegisters() const

getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag.

Definition InlineAsm.h:360

Flag(uint32_t F)

Definition InlineAsm.h:323

bool isRegDefEarlyClobberKind() const

Definition InlineAsm.h:332

bool isRegDefKind() const

Definition InlineAsm.h:331

AsmDialect

Definition InlineAsm.h:37

@ AD_Intel

Definition InlineAsm.h:39

@ AD_ATT

Definition InlineAsm.h:38

LLVM_ABI void collectAsmStrs(SmallVectorImpl< StringRef > &AsmStrs) const

static LLVM_ABI InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)

InlineAsm::get - Return the specified uniqued inline asm string.

Kind

Definition InlineAsm.h:228

@ Func

Definition InlineAsm.h:235

@ RegDef

Definition InlineAsm.h:230

@ RegUse

Definition InlineAsm.h:229

@ Clobber

Definition InlineAsm.h:232

@ Imm

Definition InlineAsm.h:233

@ Mem

Definition InlineAsm.h:234

@ RegDefEarlyClobber

Definition InlineAsm.h:231

std::vector< SubConstraintInfo > SubConstraintInfoVector

Definition InlineAsm.h:121

ConstraintPrefix

Definition InlineAsm.h:97

@ isLabel

Definition InlineAsm.h:101

@ isInput

Definition InlineAsm.h:98

@ isOutput

Definition InlineAsm.h:99

@ isClobber

Definition InlineAsm.h:100

std::vector< ConstraintInfo > ConstraintInfoVector

Definition InlineAsm.h:123

static std::vector< StringRef > getExtraInfoNames(unsigned ExtraInfo)

Definition InlineAsm.h:446

friend struct InlineAsmKeyType

Definition InlineAsm.h:43

bool isAlignStack() const

Definition InlineAsm.h:74

AsmDialect getDialect() const

Definition InlineAsm.h:75

LLVM_ABI FunctionType * getFunctionType() const

getFunctionType - InlineAsm's are always pointers to functions.

bool hasSideEffects() const

Definition InlineAsm.h:73

StringRef getAsmString() const

Definition InlineAsm.h:88

InlineAsm(const InlineAsm &)=delete

ConstraintInfoVector ParseConstraints() const

ParseConstraints - Parse the constraints of this inlineasm object, returning them the same way that P...

Definition InlineAsm.h:194

bool canThrow() const

Definition InlineAsm.h:76

std::vector< std::string > ConstraintCodeVector

Definition InlineAsm.h:104

static StringRef getMemConstraintName(ConstraintCode C)

Definition InlineAsm.h:470

StringRef getConstraintString() const

Definition InlineAsm.h:89

PointerType * getType() const

getType - InlineAsm's are always pointers.

Definition InlineAsm.h:80

@ Op_InputChain

Definition InlineAsm.h:205

@ Op_ExtraInfo

Definition InlineAsm.h:208

@ Extra_HasSideEffects

Definition InlineAsm.h:217

@ Op_AsmString

Definition InlineAsm.h:206

@ Extra_IsConvergent

Definition InlineAsm.h:222

@ Extra_MayLoad

Definition InlineAsm.h:220

@ Op_MDNode

Definition InlineAsm.h:207

@ MIOp_AsmString

Definition InlineAsm.h:212

@ Extra_MayStore

Definition InlineAsm.h:221

@ MIOp_ExtraInfo

Definition InlineAsm.h:213

@ Extra_AsmDialect

Definition InlineAsm.h:219

@ MIOp_FirstOperand

Definition InlineAsm.h:214

@ Extra_IsAlignStack

Definition InlineAsm.h:218

@ Op_FirstOperand

Definition InlineAsm.h:209

ConstraintCode

Definition InlineAsm.h:242

@ X

Definition InlineAsm.h:262

@ es

Definition InlineAsm.h:244

@ Z

Definition InlineAsm.h:263

@ Uq

Definition InlineAsm.h:257

@ Uv

Definition InlineAsm.h:260

@ ZR

Definition InlineAsm.h:271

@ Ut

Definition InlineAsm.h:259

@ S

Definition InlineAsm.h:253

@ Max

Definition InlineAsm.h:275

@ m

Definition InlineAsm.h:247

@ ZT

Definition InlineAsm.h:273

@ A

Definition InlineAsm.h:250

@ Un

Definition InlineAsm.h:256

@ p

Definition InlineAsm.h:269

@ Us

Definition InlineAsm.h:258

@ i

Definition InlineAsm.h:245

@ Unknown

Definition InlineAsm.h:243

@ ZS

Definition InlineAsm.h:272

@ k

Definition InlineAsm.h:246

@ Um

Definition InlineAsm.h:255

@ v

Definition InlineAsm.h:249

@ ZB

Definition InlineAsm.h:264

@ T

Definition InlineAsm.h:254

@ ZQ

Definition InlineAsm.h:270

@ Zy

Definition InlineAsm.h:266

@ o

Definition InlineAsm.h:248

@ Uy

Definition InlineAsm.h:261

@ R

Definition InlineAsm.h:252

@ Q

Definition InlineAsm.h:251

@ ZC

Definition InlineAsm.h:265

static bool classof(const Value *V)

Definition InlineAsm.h:199

InlineAsm & operator=(const InlineAsm &)=delete

Class to represent pointers.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

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

Type * getType() const

All values are typed, get the type of this value.

LLVM_ABI Value(Type *Ty, unsigned scid)

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

Describes an element of a Bitfield.

static Bitfield::Type get(StorageType Packed)

Unpacks the field from the Packed value.

static void set(StorageType &Packed, typename Bitfield::Type Value)

Sets the typed value in the provided Packed value.

Definition InlineAsm.h:125

bool isCommutative

isCommutative - This is set to true for a constraint that is commutative with the next operand.

Definition InlineAsm.h:146

ConstraintPrefix Type

Type - The basic type of the constraint: input/output/clobber/label.

Definition InlineAsm.h:128

int MatchingInput

MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...

Definition InlineAsm.h:138

ConstraintCodeVector Codes

Code - The constraint code, either the register name (in braces) or the constraint letter/number.

Definition InlineAsm.h:156

unsigned currentAlternativeIndex

The currently selected alternative constraint index.

Definition InlineAsm.h:166

ConstraintInfo()=default

Default constructor.

LLVM_ABI bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar)

Parse - Analyze the specified string (e.g.

bool hasArg() const

Whether this constraint corresponds to an argument.

Definition InlineAsm.h:181

SubConstraintInfoVector multipleAlternatives

multipleAlternatives - If there are multiple alternative constraints, this array will contain them.

Definition InlineAsm.h:163

bool isIndirect

isIndirect - True if this operand is an indirect operand.

Definition InlineAsm.h:152

bool isEarlyClobber

isEarlyClobber - "&": output operand writes result before inputs are all read.

Definition InlineAsm.h:132

bool isMultipleAlternative

isMultipleAlternative - '|': has multiple-alternative constraints.

Definition InlineAsm.h:159

LLVM_ABI void selectAlternative(unsigned index)

selectAlternative - Point this constraint to the alternative constraint indicated by the index.

bool hasMatchingInput() const

hasMatchingInput - Return true if this is an output constraint that has a matching input constraint.

Definition InlineAsm.h:142

ConstraintCodeVector Codes

Code - The constraint code, either the register name (in braces) or the constraint letter/number.

Definition InlineAsm.h:115

int MatchingInput

MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...

Definition InlineAsm.h:111

SubConstraintInfo()=default

Default constructor.