diff options
author | Nick Hildenbrandt <hldnbrnd@uiuc.edu> | 2002-10-28 19:05:12 +0000 |
---|---|---|
committer | Nick Hildenbrandt <hldnbrnd@uiuc.edu> | 2002-10-28 19:05:12 +0000 |
commit | 50de36a41dec7a2e230744bd2b257ab2b8c76231 (patch) | |
tree | 30a52de777fbd9bd05e7688e453a3746c095b31e /lib/Target/CBackend/CBackend.cpp | |
parent | fcffe865f9003e592e09f1eea13da213eb1781e3 (diff) |
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 4227114b15..196281f6e8 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -451,7 +451,7 @@ void CWriter::writeOperandInternal(Value *Operand) { return; } - if (Operand->hasName()) { + if (Operand->hasName()) { Out << getValueName(Operand); } else if (Constant *CPV = dyn_cast<Constant>(Operand)) { printConstant(CPV); @@ -575,6 +575,19 @@ void CWriter::printModule(Module *M) { Out << "extern void * malloc(size_t);\n\n"; } + // Output the global variable declerations + if (!M->gempty()) { + Out << "\n\n/* Global Variable Declerations */\n"; + for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + if (!I->isExternal()) { + Out << "extern "; + printType(I->getType()->getElementType(), getValueName(I)); + + Out << ";\n"; + } + } + + // Output the global variable definitions and contents... if (!M->gempty()) { Out << "\n\n/* Global Variable Definitions and Initialization */\n"; |