use some helpers instead of duplicating logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-01-23 05:26:25 +00:00
parent 3924868a95
commit 64c2b24498
2 changed files with 7 additions and 6 deletions

View File

@ -204,12 +204,10 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO) {
switch (MO.getType()) {
default: llvm_unreachable("unknown symbol type!");
case MachineOperand::MO_JumpTableIndex:
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_'
<< MO.getIndex();
O << *GetJTISymbol(MO.getIndex());
break;
case MachineOperand::MO_ConstantPoolIndex:
O << MAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
<< MO.getIndex();
O << *GetCPISymbol(MO.getIndex());
printOffset(MO.getOffset());
break;
case MachineOperand::MO_GlobalAddress: {
@ -468,8 +466,7 @@ void X86AsmPrinter::printPICJumpTableSetLabel(unsigned uid,
O << *GetMBBSymbol(MBB->getNumber());
if (Subtarget->isPICStyleRIPRel())
O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << uid << '\n';
O << '-' << *GetJTISymbol(uid) << '\n';
else {
O << '-';
PrintPICBaseSymbol();

View File

@ -163,6 +163,8 @@ GetExternalSymbolSymbol(const MachineOperand &MO) const {
MCSymbol *X86MCInstLower::GetJumpTableSymbol(const MachineOperand &MO) const {
SmallString<256> Name;
// FIXME: Use AsmPrinter.GetJTISymbol. @TLSGD shouldn't be part of the symbol
// name!
raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "JTI"
<< AsmPrinter.getFunctionNumber() << '_' << MO.getIndex();
@ -194,6 +196,8 @@ MCSymbol *X86MCInstLower::GetJumpTableSymbol(const MachineOperand &MO) const {
MCSymbol *X86MCInstLower::
GetConstantPoolIndexSymbol(const MachineOperand &MO) const {
SmallString<256> Name;
// FIXME: USe AsmPrinter.GetCPISymbol. @TLSGD shouldn't be part of the symbol
// name!
raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "CPI"
<< AsmPrinter.getFunctionNumber() << '_' << MO.getIndex();