LLVM: lib/Target/X86/X86AsmPrinter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

50

51using namespace llvm;

52

54 std::unique_ptr Streamer)

56

57

58

59

60

61

62

65

66 SMShadowTracker.startFunction(MF);

69

71 EmitFPOData = Subtarget->isTargetWin32() && M->getCodeViewFlag();

72

73 IndCSPrefix = M->getModuleFlag("indirect_branch_cs_prefix");

74

76

85 }

86

87

89

90

92

93 EmitFPOData = false;

94

95 IndCSPrefix = false;

96

97

98 return false;

99}

100

102 if (EmitFPOData) {

103 auto *XTS =

108 }

109}

110

112 if (EmitFPOData) {

113 auto *XTS =

116 }

117}

118

120

121 const uint32_t InvalidValues[] = {

122 0xFA1E0FF3,

123 0xFB1E0FF3,

124 };

125 for (uint32_t N : InvalidValues) {

126

127

129 return Value + 1;

130 }

132}

133

134void X86AsmPrinter::EmitKCFITypePadding(const MachineFunction &MF,

135 bool HasType) {

136

137

138 int64_t PrefixBytes = 0;

143

144

145

146

147 if (HasType)

148 PrefixBytes += 5;

149

151}

152

153

154

157 if (F.getParent()->getModuleFlag("kcfi"))

158 return;

159

161 if (const MDNode *MD = F.getMetadata(LLVMContext::MD_kcfi_type))

162 Type = mdconst::extract(MD->getOperand(0));

163

164

165

167 EmitKCFITypePadding(MF, false);

168 return;

169 }

170

171

172

173

174

180

181

182

183 EmitKCFITypePadding(MF);

184 EmitAndCountInstruction(MCInstBuilder(X86::MOV32ri)

185 .addReg(X86::EAX)

186 .addImm(MaskKCFIType(Type->getZExtValue())));

187

191

195 OutStreamer->emitELFSize(FnSym, SizeExp);

196 }

197}

198

199

200

201

202void X86AsmPrinter::PrintSymbolOperand(const MachineOperand &MO,

209 break;

212

217 else

219

220

224 GVSym =

226

235 }

236

237

238

239 if (GVSym->getName()[0] != '$')

241 else {

242 O << '(';

244 O << ')';

245 }

247 break;

248 }

249 }

250

252 default:

255 break;

259

260 break;

262 O << " + [.-";

264 O << ']';

265 break;

268 O << '-';

270 break;

287 O << "@TLVP" << '-';

289 break;

291 }

292}

293

294void X86AsmPrinter::PrintOperand(const MachineInstr *MI, unsigned OpNo,

301 if (IsATT)

302 O << '%';

304 return;

305 }

306

308 if (IsATT)

309 O << '$';

311 return;

312

315 switch (MI->getInlineAsmDialect()) {

317 O << '$';

318 break;

320 O << "offset ";

321 break;

322 }

323 PrintSymbolOperand(MO, O);

324 break;

325 }

329 break;

330 }

331 }

332}

333

334

335

336

337void X86AsmPrinter::PrintModifiedOperand(const MachineInstr *MI, unsigned OpNo,

340 if (!Modifier || !MO.isReg())

341 return PrintOperand(MI, OpNo, O);

343 O << '%';

345 if (strncmp(Modifier, "subreg", strlen("subreg")) == 0) {

346 unsigned Size = (strcmp(Modifier+6,"64") == 0) ? 64 :

347 (strcmp(Modifier+6,"32") == 0) ? 32 :

348 (strcmp(Modifier+6,"16") == 0) ? 16 : 8;

350 }

352}

353

354

355

356

357void X86AsmPrinter::PrintPCRelImm(const MachineInstr *MI, unsigned OpNo,

361 default: llvm_unreachable("Unknown pcrel immediate operand");

363

364 PrintOperand(MI, OpNo, O);

365 return;

368 return;

370 PrintSymbolOperand(MO, O);

371 return;

372 }

373}

374

375void X86AsmPrinter::PrintLeaMemReference(const MachineInstr *MI, unsigned OpNo,

380

381

382 bool HasBaseReg = BaseReg.getReg() != 0;

383 if (HasBaseReg && Modifier && !strcmp(Modifier, "no-rip") &&

384 BaseReg.getReg() == X86::RIP)

385 HasBaseReg = false;

386

387

388 bool HasParenPart = IndexReg.getReg() || HasBaseReg;

389

390 switch (DispSpec.getType()) {

391 default:

394 int DispVal = DispSpec.getImm();

395 if (DispVal || !HasParenPart)

396 O << DispVal;

397 break;

398 }

401 PrintSymbolOperand(DispSpec, O);

402 break;

403 }

404

405 if (Modifier && strcmp(Modifier, "H") == 0)

406 O << "+8";

407

408 if (HasParenPart) {

410 "X86 doesn't allow scaling by ESP");

411

412 O << '(';

413 if (HasBaseReg)

415

416 if (IndexReg.getReg()) {

417 O << ',';

420 if (ScaleVal != 1)

421 O << ',' << ScaleVal;

422 }

423 O << ')';

424 }

425}

426

428

429 return MI.getDesc().isReturn() && MI.getDesc().isCall();

430}

431

433 unsigned Opc = MI.getOpcode();

434 return MI.getDesc().isIndirectBranch() ||

435 Opc == X86::TAILJMPr || Opc == X86::TAILJMPm ||

436 Opc == X86::TAILJMPr64 || Opc == X86::TAILJMPm64 ||

437 Opc == X86::TCRETURNri || Opc == X86::TCRETURNmi ||

438 Opc == X86::TCRETURNri64 || Opc == X86::TCRETURNmi64 ||

439 Opc == X86::TAILJMPr64_REX || Opc == X86::TAILJMPm64_REX;

440}

441

443 if (Subtarget->hardenSlsRet() || Subtarget->hardenSlsIJmp()) {

451 }

452 }

453 }

456}

457

458void X86AsmPrinter::PrintMemReference(const MachineInstr *MI, unsigned OpNo,

460 assert(isMem(*MI, OpNo) && "Invalid memory reference!");

462 if (Segment.getReg()) {

464 O << ':';

465 }

466 PrintLeaMemReference(MI, OpNo, O, Modifier);

467}

468

469

470void X86AsmPrinter::PrintIntelMemReference(const MachineInstr *MI,

472 const char *Modifier) {

478

479

480 bool HasBaseReg = BaseReg.getReg() != 0;

481 if (HasBaseReg && Modifier && !strcmp(Modifier, "no-rip") &&

482 BaseReg.getReg() == X86::RIP)

483 HasBaseReg = false;

484

485

486 if (Modifier && (DispSpec.isGlobal() || DispSpec.isSymbol()) &&

487 !strcmp(Modifier, "disp-only")) {

488 HasBaseReg = false;

489 }

490

491

492 if (SegReg.getReg()) {

494 O << ':';

495 }

496

497 O << '[';

498

499 bool NeedPlus = false;

500 if (HasBaseReg) {

502 NeedPlus = true;

503 }

504

505 if (IndexReg.getReg()) {

506 if (NeedPlus) O << " + ";

507 if (ScaleVal != 1)

508 O << ScaleVal << '*';

510 NeedPlus = true;

511 }

512

513 if (!DispSpec.isImm()) {

514 if (NeedPlus) O << " + ";

515

516

517 PrintSymbolOperand(DispSpec, O);

518 } else {

519 int64_t DispVal = DispSpec.getImm();

520 if (DispVal || (!IndexReg.getReg() && !HasBaseReg)) {

521 if (NeedPlus) {

522 if (DispVal > 0)

523 O << " + ";

524 else {

525 O << " - ";

526 DispVal = -DispVal;

527 }

528 }

529 O << DispVal;

530 }

531 }

532 O << ']';

533}

534

535const MCSubtargetInfo *X86AsmPrinter::getIFuncMCSubtargetInfo() const {

537 return Subtarget;

538}

539

540void X86AsmPrinter::emitMachOIFuncStubBody(Module &M, const GlobalIFunc &GI,

542

543

544

547 .addReg(X86::RIP)

548 .addImm(1)

549 .addReg(0)

552 .addReg(0),

553 *Subtarget);

554}

555

556void X86AsmPrinter::emitMachOIFuncStubHelperBody(Module &M,

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578 for (int Reg :

579 {X86::RAX, X86::RDI, X86::RSI, X86::RDX, X86::RCX, X86::R8, X86::R9})

581 *Subtarget);

582

586 *Subtarget);

587

590 .addReg(X86::RIP)

591 .addImm(1)

592 .addReg(0)

595 .addReg(0)

596 .addReg(X86::RAX),

597 *Subtarget);

598

599 for (int Reg :

600 {X86::R9, X86::R8, X86::RCX, X86::RDX, X86::RSI, X86::RDI, X86::RAX})

602 *Subtarget);

603

606 .addReg(X86::RIP)

607 .addImm(1)

608 .addReg(0)

611 .addReg(0),

612 *Subtarget);

613}

614

619

620 if (!X86::GR8RegClass.contains(Reg) &&

621 !X86::GR16RegClass.contains(Reg) &&

622 !X86::GR32RegClass.contains(Reg) &&

623 !X86::GR64RegClass.contains(Reg))

624 return true;

625

626 switch (Mode) {

627 default: return true;

628 case 'b':

630 break;

631 case 'h':

633 if (!Reg.isValid())

634 return true;

635 break;

636 case 'w':

638 break;

639 case 'k':

641 break;

642 case 'V':

643 EmitPercent = false;

644 [[fallthrough]];

645 case 'q':

646

647

649 break;

650 }

651

652 if (EmitPercent)

653 O << '%';

654

656 return false;

657}

658

663

664 unsigned Index;

665 if (X86::VR128XRegClass.contains(Reg))

666 Index = Reg - X86::XMM0;

667 else if (X86::VR256XRegClass.contains(Reg))

668 Index = Reg - X86::YMM0;

669 else if (X86::VR512RegClass.contains(Reg))

670 Index = Reg - X86::ZMM0;

671 else

672 return true;

673

674 switch (Mode) {

675 default:

676 return true;

677 case 'x':

678 Reg = X86::XMM0 + Index;

679 break;

680 case 't':

681 Reg = X86::YMM0 + Index;

682 break;

683 case 'g':

684 Reg = X86::ZMM0 + Index;

685 break;

686 }

687

688 if (EmitPercent)

689 O << '%';

690

692 return false;

693}

694

695

696

699

700 if (ExtraCode && ExtraCode[0]) {

701 if (ExtraCode[1] != 0) return true;

702

704

705 switch (ExtraCode[0]) {

706 default:

707

709 case 'a':

711 default:

712 return true;

715 return false;

721 PrintSymbolOperand(MO, O);

723 O << "(%rip)";

724 return false;

726 O << '(';

727 PrintOperand(MI, OpNo, O);

728 O << ')';

729 return false;

730 }

731

732 case 'c':

734 default:

735 PrintOperand(MI, OpNo, O);

736 break;

739 break;

745 PrintSymbolOperand(MO, O);

746 break;

747 }

748 return false;

749

750 case 'A':

751 if (MO.isReg()) {

752 O << '*';

753 PrintOperand(MI, OpNo, O);

754 return false;

755 }

756 return true;

757

758 case 'b':

759 case 'h':

760 case 'w':

761 case 'k':

762 case 'q':

763 case 'V':

766 PrintOperand(MI, OpNo, O);

767 return false;

768

769 case 'x':

770 case 't':

771 case 'g':

774 PrintOperand(MI, OpNo, O);

775 return false;

776

777 case 'p': {

780 return true;

781 PrintSymbolOperand(MO, O);

782 return false;

783 }

784

785 case 'P':

786 PrintPCRelImm(MI, OpNo, O);

787 return false;

788

789 case 'n':

790

791

792 if (MO.isImm()) {

794 return false;

795 }

796 O << '-';

797 }

798 }

799

800 PrintOperand(MI, OpNo, O);

801 return false;

802}

803

805 const char *ExtraCode,

807 if (ExtraCode && ExtraCode[0]) {

808 if (ExtraCode[1] != 0) return true;

809

810 switch (ExtraCode[0]) {

811 default: return true;

812 case 'b':

813 case 'h':

814 case 'w':

815 case 'k':

816 case 'q':

817

818 break;

819 case 'H':

821 return true;

822 } else {

823 PrintMemReference(MI, OpNo, O, "H");

824 }

825 return false;

826

827

828

829 case 'P':

831 PrintIntelMemReference(MI, OpNo, O, "disp-only");

832 } else {

833 PrintMemReference(MI, OpNo, O, "disp-only");

834 }

835 return false;

836 }

837 }

839 PrintIntelMemReference(MI, OpNo, O, nullptr);

840 } else {

841 PrintMemReference(MI, OpNo, O, nullptr);

842 }

843 return false;

844}

845

848

849 if (TT.isOSBinFormatELF()) {

850

851 unsigned FeatureFlagsAnd = 0;

852 if (M.getModuleFlag("cf-protection-branch"))

854 if (M.getModuleFlag("cf-protection-return"))

856

857 if (FeatureFlagsAnd) {

858

859 assert((TT.isArch32Bit() || TT.isArch64Bit()) &&

860 "CFProtection used on invalid architecture!");

865

866

867 const int WordSize = TT.isArch64Bit() && !TT.isX32() ? 8 : 4;

869 OutStreamer->emitIntValue(4, 4 );

870 OutStreamer->emitIntValue(8 + WordSize, 4 );

873

874

877 OutStreamer->emitInt32(FeatureFlagsAnd);

879

881 }

882 }

883

884 if (TT.isOSBinFormatMachO())

886

887 if (TT.isOSBinFormatCOFF()) {

888

894 int64_t Feat00Value = 0;

895

897

898

899

900

901

903 }

904

905 if (M.getModuleFlag("cfguard")) {

906

908 }

909

910 if (M.getModuleFlag("ehcontguard")) {

911

913 }

914

915 if (M.getModuleFlag("ms-kernel")) {

916

918 }

919

923 }

925

926

927

929 if (M.getModuleInlineAsm().empty() && is16)

931}

932

933static void

936

937 OutStreamer.emitLabel(StubLabel);

938

940

942

944 else

945

946

947

948

949

950

953 4 );

954}

955

957

960

961

963

964

966 if (!Stubs.empty()) {

970

971 for (auto &Stub : Stubs)

973

974 Stubs.clear();

976 }

977}

978

979

980

981

982

983

984

985

987

988 if (!TT.isWindowsMSVCEnvironment())

989 return false;

990

993 if (I.getType()->isFPOrFPVectorTy())

994 return true;

995

996 for (const auto &Op : I.operands()) {

997 if (Op->getType()->isFPOrFPVectorTy())

998 return true;

999 }

1000 }

1001 }

1002

1003 return false;

1004}

1005

1008

1009 if (TT.isOSBinFormatMachO()) {

1010

1011

1013

1014

1016

1017

1018

1019

1020

1021

1023 } else if (TT.isOSBinFormatCOFF()) {

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1039 (TT.getArch() == Triple::x86) ? "__fltused" : "_fltused";

1042 return;

1043 }

1044 } else if (TT.isOSBinFormatELF()) {

1046 }

1047

1048

1051 Align Alignment(1);

1054 nullptr, Alignment);

1055 OutStreamer->switchSection(ReadOnlySection);

1057

1060 PtrSize);

1061 }

1062 }

1063}

1064

1065

1066

1067

1068

1069

1073}

static MCDisassembler::DecodeStatus addOperand(MCInst &Inst, const MCOperand &Opnd)

static void emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel, MachineModuleInfoImpl::StubValueTy &MCSym)

Expand Atomic instructions

static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")

Module.h This file contains the declarations for the Module class.

This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...

static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)

static bool printAsmMRegister(const X86AsmPrinter &P, const MachineOperand &MO, char Mode, raw_ostream &O)

LLVM_C_ABI void LLVMInitializeX86AsmPrinter()

static bool isSimpleReturn(const MachineInstr &MI)

static bool usesMSVCFloatingPoint(const Triple &TT, const Module &M)

True if this module is being built for windows/msvc, and uses floating point.

static bool isIndirectBranchOrTailCall(const MachineInstr &MI)

static bool printAsmVRegister(const MachineOperand &MO, char Mode, raw_ostream &O)

static void emitNonLazyStubs(MachineModuleInfo *MMI, MCStreamer &OutStreamer)

This class is intended to be used as a driving class for all asm writers.

const TargetLoweringObjectFile & getObjFileLowering() const

Return information about object file lowering.

MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix) const

Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...

MCSymbol * getSymbol(const GlobalValue *GV) const

void emitNops(unsigned N)

Emit N NOP instructions.

void EmitToStreamer(MCStreamer &S, const MCInst &Inst)

TargetMachine & TM

Target machine description.

void emitXRayTable()

Emit a table with all XRay instrumentation points.

virtual void emitBasicBlockEnd(const MachineBasicBlock &MBB)

Targets can override this to emit stuff at the end of a basic block.

virtual MCSymbol * GetCPISymbol(unsigned CPID) const

Return the symbol for the specified constant pool entry.

const MCAsmInfo * MAI

Target Asm Printer information.

MachineFunction * MF

The current machine function.

virtual void SetupMachineFunction(MachineFunction &MF)

This should be called when a new MachineFunction is being processed from runOnMachineFunction.

void emitFunctionBody()

This method emits the body and trailer for a function.

virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const

This emits linkage information about GVSym based on GV, if this is supported by the target.

void printOffset(int64_t Offset, raw_ostream &OS) const

This is just convenient handler for printing offsets.

MCSymbol * getSymbolPreferLocal(const GlobalValue &GV) const

Similar to getSymbol() but preferred for references.

MCSymbol * CurrentFnSym

The symbol for the current function.

MachineModuleInfo * MMI

This is a pointer to the current MachineModuleInfo.

void emitAlignment(Align Alignment, const GlobalObject *GV=nullptr, unsigned MaxBytesToEmit=0) const

Emit an alignment directive to the specified power of two boundary.

MCContext & OutContext

This is the context for the output file that we are streaming.

MCSymbol * GetExternalSymbolSymbol(Twine Sym) const

Return the MCSymbol for the specified ExternalSymbol.

std::unique_ptr< MCStreamer > OutStreamer

This is the MCStreamer object for the file we are generating.

virtual const MCExpr * lowerConstant(const Constant *CV)

Lower the specified LLVM Constant to an MCExpr.

MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const

Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.

const DataLayout & getDataLayout() const

Return information about data layout.

const MCSubtargetInfo & getSubtargetInfo() const

Return information about subtarget.

virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)

Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.

StringRef getValueAsString() const

Return the attribute's value as a string.

This is the shared class of boolean and integer constants.

This class represents an Operation in the Expression.

void serializeToFaultMapSection()

Attribute getFnAttribute(Attribute::AttrKind Kind) const

Return the attribute for the given attribute kind.

const Constant * getResolver() const

bool hasLocalLinkage() const

Module * getParent()

Get the module that this global value is contained inside of...

bool hasInternalLinkage() const

bool hasDotTypeDotSizeDirective() const

unsigned getCodePointerSize() const

Get the code pointer size in bytes.

static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)

static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)

MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)

Return the MCSection for the specified mach-o section.

MCSymbol * createTempSymbol()

Create a temporary symbol with a unique name.

MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)

MCSymbol * lookupSymbol(const Twine &Name) const

Get the symbol for Name, or null.

MCSymbol * getOrCreateSymbol(const Twine &Name)

Lookup the symbol inside with the specified Name.

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

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

void setOpcode(unsigned Op)

static MCOperand createExpr(const MCExpr *Val)

Instances of this class represent a uniqued identifier for a section in the current translation unit.

Streaming machine code generation interface.

virtual void addBlankLine()

Emit a blank line to a .s file to pretty it up.

virtual bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0

Add the given Attribute to Symbol.

MCContext & getContext() const

void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())

virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())

Emit a label for Symbol into the current section.

virtual void emitIntValue(uint64_t Value, unsigned Size)

Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.

virtual void switchSection(MCSection *Section, uint32_t Subsec=0)

Set the current section where code is being emitted to Section.

Generic base class for all target subtargets.

static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

void print(raw_ostream &OS, const MCAsmInfo *MAI) const

print - Print the value to the stream OS.

StringRef getName() const

getName - Get the symbol name.

iterator getLastNonDebugInstr(bool SkipPseudoOp=true)

Returns an iterator to the last non-debug instruction in the basic block, or end().

MCSymbol * getPICBaseSymbol() const

getPICBaseSymbol - Return a function-local symbol to represent the PIC base.

const TargetSubtargetInfo & getSubtarget() const

getSubtarget - Return the subtarget for which this machine code is being compiled.

StringRef getName() const

getName - Return the name of the corresponding LLVM function.

MCContext & getContext() const

Align getAlignment() const

getAlignment - Return the alignment of the function.

Function & getFunction()

Return the LLVM function that this machine code represents.

Ty * getInfo()

getInfo - Keep track of various per-function pieces of information for backends that would like to do...

Representation of each machine instruction.

InlineAsm::AsmDialect getInlineAsmDialect() const

std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy

PointerIntPair< MCSymbol *, 1, bool > StubValueTy

MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.

SymbolListTy GetGVStubList()

Accessor methods to return the set of stubs in sorted order.

This class contains meta information specific to a module.

const MCContext & getContext() const

Ty & getObjFileInfo()

Keep track of various per-module pieces of information for backends that would like to do so.

MachineOperand class - Representation of each machine instruction operand.

const GlobalValue * getGlobal() const

bool isReg() const

isReg - Tests if this is a MO_Register operand.

bool isImm() const

isImm - Tests if this is a MO_Immediate operand.

bool isSymbol() const

isSymbol - Tests if this is a MO_ExternalSymbol operand.

const BlockAddress * getBlockAddress() const

MachineInstr * getParent()

getParent - Return the instruction that this operand belongs to.

unsigned getTargetFlags() const

bool isGlobal() const

isGlobal - Tests if this is a MO_GlobalAddress operand.

MachineOperandType getType() const

getType - Returns the MachineOperandType for this operand.

Register getReg() const

getReg - Returns the register number.

@ MO_Immediate

Immediate operand.

@ MO_ConstantPoolIndex

Address of indexed Constant in Constant Pool.

@ MO_GlobalAddress

Address of a global value.

@ MO_BlockAddress

Address of a basic block.

@ MO_Register

Register operand.

@ MO_ExternalSymbol

Name of external global symbol.

@ MO_JumpTableIndex

Address of indexed Jump Table for switch.

int64_t getOffset() const

Return the offset from the symbol in this operand.

A Module instance is used to store all the information related to an LLVM module.

PointerIntPair - This class implements a pair of a pointer and small integer.

PointerTy getPointer() const

Wrapper class representing virtual and physical registers.

static SectionKind getMetadata()

static SectionKind getReadOnly()

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

bool getAsInteger(unsigned Radix, T &Result) const

Parse the current string as an integer of the specified radix.

virtual MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const

Given a constant with the SectionKind, return a section that it should be placed in.

Primary interface to the complete machine description for the target machine.

const Triple & getTargetTriple() const

const Target & getTarget() const

CodeModel::Model getCodeModel() const

Returns the code model.

MCCodeEmitter * createMCCodeEmitter(const MCInstrInfo &II, MCContext &Ctx) const

createMCCodeEmitter - Create a target specific code emitter.

Triple - Helper class for working with autoconf configuration names.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

static const char * getRegisterName(MCRegister Reg)

bool runOnMachineFunction(MachineFunction &MF) override

runOnMachineFunction - Emit the function body.

void emitKCFITypeId(const MachineFunction &MF) override

emitKCFITypeId - Emit the KCFI type information in architecture specific format.

void emitStartOfAsmFile(Module &M) override

This virtual method can be overridden by targets that want to emit something at the start of their fi...

void emitEndOfAsmFile(Module &M) override

This virtual method can be overridden by targets that want to emit something at the end of their file...

void emitFunctionBodyEnd() override

Targets can override this to emit stuff after the last basic block in the function.

bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &O) override

Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...

void emitBasicBlockEnd(const MachineBasicBlock &MBB) override

Targets can override this to emit stuff at the end of a basic block.

X86AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)

bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &O) override

PrintAsmOperand - Print out an operand for an inline asm expression.

void emitFunctionBodyStart() override

Targets can override this to emit stuff before the first basic block in the function.

X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...

unsigned getArgumentStackSize() const

const X86InstrInfo * getInstrInfo() const override

bool isTargetCOFF() const

bool isPICStyleRIPRel() const

bool isTargetWin32() const

X86 target streamer implementing x86-only assembly directives.

virtual bool emitFPOProc(const MCSymbol *ProcSym, unsigned ParamsSize, SMLoc L={})

virtual bool emitFPOEndProc(SMLoc L={})

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

#define llvm_unreachable(msg)

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

@ IMAGE_SYM_CLASS_EXTERNAL

External symbol.

@ IMAGE_SYM_CLASS_STATIC

Static.

@ IMAGE_SYM_DTYPE_NULL

No complex type; simple scalar variable.

@ IMAGE_SYM_DTYPE_FUNCTION

A function that returns a base type.

@ SCT_COMPLEX_TYPE_SHIFT

Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))

@ GNU_PROPERTY_X86_FEATURE_1_AND

@ GNU_PROPERTY_X86_FEATURE_1_SHSTK

@ GNU_PROPERTY_X86_FEATURE_1_IBT

@ S_NON_LAZY_SYMBOL_POINTERS

S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.

Reg

All possible values of the reg field in the ModR/M byte.

@ MO_TLSLD

MO_TLSLD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...

@ MO_GOTPCREL_NORELAX

MO_GOTPCREL_NORELAX - Same as MO_GOTPCREL except that R_X86_64_GOTPCREL relocations are guaranteed to...

@ MO_GOTOFF

MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...

@ MO_DARWIN_NONLAZY_PIC_BASE

MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...

@ MO_GOT_ABSOLUTE_ADDRESS

MO_GOT_ABSOLUTE_ADDRESS - On a symbol operand, this represents a relocation of: SYMBOL_LABEL + [.

@ MO_COFFSTUB

MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....

@ MO_NTPOFF

MO_NTPOFF - On a symbol operand this indicates that the immediate is the negative thread-pointer offs...

@ MO_DARWIN_NONLAZY

MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...

@ MO_INDNTPOFF

MO_INDNTPOFF - On a symbol operand this indicates that the immediate is the absolute address of the G...

@ MO_GOTNTPOFF

MO_GOTNTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry w...

@ MO_TPOFF

MO_TPOFF - On a symbol operand this indicates that the immediate is the thread-pointer offset for the...

@ MO_TLVP_PIC_BASE

MO_TLVP_PIC_BASE - On a symbol operand this indicates that the immediate is some TLS offset from the ...

@ MO_GOT

MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...

@ MO_PLT

MO_PLT - On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol n...

@ MO_TLSGD

MO_TLSGD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...

@ MO_NO_FLAG

MO_NO_FLAG - No flag for the operand.

@ MO_TLVP

MO_TLVP - On a symbol operand this indicates that the immediate is some TLS offset.

@ MO_DLLIMPORT

MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...

@ MO_GOTTPOFF

MO_GOTTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry wi...

@ MO_SECREL

MO_SECREL - On a symbol operand this indicates that the immediate is the offset from beginning of sec...

@ MO_DTPOFF

MO_DTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...

@ MO_PIC_BASE_OFFSET

MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...

@ MO_TLSLDM

MO_TLSLDM - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...

@ MO_GOTPCREL

MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...

This is an optimization pass for GlobalISel generic memory operations.

static bool isMem(const MachineInstr &MI, unsigned Op)

MCRegister getX86SubSuperRegister(MCRegister Reg, unsigned Size, bool High=false)

Target & getTheX86_32Target()

uint64_t offsetToAlignment(uint64_t Value, Align Alignment)

Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...

@ MCAF_Code16

.code16 (X86) / .code 16 (ARM)

@ MCAF_SubsectionsViaSymbols

.subsections_via_symbols (MachO)

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Target & getTheX86_64Target()

@ MCSA_IndirectSymbol

.indirect_symbol (MachO)

@ MCSA_Global

.type _foo, @gnu_unique_object

@ MCSA_ELF_TypeFunction

.type _foo, STT_FUNC # aka @function

Implement std::hash so that hash_code can be used in STL containers.

This struct is a compact representation of a valid (non-zero power of two) alignment.

RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...