52 SMShadowTracker.startFunction(MF);
129 if (GVSym->
getName()[0] !=
'$')
186 const char *Modifier =
nullptr,
unsigned AsmVariant = 0);
210 unsigned OpNo,
raw_ostream &O,
const char *Modifier,
211 unsigned AsmVariant) {
217 if (AsmVariant == 0) O <<
'%';
219 if (Modifier && strncmp(Modifier,
"subreg", strlen(
"subreg")) == 0) {
230 if (AsmVariant == 0) O <<
'$';
235 if (AsmVariant == 0) O <<
'$';
244 const char *Modifier =
nullptr) {
250 bool HasBaseReg = BaseReg.
getReg() != 0;
251 if (HasBaseReg && Modifier && !strcmp(Modifier,
"no-rip") &&
252 BaseReg.
getReg() == X86::RIP)
256 bool HasParenPart = IndexReg.
getReg() || HasBaseReg;
262 int DispVal = DispSpec.
getImm();
263 if (DispVal || !HasParenPart)
272 if (Modifier && strcmp(Modifier,
"H") == 0)
276 assert(IndexReg.
getReg() != X86::ESP &&
277 "X86 doesn't allow scaling by ESP");
288 O <<
',' << ScaleVal;
296 const char *Modifier =
nullptr) {
297 assert(
isMem(MI, Op) &&
"Invalid memory reference!");
308 const char *Modifier =
nullptr,
309 unsigned AsmVariant = 1) {
324 bool NeedPlus =
false;
331 if (NeedPlus) O <<
" + ";
333 O << ScaleVal <<
'*';
338 if (!DispSpec.
isImm()) {
339 if (NeedPlus) O <<
" + ";
342 int64_t DispVal = DispSpec.
getImm();
343 if (DispVal || (!IndexReg.
getReg() && !BaseReg.
getReg())) {
362 default:
return true;
393 if (ExtraCode && ExtraCode[0]) {
394 if (ExtraCode[1] != 0)
return true;
398 switch (ExtraCode[0]) {
481 unsigned OpNo,
unsigned AsmVariant,
482 const char *ExtraCode,
489 if (ExtraCode && ExtraCode[0]) {
490 if (ExtraCode[1] != 0)
return true;
492 switch (ExtraCode[0]) {
493 default:
return true;
572 if (
MCSymbol *Sym = S->getCOMDATSymbol()) {
573 if (Sym->isUndefined())
596 if (!Stubs.empty()) {
598 "__IMPORT",
"__jump_table",
604 for (
const auto &Stub : Stubs) {
608 OutStreamer->EmitSymbolAttribute(Stub.second.getPointer(),
611 const char HltInsts[] =
"\xf4\xf4\xf4\xf4\xf4";
621 if (!Stubs.empty()) {
627 for (
auto &Stub : Stubs)
635 if (!Stubs.empty()) {
641 for (
auto &Stub : Stubs)
675 for (
const auto &
Global : M.globals())
677 for (
const auto &Alias : M.aliases())
683 if (!Flags.empty()) {
MO_SECREL - On a symbol operand this indicates that the immediate is the offset from beginning of sec...
Instances of this class represent a uniqued identifier for a section in the current translation unit...
SymbolListTy GetGVStubList()
S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
static bool printAsmMRegister(X86AsmPrinter &P, const MachineOperand &MO, char Mode, raw_ostream &O)
SectionKind getSectionKind(const DataLayout *DL) const
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
void LLVMInitializeX86AsmPrinter()
const GlobalValue * getGlobal() const
static const char * getRegisterName(unsigned RegNo)
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
AddrSegmentReg - The operand # of the segment in the memory operand.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol * getSymbol(const GlobalValue *GV) const
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
MO_TLSLD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
MO_TLVP_PIC_BASE - On a symbol operand this indicates that the immediate is some TLS offset from the ...
MCContext & OutContext
This is the context for the output file that we are streaming.
bool runOnMachineFunction(MachineFunction &F) override
runOnMachineFunction - Emit the function body.
Address of indexed Jump Table for switch.
const MachineFunction * MF
The current machine function.
bool isTargetKnownWindowsMSVC() const
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...
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...
MO_DTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
static void printSymbolOperand(X86AsmPrinter &P, const MachineOperand &MO, raw_ostream &O)
printSymbolOperand - Print a raw symbol reference operand.
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
const Triple & getTargetTriple() const
MCSectionCOFF - This represents a section on Windows.
MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static void printPCRelImm(X86AsmPrinter &P, const MachineInstr *MI, unsigned OpNo, raw_ostream &O)
printPCRelImm - This is used to print an immediate value that ends up being encoded as a pc-relative ...
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
No complex type; simple scalar variable.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool hasInternalLinkage() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Name of external global symbol.
Reg
All possible values of the reg field in the ModR/M byte.
bool usesVAFloatArgument() const
MCContext & getContext() const
void EmitFunctionBody()
This method emits the body and trailer for a function.
Mangler * Mang
Name-mangler for global names.
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.
MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
static void printLeaMemReference(X86AsmPrinter &P, const MachineInstr *MI, unsigned Op, raw_ostream &O, const char *Modifier=nullptr)
bool isPICStyleRIPRel() const
MO_GOTTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry wi...
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
static void emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel, MachineModuleInfoImpl::StubValueTy &MCSym)
This class is a data container for one entry in a MachineConstantPool.
static void printOperand(X86AsmPrinter &P, const MachineInstr *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=nullptr, unsigned AsmVariant=0)
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) override
PrintAsmOperand - Print out an operand for an inline asm expression.
unsigned getX86SubSuperRegister(unsigned Reg, MVT::SimpleValueType VT, bool High)
Returns the sub or super register of a specific X86 register.
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...
MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...
SymbolListTy GetFnStubList()
Accessor methods to return the set of stubs in sorted order.
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is a...
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
MO_DARWIN_STUB - On a symbol operand "FOO", this indicates that the reference is actually to the "FOO...
const Constant * ConstVal
Address of a global value.
unsigned getTargetFlags() const
Streaming machine code generation interface.
MCSymbol * CurrentFnSym
The symbol for the current function.
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
MO_GOT_ABSOLUTE_ADDRESS - On a symbol operand, this represents a relocation of: SYMBOL_LABEL + [...
const MCAsmInfo * MAI
Target Asm Printer information.
PointerIntPair - This class implements a pair of a pointer and small integer.
bool isTargetCOFF() const
MO_GOTNTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry w...
MO_TLVP - On a symbol operand this indicates that the immediate is some TLS offset.
This is an important base class in LLVM.
const MachineOperand & getOperand(unsigned i) const
MO_TLSLDM - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
TargetMachine & TM
Target machine description.
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
.subsections_via_symbols (MachO)
SectionKind - This is a simple POD value that classifies the properties of a section.
A function that returns a base type.
MCSection * getDrectveSection() const
int64_t getOffset() const
Return the offset from the symbol in this operand.
MO_NTPOFF - On a symbol operand this indicates that the immediate is the negative thread-pointer offs...
Ty & getObjFileInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
Triple - Helper class for working with autoconf configuration names.
MO_TLSGD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
void serializeToStackMapSection()
If there is any stack map data, create a stack map section and serialize the map info into it...
MO_TPOFF - On a symbol operand this indicates that the immediate is the thread-pointer offset for the...
PointerTy getPointer() const
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
virtual void EmitLabel(MCSymbol *Symbol)
Emit a label for Symbol into the current section.
SymbolListTy GetHiddenGVStubList()
const MCContext & getContext() const
const DataLayout * getDataLayout() const
Deprecated in 3.7, will be removed in 3.8.
void serializeToFaultMapSection()
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
void EmitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
const X86Subtarget & getSubtarget() const
static SectionKind getMetadata()
MCSymbol * GetCPISymbol(unsigned CPID) const override
Return the symbol for the specified constant pool entry.
static void printMemReference(X86AsmPrinter &P, const MachineInstr *MI, unsigned Op, raw_ostream &O, const char *Modifier=nullptr)
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...
void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
StringRef getName() const
getName - Get the symbol name.
MO_INDNTPOFF - On a symbol operand this indicates that the immediate is the absolute address of the G...
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
static void printIntelMemReference(X86AsmPrinter &P, const MachineInstr *MI, unsigned Op, raw_ostream &O, const char *Modifier=nullptr, unsigned AsmVariant=1)
void EmitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
union llvm::MachineConstantPoolEntry::@30 Val
The constant itself.
S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by dyld.
static bool isMem(const MachineInstr *MI, unsigned Op)
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
void EmitValue(const MCExpr *Value, unsigned Size, const SMLoc &Loc=SMLoc())
MO_PLT - On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol n...
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
unsigned getReg() const
getReg - Returns the register number.
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
A raw_ostream that writes to an std::string.
bool isKnownWindowsMSVCEnvironment() const
RegisterAsmPrinter - Helper template for registering a target specific assembly printer, for use in the target machine initialization function.
This class implements an extremely fast bulk output stream that can only output to a stream...
MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...
const std::vector< MachineConstantPoolEntry > & getConstants() const
StringRef - Represent a constant reference to a string, i.e.
Address of indexed Constant in Constant Pool.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
void emitLinkerFlagsForGlobal(raw_ostream &OS, const GlobalValue *GV, const Mangler &Mang) const override
MachineModuleInfoImpl - This class can be derived from and used by targets to hold private target-spe...
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...