[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Jun 12 19:44:01 PDT 2004


Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.43 -> 1.44

---
Log message:

Local variables can be reused so if our curent type does not match
create another one. Also initialization is not required as the java
source to bytecode compiler is responsible for that.


---
Diffs of the changes:  (+4 -6)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.43 llvm-java/lib/Compiler/Compiler.cpp:1.44
--- llvm-java/lib/Compiler/Compiler.cpp:1.43	Thu Jun 10 04:54:11 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Sat Jun 12 19:37:46 2004
@@ -196,12 +196,10 @@
         }
 
         Value* getOrCreateLocal(unsigned index, const Type* type) {
-            if (!locals_[index]) {
-                locals_[index] = new AllocaInst(type, NULL,
-                                                "local" + utostr(index),
-                                                prologue_);
-                new StoreInst(llvm::Constant::getNullValue(type),
-                              locals_[index], prologue_);
+            if (!locals_[index] ||
+                cast<PointerType>(locals_[index]->getType())->getElementType() != type) {
+                locals_[index] = new AllocaInst
+                    (type, NULL, "local" + utostr(index), prologue_);
             }
 
             return locals_[index];





More information about the llvm-commits mailing list