llvm.org GIT mirror llvm / 1b2eb0e
eliminate the now-unneeded context argument of MBB::getSymbol() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98451 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
21 changed file(s) with 35 addition(s) and 34 deletion(s). Raw diff Collapse all Expand all
2020
2121 class BasicBlock;
2222 class MachineFunction;
23 class MCContext;
2423 class MCSymbol;
2524 class StringRef;
2625 class raw_ostream;
351350
352351 /// getSymbol - Return the MCSymbol for this basic block.
353352 ///
354 MCSymbol *getSymbol(MCContext &Ctx) const;
353 MCSymbol *getSymbol() const;
355354
356355 private: // Methods used to maintain doubly linked list of blocks...
357356 friend struct ilist_traits;
3232 class MachineFrameInfo;
3333 class MachineConstantPool;
3434 class MachineJumpTableInfo;
35 class MCContext;
3536 class Pass;
3637 class TargetMachine;
3738 class TargetRegisterClass;
697697
698698 // .set LJTSet, LBB32-base
699699 const MCExpr *LHS =
700 MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext);
700 MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
701701 OutStreamer.EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
702702 MCBinaryExpr::CreateSub(LHS, Base, OutContext));
703703 }
735735 case MachineJumpTableInfo::EK_BlockAddress:
736736 // EK_BlockAddress - Each entry is a plain address of block, e.g.:
737737 // .word LBB123
738 Value = MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext);
738 Value = MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
739739 break;
740740 case MachineJumpTableInfo::EK_GPRel32BlockAddress: {
741741 // EK_GPRel32BlockAddress - Each entry is an address of block, encoded
742742 // with a relocation as gp-relative, e.g.:
743743 // .gprel32 LBB123
744 MCSymbol *MBBSym = MBB->getSymbol(OutContext);
744 MCSymbol *MBBSym = MBB->getSymbol();
745745 OutStreamer.EmitGPRel32Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
746746 return;
747747 }
765765 break;
766766 }
767767 // Otherwise, use the difference as the jump table entry.
768 Value = MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext);
768 Value = MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
769769 const MCExpr *JTI = MCSymbolRefExpr::Create(GetJTISymbol(UID), OutContext);
770770 Value = MCBinaryExpr::CreateSub(Value, JTI, OutContext);
771771 break;
14991499 ++OpNo; // Skip over the ID number.
15001500
15011501 if (Modifier[0] == 'l') // labels are target independent
1502 O << *MI->getOperand(OpNo).getMBB()->getSymbol(OutContext);
1502 O << *MI->getOperand(OpNo).getMBB()->getSymbol();
15031503 else {
15041504 AsmPrinter *AP = const_cast(this);
15051505 if ((OpFlags & 7) == 4) {
17551755 PrintBasicBlockLoopComments(*MBB, LI, *this);
17561756 }
17571757
1758 OutStreamer.EmitLabel(MBB->getSymbol(OutContext));
1758 OutStreamer.EmitLabel(MBB->getSymbol());
17591759 }
17601760 }
17611761
4040
4141 /// getSymbol - Return the MCSymbol for this basic block.
4242 ///
43 MCSymbol *MachineBasicBlock::getSymbol(MCContext &Ctx) const {
43 MCSymbol *MachineBasicBlock::getSymbol() const {
4444 const MachineFunction *MF = getParent();
45 const char *Prefix = MF->getTarget().getMCAsmInfo()->getPrivateGlobalPrefix();
45 MCContext &Ctx = MF->getContext();
46 const char *Prefix = Ctx.getAsmInfo().getPrivateGlobalPrefix();
4647 return Ctx.GetOrCreateTemporarySymbol(Twine(Prefix) + "BB" +
4748 Twine(MF->getFunctionNumber()) + "_" +
4849 Twine(getNumber()));
303303 break;
304304 }
305305 case MachineOperand::MO_MachineBasicBlock:
306 O << *MO.getMBB()->getSymbol(OutContext);
306 O << *MO.getMBB()->getSymbol();
307307 return;
308308 case MachineOperand::MO_GlobalAddress: {
309309 bool isCallOp = Modifier && !strcmp(Modifier, "call");
889889 if (UseSet && isNew) {
890890 O << "\t.set\t"
891891 << *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB) << ','
892 << *MBB->getSymbol(OutContext) << '-' << *JTISymbol << '\n';
892 << *MBB->getSymbol() << '-' << *JTISymbol << '\n';
893893 }
894894
895895 O << JTEntryDirective << ' ';
896896 if (UseSet)
897897 O << *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB);
898898 else if (TM.getRelocationModel() == Reloc::PIC_)
899 O << *MBB->getSymbol(OutContext) << '-' << *JTISymbol;
899 O << *MBB->getSymbol() << '-' << *JTISymbol;
900900 else
901 O << *MBB->getSymbol(OutContext);
901 O << *MBB->getSymbol();
902902
903903 if (i != e-1)
904904 O << '\n';
930930 O << MAI->getData16bitsDirective();
931931
932932 if (ByteOffset || HalfWordOffset)
933 O << '(' << *MBB->getSymbol(OutContext) << "-" << *JTISymbol << ")/2";
933 O << '(' << *MBB->getSymbol() << "-" << *JTISymbol << ")/2";
934934 else
935 O << "\tb.w " << *MBB->getSymbol(OutContext);
935 O << "\tb.w " << *MBB->getSymbol();
936936
937937 if (i != e-1)
938938 O << '\n';
135135 break;
136136 case MachineOperand::MO_MachineBasicBlock:
137137 MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
138 MO.getMBB()->getSymbol(Ctx), Ctx));
138 MO.getMBB()->getSymbol(), Ctx));
139139 break;
140140 case MachineOperand::MO_GlobalAddress:
141141 MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
9595 return;
9696
9797 case MachineOperand::MO_MachineBasicBlock:
98 O << *MO.getMBB()->getSymbol(OutContext);
98 O << *MO.getMBB()->getSymbol();
9999 return;
100100
101101 case MachineOperand::MO_ConstantPoolIndex:
8181 O << MO.getImm();
8282 break;
8383 case MachineOperand::MO_MachineBasicBlock:
84 O << *MO.getMBB()->getSymbol(OutContext);
84 O << *MO.getMBB()->getSymbol();
8585 return;
8686 case MachineOperand::MO_GlobalAddress:
8787 O << *Mang->getSymbol(MO.getGlobal());
280280 return;
281281
282282 case MachineOperand::MO_MachineBasicBlock:
283 O << *MO.getMBB()->getSymbol(OutContext);
283 O << *MO.getMBB()->getSymbol();
284284 return;
285285 case MachineOperand::MO_JumpTableIndex:
286286 O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
235235 }
236236
237237 case MachineOperand::MO_MachineBasicBlock:
238 O << *MO.getMBB()->getSymbol(OutContext);
238 O << *MO.getMBB()->getSymbol();
239239 return;
240240
241241 case MachineOperand::MO_GlobalAddress:
9191 O << MO.getImm();
9292 return;
9393 case MachineOperand::MO_MachineBasicBlock:
94 O << *MO.getMBB()->getSymbol(OutContext);
94 O << *MO.getMBB()->getSymbol();
9595 return;
9696 case MachineOperand::MO_GlobalAddress: {
9797 bool isMemOp = Modifier && !strcmp(Modifier, "mem");
116116 break;
117117 case MachineOperand::MO_MachineBasicBlock:
118118 MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
119 MO.getMBB()->getSymbol(Printer.OutContext), Ctx));
119 MO.getMBB()->getSymbol(), Ctx));
120120 break;
121121 case MachineOperand::MO_GlobalAddress:
122122 MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
276276 break;
277277
278278 case MachineOperand::MO_MachineBasicBlock:
279 O << *MO.getMBB()->getSymbol(OutContext);
279 O << *MO.getMBB()->getSymbol();
280280 return;
281281
282282 case MachineOperand::MO_GlobalAddress:
205205 break;
206206 }
207207 case MachineOperand::MO_MachineBasicBlock:
208 O << *MO.getMBB()->getSymbol(OutContext);
208 O << *MO.getMBB()->getSymbol();
209209 return;
210210
211211 default:
377377 llvm_unreachable("printOp() does not handle immediate values");
378378
379379 case MachineOperand::MO_MachineBasicBlock:
380 O << *MO.getMBB()->getSymbol(OutContext);
380 O << *MO.getMBB()->getSymbol();
381381 return;
382382 case MachineOperand::MO_JumpTableIndex:
383383 O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
8383 O << (int)MO.getImm();
8484 break;
8585 case MachineOperand::MO_MachineBasicBlock:
86 O << *MO.getMBB()->getSymbol(OutContext);
86 O << *MO.getMBB()->getSymbol();
8787 return;
8888 case MachineOperand::MO_GlobalAddress:
8989 O << *Mang->getSymbol(MO.getGlobal());
8888 O << MO.getImm();
8989 return;
9090 case MachineOperand::MO_MachineBasicBlock:
91 O << *MO.getMBB()->getSymbol(OutContext);
91 O << *MO.getMBB()->getSymbol();
9292 return;
9393 case MachineOperand::MO_GlobalAddress: {
9494 const GlobalValue *GV = MO.getGlobal();
143143 O << MO.getImm();
144144 return;
145145 case MachineOperand::MO_MachineBasicBlock:
146 O << *MO.getMBB()->getSymbol(OutContext);
146 O << *MO.getMBB()->getSymbol();
147147 return;
148148 case MachineOperand::MO_JumpTableIndex:
149149 O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_'
213213 O << MO.getImm();
214214 return;
215215 case MachineOperand::MO_MachineBasicBlock:
216 O << *MO.getMBB()->getSymbol(OutContext);
216 O << *MO.getMBB()->getSymbol();
217217 return;
218218 case MachineOperand::MO_GlobalAddress:
219219 case MachineOperand::MO_ExternalSymbol:
241241 break;
242242 case MachineOperand::MO_MachineBasicBlock:
243243 MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
244 MO.getMBB()->getSymbol(Ctx), Ctx));
244 MO.getMBB()->getSymbol(), Ctx));
245245 break;
246246 case MachineOperand::MO_GlobalAddress:
247247 MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
11641164 Subtarget->isPICStyleGOT());
11651165 // In 32-bit ELF systems, our jump table entries are formed with @GOTOFF
11661166 // entries.
1167 return X86MCTargetExpr::Create(MBB->getSymbol(Ctx),
1167 return X86MCTargetExpr::Create(MBB->getSymbol(),
11681168 X86MCTargetExpr::GOTOFF, Ctx);
11691169 }
11701170
275275 MachineBasicBlock *MBB = JTBBs[i];
276276 if (i > 0)
277277 O << ",";
278 O << *MBB->getSymbol(OutContext);
278 O << *MBB->getSymbol();
279279 }
280280 }
281281
289289 O << MO.getImm();
290290 break;
291291 case MachineOperand::MO_MachineBasicBlock:
292 O << *MO.getMBB()->getSymbol(OutContext);
292 O << *MO.getMBB()->getSymbol();
293293 break;
294294 case MachineOperand::MO_GlobalAddress:
295295 O << *Mang->getSymbol(MO.getGlobal());