diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-19 04:39:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-19 04:39:15 +0000 |
commit | 6a160517a0690fc9ddda4511174e08d8d5557821 (patch) | |
tree | 5dbfe144342fabfbf728b786dca8c4e881abed2c /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | e9d28b19cf3864c0e44e15036dc71e8e4eb31088 (diff) | |
download | bcm5719-llvm-6a160517a0690fc9ddda4511174e08d8d5557821.tar.gz bcm5719-llvm-6a160517a0690fc9ddda4511174e08d8d5557821.zip |
hoist handling of external globals and special globals up to common code.
This makes a similar code dead in all the other targets, I'll clean it up
in a bit.
This also moves handling of lcomm up before acquisition of a section,
since lcomm never needs a section.
llvm-svn: 93851
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 9a19f81e38b..0ae3ecb363c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -135,11 +135,25 @@ bool AsmPrinter::doInitialization(Module &M) { return false; } +/// EmitGlobalVariable - Emit the specified global variable to the .s file. +void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { + if (!GV->hasInitializer()) // External globals require no code. + return; + + // Check to see if this is a special global used by LLVM, if so, emit it. + if (EmitSpecialLLVMGlobal(GV)) + return; + + // Let the target emit it. + PrintGlobalVariable(GV); +} + + bool AsmPrinter::doFinalization(Module &M) { // Emit global variables. for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - PrintGlobalVariable(I); + EmitGlobalVariable(I); // Emit final debug information. if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling()) |