[vmkit-commits] [vmkit] r77212 - in /vmkit/trunk/lib: JnJVM/Compiler/ Mvm/Compiler/ N3/Mono/ N3/VMCore/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Jul 27 10:54:52 PDT 2009
Author: geoffray
Date: Mon Jul 27 12:54:50 2009
New Revision: 77212
URL: http://llvm.org/viewvc/llvm-project?rev=77212&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/JavaJITCompiler.cpp
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/EscapeAnalysis.cpp
vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
vmkit/trunk/lib/N3/Mono/MonoString.cpp
vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp
vmkit/trunk/lib/N3/VMCore/LowerArrayLength.cpp
vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
vmkit/trunk/lib/N3/VMCore/VMCache.cpp
vmkit/trunk/lib/N3/VMCore/VMClass.cpp
Modified: vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc Mon Jul 27 12:54:50 2009
@@ -432,7 +432,7 @@
currentBlock);
uint32 depth = cur->catchClass->virtualVT->depth;
- Value* depthCl = llvmContext->getConstantInt(Type::Int32Ty, depth);
+ Value* depthCl = ConstantInt::get(Type::Int32Ty, depth);
Value* cmp = 0;
if (depth >= JavaVirtualTable::getDisplayLength()) {
Modified: vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/ExceptionsDwarf.inc Mon Jul 27 12:54:50 2009
@@ -427,7 +427,7 @@
Value* objCl = CallInst::Create(module->GetClassFunction, obj, "",
currentBlock);
- Value* depthCl = llvmContext->getConstantInt(Type::Int32Ty, cur->catchClass->depth);
+ Value* depthCl = ConstantInt::get(Type::Int32Ty, cur->catchClass->depth);
Value* depthClObj = CallInst::Create(module->GetDepthFunction, objCl, "",
currentBlock);
@@ -530,7 +530,7 @@
cur->javaHandler);
OldIsolateID = new LoadInst(IsolateIDPtr, "", cur->javaHandler);
- Value* MyID = llvmContext->getConstantInt(module->pointerSizeType,
+ Value* MyID = ConstantInt::get(module->pointerSizeType,
loader->getIsolate()->IsolateID);
new StoreInst(MyID, IsolateIDPtr, cur->javaHandler);
Modified: vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp Mon Jul 27 12:54:50 2009
@@ -44,8 +44,6 @@
const StructType* structType = 0;
JavaLLVMCompiler* Mod =
(JavaLLVMCompiler*)classDef->classLoader->getCompiler();
- Module* LMod = Mod->getLLVMModule();
- LLVMContext& Context = LMod->getContext();
if (classDef->super) {
LLVMClassInfo* CLI = JavaLLVMCompiler::getClassInfo(classDef->super);
@@ -80,7 +78,7 @@
uint64 size = JnjvmModule::getTypeSize(structType);
classDef->virtualSize = (uint32)size;
- virtualSizeConstant = Context.getConstantInt(Type::Int32Ty, size);
+ virtualSizeConstant = ConstantInt::get(Type::Int32Ty, size);
Mod->makeVT(classDef);
}
@@ -121,15 +119,10 @@
Value* LLVMClassInfo::getVirtualSize() {
if (!virtualSizeConstant) {
- JavaLLVMCompiler* Mod =
- (JavaLLVMCompiler*)classDef->classLoader->getCompiler();
- Module* LMod = Mod->getLLVMModule();
- LLVMContext& Context = LMod->getContext();
-
getVirtualType();
assert(classDef->virtualSize && "Zero size for a class?");
virtualSizeConstant =
- Context.getConstantInt(Type::Int32Ty, classDef->virtualSize);
+ ConstantInt::get(Type::Int32Ty, classDef->virtualSize);
}
return virtualSizeConstant;
}
@@ -195,11 +188,9 @@
if (!offsetConstant) {
JnjvmClassLoader* JCL = methodDef->classDef->classLoader;
JavaLLVMCompiler* Mod = (JavaLLVMCompiler*)JCL->getCompiler();
- Module* LMod = Mod->getLLVMModule();
- LLVMContext& Context = LMod->getContext();
Mod->resolveVirtualClass(methodDef->classDef);
- offsetConstant = Context.getConstantInt(Type::Int32Ty, methodDef->offset);
+ offsetConstant = ConstantInt::get(Type::Int32Ty, methodDef->offset);
}
return offsetConstant;
}
@@ -208,8 +199,6 @@
if (!offsetConstant) {
JnjvmClassLoader* JCL = fieldDef->classDef->classLoader;
JavaLLVMCompiler* Mod = (JavaLLVMCompiler*)JCL->getCompiler();
- Module* LMod = Mod->getLLVMModule();
- LLVMContext& Context = LMod->getContext();
if (isStatic(fieldDef->access)) {
Mod->resolveStaticClass(fieldDef->classDef);
@@ -217,7 +206,7 @@
Mod->resolveVirtualClass(fieldDef->classDef);
}
- offsetConstant = Context.getConstantInt(Type::Int32Ty, fieldDef->num);
+ offsetConstant = ConstantInt::get(Type::Int32Ty, fieldDef->num);
}
return offsetConstant;
}
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Mon Jul 27 12:54:50 2009
@@ -130,14 +130,13 @@
}
Constant* JavaAOTCompiler::getMethodInClass(JavaMethod* meth) {
- LLVMContext& Context = getLLVMModule()->getContext();
Class* cl = meth->classDef;
Constant* MOffset = 0;
Constant* Array = 0;
method_iterator SI = virtualMethods.find(cl);
for (uint32 i = 0; i < cl->nbVirtualMethods + cl->nbStaticMethods; ++i) {
if (&cl->virtualMethods[i] == meth) {
- MOffset = Context.getConstantInt(Type::Int32Ty, i);
+ MOffset = ConstantInt::get(Type::Int32Ty, i);
break;
}
}
@@ -312,8 +311,7 @@
varGV->setInitializer(CreateConstantFromJavaObject(obj));
return C;
} else {
- LLVMContext& Context = getLLVMModule()->getContext();
- Constant* CI = Context.getConstantInt(Type::Int64Ty, uint64_t(obj));
+ Constant* CI = ConstantInt::get(Type::Int64Ty, uint64_t(obj));
CI = ConstantExpr::getIntToPtr(CI, JnjvmModule::JavaObjectType);
finalObjects.insert(std::make_pair(obj, CI));
return CI;
@@ -346,19 +344,19 @@
if (type->isPrimitive()) {
const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
if (prim->isBool() || prim->isByte()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int8Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int8Ty,
field.getInt8Field(obj));
Elts.push_back(CI);
} else if (prim->isShort() || prim->isChar()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int16Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int16Ty,
field.getInt16Field(obj));
Elts.push_back(CI);
} else if (prim->isInt()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int32Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int32Ty,
field.getInt32Field(obj));
Elts.push_back(CI);
} else if (prim->isLong()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty,
field.getLongField(obj));
Elts.push_back(CI);
} else if (prim->isFloat()) {
@@ -390,13 +388,13 @@
uint16 idx = reader.readU2();
if (type->isPrimitive()) {
if (Ty == Type::Int64Ty) {
- Elts.push_back(Context.getConstantInt(Ty, (uint64)ctpInfo->LongAt(idx)));
+ Elts.push_back(ConstantInt::get(Ty, (uint64)ctpInfo->LongAt(idx)));
} else if (Ty == Type::DoubleTy) {
Elts.push_back(Context.getConstantFP(Ty, ctpInfo->DoubleAt(idx)));
} else if (Ty == Type::FloatTy) {
Elts.push_back(Context.getConstantFP(Ty, ctpInfo->FloatAt(idx)));
} else {
- Elts.push_back(Context.getConstantInt(Ty, (uint64)ctpInfo->IntegerAt(idx)));
+ Elts.push_back(ConstantInt::get(Ty, (uint64)ctpInfo->IntegerAt(idx)));
}
} else if (type->isReference()){
const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[idx]);
@@ -411,7 +409,7 @@
}
}
- return ConstantStruct::get(STy, Elts);
+ return Context.getConstantStruct(STy, Elts);
}
Constant* JavaAOTCompiler::getStaticInstance(Class* classDef) {
@@ -523,10 +521,10 @@
Elmts.push_back(getVirtualTable(cl->virtualVT));
// lock
- Constant* L = Context.getConstantInt(Type::Int64Ty, 0);
+ Constant* L = ConstantInt::get(Type::Int64Ty, 0);
Elmts.push_back(ConstantExpr::getIntToPtr(L, JnjvmModule::ptrType));
- return ConstantStruct::get(STy, Elmts);
+ return Context.getConstantStruct(STy, Elmts);
}
Constant* JavaAOTCompiler::CreateConstantFromJavaClass(CommonClass* cl) {
@@ -535,6 +533,7 @@
Module& Mod = *getLLVMModule();
const StructType* STy =
dyn_cast<StructType>(LCI->getVirtualType()->getContainedType(0));
+ LLVMContext& Context = Mod.getContext();
std::vector<Constant*> Elmts;
@@ -542,10 +541,10 @@
Elmts.push_back(CreateConstantForBaseObject(javaClass));
// signers
- Elmts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
+ Elmts.push_back(Context.getNullValue(JnjvmModule::JavaObjectType));
// pd
- Elmts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
+ Elmts.push_back(Context.getNullValue(JnjvmModule::JavaObjectType));
// vmdata
Constant* Cl = getNativeClass(cl);
@@ -554,9 +553,9 @@
Elmts.push_back(Cl);
// constructor
- Elmts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaObjectType));
+ Elmts.push_back(Context.getNullValue(JnjvmModule::JavaObjectType));
- return ConstantStruct::get(STy, Elmts);
+ return Context.getConstantStruct(STy, Elmts);
}
Constant* JavaAOTCompiler::CreateConstantFromJavaObject(JavaObject* obj) {
@@ -621,19 +620,19 @@
if (type->isPrimitive()) {
const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
if (prim->isBool() || prim->isByte()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int8Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int8Ty,
field.getInt8Field(obj));
TempElts.push_back(CI);
} else if (prim->isShort() || prim->isChar()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int16Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int16Ty,
field.getInt16Field(obj));
TempElts.push_back(CI);
} else if (prim->isInt()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int32Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int32Ty,
field.getInt32Field(obj));
TempElts.push_back(CI);
} else if (prim->isLong()) {
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty,
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty,
field.getLongField(obj));
TempElts.push_back(CI);
} else if (prim->isFloat()) {
@@ -658,7 +657,7 @@
}
}
}
- CurConstant = ConstantStruct::get(STy, TempElts);
+ CurConstant = Context.getConstantStruct(STy, TempElts);
}
return CurConstant;
@@ -688,11 +687,11 @@
Array = ConstantExpr::getBitCast(varGV, JnjvmModule::JavaObjectType);
Elmts.push_back(Array);
- Elmts.push_back(Context.getConstantInt(Type::Int32Ty, str->count));
- Elmts.push_back(Context.getConstantInt(Type::Int32Ty, str->cachedHashCode));
- Elmts.push_back(Context.getConstantInt(Type::Int32Ty, str->offset));
+ Elmts.push_back(ConstantInt::get(Type::Int32Ty, str->count));
+ Elmts.push_back(ConstantInt::get(Type::Int32Ty, str->cachedHashCode));
+ Elmts.push_back(ConstantInt::get(Type::Int32Ty, str->offset));
- return ConstantStruct::get(STy, Elmts);
+ return Context.getConstantStruct(STy, Elmts);
}
@@ -707,7 +706,7 @@
Elmts.push_back(Context.getNullValue(STy->getContainedType(2)));
Elmts.push_back(getEnveloppe(CN->enveloppe));
- return ConstantStruct::get(STy, Elmts);
+ return Context.getConstantStruct(STy, Elmts);
}
Constant* JavaAOTCompiler::CreateConstantFromEnveloppe(Enveloppe* val) {
@@ -717,6 +716,7 @@
const StructType* CNTy =
dyn_cast<StructType>(JnjvmModule::CacheNodeType->getContainedType(0));
Module& Mod = *getLLVMModule();
+ LLVMContext& Context = Mod.getContext();
std::vector<Constant*> Elmts;
@@ -727,11 +727,11 @@
Elmts.push_back(getUTF8(val->methodName));
Elmts.push_back(getUTF8(val->methodSign));
- Elmts.push_back(Mod.getContext().getNullValue(Type::Int32Ty));
+ Elmts.push_back(Context.getNullValue(Type::Int32Ty));
Elmts.push_back(getNativeClass(val->classDef));
Elmts.push_back(firstCache);
- return ConstantStruct::get(STy, Elmts);
+ return Context.getConstantStruct(STy, Elmts);
}
@@ -747,12 +747,12 @@
Elmts.push_back(getUTF8(attribut.name));
// start
- Elmts.push_back(Context.getConstantInt(Type::Int32Ty, attribut.start));
+ Elmts.push_back(ConstantInt::get(Type::Int32Ty, attribut.start));
// nbb
- Elmts.push_back(Context.getConstantInt(Type::Int32Ty, attribut.nbb));
+ Elmts.push_back(ConstantInt::get(Type::Int32Ty, attribut.nbb));
- return ConstantStruct::get(STy, Elmts);
+ return Context.getConstantStruct(STy, Elmts);
}
Constant* JavaAOTCompiler::CreateConstantFromCommonClass(CommonClass* cl) {
@@ -774,7 +774,7 @@
CommonClassElts.push_back(Context.getConstantArray(ATy, TCM, 1));
// access
- CommonClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->access));
+ CommonClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->access));
// interfaces
if (cl->nbInterfaces) {
@@ -797,7 +797,7 @@
}
// nbInterfaces
- CommonClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->nbInterfaces));
+ CommonClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbInterfaces));
// name
CommonClassElts.push_back(getUTF8(cl->name));
@@ -823,7 +823,7 @@
TempTy = JnjvmModule::VTType;
CommonClassElts.push_back(Mod.getContext().getNullValue(TempTy));
}
- return ConstantStruct::get(STy, CommonClassElts);
+ return Context.getConstantStruct(STy, CommonClassElts);
}
Constant* JavaAOTCompiler::CreateConstantFromJavaField(JavaField& field) {
@@ -839,7 +839,7 @@
FieldElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
// access
- FieldElts.push_back(Context.getConstantInt(Type::Int16Ty, field.access));
+ FieldElts.push_back(ConstantInt::get(Type::Int16Ty, field.access));
// name
FieldElts.push_back(getUTF8(field.name));
@@ -869,21 +869,21 @@
}
// nbAttributs
- FieldElts.push_back(Context.getConstantInt(Type::Int16Ty, field.nbAttributs));
+ FieldElts.push_back(ConstantInt::get(Type::Int16Ty, field.nbAttributs));
// classDef
FieldElts.push_back(getNativeClass(field.classDef));
// ptrOffset
- FieldElts.push_back(Context.getConstantInt(Type::Int32Ty, field.ptrOffset));
+ FieldElts.push_back(ConstantInt::get(Type::Int32Ty, field.ptrOffset));
// num
- FieldElts.push_back(Context.getConstantInt(Type::Int16Ty, field.num));
+ FieldElts.push_back(ConstantInt::get(Type::Int16Ty, field.num));
//JInfo
FieldElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
- return ConstantStruct::get(STy, FieldElts);
+ return Context.getConstantStruct(STy, FieldElts);
}
Constant* JavaAOTCompiler::CreateConstantFromJavaMethod(JavaMethod& method) {
@@ -899,7 +899,7 @@
MethodElts.push_back(Context.getNullValue(JnjvmModule::ptrType));
// access
- MethodElts.push_back(Context.getConstantInt(Type::Int16Ty, method.access));
+ MethodElts.push_back(ConstantInt::get(Type::Int16Ty, method.access));
// attributs
if (method.nbAttributs) {
@@ -923,7 +923,7 @@
}
// nbAttributs
- MethodElts.push_back(Context.getConstantInt(Type::Int16Ty, method.nbAttributs));
+ MethodElts.push_back(ConstantInt::get(Type::Int16Ty, method.nbAttributs));
// enveloppes
// already allocated by the JIT, don't reallocate them.
@@ -931,7 +931,7 @@
// nbEnveloppes
// 0 because we're not allocating here.
- MethodElts.push_back(Context.getConstantInt(Type::Int16Ty, 0));
+ MethodElts.push_back(ConstantInt::get(Type::Int16Ty, 0));
// classDef
MethodElts.push_back(getNativeClass(method.classDef));
@@ -943,7 +943,7 @@
MethodElts.push_back(getUTF8(method.type));
// canBeInlined
- MethodElts.push_back(Context.getConstantInt(Type::Int8Ty, method.canBeInlined));
+ MethodElts.push_back(ConstantInt::get(Type::Int8Ty, method.canBeInlined));
// code
if (isAbstract(method.access)) {
@@ -956,12 +956,12 @@
}
// offset
- MethodElts.push_back(Context.getConstantInt(Type::Int32Ty, method.offset));
+ MethodElts.push_back(ConstantInt::get(Type::Int32Ty, method.offset));
//JInfo
MethodElts.push_back(Context.getNullValue(JnjvmModule::ptrType));
- return ConstantStruct::get(STy, MethodElts);
+ return Context.getConstantStruct(STy, MethodElts);
}
Constant* JavaAOTCompiler::CreateConstantFromClassPrimitive(ClassPrimitive* cl) {
@@ -976,14 +976,15 @@
ClassElts.push_back(CreateConstantFromCommonClass(cl));
// primSize
- ClassElts.push_back(Context.getConstantInt(Type::Int32Ty, cl->logSize));
+ ClassElts.push_back(ConstantInt::get(Type::Int32Ty, cl->logSize));
- return ConstantStruct::get(STy, ClassElts);
+ return Context.getConstantStruct(STy, ClassElts);
}
Constant* JavaAOTCompiler::CreateConstantFromClassArray(ClassArray* cl) {
const StructType* STy =
dyn_cast<StructType>(JnjvmModule::JavaClassArrayType->getContainedType(0));
+ LLVMContext& Context = getLLVMModule()->getContext();
std::vector<Constant*> ClassElts;
Constant* ClGEPs[2] = { getIntrinsics()->constantZero,
@@ -999,7 +1000,7 @@
ClassElts.push_back(Cl);
- return ConstantStruct::get(STy, ClassElts);
+ return Context.getConstantStruct(STy, ClassElts);
}
Constant* JavaAOTCompiler::CreateConstantFromClass(Class* cl) {
@@ -1015,7 +1016,7 @@
ClassElts.push_back(CreateConstantFromCommonClass(cl));
// virtualSize
- ClassElts.push_back(Context.getConstantInt(Type::Int32Ty, cl->virtualSize));
+ ClassElts.push_back(ConstantInt::get(Type::Int32Ty, cl->virtualSize));
// IsolateInfo
const ArrayType* ATy = dyn_cast<ArrayType>(STy->getContainedType(2));
@@ -1025,10 +1026,10 @@
assert(TCMTy && "Malformed type");
uint32 status = cl->needsInitialisationCheck() ? vmjc : ready;
- TempElts.push_back(Context.getConstantInt(Type::Int8Ty, status));
- TempElts.push_back(Context.getConstantInt(Type::Int1Ty, status == ready ? 1 : 0));
+ TempElts.push_back(ConstantInt::get(Type::Int8Ty, status));
+ TempElts.push_back(ConstantInt::get(Type::Int1Ty, status == ready ? 1 : 0));
TempElts.push_back(getStaticInstance(cl));
- Constant* CStr[1] = { ConstantStruct::get(TCMTy, TempElts) };
+ Constant* CStr[1] = { Context.getConstantStruct(TCMTy, TempElts) };
TempElts.clear();
ClassElts.push_back(Context.getConstantArray(ATy, CStr, 1));
@@ -1076,7 +1077,7 @@
ClassElts.push_back(fields);
ConstantInt* nbVirtualFields =
- Context.getConstantInt(Type::Int16Ty, cl->nbVirtualFields);
+ ConstantInt::get(Type::Int16Ty, cl->nbVirtualFields);
// nbVirtualFields
ClassElts.push_back(nbVirtualFields);
@@ -1086,7 +1087,7 @@
ClassElts.push_back(Context.getNullValue(JnjvmModule::JavaFieldType));
// nbStaticFields
- ClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->nbStaticFields));
+ ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbStaticFields));
// virtualMethods
if (cl->nbVirtualMethods + cl->nbStaticMethods) {
@@ -1124,7 +1125,7 @@
ClassElts.push_back(methods);
ConstantInt* nbVirtualMethods =
- Context.getConstantInt(Type::Int16Ty, cl->nbVirtualMethods);
+ ConstantInt::get(Type::Int16Ty, cl->nbVirtualMethods);
// nbVirtualMethods
ClassElts.push_back(nbVirtualMethods);
@@ -1133,7 +1134,7 @@
ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::JavaMethodType));
// nbStaticMethods
- ClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->nbStaticMethods));
+ ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbStaticMethods));
// ownerClass
ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
@@ -1166,7 +1167,7 @@
}
// nbAttributs
- ClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->nbAttributs));
+ ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbAttributs));
// innerClasses
if (cl->nbInnerClasses) {
@@ -1190,7 +1191,7 @@
}
// nbInnerClasses
- ClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->nbInnerClasses));
+ ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->nbInnerClasses));
// outerClass
if (cl->outerClass) {
@@ -1200,24 +1201,24 @@
}
// innerAccess
- ClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->innerAccess));
+ ClassElts.push_back(ConstantInt::get(Type::Int16Ty, cl->innerAccess));
// innerOuterResolved
- ClassElts.push_back(Context.getConstantInt(Type::Int8Ty, cl->innerOuterResolved));
+ ClassElts.push_back(ConstantInt::get(Type::Int8Ty, cl->innerOuterResolved));
// isAnonymous
- ClassElts.push_back(Context.getConstantInt(Type::Int8Ty, cl->isAnonymous));
+ ClassElts.push_back(ConstantInt::get(Type::Int8Ty, cl->isAnonymous));
// virtualTableSize
- ClassElts.push_back(Context.getConstantInt(Type::Int32Ty, cl->virtualTableSize));
+ ClassElts.push_back(ConstantInt::get(Type::Int32Ty, cl->virtualTableSize));
// staticSize
- ClassElts.push_back(Context.getConstantInt(Type::Int32Ty, cl->staticSize));
+ ClassElts.push_back(ConstantInt::get(Type::Int32Ty, cl->staticSize));
// JInfo
ClassElts.push_back(Mod.getContext().getNullValue(JnjvmModule::ptrType));
- return ConstantStruct::get(STy, ClassElts);
+ return Context.getConstantStruct(STy, ClassElts);
}
template<typename T>
@@ -1236,12 +1237,12 @@
std::vector<Constant*> Cts;
Cts.push_back(CreateConstantForBaseObject(val->getClass()));
- Cts.push_back(Context.getConstantInt(JnjvmModule::pointerSizeType, val->size));
+ Cts.push_back(ConstantInt::get(JnjvmModule::pointerSizeType, val->size));
std::vector<Constant*> Vals;
for (sint32 i = 0; i < val->size; ++i) {
if (Ty->isInteger()) {
- Vals.push_back(Context.getConstantInt(Ty, (uint64)val->elements[i]));
+ Vals.push_back(ConstantInt::get(Ty, (uint64)val->elements[i]));
} else if (Ty->isFloatingPoint()) {
Vals.push_back(Context.getConstantFP(Ty, (double)(size_t)val->elements[i]));
} else {
@@ -1255,7 +1256,7 @@
Cts.push_back(Context.getConstantArray(ATy, Vals));
- return ConstantStruct::get(STy, Cts);
+ return Context.getConstantStruct(STy, Cts);
}
Constant* JavaAOTCompiler::CreateConstantFromUTF8(const UTF8* val) {
@@ -1270,16 +1271,16 @@
const StructType* STy = StructType::get(Elemts);
std::vector<Constant*> Cts;
- Cts.push_back(Context.getConstantInt(JnjvmModule::pointerSizeType, val->size));
+ Cts.push_back(ConstantInt::get(JnjvmModule::pointerSizeType, val->size));
std::vector<Constant*> Vals;
for (sint32 i = 0; i < val->size; ++i) {
- Vals.push_back(Context.getConstantInt(Type::Int16Ty, val->elements[i]));
+ Vals.push_back(ConstantInt::get(Type::Int16Ty, val->elements[i]));
}
Cts.push_back(Context.getConstantArray(ATy, Vals));
- return ConstantStruct::get(STy, Cts);
+ return Context.getConstantStruct(STy, Cts);
}
@@ -1355,11 +1356,11 @@
// depth
Elemts.push_back(ConstantExpr::getIntToPtr(
- Context.getConstantInt(Type::Int64Ty, VT->depth), PTy));
+ ConstantInt::get(Type::Int64Ty, VT->depth), PTy));
// offset
Elemts.push_back(ConstantExpr::getIntToPtr(
- Context.getConstantInt(Type::Int64Ty, VT->offset), PTy));
+ ConstantInt::get(Type::Int64Ty, VT->offset), PTy));
// cache
Elemts.push_back(N);
@@ -1377,7 +1378,7 @@
// nbSecondaryTypes
Elemts.push_back(ConstantExpr::getIntToPtr(
- Context.getConstantInt(Type::Int64Ty, VT->nbSecondaryTypes), PTy));
+ ConstantInt::get(Type::Int64Ty, VT->nbSecondaryTypes), PTy));
// secondaryTypes
const ArrayType* DTy = ArrayType::get(JnjvmModule::VTType,
@@ -1507,7 +1508,7 @@
Constant* cons =
- ConstantExpr::getIntToPtr(Context.getConstantInt(Type::Int64Ty,
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
uint64_t(isolate)),
ptrType);
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Mon Jul 27 12:54:50 2009
@@ -158,7 +158,7 @@
Constant* Offset = LMI->getOffset();
indexes2[1] = Offset;
#ifdef ISOLATE_SHARING
- indexesCtp = llvmContext->getConstantInt(Type::Int32Ty,
+ indexesCtp = ConstantInt::get(Type::Int32Ty,
Offset->getZExtValue() * -1);
#endif
} else {
@@ -280,7 +280,7 @@
BasicBlock* executeBlock = createBasicBlock("execute");
endBlock = createBasicBlock("end block");
- Constant* sizeB = llvmContext->getConstantInt(Type::Int32Ty, sizeof(jmp_buf));
+ Constant* sizeB = ConstantInt::get(Type::Int32Ty, sizeof(jmp_buf));
Value* oldJB = new AllocaInst(module->ptrType, "", currentBlock);
Value* newJB = new AllocaInst(Type::Int8Ty, sizeB, "", currentBlock);
@@ -512,8 +512,8 @@
// It's a thin lock. Look if we're the owner of this lock.
currentBlock = ThinLockBB;
- Value* idMask = llvmContext->getConstantInt(module->pointerSizeType, 0x7FFFFF00);
- Value* cptMask = llvmContext->getConstantInt(module->pointerSizeType, 0xFF);
+ 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(*currentBlock, ICmpInst::ICMP_EQ, threadId,
IdInLock, "");
@@ -995,7 +995,7 @@
currentBlock);
OldIsolateID = new LoadInst(IsolateIDPtr, "", currentBlock);
- Value* MyID = llvmContext->getConstantInt(module->pointerSizeType,
+ Value* MyID = ConstantInt::get(module->pointerSizeType,
loader->getIsolate()->IsolateID);
Cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, OldIsolateID, MyID,
"");
@@ -1212,13 +1212,13 @@
}
#endif
} else if (type == JavaConstantPool::ConstantLong) {
- push(llvmContext->getConstantInt(Type::Int64Ty, ctpInfo->LongAt(index)),
+ push(ConstantInt::get(Type::Int64Ty, ctpInfo->LongAt(index)),
false);
} else if (type == JavaConstantPool::ConstantDouble) {
push(llvmContext->getConstantFP(Type::DoubleTy, ctpInfo->DoubleAt(index)),
false);
} else if (type == JavaConstantPool::ConstantInteger) {
- push(llvmContext->getConstantInt(Type::Int32Ty, ctpInfo->IntegerAt(index)),
+ push(ConstantInt::get(Type::Int32Ty, ctpInfo->IntegerAt(index)),
false);
} else if (type == JavaConstantPool::ConstantFloat) {
push(llvmContext->getConstantFP(Type::FloatTy, ctpInfo->FloatAt(index)),
@@ -1548,7 +1548,7 @@
BranchInst::Create(falseCl, trueCl, test, currentBlock);
std::vector<Value*> Args;
Args.push_back(ctpCache);
- Args.push_back(llvmContext->getConstantInt(Type::Int32Ty, index));
+ Args.push_back(ConstantInt::get(Type::Int32Ty, index));
Args.push_back(GV);
res = CallInst::Create(module->SpecialCtpLookupFunction, Args.begin(),
Args.end(), "", falseCl);
@@ -1676,7 +1676,7 @@
Args.push_back(resolver);
Args.push_back(CTP);
Args.push_back(Cl);
- Args.push_back(llvmContext->getConstantInt(Type::Int32Ty, index));
+ Args.push_back(ConstantInt::get(Type::Int32Ty, index));
if (additionalArg) Args.push_back(additionalArg);
Value* res = 0;
@@ -1918,22 +1918,22 @@
const PrimitiveTypedef* prim = (PrimitiveTypedef*)sign;
if (prim->isInt()) {
sint32 val = field->getInt32Field(Obj);
- push(llvmContext->getConstantInt(Type::Int32Ty, val), false);
+ push(ConstantInt::get(Type::Int32Ty, val), false);
} else if (prim->isByte()) {
sint8 val = (sint8)field->getInt8Field(Obj);
- push(llvmContext->getConstantInt(Type::Int8Ty, val), false);
+ push(ConstantInt::get(Type::Int8Ty, val), false);
} else if (prim->isBool()) {
uint8 val = (uint8)field->getInt8Field(Obj);
- push(llvmContext->getConstantInt(Type::Int8Ty, val), true);
+ push(ConstantInt::get(Type::Int8Ty, val), true);
} else if (prim->isShort()) {
sint16 val = (sint16)field->getInt16Field(Obj);
- push(llvmContext->getConstantInt(Type::Int16Ty, val), false);
+ push(ConstantInt::get(Type::Int16Ty, val), false);
} else if (prim->isChar()) {
uint16 val = (uint16)field->getInt16Field(Obj);
- push(llvmContext->getConstantInt(Type::Int16Ty, val), true);
+ push(ConstantInt::get(Type::Int16Ty, val), true);
} else if (prim->isLong()) {
sint64 val = (sint64)field->getLongField(Obj);
- push(llvmContext->getConstantInt(Type::Int64Ty, val), false);
+ push(ConstantInt::get(Type::Int64Ty, val), false);
} else if (prim->isFloat()) {
float val = (float)field->getFloatField(Obj);
push(llvmContext->getConstantFP(Type::FloatTy, val), false);
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJITCompiler.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITCompiler.cpp Mon Jul 27 12:54:50 2009
@@ -29,55 +29,48 @@
using namespace llvm;
Constant* JavaJITCompiler::getNativeClass(CommonClass* classDef) {
- LLVMContext& Context = getLLVMModule()->getContext();
const llvm::Type* Ty = classDef->isClass() ? JnjvmModule::JavaClassType :
JnjvmModule::JavaCommonClassType;
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64_t(classDef));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64_t(classDef));
return ConstantExpr::getIntToPtr(CI, Ty);
}
Constant* JavaJITCompiler::getConstantPool(JavaConstantPool* ctp) {
void* ptr = ctp->ctpRes;
assert(ptr && "No constant pool found");
- LLVMContext& Context = getLLVMModule()->getContext();
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64_t(ptr));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64_t(ptr));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::ConstantPoolType);
}
Constant* JavaJITCompiler::getMethodInClass(JavaMethod* meth) {
- LLVMContext& Context = getLLVMModule()->getContext();
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, (int64_t)meth);
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, (int64_t)meth);
return ConstantExpr::getIntToPtr(CI, JnjvmModule::JavaMethodType);
}
Constant* JavaJITCompiler::getString(JavaString* str) {
assert(str && "No string given");
- LLVMContext& Context = getLLVMModule()->getContext();
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64(str));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64(str));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::JavaObjectType);
}
Constant* JavaJITCompiler::getStringPtr(JavaString** str) {
assert(str && "No string given");
- LLVMContext& Context = getLLVMModule()->getContext();
const llvm::Type* Ty = PointerType::getUnqual(JnjvmModule::JavaObjectType);
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64(str));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64(str));
return ConstantExpr::getIntToPtr(CI, Ty);
}
Constant* JavaJITCompiler::getEnveloppe(Enveloppe* enveloppe) {
assert(enveloppe && "No enveloppe given");
- LLVMContext& Context = getLLVMModule()->getContext();
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64(enveloppe));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64(enveloppe));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::EnveloppeType);
}
Constant* JavaJITCompiler::getJavaClass(CommonClass* cl) {
JavaObject* obj = cl->getClassDelegatee(JavaThread::get()->getJVM());
assert(obj && "Delegatee not created");
- LLVMContext& Context = getLLVMModule()->getContext();
- Constant* CI = Context.getConstantInt(Type::Int64Ty, uint64(obj));
+ Constant* CI = ConstantInt::get(Type::Int64Ty, uint64(obj));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::JavaObjectType);
}
@@ -85,8 +78,7 @@
Jnjvm* vm = JavaThread::get()->getJVM();
JavaObject* const* obj = cl->getClassDelegateePtr(vm);
assert(obj && "Delegatee not created");
- LLVMContext& Context = getLLVMModule()->getContext();
- Constant* CI = Context.getConstantInt(Type::Int64Ty, uint64(obj));
+ Constant* CI = ConstantInt::get(Type::Int64Ty, uint64(obj));
const Type* Ty = PointerType::getUnqual(JnjvmModule::JavaObjectType);
return ConstantExpr::getIntToPtr(CI, Ty);
}
@@ -101,13 +93,11 @@
}
Constant* JavaJITCompiler::getFinalObject(JavaObject* obj) {
- LLVMContext& Context = getLLVMModule()->getContext();
- Constant* CI = Context.getConstantInt(Type::Int64Ty, uint64(obj));
+ Constant* CI = ConstantInt::get(Type::Int64Ty, uint64(obj));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::JavaObjectType);
}
Constant* JavaJITCompiler::getStaticInstance(Class* classDef) {
- LLVMContext& Context = getLLVMModule()->getContext();
#ifdef ISOLATE
assert(0 && "Should not be here");
abort();
@@ -122,29 +112,27 @@
}
classDef->release();
}
- Constant* CI = Context.getConstantInt(Type::Int64Ty, (uint64_t(obj)));
+ Constant* CI = ConstantInt::get(Type::Int64Ty, (uint64_t(obj)));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::ptrType);
}
Constant* JavaJITCompiler::getVirtualTable(JavaVirtualTable* VT) {
- LLVMContext& Context = getLLVMModule()->getContext();
if (VT->cl->isClass()) {
LLVMClassInfo* LCI = getClassInfo(VT->cl->asClass());
LCI->getVirtualType();
}
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64_t(VT));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64_t(VT));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::VTType);
}
Constant* JavaJITCompiler::getNativeFunction(JavaMethod* meth, void* ptr) {
- LLVMContext& Context = getLLVMModule()->getContext();
LLVMSignatureInfo* LSI = getSignatureInfo(meth->getSignature());
const llvm::Type* valPtrType = LSI->getNativePtrType();
assert(ptr && "No native function given");
- Constant* CI = Context.getConstantInt(Type::Int64Ty, uint64_t(ptr));
+ Constant* CI = ConstantInt::get(Type::Int64Ty, uint64_t(ptr));
return ConstantExpr::getIntToPtr(CI, valPtrType);
}
@@ -162,8 +150,7 @@
#ifdef SERVICE
Value* JavaJITCompiler::getIsolate(Jnjvm* isolate, Value* Where) {
- LLVMContext& Context = getLLVMModule()->getContext();
- ConstantInt* CI = Context.getConstantInt(Type::Int64Ty, uint64_t(isolate));
+ ConstantInt* CI = ConstantInt::get(Type::Int64Ty, uint64_t(isolate));
return ConstantExpr::getIntToPtr(CI, JnjvmModule::ptrType);
}
#endif
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp Mon Jul 27 12:54:50 2009
@@ -182,8 +182,8 @@
#if JNJVM_EXECUTE > 1
{
Value* args[3] = {
- llvmContext->getConstantInt(Type::Int32Ty, (int64_t)bytecodes[i]),
- llvmContext->getConstantInt(Type::Int32Ty, (int64_t)i),
+ ConstantInt::get(Type::Int32Ty, (int64_t)bytecodes[i]),
+ ConstantInt::get(Type::Int32Ty, (int64_t)i),
TheCompiler->getMethodInClass(compilingMethod)
};
@@ -262,13 +262,13 @@
break;
case BIPUSH :
- push(ConstantExpr::getSExt(llvmContext->getConstantInt(Type::Int8Ty,
+ push(ConstantExpr::getSExt(ConstantInt::get(Type::Int8Ty,
bytecodes[++i]),
Type::Int32Ty), false);
break;
case SIPUSH :
- push(ConstantExpr::getSExt(llvmContext->getConstantInt(Type::Int16Ty,
+ push(ConstantExpr::getSExt(ConstantInt::get(Type::Int16Ty,
readS2(bytecodes, i)),
Type::Int32Ty), false);
break;
@@ -1126,7 +1126,7 @@
case IUSHR : {
Value* val2 = popAsInt();
Value* val1 = popAsInt();
- Value* mask = llvmContext->getConstantInt(Type::Int32Ty, 0x1F);
+ Value* mask = ConstantInt::get(Type::Int32Ty, 0x1F);
val2 = BinaryOperator::CreateAnd(val2, mask, "", currentBlock);
push(BinaryOperator::CreateLShr(val1, val2, "", currentBlock),
false);
@@ -1135,7 +1135,7 @@
case LUSHR : {
Value* val2 = new ZExtInst(pop(), Type::Int64Ty, "", currentBlock);
- Value* mask = llvmContext->getConstantInt(Type::Int64Ty, 0x3F);
+ Value* mask = ConstantInt::get(Type::Int64Ty, 0x3F);
val2 = BinaryOperator::CreateAnd(val2, mask, "", currentBlock);
pop(); // remove the 0 on the stack
Value* val1 = pop();
@@ -1207,7 +1207,7 @@
sint16 val = WREAD_S1(bytecodes, false, i, wide);
llvm::Value* add = BinaryOperator::CreateAdd(
new LoadInst(intLocals[idx], "", currentBlock),
- llvmContext->getConstantInt(Type::Int32Ty, val), "",
+ ConstantInt::get(Type::Int32Ty, val), "",
currentBlock);
new StoreInst(add, intLocals[idx], false, currentBlock);
break;
@@ -1743,7 +1743,7 @@
case JSR : {
uint32 tmp = i;
Value* expr = ConstantExpr::getIntToPtr(
- llvmContext->getConstantInt(Type::Int64Ty,
+ ConstantInt::get(Type::Int64Ty,
uint64_t (jsrIndex++)),
module->JavaObjectType);
push(expr, false);
@@ -1762,7 +1762,7 @@
uint32 index = 0;
for (std::vector<BasicBlock*>::iterator i = jsrs.begin(),
e = jsrs.end(); i!= e; ++i, ++index) {
- inst->addCase(llvmContext->getConstantInt(Type::Int32Ty, index), *i);
+ inst->addCase(ConstantInt::get(Type::Int32Ty, index), *i);
}
break;
@@ -1783,7 +1783,7 @@
const llvm::Type* type = index->getType();
for (sint32 cur = low; cur < high; ++cur) {
Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ,
- llvmContext->getConstantInt(type, cur), index, "");
+ ConstantInt::get(type, cur), index, "");
BasicBlock* falseBlock = createBasicBlock("continue tableswitch");
branch(cmp, opcodeInfos[tmp + readU4(bytecodes, i)].newBlock,
falseBlock, currentBlock);
@@ -1813,7 +1813,7 @@
key = new SExtInst(key, Type::Int32Ty, "", currentBlock);
}
for (uint32 cur = 0; cur < nbs; ++cur) {
- Value* val = llvmContext->getConstantInt(Type::Int32Ty, readU4(bytecodes, i));
+ Value* val = ConstantInt::get(Type::Int32Ty, readU4(bytecodes, i));
Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val, key,
"");
BasicBlock* falseBlock = createBasicBlock("continue lookupswitch");
@@ -1932,13 +1932,13 @@
valCl = TheCompiler->getNativeClass(dcl);
#else
Value* args[2] = { isolateLocal,
- llvmContext->getConstantInt(Type::Int32Ty, id - 4) };
+ ConstantInt::get(Type::Int32Ty, id - 4) };
valCl = CallInst::Create(module->GetJnjvmArrayClassFunction,
args, args + 2, "", currentBlock);
#endif
LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[charId];
- sizeElement = llvmContext->getConstantInt(Type::Int32Ty,
+ sizeElement = ConstantInt::get(Type::Int32Ty,
LAI.logSizeInBytesConstant);
if (TheCompiler->isStaticCompiling() &&
valCl->getType() != module->JavaClassArrayType) {
@@ -2112,7 +2112,7 @@
objVT, "", currentBlock);
uint32 depth = cl->virtualVT->depth;
- ConstantInt* CI = llvmContext->getConstantInt(Type::Int32Ty, depth);
+ ConstantInt* CI = ConstantInt::get(Type::Int32Ty, depth);
Value* displayArgs[2] = { inDisplay, CI };
Value* VTInDisplay =
CallInst::Create(module->GetVTInDisplayFunction,
@@ -2167,7 +2167,7 @@
Value* valCl = getResolvedCommonClass(index, true, 0);
Value** args = (Value**)alloca(sizeof(Value*) * (dim + 2));
args[0] = valCl;
- args[1] = llvmContext->getConstantInt(Type::Int32Ty, dim);
+ args[1] = ConstantInt::get(Type::Int32Ty, dim);
for (int cur = dim + 1; cur >= 2; --cur)
args[cur] = pop();
Modified: vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp Mon Jul 27 12:54:50 2009
@@ -165,7 +165,6 @@
JnjvmModule::JnjvmModule(llvm::Module* module) :
MvmModule(module) {
- LLVMContext& Context = module->getContext();
if (!VTType) {
initialise();
@@ -174,10 +173,10 @@
JavaObjectNullConstant =
module->getContext().getNullValue(JnjvmModule::JavaObjectType);
- MaxArraySizeConstant = Context.getConstantInt(Type::Int32Ty,
+ MaxArraySizeConstant = ConstantInt::get(Type::Int32Ty,
JavaArray::MaxArraySize);
JavaArraySizeConstant =
- Context.getConstantInt(Type::Int32Ty, sizeof(JavaObject) + sizeof(ssize_t));
+ ConstantInt::get(Type::Int32Ty, sizeof(JavaObject) + sizeof(ssize_t));
JavaArrayElementsOffsetConstant = constantTwo;
@@ -187,22 +186,22 @@
OffsetClassInVTConstant = constantThree;
OffsetDepthInVTConstant = constantFour;
OffsetDisplayInVTConstant = constantSeven;
- OffsetBaseClassVTInVTConstant = Context.getConstantInt(Type::Int32Ty, 17);
+ OffsetBaseClassVTInVTConstant = ConstantInt::get(Type::Int32Ty, 17);
OffsetObjectSizeInClassConstant = constantOne;
- OffsetVTInClassConstant = Context.getConstantInt(Type::Int32Ty, 7);
+ OffsetVTInClassConstant = ConstantInt::get(Type::Int32Ty, 7);
OffsetTaskClassMirrorInClassConstant = constantTwo;
OffsetStaticInstanceInTaskClassMirrorConstant = constantTwo;
OffsetStatusInTaskClassMirrorConstant = constantZero;
OffsetInitializedInTaskClassMirrorConstant = constantOne;
- OffsetIsolateInThreadConstant = Context.getConstantInt(Type::Int32Ty, 3);
- OffsetDoYieldInThreadConstant = Context.getConstantInt(Type::Int32Ty, 6);
- OffsetJNIInThreadConstant = Context.getConstantInt(Type::Int32Ty, 9);
- OffsetJavaExceptionInThreadConstant = Context.getConstantInt(Type::Int32Ty, 10);
- OffsetCXXExceptionInThreadConstant = Context.getConstantInt(Type::Int32Ty, 11);
+ OffsetIsolateInThreadConstant = ConstantInt::get(Type::Int32Ty, 3);
+ OffsetDoYieldInThreadConstant = ConstantInt::get(Type::Int32Ty, 6);
+ OffsetJNIInThreadConstant = ConstantInt::get(Type::Int32Ty, 9);
+ OffsetJavaExceptionInThreadConstant = ConstantInt::get(Type::Int32Ty, 10);
+ OffsetCXXExceptionInThreadConstant = ConstantInt::get(Type::Int32Ty, 11);
- ClassReadyConstant = Context.getConstantInt(Type::Int8Ty, ready);
+ ClassReadyConstant = ConstantInt::get(Type::Int8Ty, ready);
module->addTypeName("JavaObject", JavaObjectType->getContainedType(0));
module->addTypeName("JavaArray", JavaArrayType->getContainedType(0));
Modified: vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp Mon Jul 27 12:54:50 2009
@@ -411,7 +411,7 @@
ConstantInt* Cons = dyn_cast<ConstantInt>(Index);
assert(CI && "Wrong use of GetConstantPoolAt");
uint64 val = Cons->getZExtValue();
- Value* indexes = Context->getConstantInt(Type::Int32Ty, val + 1);
+ Value* indexes = ConstantInt::get(Type::Int32Ty, val + 1);
#else
Value* indexes = Index;
#endif
@@ -537,7 +537,7 @@
BasicBlock* FailedBlock = BasicBlock::Create("", &F);
PHINode* node = PHINode::Create(Type::Int1Ty, "", CurEndBlock);
- ConstantInt* CC = Context->getConstantInt(Type::Int32Ty,
+ ConstantInt* CC = ConstantInt::get(Type::Int32Ty,
JavaVirtualTable::getOffsetIndex());
Value* indices[2] = { module->constantZero, CC };
Value* Offset = GetElementPtrInst::Create(VT2, indices, indices + 2,
@@ -595,7 +595,7 @@
// if (VT1.cache == VT2 || VT1 == VT2) goto end with true;
// else goto headerLoop;
ConstantInt* cacheIndex =
- Context->getConstantInt(Type::Int32Ty, JavaVirtualTable::getCacheIndex());
+ ConstantInt::get(Type::Int32Ty, JavaVirtualTable::getCacheIndex());
Value* indices[2] = { module->constantZero, cacheIndex };
Instruction* CachePtr =
GetElementPtrInst::Create(VT1, indices, indices + 2, "", CI);
@@ -613,7 +613,7 @@
// size = VT1->nbSecondaryTypes;
// i = 0;
// goto test;
- ConstantInt* sizeIndex = Context->getConstantInt(Type::Int32Ty,
+ ConstantInt* sizeIndex = ConstantInt::get(Type::Int32Ty,
JavaVirtualTable::getNumSecondaryTypesIndex());
indices[1] = sizeIndex;
Instruction* Size = GetElementPtrInst::Create(VT1, indices,
@@ -622,7 +622,7 @@
Size = new LoadInst(Size, "", false, Preheader);
Size = new PtrToIntInst(Size, Type::Int32Ty, "", Preheader);
- ConstantInt* secondaryTypesIndex = Context->getConstantInt(Type::Int32Ty,
+ ConstantInt* secondaryTypesIndex = ConstantInt::get(Type::Int32Ty,
JavaVirtualTable::getSecondaryTypesIndex());
indices[1] = secondaryTypesIndex;
Instruction* secondaryTypes =
Modified: vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp Mon Jul 27 12:54:50 2009
@@ -213,7 +213,7 @@
// we don't end up with tons of allocations on the stack.
BasicBlock* BB = CurLoop->getLoopPreheader();
assert(BB && "No Preheader!");
- DOUT << "Escape analysis hoisting to " << BB->getName() << ": ";
+ DOUT << "Escape analysis hoisting to " << BB->getNameStr() << ": ";
DOUT << *Alloc;
Alloc->removeFromParent();
BB->getInstList().insert(BB->getTerminator(), Alloc);
@@ -221,7 +221,7 @@
AllocaInst* AI = new AllocaInst(Type::Int8Ty, Size, "", Alloc);
BitCastInst* BI = new BitCastInst(AI, Alloc->getType(), "", Alloc);
- DOUT << "escape" << Alloc->getParent()->getParent()->getName() << "\n";
+ DOUT << "escape" << Alloc->getParent()->getParent()->getNameStr() << "\n";
Alloc->replaceAllUsesWith(BI);
// If it's an invoke, replace the invoke with a direct branch.
if (InvokeInst *CI = dyn_cast<InvokeInst>(Alloc)) {
Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Mon Jul 27 12:54:50 2009
@@ -98,24 +98,24 @@
// Constant declaration
- constantLongMinusOne = globalContext->getConstantInt(Type::Int64Ty, (uint64_t)-1);
- constantLongZero = globalContext->getConstantInt(Type::Int64Ty, 0);
- constantLongOne = globalContext->getConstantInt(Type::Int64Ty, 1);
- constantZero = globalContext->getConstantInt(Type::Int32Ty, 0);
- constantInt8Zero = globalContext->getConstantInt(Type::Int8Ty, 0);
- constantOne = globalContext->getConstantInt(Type::Int32Ty, 1);
- constantTwo = globalContext->getConstantInt(Type::Int32Ty, 2);
- constantThree = globalContext->getConstantInt(Type::Int32Ty, 3);
- constantFour = globalContext->getConstantInt(Type::Int32Ty, 4);
- constantFive = globalContext->getConstantInt(Type::Int32Ty, 5);
- constantSix = globalContext->getConstantInt(Type::Int32Ty, 6);
- constantSeven = globalContext->getConstantInt(Type::Int32Ty, 7);
- constantEight = globalContext->getConstantInt(Type::Int32Ty, 8);
- constantMinusOne = globalContext->getConstantInt(Type::Int32Ty, (uint64_t)-1);
- constantMinInt = globalContext->getConstantInt(Type::Int32Ty, MinInt);
- constantMaxInt = globalContext->getConstantInt(Type::Int32Ty, MaxInt);
- constantMinLong = globalContext->getConstantInt(Type::Int64Ty, MinLong);
- constantMaxLong = globalContext->getConstantInt(Type::Int64Ty, MaxLong);
+ constantLongMinusOne = ConstantInt::get(Type::Int64Ty, (uint64_t)-1);
+ constantLongZero = ConstantInt::get(Type::Int64Ty, 0);
+ constantLongOne = ConstantInt::get(Type::Int64Ty, 1);
+ constantZero = ConstantInt::get(Type::Int32Ty, 0);
+ constantInt8Zero = ConstantInt::get(Type::Int8Ty, 0);
+ constantOne = ConstantInt::get(Type::Int32Ty, 1);
+ constantTwo = ConstantInt::get(Type::Int32Ty, 2);
+ constantThree = ConstantInt::get(Type::Int32Ty, 3);
+ constantFour = ConstantInt::get(Type::Int32Ty, 4);
+ constantFive = ConstantInt::get(Type::Int32Ty, 5);
+ constantSix = ConstantInt::get(Type::Int32Ty, 6);
+ constantSeven = ConstantInt::get(Type::Int32Ty, 7);
+ constantEight = ConstantInt::get(Type::Int32Ty, 8);
+ constantMinusOne = ConstantInt::get(Type::Int32Ty, (uint64_t)-1);
+ constantMinInt = ConstantInt::get(Type::Int32Ty, MinInt);
+ constantMaxInt = ConstantInt::get(Type::Int32Ty, MaxInt);
+ constantMinLong = ConstantInt::get(Type::Int64Ty, MinLong);
+ constantMaxLong = ConstantInt::get(Type::Int64Ty, MaxLong);
constantFloatZero = globalContext->getConstantFP(Type::FloatTy, 0.0f);
constantFloatOne = globalContext->getConstantFP(Type::FloatTy, 1.0f);
constantFloatTwo = globalContext->getConstantFP(Type::FloatTy, 2.0f);
@@ -136,17 +136,17 @@
constantDoubleMinusInfinity = globalContext->getConstantFP(Type::DoubleTy, MinDouble);
constantDoubleMinusZero = globalContext->getConstantFP(Type::DoubleTy, -0.0);
constantFloatMinusZero = globalContext->getConstantFP(Type::FloatTy, -0.0f);
- constantThreadIDMask = globalContext->getConstantInt(pointerSizeType, mvm::Thread::IDMask);
+ constantThreadIDMask = ConstantInt::get(pointerSizeType, mvm::Thread::IDMask);
constantStackOverflowMask =
- globalContext->getConstantInt(pointerSizeType, mvm::Thread::StackOverflowMask);
- constantFatMask = globalContext->getConstantInt(pointerSizeType,
+ ConstantInt::get(pointerSizeType, mvm::Thread::StackOverflowMask);
+ constantFatMask = ConstantInt::get(pointerSizeType,
pointerSizeType == Type::Int32Ty ? 0x80000000 : 0x8000000000000000LL);
- constantPtrOne = globalContext->getConstantInt(pointerSizeType, 1);
- constantPtrZero = globalContext->getConstantInt(pointerSizeType, 0);
+ constantPtrOne = ConstantInt::get(pointerSizeType, 1);
+ constantPtrZero = ConstantInt::get(pointerSizeType, 0);
constantPtrNull = globalContext->getNullValue(ptrType);
constantPtrLogSize =
- globalContext->getConstantInt(Type::Int32Ty, sizeof(void*) == 8 ? 3 : 2);
+ 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=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoString.cpp (original)
+++ vmkit/trunk/lib/N3/Mono/MonoString.cpp Mon Jul 27 12:54:50 2009
@@ -52,9 +52,8 @@
if (!str->_llvmVar) {
const Type* pty = mvm::MvmModule::ptrType;
Module* Mod = vm->getLLVMModule();
- LLVMContext& Context = Mod->getContext();
Constant* cons =
- ConstantExpr::getIntToPtr(Context.getConstantInt(Type::Int64Ty, uint64_t (this)),
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
str->_llvmVar = new GlobalVariable(*Mod, pty, true,
GlobalValue::ExternalLinkage,
Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Mon Jul 27 12:54:50 2009
@@ -103,7 +103,6 @@
Value* GC = ++(block->getParent()->arg_begin());
#endif
- Function* llvmFunction = block->getParent();
Constant* zero = cl->vm->module->constantZero;
for (std::vector<VMField*>::iterator i = fields.begin(),
e = fields.end(); i!= e; ++i) {
@@ -113,7 +112,7 @@
args.push_back(zero);
if (boxed) {
ConstantInt* CI = dyn_cast<ConstantInt>(field->offset);
- args.push_back(llvmFunction->getContext().getConstantInt(CI->getValue() + 1));
+ args.push_back(ConstantInt::get(Type::Int32Ty, CI->getValue() + 1));
} else {
args.push_back(field->offset);
}
@@ -125,7 +124,7 @@
args.push_back(zero);
if (boxed) {
ConstantInt* CI = dyn_cast<ConstantInt>(field->offset);
- args.push_back(llvmFunction->getContext().getConstantInt(CI->getValue() + 1));
+ args.push_back(ConstantInt::get(Type::Int32Ty, CI->getValue() + 1));
} else {
args.push_back(field->offset);
}
@@ -631,7 +630,7 @@
std::vector<Value*> params;
params.push_back(new BitCastInst(obj, module->ptrType, "", currentBlock));
params.push_back(module->constantInt8Zero);
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memset_i32, params.begin(), params.end(),
"", currentBlock);
@@ -738,7 +737,7 @@
std::vector<Value*> params;
params.push_back(new BitCastInst(ptr, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
params.push_back(new BitCastInst(val, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memcpy_i32, params.begin(), params.end(), "", currentBlock);
@@ -950,7 +949,7 @@
void* natPtr = NativeUtil::nativeLookup(compilingClass, compilingMethod);
Value* valPtr =
- ConstantExpr::getIntToPtr(llvmFunction->getContext().getConstantInt(Type::Int64Ty, (uint64)natPtr),
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, (uint64)natPtr),
PointerType::getUnqual(funcType));
Value* result = CallInst::Create(valPtr, nativeArgs.begin(),
@@ -1234,7 +1233,7 @@
params.push_back(new BitCastInst(alloc, module->ptrType, "",
currentBlock));
params.push_back(module->constantInt8Zero);
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memset_i32, params.begin(),
params.end(), "", currentBlock);
@@ -1282,7 +1281,7 @@
currentBlock));
params.push_back(new BitCastInst(endNode, module->ptrType, "",
currentBlock));
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantFour);
CallInst::Create(module->llvm_memcpy_i32, params.begin(), params.end(),
"", currentBlock);
@@ -1411,7 +1410,7 @@
params.push_back(new BitCastInst(alloc, module->ptrType, "",
currentBlock));
params.push_back(module->constantInt8Zero);
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memset_i32, params.begin(),
params.end(), "", currentBlock);
Modified: vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp Mon Jul 27 12:54:50 2009
@@ -365,10 +365,9 @@
aquire();
if (!_llvmVar) {
Module* Mod = vm->getLLVMModule();
- LLVMContext& Context = Mod->getContext();
const Type* pty = mvm::MvmModule::ptrType;
Constant* cons =
- ConstantExpr::getIntToPtr(Context.getConstantInt(Type::Int64Ty, uint64_t (this)),
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
_llvmVar = new GlobalVariable(*Mod, pty, true,
@@ -387,9 +386,8 @@
if (!_llvmVar) {
const Type* pty = mvm::MvmModule::ptrType;
Module* Mod = classDef->vm->getLLVMModule();
- LLVMContext& Context = Mod->getContext();
Constant* cons =
- ConstantExpr::getIntToPtr(Context.getConstantInt(Type::Int64Ty, uint64_t (this)),
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
_llvmVar = new GlobalVariable(*Mod, pty, true,
@@ -406,10 +404,9 @@
classDef->aquire();
if (!_llvmVar) {
Module* Mod = classDef->vm->getLLVMModule();
- LLVMContext& Context = Mod->getContext();
const Type* pty = mvm::MvmModule::ptrType;
Constant* cons =
- ConstantExpr::getIntToPtr(Context.getConstantInt(Type::Int64Ty, uint64_t (this)),
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
pty);
_llvmVar = new GlobalVariable(*Mod, pty, true,
Modified: vmkit/trunk/lib/N3/VMCore/LowerArrayLength.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/LowerArrayLength.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/LowerArrayLength.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/LowerArrayLength.cpp Mon Jul 27 12:54:50 2009
@@ -46,7 +46,7 @@
Changed = true;
Value* val = CI->getOperand(1); // get the array
std::vector<Value*> args; //size= 2
- args.push_back(F.getContext().getConstantInt(Type::Int32Ty, 0));
+ args.push_back(ConstantInt::get(Type::Int32Ty, 0));
args.push_back(n3::VMArray::sizeOffset());
Value* ptr = GetElementPtrInst::Create(val, args.begin(), args.end(),
"", CI);
Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Mon Jul 27 12:54:50 2009
@@ -164,7 +164,6 @@
static void store(Value* val, Value* local, bool vol,
BasicBlock* currentBlock, mvm::MvmModule* module) {
const Type* contained = local->getType()->getContainedType(0);
- Function* llvmFunction = currentBlock->getParent();
if (contained->isSingleValueType()) {
if (val->getType() != contained) {
convertValue(val, contained, currentBlock);
@@ -176,7 +175,7 @@
std::vector<Value*> params;
params.push_back(new BitCastInst(local, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
params.push_back(new BitCastInst(val, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memcpy_i32, params.begin(), params.end(), "", currentBlock);
} else {
@@ -186,7 +185,6 @@
static Value* load(Value* val, const char* name, BasicBlock* currentBlock, mvm::MvmModule* module) {
const Type* contained = val->getType()->getContainedType(0);
- Function* llvmFunction = currentBlock->getParent();
if (contained->isSingleValueType()) {
return new LoadInst(val, name, currentBlock);
} else {
@@ -195,7 +193,7 @@
std::vector<Value*> params;
params.push_back(new BitCastInst(ret, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
params.push_back(new BitCastInst(val, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memcpy_i32, params.begin(), params.end(), "", currentBlock);
return ret;
@@ -230,13 +228,13 @@
#if N3_EXECUTE > 1
if (bytecodes[i] == 0xFE) {
std::vector<llvm::Value*> args;
- args.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, (int64_t)OpcodeNamesFE[bytecodes[i + 1]]));
- args.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, (int64_t)compilingMethod));
+ args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)OpcodeNamesFE[bytecodes[i + 1]]));
+ args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
CallInst::Create(printExecutionLLVM, args.begin(), args.end(), "", currentBlock);
} else {
std::vector<llvm::Value*> args;
- args.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, (int64_t)OpcodeNames[bytecodes[i]]));
- args.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, (int64_t)compilingMethod));
+ args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)OpcodeNames[bytecodes[i]]));
+ args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
CallInst::Create(printExecutionLLVM, args.begin(), args.end(), "", currentBlock);
}
#endif
@@ -705,7 +703,7 @@
uint32 index = 0;
for (std::vector<BasicBlock*>::iterator i = leaves.begin(),
e = leaves.end(); i!= e; ++i, ++index) {
- inst->addCase(llvmFunction->getContext().getConstantInt(Type::Int32Ty, index), *i);
+ inst->addCase(ConstantInt::get(Type::Int32Ty, index), *i);
}
//currentBlock = bb2;
@@ -749,12 +747,12 @@
}
case LDC_I4 : {
- push(llvmFunction->getContext().getConstantInt(Type::Int32Ty, readS4(bytecodes, i)));
+ push(ConstantInt::get(Type::Int32Ty, readS4(bytecodes, i)));
break;
}
case LDC_I8 : {
- push(llvmFunction->getContext().getConstantInt(Type::Int64Ty, readS8(bytecodes, i)));
+ push(ConstantInt::get(Type::Int64Ty, readS8(bytecodes, i)));
break;
}
@@ -819,7 +817,7 @@
}
case LDC_I4_S : {
- push(llvmFunction->getContext().getConstantInt(Type::Int32Ty, readS1(bytecodes, i)));
+ push(ConstantInt::get(Type::Int32Ty, readS1(bytecodes, i)));
break;
}
@@ -954,7 +952,7 @@
}
if (res) {
Value* expr = ConstantExpr::getIntToPtr(
- llvmFunction->getContext().getConstantInt(Type::Int64Ty,
+ ConstantInt::get(Type::Int64Ty,
uint64_t (leaveIndex++)),
VMObject::llvmType);
@@ -986,7 +984,7 @@
}
if (res) {
Value* expr = ConstantExpr::getIntToPtr(
- llvmFunction->getContext().getConstantInt(Type::Int64Ty,
+ ConstantInt::get(Type::Int64Ty,
uint64_t (leaveIndex++)),
VMObject::llvmType);
@@ -1262,7 +1260,7 @@
sint32 index = next + offset;
assert(index > 0);
BasicBlock* BB = opcodeInfos[index].newBlock;
- SI->addCase(llvmFunction->getContext().getConstantInt(Type::Int32Ty, t), BB);
+ SI->addCase(ConstantInt::get(Type::Int32Ty, t), BB);
}
break;
}
@@ -1313,7 +1311,7 @@
std::vector<Value*> params;
params.push_back(new BitCastInst(ptr, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
params.push_back(new BitCastInst(val, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memcpy_i32, params.begin(), params.end(), "", currentBlock);
@@ -1580,7 +1578,7 @@
uint32 value = readU4(bytecodes, i);
uint32 index = value & 0xfffffff;
const UTF8* utf8 = compilingClass->assembly->readUserString(index);
- Value* val = ConstantExpr::getIntToPtr(llvmFunction->getContext().getConstantInt(Type::Int64Ty, (int64_t)utf8),
+ Value* val = ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, (int64_t)utf8),
module->ptrType);
Value* res = CallInst::Create(newStringLLVM, val, "", currentBlock);
/*CLIString * str =
@@ -1812,7 +1810,7 @@
std::vector<Value*> params;
params.push_back(new BitCastInst(val, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
params.push_back(new BitCastInst(ptr, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memcpy_i32, params.begin(), params.end(), "", currentBlock);
@@ -1963,7 +1961,7 @@
params.push_back(new BitCastInst(pop(), module->ptrType, "",
currentBlock));
params.push_back(module->constantInt8Zero);
- params.push_back(llvmFunction->getContext().getConstantInt(Type::Int32Ty, size));
+ params.push_back(ConstantInt::get(Type::Int32Ty, size));
params.push_back(module->constantZero);
CallInst::Create(module->llvm_memset_i32, params.begin(),
params.end(), "", currentBlock);
Modified: vmkit/trunk/lib/N3/VMCore/VMCache.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMCache.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMCache.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMCache.cpp Mon Jul 27 12:54:50 2009
@@ -92,7 +92,7 @@
Value* five = module->constantFive;
Value* llvmEnv =
- ConstantExpr::getIntToPtr(llvmFunction->getContext().getConstantInt(Type::Int64Ty, uint64_t (enveloppe)),
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (enveloppe)),
Enveloppe::llvmType);
std::vector<Value*> args1;
Modified: vmkit/trunk/lib/N3/VMCore/VMClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.cpp?rev=77212&r1=77211&r2=77212&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMClass.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMClass.cpp Mon Jul 27 12:54:50 2009
@@ -279,7 +279,7 @@
for (std::vector<VMField*>::iterator i = cl->staticFields.begin(),
e = cl->staticFields.end(); i!= e; ++i) {
// preincrement because 0 is VMObject
- (*i)->offset = vm->getLLVMModule()->getContext().getConstantInt(llvm::Type::Int32Ty, ++offset);
+ (*i)->offset = llvm::ConstantInt::get(llvm::Type::Int32Ty, ++offset);
}
for (std::vector<VMField*>::iterator i = cl->staticFields.begin(),
e = cl->staticFields.end(); i!= e; ++i) {
@@ -329,7 +329,7 @@
uint32 offset = -1;
for (std::vector<VMField*>::iterator i = virtualFields.begin(),
e = virtualFields.end(); i!= e; ++i) {
- (*i)->offset = vm->getLLVMModule()->getContext().getConstantInt(llvm::Type::Int32Ty, ++offset);
+ (*i)->offset = llvm::ConstantInt::get(llvm::Type::Int32Ty, ++offset);
const llvm::Type* type = (*i)->signature->naturalType;
Elts.push_back(type);
}
@@ -343,7 +343,7 @@
uint32 offset = 0;
for (std::vector<VMField*>::iterator i = virtualFields.begin(),
e = virtualFields.end(); i!= e; ++i) {
- (*i)->offset = vm->getLLVMModule()->getContext().getConstantInt(llvm::Type::Int32Ty, ++offset);
+ (*i)->offset = llvm::ConstantInt::get(llvm::Type::Int32Ty, ++offset);
const llvm::Type* type = (*i)->signature->naturalType;
Elts.push_back(type);
}
More information about the vmkit-commits
mailing list