diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-02-20 05:49:22 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-02-20 05:49:22 +0000 |
| commit | 73ffc88a8b834965a4734f1996909d758dd89ffb (patch) | |
| tree | b821b46309c30ef72614bdaa8710f0c5c53ea034 /llvm/lib/Target/CBackend/Writer.cpp | |
| parent | 74b387dea1e77d5429779de47977535b39e97584 (diff) | |
| download | bcm5719-llvm-73ffc88a8b834965a4734f1996909d758dd89ffb.tar.gz bcm5719-llvm-73ffc88a8b834965a4734f1996909d758dd89ffb.zip | |
It is totally unacceptable to print out (literally) millions of zeros when
compiling 129.compress... so don't!
llvm-svn: 11649
Diffstat (limited to 'llvm/lib/Target/CBackend/Writer.cpp')
| -rw-r--r-- | llvm/lib/Target/CBackend/Writer.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/Target/CBackend/Writer.cpp b/llvm/lib/Target/CBackend/Writer.cpp index b52db0346a9..93e5b07f5f2 100644 --- a/llvm/lib/Target/CBackend/Writer.cpp +++ b/llvm/lib/Target/CBackend/Writer.cpp @@ -728,10 +728,21 @@ bool CWriter::doInitialization(Module &M) { // this, however, occurs when the variable has weak linkage. In this // case, the assembler will complain about the variable being both weak // and common, so we disable this optimization. - if (!I->getInitializer()->isNullValue() || - I->hasWeakLinkage()) { + if (!I->getInitializer()->isNullValue()) { Out << " = " ; writeOperand(I->getInitializer()); + } else if (I->hasWeakLinkage()) { + // We have to specify an initializer, but it doesn't have to be + // complete. If the value is an aggregate, print out { 0 }, and let + // the compiler figure out the rest of the zeros. + Out << " = " ; + if (isa<StructType>(I->getInitializer()->getType()) || + isa<ArrayType>(I->getInitializer()->getType())) { + Out << "{ 0 }"; + } else { + // Just print it out normally. + writeOperand(I->getInitializer()); + } } Out << ";\n"; } |

