llvm.org GIT mirror llvm / ffc7dca
Add a helper getSymbol to AsmPrinter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193627 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
26 changed file(s) with 88 addition(s) and 84 deletion(s). Raw diff Collapse all Expand all
144144 /// getCurrentSection() - Return the current section we are emitting to.
145145 const MCSection *getCurrentSection() const;
146146
147 MCSymbol *getSymbol(const GlobalValue *GV) const;
147148
148149 //===------------------------------------------------------------------===//
149150 // MachineFunctionPass Implementation.
8181 // Emit references to personality.
8282 if (const Function * Personality =
8383 MMI->getPersonalities()[MMI->getPersonalityIndex()]) {
84 MCSymbol *PerSym = Asm->Mang->getSymbol(Personality);
84 MCSymbol *PerSym = Asm->getSymbol(Personality);
8585 Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global);
8686 ATS.emitPersonality(PerSym);
8787 }
262262 llvm_unreachable("Unknown linkage type!");
263263 }
264264
265 MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {
266 return Mang->getSymbol(GV);
267 }
265268
266269 /// EmitGlobalVariable - Emit the specified global variable to the .s file.
267270 void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
277280 }
278281 }
279282
280 MCSymbol *GVSym = Mang->getSymbol(GV);
283 MCSymbol *GVSym = getSymbol(GV);
281284 EmitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration());
282285
283286 if (!GV->hasInitializer()) // External globals require no extra code.
878881 if (V == GlobalValue::DefaultVisibility)
879882 continue;
880883
881 MCSymbol *Name = Mang->getSymbol(&F);
884 MCSymbol *Name = getSymbol(&F);
882885 EmitVisibility(Name, V, false);
883886 }
884887
918921 for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
919922 I != E; ++I) {
920923 if (!I->hasExternalWeakLinkage()) continue;
921 OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
924 OutStreamer.EmitSymbolAttribute(getSymbol(I), MCSA_WeakReference);
922925 }
923926
924927 for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
925928 if (!I->hasExternalWeakLinkage()) continue;
926 OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
929 OutStreamer.EmitSymbolAttribute(getSymbol(I), MCSA_WeakReference);
927930 }
928931 }
929932
931934 OutStreamer.AddBlankLine();
932935 for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
933936 I != E; ++I) {
934 MCSymbol *Name = Mang->getSymbol(I);
937 MCSymbol *Name = getSymbol(I);
935938
936939 const GlobalValue *GV = I->getAliasedGlobal();
937 MCSymbol *Target = Mang->getSymbol(GV);
940 MCSymbol *Target = getSymbol(GV);
938941
939942 if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())
940943 OutStreamer.EmitSymbolAttribute(Name, MCSA_Global);
983986 void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
984987 this->MF = &MF;
985988 // Get the function symbol.
986 CurrentFnSym = Mang->getSymbol(MF.getFunction());
989 CurrentFnSym = getSymbol(MF.getFunction());
987990 CurrentFnSymForSize = CurrentFnSym;
988991
989992 if (isVerbose())
12901293 const GlobalValue *GV =
12911294 dyn_cast(InitList->getOperand(i)->stripPointerCasts());
12921295 if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang))
1293 OutStreamer.EmitSymbolAttribute(Mang->getSymbol(GV), MCSA_NoDeadStrip);
1296 OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
12941297 }
12951298 }
12961299
14851488 return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
14861489
14871490 if (const GlobalValue *GV = dyn_cast(CV))
1488 return MCSymbolRefExpr::Create(AP.Mang->getSymbol(GV), Ctx);
1491 return MCSymbolRefExpr::Create(AP.getSymbol(GV), Ctx);
14891492
14901493 if (const BlockAddress *BA = dyn_cast(CV))
14911494 return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
6767 for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
6868 if (!Personalities[i])
6969 continue;
70 MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
70 MCSymbol *Sym = Asm->getSymbol(Personalities[i]);
7171 TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
7272 AtLeastOne = true;
7373 }
13071307 // For declaration non-type template parameters (such as global values and
13081308 // functions)
13091309 DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
1310 addOpAddress(Block, Asm->Mang->getSymbol(GV));
1310 addOpAddress(Block, Asm->getSymbol(GV));
13111311 // Emit DW_OP_stack_value to use the address as the immediate value of the
13121312 // parameter, rather than a pointer to it.
13131313 addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
15401540 if (isGlobalVariable) {
15411541 addToAccelTable = true;
15421542 DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
1543 const MCSymbol *Sym = Asm->Mang->getSymbol(GV.getGlobal());
1543 const MCSymbol *Sym = Asm->getSymbol(GV.getGlobal());
15441544 if (GV.getGlobal()->isThreadLocal()) {
15451545 // FIXME: Make this work with -gsplit-dwarf.
15461546 unsigned PointerSize = Asm->getDataLayout().getPointerSize();
16001600 // GV is a merged global.
16011601 DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
16021602 Value *Ptr = CE->getOperand(0);
1603 addOpAddress(Block, Asm->Mang->getSymbol(cast(Ptr)));
1603 addOpAddress(Block, Asm->getSymbol(cast(Ptr)));
16041604 addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
16051605 SmallVector Idx(CE->op_begin() + 1, CE->op_end());
16061606 addUInt(Block, dwarf::DW_FORM_udata,
8383 default:
8484 llvm_unreachable("Unexpected operand for symbolic address constraint");
8585 case MachineOperand::MO_GlobalAddress:
86 Name = Mang->getSymbol(MO.getGlobal())->getName();
86 Name = getSymbol(MO.getGlobal())->getName();
8787
8888 // Global variables may be accessed either via a GOT or in various fun and
8989 // interesting TLS-model specific ways. Set the prefix modifier as
120120 MCOp = lowerSymbolOperand(MO, GetExternalSymbolSymbol(MO.getSymbolName()));
121121 break;
122122 case MachineOperand::MO_GlobalAddress:
123 MCOp = lowerSymbolOperand(MO, Mang->getSymbol(MO.getGlobal()));
123 MCOp = lowerSymbolOperand(MO, getSymbol(MO.getGlobal()));
124124 break;
125125 case MachineOperand::MO_MachineBasicBlock:
126126 MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
144144 const GlobalValue *GV = dyn_cast(CV->stripPointerCasts());
145145 assert(GV && "C++ constructor pointer was not a GlobalValue!");
146146
147 const MCExpr *E = MCSymbolRefExpr::Create(Mang->getSymbol(GV),
147 const MCExpr *E = MCSymbolRefExpr::Create(getSymbol(GV),
148148 (Subtarget->isTargetDarwin()
149149 ? MCSymbolRefExpr::VK_None
150150 : MCSymbolRefExpr::VK_ARM_TARGET1),
205205 else if ((Modifier && strcmp(Modifier, "hi16") == 0) ||
206206 (TF & ARMII::MO_HI16))
207207 O << ":upper16:";
208 O << *Mang->getSymbol(GV);
208 O << *getSymbol(GV);
209209
210210 printOffset(MO.getOffset(), O);
211211 if (TF == ARMII::MO_PLT)
757757 bool isIndirect = Subtarget->isTargetDarwin() &&
758758 Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
759759 if (!isIndirect)
760 return Mang->getSymbol(GV);
760 return getSymbol(GV);
761761
762762 // FIXME: Remove this when Darwin transition to @GOT like syntax.
763763 MCSymbol *MCSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
768768 MMIMachO.getGVStubEntry(MCSym);
769769 if (StubSym.getPointer() == 0)
770770 StubSym = MachineModuleInfoImpl::
771 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
771 StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
772772 return MCSym;
773773 }
774774
12021202 .addReg(0));
12031203
12041204 const GlobalValue *GV = MI->getOperand(0).getGlobal();
1205 MCSymbol *GVSym = Mang->getSymbol(GV);
1205 MCSymbol *GVSym = getSymbol(GV);
12061206 const MCExpr *GVSymExpr = MCSymbolRefExpr::Create(GVSym, OutContext);
12071207 OutStreamer.EmitInstruction(MCInstBuilder(ARM::Bcc)
12081208 .addExpr(GVSymExpr)
8181 MO.getMBB()->getSymbol(), OutContext));
8282 break;
8383 case MachineOperand::MO_GlobalAddress:
84 MCOp = GetSymbolRef(MO, Mang->getSymbol(MO.getGlobal()));
84 MCOp = GetSymbolRef(MO, getSymbol(MO.getGlobal()));
8585 break;
8686 case MachineOperand::MO_ExternalSymbol:
8787 MCOp = GetSymbolRef(MO,
9898 return;
9999 case MachineOperand::MO_GlobalAddress:
100100 // Computing the address of a global symbol, not calling it.
101 O << *Mang->getSymbol(MO.getGlobal());
101 O << *getSymbol(MO.getGlobal());
102102 printOffset(MO.getOffset(), O);
103103 return;
104104 }
266266 assert( (MO.getType() == MachineOperand::MO_GlobalAddress) &&
267267 "Expecting global address");
268268
269 O << *Mang->getSymbol(MO.getGlobal());
269 O << *getSymbol(MO.getGlobal());
270270 if (MO.getOffset() != 0) {
271271 O << " + ";
272272 O << MO.getOffset();
7272 AP.OutContext));
7373 break;
7474 case MachineOperand::MO_GlobalAddress:
75 MCO = GetSymbolRef(MO, AP.Mang->getSymbol(MO.getGlobal()), AP);
75 MCO = GetSymbolRef(MO, AP.getSymbol(MO.getGlobal()), AP);
7676 break;
7777 case MachineOperand::MO_ExternalSymbol:
7878 MCO = GetSymbolRef(MO, AP.GetExternalSymbolSymbol(MO.getSymbolName()),
9191 if (Offset)
9292 O << '(' << Offset << '+';
9393
94 O << *Mang->getSymbol(MO.getGlobal());
94 O << *getSymbol(MO.getGlobal());
9595
9696 if (Offset)
9797 O << ')';
3232 case 0: break;
3333 }
3434
35 return Printer.Mang->getSymbol(MO.getGlobal());
35 return Printer.getSymbol(MO.getGlobal());
3636 }
3737
3838 MCSymbol *MSP430MCInstLower::
527527 return;
528528
529529 case MachineOperand::MO_GlobalAddress:
530 O << *Mang->getSymbol(MO.getGlobal());
530 O << *getSymbol(MO.getGlobal());
531531 break;
532532
533533 case MachineOperand::MO_BlockAddress: {
7272 break;
7373
7474 case MachineOperand::MO_GlobalAddress:
75 Symbol = AsmPrinter.Mang->getSymbol(MO.getGlobal());
75 Symbol = AsmPrinter.getSymbol(MO.getGlobal());
7676 Offset += MO.getOffset();
7777 break;
7878
125125 return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
126126
127127 if (const GlobalValue *GV = dyn_cast(CV))
128 return MCSymbolRefExpr::Create(AP.Mang->getSymbol(GV), Ctx);
128 return MCSymbolRefExpr::Create(AP.getSymbol(GV), Ctx);
129129
130130 if (const BlockAddress *BA = dyn_cast(CV))
131131 return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
340340 MCOp = GetSymbolRef(MO, GetExternalSymbolSymbol(MO.getSymbolName()));
341341 break;
342342 case MachineOperand::MO_GlobalAddress:
343 MCOp = GetSymbolRef(MO, Mang->getSymbol(MO.getGlobal()));
343 MCOp = GetSymbolRef(MO, getSymbol(MO.getGlobal()));
344344 break;
345345 case MachineOperand::MO_FPImmediate: {
346346 const ConstantFP *Cnt = MO.getFPImm();
676676 else
677677 O << ".func ";
678678 printReturnValStr(F, O);
679 O << *Mang->getSymbol(F) << "\n";
679 O << *getSymbol(F) << "\n";
680680 emitFunctionParamList(F, O);
681681 O << ";\n";
682682 }
12061206 else
12071207 O << getPTXFundamentalTypeStr(ETy, false);
12081208 O << " ";
1209 O << *Mang->getSymbol(GVar);
1209 O << *getSymbol(GVar);
12101210
12111211 // Ptx allows variable initilization only for constant and global state
12121212 // spaces.
12421242 bufferAggregateConstant(Initializer, &aggBuffer);
12431243 if (aggBuffer.numSymbols) {
12441244 if (nvptxSubtarget.is64Bit()) {
1245 O << " .u64 " << *Mang->getSymbol(GVar) << "[";
1245 O << " .u64 " << *getSymbol(GVar) << "[";
12461246 O << ElementSize / 8;
12471247 } else {
1248 O << " .u32 " << *Mang->getSymbol(GVar) << "[";
1248 O << " .u32 " << *getSymbol(GVar) << "[";
12491249 O << ElementSize / 4;
12501250 }
12511251 O << "]";
12521252 } else {
1253 O << " .b8 " << *Mang->getSymbol(GVar) << "[";
1253 O << " .b8 " << *getSymbol(GVar) << "[";
12541254 O << ElementSize;
12551255 O << "]";
12561256 }
12581258 aggBuffer.print();
12591259 O << "}";
12601260 } else {
1261 O << " .b8 " << *Mang->getSymbol(GVar);
1261 O << " .b8 " << *getSymbol(GVar);
12621262 if (ElementSize) {
12631263 O << "[";
12641264 O << ElementSize;
12661266 }
12671267 }
12681268 } else {
1269 O << " .b8 " << *Mang->getSymbol(GVar);
1269 O << " .b8 " << *getSymbol(GVar);
12701270 if (ElementSize) {
12711271 O << "[";
12721272 O << ElementSize;
13731373 O << " .";
13741374 O << getPTXFundamentalTypeStr(ETy);
13751375 O << " ";
1376 O << *Mang->getSymbol(GVar);
1376 O << *getSymbol(GVar);
13771377 return;
13781378 }
13791379
13881388 case Type::ArrayTyID:
13891389 case Type::VectorTyID:
13901390 ElementSize = TD->getTypeStoreSize(ETy);
1391 O << " .b8 " << *Mang->getSymbol(GVar) << "[";
1391 O << " .b8 " << *getSymbol(GVar) << "[";
13921392 if (ElementSize) {
13931393 O << itostr(ElementSize);
13941394 }
14431443 int paramIndex, raw_ostream &O) {
14441444 if ((nvptxSubtarget.getDrvInterface() == NVPTX::NVCL) ||
14451445 (nvptxSubtarget.getDrvInterface() == NVPTX::CUDA))
1446 O << *Mang->getSymbol(I->getParent()) << "_param_" << paramIndex;
1446 O << *getSymbol(I->getParent()) << "_param_" << paramIndex;
14471447 else {
14481448 std::string argName = I->getName();
14491449 const char *p = argName.c_str();
15021502 if (llvm::isImage(*I)) {
15031503 std::string sname = I->getName();
15041504 if (llvm::isImageWriteOnly(*I))
1505 O << "\t.param .surfref " << *Mang->getSymbol(F) << "_param_"
1505 O << "\t.param .surfref " << *getSymbol(F) << "_param_"
15061506 << paramIndex;
15071507 else // Default image is read_only
1508 O << "\t.param .texref " << *Mang->getSymbol(F) << "_param_"
1508 O << "\t.param .texref " << *getSymbol(F) << "_param_"
15091509 << paramIndex;
15101510 } else // Should be llvm::isSampler(*I)
1511 O << "\t.param .samplerref " << *Mang->getSymbol(F) << "_param_"
1511 O << "\t.param .samplerref " << *getSymbol(F) << "_param_"
15121512 << paramIndex;
15131513 continue;
15141514 }
17551755 return;
17561756 }
17571757 if (const GlobalValue *GVar = dyn_cast(CPV)) {
1758 O << *Mang->getSymbol(GVar);
1758 O << *getSymbol(GVar);
17591759 return;
17601760 }
17611761 if (const ConstantExpr *Cexpr = dyn_cast(CPV)) {
17621762 const Value *v = Cexpr->stripPointerCasts();
17631763 if (const GlobalValue *GVar = dyn_cast(v)) {
1764 O << *Mang->getSymbol(GVar);
1764 O << *getSymbol(GVar);
17651765 return;
17661766 } else {
17671767 O << *LowerConstant(CPV, *this);
20752075 break;
20762076
20772077 case MachineOperand::MO_GlobalAddress:
2078 O << *Mang->getSymbol(MO.getGlobal());
2078 O << *getSymbol(MO.getGlobal());
20792079 break;
20802080
20812081 case MachineOperand::MO_ExternalSymbol: {
154154 if (pos == nextSymbolPos) {
155155 const Value *v = Symbols[nSym];
156156 if (const GlobalValue *GVar = dyn_cast(v)) {
157 MCSymbol *Name = AP.Mang->getSymbol(GVar);
157 MCSymbol *Name = AP.getSymbol(GVar);
158158 O << *Name;
159159 } else if (const ConstantExpr *Cexpr = dyn_cast(v)) {
160160 O << *nvptx::LowerConstant(Cexpr, AP);
202202 .getGVStubEntry(SymToPrint);
203203 if (StubSym.getPointer() == 0)
204204 StubSym = MachineModuleInfoImpl::
205 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
205 StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
206206 } else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
207207 GV->hasAvailableExternallyLinkage()) {
208208 SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
212212 getHiddenGVStubEntry(SymToPrint);
213213 if (StubSym.getPointer() == 0)
214214 StubSym = MachineModuleInfoImpl::
215 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
215 StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
216216 } else {
217 SymToPrint = Mang->getSymbol(GV);
217 SymToPrint = getSymbol(GV);
218218 }
219219 } else {
220 SymToPrint = Mang->getSymbol(GV);
220 SymToPrint = getSymbol(GV);
221221 }
222222
223223 O << *SymToPrint;
363363 assert(MO.isGlobal() || MO.isCPI() || MO.isJTI());
364364 MCSymbol *MOSymbol = 0;
365365 if (MO.isGlobal())
366 MOSymbol = Mang->getSymbol(MO.getGlobal());
366 MOSymbol = getSymbol(MO.getGlobal());
367367 else if (MO.isCPI())
368368 MOSymbol = GetCPISymbol(MO.getIndex());
369369 else if (MO.isJTI())
402402 const GlobalAlias *GAlias = dyn_cast(GValue);
403403 const GlobalValue *RealGValue = GAlias ?
404404 GAlias->resolveAliasedGlobal(false) : GValue;
405 MOSymbol = Mang->getSymbol(RealGValue);
405 MOSymbol = getSymbol(RealGValue);
406406 const GlobalVariable *GVar = dyn_cast(RealGValue);
407407 IsExternal = GVar && !GVar->hasInitializer();
408408 IsCommon = GVar && RealGValue->hasCommonLinkage();
449449 const GlobalAlias *GAlias = dyn_cast(GValue);
450450 const GlobalValue *RealGValue = GAlias ?
451451 GAlias->resolveAliasedGlobal(false) : GValue;
452 MOSymbol = Mang->getSymbol(RealGValue);
452 MOSymbol = getSymbol(RealGValue);
453453 const GlobalVariable *GVar = dyn_cast(RealGValue);
454454
455455 if (!GVar || !GVar->hasInitializer() || RealGValue->hasCommonLinkage() ||
484484 const GlobalAlias *GAlias = dyn_cast(GValue);
485485 const GlobalValue *RealGValue = GAlias ?
486486 GAlias->resolveAliasedGlobal(false) : GValue;
487 MOSymbol = Mang->getSymbol(RealGValue);
487 MOSymbol = getSymbol(RealGValue);
488488 const GlobalVariable *GVar = dyn_cast(RealGValue);
489489 IsExternal = GVar && !GVar->hasInitializer();
490490 IsFunction = !GVar;
507507 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
508508 const MachineOperand &MO = MI->getOperand(2);
509509 const GlobalValue *GValue = MO.getGlobal();
510 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
510 MCSymbol *MOSymbol = getSymbol(GValue);
511511 const MCExpr *SymGotTprel =
512512 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA,
513513 OutContext);
525525 TmpInst.setOpcode(PPC::LD);
526526 const MachineOperand &MO = MI->getOperand(1);
527527 const GlobalValue *GValue = MO.getGlobal();
528 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
528 MCSymbol *MOSymbol = getSymbol(GValue);
529529 const MCExpr *Exp =
530530 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
531531 OutContext);
539539 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
540540 const MachineOperand &MO = MI->getOperand(2);
541541 const GlobalValue *GValue = MO.getGlobal();
542 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
542 MCSymbol *MOSymbol = getSymbol(GValue);
543543 const MCExpr *SymGotTlsGD =
544544 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA,
545545 OutContext);
555555 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
556556 const MachineOperand &MO = MI->getOperand(2);
557557 const GlobalValue *GValue = MO.getGlobal();
558 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
558 MCSymbol *MOSymbol = getSymbol(GValue);
559559 const MCExpr *SymGotTlsGD =
560560 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO,
561561 OutContext);
576576 MCSymbolRefExpr::Create(TlsGetAddr, MCSymbolRefExpr::VK_None, OutContext);
577577 const MachineOperand &MO = MI->getOperand(2);
578578 const GlobalValue *GValue = MO.getGlobal();
579 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
579 MCSymbol *MOSymbol = getSymbol(GValue);
580580 const MCExpr *SymVar =
581581 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TLSGD,
582582 OutContext);
591591 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
592592 const MachineOperand &MO = MI->getOperand(2);
593593 const GlobalValue *GValue = MO.getGlobal();
594 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
594 MCSymbol *MOSymbol = getSymbol(GValue);
595595 const MCExpr *SymGotTlsLD =
596596 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA,
597597 OutContext);
607607 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
608608 const MachineOperand &MO = MI->getOperand(2);
609609 const GlobalValue *GValue = MO.getGlobal();
610 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
610 MCSymbol *MOSymbol = getSymbol(GValue);
611611 const MCExpr *SymGotTlsLD =
612612 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO,
613613 OutContext);
628628 MCSymbolRefExpr::Create(TlsGetAddr, MCSymbolRefExpr::VK_None, OutContext);
629629 const MachineOperand &MO = MI->getOperand(2);
630630 const GlobalValue *GValue = MO.getGlobal();
631 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
631 MCSymbol *MOSymbol = getSymbol(GValue);
632632 const MCExpr *SymVar =
633633 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TLSLD,
634634 OutContext);
643643 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
644644 const MachineOperand &MO = MI->getOperand(2);
645645 const GlobalValue *GValue = MO.getGlobal();
646 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
646 MCSymbol *MOSymbol = getSymbol(GValue);
647647 const MCExpr *SymDtprel =
648648 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_HA,
649649 OutContext);
659659 assert(Subtarget.isPPC64() && "Not supported for 32-bit PowerPC");
660660 const MachineOperand &MO = MI->getOperand(2);
661661 const GlobalValue *GValue = MO.getGlobal();
662 MCSymbol *MOSymbol = Mang->getSymbol(GValue);
662 MCSymbol *MOSymbol = getSymbol(GValue);
663663 const MCExpr *SymDtprel =
664664 MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
665665 OutContext);
10601060 MCSymbol *NLPSym = GetSymbolWithGlobalValueBase(*I, "$non_lazy_ptr");
10611061 MachineModuleInfoImpl::StubValueTy &StubSym =
10621062 MMIMacho.getGVStubEntry(NLPSym);
1063 StubSym = MachineModuleInfoImpl::StubValueTy(Mang->getSymbol(*I), true);
1063 StubSym = MachineModuleInfoImpl::StubValueTy(getSymbol(*I), true);
10641064 }
10651065 }
10661066 }
6868 if (MO.isGlobal()) {
6969 StubSym =
7070 MachineModuleInfoImpl::
71 StubValueTy(AP.Mang->getSymbol(MO.getGlobal()),
71 StubValueTy(AP.getSymbol(MO.getGlobal()),
7272 !MO.getGlobal()->hasInternalLinkage());
7373 } else {
7474 Name.erase(Name.end()-5, Name.end());
9494 if (StubSym.getPointer() == 0) {
9595 assert(MO.isGlobal() && "Extern symbol not handled yet");
9696 StubSym = MachineModuleInfoImpl::
97 StubValueTy(AP.Mang->getSymbol(MO.getGlobal()),
97 StubValueTy(AP.getSymbol(MO.getGlobal()),
9898 !MO.getGlobal()->hasInternalLinkage());
9999 }
100100 return Sym;
185185 O << *MO.getMBB()->getSymbol();
186186 return;
187187 case MachineOperand::MO_GlobalAddress:
188 O << *Mang->getSymbol(MO.getGlobal());
188 O << *getSymbol(MO.getGlobal());
189189 break;
190190 case MachineOperand::MO_BlockAddress:
191191 O << GetBlockAddressSymbol(MO.getBlockAddress())->getName();
159159 static_cast(MCPV);
160160
161161 const MCExpr *Expr =
162 MCSymbolRefExpr::Create(Mang->getSymbol(ZCPV->getGlobalValue()),
162 MCSymbolRefExpr::Create(getSymbol(ZCPV->getGlobalValue()),
163163 getModifierVariantKind(ZCPV->getModifier()),
164164 OutContext);
165165 uint64_t Size = TM.getDataLayout()->getTypeAllocSize(ZCPV->getType());
4141 break;
4242
4343 case MachineOperand::MO_GlobalAddress:
44 Symbol = AsmPrinter.Mang->getSymbol(MO.getGlobal());
44 Symbol = AsmPrinter.getSymbol(MO.getGlobal());
4545 break;
4646
4747 case MachineOperand::MO_ExternalSymbol:
9595 MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE)
9696 GVSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
9797 else
98 GVSym = Mang->getSymbol(GV);
98 GVSym = getSymbol(GV);
9999
100100 // Handle dllimport linkage.
101101 if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
108108 MMI->getObjFileInfo().getGVStubEntry(Sym);
109109 if (StubSym.getPointer() == 0)
110110 StubSym = MachineModuleInfoImpl::
111 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
111 StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
112112 } else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
113113 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
114114 MachineModuleInfoImpl::StubValueTy &StubSym =
115115 MMI->getObjFileInfo().getHiddenGVStubEntry(Sym);
116116 if (StubSym.getPointer() == 0)
117117 StubSym = MachineModuleInfoImpl::
118 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
118 StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
119119 } else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
120120 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
121121 MachineModuleInfoImpl::StubValueTy &StubSym =
122122 MMI->getObjFileInfo().getFnStubEntry(Sym);
123123 if (StubSym.getPointer() == 0)
124124 StubSym = MachineModuleInfoImpl::
125 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
125 StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
126126 }
127127
128128 // If the name begins with a dollar-sign, enclose it in parens. We do this
664664
665665 for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
666666 if (I->hasDLLExportLinkage())
667 DLLExportedFns.push_back(Mang->getSymbol(I));
667 DLLExportedFns.push_back(getSymbol(I));
668668
669669 for (Module::const_global_iterator I = M.global_begin(),
670670 E = M.global_end(); I != E; ++I)
671671 if (I->hasDLLExportLinkage())
672 DLLExportedGlobals.push_back(Mang->getSymbol(I));
672 DLLExportedGlobals.push_back(getSymbol(I));
673673
674674 // Output linker support code for dllexported globals on windows.
675675 if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
110110 assert(MO.isGlobal() && "Extern symbol not handled yet");
111111 StubSym =
112112 MachineModuleInfoImpl::
113 StubValueTy(getMang()->getSymbol(MO.getGlobal()),
113 StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
114114 !MO.getGlobal()->hasInternalLinkage());
115115 }
116116 return Sym;
124124 assert(MO.isGlobal() && "Extern symbol not handled yet");
125125 StubSym =
126126 MachineModuleInfoImpl::
127 StubValueTy(getMang()->getSymbol(MO.getGlobal()),
127 StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
128128 !MO.getGlobal()->hasInternalLinkage());
129129 }
130130 return Sym;
140140 if (MO.isGlobal()) {
141141 StubSym =
142142 MachineModuleInfoImpl::
143 StubValueTy(getMang()->getSymbol(MO.getGlobal()),
143 StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
144144 !MO.getGlobal()->hasInternalLinkage());
145145 } else {
146146 Name.erase(Name.end()-5, Name.end());
108108 OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM));
109109
110110
111 MCSymbol *GVSym = Mang->getSymbol(GV);
111 MCSymbol *GVSym = getSymbol(GV);
112112 const Constant *C = GV->getInitializer();
113113 unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
114114
215215 O << *MO.getMBB()->getSymbol();
216216 break;
217217 case MachineOperand::MO_GlobalAddress:
218 O << *Mang->getSymbol(MO.getGlobal());
218 O << *getSymbol(MO.getGlobal());
219219 break;
220220 case MachineOperand::MO_ExternalSymbol:
221221 O << MO.getSymbolName();
4242 Symbol = MO.getMBB()->getSymbol();
4343 break;
4444 case MachineOperand::MO_GlobalAddress:
45 Symbol = Mang->getSymbol(MO.getGlobal());
45 Symbol = Printer.getSymbol(MO.getGlobal());
4646 Offset += MO.getOffset();
4747 break;
4848 case MachineOperand::MO_BlockAddress: