aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-15 04:55:56 +0000
committerChris Lattner <sabre@nondot.org>2009-07-15 04:55:56 +0000
commitc08872ec60fc1b8d475d910139c10a12df0f3564 (patch)
tree56bbe22c535585b0432f71c32c6029a3279f27db
parent9d5511b7db2c42a2cea0ca00c0e123e64cceadae (diff)
downloadexternal_llvm-c08872ec60fc1b8d475d910139c10a12df0f3564.zip
external_llvm-c08872ec60fc1b8d475d910139c10a12df0f3564.tar.gz
external_llvm-c08872ec60fc1b8d475d910139c10a12df0f3564.tar.bz2
rename decorateName -> DecorateCygMingName, make it assert if not
cygming, make the two callers only call it if cygming. Other minor cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75744 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp25
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h2
2 files changed, 14 insertions, 13 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index f9be9a5..2cec373 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
@@ -102,15 +102,17 @@ static X86MachineFunctionInfo calculateFunctionInfo(const Function *F,
return Info;
}
-/// decorateName - Query FunctionInfoMap and use this information for various
-/// name decoration.
-void X86ATTAsmPrinter::decorateName(std::string &Name,
- const GlobalValue *GV) {
+/// DecorateCygMingName - Query FunctionInfoMap and use this information for
+/// various name decorations for Cygwin and MingW.
+void X86ATTAsmPrinter::DecorateCygMingName(std::string &Name,
+ const GlobalValue *GV) {
+ assert(Subtarget->isTargetCygMing() && "This is only for cygwin and mingw");
+
const Function *F = dyn_cast<Function>(GV);
if (!F) return;
// Save function name for later type emission.
- if (Subtarget->isTargetCygMing() && F->isDeclaration())
+ if (F->isDeclaration())
CygMingStubs.insert(Name);
// We don't want to decorate non-stdcall or non-fastcall functions right now
@@ -118,13 +120,10 @@ void X86ATTAsmPrinter::decorateName(std::string &Name,
if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
return;
- // Decorate names only when we're targeting Cygwin/Mingw32 targets
- if (!Subtarget->isTargetCygMing())
- return;
-
- FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
const X86MachineFunctionInfo *Info;
+
+ FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
if (info_item == FunctionInfoMap.end()) {
// Calculate apropriate function info and populate map
FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData());
@@ -164,7 +163,8 @@ void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
unsigned FnAlign = MF.getAlignment();
const Function *F = MF.getFunction();
- decorateName(CurrentFnName, F);
+ if (Subtarget->isTargetCygMing())
+ DecorateCygMingName(CurrentFnName, F);
SwitchToSection(TAI->SectionForGlobal(F));
switch (F->getLinkage()) {
@@ -316,7 +316,8 @@ void X86ATTAsmPrinter::printSymbolOperand(const MachineOperand &MO) {
Suffix = "$non_lazy_ptr";
std::string Name = Mang->getMangledName(GV, Suffix, Suffix[0] != '\0');
- decorateName(Name, GV);
+ if (Subtarget->isTargetCygMing())
+ DecorateCygMingName(Name, GV);
// Handle dllimport linkage.
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
index 9382d59..9721fdc 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
@@ -219,7 +219,7 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
FMFInfoMap FunctionInfoMap;
- void decorateName(std::string& Name, const GlobalValue* GV);
+ void DecorateCygMingName(std::string &Name, const GlobalValue *GV);
};
} // end namespace llvm