diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-06-28 11:09:01 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-06-28 11:09:01 +0000 |
commit | 1ecf0eedc4c1c453946fa9812a24392117b1e05e (patch) | |
tree | 84ab6baa8ef767cceef893d84b60f406f8895dbd /lib | |
parent | 36a5701ad7878fd54b197625f8c6796b544b100f (diff) | |
download | external_llvm-1ecf0eedc4c1c453946fa9812a24392117b1e05e.zip external_llvm-1ecf0eedc4c1c453946fa9812a24392117b1e05e.tar.gz external_llvm-1ecf0eedc4c1c453946fa9812a24392117b1e05e.tar.bz2 |
Factor out stuff into helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86ATTAsmPrinter.cpp | 70 | ||||
-rw-r--r-- | lib/Target/X86/X86ATTAsmPrinter.h | 2 |
2 files changed, 39 insertions, 33 deletions
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index 602fa51..5b3e420 100644 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -167,31 +167,8 @@ std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { } } -/// 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 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { 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 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { (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 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { 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); diff --git a/lib/Target/X86/X86ATTAsmPrinter.h b/lib/Target/X86/X86ATTAsmPrinter.h index 2c80df4..025a157 100644 --- a/lib/Target/X86/X86ATTAsmPrinter.h +++ b/lib/Target/X86/X86ATTAsmPrinter.h @@ -124,6 +124,8 @@ struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { /// 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; |