forked from OSchip/llvm-project
minor tidying, only do work if a function is
actually X86_StdCall or X86_FastCall. llvm-svn: 98374
This commit is contained in:
parent
e397df7af0
commit
74026ffcae
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue