[vmkit-commits] [vmkit] r75462 - in /vmkit/trunk/lib: JnJVM/Compiler/ExceptionsCheck.inc JnJVM/Compiler/ExceptionsDwarf.inc JnJVM/Compiler/JITInfo.cpp JnJVM/Compiler/JavaAOTCompiler.cpp JnJVM/Compiler/JavaJIT.cpp JnJVM/Compiler/JavaJIT.h JnJVM/Compiler/JavaJITOpcodes.cpp JnJVM/Compiler/JnjvmModule.cpp JnJVM/Compiler/LowerConstantCalls.cpp Mvm/Compiler/JIT.cpp N3/Mono/MonoString.cpp N3/PNetLib/PNetString.cpp N3/VMCore/CLIJit.cpp N3/VMCore/CLIJitMeta.cpp N3/VMCore/Opcodes.cpp N3/VMCore/VMCache.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Jul 13 04:22:24 PDT 2009
Author: geoffray
Date: Mon Jul 13 06:22:20 2009
New Revision: 75462
URL: http://llvm.org/viewvc/llvm-project?rev=75462&view=rev
Log:
Move to new LLVM API.
Modified:
vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc
vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc
vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp
vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h
vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp
vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp
vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp
vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
vmkit/trunk/lib/N3/Mono/MonoString.cpp
vmkit/trunk/lib/N3/PNetLib/PNetString.cpp
vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp
vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
vmkit/trunk/lib/N3/VMCore/VMCache.cpp
Modified: vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc Mon Jul 13 06:22:20 2009
@@ -34,12 +34,12 @@
// the function is readnone.
obj = new LoadInst(javaExceptionPtr, "", true, currentBlock);
test = new BitCastInst(res, module->JavaObjectType, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_EQ, test, obj, "", currentBlock);
- Value* T = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
+ Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
test = BinaryOperator::CreateAnd(test, T, "", currentBlock);
} else {
obj = new LoadInst(javaExceptionPtr, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
}
BranchInst::Create(currentExceptionBlock, ifNormal, test, currentBlock);
@@ -84,12 +84,12 @@
F == module->GetClassDelegateeFunction) {
obj = new LoadInst(javaExceptionPtr, "", true, currentBlock);
test = new BitCastInst(res, module->JavaObjectType, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_EQ, test, obj, "", currentBlock);
- Value* T = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
+ Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
test = BinaryOperator::CreateAnd(test, T, "", currentBlock);
} else {
obj = new LoadInst(javaExceptionPtr, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
}
BranchInst::Create(currentExceptionBlock, ifNormal, test, currentBlock);
@@ -135,12 +135,12 @@
F == module->GetClassDelegateeFunction) {
obj = new LoadInst(javaExceptionPtr, "", true, currentBlock);
test = new BitCastInst(res, module->JavaObjectType, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_EQ, test, obj, "", currentBlock);
- Value* T = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
+ Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
test = BinaryOperator::CreateAnd(test, T, "", currentBlock);
} else {
obj = new LoadInst(javaExceptionPtr, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
}
BranchInst::Create(currentExceptionBlock, ifNormal, test, currentBlock);
@@ -183,12 +183,12 @@
F == module->GetClassDelegateeFunction) {
obj = new LoadInst(javaExceptionPtr, "", true, currentBlock);
test = new BitCastInst(res, module->JavaObjectType, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_EQ, test, obj, "", currentBlock);
- Value* T = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
+ Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
test = BinaryOperator::CreateAnd(test, T, "", currentBlock);
} else {
obj = new LoadInst(javaExceptionPtr, "", currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_NE, obj, zero, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
}
BranchInst::Create(currentExceptionBlock, ifNormal, test, currentBlock);
@@ -214,7 +214,7 @@
BranchInst::Create(currentExceptionBlock, currentBlock);
} else {
if (endNode) {
- endNode->addIncoming(Constant::getNullValue(endNode->getType()),
+ endNode->addIncoming(llvmContext->getNullValue(endNode->getType()),
currentBlock);
}
BranchInst::Create(endBlock, currentBlock);
@@ -237,7 +237,7 @@
BranchInst::Create(currentExceptionBlock, currentBlock);
} else {
if (endNode) {
- endNode->addIncoming(Constant::getNullValue(endNode->getType()),
+ endNode->addIncoming(llvmContext->getNullValue(endNode->getType()),
currentBlock);
}
BranchInst::Create(endBlock, currentBlock);
@@ -254,7 +254,7 @@
BranchInst::Create(currentExceptionBlock, currentBlock);
} else {
if (endNode) {
- endNode->addIncoming(Constant::getNullValue(endNode->getType()),
+ endNode->addIncoming(llvmContext->getNullValue(endNode->getType()),
currentBlock);
}
BranchInst::Create(endBlock, currentBlock);
@@ -411,8 +411,8 @@
Status = new LoadInst(Status, "", currentBlock);
Status = new PtrToIntInst(Status, Type::Int32Ty, "", currentBlock);
- Value* stopping = new ICmpInst(ICmpInst::ICMP_EQ, Status,
- module->constantOne, "", currentBlock);
+ Value* stopping = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, Status,
+ module->constantOne, "");
BasicBlock* raiseBlock = createBasicBlock("raiseBlock");
BasicBlock* continueBlock = createBasicBlock("continueBlock");
@@ -451,8 +451,8 @@
displayArgs, displayArgs + 2, "",
currentBlock);
- cmp = new ICmpInst(ICmpInst::ICMP_EQ, VTInDisplay, VTVar, "",
- currentBlock);
+ cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, VTInDisplay, VTVar,
+ "");
}
// Add the Java exception in the phi node of the handler.
@@ -533,7 +533,7 @@
endExceptionBlock->eraseFromParent();
} else {
if (endNode) {
- endNode->addIncoming(Constant::getNullValue(endNode->getType()),
+ endNode->addIncoming(llvmContext->getNullValue(endNode->getType()),
endExceptionBlock);
}
BranchInst::Create(endBlock, endExceptionBlock);
@@ -556,7 +556,7 @@
Instruction* insn = BI->begin();
PHINode* node = dyn_cast<PHINode>(insn);
if (node) {
- node->replaceAllUsesWith(Constant::getNullValue(node->getType()));
+ node->replaceAllUsesWith(llvmContext->getNullValue(node->getType()));
node->eraseFromParent();
}
}
Modified: vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc Mon Jul 13 06:22:20 2009
@@ -399,8 +399,8 @@
Status = new LoadInst(Status, "", currentBlock);
Status = new PtrToIntInst(Status, Type::Int32Ty, "", currentBlock);
- Value* stopping = new ICmpInst(ICmpInst::ICMP_EQ, Status,
- module->constantOne, "", currentBlock);
+ Value* stopping = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, Status,
+ module->constantOne, "");
BasicBlock* raiseBlock = createBasicBlock("raiseBlock");
BasicBlock* continueBlock = createBasicBlock("continueBlock");
@@ -431,8 +431,8 @@
currentBlock);
// Compare the exception with the exception class we catch.
- Value* cmp = new ICmpInst(ICmpInst::ICMP_ULE, depthCl, depthClObj, "",
- currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_ULE, depthCl,
+ depthClObj, "");
BasicBlock* supDepth = createBasicBlock("superior depth");
@@ -450,8 +450,8 @@
displayArgs, displayArgs + 2, "",
currentBlock);
- cmp = new ICmpInst(ICmpInst::ICMP_EQ, clInDisplay, clVar, "",
- currentBlock);
+ cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, clInDisplay, clVar,
+ "");
// If we are catching this exception, then jump to the nativeHandler,
// otherwise jump to our next handler.
Modified: vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp Mon Jul 13 06:22:20 2009
@@ -543,56 +543,56 @@
AssessorInfo[I_BOOL].llvmType = Type::Int8Ty;
AssessorInfo[I_BOOL].llvmTypePtr = PointerType::getUnqual(Type::Int8Ty);
AssessorInfo[I_BOOL].llvmNullConstant =
- Constant::getNullValue(Type::Int8Ty);
+ mvm::MvmModule::globalContext->getNullValue(Type::Int8Ty);
AssessorInfo[I_BOOL].logSizeInBytesConstant =
mvm::MvmModule::constantZero;
AssessorInfo[I_BYTE].llvmType = Type::Int8Ty;
AssessorInfo[I_BYTE].llvmTypePtr = PointerType::getUnqual(Type::Int8Ty);
AssessorInfo[I_BYTE].llvmNullConstant =
- Constant::getNullValue(Type::Int8Ty);
+ mvm::MvmModule::globalContext->getNullValue(Type::Int8Ty);
AssessorInfo[I_BYTE].logSizeInBytesConstant =
mvm::MvmModule::constantZero;
AssessorInfo[I_SHORT].llvmType = Type::Int16Ty;
AssessorInfo[I_SHORT].llvmTypePtr = PointerType::getUnqual(Type::Int16Ty);
AssessorInfo[I_SHORT].llvmNullConstant =
- Constant::getNullValue(Type::Int16Ty);
+ mvm::MvmModule::globalContext->getNullValue(Type::Int16Ty);
AssessorInfo[I_SHORT].logSizeInBytesConstant =
mvm::MvmModule::constantOne;
AssessorInfo[I_CHAR].llvmType = Type::Int16Ty;
AssessorInfo[I_CHAR].llvmTypePtr = PointerType::getUnqual(Type::Int16Ty);
AssessorInfo[I_CHAR].llvmNullConstant =
- Constant::getNullValue(Type::Int16Ty);
+ mvm::MvmModule::globalContext->getNullValue(Type::Int16Ty);
AssessorInfo[I_CHAR].logSizeInBytesConstant =
mvm::MvmModule::constantOne;
AssessorInfo[I_INT].llvmType = Type::Int32Ty;
AssessorInfo[I_INT].llvmTypePtr = PointerType::getUnqual(Type::Int32Ty);
AssessorInfo[I_INT].llvmNullConstant =
- Constant::getNullValue(Type::Int32Ty);
+ mvm::MvmModule::globalContext->getNullValue(Type::Int32Ty);
AssessorInfo[I_INT].logSizeInBytesConstant =
mvm::MvmModule::constantTwo;
AssessorInfo[I_FLOAT].llvmType = Type::FloatTy;
AssessorInfo[I_FLOAT].llvmTypePtr = PointerType::getUnqual(Type::FloatTy);
AssessorInfo[I_FLOAT].llvmNullConstant =
- Constant::getNullValue(Type::FloatTy);
+ mvm::MvmModule::globalContext->getNullValue(Type::FloatTy);
AssessorInfo[I_FLOAT].logSizeInBytesConstant =
mvm::MvmModule::constantTwo;
AssessorInfo[I_LONG].llvmType = Type::Int64Ty;
AssessorInfo[I_LONG].llvmTypePtr = PointerType::getUnqual(Type::Int64Ty);
AssessorInfo[I_LONG].llvmNullConstant =
- Constant::getNullValue(Type::Int64Ty);
+ mvm::MvmModule::globalContext->getNullValue(Type::Int64Ty);
AssessorInfo[I_LONG].logSizeInBytesConstant =
mvm::MvmModule::constantThree;
AssessorInfo[I_DOUBLE].llvmType = Type::DoubleTy;
AssessorInfo[I_DOUBLE].llvmTypePtr = PointerType::getUnqual(Type::DoubleTy);
AssessorInfo[I_DOUBLE].llvmNullConstant =
- Constant::getNullValue(Type::DoubleTy);
+ mvm::MvmModule::globalContext->getNullValue(Type::DoubleTy);
AssessorInfo[I_DOUBLE].logSizeInBytesConstant =
mvm::MvmModule::constantThree;
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Mon Jul 13 06:22:20 2009
@@ -64,10 +64,10 @@
Ty = JnjvmModule::JavaClassType->getContainedType(0);
}
- GlobalVariable* varGV =
- new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage, 0,
- UTF8Buffer(classDef->name).toCompileName()->cString(),
- getLLVMModule());
+ const char* val = UTF8Buffer(classDef->name).toCompileName()->cString();
+ GlobalVariable* varGV =
+ new GlobalVariable(*getLLVMModule(), Ty, false,
+ GlobalValue::ExternalLinkage, 0, val);
nativeClasses.insert(std::make_pair(classDef, varGV));
@@ -92,13 +92,13 @@
array_class_iterator End = arrayClasses.end();
array_class_iterator I = arrayClasses.find(classDef->asArrayClass());
if (I == End) {
- const llvm::Type* Ty = JnjvmModule::JavaClassArrayType;
+ const llvm::Type* Ty = JnjvmModule::JavaClassArrayType;
+ Module& Mod = *getLLVMModule();
+ const char* name = UTF8Buffer(classDef->name).toCompileName()->cString();
GlobalVariable* varGV =
- new GlobalVariable(Ty, false, GlobalValue::InternalLinkage,
- Constant::getNullValue(Ty),
- UTF8Buffer(classDef->name).toCompileName()->cString(),
- getLLVMModule());
+ new GlobalVariable(Mod, Ty, false, GlobalValue::InternalLinkage,
+ Mod.getContext().getNullValue(Ty), name);
arrayClasses.insert(std::make_pair(classDef->asArrayClass(), varGV));
return varGV;
@@ -117,9 +117,11 @@
constant_pool_iterator I = constantPools.find(ctp);
if (I == End) {
const Type* Ty = JnjvmModule::ConstantPoolType->getContainedType(0);
- varGV = new GlobalVariable(Ty, false,
+ Module& Mod = *getLLVMModule();
+
+ varGV = new GlobalVariable(Mod, Ty, false,
GlobalValue::InternalLinkage,
- Constant::getNullValue(Ty), "", getLLVMModule());
+ Mod.getContext().getNullValue(Ty), "");
constantPools.insert(std::make_pair(ctp, varGV));
return varGV;
} else {
@@ -151,10 +153,11 @@
assert(str && "No string given");
LLVMClassInfo* LCI = getClassInfo(str->getClass()->asClass());
const llvm::Type* Ty = LCI->getVirtualType();
+ Module& Mod = *getLLVMModule();
+
GlobalVariable* varGV =
- new GlobalVariable(Ty->getContainedType(0), false,
- GlobalValue::InternalLinkage,
- 0, "", getLLVMModule());
+ new GlobalVariable(Mod, Ty->getContainedType(0), false,
+ GlobalValue::InternalLinkage, 0, "");
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
JnjvmModule::JavaObjectType);
strings.insert(std::make_pair(str, res));
@@ -169,9 +172,10 @@
if (SI != enveloppes.end()) {
return SI->second;
} else {
+ Module& Mod = *getLLVMModule();
GlobalVariable* varGV =
- new GlobalVariable(JnjvmModule::EnveloppeType->getContainedType(0), false,
- GlobalValue::InternalLinkage, 0, "", getLLVMModule());
+ new GlobalVariable(Mod, JnjvmModule::EnveloppeType->getContainedType(0),
+ false, GlobalValue::InternalLinkage, 0, "");
enveloppes.insert(std::make_pair(enveloppe, varGV));
Constant* C = CreateConstantFromEnveloppe(enveloppe);
@@ -187,10 +191,11 @@
Class* javaClass = cl->classLoader->bootstrapLoader->upcalls->newClass;
LLVMClassInfo* LCI = getClassInfo(javaClass);
const llvm::Type* Ty = LCI->getVirtualType();
+ Module& Mod = *getLLVMModule();
GlobalVariable* varGV =
- new GlobalVariable(Ty->getContainedType(0), false,
- GlobalValue::InternalLinkage, 0, "", getLLVMModule());
+ new GlobalVariable(Mod, Ty->getContainedType(0), false,
+ GlobalValue::InternalLinkage, 0, "");
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
JnjvmModule::JavaObjectType);
@@ -264,8 +269,9 @@
Ty = LCI->getVirtualType()->getContainedType(0);
}
- varGV = new GlobalVariable(Ty, false, GlobalValue::InternalLinkage,
- 0, "", getLLVMModule());
+ Module& Mod = *getLLVMModule();
+ varGV = new GlobalVariable(Mod, Ty, false, GlobalValue::InternalLinkage,
+ 0, "");
Constant* C = ConstantExpr::getBitCast(varGV,
JnjvmModule::JavaObjectType);
@@ -290,6 +296,7 @@
LLVMClassInfo* LCI = getClassInfo(cl);
const Type* Ty = LCI->getStaticType();
const StructType* STy = dyn_cast<StructType>(Ty->getContainedType(0));
+ Module& Mod = *getLLVMModule();
std::vector<Constant*> Elts;
@@ -339,11 +346,11 @@
Constant* CO = getFinalObject(val);
Elts.push_back(CO);
} else {
- Elts.push_back(Constant::getNullValue(Ty));
+ Elts.push_back(Mod.getContext().getNullValue(Ty));
}
}
} else {
- Elts.push_back(Constant::getNullValue(Ty));
+ Elts.push_back(Mod.getContext().getNullValue(Ty));
}
} else {
Reader reader(attribut, cl->bytes);
@@ -389,9 +396,10 @@
Ty = Ty->getContainedType(0);
std::string name(UTF8Buffer(classDef->name).toCompileName()->cString());
name += "_static";
+ Module& Mod = *getLLVMModule();
GlobalVariable* varGV =
- new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage,
- 0, name, getLLVMModule());
+ new GlobalVariable(Mod, Ty, false, GlobalValue::ExternalLinkage,
+ 0, name);
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
JnjvmModule::ptrType);
@@ -431,9 +439,10 @@
name += "_VT";
// Do not set a virtual table as a constant, because the runtime may
// modify it.
- GlobalVariable* varGV = new GlobalVariable(ATy, false,
+ Module& Mod = *getLLVMModule();
+ GlobalVariable* varGV = new GlobalVariable(Mod, ATy, false,
GlobalValue::ExternalLinkage,
- 0, name, getLLVMModule());
+ 0, name);
res = ConstantExpr::getCast(Instruction::BitCast, varGV,
JnjvmModule::VTType);
@@ -459,10 +468,10 @@
LLVMSignatureInfo* LSI = getSignatureInfo(meth->getSignature());
const llvm::Type* valPtrType = LSI->getNativePtrType();
- varGV = new GlobalVariable(valPtrType, true,
+ Module& Mod = *getLLVMModule();
+ varGV = new GlobalVariable(Mod, valPtrType, true,
GlobalValue::InternalLinkage,
- Constant::getNullValue(valPtrType), "",
- getLLVMModule());
+ Mod.getContext().getNullValue(valPtrType), "");
nativeFunctions.insert(std::make_pair(meth, varGV));
return varGV;
@@ -490,6 +499,7 @@
Constant* JavaAOTCompiler::CreateConstantFromJavaClass(CommonClass* cl) {
Class* javaClass = cl->classLoader->bootstrapLoader->upcalls->newClass;
LLVMClassInfo* LCI = getClassInfo(javaClass);
+ Module& Mod = *getLLVMModule();
const StructType* STy =
dyn_cast<StructType>(LCI->getVirtualType()->getContainedType(0));
@@ -499,10 +509,10 @@
Elmts.push_back(CreateConstantForBaseObject(javaClass));
// signers
- Elmts.push_back(Constant::getNullValue(JnjvmModule::JavaObjectType));
+ Elmts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
// pd
- Elmts.push_back(Constant::getNullValue(JnjvmModule::JavaObjectType));
+ Elmts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
// vmdata
Constant* Cl = getNativeClass(cl);
@@ -511,13 +521,14 @@
Elmts.push_back(Cl);
// constructor
- Elmts.push_back(Constant::getNullValue(JnjvmModule::JavaObjectType));
+ Elmts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
return ConstantStruct::get(STy, Elmts);
}
Constant* JavaAOTCompiler::CreateConstantFromJavaObject(JavaObject* obj) {
CommonClass* cl = obj->getClass();
+ Module& Mod = *getLLVMModule();
if (cl->isArray()) {
Classpath* upcalls = cl->classLoader->bootstrapLoader->upcalls;
@@ -609,7 +620,7 @@
TempElts.push_back(C);
} else {
const llvm::Type* Ty = JnjvmModule::JavaObjectType;
- TempElts.push_back(Constant::getNullValue(Ty));
+ TempElts.push_back(Mod.getContext().getNullValue(Ty));
}
}
}
@@ -634,9 +645,10 @@
CreateConstantFromArray<ArrayUInt16>(str->value, Type::Int16Ty);
- GlobalVariable* varGV = new GlobalVariable(Array->getType(), false,
+ Module& Mod = *getLLVMModule();
+ GlobalVariable* varGV = new GlobalVariable(Mod, Array->getType(), false,
GlobalValue::InternalLinkage,
- Array, "", getLLVMModule());
+ Array, "");
Array = ConstantExpr::getBitCast(varGV, JnjvmModule::JavaObjectType);
@@ -652,11 +664,12 @@
Constant* JavaAOTCompiler::CreateConstantFromCacheNode(CacheNode* CN) {
const StructType* STy =
dyn_cast<StructType>(JnjvmModule::CacheNodeType->getContainedType(0));
+ Module& Mod = *getLLVMModule();
std::vector<Constant*> Elmts;
- Elmts.push_back(Constant::getNullValue(STy->getContainedType(0)));
- Elmts.push_back(Constant::getNullValue(STy->getContainedType(1)));
- Elmts.push_back(Constant::getNullValue(STy->getContainedType(2)));
+ Elmts.push_back(Mod.getContext().getNullValue(STy->getContainedType(0)));
+ Elmts.push_back(Mod.getContext().getNullValue(STy->getContainedType(1)));
+ Elmts.push_back(Mod.getContext().getNullValue(STy->getContainedType(2)));
Elmts.push_back(getEnveloppe(CN->enveloppe));
return ConstantStruct::get(STy, Elmts);
@@ -668,17 +681,18 @@
dyn_cast<StructType>(JnjvmModule::EnveloppeType->getContainedType(0));
const StructType* CNTy =
dyn_cast<StructType>(JnjvmModule::CacheNodeType->getContainedType(0));
+ Module& Mod = *getLLVMModule();
std::vector<Constant*> Elmts;
Constant* firstCache = CreateConstantFromCacheNode(val->firstCache);
- Elmts.push_back(new GlobalVariable(CNTy, false,
+ Elmts.push_back(new GlobalVariable(*getLLVMModule(), CNTy, false,
GlobalValue::InternalLinkage,
- firstCache, "", getLLVMModule()));
+ firstCache, ""));
Elmts.push_back(getUTF8(val->methodName));
Elmts.push_back(getUTF8(val->methodSign));
- Elmts.push_back(Constant::getNullValue(Type::Int8Ty));
+ Elmts.push_back(Mod.getContext().getNullValue(Type::Int8Ty));
Elmts.push_back(getNativeClass(val->classDef));
Elmts.push_back(firstCache);
@@ -708,6 +722,7 @@
Constant* JavaAOTCompiler::CreateConstantFromCommonClass(CommonClass* cl) {
const StructType* STy =
dyn_cast<StructType>(JnjvmModule::JavaCommonClassType->getContainedType(0));
+ Module& Mod = *getLLVMModule();
const llvm::Type* TempTy = 0;
@@ -732,15 +747,16 @@
ATy = ArrayType::get(JnjvmModule::JavaClassType, cl->nbInterfaces);
Constant* interfaces = ConstantArray::get(ATy, TempElmts);
- interfaces = new GlobalVariable(ATy, true, GlobalValue::InternalLinkage,
- interfaces, "", getLLVMModule());
+ interfaces = new GlobalVariable(*getLLVMModule(), ATy, true,
+ GlobalValue::InternalLinkage,
+ interfaces, "");
interfaces = ConstantExpr::getCast(Instruction::BitCast, interfaces,
PointerType::getUnqual(JnjvmModule::JavaClassType));
CommonClassElts.push_back(interfaces);
} else {
const Type* Ty = PointerType::getUnqual(JnjvmModule::JavaClassType);
- CommonClassElts.push_back(Constant::getNullValue(Ty));
+ CommonClassElts.push_back(Mod.getContext().getNullValue(Ty));
}
// nbInterfaces
@@ -754,7 +770,7 @@
CommonClassElts.push_back(getNativeClass(cl->super));
} else {
TempTy = JnjvmModule::JavaClassType;
- CommonClassElts.push_back(Constant::getNullValue(TempTy));
+ CommonClassElts.push_back(Mod.getContext().getNullValue(TempTy));
}
// classLoader: store the static initializer, it will be overriden once
@@ -768,7 +784,7 @@
CommonClassElts.push_back(getVirtualTable(cl->virtualVT));
} else {
TempTy = JnjvmModule::VTType;
- CommonClassElts.push_back(Constant::getNullValue(TempTy));
+ CommonClassElts.push_back(Mod.getContext().getNullValue(TempTy));
}
return ConstantStruct::get(STy, CommonClassElts);
}
@@ -776,12 +792,13 @@
Constant* JavaAOTCompiler::CreateConstantFromJavaField(JavaField& field) {
const StructType* STy =
dyn_cast<StructType>(JnjvmModule::JavaFieldType->getContainedType(0));
+ Module& Mod = *getLLVMModule();
std::vector<Constant*> FieldElts;
std::vector<Constant*> TempElts;
// signature
- FieldElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ FieldElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
// access
FieldElts.push_back(ConstantInt::get(Type::Int16Ty, field.access));
@@ -802,14 +819,15 @@
Constant* attributs = ConstantArray::get(ATy, TempElts);
TempElts.clear();
- attributs = new GlobalVariable(ATy, true, GlobalValue::InternalLinkage,
- attributs, "", getLLVMModule());
+ attributs = new GlobalVariable(*getLLVMModule(), ATy, true,
+ GlobalValue::InternalLinkage,
+ attributs, "");
attributs = ConstantExpr::getCast(Instruction::BitCast, attributs,
JnjvmModule::AttributType);
FieldElts.push_back(attributs);
} else {
- FieldElts.push_back(Constant::getNullValue(JnjvmModule::AttributType));
+ FieldElts.push_back(Mod.getContext().getNullValue(JnjvmModule::AttributType));
}
// nbAttributs
@@ -825,7 +843,7 @@
FieldElts.push_back(ConstantInt::get(Type::Int16Ty, field.num));
//JInfo
- FieldElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ FieldElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
return ConstantStruct::get(STy, FieldElts);
}
@@ -833,12 +851,13 @@
Constant* JavaAOTCompiler::CreateConstantFromJavaMethod(JavaMethod& method) {
const StructType* STy =
dyn_cast<StructType>(JnjvmModule::JavaMethodType->getContainedType(0));
+ Module& Mod = *getLLVMModule();
std::vector<Constant*> MethodElts;
std::vector<Constant*> TempElts;
// signature
- MethodElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ MethodElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
// access
MethodElts.push_back(ConstantInt::get(Type::Int16Ty, method.access));
@@ -853,14 +872,15 @@
Constant* attributs = ConstantArray::get(ATy, TempElts);
TempElts.clear();
- attributs = new GlobalVariable(ATy, true, GlobalValue::InternalLinkage,
- attributs, "", getLLVMModule());
+ attributs = new GlobalVariable(*getLLVMModule(), ATy, true,
+ GlobalValue::InternalLinkage,
+ attributs, "");
attributs = ConstantExpr::getCast(Instruction::BitCast, attributs,
JnjvmModule::AttributType);
MethodElts.push_back(attributs);
} else {
- MethodElts.push_back(Constant::getNullValue(JnjvmModule::AttributType));
+ MethodElts.push_back(Mod.getContext().getNullValue(JnjvmModule::AttributType));
}
// nbAttributs
@@ -868,7 +888,7 @@
// enveloppes
// already allocated by the JIT, don't reallocate them.
- MethodElts.push_back(Constant::getNullValue(JnjvmModule::EnveloppeType));
+ MethodElts.push_back(Mod.getContext().getNullValue(JnjvmModule::EnveloppeType));
// nbEnveloppes
// 0 because we're not allocating here.
@@ -888,7 +908,7 @@
// code
if (isAbstract(method.access)) {
- MethodElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ MethodElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
} else {
LLVMMethodInfo* LMI = getMethodInfo(&method);
Function* func = LMI->getMethod();
@@ -900,7 +920,7 @@
MethodElts.push_back(ConstantInt::get(Type::Int32Ty, method.offset));
//JInfo
- MethodElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ MethodElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
return ConstantStruct::get(STy, MethodElts);
}
@@ -945,6 +965,7 @@
Constant* JavaAOTCompiler::CreateConstantFromClass(Class* cl) {
const StructType* STy =
dyn_cast<StructType>(JnjvmModule::JavaClassType->getContainedType(0));
+ Module& Mod = *getLLVMModule();
std::vector<Constant*> ClassElts;
std::vector<Constant*> TempElts;
@@ -971,7 +992,7 @@
ClassElts.push_back(ConstantArray::get(ATy, CStr, 1));
// thinlock
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
if (cl->nbVirtualFields + cl->nbStaticFields) {
ATy = ArrayType::get(JnjvmModule::JavaFieldType->getContainedType(0),
@@ -1001,12 +1022,13 @@
fields = ConstantArray::get(ATy, TempElts);
TempElts.clear();
- fields = new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
- fields, "", getLLVMModule());
+ fields = new GlobalVariable(*getLLVMModule(), ATy, false,
+ GlobalValue::InternalLinkage,
+ fields, "");
fields = ConstantExpr::getCast(Instruction::BitCast, fields,
JnjvmModule::JavaFieldType);
} else {
- fields = Constant::getNullValue(JnjvmModule::JavaFieldType);
+ fields = Mod.getContext().getNullValue(JnjvmModule::JavaFieldType);
}
// virtualFields
@@ -1020,7 +1042,7 @@
// staticFields
// Output null, getLLVMModule() will be set in the initializer. Otherwise, the
// assembly emitter of LLVM will try to align the data.
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::JavaFieldType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaFieldType));
// nbStaticFields
ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbStaticFields));
@@ -1047,14 +1069,14 @@
if (cl->nbVirtualMethods + cl->nbStaticMethods) {
methods = ConstantArray::get(ATy, TempElts);
TempElts.clear();
- GlobalVariable* GV = new GlobalVariable(ATy, false,
+ GlobalVariable* GV = new GlobalVariable(*getLLVMModule(), ATy, false,
GlobalValue::InternalLinkage,
- methods, "", getLLVMModule());
+ methods, "");
virtualMethods.insert(std::make_pair(cl, GV));
methods = ConstantExpr::getCast(Instruction::BitCast, GV,
JnjvmModule::JavaMethodType);
} else {
- methods = Constant::getNullValue(JnjvmModule::JavaMethodType);
+ methods = Mod.getContext().getNullValue(JnjvmModule::JavaMethodType);
}
// virtualMethods
@@ -1067,19 +1089,19 @@
// staticMethods
// Output null, getLLVMModule() will be set in the initializer.
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::JavaMethodType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaMethodType));
// nbStaticMethods
ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbStaticMethods));
// ownerClass
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
// bytes
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::JavaArrayUInt8Type));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaArrayUInt8Type));
// ctpInfo
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
// attributs
if (cl->nbAttributs) {
@@ -1092,13 +1114,14 @@
Constant* attributs = ConstantArray::get(ATy, TempElts);
TempElts.clear();
- attributs = new GlobalVariable(ATy, true, GlobalValue::InternalLinkage,
- attributs, "", getLLVMModule());
+ attributs = new GlobalVariable(*getLLVMModule(), ATy, true,
+ GlobalValue::InternalLinkage,
+ attributs, "");
attributs = ConstantExpr::getCast(Instruction::BitCast, attributs,
JnjvmModule::AttributType);
ClassElts.push_back(attributs);
} else {
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::AttributType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::AttributType));
}
// nbAttributs
@@ -1113,15 +1136,16 @@
const llvm::Type* TempTy = JnjvmModule::JavaClassType;
ATy = ArrayType::get(TempTy, cl->nbInnerClasses);
Constant* innerClasses = ConstantArray::get(ATy, TempElts);
- innerClasses = new GlobalVariable(ATy, true, GlobalValue::InternalLinkage,
- innerClasses, "", getLLVMModule());
+ innerClasses = new GlobalVariable(*getLLVMModule(), ATy, true,
+ GlobalValue::InternalLinkage,
+ innerClasses, "");
innerClasses = ConstantExpr::getCast(Instruction::BitCast, innerClasses,
PointerType::getUnqual(TempTy));
ClassElts.push_back(innerClasses);
} else {
const Type* Ty = PointerType::getUnqual(JnjvmModule::JavaClassType);
- ClassElts.push_back(Constant::getNullValue(Ty));
+ ClassElts.push_back(Mod.getContext().getNullValue(Ty));
}
// nbInnerClasses
@@ -1131,7 +1155,7 @@
if (cl->outerClass) {
ClassElts.push_back(getNativeClass(cl->outerClass));
} else {
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::JavaClassType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaClassType));
}
// innerAccess
@@ -1150,13 +1174,14 @@
ClassElts.push_back(ConstantInt::get(Type::Int32Ty, cl->staticSize));
// JInfo
- ClassElts.push_back(Constant::getNullValue(JnjvmModule::ptrType));
+ ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
return ConstantStruct::get(STy, ClassElts);
}
template<typename T>
Constant* JavaAOTCompiler::CreateConstantFromArray(const T* val, const Type* Ty) {
+ Module& Mod = *getLLVMModule();
std::vector<const Type*> Elemts;
const ArrayType* ATy = ArrayType::get(Ty, val->size);
Elemts.push_back(JnjvmModule::JavaObjectType->getContainedType(0));
@@ -1180,7 +1205,7 @@
if (val->elements[i]) {
Vals.push_back(getFinalObject((JavaObject*)(size_t)val->elements[i]));
} else {
- Vals.push_back(Constant::getNullValue(JnjvmModule::JavaObjectType));
+ Vals.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
}
}
}
@@ -1218,9 +1243,10 @@
utf8_iterator I = utf8s.find(val);
if (I == End) {
Constant* C = CreateConstantFromUTF8(val);
- GlobalVariable* varGV = new GlobalVariable(C->getType(), true,
+ Module& Mod = *getLLVMModule();
+ GlobalVariable* varGV = new GlobalVariable(Mod, C->getType(), true,
GlobalValue::InternalLinkage,
- C, "", getLLVMModule());
+ C, "");
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
JnjvmModule::UTF8Type);
@@ -1233,6 +1259,7 @@
}
Constant* JavaAOTCompiler::CreateConstantFromVT(JavaVirtualTable* VT) {
+ Module& Mod = *getLLVMModule();
CommonClass* classDef = VT->cl;
uint32 size = classDef->isClass() ? classDef->asClass()->virtualTableSize :
JavaVirtualTable::getBaseSize();
@@ -1298,7 +1325,7 @@
Temp = ConstantExpr::getBitCast(Temp, PTy);
Elemts.push_back(Temp);
} else {
- Elemts.push_back(Constant::getNullValue(PTy));
+ Elemts.push_back(Mod.getContext().getNullValue(PTy));
}
}
@@ -1319,8 +1346,9 @@
Constant* display = ConstantArray::get(DTy, TempElmts);
TempElmts.clear();
- display = new GlobalVariable(DTy, true, GlobalValue::InternalLinkage,
- display, "", getLLVMModule());
+ display = new GlobalVariable(*getLLVMModule(), DTy, true,
+ GlobalValue::InternalLinkage,
+ display, "");
display = ConstantExpr::getCast(Instruction::BitCast, display, PTy);
@@ -1332,7 +1360,7 @@
Temp = ConstantExpr::getBitCast(Temp, PTy);
Elemts.push_back(Temp);
} else {
- Elemts.push_back(Constant::getNullValue(PTy));
+ Elemts.push_back(Mod.getContext().getNullValue(PTy));
}
@@ -1342,7 +1370,7 @@
LLVMMethodInfo* LMI = getMethodInfo(meth);
Function* F = LMI->getMethod();
if (isAbstract(meth->access)) {
- Elemts.push_back(Constant::getNullValue(PTy));
+ Elemts.push_back(Mod.getContext().getNullValue(PTy));
} else {
Elemts.push_back(ConstantExpr::getCast(Instruction::BitCast, F, PTy));
}
@@ -1437,9 +1465,10 @@
uint64_t(isolate)),
ptrType);
- varGV = new GlobalVariable(ptrType, !staticCompilation,
+ Module& Mod = *getLLVMModule();
+ varGV = new GlobalVariable(Mod, ptrType, !staticCompilation,
GlobalValue::ExternalLinkage,
- cons, "", getLLVMModule());
+ cons, "");
isolates.insert(std::make_pair(isolate, varGV));
} else {
@@ -1864,8 +1893,8 @@
BasicBlock* currentBlock = BasicBlock::Create("enter", MainFunc);
GlobalVariable* GvarArrayStr = new GlobalVariable(
- ArrayType::get(Type::Int8Ty, strlen(name) + 1), true,
- GlobalValue::InternalLinkage, 0, "mainClass", TheModule);
+ *TheModule, ArrayType::get(Type::Int8Ty, strlen(name) + 1), true,
+ GlobalValue::InternalLinkage, 0, "mainClass");
Constant* NameArray = ConstantArray::get(name, true);
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Mon Jul 13 06:22:20 2009
@@ -122,7 +122,7 @@
cl2 = new BitCastInst(cl2, module->JavaCommonClassType, "", currentBlock);
}
- Value* test = new ICmpInst(ICmpInst::ICMP_EQ, cl, cl2, "", currentBlock);
+ Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, cl, cl2, "");
BasicBlock* trueBlock = createBasicBlock("true virtual invoke");
BasicBlock* falseBlock = createBasicBlock("false virtual invoke");
@@ -255,7 +255,7 @@
currentBlock = createBasicBlock("start");
CallInst::Create(module->ThrowExceptionFromJITFunction, "", currentBlock);
if (returnType != Type::VoidTy)
- ReturnInst::Create(Constant::getNullValue(returnType), currentBlock);
+ ReturnInst::Create(llvmContext->getNullValue(returnType), currentBlock);
else
ReturnInst::Create(currentBlock);
@@ -283,13 +283,13 @@
"", currentBlock);
Value* test = llvm::CallInst::Create(module->setjmpLLVM, buf, "",
currentBlock);
- test = new ICmpInst(ICmpInst::ICMP_EQ, test, module->constantZero, "",
- currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test,
+ module->constantZero, "");
llvm::BranchInst::Create(executeBlock, endBlock, test, currentBlock);
if (returnType != Type::VoidTy) {
endNode = llvm::PHINode::Create(returnType, "", endBlock);
- endNode->addIncoming(Constant::getNullValue(returnType),
+ endNode->addIncoming(llvmContext->getNullValue(returnType),
currentBlock);
}
@@ -347,8 +347,8 @@
const llvm::Type* Ty = test->getType();
PHINode* node = PHINode::Create(Ty, "", endBlock);
node->addIncoming(test, currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, test,
- Constant::getNullValue(Ty), "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test,
+ llvmContext->getNullValue(Ty), "");
BranchInst::Create(unloadedBlock, endBlock, cmp, currentBlock);
currentBlock = unloadedBlock;
@@ -423,8 +423,8 @@
atomicArgs.begin(), atomicArgs.end(), "",
currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, atomic, module->constantPtrZero,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, atomic,
+ module->constantPtrZero, "");
BasicBlock* OK = createBasicBlock("synchronize passed");
BasicBlock* NotOK = createBasicBlock("synchronize did not pass");
@@ -438,8 +438,8 @@
// The compare and swap did not pass, look if it's a thin lock
Value* isThin = BinaryOperator::CreateAnd(atomic, module->constantFatMask, "",
currentBlock);
- cmp = new ICmpInst(ICmpInst::ICMP_EQ, isThin, module->constantPtrZero, "",
- currentBlock);
+ cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, isThin,
+ module->constantPtrZero, "");
BranchInst::Create(ThinLockBB, FatLockBB, cmp, currentBlock);
@@ -448,8 +448,8 @@
Value* idMask = ConstantInt::get(module->pointerSizeType, 0x7FFFFF00);
Value* cptMask = ConstantInt::get(module->pointerSizeType, 0xFF);
Value* IdInLock = BinaryOperator::CreateAnd(atomic, idMask, "", currentBlock);
- Value* owner = new ICmpInst(ICmpInst::ICMP_EQ, threadId, IdInLock, "",
- currentBlock);
+ Value* owner = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, threadId,
+ IdInLock, "");
BasicBlock* OwnerBB = createBasicBlock("owner thread");
@@ -458,7 +458,7 @@
// OK, we are the owner, now check if the counter will overflow.
Value* count = BinaryOperator::CreateAnd(atomic, cptMask, "", currentBlock);
- cmp = new ICmpInst(ICmpInst::ICMP_ULT, count, cptMask, "", currentBlock);
+ cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_ULT, count, cptMask, "");
BasicBlock* IncCounterBB = createBasicBlock("Increment counter");
BasicBlock* OverflowCounterBB = createBasicBlock("Overflow counter");
@@ -503,8 +503,8 @@
threadId = new PtrToIntInst(threadId, module->pointerSizeType, "",
currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, lock, threadId, "",
- currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, lock, threadId,
+ "");
BasicBlock* EndUnlock = createBasicBlock("end unlock");
@@ -525,8 +525,8 @@
// Look if the lock is thin.
Value* isThin = BinaryOperator::CreateAnd(lock, module->constantFatMask, "",
currentBlock);
- cmp = new ICmpInst(ICmpInst::ICMP_EQ, isThin, module->constantPtrZero, "",
- currentBlock);
+ cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, isThin,
+ module->constantPtrZero, "");
BranchInst::Create(ThinLockBB, FatLockBB, cmp, currentBlock);
@@ -859,7 +859,8 @@
Value* MyID = ConstantInt::get(module->pointerSizeType,
loader->getIsolate()->IsolateID);
- Cmp = new ICmpInst(ICmpInst::ICMP_EQ, OldIsolateID, MyID, "", currentBlock);
+ Cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, OldIsolateID, MyID,
+ "");
BasicBlock* EndBB = createBasicBlock("After service check");
BasicBlock* ServiceBB = createBasicBlock("Begin service call");
@@ -918,8 +919,8 @@
BinaryOperator::CreateAnd(FrameAddr, module->constantStackOverflowMask,
"", currentBlock);
- stackCheck = new ICmpInst(ICmpInst::ICMP_EQ, stackCheck,
- module->constantPtrZero, "", currentBlock);
+ stackCheck = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, stackCheck,
+ module->constantPtrZero, "");
BasicBlock* stackOverflow = createBasicBlock("stack overflow");
BasicBlock* noStackOverflow = createBasicBlock("no stack overflow");
BranchInst::Create(stackOverflow, noStackOverflow, stackCheck,
@@ -942,11 +943,11 @@
if (isa<UnreachableInst>(I)) {
I->eraseFromParent();
BranchInst::Create(endBlock, currentBlock);
- endNode->addIncoming(Constant::getNullValue(returnType),
+ endNode->addIncoming(llvmContext->getNullValue(returnType),
currentBlock);
} else if (InvokeInst* II = dyn_cast<InvokeInst>(I)) {
II->setNormalDest(endBlock);
- endNode->addIncoming(Constant::getNullValue(returnType),
+ endNode->addIncoming(llvmContext->getNullValue(returnType),
currentBlock);
}
@@ -1019,11 +1020,11 @@
Value* zero = module->constantZero;
Value* minus = module->constantMinusOne;
- Value* c = new FCmpInst(FCmpInst::FCMP_UGT, val1, val2, "", currentBlock);
+ Value* c = new FCmpInst(*currentBlock, FCmpInst::FCMP_UGT, val1, val2, "");
Value* r = llvm::SelectInst::Create(c, one, zero, "", currentBlock);
- c = new FCmpInst(FCmpInst::FCMP_ULT, val1, val2, "", currentBlock);
+ c = new FCmpInst(*currentBlock, FCmpInst::FCMP_ULT, val1, val2, "");
r = llvm::SelectInst::Create(c, minus, r, "", currentBlock);
- c = new FCmpInst(FCmpInst::FCMP_UNO, val1, val2, "", currentBlock);
+ c = new FCmpInst(*currentBlock, FCmpInst::FCMP_UNO, val1, val2, "");
r = llvm::SelectInst::Create(c, l ? one : minus, r, "", currentBlock);
push(r, false);
@@ -1100,8 +1101,7 @@
if (TheCompiler->hasExceptionsEnabled()) {
Constant* zero = module->JavaObjectNullConstant;
- Value* test = new ICmpInst(ICmpInst::ICMP_EQ, obj, zero, "",
- currentBlock);
+ Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, obj, zero, "");
BasicBlock* exit = createBasicBlock("verifyNullExit");
BasicBlock* cont = createBasicBlock("verifyNullCont");
@@ -1125,8 +1125,8 @@
if (TheCompiler->hasExceptionsEnabled()) {
Value* size = arraySize(obj);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_ULT, index, size, "",
- currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_ULT, index, size,
+ "");
BasicBlock* ifTrue = createBasicBlock("true verifyAndComputePtr");
BasicBlock* ifFalse = createBasicBlock("false verifyAndComputePtr");
@@ -1244,8 +1244,8 @@
BinaryOperator::Create(Instruction::Sub, const_int32_9, args[0],
"tmpneg", currentBlock);
ICmpInst* int1_abscond =
- new ICmpInst(ICmpInst::ICMP_SGT, args[0], const_int32_10, "abscond",
- currentBlock);
+ new ICmpInst(*currentBlock, ICmpInst::ICMP_SGT, args[0], const_int32_10,
+ "abscond");
return llvm::SelectInst::Create(int1_abscond, args[0], int32_tmpneg,
"abs", currentBlock);
} else if (Ty == Type::Int64Ty) {
@@ -1256,9 +1256,8 @@
BinaryOperator::Create(Instruction::Sub, const_int64_9, args[0],
"tmpneg", currentBlock);
- ICmpInst* int1_abscond = new ICmpInst(ICmpInst::ICMP_SGT, args[0],
- const_int64_10, "abscond",
- currentBlock);
+ ICmpInst* int1_abscond = new ICmpInst(*currentBlock, ICmpInst::ICMP_SGT,
+ args[0], const_int64_10, "abscond");
return llvm::SelectInst::Create(int1_abscond, args[0], int64_tmpneg,
"abs", currentBlock);
@@ -1391,12 +1390,12 @@
#if defined(ISOLATE_SHARING)
const Type* Ty = module->ConstantPoolType;
- Constant* Nil = Constant::getNullValue(Ty);
+ Constant* Nil = llvmContext->getNullValue(Ty);
GlobalVariable* GV = new GlobalVariable(Ty, false,
GlobalValue::ExternalLinkage, Nil,
"", module);
Value* res = new LoadInst(GV, "", false, currentBlock);
- Value* test = new ICmpInst(ICmpInst::ICMP_EQ, res, Nil, "", currentBlock);
+ Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, res, Nil, "");
BasicBlock* trueCl = createBasicBlock("UserCtp OK");
BasicBlock* falseCl = createBasicBlock("UserCtp Not OK");
@@ -1943,7 +1942,8 @@
currentBlock);
Value* lastCible = new LoadInst(lastCiblePtr, "", currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, VT, lastCible, "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, VT, lastCible,
+ "");
BasicBlock* ifTrue = createBasicBlock("cache ok");
BasicBlock* ifFalse = createBasicBlock("cache not ok");
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h Mon Jul 13 06:22:20 2009
@@ -16,6 +16,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Type.h"
#include "llvm/Value.h"
@@ -62,6 +63,7 @@
TheCompiler = C;
module = TheCompiler->getIntrinsics();
llvmFunction = func;
+ llvmContext = func->getContext();
inlining = false;
callsStackWalker = false;
endNode = 0;
@@ -83,6 +85,9 @@
/// llvmFunction - The LLVM representation of the method.
llvm::Function* llvmFunction;
+
+ /// llvmContext - The current LLVM context of compilation.
+ llvm::LLVMContext* llvmContext;
/// module - The LLVM module where lives the compiling LLVM function.
JnjvmModule* module;
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp Mon Jul 13 06:22:20 2009
@@ -660,9 +660,8 @@
if (TheCompiler->hasExceptionsEnabled()) {
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, val,
- module->JavaObjectNullConstant,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val,
+ module->JavaObjectNullConstant, "");
BasicBlock* endBlock = createBasicBlock("end array store check");
BasicBlock* checkBlock = createBasicBlock("array store check");
@@ -935,9 +934,8 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
if (TheCompiler->hasExceptionsEnabled()) {
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, val2,
- module->constantZero,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val2,
+ module->constantZero, "");
BasicBlock* ifFalse = createBasicBlock("non null div");
BasicBlock* ifTrue = createBasicBlock("null div");
@@ -957,9 +955,8 @@
pop();
llvm::Value* val1 = pop();
if (TheCompiler->hasExceptionsEnabled()) {
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, val2,
- module->constantLongZero,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val2,
+ module->constantLongZero, "");
BasicBlock* ifFalse = createBasicBlock("non null div");
BasicBlock* ifTrue = createBasicBlock("null div");
@@ -1226,8 +1223,8 @@
case F2I : {
llvm::Value* val = pop();
- llvm::Value* test = new FCmpInst(FCmpInst::FCMP_ONE, val, val, "",
- currentBlock);
+ llvm::Value* test = new FCmpInst(*currentBlock, FCmpInst::FCMP_ONE,
+ val, val, "");
BasicBlock* res = createBasicBlock("F2I");
PHINode* node = PHINode::Create(llvm::Type::Int32Ty, "", res);
@@ -1238,9 +1235,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OGE, val,
- module->constantMaxIntFloat,
- "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OGE, val,
+ module->constantMaxIntFloat, "");
cont = createBasicBlock("F2I");
@@ -1250,9 +1246,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OLE, val,
- module->constantMinIntFloat,
- "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OLE, val,
+ module->constantMinIntFloat, "");
cont = createBasicBlock("F2I");
@@ -1274,8 +1269,8 @@
case F2L : {
llvm::Value* val = pop();
- llvm::Value* test = new FCmpInst(FCmpInst::FCMP_ONE, val, val, "",
- currentBlock);
+ llvm::Value* test = new FCmpInst(*currentBlock, FCmpInst::FCMP_ONE,
+ val, val, "");
BasicBlock* res = createBasicBlock("F2L");
PHINode* node = PHINode::Create(llvm::Type::Int64Ty, "", res);
@@ -1286,9 +1281,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OGE, val,
- module->constantMaxLongFloat,
- "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OGE, val,
+ module->constantMaxLongFloat, "");
cont = createBasicBlock("F2L");
@@ -1297,8 +1291,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OLE, val,
- module->constantMinLongFloat, "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OLE, val,
+ module->constantMinLongFloat, "");
cont = createBasicBlock("F2L");
@@ -1328,8 +1322,8 @@
case D2I : {
pop(); // remove the 0 on the stack
llvm::Value* val = pop();
- llvm::Value* test = new FCmpInst(FCmpInst::FCMP_ONE, val, val, "",
- currentBlock);
+ llvm::Value* test = new FCmpInst(*currentBlock, FCmpInst::FCMP_ONE,
+ val, val, "");
BasicBlock* res = createBasicBlock("D2I");
PHINode* node = PHINode::Create(llvm::Type::Int32Ty, "", res);
@@ -1340,9 +1334,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OGE, val,
- module->constantMaxIntDouble,
- "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OGE, val,
+ module->constantMaxIntDouble, "");
cont = createBasicBlock("D2I");
@@ -1351,9 +1344,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OLE, val,
- module->constantMinIntDouble,
- "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OLE, val,
+ module->constantMinIntDouble, "");
cont = createBasicBlock("D2I");
@@ -1377,8 +1369,8 @@
case D2L : {
pop(); // remove the 0 on the stack
llvm::Value* val = pop();
- llvm::Value* test = new FCmpInst(FCmpInst::FCMP_ONE, val, val, "",
- currentBlock);
+ llvm::Value* test = new FCmpInst(*currentBlock, FCmpInst::FCMP_ONE,
+ val, val, "");
BasicBlock* res = createBasicBlock("D2L");
PHINode* node = PHINode::Create(llvm::Type::Int64Ty, "", res);
@@ -1389,9 +1381,8 @@
currentBlock = cont;
- test = new FCmpInst(FCmpInst::FCMP_OGE, val,
- module->constantMaxLongDouble,
- "", currentBlock);
+ test = new FCmpInst(*currentBlock, FCmpInst::FCMP_OGE, val,
+ module->constantMaxLongDouble, "");
cont = createBasicBlock("D2L");
@@ -1401,8 +1392,8 @@
currentBlock = cont;
test =
- new FCmpInst(FCmpInst::FCMP_OLE, val, module->constantMinLongDouble,
- "", currentBlock);
+ new FCmpInst(*currentBlock, FCmpInst::FCMP_OLE, val,
+ module->constantMinLongDouble, "");
cont = createBasicBlock("D2L");
@@ -1465,8 +1456,8 @@
pop();
llvm::Value* val1 = pop();
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val1,
+ val2, "");
BasicBlock* cont = createBasicBlock("LCMP");
BasicBlock* res = createBasicBlock("LCMP");
@@ -1476,7 +1467,7 @@
BranchInst::Create(res, cont, test, currentBlock);
currentBlock = cont;
- test = new ICmpInst(ICmpInst::ICMP_SLT, val1, val2, "", currentBlock);
+ test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLT, val1, val2, "");
node->addIncoming(module->constantMinusOne, currentBlock);
cont = createBasicBlock("LCMP");
@@ -1530,9 +1521,9 @@
Value* op = pop();
const Type* type = op->getType();
- Constant* val = Constant::getNullValue(type);
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, op, val, "",
- currentBlock);
+ Constant* val = llvmContext->getNullValue(type);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, op,
+ val, "");
BasicBlock* ifFalse = createBasicBlock("false IFEQ");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1545,9 +1536,9 @@
Value* op = pop();
const Type* type = op->getType();
- Constant* val = Constant::getNullValue(type);
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_NE, op, val, "",
- currentBlock);
+ Constant* val = llvmContext->getNullValue(type);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, op,
+ val, "");
BasicBlock* ifFalse = createBasicBlock("false IFNE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1559,9 +1550,9 @@
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
Value* op = pop();
const Type* type = op->getType();
- Constant* val = Constant::getNullValue(type);
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SLT, op, val, "",
- currentBlock);
+ Constant* val = llvmContext->getNullValue(type);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLT, op,
+ val, "");
BasicBlock* ifFalse = createBasicBlock("false IFLT");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1573,9 +1564,9 @@
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
Value* op = pop();
const Type* type = op->getType();
- Constant* val = Constant::getNullValue(type);
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SGE, op, val, "",
- currentBlock);
+ Constant* val = llvmContext->getNullValue(type);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SGE, op,
+ val, "");
BasicBlock* ifFalse = createBasicBlock("false IFGE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1587,9 +1578,9 @@
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
Value* op = pop();
const Type* type = op->getType();
- Constant* val = Constant::getNullValue(type);
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SGT, op, val, "",
- currentBlock);
+ Constant* val = llvmContext->getNullValue(type);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SGT, op,
+ val, "");
BasicBlock* ifFalse = createBasicBlock("false IFGT");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1601,9 +1592,9 @@
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
Value* op = pop();
const Type* type = op->getType();
- Constant* val = Constant::getNullValue(type);
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SLE, op, val, "",
- currentBlock);
+ Constant* val = llvmContext->getNullValue(type);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLE, op,
+ val, "");
BasicBlock* ifFalse = createBasicBlock("false IFLE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1615,8 +1606,8 @@
Value *val1 = popAsInt();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val1,
+ val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ICMPEQ");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1628,8 +1619,8 @@
Value *val1 = popAsInt();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_NE, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, val1,
+ val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ICMPNE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1641,8 +1632,8 @@
Value *val1 = popAsInt();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SLT, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLT,
+ val1, val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_IFCMPLT");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1654,8 +1645,8 @@
Value *val1 = popAsInt();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SGE, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SGE,
+ val1, val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ICMPGE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1667,8 +1658,8 @@
Value *val1 = popAsInt();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SGT, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SGT,
+ val1, val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ICMPGT");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1680,8 +1671,8 @@
Value *val1 = popAsInt();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SLE, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLE,
+ val1, val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ICMPLE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1693,8 +1684,8 @@
Value *val1 = pop();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ,
+ val1, val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ACMPEQ");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1706,8 +1697,8 @@
Value *val1 = pop();
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_NE, val1, val2, "",
- currentBlock);
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE,
+ val1, val2, "");
BasicBlock* ifFalse = createBasicBlock("false IF_ACMPNE");
branch(test, ifTrue, ifFalse, currentBlock);
currentBlock = ifFalse;
@@ -1763,9 +1754,8 @@
const llvm::Type* type = index->getType();
for (sint32 cur = low; cur < high; ++cur) {
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ,
- ConstantInt::get(type, cur), index,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ,
+ ConstantInt::get(type, cur), index, "");
BasicBlock* falseBlock = createBasicBlock("continue tableswitch");
branch(cmp, opcodeInfos[tmp + readU4(bytecodes, i)].newBlock,
falseBlock, currentBlock);
@@ -1796,7 +1786,8 @@
}
for (uint32 cur = 0; cur < nbs; ++cur) {
Value* val = ConstantInt::get(Type::Int32Ty, readU4(bytecodes, i));
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, val, key, "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val, key,
+ "");
BasicBlock* falseBlock = createBasicBlock("continue lookupswitch");
branch(cmp, opcodeInfos[tmp + readU4(bytecodes, i)].newBlock,
falseBlock, currentBlock);
@@ -1955,7 +1946,7 @@
} else {
const llvm::Type* Ty =
PointerType::getUnqual(module->JavaClassArrayType);
- Value* args[2]= { valCl, Constant::getNullValue(Ty) };
+ Value* args[2]= { valCl, llvmContext->getNullValue(Ty) };
valCl = CallInst::Create(module->GetArrayClassFunction, args,
args + 2, "", currentBlock);
TheVT = CallInst::Create(module->GetVTFromClassArrayFunction, valCl, "",
@@ -1967,8 +1958,8 @@
Value* arg1 = popAsInt();
if (TheCompiler->hasExceptionsEnabled()) {
- Value* cmp = new ICmpInst(ICmpInst::ICMP_SLT, arg1,
- module->constantZero, "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLT, arg1,
+ module->constantZero, "");
BasicBlock* BB1 = createBasicBlock("");
BasicBlock* BB2 = createBasicBlock("");
@@ -1978,9 +1969,8 @@
throwException(module->NegativeArraySizeExceptionFunction, arg1);
currentBlock = BB2;
- cmp = new ICmpInst(ICmpInst::ICMP_SGT, arg1,
- module->MaxArraySizeConstant,
- "", currentBlock);
+ cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_SGT, arg1,
+ module->MaxArraySizeConstant, "");
BB1 = createBasicBlock("");
BB2 = createBasicBlock("");
@@ -2046,9 +2036,8 @@
Value* clVar = getResolvedCommonClass(index, true, &cl);
Value* obj = top();
Value* args[2] = { obj, clVar };
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, obj,
- module->JavaObjectNullConstant,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, obj,
+ module->JavaObjectNullConstant, "");
BasicBlock* endBlock = createBasicBlock("end type compare");
PHINode* node = PHINode::Create(Type::Int1Ty, "", endBlock);
@@ -2101,8 +2090,8 @@
displayArgs, displayArgs + 2, "",
currentBlock);
- res = new ICmpInst(ICmpInst::ICMP_EQ, VTInDisplay, TheVT, "",
- currentBlock);
+ res = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, VTInDisplay,
+ TheVT, "");
}
} else {
res = CallInst::Create(module->IsAssignableFromFunction,
@@ -2170,9 +2159,9 @@
case IFNULL : {
uint32 tmp = i;
llvm::Value* val = pop();
- Constant* nil = Constant::getNullValue(val->getType());
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, val, nil, "",
- currentBlock);
+ Constant* nil = llvmContext->getNullValue(val->getType());
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val,
+ nil, "");
BasicBlock* ifFalse = createBasicBlock("true IFNULL");
BasicBlock* ifTrue = opcodeInfos[readS2(bytecodes, i) + tmp].newBlock;
branch(test, ifTrue, ifFalse, currentBlock);
@@ -2183,9 +2172,9 @@
case IFNONNULL : {
uint32 tmp = i;
llvm::Value* val = pop();
- Constant* nil = Constant::getNullValue(val->getType());
- llvm::Value* test = new ICmpInst(ICmpInst::ICMP_NE, val, nil, "",
- currentBlock);
+ Constant* nil = llvmContext->getNullValue(val->getType());
+ llvm::Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, val,
+ nil, "");
BasicBlock* ifFalse = createBasicBlock("false IFNONNULL");
BasicBlock* ifTrue = opcodeInfos[readS2(bytecodes, i) + tmp].newBlock;
branch(test, ifTrue, ifFalse, currentBlock);
Modified: vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp Mon Jul 13 06:22:20 2009
@@ -176,7 +176,8 @@
JavaThreadType =
PointerType::getUnqual(module->getTypeByName("JavaThread"));
- JavaObjectNullConstant = Constant::getNullValue(JnjvmModule::JavaObjectType);
+ JavaObjectNullConstant =
+ module->getContext().getNullValue(JnjvmModule::JavaObjectType);
MaxArraySizeConstant = ConstantInt::get(Type::Int32Ty,
JavaArray::MaxArraySize);
JavaArraySizeConstant =
Modified: vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp Mon Jul 13 06:22:20 2009
@@ -296,8 +296,8 @@
BasicBlock* NBB = II->getParent()->splitBasicBlock(II);
I->getParent()->getTerminator()->eraseFromParent();
Value* Del = getDelegatee(module, Call.getArgument(0), CI);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, Del,
- module->JavaObjectNullConstant, "", CI);
+ Value* cmp = new ICmpInst(CI, ICmpInst::ICMP_EQ, Del,
+ module->JavaObjectNullConstant, "");
BasicBlock* NoDelegatee = BasicBlock::Create("No delegatee", &F);
BasicBlock* DelegateeOK = BasicBlock::Create("Delegatee OK", &F);
@@ -414,8 +414,8 @@
#endif
Value* arg1 = GetElementPtrInst::Create(CTP, indexes, "", CI);
arg1 = new LoadInst(arg1, "", false, CI);
- Value* test = new ICmpInst(ICmpInst::ICMP_EQ, arg1,
- mvm::MvmModule::constantPtrNull, "", CI);
+ Value* test = new ICmpInst(CI, ICmpInst::ICMP_EQ, arg1,
+ mvm::MvmModule::constantPtrNull, "");
BasicBlock* trueCl = BasicBlock::Create("Ctp OK", &F);
BasicBlock* falseCl = BasicBlock::Create("Ctp Not OK", &F);
@@ -471,22 +471,22 @@
} else if (V == module->GetArrayClassFunction) {
const llvm::Type* Ty =
PointerType::getUnqual(module->JavaCommonClassType);
- Constant* nullValue = Constant::getNullValue(Ty);
+ Constant* nullValue = F.getContext()->getNullValue(Ty);
// Check if we have already proceed this call.
if (Call.getArgument(1) == nullValue) {
BasicBlock* NBB = II->getParent()->splitBasicBlock(II);
I->getParent()->getTerminator()->eraseFromParent();
Constant* init =
- Constant::getNullValue(module->JavaClassArrayType);
+ F.getContext()->getNullValue(module->JavaClassArrayType);
GlobalVariable* GV =
- new GlobalVariable(module->JavaClassArrayType, false,
- GlobalValue::ExternalLinkage,
- init, "", TheCompiler->getLLVMModule());
+ new GlobalVariable(*(F.getParent()), module->JavaClassArrayType,
+ false, GlobalValue::ExternalLinkage,
+ init, "");
Value* LoadedGV = new LoadInst(GV, "", CI);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, LoadedGV, init,
- "", CI);
+ Value* cmp = new ICmpInst(CI, ICmpInst::ICMP_EQ, LoadedGV, init,
+ "");
BasicBlock* OKBlock = BasicBlock::Create("", &F);
BasicBlock* NotOKBlock = BasicBlock::Create("", &F);
@@ -548,7 +548,7 @@
CurVT = new LoadInst(CurVT, "", false, CI);
CurVT = new BitCastInst(CurVT, module->VTType, "", CI);
- Value* res = new ICmpInst(ICmpInst::ICMP_EQ, CurVT, VT2, "", CI);
+ Value* res = new ICmpInst(CI, ICmpInst::ICMP_EQ, CurVT, VT2, "");
node->addIncoming(ConstantInt::getTrue(), CI->getParent());
BranchInst::Create(CurEndBlock, FailedBlock, res, CI);
@@ -599,8 +599,8 @@
GetElementPtrInst::Create(VT1, indices, indices + 2, "", CI);
CachePtr = new BitCastInst(CachePtr, Ty, "", CI);
Value* Cache = new LoadInst(CachePtr, "", false, CI);
- ICmpInst* cmp1 = new ICmpInst(ICmpInst::ICMP_EQ, Cache, VT2, "", CI);
- ICmpInst* cmp2 = new ICmpInst(ICmpInst::ICMP_EQ, VT1, VT2, "", CI);
+ ICmpInst* cmp1 = new ICmpInst(CI, ICmpInst::ICMP_EQ, Cache, VT2, "");
+ ICmpInst* cmp2 = new ICmpInst(CI, ICmpInst::ICMP_EQ, VT1, VT2, "");
BinaryOperator* Or = BinaryOperator::Create(Instruction::Or, cmp1,
cmp2, "", CI);
BranchInst::Create(BB9, Preheader, Or, CI);
@@ -637,7 +637,7 @@
Instruction* CurVT = GetElementPtrInst::Create(secondaryTypes, resFwd,
"", BB4);
CurVT = new LoadInst(CurVT, "", false, BB4);
- cmp1 = new ICmpInst(ICmpInst::ICMP_EQ, CurVT, VT2, "", BB4);
+ cmp1 = new ICmpInst(*BB4, ICmpInst::ICMP_EQ, CurVT, VT2, "");
BranchInst::Create(BB5, BB6, cmp1, BB4);
// Increment i if the previous test failed
@@ -656,7 +656,7 @@
resFwd->addIncoming(module->constantZero, Preheader);
resFwd->addIncoming(IndVar, BB6);
- cmp1 = new ICmpInst(ICmpInst::ICMP_SGT, Size, resFwd, "", BB7);
+ cmp1 = new ICmpInst(*BB7, ICmpInst::ICMP_SGT, Size, resFwd, "");
BranchInst::Create(BB4, BB9, cmp1, BB7);
// Update the cache if the result is found.
Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Mon Jul 13 06:22:20 2009
@@ -133,7 +133,7 @@
constantPtrOne = ConstantInt::get(pointerSizeType, 1);
constantPtrZero = ConstantInt::get(pointerSizeType, 0);
- constantPtrNull = Constant::getNullValue(ptrType);
+ constantPtrNull = globalContext->getNullValue(ptrType);
constantPtrLogSize =
ConstantInt::get(Type::Int32Ty, sizeof(void*) == 8 ? 3 : 2);
arrayPtrType = PointerType::getUnqual(ArrayType::get(Type::Int8Ty, 0));
Modified: vmkit/trunk/lib/N3/Mono/MonoString.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/MonoString.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoString.cpp (original)
+++ vmkit/trunk/lib/N3/Mono/MonoString.cpp Mon Jul 13 06:22:20 2009
@@ -53,10 +53,9 @@
Constant* cons =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
- str->_llvmVar = new GlobalVariable(pty, true,
+ str->_llvmVar = new GlobalVariable(*(vm->getLLVMModule()), pty, true,
GlobalValue::ExternalLinkage,
- cons, "",
- vm->getLLVMModule());
+ cons, "");
}
}
return str->_llvmVar;
Modified: vmkit/trunk/lib/N3/PNetLib/PNetString.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/PNetLib/PNetString.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/PNetLib/PNetString.cpp (original)
+++ vmkit/trunk/lib/N3/PNetLib/PNetString.cpp Mon Jul 13 06:22:20 2009
@@ -54,10 +54,9 @@
Constant* cons =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
- str->_llvmVar = new GlobalVariable(pty, true,
+ str->_llvmVar = new GlobalVariable(*(vm->getLLVMModule()), pty, true,
GlobalValue::ExternalLinkage,
- cons, "",
- vm->getLLVMModule());
+ cons, "");
}
}
return str->_llvmVar;
Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Mon Jul 13 06:22:20 2009
@@ -184,9 +184,9 @@
LoadInst* int32_tmp1019 = new LoadInst(ptr_tmp918, "tmp1019", false,
label_entry);
- ICmpInst* int1_tmp1221 = new ICmpInst(ICmpInst::ICMP_SGT, int32_tmp1019,
- const_int32_8, "tmp1221",
- label_entry);
+ ICmpInst* int1_tmp1221 = new ICmpInst(*label_entry, ICmpInst::ICMP_SGT,
+ int32_tmp1019,
+ const_int32_8, "tmp1221");
BranchInst::Create(label_bb, label_return, int1_tmp1221, label_entry);
@@ -225,8 +225,8 @@
BinaryOperator::Create(Instruction::Add, int32_i_015_0, const_int32_9,
"tmp6", label_bb);
LoadInst* int32_tmp10 = new LoadInst(ptr_tmp918, "tmp10", false, label_bb);
- ICmpInst* int1_tmp12 = new ICmpInst(ICmpInst::ICMP_SGT, int32_tmp10,
- int32_tmp6, "tmp12", label_bb);
+ ICmpInst* int1_tmp12 = new ICmpInst(*label_bb, ICmpInst::ICMP_SGT,
+ int32_tmp10, int32_tmp6, "tmp12");
BranchInst::Create(label_bb, label_return, int1_tmp12, label_bb);
// Block return (label_return)
@@ -535,8 +535,8 @@
} else if (meth->classDef->nameSpace == N3::system &&
meth->classDef->name == N3::doubleName) {
if (meth->name == N3::isNan) {
- push(new FCmpInst(FCmpInst::FCMP_UNO, Args[0],
- module->constantDoubleZero, "tmp1", currentBlock));
+ push(new FCmpInst(*currentBlock, FCmpInst::FCMP_UNO, Args[0],
+ module->constantDoubleZero, "tmp1"));
return;
} else if (meth->name == N3::testInfinity) {
BasicBlock* endBlock = createBasicBlock("end test infinity");
@@ -546,13 +546,11 @@
node->addIncoming(module->constantOne, currentBlock);
node->addIncoming(module->constantMinusOne, minusInfinity);
node->addIncoming(module->constantZero, noInfinity);
- Value* val1 = new FCmpInst(FCmpInst::FCMP_OEQ, Args[0],
- module->constantDoubleInfinity, "tmp1",
- currentBlock);
+ Value* val1 = new FCmpInst(*currentBlock, FCmpInst::FCMP_OEQ, Args[0],
+ module->constantDoubleInfinity, "tmp1");
BranchInst::Create(endBlock, minusInfinity, val1, currentBlock);
- Value* val2 = new FCmpInst(FCmpInst::FCMP_OEQ, Args[0],
- module->constantDoubleMinusInfinity, "tmp1",
- minusInfinity);
+ Value* val2 = new FCmpInst(*minusInfinity, FCmpInst::FCMP_OEQ, Args[0],
+ module->constantDoubleMinusInfinity, "tmp1");
BranchInst::Create(endBlock, noInfinity, val2, minusInfinity);
BranchInst::Create(endBlock, noInfinity);
currentBlock = endBlock;
@@ -562,8 +560,8 @@
} else if (meth->classDef->nameSpace == N3::system &&
meth->classDef->name == N3::floatName) {
if (meth->name == N3::isNan) {
- push(new FCmpInst(FCmpInst::FCMP_UNO, Args[0],
- module->constantFloatZero, "tmp1", currentBlock));
+ push(new FCmpInst(*currentBlock, FCmpInst::FCMP_UNO, Args[0],
+ module->constantFloatZero, "tmp1"));
return;
} else if (meth->name == N3::testInfinity) {
BasicBlock* endBlock = createBasicBlock("end test infinity");
@@ -573,13 +571,11 @@
node->addIncoming(module->constantOne, currentBlock);
node->addIncoming(module->constantMinusOne, minusInfinity);
node->addIncoming(module->constantZero, noInfinity);
- Value* val1 = new FCmpInst(FCmpInst::FCMP_OEQ, Args[0],
- module->constantFloatInfinity, "tmp1",
- currentBlock);
+ Value* val1 = new FCmpInst(*currentBlock, FCmpInst::FCMP_OEQ, Args[0],
+ module->constantFloatInfinity, "tmp1");
BranchInst::Create(endBlock, minusInfinity, val1, currentBlock);
- Value* val2 = new FCmpInst(FCmpInst::FCMP_OEQ, Args[0],
- module->constantFloatMinusInfinity, "tmp1",
- minusInfinity);
+ Value* val2 = new FCmpInst(*minusInfinity, FCmpInst::FCMP_OEQ, Args[0],
+ module->constantFloatMinusInfinity, "tmp1");
BranchInst::Create(endBlock, noInfinity, val2, minusInfinity);
BranchInst::Create(endBlock, noInfinity);
currentBlock = endBlock;
@@ -748,7 +744,7 @@
} else {
type = field->signature->naturalType;
if (val == constantVMObjectNull) {
- val = Constant::getNullValue(type);
+ val = llvmFunction->getContext()->getNullValue(type);
} else if (type != valType) {
val = changeType(val, type);
}
@@ -774,7 +770,7 @@
const Type* type = field->signature->naturalType;
const Type* valType = val->getType();
if (val == constantVMObjectNull) {
- val = Constant::getNullValue(type);
+ val = llvmFunction->getContext()->getNullValue(type);
} else if (type != valType) {
val = changeType(val, type);
}
@@ -783,9 +779,9 @@
void CLIJit::JITVerifyNull(Value* obj) {
CLIJit* jit = this;
- Constant* zero = Constant::getNullValue(obj->getType());
- Value* test = new ICmpInst(ICmpInst::ICMP_EQ, obj, zero, "",
- jit->currentBlock);
+ Constant* zero = llvmFunction->getContext()->getNullValue(obj->getType());
+ Value* test = new ICmpInst(*jit->currentBlock, ICmpInst::ICMP_EQ, obj,
+ zero, "");
BasicBlock* exit = jit->createBasicBlock("verifyNullExit");
BasicBlock* cont = jit->createBasicBlock("verifyNullCont");
@@ -819,8 +815,8 @@
if (true) {
Value* size = arraySize(obj);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_SLT, index, size, "",
- currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_SLT, index,
+ size, "");
BasicBlock* ifTrue = createBasicBlock("true verifyAndComputePtr");
BasicBlock* ifFalse = createBasicBlock("false verifyAndComputePtr");
@@ -1228,7 +1224,7 @@
cl->resolveType(false, false, genMethod);
AllocaInst* alloc = new AllocaInst(cl->naturalType, "", currentBlock);
if (cl->naturalType->isSingleValueType()) {
- new StoreInst(Constant::getNullValue(cl->naturalType), alloc, false,
+ new StoreInst(llvmFunction->getContext()->getNullValue(cl->naturalType), alloc, false,
currentBlock);
} else {
uint64 size = module->getTypeSize(cl->naturalType);
@@ -1405,7 +1401,7 @@
cl->resolveType(false, false, genMethod);
AllocaInst* alloc = new AllocaInst(cl->naturalType, "", currentBlock);
if (cl->naturalType->isSingleValueType()) {
- new StoreInst(Constant::getNullValue(cl->naturalType), alloc, false,
+ new StoreInst(llvmFunction->getContext()->getNullValue(cl->naturalType), alloc, false,
currentBlock);
} else {
uint64 size = module->getTypeSize(cl->naturalType);
@@ -1606,7 +1602,7 @@
- constantVMObjectNull = Constant::getNullValue(VMObject::llvmType);
+ constantVMObjectNull = module->getContext().getNullValue(VMObject::llvmType);
}
Constant* CLIJit::constantVMObjectNull;
Modified: vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp Mon Jul 13 06:22:20 2009
@@ -369,10 +369,9 @@
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
- _llvmVar = new GlobalVariable(pty, true,
+ _llvmVar = new GlobalVariable(*(vm->getLLVMModule()), pty, true,
GlobalValue::ExternalLinkage,
- cons, "",
- vm->getLLVMModule());
+ cons, "");
}
release();
@@ -389,10 +388,9 @@
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
- _llvmVar = new GlobalVariable(pty, true,
+ _llvmVar = new GlobalVariable(*(classDef->vm->getLLVMModule()), pty, true,
GlobalValue::ExternalLinkage,
- cons, "",
- classDef->vm->getLLVMModule());
+ cons, "");
}
classDef->release();
}
@@ -408,10 +406,9 @@
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
- _llvmVar = new GlobalVariable(pty, true,
+ _llvmVar = new GlobalVariable(*(classDef->vm->getLLVMModule()), pty, true,
GlobalValue::ExternalLinkage,
- cons, "",
- classDef->vm->getLLVMModule());
+ cons, "");
}
classDef->release();
Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Mon Jul 13 06:22:20 2009
@@ -284,9 +284,9 @@
Value* test = 0; \
verifyType(val1, val2, currentBlock); \
if (val1->getType()->isFloatingPoint()) { \
- test = new FCmpInst(FCmpInst::cmpf, val1, val2, "", currentBlock); \
+ test = new FCmpInst(*currentBlock, FCmpInst::cmpf, val1, val2, ""); \
} else { \
- test = new ICmpInst(ICmpInst::cmpi, val1, val2, "", currentBlock); \
+ test = new ICmpInst(*currentBlock, ICmpInst::cmpi, val1, val2, ""); \
} \
BasicBlock* ifFalse = createBasicBlock("false BEQ"); \
branch(test, ifTrue, ifFalse, currentBlock); \
@@ -341,13 +341,13 @@
#define TEST(name, read, cmpf, cmpi, offset) case name : { \
uint32 tmp = i; \
Value* val2 = pop(); \
- Value* val1 = Constant::getNullValue(val2->getType()); \
+ Value* val1 = llvmFunction->getContext()->getNullValue(val2->getType()); \
BasicBlock* ifTrue = opcodeInfos[tmp + offset + read(bytecodes, i)].newBlock; \
Value* test = 0; \
if (val1->getType()->isFloatingPoint()) { \
- test = new FCmpInst(FCmpInst::cmpf, val1, val2, "", currentBlock); \
+ test = new FCmpInst(*currentBlock, FCmpInst::cmpf, val1, val2, ""); \
} else { \
- test = new ICmpInst(ICmpInst::cmpi, val1, val2, "", currentBlock); \
+ test = new ICmpInst(*currentBlock, ICmpInst::cmpi, val1, val2, ""); \
} \
BasicBlock* ifFalse = createBasicBlock("false BR"); \
branch(test, ifTrue, ifFalse, currentBlock); \
@@ -1020,7 +1020,7 @@
case NEG : {
Value* val = pop();
push(BinaryOperator::CreateSub(
- Constant::getNullValue(val->getType()),
+ llvmFunction->getContext()->getNullValue(val->getType()),
val, "", currentBlock));
break;
}
@@ -1334,9 +1334,8 @@
false, true, genClass, genMethod);
Value* obj = new BitCastInst(pop(), VMObject::llvmType, "", currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, obj,
- CLIJit::constantVMObjectNull,
- "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, obj,
+ CLIJit::constantVMObjectNull, "");
BasicBlock* ifTrue = createBasicBlock("null checkcast");
BasicBlock* ifFalse = createBasicBlock("non null checkcast");
@@ -1350,8 +1349,8 @@
Value* call = CallInst::Create(instanceOfLLVM, args.begin(), args.end(),
"", ifFalse);
- cmp = new ICmpInst(ICmpInst::ICMP_EQ, call,
- module->constantZero, "", ifFalse);
+ cmp = new ICmpInst(*ifFalse, ICmpInst::ICMP_EQ, call,
+ module->constantZero, "");
BasicBlock* ex = createBasicBlock("false checkcast");
branch(cmp, ex, ifTrue, ifFalse);
@@ -1383,10 +1382,9 @@
false, true, genClass, genMethod);
Value* obj = pop();
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, obj,
- Constant::getNullValue(obj->getType()),
- "", currentBlock);
- Constant* nullVirtual = Constant::getNullValue(dcl->virtualType);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, obj,
+ llvmFunction->getContext()->getNullValue(obj->getType()), "");
+ Constant* nullVirtual = llvmFunction->getContext()->getNullValue(dcl->virtualType);
BasicBlock* isInstEndBlock = createBasicBlock("end isinst");
@@ -1407,8 +1405,8 @@
Value* call = CallInst::Create(instanceOfLLVM, args.begin(), args.end(),
"", ifFalse);
- cmp = new ICmpInst(ICmpInst::ICMP_EQ, call,
- module->constantZero, "", ifFalse);
+ cmp = new ICmpInst(*ifFalse, ICmpInst::ICMP_EQ, call,
+ module->constantZero, "");
BasicBlock* falseInst = createBasicBlock("false isinst");
BasicBlock* trueInst = createBasicBlock("true isinst");
@@ -1840,10 +1838,10 @@
Value* val1 = pop(); \
Value* test = 0; \
if (val1->getType()->isFloatingPoint()) { \
- test = new FCmpInst(FCmpInst::cmpf, val1, val2, "", currentBlock); \
+ test = new FCmpInst(*currentBlock, FCmpInst::cmpf, val1, val2, ""); \
} else { \
convertValue(val2, val1->getType(), currentBlock); \
- test = new ICmpInst(ICmpInst::cmpi, val1, val2, "", currentBlock); \
+ test = new ICmpInst(*currentBlock, ICmpInst::cmpi, val1, val2, ""); \
} \
push(test); \
break; \
Modified: vmkit/trunk/lib/N3/VMCore/VMCache.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMCache.cpp?rev=75462&r1=75461&r2=75462&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMCache.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMCache.cpp Mon Jul 13 06:22:20 2009
@@ -117,7 +117,7 @@
"", currentBlock);
Value* lastCible = new LoadInst(lastCiblePtr, "", currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, cl, lastCible, "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, cl, lastCible, "");
BasicBlock* ifFalse = createBasicBlock("cache not ok");
BranchInst::Create(callBlock, ifFalse, cmp, currentBlock);
More information about the vmkit-commits
mailing list