[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed Jul 14 02:54:04 PDT 2004
Changes in directory llvm-java/lib/Compiler:
Compiler.cpp updated: 1.58 -> 1.59
---
Log message:
Use internal linkage for private globals with a constant initializer.
---
Diffs of the changes: (+9 -3)
Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.58 llvm-java/lib/Compiler/Compiler.cpp:1.59
--- llvm-java/lib/Compiler/Compiler.cpp:1.58 Wed Jul 14 04:44:43 2004
+++ llvm-java/lib/Compiler/Compiler.cpp Wed Jul 14 04:53:54 2004
@@ -234,15 +234,21 @@
const Fields& fields = cf->getFields();
for (unsigned i = 0, e = fields.size(); i != e; ++i) {
const Field* field = fields[i];
- if (field->isStatic())
+ if (field->isStatic()) {
+ llvm::Constant* init = NULL;
+ if (const ConstantValueAttribute* cv =
+ field->getConstantValueAttribute())
+ init = getConstant(cv->getValue());
+
new GlobalVariable(getType(field->getDescriptor()),
field->isFinal(),
- (field->isPrivate() ?
+ (field->isPrivate() & bool(init) ?
GlobalVariable::InternalLinkage :
GlobalVariable::ExternalLinkage),
- NULL,
+ init,
className + '/' + field->getName()->str(),
module_);
+ }
else
elements.push_back(getType(field->getDescriptor()));
}
More information about the llvm-commits
mailing list