minor tidying, only do work if a function is

actually X86_StdCall or X86_FastCall.

llvm-svn: 98374
This commit is contained in:
Chris Lattner 2010-03-12 19:48:03 +00:00
parent e397df7af0
commit 74026ffcae
4 changed files with 15 additions and 16 deletions

View File

@ -61,10 +61,8 @@ MCSymbol *X86AsmPrinter::GetGlobalValueSymbol(const GlobalValue *GV) const {
X86COFFMachineModuleInfo &COFFMMI =
MMI->getObjFileInfo<X86COFFMachineModuleInfo>();
COFFMMI.DecorateCygMingName(Symb, OutContext, cast<Function>(GV),
*TM.getTargetData());
return Symb;
return COFFMMI.DecorateCygMingName(Symb, OutContext, cast<Function>(GV),
*TM.getTargetData());
}
/// runOnMachineFunction - Emit the function body.

View File

@ -65,8 +65,8 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
MCSymbol *Sym = Mang->getSymbol(GV);
X86COFFMachineModuleInfo &COFFMMI =
AsmPrinter.MMI->getObjFileInfo<X86COFFMachineModuleInfo>();
COFFMMI.DecorateCygMingName(Sym, Ctx, cast<Function>(GV),
*AsmPrinter.TM.getTargetData());
Sym = COFFMMI.DecorateCygMingName(Sym, Ctx, cast<Function>(GV),
*AsmPrinter.TM.getTargetData());
Name.append(Sym->getName().begin(), Sym->getName().end());
} else {
const GlobalValue *GV = MO.getGlobal();

View File

@ -28,16 +28,14 @@ X86COFFMachineModuleInfo::~X86COFFMachineModuleInfo() {
/// DecorateCygMingName - Query FunctionInfoMap and use this information for
/// various name decorations for Cygwin and MingW.
void X86COFFMachineModuleInfo::DecorateCygMingName(MCSymbol *&NameSym,
MCContext &Ctx,
const Function *F,
const TargetData &TD) {
SmallString<128> Name(NameSym->getName().begin(), NameSym->getName().end());
MCSymbol *X86COFFMachineModuleInfo::DecorateCygMingName(MCSymbol *NameSym,
MCContext &Ctx,
const Function *F,
const TargetData &TD) {
// We don't want to decorate non-stdcall or non-fastcall functions right now
CallingConv::ID CC = F->getCallingConv();
if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
return;
return NameSym;
unsigned ArgWords = 0;
@ -55,6 +53,9 @@ void X86COFFMachineModuleInfo::DecorateCygMingName(MCSymbol *&NameSym,
}
const FunctionType *FT = F->getFunctionType();
SmallString<128> Name(NameSym->getName().begin(), NameSym->getName().end());
// "Pure" variadic functions do not receive @0 suffix.
if (!FT->isVarArg() || FT->getNumParams() == 0 ||
(FT->getNumParams() == 1 && F->hasStructRetAttr()))
@ -67,5 +68,5 @@ void X86COFFMachineModuleInfo::DecorateCygMingName(MCSymbol *&NameSym,
Name.insert(Name.begin(), '@');
}
NameSym = Ctx.GetOrCreateSymbol(Name.str());
return Ctx.GetOrCreateSymbol(Name.str());
}

View File

@ -30,8 +30,8 @@ public:
X86COFFMachineModuleInfo(const MachineModuleInfo &) {}
virtual ~X86COFFMachineModuleInfo();
void DecorateCygMingName(MCSymbol *&Name, MCContext &Ctx,
const Function *F, const TargetData &TD);
MCSymbol *DecorateCygMingName(MCSymbol *Name, MCContext &Ctx,
const Function *F, const TargetData &TD);
void addExternalFunction(StringRef Name) {
CygMingStubs.insert(Name);