[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86ISelLowering.cpp X86IntelAsmPrinter.cpp X86MachineFunctionInfo.h
Chris Lattner
sabre at nondot.org
Mon Sep 25 20:58:07 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.64 -> 1.65
X86AsmPrinter.cpp updated: 1.199 -> 1.200
X86AsmPrinter.h updated: 1.32 -> 1.33
X86ISelLowering.cpp updated: 1.263 -> 1.264
X86IntelAsmPrinter.cpp updated: 1.57 -> 1.58
X86MachineFunctionInfo.h updated: 1.3 -> 1.4
---
Log message:
Various random and minor code cleanups.
---
Diffs of the changes: (+39 -56)
X86ATTAsmPrinter.cpp | 7 ++--
X86AsmPrinter.cpp | 67 ++++++++++++++++++-----------------------------
X86AsmPrinter.h | 7 ++--
X86ISelLowering.cpp | 5 +--
X86IntelAsmPrinter.cpp | 7 ++--
X86MachineFunctionInfo.h | 2 -
6 files changed, 39 insertions(+), 56 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.65
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Sep 25 22:57:53 2006
@@ -48,9 +48,8 @@
// Populate function information map. Actually, We don't want to populate
// non-stdcall or non-fastcall functions' information right now.
- if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) {
- FunctionInfoMap[F] = *(MF.getInfo<X86FunctionInfo>());
- }
+ if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall)
+ FunctionInfoMap[F] = *MF.getInfo<X86FunctionInfo>();
X86SharedAsmPrinter::decorateName(CurrentFnName, F);
@@ -200,7 +199,7 @@
bool isExt = (GV->isExternal() || GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage());
- X86SharedAsmPrinter::decorateName(Name, (Function*)GV);
+ X86SharedAsmPrinter::decorateName(Name, GV);
if (X86PICStyle == PICStyle::Stub &&
TM.getRelocationModel() != Reloc::Static) {
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.200
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Sep 25 22:57:53 2006
@@ -33,88 +33,75 @@
Statistic<> llvm::EmittedInsts("asm-printer",
"Number of machine instrs printed");
-static X86FunctionInfo calculateFunctionInfo(const Function* F,
- const TargetData* TD)
-{
+static X86FunctionInfo calculateFunctionInfo(const Function *F,
+ const TargetData *TD) {
X86FunctionInfo Info;
- uint64_t size = 0;
+ uint64_t Size = 0;
switch (F->getCallingConv()) {
- case CallingConv::X86_StdCall:
+ case CallingConv::X86_StdCall:
Info.setDecorationStyle(StdCall);
break;
- case CallingConv::X86_FastCall:
+ case CallingConv::X86_FastCall:
Info.setDecorationStyle(FastCall);
break;
- default:
+ default:
return Info;
}
- for (Function::const_arg_iterator AI = F->arg_begin(),
- AE = F->arg_end();
- AI != AE;
- ++AI) {
- size += TD->getTypeSize(AI->getType());
- }
+ for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
+ AI != AE; ++AI)
+ Size += TD->getTypeSize(AI->getType());
// We're not supporting tooooo huge arguments :)
- Info.setBytesToPopOnReturn((unsigned int)size);
-
+ Info.setBytesToPopOnReturn((unsigned int)Size);
return Info;
}
-// Query FunctionInfoMap and use this information for various name decoration
-void X86SharedAsmPrinter::decorateName(std::string& Name, const GlobalValue* GV)
-{
- const X86FunctionInfo* Info;
- const Function* F;
-
- if ((F = dyn_cast<Function>(GV)) == NULL) {
- return;
- }
-
- unsigned CC = F->getCallingConv();
+/// decorateName - Query FunctionInfoMap and use this information for various
+/// name decoration.
+void X86SharedAsmPrinter::decorateName(std::string &Name,
+ const GlobalValue *GV) {
+ const Function *F = dyn_cast<Function>(GV);
+ if (!F) return;
// We don't want to decorate non-stdcall or non-fastcall functions right now
- if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) {
+ unsigned CC = F->getCallingConv();
+ if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
return;
- }
FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
+ const X86FunctionInfo *Info;
if (info_item == FunctionInfoMap.end()) {
// Calculate apropriate function info and populate map
FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData());
Info = &FunctionInfoMap[F];
} else {
- Info = &(info_item->second);
+ Info = &info_item->second;
}
switch (Info->getDecorationStyle()) {
- case None:
+ case None:
break;
- case StdCall:
- if (!F->isVarArg()) {
- // Variadic functions do not receive @0 suffix
+ case StdCall:
+ if (!F->isVarArg()) // Variadic functions do not receive @0 suffix.
Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
- }
break;
- case FastCall:
- if (!F->isVarArg()) {
- // Variadic functions do not receive @0 suffix
+ case FastCall:
+ if (!F->isVarArg()) // Variadic functions do not receive @0 suffix.
Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
- }
+
if (Name[0] == '_') {
Name[0] = '@';
} else {
Name = '@' + Name;
}
break;
- default:
+ default:
assert(0 && "Unsupported DecorationStyle");
}
-
}
/// doInitialization
Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.32 llvm/lib/Target/X86/X86AsmPrinter.h:1.33
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.32 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Mon Sep 25 22:57:53 2006
@@ -46,19 +46,18 @@
Subtarget = &TM.getSubtarget<X86Subtarget>();
}
- typedef std::map<const Function*, X86FunctionInfo> FMFInfoMap ;
-
// We have to propagate some information about MachineFunction to
// AsmPrinter. It's ok, when we're printing the function, since we have
- // access to MachineFunction and can get the appropriate MachineFunctionInfo.
+ // access to MachineFunction and can get the appropriate MachineFunctionInfo.
// Unfortunately, this is not possible when we're printing reference to
// Function (e.g. calling it and so on). Even more, there is no way to get the
// corresponding MachineFunctions: it can even be not created at all. That's
// why we should use additional structure, when we're collecting all necessary
// information.
-
+ //
// This structure is using e.g. for name decoration for stdcall & fastcall'ed
// function, since we have to use arguments' size for decoration.
+ typedef std::map<const Function*, X86FunctionInfo> FMFInfoMap;
FMFInfoMap FunctionInfoMap;
void decorateName(std::string& Name, const GlobalValue* GV);
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 llvm/lib/Target/X86/X86ISelLowering.cpp:1.264
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 Wed Sep 20 21:08:31 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Sep 25 22:57:53 2006
@@ -1523,9 +1523,8 @@
return DAG.getNode(ISD::MERGE_VALUES, RetVTs, &ArgValues[0],ArgValues.size());
}
-SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op,
- SelectionDAG &DAG,
- bool isFastCall){
+SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG,
+ bool isFastCall) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.58
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Mon Sep 25 22:57:53 2006
@@ -36,14 +36,13 @@
EmitConstantPool(MF.getConstantPool());
// Print out labels for the function.
- const Function* F = MF.getFunction();
+ const Function *F = MF.getFunction();
unsigned CC = F->getCallingConv();
// Populate function information map. Actually, We don't want to populate
// non-stdcall or non-fastcall functions' information right now.
- if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) {
- FunctionInfoMap[F] = *(MF.getInfo<X86FunctionInfo>());
- }
+ if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall)
+ FunctionInfoMap[F] = *MF.getInfo<X86FunctionInfo>();
X86SharedAsmPrinter::decorateName(CurrentFnName, F);
Index: llvm/lib/Target/X86/X86MachineFunctionInfo.h
diff -u llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.4
--- llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86MachineFunctionInfo.h Mon Sep 25 22:57:53 2006
@@ -46,7 +46,7 @@
BytesToPopOnReturn(0),
DecorationStyle(None) {}
- X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false),
+ X86FunctionInfo(MachineFunction &MF) : ForceFramePointer(false),
BytesToPopOnReturn(0),
DecorationStyle(None) {}
More information about the llvm-commits
mailing list