aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-12 19:48:03 +0000
committerChris Lattner <sabre@nondot.org>2010-03-12 19:48:03 +0000
commit9c592681976f53b072cc4c26ac97fd471ceab937 (patch)
treead8ae0346d063b50f5c8e7b7d399ee70d87bda85 /lib/Target/X86
parentc9747c05d1fc01678fb86b3bc4674656228269bc (diff)
downloadexternal_llvm-9c592681976f53b072cc4c26ac97fd471ceab937.tar.gz
external_llvm-9c592681976f53b072cc4c26ac97fd471ceab937.tar.bz2
external_llvm-9c592681976f53b072cc4c26ac97fd471ceab937.zip
minor tidying, only do work if a function is
actually X86_StdCall or X86_FastCall. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98374 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86')
-rw-r--r--lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp6
-rw-r--r--lib/Target/X86/AsmPrinter/X86MCInstLower.cpp4
-rw-r--r--lib/Target/X86/X86COFFMachineModuleInfo.cpp17
-rw-r--r--lib/Target/X86/X86COFFMachineModuleInfo.h4
4 files changed, 15 insertions, 16 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index b879d48ce0..cc80e20fb1 100644
--- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -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.
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
index 8dabaac6d1..537d44222f 100644
--- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
+++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
@@ -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();
diff --git a/lib/Target/X86/X86COFFMachineModuleInfo.cpp b/lib/Target/X86/X86COFFMachineModuleInfo.cpp
index 8fbd20714d..2988e4f91d 100644
--- a/lib/Target/X86/X86COFFMachineModuleInfo.cpp
+++ b/lib/Target/X86/X86COFFMachineModuleInfo.cpp
@@ -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());
}
diff --git a/lib/Target/X86/X86COFFMachineModuleInfo.h b/lib/Target/X86/X86COFFMachineModuleInfo.h
index f43b5ce7cb..d07f073353 100644
--- a/lib/Target/X86/X86COFFMachineModuleInfo.h
+++ b/lib/Target/X86/X86COFFMachineModuleInfo.h
@@ -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);