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 | 48d64ba9d846229339b2431b298620cb8a01ffc5 (patch) | |
| tree | 604d4db965eed12c4ce27a78e96ac0d9b66c487c /lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
| parent | 71eae713153e564ec743c5c4162ff258c255de78 (diff) | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
| -rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 9a19f81e38..0ae3ecb363 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/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()) |
