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

Alkis Evlogimenos alkis at cs.uiuc.edu
Mon Dec 13 18:58:05 PST 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.180 -> 1.181
---
Log message:

Fix types after change to ConstantExpr::getSizeOf().


---
Diffs of the changes:  (+11 -5)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.180 llvm-java/lib/Compiler/Compiler.cpp:1.181
--- llvm-java/lib/Compiler/Compiler.cpp:1.180	Sun Dec 12 01:21:15 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Mon Dec 13 20:57:54 2004
@@ -2302,14 +2302,20 @@
                             Type* elementTy,
                             const VTableInfo& vi,
                             Value* count) {
+      // The size of the element.
+      llvm::Constant* elementSize =
+        ConstantExpr::getCast(ConstantExpr::getSizeOf(elementTy), Type::UIntTy);
+
       // The size of the array part of the struct.
       Value* size = BinaryOperator::create(
-        Instruction::Mul, count, ConstantExpr::getSizeOf(elementTy),
-        TMP, currentBB_);
-      // Plus the size of the rest of the struct.
+        Instruction::Mul, count, elementSize, TMP, currentBB_);
+      // The size of the rest of the array object.
+      llvm::Constant* arrayObjectSize = 
+        ConstantExpr::getCast(ConstantExpr::getSizeOf(ci.type), Type::UIntTy);
+
+      // Add the array part plus the object part together.
       size = BinaryOperator::create(
-        Instruction::Add, size, ConstantExpr::getSizeOf(ci.type),
-        TMP, currentBB_);
+        Instruction::Add, size, arrayObjectSize, TMP, currentBB_);
       // Allocate memory for the object.
       Value* objRef = new MallocInst(Type::SByteTy, size, TMP, currentBB_);
       objRef = new CastInst(objRef, PointerType::get(ci.type), TMP, currentBB_);






More information about the llvm-commits mailing list