[vmkit-commits] [vmkit] r198491 - Flatten/unflatten can now consider new invariants
Gael Thomas
gael.thomas at lip6.fr
Sat Jan 4 05:56:38 PST 2014
Author: gthomas
Date: Sat Jan 4 07:56:38 2014
New Revision: 198491
URL: http://llvm.org/viewvc/llvm-project?rev=198491&view=rev
Log:
Flatten/unflatten can now consider new invariants
Modified:
vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
Modified: vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc?rev=198491&r1=198490&r2=198491&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc Sat Jan 4 07:56:38 2014
@@ -161,35 +161,38 @@ uint32_t J3CodeGen::wideReadS1() {
llvm::Value* J3CodeGen::flatten(llvm::Value* v, llvm::Type* type) {
if(type == vm->typeInteger->llvmType() || type == vm->typeLong->llvmType() ||
- type == vm->typeFloat->llvmType() || type == vm->typeDouble->llvmType())
+ type == vm->typeFloat->llvmType() || type == vm->typeDouble->llvmType() ||
+ (type->isPointerTy() && (v->getType() == vm->typeJ3ObjectPtr)))
return v;
- else if(type->isPointerTy()) {
- if(v->getType() == vm->typeJ3ObjectPtr)
- return v;
- else
- return builder->CreateBitCast(v, vm->typeJ3ObjectPtr);
- } else if(type == vm->typeBoolean->llvmType() || type == vm->typeByte->llvmType() || type == vm->typeShort->llvmType())
+ else if(type == vm->typeBoolean->llvmType() || type == vm->typeByte->llvmType() || type == vm->typeShort->llvmType())
return builder->CreateSExt(v, vm->typeInteger->llvmType());
else if(type == vm->typeChar->llvmType())
return builder->CreateZExt(v, vm->typeInteger->llvmType());
- else
- J3::internalError("should not happen");
+
+ fprintf(stderr, " v: ");
+ v->getType()->dump();
+ fprintf(stderr, "\n type: ");
+ type->dump();
+ fprintf(stderr, "\n");
+ J3::internalError("should not happen");
}
llvm::Value* J3CodeGen::unflatten(llvm::Value* v, llvm::Type* type) {
if(type == vm->typeInteger->llvmType() || type == vm->typeLong->llvmType() ||
- type == vm->typeFloat->llvmType() || type == vm->typeDouble->llvmType())
+ type == vm->typeFloat->llvmType() || type == vm->typeDouble->llvmType() ||
+ (type->isPointerTy() && type == v->getType()))
return v;
- else if(type->isPointerTy())
- return builder->CreateBitCast(v, type);
else if(type == vm->typeBoolean->llvmType() || type == vm->typeByte->llvmType() || type == vm->typeShort->llvmType())
return builder->CreateSExtOrTrunc(v, type);
else if(type == vm->typeChar->llvmType())
return builder->CreateZExtOrTrunc(v, type);
- else {
- type->dump();
- J3::internalError("should not happen");
- }
+
+ fprintf(stderr, " v: ");
+ v->getType()->dump();
+ fprintf(stderr, "\n type: ");
+ type->dump();
+ fprintf(stderr, "\n");
+ J3::internalError("should not happen");
}
llvm::Function* J3CodeGen::buildFunction(J3Method* method, bool isStub) {
More information about the vmkit-commits
mailing list