mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Add a helper getSymbol to AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193627 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -145,6 +145,7 @@ namespace llvm {
|
|||||||
/// getCurrentSection() - Return the current section we are emitting to.
|
/// getCurrentSection() - Return the current section we are emitting to.
|
||||||
const MCSection *getCurrentSection() const;
|
const MCSection *getCurrentSection() const;
|
||||||
|
|
||||||
|
MCSymbol *getSymbol(const GlobalValue *GV) const;
|
||||||
|
|
||||||
//===------------------------------------------------------------------===//
|
//===------------------------------------------------------------------===//
|
||||||
// MachineFunctionPass Implementation.
|
// MachineFunctionPass Implementation.
|
||||||
|
@ -82,7 +82,7 @@ void ARMException::EndFunction() {
|
|||||||
// Emit references to personality.
|
// Emit references to personality.
|
||||||
if (const Function * Personality =
|
if (const Function * Personality =
|
||||||
MMI->getPersonalities()[MMI->getPersonalityIndex()]) {
|
MMI->getPersonalities()[MMI->getPersonalityIndex()]) {
|
||||||
MCSymbol *PerSym = Asm->Mang->getSymbol(Personality);
|
MCSymbol *PerSym = Asm->getSymbol(Personality);
|
||||||
Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global);
|
Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global);
|
||||||
ATS.emitPersonality(PerSym);
|
ATS.emitPersonality(PerSym);
|
||||||
}
|
}
|
||||||
|
@ -263,6 +263,9 @@ void AsmPrinter::EmitLinkage(unsigned L, MCSymbol *GVSym) const {
|
|||||||
llvm_unreachable("Unknown linkage type!");
|
llvm_unreachable("Unknown linkage type!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {
|
||||||
|
return Mang->getSymbol(GV);
|
||||||
|
}
|
||||||
|
|
||||||
/// EmitGlobalVariable - Emit the specified global variable to the .s file.
|
/// EmitGlobalVariable - Emit the specified global variable to the .s file.
|
||||||
void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||||
@ -278,7 +281,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *GVSym = Mang->getSymbol(GV);
|
MCSymbol *GVSym = getSymbol(GV);
|
||||||
EmitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration());
|
EmitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration());
|
||||||
|
|
||||||
if (!GV->hasInitializer()) // External globals require no extra code.
|
if (!GV->hasInitializer()) // External globals require no extra code.
|
||||||
@ -879,7 +882,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
if (V == GlobalValue::DefaultVisibility)
|
if (V == GlobalValue::DefaultVisibility)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MCSymbol *Name = Mang->getSymbol(&F);
|
MCSymbol *Name = getSymbol(&F);
|
||||||
EmitVisibility(Name, V, false);
|
EmitVisibility(Name, V, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,12 +922,12 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (!I->hasExternalWeakLinkage()) continue;
|
if (!I->hasExternalWeakLinkage()) continue;
|
||||||
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
|
OutStreamer.EmitSymbolAttribute(getSymbol(I), MCSA_WeakReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||||
if (!I->hasExternalWeakLinkage()) continue;
|
if (!I->hasExternalWeakLinkage()) continue;
|
||||||
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
|
OutStreamer.EmitSymbolAttribute(getSymbol(I), MCSA_WeakReference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,10 +935,10 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
OutStreamer.AddBlankLine();
|
OutStreamer.AddBlankLine();
|
||||||
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
|
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
MCSymbol *Name = Mang->getSymbol(I);
|
MCSymbol *Name = getSymbol(I);
|
||||||
|
|
||||||
const GlobalValue *GV = I->getAliasedGlobal();
|
const GlobalValue *GV = I->getAliasedGlobal();
|
||||||
MCSymbol *Target = Mang->getSymbol(GV);
|
MCSymbol *Target = getSymbol(GV);
|
||||||
|
|
||||||
if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())
|
if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())
|
||||||
OutStreamer.EmitSymbolAttribute(Name, MCSA_Global);
|
OutStreamer.EmitSymbolAttribute(Name, MCSA_Global);
|
||||||
@ -984,7 +987,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
||||||
this->MF = &MF;
|
this->MF = &MF;
|
||||||
// Get the function symbol.
|
// Get the function symbol.
|
||||||
CurrentFnSym = Mang->getSymbol(MF.getFunction());
|
CurrentFnSym = getSymbol(MF.getFunction());
|
||||||
CurrentFnSymForSize = CurrentFnSym;
|
CurrentFnSymForSize = CurrentFnSym;
|
||||||
|
|
||||||
if (isVerbose())
|
if (isVerbose())
|
||||||
@ -1291,7 +1294,7 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) {
|
|||||||
const GlobalValue *GV =
|
const GlobalValue *GV =
|
||||||
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
|
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
|
||||||
if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang))
|
if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang))
|
||||||
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(GV), MCSA_NoDeadStrip);
|
OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,7 +1489,7 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
|
|||||||
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
||||||
|
|
||||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
||||||
return MCSymbolRefExpr::Create(AP.Mang->getSymbol(GV), Ctx);
|
return MCSymbolRefExpr::Create(AP.getSymbol(GV), Ctx);
|
||||||
|
|
||||||
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
||||||
return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
|
return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
|
||||||
|
@ -68,7 +68,7 @@ void DwarfCFIException::EndModule() {
|
|||||||
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
||||||
if (!Personalities[i])
|
if (!Personalities[i])
|
||||||
continue;
|
continue;
|
||||||
MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
|
MCSymbol *Sym = Asm->getSymbol(Personalities[i]);
|
||||||
TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
|
TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
|
||||||
AtLeastOne = true;
|
AtLeastOne = true;
|
||||||
}
|
}
|
||||||
|
@ -1308,7 +1308,7 @@ CompileUnit::constructTemplateValueParameterDIE(DIE &Buffer,
|
|||||||
// For declaration non-type template parameters (such as global values and
|
// For declaration non-type template parameters (such as global values and
|
||||||
// functions)
|
// functions)
|
||||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||||
addOpAddress(Block, Asm->Mang->getSymbol(GV));
|
addOpAddress(Block, Asm->getSymbol(GV));
|
||||||
// Emit DW_OP_stack_value to use the address as the immediate value of the
|
// Emit DW_OP_stack_value to use the address as the immediate value of the
|
||||||
// parameter, rather than a pointer to it.
|
// parameter, rather than a pointer to it.
|
||||||
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
|
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
|
||||||
@ -1541,7 +1541,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
|
|||||||
if (isGlobalVariable) {
|
if (isGlobalVariable) {
|
||||||
addToAccelTable = true;
|
addToAccelTable = true;
|
||||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||||
const MCSymbol *Sym = Asm->Mang->getSymbol(GV.getGlobal());
|
const MCSymbol *Sym = Asm->getSymbol(GV.getGlobal());
|
||||||
if (GV.getGlobal()->isThreadLocal()) {
|
if (GV.getGlobal()->isThreadLocal()) {
|
||||||
// FIXME: Make this work with -gsplit-dwarf.
|
// FIXME: Make this work with -gsplit-dwarf.
|
||||||
unsigned PointerSize = Asm->getDataLayout().getPointerSize();
|
unsigned PointerSize = Asm->getDataLayout().getPointerSize();
|
||||||
@ -1601,7 +1601,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
|
|||||||
// GV is a merged global.
|
// GV is a merged global.
|
||||||
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
|
||||||
Value *Ptr = CE->getOperand(0);
|
Value *Ptr = CE->getOperand(0);
|
||||||
addOpAddress(Block, Asm->Mang->getSymbol(cast<GlobalValue>(Ptr)));
|
addOpAddress(Block, Asm->getSymbol(cast<GlobalValue>(Ptr)));
|
||||||
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
|
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
|
||||||
SmallVector<Value *, 3> Idx(CE->op_begin() + 1, CE->op_end());
|
SmallVector<Value *, 3> Idx(CE->op_begin() + 1, CE->op_end());
|
||||||
addUInt(Block, dwarf::DW_FORM_udata,
|
addUInt(Block, dwarf::DW_FORM_udata,
|
||||||
|
@ -84,7 +84,7 @@ bool AArch64AsmPrinter::printSymbolicAddress(const MachineOperand &MO,
|
|||||||
default:
|
default:
|
||||||
llvm_unreachable("Unexpected operand for symbolic address constraint");
|
llvm_unreachable("Unexpected operand for symbolic address constraint");
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
Name = Mang->getSymbol(MO.getGlobal())->getName();
|
Name = getSymbol(MO.getGlobal())->getName();
|
||||||
|
|
||||||
// Global variables may be accessed either via a GOT or in various fun and
|
// Global variables may be accessed either via a GOT or in various fun and
|
||||||
// interesting TLS-model specific ways. Set the prefix modifier as
|
// interesting TLS-model specific ways. Set the prefix modifier as
|
||||||
|
@ -121,7 +121,7 @@ bool AArch64AsmPrinter::lowerOperand(const MachineOperand &MO,
|
|||||||
MCOp = lowerSymbolOperand(MO, GetExternalSymbolSymbol(MO.getSymbolName()));
|
MCOp = lowerSymbolOperand(MO, GetExternalSymbolSymbol(MO.getSymbolName()));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
MCOp = lowerSymbolOperand(MO, Mang->getSymbol(MO.getGlobal()));
|
MCOp = lowerSymbolOperand(MO, getSymbol(MO.getGlobal()));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_MachineBasicBlock:
|
case MachineOperand::MO_MachineBasicBlock:
|
||||||
MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
|
MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
|
||||||
|
@ -145,7 +145,7 @@ void ARMAsmPrinter::EmitXXStructor(const Constant *CV) {
|
|||||||
const GlobalValue *GV = dyn_cast<GlobalValue>(CV->stripPointerCasts());
|
const GlobalValue *GV = dyn_cast<GlobalValue>(CV->stripPointerCasts());
|
||||||
assert(GV && "C++ constructor pointer was not a GlobalValue!");
|
assert(GV && "C++ constructor pointer was not a GlobalValue!");
|
||||||
|
|
||||||
const MCExpr *E = MCSymbolRefExpr::Create(Mang->getSymbol(GV),
|
const MCExpr *E = MCSymbolRefExpr::Create(getSymbol(GV),
|
||||||
(Subtarget->isTargetDarwin()
|
(Subtarget->isTargetDarwin()
|
||||||
? MCSymbolRefExpr::VK_None
|
? MCSymbolRefExpr::VK_None
|
||||||
: MCSymbolRefExpr::VK_ARM_TARGET1),
|
: MCSymbolRefExpr::VK_ARM_TARGET1),
|
||||||
@ -206,7 +206,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
|||||||
else if ((Modifier && strcmp(Modifier, "hi16") == 0) ||
|
else if ((Modifier && strcmp(Modifier, "hi16") == 0) ||
|
||||||
(TF & ARMII::MO_HI16))
|
(TF & ARMII::MO_HI16))
|
||||||
O << ":upper16:";
|
O << ":upper16:";
|
||||||
O << *Mang->getSymbol(GV);
|
O << *getSymbol(GV);
|
||||||
|
|
||||||
printOffset(MO.getOffset(), O);
|
printOffset(MO.getOffset(), O);
|
||||||
if (TF == ARMII::MO_PLT)
|
if (TF == ARMII::MO_PLT)
|
||||||
@ -758,7 +758,7 @@ MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV) {
|
|||||||
bool isIndirect = Subtarget->isTargetDarwin() &&
|
bool isIndirect = Subtarget->isTargetDarwin() &&
|
||||||
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
|
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
|
||||||
if (!isIndirect)
|
if (!isIndirect)
|
||||||
return Mang->getSymbol(GV);
|
return getSymbol(GV);
|
||||||
|
|
||||||
// FIXME: Remove this when Darwin transition to @GOT like syntax.
|
// FIXME: Remove this when Darwin transition to @GOT like syntax.
|
||||||
MCSymbol *MCSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
MCSymbol *MCSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||||
@ -769,7 +769,7 @@ MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV) {
|
|||||||
MMIMachO.getGVStubEntry(MCSym);
|
MMIMachO.getGVStubEntry(MCSym);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
return MCSym;
|
return MCSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1203,7 +1203,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
.addReg(0));
|
.addReg(0));
|
||||||
|
|
||||||
const GlobalValue *GV = MI->getOperand(0).getGlobal();
|
const GlobalValue *GV = MI->getOperand(0).getGlobal();
|
||||||
MCSymbol *GVSym = Mang->getSymbol(GV);
|
MCSymbol *GVSym = getSymbol(GV);
|
||||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::Create(GVSym, OutContext);
|
const MCExpr *GVSymExpr = MCSymbolRefExpr::Create(GVSym, OutContext);
|
||||||
OutStreamer.EmitInstruction(MCInstBuilder(ARM::Bcc)
|
OutStreamer.EmitInstruction(MCInstBuilder(ARM::Bcc)
|
||||||
.addExpr(GVSymExpr)
|
.addExpr(GVSymExpr)
|
||||||
|
@ -82,7 +82,7 @@ bool ARMAsmPrinter::lowerOperand(const MachineOperand &MO,
|
|||||||
MO.getMBB()->getSymbol(), OutContext));
|
MO.getMBB()->getSymbol(), OutContext));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
MCOp = GetSymbolRef(MO, Mang->getSymbol(MO.getGlobal()));
|
MCOp = GetSymbolRef(MO, getSymbol(MO.getGlobal()));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
MCOp = GetSymbolRef(MO,
|
MCOp = GetSymbolRef(MO,
|
||||||
|
@ -99,7 +99,7 @@ void HexagonAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
return;
|
return;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
// Computing the address of a global symbol, not calling it.
|
// Computing the address of a global symbol, not calling it.
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
printOffset(MO.getOffset(), O);
|
printOffset(MO.getOffset(), O);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ void HexagonAsmPrinter::printGlobalOperand(const MachineInstr *MI, int OpNo,
|
|||||||
assert( (MO.getType() == MachineOperand::MO_GlobalAddress) &&
|
assert( (MO.getType() == MachineOperand::MO_GlobalAddress) &&
|
||||||
"Expecting global address");
|
"Expecting global address");
|
||||||
|
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
if (MO.getOffset() != 0) {
|
if (MO.getOffset() != 0) {
|
||||||
O << " + ";
|
O << " + ";
|
||||||
O << MO.getOffset();
|
O << MO.getOffset();
|
||||||
|
@ -73,7 +73,7 @@ void llvm::HexagonLowerToMC(const MachineInstr* MI, HexagonMCInst& MCI,
|
|||||||
AP.OutContext));
|
AP.OutContext));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
MCO = GetSymbolRef(MO, AP.Mang->getSymbol(MO.getGlobal()), AP);
|
MCO = GetSymbolRef(MO, AP.getSymbol(MO.getGlobal()), AP);
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
MCO = GetSymbolRef(MO, AP.GetExternalSymbolSymbol(MO.getSymbolName()),
|
MCO = GetSymbolRef(MO, AP.GetExternalSymbolSymbol(MO.getSymbolName()),
|
||||||
|
@ -92,7 +92,7 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
|||||||
if (Offset)
|
if (Offset)
|
||||||
O << '(' << Offset << '+';
|
O << '(' << Offset << '+';
|
||||||
|
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
|
|
||||||
if (Offset)
|
if (Offset)
|
||||||
O << ')';
|
O << ')';
|
||||||
|
@ -33,7 +33,7 @@ GetGlobalAddressSymbol(const MachineOperand &MO) const {
|
|||||||
case 0: break;
|
case 0: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Printer.Mang->getSymbol(MO.getGlobal());
|
return Printer.getSymbol(MO.getGlobal());
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *MSP430MCInstLower::
|
MCSymbol *MSP430MCInstLower::
|
||||||
|
@ -528,7 +528,7 @@ void MipsAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MachineOperand::MO_BlockAddress: {
|
case MachineOperand::MO_BlockAddress: {
|
||||||
|
@ -73,7 +73,7 @@ MCOperand MipsMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
Symbol = AsmPrinter.Mang->getSymbol(MO.getGlobal());
|
Symbol = AsmPrinter.getSymbol(MO.getGlobal());
|
||||||
Offset += MO.getOffset();
|
Offset += MO.getOffset();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ const MCExpr *nvptx::LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
|||||||
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
||||||
|
|
||||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
||||||
return MCSymbolRefExpr::Create(AP.Mang->getSymbol(GV), Ctx);
|
return MCSymbolRefExpr::Create(AP.getSymbol(GV), Ctx);
|
||||||
|
|
||||||
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
||||||
return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
|
return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
|
||||||
@ -341,7 +341,7 @@ bool NVPTXAsmPrinter::lowerOperand(const MachineOperand &MO,
|
|||||||
MCOp = GetSymbolRef(MO, GetExternalSymbolSymbol(MO.getSymbolName()));
|
MCOp = GetSymbolRef(MO, GetExternalSymbolSymbol(MO.getSymbolName()));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
MCOp = GetSymbolRef(MO, Mang->getSymbol(MO.getGlobal()));
|
MCOp = GetSymbolRef(MO, getSymbol(MO.getGlobal()));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_FPImmediate: {
|
case MachineOperand::MO_FPImmediate: {
|
||||||
const ConstantFP *Cnt = MO.getFPImm();
|
const ConstantFP *Cnt = MO.getFPImm();
|
||||||
@ -677,7 +677,7 @@ void NVPTXAsmPrinter::emitDeclaration(const Function *F, raw_ostream &O) {
|
|||||||
else
|
else
|
||||||
O << ".func ";
|
O << ".func ";
|
||||||
printReturnValStr(F, O);
|
printReturnValStr(F, O);
|
||||||
O << *Mang->getSymbol(F) << "\n";
|
O << *getSymbol(F) << "\n";
|
||||||
emitFunctionParamList(F, O);
|
emitFunctionParamList(F, O);
|
||||||
O << ";\n";
|
O << ";\n";
|
||||||
}
|
}
|
||||||
@ -1207,7 +1207,7 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
|||||||
else
|
else
|
||||||
O << getPTXFundamentalTypeStr(ETy, false);
|
O << getPTXFundamentalTypeStr(ETy, false);
|
||||||
O << " ";
|
O << " ";
|
||||||
O << *Mang->getSymbol(GVar);
|
O << *getSymbol(GVar);
|
||||||
|
|
||||||
// Ptx allows variable initilization only for constant and global state
|
// Ptx allows variable initilization only for constant and global state
|
||||||
// spaces.
|
// spaces.
|
||||||
@ -1243,15 +1243,15 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
|||||||
bufferAggregateConstant(Initializer, &aggBuffer);
|
bufferAggregateConstant(Initializer, &aggBuffer);
|
||||||
if (aggBuffer.numSymbols) {
|
if (aggBuffer.numSymbols) {
|
||||||
if (nvptxSubtarget.is64Bit()) {
|
if (nvptxSubtarget.is64Bit()) {
|
||||||
O << " .u64 " << *Mang->getSymbol(GVar) << "[";
|
O << " .u64 " << *getSymbol(GVar) << "[";
|
||||||
O << ElementSize / 8;
|
O << ElementSize / 8;
|
||||||
} else {
|
} else {
|
||||||
O << " .u32 " << *Mang->getSymbol(GVar) << "[";
|
O << " .u32 " << *getSymbol(GVar) << "[";
|
||||||
O << ElementSize / 4;
|
O << ElementSize / 4;
|
||||||
}
|
}
|
||||||
O << "]";
|
O << "]";
|
||||||
} else {
|
} else {
|
||||||
O << " .b8 " << *Mang->getSymbol(GVar) << "[";
|
O << " .b8 " << *getSymbol(GVar) << "[";
|
||||||
O << ElementSize;
|
O << ElementSize;
|
||||||
O << "]";
|
O << "]";
|
||||||
}
|
}
|
||||||
@ -1259,7 +1259,7 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
|||||||
aggBuffer.print();
|
aggBuffer.print();
|
||||||
O << "}";
|
O << "}";
|
||||||
} else {
|
} else {
|
||||||
O << " .b8 " << *Mang->getSymbol(GVar);
|
O << " .b8 " << *getSymbol(GVar);
|
||||||
if (ElementSize) {
|
if (ElementSize) {
|
||||||
O << "[";
|
O << "[";
|
||||||
O << ElementSize;
|
O << ElementSize;
|
||||||
@ -1267,7 +1267,7 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
O << " .b8 " << *Mang->getSymbol(GVar);
|
O << " .b8 " << *getSymbol(GVar);
|
||||||
if (ElementSize) {
|
if (ElementSize) {
|
||||||
O << "[";
|
O << "[";
|
||||||
O << ElementSize;
|
O << ElementSize;
|
||||||
@ -1374,7 +1374,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
|
|||||||
O << " .";
|
O << " .";
|
||||||
O << getPTXFundamentalTypeStr(ETy);
|
O << getPTXFundamentalTypeStr(ETy);
|
||||||
O << " ";
|
O << " ";
|
||||||
O << *Mang->getSymbol(GVar);
|
O << *getSymbol(GVar);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1389,7 +1389,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
|
|||||||
case Type::ArrayTyID:
|
case Type::ArrayTyID:
|
||||||
case Type::VectorTyID:
|
case Type::VectorTyID:
|
||||||
ElementSize = TD->getTypeStoreSize(ETy);
|
ElementSize = TD->getTypeStoreSize(ETy);
|
||||||
O << " .b8 " << *Mang->getSymbol(GVar) << "[";
|
O << " .b8 " << *getSymbol(GVar) << "[";
|
||||||
if (ElementSize) {
|
if (ElementSize) {
|
||||||
O << itostr(ElementSize);
|
O << itostr(ElementSize);
|
||||||
}
|
}
|
||||||
@ -1444,7 +1444,7 @@ void NVPTXAsmPrinter::printParamName(Function::const_arg_iterator I,
|
|||||||
int paramIndex, raw_ostream &O) {
|
int paramIndex, raw_ostream &O) {
|
||||||
if ((nvptxSubtarget.getDrvInterface() == NVPTX::NVCL) ||
|
if ((nvptxSubtarget.getDrvInterface() == NVPTX::NVCL) ||
|
||||||
(nvptxSubtarget.getDrvInterface() == NVPTX::CUDA))
|
(nvptxSubtarget.getDrvInterface() == NVPTX::CUDA))
|
||||||
O << *Mang->getSymbol(I->getParent()) << "_param_" << paramIndex;
|
O << *getSymbol(I->getParent()) << "_param_" << paramIndex;
|
||||||
else {
|
else {
|
||||||
std::string argName = I->getName();
|
std::string argName = I->getName();
|
||||||
const char *p = argName.c_str();
|
const char *p = argName.c_str();
|
||||||
@ -1503,13 +1503,13 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
|
|||||||
if (llvm::isImage(*I)) {
|
if (llvm::isImage(*I)) {
|
||||||
std::string sname = I->getName();
|
std::string sname = I->getName();
|
||||||
if (llvm::isImageWriteOnly(*I))
|
if (llvm::isImageWriteOnly(*I))
|
||||||
O << "\t.param .surfref " << *Mang->getSymbol(F) << "_param_"
|
O << "\t.param .surfref " << *getSymbol(F) << "_param_"
|
||||||
<< paramIndex;
|
<< paramIndex;
|
||||||
else // Default image is read_only
|
else // Default image is read_only
|
||||||
O << "\t.param .texref " << *Mang->getSymbol(F) << "_param_"
|
O << "\t.param .texref " << *getSymbol(F) << "_param_"
|
||||||
<< paramIndex;
|
<< paramIndex;
|
||||||
} else // Should be llvm::isSampler(*I)
|
} else // Should be llvm::isSampler(*I)
|
||||||
O << "\t.param .samplerref " << *Mang->getSymbol(F) << "_param_"
|
O << "\t.param .samplerref " << *getSymbol(F) << "_param_"
|
||||||
<< paramIndex;
|
<< paramIndex;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1756,13 +1756,13 @@ void NVPTXAsmPrinter::printScalarConstant(const Constant *CPV, raw_ostream &O) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
|
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
|
||||||
O << *Mang->getSymbol(GVar);
|
O << *getSymbol(GVar);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
|
if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
|
||||||
const Value *v = Cexpr->stripPointerCasts();
|
const Value *v = Cexpr->stripPointerCasts();
|
||||||
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
|
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
|
||||||
O << *Mang->getSymbol(GVar);
|
O << *getSymbol(GVar);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
O << *LowerConstant(CPV, *this);
|
O << *LowerConstant(CPV, *this);
|
||||||
@ -2076,7 +2076,7 @@ void NVPTXAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MachineOperand::MO_ExternalSymbol: {
|
case MachineOperand::MO_ExternalSymbol: {
|
||||||
|
@ -155,7 +155,7 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
|
|||||||
if (pos == nextSymbolPos) {
|
if (pos == nextSymbolPos) {
|
||||||
const Value *v = Symbols[nSym];
|
const Value *v = Symbols[nSym];
|
||||||
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
|
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
|
||||||
MCSymbol *Name = AP.Mang->getSymbol(GVar);
|
MCSymbol *Name = AP.getSymbol(GVar);
|
||||||
O << *Name;
|
O << *Name;
|
||||||
} else if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(v)) {
|
} else if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(v)) {
|
||||||
O << *nvptx::LowerConstant(Cexpr, AP);
|
O << *nvptx::LowerConstant(Cexpr, AP);
|
||||||
|
@ -203,7 +203,7 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
.getGVStubEntry(SymToPrint);
|
.getGVStubEntry(SymToPrint);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
} else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
|
} else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
|
||||||
GV->hasAvailableExternallyLinkage()) {
|
GV->hasAvailableExternallyLinkage()) {
|
||||||
SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||||
@ -213,12 +213,12 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
getHiddenGVStubEntry(SymToPrint);
|
getHiddenGVStubEntry(SymToPrint);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
} else {
|
} else {
|
||||||
SymToPrint = Mang->getSymbol(GV);
|
SymToPrint = getSymbol(GV);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SymToPrint = Mang->getSymbol(GV);
|
SymToPrint = getSymbol(GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
O << *SymToPrint;
|
O << *SymToPrint;
|
||||||
@ -364,7 +364,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(MO.isGlobal() || MO.isCPI() || MO.isJTI());
|
assert(MO.isGlobal() || MO.isCPI() || MO.isJTI());
|
||||||
MCSymbol *MOSymbol = 0;
|
MCSymbol *MOSymbol = 0;
|
||||||
if (MO.isGlobal())
|
if (MO.isGlobal())
|
||||||
MOSymbol = Mang->getSymbol(MO.getGlobal());
|
MOSymbol = getSymbol(MO.getGlobal());
|
||||||
else if (MO.isCPI())
|
else if (MO.isCPI())
|
||||||
MOSymbol = GetCPISymbol(MO.getIndex());
|
MOSymbol = GetCPISymbol(MO.getIndex());
|
||||||
else if (MO.isJTI())
|
else if (MO.isJTI())
|
||||||
@ -403,7 +403,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
||||||
const GlobalValue *RealGValue = GAlias ?
|
const GlobalValue *RealGValue = GAlias ?
|
||||||
GAlias->resolveAliasedGlobal(false) : GValue;
|
GAlias->resolveAliasedGlobal(false) : GValue;
|
||||||
MOSymbol = Mang->getSymbol(RealGValue);
|
MOSymbol = getSymbol(RealGValue);
|
||||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
||||||
IsExternal = GVar && !GVar->hasInitializer();
|
IsExternal = GVar && !GVar->hasInitializer();
|
||||||
IsCommon = GVar && RealGValue->hasCommonLinkage();
|
IsCommon = GVar && RealGValue->hasCommonLinkage();
|
||||||
@ -450,7 +450,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
||||||
const GlobalValue *RealGValue = GAlias ?
|
const GlobalValue *RealGValue = GAlias ?
|
||||||
GAlias->resolveAliasedGlobal(false) : GValue;
|
GAlias->resolveAliasedGlobal(false) : GValue;
|
||||||
MOSymbol = Mang->getSymbol(RealGValue);
|
MOSymbol = getSymbol(RealGValue);
|
||||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
||||||
|
|
||||||
if (!GVar || !GVar->hasInitializer() || RealGValue->hasCommonLinkage() ||
|
if (!GVar || !GVar->hasInitializer() || RealGValue->hasCommonLinkage() ||
|
||||||
@ -485,7 +485,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
||||||
const GlobalValue *RealGValue = GAlias ?
|
const GlobalValue *RealGValue = GAlias ?
|
||||||
GAlias->resolveAliasedGlobal(false) : GValue;
|
GAlias->resolveAliasedGlobal(false) : GValue;
|
||||||
MOSymbol = Mang->getSymbol(RealGValue);
|
MOSymbol = getSymbol(RealGValue);
|
||||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
||||||
IsExternal = GVar && !GVar->hasInitializer();
|
IsExternal = GVar && !GVar->hasInitializer();
|
||||||
IsFunction = !GVar;
|
IsFunction = !GVar;
|
||||||
@ -508,7 +508,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymGotTprel =
|
const MCExpr *SymGotTprel =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -526,7 +526,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
TmpInst.setOpcode(PPC::LD);
|
TmpInst.setOpcode(PPC::LD);
|
||||||
const MachineOperand &MO = MI->getOperand(1);
|
const MachineOperand &MO = MI->getOperand(1);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *Exp =
|
const MCExpr *Exp =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -540,7 +540,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymGotTlsGD =
|
const MCExpr *SymGotTlsGD =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -556,7 +556,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymGotTlsGD =
|
const MCExpr *SymGotTlsGD =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -577,7 +577,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
MCSymbolRefExpr::Create(TlsGetAddr, MCSymbolRefExpr::VK_None, OutContext);
|
MCSymbolRefExpr::Create(TlsGetAddr, MCSymbolRefExpr::VK_None, OutContext);
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymVar =
|
const MCExpr *SymVar =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TLSGD,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TLSGD,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -592,7 +592,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymGotTlsLD =
|
const MCExpr *SymGotTlsLD =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -608,7 +608,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymGotTlsLD =
|
const MCExpr *SymGotTlsLD =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -629,7 +629,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
MCSymbolRefExpr::Create(TlsGetAddr, MCSymbolRefExpr::VK_None, OutContext);
|
MCSymbolRefExpr::Create(TlsGetAddr, MCSymbolRefExpr::VK_None, OutContext);
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymVar =
|
const MCExpr *SymVar =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TLSLD,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TLSLD,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -644,7 +644,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymDtprel =
|
const MCExpr *SymDtprel =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_HA,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_HA,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -660,7 +660,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
|
||||||
const MachineOperand &MO = MI->getOperand(2);
|
const MachineOperand &MO = MI->getOperand(2);
|
||||||
const GlobalValue *GValue = MO.getGlobal();
|
const GlobalValue *GValue = MO.getGlobal();
|
||||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||||
const MCExpr *SymDtprel =
|
const MCExpr *SymDtprel =
|
||||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
|
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
|
||||||
OutContext);
|
OutContext);
|
||||||
@ -1061,7 +1061,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
|||||||
MCSymbol *NLPSym = GetSymbolWithGlobalValueBase(*I, "$non_lazy_ptr");
|
MCSymbol *NLPSym = GetSymbolWithGlobalValueBase(*I, "$non_lazy_ptr");
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||||
MMIMacho.getGVStubEntry(NLPSym);
|
MMIMacho.getGVStubEntry(NLPSym);
|
||||||
StubSym = MachineModuleInfoImpl::StubValueTy(Mang->getSymbol(*I), true);
|
StubSym = MachineModuleInfoImpl::StubValueTy(getSymbol(*I), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
|
|||||||
if (MO.isGlobal()) {
|
if (MO.isGlobal()) {
|
||||||
StubSym =
|
StubSym =
|
||||||
MachineModuleInfoImpl::
|
MachineModuleInfoImpl::
|
||||||
StubValueTy(AP.Mang->getSymbol(MO.getGlobal()),
|
StubValueTy(AP.getSymbol(MO.getGlobal()),
|
||||||
!MO.getGlobal()->hasInternalLinkage());
|
!MO.getGlobal()->hasInternalLinkage());
|
||||||
} else {
|
} else {
|
||||||
Name.erase(Name.end()-5, Name.end());
|
Name.erase(Name.end()-5, Name.end());
|
||||||
@ -95,7 +95,7 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
|
|||||||
if (StubSym.getPointer() == 0) {
|
if (StubSym.getPointer() == 0) {
|
||||||
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(AP.Mang->getSymbol(MO.getGlobal()),
|
StubValueTy(AP.getSymbol(MO.getGlobal()),
|
||||||
!MO.getGlobal()->hasInternalLinkage());
|
!MO.getGlobal()->hasInternalLinkage());
|
||||||
}
|
}
|
||||||
return Sym;
|
return Sym;
|
||||||
|
@ -186,7 +186,7 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
|||||||
O << *MO.getMBB()->getSymbol();
|
O << *MO.getMBB()->getSymbol();
|
||||||
return;
|
return;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_BlockAddress:
|
case MachineOperand::MO_BlockAddress:
|
||||||
O << GetBlockAddressSymbol(MO.getBlockAddress())->getName();
|
O << GetBlockAddressSymbol(MO.getBlockAddress())->getName();
|
||||||
|
@ -160,7 +160,7 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
|||||||
static_cast<SystemZConstantPoolValue*>(MCPV);
|
static_cast<SystemZConstantPoolValue*>(MCPV);
|
||||||
|
|
||||||
const MCExpr *Expr =
|
const MCExpr *Expr =
|
||||||
MCSymbolRefExpr::Create(Mang->getSymbol(ZCPV->getGlobalValue()),
|
MCSymbolRefExpr::Create(getSymbol(ZCPV->getGlobalValue()),
|
||||||
getModifierVariantKind(ZCPV->getModifier()),
|
getModifierVariantKind(ZCPV->getModifier()),
|
||||||
OutContext);
|
OutContext);
|
||||||
uint64_t Size = TM.getDataLayout()->getTypeAllocSize(ZCPV->getType());
|
uint64_t Size = TM.getDataLayout()->getTypeAllocSize(ZCPV->getType());
|
||||||
|
@ -42,7 +42,7 @@ SystemZMCInstLower::getExpr(const MachineOperand &MO,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
Symbol = AsmPrinter.Mang->getSymbol(MO.getGlobal());
|
Symbol = AsmPrinter.getSymbol(MO.getGlobal());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
|
@ -96,7 +96,7 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO,
|
|||||||
MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE)
|
MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE)
|
||||||
GVSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
GVSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||||
else
|
else
|
||||||
GVSym = Mang->getSymbol(GV);
|
GVSym = getSymbol(GV);
|
||||||
|
|
||||||
// Handle dllimport linkage.
|
// Handle dllimport linkage.
|
||||||
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
|
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
|
||||||
@ -109,21 +109,21 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO,
|
|||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(Sym);
|
MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(Sym);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
|
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
|
||||||
MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(Sym);
|
MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(Sym);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
||||||
MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
|
MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
|
MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the name begins with a dollar-sign, enclose it in parens. We do this
|
// If the name begins with a dollar-sign, enclose it in parens. We do this
|
||||||
@ -665,12 +665,12 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
|
|
||||||
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
|
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
|
||||||
if (I->hasDLLExportLinkage())
|
if (I->hasDLLExportLinkage())
|
||||||
DLLExportedFns.push_back(Mang->getSymbol(I));
|
DLLExportedFns.push_back(getSymbol(I));
|
||||||
|
|
||||||
for (Module::const_global_iterator I = M.global_begin(),
|
for (Module::const_global_iterator I = M.global_begin(),
|
||||||
E = M.global_end(); I != E; ++I)
|
E = M.global_end(); I != E; ++I)
|
||||||
if (I->hasDLLExportLinkage())
|
if (I->hasDLLExportLinkage())
|
||||||
DLLExportedGlobals.push_back(Mang->getSymbol(I));
|
DLLExportedGlobals.push_back(getSymbol(I));
|
||||||
|
|
||||||
// Output linker support code for dllexported globals on windows.
|
// Output linker support code for dllexported globals on windows.
|
||||||
if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
|
if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
|
||||||
|
@ -111,7 +111,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
|||||||
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
||||||
StubSym =
|
StubSym =
|
||||||
MachineModuleInfoImpl::
|
MachineModuleInfoImpl::
|
||||||
StubValueTy(getMang()->getSymbol(MO.getGlobal()),
|
StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
|
||||||
!MO.getGlobal()->hasInternalLinkage());
|
!MO.getGlobal()->hasInternalLinkage());
|
||||||
}
|
}
|
||||||
return Sym;
|
return Sym;
|
||||||
@ -125,7 +125,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
|||||||
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
||||||
StubSym =
|
StubSym =
|
||||||
MachineModuleInfoImpl::
|
MachineModuleInfoImpl::
|
||||||
StubValueTy(getMang()->getSymbol(MO.getGlobal()),
|
StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
|
||||||
!MO.getGlobal()->hasInternalLinkage());
|
!MO.getGlobal()->hasInternalLinkage());
|
||||||
}
|
}
|
||||||
return Sym;
|
return Sym;
|
||||||
@ -141,7 +141,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
|||||||
if (MO.isGlobal()) {
|
if (MO.isGlobal()) {
|
||||||
StubSym =
|
StubSym =
|
||||||
MachineModuleInfoImpl::
|
MachineModuleInfoImpl::
|
||||||
StubValueTy(getMang()->getSymbol(MO.getGlobal()),
|
StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
|
||||||
!MO.getGlobal()->hasInternalLinkage());
|
!MO.getGlobal()->hasInternalLinkage());
|
||||||
} else {
|
} else {
|
||||||
Name.erase(Name.end()-5, Name.end());
|
Name.erase(Name.end()-5, Name.end());
|
||||||
|
@ -109,7 +109,7 @@ void XCoreAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM));
|
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM));
|
||||||
|
|
||||||
|
|
||||||
MCSymbol *GVSym = Mang->getSymbol(GV);
|
MCSymbol *GVSym = getSymbol(GV);
|
||||||
const Constant *C = GV->getInitializer();
|
const Constant *C = GV->getInitializer();
|
||||||
unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
|
unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
|||||||
O << *MO.getMBB()->getSymbol();
|
O << *MO.getMBB()->getSymbol();
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
O << *Mang->getSymbol(MO.getGlobal());
|
O << *getSymbol(MO.getGlobal());
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
O << MO.getSymbolName();
|
O << MO.getSymbolName();
|
||||||
|
@ -43,7 +43,7 @@ MCOperand XCoreMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
|||||||
Symbol = MO.getMBB()->getSymbol();
|
Symbol = MO.getMBB()->getSymbol();
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
Symbol = Mang->getSymbol(MO.getGlobal());
|
Symbol = Printer.getSymbol(MO.getGlobal());
|
||||||
Offset += MO.getOffset();
|
Offset += MO.getOffset();
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_BlockAddress:
|
case MachineOperand::MO_BlockAddress:
|
||||||
|
Reference in New Issue
Block a user