131 if (GVSym->
getName()[0] !=
'$')
134 O <<
'(' << *GVSym <<
')';
148 if (StubSym.getPointer() == 0) {
149 TempNameStr.erase(TempNameStr.
end()-5, TempNameStr.
end());
154 SymToPrint = StubSym.getPointer();
161 if (SymToPrint->
getName()[0] !=
'$')
164 O <<
'(' << *SymToPrint <<
'(';
236 unsigned AsmVariant) {
242 if (AsmVariant == 0) O <<
'%';
244 if (Modifier &&
strncmp(Modifier,
"subreg",
strlen(
"subreg")) == 0) {
255 if (AsmVariant == 0) O <<
'$';
263 if (AsmVariant == 0) O <<
'$';
277 bool HasBaseReg = BaseReg.
getReg() != 0;
278 if (HasBaseReg && Modifier && !
strcmp(Modifier,
"no-rip") &&
279 BaseReg.
getReg() == X86::RIP)
283 bool HasParenPart = IndexReg.
getReg() || HasBaseReg;
285 if (DispSpec.
isImm()) {
286 int DispVal = DispSpec.
getImm();
287 if (DispVal || !HasParenPart)
295 if (Modifier &&
strcmp(Modifier,
"H") == 0)
300 "X86 doesn't allow scaling by ESP");
311 O <<
',' << ScaleVal;
319 assert(
isMem(MI, Op) &&
"Invalid memory reference!");
330 unsigned AsmVariant){
345 bool NeedPlus =
false;
352 if (NeedPlus) O <<
" + ";
354 O << ScaleVal <<
'*';
359 if (!DispSpec.
isImm()) {
360 if (NeedPlus) O <<
" + ";
363 int64_t DispVal = DispSpec.
getImm();
364 if (DispVal || (!IndexReg.
getReg() && !BaseReg.
getReg())) {
383 default:
return true;
412 if (ExtraCode && ExtraCode[0]) {
413 if (ExtraCode[1] != 0)
return true;
417 switch (ExtraCode[0]) {
487 unsigned OpNo,
unsigned AsmVariant,
488 const char *ExtraCode,
495 if (ExtraCode && ExtraCode[0]) {
496 if (ExtraCode[1] != 0)
return true;
498 switch (ExtraCode[0]) {
499 default:
return true;
556 if (!Stubs.empty()) {
560 MCSectionMachO::S_ATTR_SELF_MODIFYING_CODE |
561 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
565 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
572 const char HltInsts[] =
"\xf4\xf4\xf4\xf4\xf4";
582 if (!Stubs.empty()) {
589 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
615 if (!Stubs.empty()) {
619 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
624 Create(Stubs[i].second.getPointer(),
665 std::vector<const MCSymbol*> DLLExportedFns, DLLExportedGlobals;
671 if (
I->hasDLLExportLinkage())
676 if (
I->hasDLLExportLinkage())
680 if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
683 for (
unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) {
688 name += DLLExportedGlobals[i]->getName();
696 for (
unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) {
701 name += DLLExportedFns[i]->getName();
715 if (!Stubs.empty()) {
719 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
int strcmp(const char *s1, const char *s2);
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
void LLVMInitializeX86AsmPrinter()
const GlobalValue * getGlobal() const
static const char * getRegisterName(unsigned RegNo)
MCSymbol * getSymbol(const GlobalValue *GV) const
MachineBasicBlock * getMBB() const
static const MCConstantExpr * Create(int64_t Value, MCContext &Ctx)
The main container class for the LLVM Intermediate Representation.
virtual void AddBlankLine()
AddBlankLine - Emit a blank line to a .s file to pretty it up.
bool isTargetCygMing() const
externals_iterator externals_begin() const
unsigned getPointerSize(unsigned AS=0) const
void setAbsolute()
setAbsolute - Mark the symbol as absolute.
const MCSection * getDrectveSection() const
const MachineFunction * MF
The current machine function.
SymbolListTy GetFnStubList() const
Accessor methods to return the set of stubs in sorted order.
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=0, unsigned AsmVariant=0)
std::string str() const
str - Get the contents as an std::string.
const char * getSymbolName() const
const Function * getFunction() const
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
SymbolListTy GetGVStubList() const
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value)=0
MCSymbol * GetSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix, bool ForcePrivate=true) const
Address of indexed Jump Table for switch.
virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) LLVM_OVERRIDE
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
MCSymbol * GetOrCreateSymbol(StringRef Name)
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) LLVM_OVERRIDE
void printPCRelImm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O)
No complex type; simple scalar variable.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
#define llvm_unreachable(msg)
bool hasInternalLinkage() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
virtual void EmitBytes(StringRef Data)=0
MCSymbol * GetJTISymbol(unsigned JTID, bool isLinkerPrivate=false) const
GetJTISymbol - Return the symbol for the specified jump table entry.
void printSymbolOperand(const MachineOperand &MO, raw_ostream &O)
bool usesVAFloatArgument() const
global_iterator global_begin()
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
void SwitchSection(const MCSection *Section, const MCExpr *Subsection=0)
virtual void EmitEndOfAsmFile(Module &M) LLVM_OVERRIDE
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
bool isPICStyleRIPRel() const
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol)=0
bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O)
virtual void EmitStartOfAsmFile(Module &M) LLVM_OVERRIDE
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Address of indexed Constant in Constant Pool.
void EmitValue(const MCExpr *Value, unsigned Size)
MachineModuleInfo * MMI
MMI - This is a pointer to the current MachineModuleInfo.
SymbolListTy GetGVStubList() const
Accessor methods to return the set of stubs in sorted order.
virtual bool runOnMachineFunction(MachineFunction &F) LLVM_OVERRIDE
unsigned getX86SubSuperRegister(unsigned Reg, MVT::SimpleValueType VT, bool High)
externals_iterator externals_end() const
static const MCSymbolRefExpr * Create(const MCSymbol *Symbol, MCContext &Ctx)
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag)=0
EmitAssemblerFlag - Note in the output the specified Flag.
void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O, const char *Modifier=NULL)
unsigned getTargetFlags() const
void EmitFunctionHeader()
bool isTargetCOFF() const
const MachineOperand & getOperand(unsigned i) const
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
EmitSymbolAttribute - Add the given Attribute to Symbol.
void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O, const char *Modifier=NULL)
void printOffset(int64_t Offset, raw_ostream &OS) const
printOffset - This is just convenient handler for printing offsets.
.subsections_via_symbols (MachO)
A function that returns a base type.
int64_t getOffset() const
MCSymbol * getSymbol() const
void serializeToStackMapSection()
bool isTargetWindows() const
global_iterator global_end()
PointerTy getPointer() const
virtual void EmitCOFFSymbolType(int Type)=0
MCSymbol * getPICBaseSymbol() const
virtual void EmitLabel(MCSymbol *Symbol)
const MCContext & getContext() const
static SectionKind getMetadata()
size_t strlen(const char *s);
virtual void EndCOFFSymbolDef()=0
EndCOFFSymbolDef - Marks the end of the symbol definition.
MachineOperandType getType() const
void SetupMachineFunction(MachineFunction &MF)
StringRef getName() const
getName - Get the symbol name.
virtual const DataLayout * getDataLayout() const
void EmitAlignment(unsigned NumBits, const GlobalValue *GV=0) const
static bool isMem(const MachineInstr *MI, unsigned Op)
void printIntelMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O, const char *Modifier=NULL, unsigned AsmVariant=1)
MCSymbol * GetCPISymbol(unsigned CPID) const
GetCPISymbol - Return the symbol for the specified constant pool entry.
unsigned getReg() const
getReg - Returns the register number.
const TargetLoweringObjectFile & getObjFileLowering() const
getObjFileLowering - Return information about object file lowering.
const MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K)
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
const MCSection * getDataRelSection() const
int strncmp(const char *s1, const char *s2, size_t n);
virtual void EmitCOFFSymbolStorageClass(int StorageClass)=0
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
SymbolListTy GetHiddenGVStubList() const
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
MachineBasicBlock reference.
bool isTargetEnvMacho() const
Address of a global value.
Name of external global symbol.