[llvm-commits] [llvm] r52862 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h
Anton Korobeynikov
asl at math.spbu.ru
Sat Jun 28 04:09:01 PDT 2008
Author: asl
Date: Sat Jun 28 06:09:01 2008
New Revision: 52862
URL: http://llvm.org/viewvc/llvm-project?rev=52862&view=rev
Log:
Factor out stuff into helper function
Modified:
llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h
Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52862&r1=52861&r2=52862&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:09:01 2008
@@ -167,31 +167,8 @@
}
}
-/// runOnMachineFunction - This uses the printMachineInstruction()
-/// method to print assembly for each instruction.
-///
-bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- if (TAI->doesSupportDebugInformation()) {
- // Let PassManager know we need debug information and relay
- // the MachineModuleInfo address on to DwarfWriter.
- MMI = &getAnalysis<MachineModuleInfo>();
- DW.SetModuleInfo(MMI);
- }
-
- SetupMachineFunction(MF);
- O << "\n\n";
-
- // Print out constants referenced by the function
- EmitConstantPool(MF.getConstantPool());
-
- // Print out labels for the function.
+void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
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<X86MachineFunctionInfo>();
decorateName(CurrentFnName, F);
@@ -204,8 +181,6 @@
EmitAlignment(FnAlign, F);
break;
case Function::DLLExportLinkage:
- DLLExportedFns.insert(Mang->makeNameProper(F->getName(), ""));
- //FALLS THROUGH
case Function::ExternalLinkage:
EmitAlignment(FnAlign, F);
O << "\t.globl\t" << CurrentFnName << "\n";
@@ -248,13 +223,43 @@
(F->getLinkage() == Function::LinkOnceLinkage ||
F->getLinkage() == Function::WeakLinkage))
O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
+}
- if (TAI->doesSupportDebugInformation() ||
- TAI->doesSupportExceptionHandling()) {
- // Emit pre-function debug and/or EH information.
- DW.BeginFunction(&MF);
+/// runOnMachineFunction - This uses the printMachineInstruction()
+/// method to print assembly for each instruction.
+///
+bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
+ const Function *F = MF.getFunction();
+ unsigned CC = F->getCallingConv();
+
+ if (TAI->doesSupportDebugInformation()) {
+ // Let PassManager know we need debug information and relay
+ // the MachineModuleInfo address on to DwarfWriter.
+ MMI = &getAnalysis<MachineModuleInfo>();
+ DW.SetModuleInfo(MMI);
}
+ SetupMachineFunction(MF);
+ O << "\n\n";
+
+ // 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<X86MachineFunctionInfo>();
+
+ // Print out constants referenced by the function
+ EmitConstantPool(MF.getConstantPool());
+
+ if (F->hasDLLExportLinkage())
+ DLLExportedFns.insert(Mang->makeNameProper(F->getName(), ""));
+
+ // Print the 'header' of function
+ emitFunctionHeader(MF);
+
+ // Emit pre-function debug and/or EH information.
+ if (TAI->doesSupportDebugInformation() || TAI->doesSupportExceptionHandling())
+ DW.BeginFunction(&MF);
+
// Print out code for the function.
bool hasAnyRealCode = false;
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
@@ -284,10 +289,9 @@
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << "\n";
- if (TAI->doesSupportDebugInformation()) {
- // Emit post-function debug information.
+ // Emit post-function debug information.
+ if (TAI->doesSupportDebugInformation())
DW.EndFunction();
- }
// Print out jump tables referenced by the function.
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=52862&r1=52861&r2=52862&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Sat Jun 28 06:09:01 2008
@@ -124,6 +124,8 @@
/// specified function body into.
virtual std::string getSectionForFunction(const Function &F) const;
+ void emitFunctionHeader(const MachineFunction &MF);
+
// Necessary for Darwin to print out the apprioriate types of linker stubs
StringSet<> FnStubs, GVStubs, LinkOnceStubs;
More information about the llvm-commits
mailing list