mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-05 12:31:46 +00:00
use MCSymbol instead of getMangledName() in all cases except one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93582 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67c59826bf
commit
f0aacf8201
@ -387,9 +387,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
|||||||
}
|
}
|
||||||
case MachineOperand::MO_ExternalSymbol: {
|
case MachineOperand::MO_ExternalSymbol: {
|
||||||
bool isCallOp = Modifier && !strcmp(Modifier, "call");
|
bool isCallOp = Modifier && !strcmp(Modifier, "call");
|
||||||
SmallString<128> NameStr;
|
GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
|
||||||
Mang->getNameWithPrefix(NameStr, MO.getSymbolName());
|
|
||||||
OutContext.GetOrCreateSymbol(NameStr.str())->print(O, MAI);
|
|
||||||
|
|
||||||
if (isCallOp && Subtarget->isTargetELF() &&
|
if (isCallOp && Subtarget->isTargetELF() &&
|
||||||
TM.getRelocationModel() == Reloc::PIC_)
|
TM.getRelocationModel() == Reloc::PIC_)
|
||||||
@ -1188,17 +1186,23 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = Mang->getMangledName(GVar);
|
std::string Name = Mang->getMangledName(GVar);
|
||||||
|
MCSymbol *GVarSym = GetGlobalValueSymbol(GVar);
|
||||||
|
|
||||||
|
|
||||||
Constant *C = GVar->getInitializer();
|
Constant *C = GVar->getInitializer();
|
||||||
const Type *Type = C->getType();
|
const Type *Type = C->getType();
|
||||||
unsigned Size = TD->getTypeAllocSize(Type);
|
unsigned Size = TD->getTypeAllocSize(Type);
|
||||||
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
||||||
bool isDarwin = Subtarget->isTargetDarwin();
|
bool isDarwin = Subtarget->isTargetDarwin();
|
||||||
|
|
||||||
printVisibility(name, GVar->getVisibility());
|
printVisibility(Name, GVar->getVisibility());
|
||||||
|
|
||||||
if (Subtarget->isTargetELF())
|
if (Subtarget->isTargetELF()) {
|
||||||
O << "\t.type " << name << ",%object\n";
|
O << "\t.type ";
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << ",%object\n";
|
||||||
|
}
|
||||||
|
|
||||||
const MCSection *TheSection =
|
const MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
@ -1210,9 +1214,12 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
!TheSection->getKind().isMergeableCString()) {
|
!TheSection->getKind().isMergeableCString()) {
|
||||||
if (GVar->hasExternalLinkage()) {
|
if (GVar->hasExternalLinkage()) {
|
||||||
if (const char *Directive = MAI->getZeroFillDirective()) {
|
if (const char *Directive = MAI->getZeroFillDirective()) {
|
||||||
O << "\t.globl\t" << name << "\n";
|
O << "\t.globl\t";
|
||||||
O << Directive << "__DATA, __common, " << name << ", "
|
GVarSym->print(O, MAI);
|
||||||
<< Size << ", " << Align << "\n";
|
O << "\n";
|
||||||
|
O << Directive << "__DATA, __common, ";
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << ", " << Size << ", " << Align << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1222,17 +1229,23 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
|
|
||||||
if (isDarwin) {
|
if (isDarwin) {
|
||||||
if (GVar->hasLocalLinkage()) {
|
if (GVar->hasLocalLinkage()) {
|
||||||
O << MAI->getLCOMMDirective() << name << ',' << Size
|
O << MAI->getLCOMMDirective();
|
||||||
<< ',' << Align;
|
GVarSym->print(O, MAI);
|
||||||
|
O << ',' << Size << ',' << Align;
|
||||||
} else if (GVar->hasCommonLinkage()) {
|
} else if (GVar->hasCommonLinkage()) {
|
||||||
O << MAI->getCOMMDirective() << name << ',' << Size
|
O << MAI->getCOMMDirective();
|
||||||
<< ',' << Align;
|
GVarSym->print(O, MAI);
|
||||||
|
O << ',' << Size << ',' << Align;
|
||||||
} else {
|
} else {
|
||||||
OutStreamer.SwitchSection(TheSection);
|
OutStreamer.SwitchSection(TheSection);
|
||||||
O << "\t.globl " << name << '\n'
|
O << "\t.globl ";
|
||||||
<< MAI->getWeakDefDirective() << name << '\n';
|
GVarSym->print(O, MAI);
|
||||||
|
O << '\n' << MAI->getWeakDefDirective();
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << '\n';
|
||||||
EmitAlignment(Align, GVar);
|
EmitAlignment(Align, GVar);
|
||||||
O << name << ":";
|
GVarSym->print(O, MAI);
|
||||||
|
O << ":";
|
||||||
if (VerboseAsm) {
|
if (VerboseAsm) {
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << ' ';
|
O << MAI->getCommentString() << ' ';
|
||||||
@ -1244,16 +1257,25 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
}
|
}
|
||||||
} else if (MAI->getLCOMMDirective() != NULL) {
|
} else if (MAI->getLCOMMDirective() != NULL) {
|
||||||
if (GVar->hasLocalLinkage()) {
|
if (GVar->hasLocalLinkage()) {
|
||||||
O << MAI->getLCOMMDirective() << name << "," << Size;
|
O << MAI->getLCOMMDirective();
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << "," << Size;
|
||||||
} else {
|
} else {
|
||||||
O << MAI->getCOMMDirective() << name << "," << Size;
|
O << MAI->getCOMMDirective();
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << "," << Size;
|
||||||
if (MAI->getCOMMDirectiveTakesAlignment())
|
if (MAI->getCOMMDirectiveTakesAlignment())
|
||||||
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
|
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (GVar->hasLocalLinkage())
|
if (GVar->hasLocalLinkage()) {
|
||||||
O << "\t.local\t" << name << "\n";
|
O << "\t.local\t";
|
||||||
O << MAI->getCOMMDirective() << name << "," << Size;
|
GVarSym->print(O, MAI);
|
||||||
|
O << '\n';
|
||||||
|
}
|
||||||
|
O << MAI->getCOMMDirective();
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << "," << Size;
|
||||||
if (MAI->getCOMMDirectiveTakesAlignment())
|
if (MAI->getCOMMDirectiveTakesAlignment())
|
||||||
O << "," << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
|
O << "," << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
|
||||||
}
|
}
|
||||||
@ -1275,17 +1297,24 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
case GlobalValue::WeakODRLinkage:
|
case GlobalValue::WeakODRLinkage:
|
||||||
case GlobalValue::LinkerPrivateLinkage:
|
case GlobalValue::LinkerPrivateLinkage:
|
||||||
if (isDarwin) {
|
if (isDarwin) {
|
||||||
O << "\t.globl " << name << "\n"
|
O << "\t.globl ";
|
||||||
<< "\t.weak_definition " << name << "\n";
|
GVarSym->print(O, MAI);
|
||||||
|
O << "\n\t.weak_definition ";
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << "\n";
|
||||||
} else {
|
} else {
|
||||||
O << "\t.weak " << name << "\n";
|
O << "\t.weak ";
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << "\n";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GlobalValue::AppendingLinkage:
|
case GlobalValue::AppendingLinkage:
|
||||||
// FIXME: appending linkage variables should go into a section of
|
// FIXME: appending linkage variables should go into a section of
|
||||||
// their name or something. For now, just emit them as external.
|
// their name or something. For now, just emit them as external.
|
||||||
case GlobalValue::ExternalLinkage:
|
case GlobalValue::ExternalLinkage:
|
||||||
O << "\t.globl " << name << "\n";
|
O << "\t.globl ";
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << "\n";
|
||||||
break;
|
break;
|
||||||
case GlobalValue::PrivateLinkage:
|
case GlobalValue::PrivateLinkage:
|
||||||
case GlobalValue::InternalLinkage:
|
case GlobalValue::InternalLinkage:
|
||||||
@ -1295,15 +1324,19 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmitAlignment(Align, GVar);
|
EmitAlignment(Align, GVar);
|
||||||
O << name << ":";
|
GVarSym->print(O, MAI);
|
||||||
|
O << ":";
|
||||||
if (VerboseAsm) {
|
if (VerboseAsm) {
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << ' ';
|
O << MAI->getCommentString() << ' ';
|
||||||
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
|
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
|
||||||
}
|
}
|
||||||
O << "\n";
|
O << "\n";
|
||||||
if (MAI->hasDotTypeDotSizeDirective())
|
if (MAI->hasDotTypeDotSizeDirective()) {
|
||||||
O << "\t.size " << name << ", " << Size << "\n";
|
O << "\t.size ";
|
||||||
|
GVarSym->print(O, MAI);
|
||||||
|
O << ", " << Size << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
EmitGlobalConstant(C);
|
EmitGlobalConstant(C);
|
||||||
O << '\n';
|
O << '\n';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user