Reapply my previous asmprinter changes now with more testing and two
additional bug fixes:
1. The bug that everyone hit was a problem in the asmprinter where it
would remove $stub but keep the L prefix on a name when emitting the
indirect symbol. This is easy to fix by keeping the name of the stub
and the name of the symbol in a StringMap instead of just keeping a
StringSet and trying to reconstruct it late.
2. There was a problem printing the personality function. The current
logic to print out the personality function from the DWARF information
is a bit of a cesspool right now that duplicates a bunch of other
logic in the asm printer. The short version of it is that it depends
on emitting both the L and _ prefix for symbols (at least on darwin)
and until I can untangle it, it is best to switch the mangler back to
emitting both prefixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75646 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index b6401df..61d295c 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -47,7 +47,7 @@
// Get the mangled name.
const Function *F = MF.getFunction();
- CurrentFnName = Mang->getValueName(F);
+ CurrentFnName = Mang->getMangledName(F);
// Emit the function frame (args and temps).
EmitFunctionFrame(MF);
@@ -136,7 +136,7 @@
return;
case MachineOperand::MO_GlobalAddress: {
- O << Mang->getValueName(MO.getGlobal());
+ O << Mang->getMangledName(MO.getGlobal());
break;
}
case MachineOperand::MO_ExternalSymbol: {
@@ -222,7 +222,7 @@
// Emit declarations for external functions.
O <<"\n"<<TAI->getCommentString() << "Function Declarations - BEGIN." <<"\n";
for (Module::iterator I = M.begin(), E = M.end(); I != E; I++) {
- std::string Name = Mang->getValueName(I);
+ std::string Name = Mang->getMangledName(I);
if (Name.compare("@abort") == 0)
continue;
@@ -252,7 +252,7 @@
O << "\n" << TAI->getCommentString() << "Imported Variables - BEGIN" << "\n";
for (unsigned j = 0; j < Items.size(); j++) {
- O << TAI->getExternDirective() << Mang->getValueName(Items[j]) << "\n";
+ O << TAI->getExternDirective() << Mang->getMangledName(Items[j]) << "\n";
}
O << TAI->getCommentString() << "Imported Variables - END" << "\n";
}
@@ -265,7 +265,7 @@
O << "\n" << TAI->getCommentString() << "Exported Variables - BEGIN" << "\n";
for (unsigned j = 0; j < Items.size(); j++) {
- O << TAI->getGlobalDirective() << Mang->getValueName(Items[j]) << "\n";
+ O << TAI->getGlobalDirective() << Mang->getMangledName(Items[j]) << "\n";
}
O << TAI->getCommentString() << "Exported Variables - END" << "\n";
}
@@ -281,7 +281,7 @@
O << "\n";
SwitchToSection(PTAI->ROSections[i]->S_);
for (unsigned j = 0; j < Items.size(); j++) {
- O << Mang->getValueName(Items[j]);
+ O << Mang->getMangledName(Items[j]);
Constant *C = Items[j]->getInitializer();
int AddrSpace = Items[j]->getType()->getAddressSpace();
EmitGlobalConstant(C, AddrSpace);
@@ -300,7 +300,7 @@
void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
const Function *F = MF.getFunction();
- std::string FuncName = Mang->getValueName(F);
+ std::string FuncName = Mang->getMangledName(F);
const TargetData *TD = TM.getTargetData();
// Emit the data section name.
O << "\n";
@@ -354,7 +354,7 @@
SwitchToSection(IDATASections[i]->S_);
std::vector<const GlobalVariable*> Items = IDATASections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
- std::string Name = Mang->getValueName(Items[j]);
+ std::string Name = Mang->getMangledName(Items[j]);
Constant *C = Items[j]->getInitializer();
int AddrSpace = Items[j]->getType()->getAddressSpace();
O << Name;
@@ -373,7 +373,7 @@
SwitchToSection(BSSSections[i]->S_);
std::vector<const GlobalVariable*> Items = BSSSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
- std::string Name = Mang->getValueName(Items[j]);
+ std::string Name = Mang->getMangledName(Items[j]);
Constant *C = Items[j]->getInitializer();
const Type *Ty = C->getType();
unsigned Size = TD->getTypeAllocSize(Ty);
@@ -401,7 +401,7 @@
SwitchToSection(AutosSections[i]->S_);
std::vector<const GlobalVariable*> Items = AutosSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
- std::string VarName = Mang->getValueName(Items[j]);
+ std::string VarName = Mang->getMangledName(Items[j]);
Constant *C = Items[j]->getInitializer();
const Type *Ty = C->getType();
unsigned Size = TD->getTypeAllocSize(Ty);
@@ -434,7 +434,7 @@
SwitchToSection(AutosSections[i]->S_);
std::vector<const GlobalVariable*> Items = AutosSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
- std::string VarName = Mang->getValueName(Items[j]);
+ std::string VarName = Mang->getMangledName(Items[j]);
Constant *C = Items[j]->getInitializer();
const Type *Ty = C->getType();
unsigned Size = TD->getTypeAllocSize(Ty);