[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.115 - 1.116 --- Log message: Check arguments return types of main(). Abort in case of no match. --- Diffs of the changes: (+32 -0) ExecutionEngine.cpp | 32 1 files changed, 32 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.115 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.116 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.115 Thu May 24 10:03:18 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSun Jun 3 14:17:35 2007 @@ -231,7 +231,39 @@ std::vectorGenericValue GVArgs; GenericValue GVArgc; GVArgc.IntVal = APInt(32, argv.size()); + + // Check main() type unsigned NumArgs = Fn-getFunctionType()-getNumParams(); + const FunctionType *FTy = Fn-getFunctionType(); + const Type* PPInt8Ty = PointerType::get(PointerType::get(Type::Int8Ty)); + switch (NumArgs) { + case 3: + if (FTy-getParamType(2) != PPInt8Ty) { + cerr Invalid type for third argument of main() supplied\n; + abort(); + } + case 2: + if (FTy-getParamType(1) != PPInt8Ty) { + cerr Invalid type for second argument of main() supplied\n; + abort(); + } + case 1: + if (FTy-getParamType(0) != Type::Int32Ty) { + cerr Invalid type for first argument of main() supplied\n; + abort(); + } + case 0: + if (FTy-getReturnType() != Type::Int32Ty + FTy-getReturnType() != Type::VoidTy) { + cerr Invalid return type of main() supplied\n; + abort(); + } + break; + default: + cerr Invalid number of arguments of main() supplied\n; + abort(); + } + if (NumArgs) { GVArgs.push_back(GVArgc); // Arg #0 = argc. if (NumArgs 1) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.116 - 1.117 --- Log message: Add comments to fallsthrough cases. Also, this fixes PR1492: http://llvm.org/PR1492 --- Diffs of the changes: (+3 -0) ExecutionEngine.cpp |3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.116 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.117 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.116 Sun Jun 3 14:17:35 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSun Jun 3 14:20:49 2007 @@ -242,16 +242,19 @@ cerr Invalid type for third argument of main() supplied\n; abort(); } + // FALLS THROUGH case 2: if (FTy-getParamType(1) != PPInt8Ty) { cerr Invalid type for second argument of main() supplied\n; abort(); } + // FALLS THROUGH case 1: if (FTy-getParamType(0) != Type::Int32Ty) { cerr Invalid type for first argument of main() supplied\n; abort(); } + // FALLS THROUGH case 0: if (FTy-getReturnType() != Type::Int32Ty FTy-getReturnType() != Type::VoidTy) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.114 - 1.115 --- Log message: Compute the correct word number. --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.114 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.115 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.114 Mon Mar 12 12:57:00 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu May 24 10:03:18 2007 @@ -573,7 +573,7 @@ } else if (BitWidth = 64) { Result.IntVal = APInt(BitWidth, *((uint64_t*)Ptr)); } else - Result.IntVal = APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); + Result.IntVal = APInt(BitWidth, (BitWidth+63)/64, (uint64_t*)Ptr); break; } case Type::FloatTyID: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.113 - 1.114 --- Log message: Unbreak C++ build. --- Diffs of the changes: (+1 -0) ExecutionEngine.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.113 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.114 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.113 Tue Mar 6 16:23:15 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon Mar 12 12:57:00 2007 @@ -24,6 +24,7 @@ #include llvm/Support/MutexGuard.h #include llvm/System/DynamicLibrary.h #include llvm/Target/TargetData.h +#include math.h using namespace llvm; STATISTIC(NumInitBytes, Number of bytes of global vars initialized); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.110 - 1.111 --- Log message: Simplify things significantly because GenericValue now has a single integer field, of type APInt, instead of multiple integer fields. Also, get rid of the special endianness code in StoreValueToMemory and LoadValueToMemory. ExecutionEngine is always used to execute on the host platform so this is now unnecessary. --- Diffs of the changes: (+72 -281) ExecutionEngine.cpp | 353 ++-- 1 files changed, 72 insertions(+), 281 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.110 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.111 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.110 Sat Mar 3 12:19:18 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon Mar 5 21:04:04 2007 @@ -229,7 +229,7 @@ const char * const * envp) { std::vectorGenericValue GVArgs; GenericValue GVArgc; - GVArgc.Int32Val = argv.size(); + GVArgc.IntVal = APInt(32, argv.size()); unsigned NumArgs = Fn-getFunctionType()-getNumParams(); if (NumArgs) { GVArgs.push_back(GVArgc); // Arg #0 = argc. @@ -245,7 +245,7 @@ } } } - return runFunction(Fn, GVArgs).Int32Val; + return runFunction(Fn, GVArgs).IntVal.getZExtValue(); } /// If possible, create a JIT, unless the caller specifically requests an @@ -298,28 +298,6 @@ return state.getGlobalAddressMap(locked)[GV]; } -/// This macro is used to handle a variety of situations involing integer -/// values where the action should be done to one of the GenericValue members. -/// THEINTTY is a const Type * for the integer type. ACTION1 comes before -/// the GenericValue, ACTION2 comes after. -#define DO_FOR_INTEGER(THEINTTY, ACTION) \ - { \ - unsigned BitWidth = castIntegerType(THEINTTY)-getBitWidth(); \ - if (BitWidth == 1) {\ -ACTION(Int1Val); \ - } else if (BitWidth = 8) {\ -ACTION(Int8Val); \ - } else if (BitWidth = 16) {\ -ACTION(Int16Val); \ - } else if (BitWidth = 32) { \ -ACTION(Int32Val); \ - } else if (BitWidth = 64) { \ -ACTION(Int64Val); \ - } else {\ -assert(0 Not implemented: integer types 64 bits); \ - } \ - } - /// This function converts a Constant* into a GenericValue. The interesting /// part is if C is a ConstantExpr. /// @brief Get a GenericValue for a Constnat* @@ -341,10 +319,8 @@ TD-getIndexedOffset(CE-getOperand(0)-getType(), Indices[0], Indices.size()); - if (getTargetData()-getPointerSize() == 4) -Result.Int32Val += Offset; - else -Result.Int64Val += Offset; + char* tmp = (char*) Result.PointerVal; + Result = PTOGV(tmp + Offset); return Result; } case Instruction::Trunc: @@ -375,21 +351,15 @@ // IntToPtr casts are just so special. Cast to intptr_t first. Constant *Op = CE-getOperand(0); GenericValue GV = getConstantValue(Op); -#define INT_TO_PTR_ACTION(FIELD) \ -return PTOGV((void*)(uintptr_t)GV.FIELD) - DO_FOR_INTEGER(Op-getType(), INT_TO_PTR_ACTION) -#undef INT_TO_PTR_ACTION + return PTOGV((void*)(uintptr_t)GV.IntVal.getZExtValue()); break; } case Instruction::Add: switch (CE-getOperand(0)-getType()-getTypeID()) { default: assert(0 Bad add type!); abort(); case Type::IntegerTyID: -#define ADD_ACTION(FIELD) \ -Result.FIELD = getConstantValue(CE-getOperand(0)).FIELD + \ - getConstantValue(CE-getOperand(1)).FIELD; -DO_FOR_INTEGER(CE-getOperand(0)-getType(),ADD_ACTION); -#undef ADD_ACTION +Result.IntVal = getConstantValue(CE-getOperand(0)).IntVal + \ +getConstantValue(CE-getOperand(1)).IntVal; break; case Type::FloatTyID: Result.FloatVal = getConstantValue(CE-getOperand(0)).FloatVal + @@ -409,28 +379,15 @@ } switch (C-getType()-getTypeID()) { -#define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ - case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break -GET_CONST_VAL(Float , float , ConstantFP, getValue); -GET_CONST_VAL(Double, double, ConstantFP, getValue); -#undef GET_CONST_VAL - case Type::IntegerTyID: { -unsigned BitWidth = castIntegerType(C-getType())-getBitWidth(); -if (BitWidth == 1) - Result.Int1Val = (bool)castConstantInt(C)-getZExtValue(); -else if (BitWidth = 8) - Result.Int8Val = (uint8_t )castConstantInt(C)-getZExtValue(); -else if (BitWidth = 16) - Result.Int16Val = (uint16_t )castConstantInt(C)-getZExtValue(); -else if (BitWidth = 32) - Result.Int32Val = (uint32_t )castConstantInt(C)-getZExtValue(); -else if (BitWidth = 64) - Result.Int64Val = (uint64_t
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.111 - 1.112 --- Log message: 1. Make StoreValueToMemory a little more efficient by not requiring caller to make a copy of the GenericValue. 2. Fix a copy paste bug in StoreValueToMemory where 64-bit values were truncated to 32 --- Diffs of the changes: (+2 -2) ExecutionEngine.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.111 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.112 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.111 Mon Mar 5 21:04:04 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon Mar 5 23:03:16 2007 @@ -410,7 +410,7 @@ /// It is not a pointer to a GenericValue containing the address at which to /// store Val. /// -void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, +void ExecutionEngine::StoreValueToMemory(const GenericValue Val, GenericValue *Ptr, const Type *Ty) { switch (Ty-getTypeID()) { case Type::IntegerTyID: { @@ -423,7 +423,7 @@ } else if (BitWidth = 32) { *((uint32_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue()); } else if (BitWidth = 64) { - *((uint64_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue()); + *((uint64_t*)Ptr) = uint64_t(Val.IntVal.getZExtValue()); } else { uint64_t *Dest = (uint64_t*)Ptr; const uint64_t *Src = Val.IntVal.getRawData(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.108 - 1.109 --- Log message: Avoid memory leakage by having caller construct the APInt for the destination value of LoadValueFromMemory. --- Diffs of the changes: (+4 -5) ExecutionEngine.cpp |9 - 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.108 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.109 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.108 Sat Mar 3 00:18:03 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Mar 3 02:36:29 2007 @@ -578,9 +578,9 @@ /// FIXME: document /// -GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, +void ExecutionEngine::LoadValueFromMemory(GenericValue Result, + GenericValue *Ptr, const Type *Ty) { - GenericValue Result; if (getTargetData()-isLittleEndian()) { switch (Ty-getTypeID()) { case Type::IntegerTyID: { @@ -605,7 +605,7 @@ ((uint64_t)Ptr-Untyped[6] 48) | ((uint64_t)Ptr-Untyped[7] 56); } else -Result.APIntVal = new APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); +*(Result.APIntVal) = APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); break; } Load4BytesLittleEndian: @@ -657,7 +657,7 @@ ((uint64_t)Ptr-Untyped[1] 48) | ((uint64_t)Ptr-Untyped[0] 56); } else -Result.APIntVal = new APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); +*(Result.APIntVal) = APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); break; } Load4BytesBigEndian: @@ -686,7 +686,6 @@ abort(); } } - return Result; } // InitializeMemory - Recursive function to apply a Constant value into the ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.109 - 1.110 --- Log message: Deal with error handling better. --- Diffs of the changes: (+5 -3) ExecutionEngine.cpp |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.109 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.110 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.109 Sat Mar 3 02:36:29 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Mar 3 12:19:18 2007 @@ -45,6 +45,7 @@ } ExecutionEngine::~ExecutionEngine() { + clearAllGlobalMappings(); for (unsigned i = 0, e = Modules.size(); i != e; ++i) delete Modules[i]; } @@ -252,16 +253,17 @@ /// NULL is returned. /// ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP, - bool ForceInterpreter) { + bool ForceInterpreter, + std::string *ErrorStr) { ExecutionEngine *EE = 0; // Unless the interpreter was explicitly selected, try making a JIT. if (!ForceInterpreter JITCtor) -EE = JITCtor(MP); +EE = JITCtor(MP, ErrorStr); // If we can't make a JIT, make an interpreter instead. if (EE == 0 InterpCtor) -EE = InterpCtor(MP); +EE = InterpCtor(MP, ErrorStr); if (EE) { // Make sure we can resolve symbols in the program as well. The zero arg ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.107 - 1.108 --- Log message: Implement loading and storing of APInt values from memory. --- Diffs of the changes: (+16 -8) ExecutionEngine.cpp | 24 1 files changed, 16 insertions(+), 8 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.107 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.108 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.107 Wed Feb 14 20:26:10 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Mar 3 00:18:03 2007 @@ -425,7 +425,7 @@ else if (BitWidth = 64) Result.Int64Val = (uint64_t )castConstantInt(C)-getZExtValue(); else - assert(0 Integers with 64-bits not implemented); + Result.APIntVal = const_castAPInt*(castConstantInt(C)-getValue()); break; } @@ -481,8 +481,12 @@ Ptr-Untyped[5] = (unsigned char)(TmpVal.Int64Val 40); Ptr-Untyped[6] = (unsigned char)(TmpVal.Int64Val 48); Ptr-Untyped[7] = (unsigned char)(TmpVal.Int64Val 56); - } else -assert(0 Integer types 64 bits not supported); + } else { +uint64_t *Dest = (uint64_t*)Ptr; +const uint64_t *Src = Val.APIntVal-getRawData(); +for (uint32_t i = 0; i Val.APIntVal-getNumWords(); ++i) + Dest[i] = Src[i]; + } break; } Store4BytesLittleEndian: @@ -537,8 +541,12 @@ Ptr-Untyped[2] = (unsigned char)(TmpVal.Int64Val 40); Ptr-Untyped[1] = (unsigned char)(TmpVal.Int64Val 48); Ptr-Untyped[0] = (unsigned char)(TmpVal.Int64Val 56); - } else -assert(0 Integer types 64 bits not supported); + } else { +uint64_t *Dest = (uint64_t*)Ptr; +const uint64_t *Src = Val.APIntVal-getRawData(); +for (uint32_t i = 0; i Val.APIntVal-getNumWords(); ++i) + Dest[i] = Src[i]; + } break; } Store4BytesBigEndian: @@ -597,7 +605,7 @@ ((uint64_t)Ptr-Untyped[6] 48) | ((uint64_t)Ptr-Untyped[7] 56); } else -assert(0 Integer types 64 bits not supported); +Result.APIntVal = new APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); break; } Load4BytesLittleEndian: @@ -628,7 +636,7 @@ } else { switch (Ty-getTypeID()) { case Type::IntegerTyID: { - unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); + uint32_t BitWidth = castIntegerType(Ty)-getBitWidth(); if (BitWidth = 8) Result.Int8Val = Ptr-Untyped[0]; else if (BitWidth = 16) { @@ -649,7 +657,7 @@ ((uint64_t)Ptr-Untyped[1] 48) | ((uint64_t)Ptr-Untyped[0] 56); } else -assert(0 Integer types 64 bits not supported); +Result.APIntVal = new APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr); break; } Load4BytesBigEndian: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.106 - 1.107 --- Log message: For PR1195: http://llvm.org/PR1195 : Rename PackedType - VectorType, ConstantPacked - ConstantVector, and PackedTyID - VectorTyID. No functional changes. --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.106 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.107 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.106 Wed Feb 14 00:20:04 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Feb 14 20:26:10 2007 @@ -687,7 +687,7 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { if (isaUndefValue(Init)) { return; - } else if (const ConstantPacked *CP = dyn_castConstantPacked(Init)) { + } else if (const ConstantVector *CP = dyn_castConstantVector(Init)) { unsigned ElementSize = getTargetData()-getTypeSize(CP-getType()-getElementType()); for (unsigned i = 0, e = CP-getNumOperands(); i != e; ++i) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.105 - 1.106 --- Log message: From Dan Gohman: While preparing http://llvm.org/PR1198: http://llvm.org/PR1198 I noticed several asserts protecting unprepared code from i128 types that weren't actually failing when they should because they were written as assert(foo) instead of something like assert(0 foo). This patch fixes all the cases that a quick grep found. --- Diffs of the changes: (+2 -2) ExecutionEngine.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.105 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.106 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.105 Sat Feb 10 14:35:22 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Feb 14 00:20:04 2007 @@ -292,7 +292,7 @@ const_castGlobalVariable *(dyn_castGlobalVariable(GV))) EmitGlobalVariable(GVar); else -assert(Global hasn't had an address allocated yet!); +assert(0 Global hasn't had an address allocated yet!); return state.getGlobalAddressMap(locked)[GV]; } @@ -425,7 +425,7 @@ else if (BitWidth = 64) Result.Int64Val = (uint64_t )castConstantInt(C)-getZExtValue(); else - assert(Integers with 64-bits not implemented); + assert(0 Integers with 64-bits not implemented); break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.103 - 1.104 --- Log message: Privatize StructLayout::MemberOffsets, adding an accessor --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.103 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.104 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.103 Mon Feb 5 15:19:13 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Feb 10 13:55:17 2007 @@ -716,7 +716,7 @@ const StructLayout *SL = getTargetData()-getStructLayout(castStructType(CPS-getType())); for (unsigned i = 0, e = CPS-getNumOperands(); i != e; ++i) - InitializeMemory(CPS-getOperand(i), (char*)Addr+SL-MemberOffsets[i]); + InitializeMemory(CPS-getOperand(i), (char*)Addr+SL-getElementOffset(i)); return; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.104 - 1.105 --- Log message: eliminate use of TargetData::getIndexedOffset that takes a vector --- Diffs of the changes: (+3 -2) ExecutionEngine.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.104 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.105 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.104 Sat Feb 10 13:55:17 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Feb 10 14:35:22 2007 @@ -334,9 +334,10 @@ case Instruction::GetElementPtr: { // Compute the index Result = getConstantValue(CE-getOperand(0)); - std::vectorValue* Indexes(CE-op_begin()+1, CE-op_end()); + SmallVectorValue*, 8 Indices(CE-op_begin()+1, CE-op_end()); uint64_t Offset = -TD-getIndexedOffset(CE-getOperand(0)-getType(), Indexes); +TD-getIndexedOffset(CE-getOperand(0)-getType(), + Indices[0], Indices.size()); if (getTargetData()-getPointerSize() == 4) Result.Int32Val += Offset; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.101 - 1.102 --- Log message: For PR1136: http://llvm.org/PR1136 : Rename GlobalVariable::isExternal as isDeclaration to avoid confusion with external linkage types. --- Diffs of the changes: (+4 -4) ExecutionEngine.cpp |8 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.101 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.102 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.101 Fri Jan 19 15:13:56 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppTue Jan 30 14:08:37 2007 @@ -194,7 +194,7 @@ // an old-style (llvmgcc3) static ctor with __main linked in and in use. If // this is the case, don't execute any of the global ctors, __main will do // it. -if (!GV || GV-isExternal() || GV-hasInternalLinkage()) continue; +if (!GV || GV-isDeclaration() || GV-hasInternalLinkage()) continue; // Should be an array of '{ int, void ()* }' structs. The first value is // the init priority, which we ignore. @@ -746,7 +746,7 @@ for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { const GlobalValue *GV = I; -if (GV-hasInternalLinkage() || GV-isExternal() || +if (GV-hasInternalLinkage() || GV-isDeclaration() || GV-hasAppendingLinkage() || !GV-hasName()) continue;// Ignore external globals and globals with internal linkage. @@ -791,7 +791,7 @@ } } - if (!I-isExternal()) { + if (!I-isDeclaration()) { // Get the type of the global. const Type *Ty = I-getType()-getElementType(); @@ -829,7 +829,7 @@ // and initialize their contents. for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { - if (!I-isExternal()) { + if (!I-isDeclaration()) { if (!LinkedGlobalsMap.empty()) { if (const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair(I-getName(), I-getType())]) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.100 - 1.101 --- Log message: For PR1043: http://llvm.org/PR1043 : This is the final patch for this PR. It implements some minor cleanup in the use of IntegerType, to wit: 1. Type::getIntegerTypeMask - IntegerType::getBitMask 2. Type::Int*Ty changed to IntegerType* from Type* 3. ConstantInt::getType() returns IntegerType* now, not Type* This also fixes PR1120: http://llvm.org/PR1120 . Patch by Sheng Zhou. --- Diffs of the changes: (+2 -6) ExecutionEngine.cpp |8 ++-- 1 files changed, 2 insertions(+), 6 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.100 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.101 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.100 Thu Jan 18 12:01:32 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppFri Jan 19 15:13:56 2007 @@ -456,9 +456,7 @@ switch (Ty-getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); - uint64_t BitMask = (1ull BitWidth) - 1; - if (BitWidth = 64) -BitMask = (uint64_t)-1; + uint64_t BitMask = castIntegerType(Ty)-getBitMask(); GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; @@ -514,9 +512,7 @@ switch (Ty-getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); - uint64_t BitMask = (1ull BitWidth) - 1; - if (BitWidth = 64) -BitMask = (uint64_t)-1; + uint64_t BitMask = castIntegerType(Ty)-getBitMask(); GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.99 - 1.100 --- Log message: Fix a regression in the last patch. When constructing a BitMask, be careful not to overflow 64-bits and end up with a 0 mask. This caused i64 values to always be stored as 0 with lots of consequential damage to nightly test. --- Diffs of the changes: (+4 -0) ExecutionEngine.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.100 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 Wed Jan 17 19:24:02 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Jan 18 12:01:32 2007 @@ -457,6 +457,8 @@ case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); uint64_t BitMask = (1ull BitWidth) - 1; + if (BitWidth = 64) +BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; @@ -513,6 +515,8 @@ case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); uint64_t BitMask = (1ull BitWidth) - 1; + if (BitWidth = 64) +BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Please just use uint64_t BitMask = Ty-getIntegerTypeMask(); Thanks, -Chris On Jan 18, 2007, at 10:01 AM, Reid Spencer wrote: Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.99 - 1.100 --- Log message: Fix a regression in the last patch. When constructing a BitMask, be careful not to overflow 64-bits and end up with a 0 mask. This caused i64 values to always be stored as 0 with lots of consequential damage to nightly test. --- Diffs of the changes: (+4 -0) ExecutionEngine.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 llvm/lib/ ExecutionEngine/ExecutionEngine.cpp:1.100 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 Wed Jan 17 19:24:02 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Thu Jan 18 12:01:32 2007 @@ -457,6 +457,8 @@ case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); uint64_t BitMask = (1ull BitWidth) - 1; + if (BitWidth = 64) +BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; @@ -513,6 +515,8 @@ case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); uint64_t BitMask = (1ull BitWidth) - 1; + if (BitWidth = 64) +BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
On Thu, 2007-01-18 at 13:49 -0800, Chris Lattner wrote: Please just use uint64_t BitMask = Ty-getIntegerTypeMask(); Good idea. This is changing to IntegerType::getBitMask(). I'm testing that set of changes now and I'll include this fix to ExecutionEngine when its time to commit. Thanks, Reid. Thanks, -Chris On Jan 18, 2007, at 10:01 AM, Reid Spencer wrote: Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.99 - 1.100 --- Log message: Fix a regression in the last patch. When constructing a BitMask, be careful not to overflow 64-bits and end up with a 0 mask. This caused i64 values to always be stored as 0 with lots of consequential damage to nightly test. --- Diffs of the changes: (+4 -0) ExecutionEngine.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 llvm/lib/ ExecutionEngine/ExecutionEngine.cpp:1.100 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 Wed Jan 17 19:24:02 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Jan 18 12:01:32 2007 @@ -457,6 +457,8 @@ case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); uint64_t BitMask = (1ull BitWidth) - 1; + if (BitWidth = 64) +BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; @@ -513,6 +515,8 @@ case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); uint64_t BitMask = (1ull BitWidth) - 1; + if (BitWidth = 64) +BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth = 8) Ptr-Untyped[0] = Val.Int8Val BitMask; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.98 - 1.99 --- Log message: Make sure we truncate stored values to their bit width. --- Diffs of the changes: (+40 -30) ExecutionEngine.cpp | 70 +--- 1 files changed, 40 insertions(+), 30 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.98 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.98 Fri Jan 12 01:05:13 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Jan 17 19:24:02 2007 @@ -456,25 +456,30 @@ switch (Ty-getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); + uint64_t BitMask = (1ull BitWidth) - 1; + GenericValue TmpVal = Val; if (BitWidth = 8) -Ptr-Untyped[0] = Val.Int8Val; +Ptr-Untyped[0] = Val.Int8Val BitMask; else if (BitWidth = 16) { -Ptr-Untyped[0] = Val.Int16Val 255; -Ptr-Untyped[1] = (Val.Int16Val 8) 255; +TmpVal.Int16Val = BitMask; +Ptr-Untyped[0] = TmpVal.Int16Val 255; +Ptr-Untyped[1] = (TmpVal.Int16Val 8) 255; } else if (BitWidth = 32) { -Ptr-Untyped[0] = Val.Int32Val 255; -Ptr-Untyped[1] = (Val.Int32Val 8) 255; -Ptr-Untyped[2] = (Val.Int32Val 16) 255; -Ptr-Untyped[3] = (Val.Int32Val 24) 255; +TmpVal.Int32Val = BitMask; +Ptr-Untyped[0] = TmpVal.Int32Val 255; +Ptr-Untyped[1] = (TmpVal.Int32Val 8) 255; +Ptr-Untyped[2] = (TmpVal.Int32Val 16) 255; +Ptr-Untyped[3] = (TmpVal.Int32Val 24) 255; } else if (BitWidth = 64) { -Ptr-Untyped[0] = (unsigned char)(Val.Int64Val ); -Ptr-Untyped[1] = (unsigned char)(Val.Int64Val 8); -Ptr-Untyped[2] = (unsigned char)(Val.Int64Val 16); -Ptr-Untyped[3] = (unsigned char)(Val.Int64Val 24); -Ptr-Untyped[4] = (unsigned char)(Val.Int64Val 32); -Ptr-Untyped[5] = (unsigned char)(Val.Int64Val 40); -Ptr-Untyped[6] = (unsigned char)(Val.Int64Val 48); -Ptr-Untyped[7] = (unsigned char)(Val.Int64Val 56); +TmpVal.Int64Val = BitMask; +Ptr-Untyped[0] = (unsigned char)(TmpVal.Int64Val ); +Ptr-Untyped[1] = (unsigned char)(TmpVal.Int64Val 8); +Ptr-Untyped[2] = (unsigned char)(TmpVal.Int64Val 16); +Ptr-Untyped[3] = (unsigned char)(TmpVal.Int64Val 24); +Ptr-Untyped[4] = (unsigned char)(TmpVal.Int64Val 32); +Ptr-Untyped[5] = (unsigned char)(TmpVal.Int64Val 40); +Ptr-Untyped[6] = (unsigned char)(TmpVal.Int64Val 48); +Ptr-Untyped[7] = (unsigned char)(TmpVal.Int64Val 56); } else assert(0 Integer types 64 bits not supported); break; @@ -507,25 +512,30 @@ switch (Ty-getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = castIntegerType(Ty)-getBitWidth(); + uint64_t BitMask = (1ull BitWidth) - 1; + GenericValue TmpVal = Val; if (BitWidth = 8) -Ptr-Untyped[0] = Val.Int8Val; +Ptr-Untyped[0] = Val.Int8Val BitMask; else if (BitWidth = 16) { -Ptr-Untyped[1] = Val.Int16Val255; -Ptr-Untyped[0] = (Val.Int16Val 8) 255; +TmpVal.Int16Val = BitMask; +Ptr-Untyped[1] = TmpVal.Int16Val255; +Ptr-Untyped[0] = (TmpVal.Int16Val 8) 255; } else if (BitWidth = 32) { -Ptr-Untyped[3] = Val.Int32Val 255; -Ptr-Untyped[2] = (Val.Int32Val 8) 255; -Ptr-Untyped[1] = (Val.Int32Val 16) 255; -Ptr-Untyped[0] = (Val.Int32Val 24) 255; +TmpVal.Int32Val = BitMask; +Ptr-Untyped[3] = TmpVal.Int32Val 255; +Ptr-Untyped[2] = (TmpVal.Int32Val 8) 255; +Ptr-Untyped[1] = (TmpVal.Int32Val 16) 255; +Ptr-Untyped[0] = (TmpVal.Int32Val 24) 255; } else if (BitWidth = 64) { -Ptr-Untyped[7] = (unsigned char)(Val.Int64Val ); -Ptr-Untyped[6] = (unsigned char)(Val.Int64Val 8); -Ptr-Untyped[5] = (unsigned char)(Val.Int64Val 16); -Ptr-Untyped[4] = (unsigned char)(Val.Int64Val 24); -Ptr-Untyped[3] = (unsigned char)(Val.Int64Val 32); -Ptr-Untyped[2] = (unsigned char)(Val.Int64Val 40); -Ptr-Untyped[1] = (unsigned char)(Val.Int64Val 48); -Ptr-Untyped[0] = (unsigned char)(Val.Int64Val 56); +TmpVal.Int64Val = BitMask; +Ptr-Untyped[7] = (unsigned char)(TmpVal.Int64Val ); +Ptr-Untyped[6] = (unsigned char)(TmpVal.Int64Val 8); +Ptr-Untyped[5] = (unsigned char)(TmpVal.Int64Val 16); +Ptr-Untyped[4] = (unsigned char)(TmpVal.Int64Val 24); +Ptr-Untyped[3] = (unsigned char)(TmpVal.Int64Val 32); +Ptr-Untyped[2] = (unsigned char)(TmpVal.Int64Val 40);
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.94 - 1.95 --- Log message: For PR1043: http://llvm.org/PR1043 : Merge ConstantIntegral and ConstantBool into ConstantInt. Remove ConstantIntegral and ConstantBool from LLVM. --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.94 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.95 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.94 Sat Dec 30 23:51:35 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Jan 11 06:24:14 2007 @@ -399,7 +399,7 @@ switch (C-getType()-getTypeID()) { #define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break -GET_CONST_VAL(Bool , bool , ConstantBool, getValue); +GET_CONST_VAL(Bool , bool , ConstantInt, getBoolValue); GET_CONST_VAL(Int8 , unsigned char , ConstantInt, getZExtValue); GET_CONST_VAL(Int16 , unsigned short, ConstantInt, getZExtValue); GET_CONST_VAL(Int32 , unsigned int , ConstantInt, getZExtValue); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.95 - 1.96 --- Log message: Rename BoolTy as Int1Ty. Patch by Sheng Zhou. --- Diffs of the changes: (+6 -6) ExecutionEngine.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.95 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.96 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.95 Thu Jan 11 06:24:14 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Jan 11 12:21:29 2007 @@ -351,7 +351,7 @@ Constant *Op = CE-getOperand(0); GenericValue GV = getConstantValue(Op); switch (Op-getType()-getTypeID()) { -case Type::BoolTyID:return PTOGV((void*)(uintptr_t)GV.BoolVal); +case Type::Int1TyID:return PTOGV((void*)(uintptr_t)GV.Int1Val); case Type::Int8TyID: return PTOGV((void*)(uintptr_t)GV.Int8Val); case Type::Int16TyID: return PTOGV((void*)(uintptr_t)GV.Int16Val); case Type::Int32TyID:return PTOGV((void*)(uintptr_t)GV.Int32Val); @@ -399,7 +399,7 @@ switch (C-getType()-getTypeID()) { #define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break -GET_CONST_VAL(Bool , bool , ConstantInt, getBoolValue); +GET_CONST_VAL(Int1 , bool , ConstantInt, getBoolValue); GET_CONST_VAL(Int8 , unsigned char , ConstantInt, getZExtValue); GET_CONST_VAL(Int16 , unsigned short, ConstantInt, getZExtValue); GET_CONST_VAL(Int32 , unsigned int , ConstantInt, getZExtValue); @@ -433,7 +433,7 @@ const Type *Ty) { if (getTargetData()-isLittleEndian()) { switch (Ty-getTypeID()) { -case Type::BoolTyID: +case Type::Int1TyID: case Type::Int8TyID:Ptr-Untyped[0] = Val.Int8Val; break; case Type::Int16TyID: Ptr-Untyped[0] = Val.Int16Val 255; Ptr-Untyped[1] = (Val.Int16Val 8) 255; @@ -463,7 +463,7 @@ } } else { switch (Ty-getTypeID()) { -case Type::BoolTyID: +case Type::Int1TyID: case Type::Int8TyID:Ptr-Untyped[0] = Val.Int8Val; break; case Type::Int16TyID: Ptr-Untyped[1] = Val.Int16Val 255; Ptr-Untyped[0] = (Val.Int16Val 8) 255; @@ -501,7 +501,7 @@ GenericValue Result; if (getTargetData()-isLittleEndian()) { switch (Ty-getTypeID()) { -case Type::BoolTyID: +case Type::Int1TyID: case Type::Int8TyID:Result.Int8Val = Ptr-Untyped[0]; break; case Type::Int16TyID: Result.Int16Val = (unsigned)Ptr-Untyped[0] | ((unsigned)Ptr-Untyped[1] 8); @@ -531,7 +531,7 @@ } } else { switch (Ty-getTypeID()) { -case Type::BoolTyID: +case Type::Int1TyID: case Type::Int8TyID:Result.Int8Val = Ptr-Untyped[0]; break; case Type::Int16TyID: Result.Int16Val = (unsigned)Ptr-Untyped[1] | ((unsigned)Ptr-Untyped[0] 8); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.96 - 1.97 --- Log message: Implement review feedback for the ConstantBool-ConstantInt merge. Chris recommended that getBoolValue be replaced with getZExtValue and that get(bool) be replaced by get(const Type*, uint64_t). This implements those changes. --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.96 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.97 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.96 Thu Jan 11 12:21:29 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Jan 11 22:24:45 2007 @@ -399,7 +399,7 @@ switch (C-getType()-getTypeID()) { #define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break -GET_CONST_VAL(Int1 , bool , ConstantInt, getBoolValue); +GET_CONST_VAL(Int1 , bool , ConstantInt, getZExtValue); GET_CONST_VAL(Int8 , unsigned char , ConstantInt, getZExtValue); GET_CONST_VAL(Int16 , unsigned short, ConstantInt, getZExtValue); GET_CONST_VAL(Int32 , unsigned int , ConstantInt, getZExtValue); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.97 - 1.98 --- Log message: For PR1064: http://llvm.org/PR1064 : Implement the arbitrary bit-width integer feature. The feature allows integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 16, 32, and 64 bit integers. This change does several things: 1. Introduces a new Derived Type, IntegerType, to represent the number of bits in an integer. The Type classes SubclassData field is used to store the number of bits. This allows 2^23 bits in an integer type. 2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and 64-bit integers. These are replaced with just IntegerType which is not a primitive any more. 3. Adjust the rest of LLVM to account for this change. Note that while this incremental change lays the foundation for arbitrary bit-width integers, LLVM has not yet been converted to actually deal with them in any significant way. Most optimization passes, for example, will still only deal with the byte-width integer types. Future increments will rectify this situation. --- Diffs of the changes: (+205 -98) ExecutionEngine.cpp | 303 +++- 1 files changed, 205 insertions(+), 98 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.97 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.98 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.97 Thu Jan 11 22:24:45 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppFri Jan 12 01:05:13 2007 @@ -296,6 +296,28 @@ return state.getGlobalAddressMap(locked)[GV]; } +/// This macro is used to handle a variety of situations involing integer +/// values where the action should be done to one of the GenericValue members. +/// THEINTTY is a const Type * for the integer type. ACTION1 comes before +/// the GenericValue, ACTION2 comes after. +#define DO_FOR_INTEGER(THEINTTY, ACTION) \ + { \ + unsigned BitWidth = castIntegerType(THEINTTY)-getBitWidth(); \ + if (BitWidth == 1) {\ +ACTION(Int1Val); \ + } else if (BitWidth = 8) {\ +ACTION(Int8Val); \ + } else if (BitWidth = 16) {\ +ACTION(Int16Val); \ + } else if (BitWidth = 32) { \ +ACTION(Int32Val); \ + } else if (BitWidth = 64) { \ +ACTION(Int64Val); \ + } else {\ +assert(0 Not implemented: integer types 64 bits); \ + } \ + } + /// This function converts a Constant* into a GenericValue. The interesting /// part is if C is a ConstantExpr. /// @brief Get a GenericValue for a Constnat* @@ -350,34 +372,21 @@ // IntToPtr casts are just so special. Cast to intptr_t first. Constant *Op = CE-getOperand(0); GenericValue GV = getConstantValue(Op); - switch (Op-getType()-getTypeID()) { -case Type::Int1TyID:return PTOGV((void*)(uintptr_t)GV.Int1Val); -case Type::Int8TyID: return PTOGV((void*)(uintptr_t)GV.Int8Val); -case Type::Int16TyID: return PTOGV((void*)(uintptr_t)GV.Int16Val); -case Type::Int32TyID:return PTOGV((void*)(uintptr_t)GV.Int32Val); -case Type::Int64TyID: return PTOGV((void*)(uintptr_t)GV.Int64Val); -default: assert(0 Unknown integral type!); - } +#define INT_TO_PTR_ACTION(FIELD) \ +return PTOGV((void*)(uintptr_t)GV.FIELD) + DO_FOR_INTEGER(Op-getType(), INT_TO_PTR_ACTION) +#undef INT_TO_PTR_ACTION break; } case Instruction::Add: switch (CE-getOperand(0)-getType()-getTypeID()) { default: assert(0 Bad add type!); abort(); - case Type::Int64TyID: -Result.Int64Val = getConstantValue(CE-getOperand(0)).Int64Val + - getConstantValue(CE-getOperand(1)).Int64Val; -break; - case Type::Int32TyID: -Result.Int32Val = getConstantValue(CE-getOperand(0)).Int32Val + -getConstantValue(CE-getOperand(1)).Int32Val; -break; - case Type::Int16TyID: -Result.Int16Val = getConstantValue(CE-getOperand(0)).Int16Val + - getConstantValue(CE-getOperand(1)).Int16Val; -break; - case Type::Int8TyID: -Result.Int8Val = getConstantValue(CE-getOperand(0)).Int8Val + - getConstantValue(CE-getOperand(1)).Int8Val; + case Type::IntegerTyID: +#define ADD_ACTION(FIELD) \ +Result.FIELD = getConstantValue(CE-getOperand(0)).FIELD + \ + getConstantValue(CE-getOperand(1)).FIELD; +DO_FOR_INTEGER(CE-getOperand(0)-getType(),ADD_ACTION); +#undef ADD_ACTION break; case Type::FloatTyID: Result.FloatVal = getConstantValue(CE-getOperand(0)).FloatVal + @@ -399,14 +408,26 @@ switch (C-getType()-getTypeID()) { #define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break -
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.93 - 1.94 --- Log message: For PR950: http://llvm.org/PR950 : Convert signed integer types to signless ones. --- Diffs of the changes: (+69 -97) ExecutionEngine.cpp | 166 +--- 1 files changed, 69 insertions(+), 97 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.93 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.94 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.93 Tue Dec 19 16:43:32 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Dec 30 23:51:35 2006 @@ -157,7 +157,7 @@ char *Result = new char[(InputArgv.size()+1)*PtrSize]; DOUT ARGV = (void*)Result \n; - const Type *SBytePtr = PointerType::get(Type::SByteTy); + const Type *SBytePtr = PointerType::get(Type::Int8Ty); for (unsigned i = 0; i != InputArgv.size(); ++i) { unsigned Size = InputArgv[i].size()+1; @@ -228,7 +228,7 @@ const char * const * envp) { std::vectorGenericValue GVArgs; GenericValue GVArgc; - GVArgc.IntVal = argv.size(); + GVArgc.Int32Val = argv.size(); unsigned NumArgs = Fn-getFunctionType()-getNumParams(); if (NumArgs) { GVArgs.push_back(GVArgc); // Arg #0 = argc. @@ -244,7 +244,7 @@ } } } - return runFunction(Fn, GVArgs).IntVal; + return runFunction(Fn, GVArgs).Int32Val; } /// If possible, create a JIT, unless the caller specifically requests an @@ -317,9 +317,9 @@ TD-getIndexedOffset(CE-getOperand(0)-getType(), Indexes); if (getTargetData()-getPointerSize() == 4) -Result.IntVal += Offset; +Result.Int32Val += Offset; else -Result.LongVal += Offset; +Result.Int64Val += Offset; return Result; } case Instruction::Trunc: @@ -352,14 +352,10 @@ GenericValue GV = getConstantValue(Op); switch (Op-getType()-getTypeID()) { case Type::BoolTyID:return PTOGV((void*)(uintptr_t)GV.BoolVal); -case Type::SByteTyID: return PTOGV((void*)( intptr_t)GV.SByteVal); -case Type::UByteTyID: return PTOGV((void*)(uintptr_t)GV.UByteVal); -case Type::ShortTyID: return PTOGV((void*)( intptr_t)GV.ShortVal); -case Type::UShortTyID: return PTOGV((void*)(uintptr_t)GV.UShortVal); -case Type::IntTyID: return PTOGV((void*)( intptr_t)GV.IntVal); -case Type::UIntTyID:return PTOGV((void*)(uintptr_t)GV.UIntVal); -case Type::LongTyID:return PTOGV((void*)( intptr_t)GV.LongVal); -case Type::ULongTyID: return PTOGV((void*)(uintptr_t)GV.ULongVal); +case Type::Int8TyID: return PTOGV((void*)(uintptr_t)GV.Int8Val); +case Type::Int16TyID: return PTOGV((void*)(uintptr_t)GV.Int16Val); +case Type::Int32TyID:return PTOGV((void*)(uintptr_t)GV.Int32Val); +case Type::Int64TyID: return PTOGV((void*)(uintptr_t)GV.Int64Val); default: assert(0 Unknown integral type!); } break; @@ -367,25 +363,21 @@ case Instruction::Add: switch (CE-getOperand(0)-getType()-getTypeID()) { default: assert(0 Bad add type!); abort(); - case Type::LongTyID: - case Type::ULongTyID: -Result.LongVal = getConstantValue(CE-getOperand(0)).LongVal + - getConstantValue(CE-getOperand(1)).LongVal; + case Type::Int64TyID: +Result.Int64Val = getConstantValue(CE-getOperand(0)).Int64Val + + getConstantValue(CE-getOperand(1)).Int64Val; break; - case Type::IntTyID: - case Type::UIntTyID: -Result.IntVal = getConstantValue(CE-getOperand(0)).IntVal + -getConstantValue(CE-getOperand(1)).IntVal; + case Type::Int32TyID: +Result.Int32Val = getConstantValue(CE-getOperand(0)).Int32Val + +getConstantValue(CE-getOperand(1)).Int32Val; break; - case Type::ShortTyID: - case Type::UShortTyID: -Result.ShortVal = getConstantValue(CE-getOperand(0)).ShortVal + - getConstantValue(CE-getOperand(1)).ShortVal; + case Type::Int16TyID: +Result.Int16Val = getConstantValue(CE-getOperand(0)).Int16Val + + getConstantValue(CE-getOperand(1)).Int16Val; break; - case Type::SByteTyID: - case Type::UByteTyID: -Result.SByteVal = getConstantValue(CE-getOperand(0)).SByteVal + - getConstantValue(CE-getOperand(1)).SByteVal; + case Type::Int8TyID: +Result.Int8Val = getConstantValue(CE-getOperand(0)).Int8Val + + getConstantValue(CE-getOperand(1)).Int8Val; break; case Type::FloatTyID: Result.FloatVal = getConstantValue(CE-getOperand(0)).FloatVal + @@ -407,17 +399,13 @@ switch (C-getType()-getTypeID()) { #define
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.90 - 1.91 --- Log message: Detemplatize the Statistic class. The only type it is instantiated with is 'unsigned'. --- Diffs of the changes: (+2 -2) ExecutionEngine.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.90 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.91 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.90 Thu Nov 30 18:25:12 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Dec 6 11:46:32 2006 @@ -27,8 +27,8 @@ using namespace llvm; namespace { - Statistic NumInitBytes(lli, Number of bytes of global vars initialized); - Statistic NumGlobals (lli, Number of global vars initialized); + Statistic NumInitBytes(lli, Number of bytes of global vars initialized); + Statistic NumGlobals (lli, Number of global vars initialized); } ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.91 - 1.92 --- Log message: Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are now cerr, cout, and NullStream resp. --- Diffs of the changes: (+9 -9) ExecutionEngine.cpp | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.91 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.92 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.91 Wed Dec 6 11:46:32 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Dec 6 19:30:31 2006 @@ -402,7 +402,7 @@ default: break; } -llvm_cerr ConstantExpr not handled as global var init: *CE \n; +cerr ConstantExpr not handled as global var init: *CE \n; abort(); } @@ -432,7 +432,7 @@ assert(0 Unknown constant pointer type!); break; default: -llvm_cerr ERROR: Constant unimp for type: *C-getType() \n; +cerr ERROR: Constant unimp for type: *C-getType() \n; abort(); } return Result; @@ -477,7 +477,7 @@ Ptr-Untyped[7] = (unsigned char)(Val.ULongVal 56); break; default: - llvm_cerr Cannot store value of type *Ty !\n; + cerr Cannot store value of type *Ty !\n; } } else { switch (Ty-getTypeID()) { @@ -511,7 +511,7 @@ Ptr-Untyped[0] = (unsigned char)(Val.ULongVal 56); break; default: - llvm_cerr Cannot store value of type *Ty !\n; + cerr Cannot store value of type *Ty !\n; } } } @@ -552,7 +552,7 @@ ((uint64_t)Ptr-Untyped[7] 56); break; default: - llvm_cerr Cannot load value of type *Ty !\n; + cerr Cannot load value of type *Ty !\n; abort(); } } else { @@ -586,7 +586,7 @@ ((uint64_t)Ptr-Untyped[0] 56); break; default: - llvm_cerr Cannot load value of type *Ty !\n; + cerr Cannot load value of type *Ty !\n; abort(); } } @@ -634,7 +634,7 @@ } default: -llvm_cerr Bad Type: *Init-getType() \n; +cerr Bad Type: *Init-getType() \n; assert(0 Unknown constant type to initialize memory with!); } } @@ -718,8 +718,8 @@ sys::DynamicLibrary::SearchForAddressOfSymbol(I-getName().c_str())) addGlobalMapping(I, SymAddr); else { - llvm_cerr Could not resolve external global address: - I-getName() \n; + cerr Could not resolve external global address: +I-getName() \n; abort(); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.89 - 1.90 --- Log message: Introducing external weak linkage. Darwin codegen should be added later. --- Diffs of the changes: (+1 -1) ExecutionEngine.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.89 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.90 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.89 Mon Nov 27 17:54:50 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Nov 30 18:25:12 2006 @@ -681,7 +681,7 @@ // Otherwise, we know it's linkonce/weak, replace it if this is a strong // symbol. -if (GV-hasExternalLinkage()) +if (GV-hasExternalLinkage() || GVEntry-hasExternalWeakLinkage()) GVEntry = GV; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.88 - 1.89 --- Log message: Removed #include iostream and replaced streams with llvm streams. --- Diffs of the changes: (+11 -12) ExecutionEngine.cpp | 23 +++ 1 files changed, 11 insertions(+), 12 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.88 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.89 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.88 Sun Nov 26 19:05:10 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon Nov 27 17:54:50 2006 @@ -24,7 +24,6 @@ #include llvm/Support/MutexGuard.h #include llvm/System/DynamicLibrary.h #include llvm/Target/TargetData.h -#include iostream using namespace llvm; namespace { @@ -159,13 +158,13 @@ unsigned PtrSize = EE-getTargetData()-getPointerSize(); char *Result = new char[(InputArgv.size()+1)*PtrSize]; - DEBUG(std::cerr ARGV = (void*)Result \n); + DOUT ARGV = (void*)Result \n; const Type *SBytePtr = PointerType::get(Type::SByteTy); for (unsigned i = 0; i != InputArgv.size(); ++i) { unsigned Size = InputArgv[i].size()+1; char *Dest = new char[Size]; -DEBUG(std::cerr ARGV[ i ] = (void*)Dest \n); +DOUT ARGV[ i ] = (void*)Dest \n; std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest); Dest[Size-1] = 0; @@ -403,7 +402,7 @@ default: break; } -std::cerr ConstantExpr not handled as global var init: *CE \n; +llvm_cerr ConstantExpr not handled as global var init: *CE \n; abort(); } @@ -433,7 +432,7 @@ assert(0 Unknown constant pointer type!); break; default: -std::cout ERROR: Constant unimp for type: *C-getType() \n; +llvm_cerr ERROR: Constant unimp for type: *C-getType() \n; abort(); } return Result; @@ -478,7 +477,7 @@ Ptr-Untyped[7] = (unsigned char)(Val.ULongVal 56); break; default: - std::cout Cannot store value of type *Ty !\n; + llvm_cerr Cannot store value of type *Ty !\n; } } else { switch (Ty-getTypeID()) { @@ -512,7 +511,7 @@ Ptr-Untyped[0] = (unsigned char)(Val.ULongVal 56); break; default: - std::cout Cannot store value of type *Ty !\n; + llvm_cerr Cannot store value of type *Ty !\n; } } } @@ -553,7 +552,7 @@ ((uint64_t)Ptr-Untyped[7] 56); break; default: - std::cout Cannot load value of type *Ty !\n; + llvm_cerr Cannot load value of type *Ty !\n; abort(); } } else { @@ -587,7 +586,7 @@ ((uint64_t)Ptr-Untyped[0] 56); break; default: - std::cout Cannot load value of type *Ty !\n; + llvm_cerr Cannot load value of type *Ty !\n; abort(); } } @@ -635,7 +634,7 @@ } default: -std::cerr Bad Type: *Init-getType() \n; +llvm_cerr Bad Type: *Init-getType() \n; assert(0 Unknown constant type to initialize memory with!); } } @@ -719,7 +718,7 @@ sys::DynamicLibrary::SearchForAddressOfSymbol(I-getName().c_str())) addGlobalMapping(I, SymAddr); else { - std::cerr Could not resolve external global address: + llvm_cerr Could not resolve external global address: I-getName() \n; abort(); } @@ -761,7 +760,7 @@ // already in the map. void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) { void *GA = getPointerToGlobalIfAvailable(GV); - DEBUG(std::cerr Global ' GV-getName() ' - GA \n); + DOUT Global ' GV-getName() ' - GA \n; const Type *ElTy = GV-getType()-getElementType(); size_t GVSize = (size_t)getTargetData()-getTypeSize(ElTy); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.86 - 1.87 --- Log message: init ivar --- Diffs of the changes: (+2 -0) ExecutionEngine.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.86 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.87 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.86 Fri Oct 20 02:07:24 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Nov 9 13:31:15 2006 @@ -36,11 +36,13 @@ ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0; ExecutionEngine::ExecutionEngine(ModuleProvider *P) { + LazyCompilationDisabled = false; Modules.push_back(P); assert(P ModuleProvider is null?); } ExecutionEngine::ExecutionEngine(Module *M) { + LazyCompilationDisabled = false; assert(M Module is null?); Modules.push_back(new ExistingModuleProvider(M)); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.85 - 1.86 --- Log message: For PR950: http://llvm.org/PR950 : This patch implements the first increment for the Signless Types feature. All changes pertain to removing the ConstantSInt and ConstantUInt classes in favor of just using ConstantInt. --- Diffs of the changes: (+13 -13) ExecutionEngine.cpp | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.85 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.86 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.85 Thu Sep 14 13:23:26 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppFri Oct 20 02:07:24 2006 @@ -390,19 +390,19 @@ } switch (C-getType()-getTypeID()) { -#define GET_CONST_VAL(TY, CTY, CLASS) \ - case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-getValue(); break -GET_CONST_VAL(Bool , bool , ConstantBool); -GET_CONST_VAL(UByte , unsigned char , ConstantUInt); -GET_CONST_VAL(SByte , signed char , ConstantSInt); -GET_CONST_VAL(UShort , unsigned short, ConstantUInt); -GET_CONST_VAL(Short , signed short , ConstantSInt); -GET_CONST_VAL(UInt , unsigned int , ConstantUInt); -GET_CONST_VAL(Int, signed int, ConstantSInt); -GET_CONST_VAL(ULong , uint64_t , ConstantUInt); -GET_CONST_VAL(Long , int64_t , ConstantSInt); -GET_CONST_VAL(Float , float , ConstantFP); -GET_CONST_VAL(Double , double, ConstantFP); +#define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ + case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break +GET_CONST_VAL(Bool , bool , ConstantBool, getValue); +GET_CONST_VAL(UByte , unsigned char , ConstantInt, getZExtValue); +GET_CONST_VAL(SByte , signed char , ConstantInt, getSExtValue); +GET_CONST_VAL(UShort , unsigned short, ConstantInt, getZExtValue); +GET_CONST_VAL(Short , signed short , ConstantInt, getSExtValue); +GET_CONST_VAL(UInt , unsigned int , ConstantInt, getZExtValue); +GET_CONST_VAL(Int, signed int, ConstantInt, getSExtValue); +GET_CONST_VAL(ULong , uint64_t , ConstantInt, getZExtValue); +GET_CONST_VAL(Long , int64_t , ConstantInt, getSExtValue); +GET_CONST_VAL(Float , float , ConstantFP, getValue); +GET_CONST_VAL(Double , double, ConstantFP, getValue); #undef GET_CONST_VAL case Type::PointerTyID: if (isaConstantPointerNull(C)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.84 - 1.85 --- Log message: Adding dllimport, dllexport and external weak linkage types. DLL* linkages got full (I hope) codegeneration support in C both x86 assembler backends. External weak linkage added for future use, we don't provide any codegeneration, etc. support for it. --- Diffs of the changes: (+3 -1) ExecutionEngine.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.84 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.85 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.84 Tue Aug 15 20:24:12 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Sep 14 13:23:26 2006 @@ -657,7 +657,9 @@ } // If the existing global is strong, never replace it. -if (GVEntry-hasExternalLinkage()) +if (GVEntry-hasExternalLinkage() || +GVEntry-hasDLLImportLinkage() || +GVEntry-hasDLLExportLinkage()) continue; // Otherwise, we know it's linkonce/weak, replace it if this is a strong ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.83 - 1.84 --- Log message: initial changes to support JIT'ing from multiple module providers, implicitly linking the program on the fly. --- Diffs of the changes: (+150 -56) ExecutionEngine.cpp | 206 +--- 1 files changed, 150 insertions(+), 56 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.83 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.84 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.83 Sun May 14 14:01:55 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppTue Aug 15 20:24:12 2006 @@ -35,19 +35,33 @@ ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0; ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0; -ExecutionEngine::ExecutionEngine(ModuleProvider *P) : - CurMod(*P-getModule()), MP(P) { +ExecutionEngine::ExecutionEngine(ModuleProvider *P) { + Modules.push_back(P); assert(P ModuleProvider is null?); } -ExecutionEngine::ExecutionEngine(Module *M) : CurMod(*M), MP(0) { +ExecutionEngine::ExecutionEngine(Module *M) { assert(M Module is null?); + Modules.push_back(new ExistingModuleProvider(M)); } ExecutionEngine::~ExecutionEngine() { - delete MP; + for (unsigned i = 0, e = Modules.size(); i != e; ++i) +delete Modules[i]; } +/// FindFunctionNamed - Search all of the active modules to find the one that +/// defines FnName. This is very slow operation and shouldn't be used for +/// general code. +Function *ExecutionEngine::FindFunctionNamed(const char *FnName) { + for (unsigned i = 0, e = Modules.size(); i != e; ++i) { +if (Function *F = Modules[i]-getModule()-getNamedFunction(FnName)) + return F; + } + return 0; +} + + /// addGlobalMapping - Tell the execution engine that the specified global is /// at the specified location. This is used internally as functions are JIT'd /// and as global variables are laid out in memory. It can and should also be @@ -168,37 +182,43 @@ /// runStaticConstructorsDestructors - This method is used to execute all of -/// the static constructors or destructors for a module, depending on the +/// the static constructors or destructors for a program, depending on the /// value of isDtors. void ExecutionEngine::runStaticConstructorsDestructors(bool isDtors) { const char *Name = isDtors ? llvm.global_dtors : llvm.global_ctors; - GlobalVariable *GV = CurMod.getNamedGlobal(Name); - - // If this global has internal linkage, or if it has a use, then it must be - // an old-style (llvmgcc3) static ctor with __main linked in and in use. If - // this is the case, don't execute any of the global ctors, __main will do it. - if (!GV || GV-isExternal() || GV-hasInternalLinkage()) return; - // Should be an array of '{ int, void ()* }' structs. The first value is the - // init priority, which we ignore. - ConstantArray *InitList = dyn_castConstantArray(GV-getInitializer()); - if (!InitList) return; - for (unsigned i = 0, e = InitList-getNumOperands(); i != e; ++i) -if (ConstantStruct *CS = dyn_castConstantStruct(InitList-getOperand(i))){ - if (CS-getNumOperands() != 2) return; // Not array of 2-element structs. + // Execute global ctors/dtors for each module in the program. + for (unsigned m = 0, e = Modules.size(); m != e; ++m) { +GlobalVariable *GV = Modules[m]-getModule()-getNamedGlobal(Name); + +// If this global has internal linkage, or if it has a use, then it must be +// an old-style (llvmgcc3) static ctor with __main linked in and in use. If +// this is the case, don't execute any of the global ctors, __main will do +// it. +if (!GV || GV-isExternal() || GV-hasInternalLinkage()) continue; + +// Should be an array of '{ int, void ()* }' structs. The first value is +// the init priority, which we ignore. +ConstantArray *InitList = dyn_castConstantArray(GV-getInitializer()); +if (!InitList) continue; +for (unsigned i = 0, e = InitList-getNumOperands(); i != e; ++i) + if (ConstantStruct *CS = + dyn_castConstantStruct(InitList-getOperand(i))) { +if (CS-getNumOperands() != 2) break; // Not array of 2-element structs. - Constant *FP = CS-getOperand(1); - if (FP-isNullValue()) -return; // Found a null terminator, exit. +Constant *FP = CS-getOperand(1); +if (FP-isNullValue()) + break; // Found a null terminator, exit. - if (ConstantExpr *CE = dyn_castConstantExpr(FP)) -if (CE-getOpcode() == Instruction::Cast) - FP = CE-getOperand(0); - if (Function *F = dyn_castFunction(FP)) { -// Execute the ctor/dtor function! -runFunction(F, std::vectorGenericValue()); +if (ConstantExpr *CE = dyn_castConstantExpr(FP)) + if (CE-getOpcode() == Instruction::Cast) +FP = CE-getOperand(0);
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.81 - 1.82 --- Log message: Move some methods out of line so that MutexGuard.h isn't needed in a public header. --- Diffs of the changes: (+73 -3) ExecutionEngine.cpp | 76 +--- 1 files changed, 73 insertions(+), 3 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.81 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.82 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.81 Tue May 2 20:29:56 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon May 8 17:00:52 2006 @@ -21,6 +21,7 @@ #include llvm/ExecutionEngine/ExecutionEngine.h #include llvm/ExecutionEngine/GenericValue.h #include llvm/Support/Debug.h +#include llvm/Support/MutexGuard.h #include llvm/System/DynamicLibrary.h #include llvm/Target/TargetData.h #include iostream @@ -47,6 +48,73 @@ delete MP; } +/// addGlobalMapping - Tell the execution engine that the specified global is +/// at the specified location. This is used internally as functions are JIT'd +/// and as global variables are laid out in memory. It can and should also be +/// used by clients of the EE that want to have an LLVM global overlay +/// existing data in memory. +void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) { + MutexGuard locked(lock); + + void *CurVal = state.getGlobalAddressMap(locked)[GV]; + assert((CurVal == 0 || Addr == 0) GlobalMapping already established!); + CurVal = Addr; + + // If we are using the reverse mapping, add it too + if (!state.getGlobalAddressReverseMap(locked).empty()) { +const GlobalValue *V = state.getGlobalAddressReverseMap(locked)[Addr]; +assert((V == 0 || GV == 0) GlobalMapping already established!); +V = GV; + } +} + +/// clearAllGlobalMappings - Clear all global mappings and start over again +/// use in dynamic compilation scenarios when you want to move globals +void ExecutionEngine::clearAllGlobalMappings() { + MutexGuard locked(lock); + + state.getGlobalAddressMap(locked).clear(); + state.getGlobalAddressReverseMap(locked).clear(); +} + +/// updateGlobalMapping - Replace an existing mapping for GV with a new +/// address. This updates both maps as required. If Addr is null, the +/// entry for the global is removed from the mappings. +void ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) { + MutexGuard locked(lock); + + // Deleting from the mapping? + if (Addr == 0) { +state.getGlobalAddressMap(locked).erase(GV); +if (!state.getGlobalAddressReverseMap(locked).empty()) + state.getGlobalAddressReverseMap(locked).erase(Addr); +return; + } + + void *CurVal = state.getGlobalAddressMap(locked)[GV]; + if (CurVal !state.getGlobalAddressReverseMap(locked).empty()) +state.getGlobalAddressReverseMap(locked).erase(CurVal); + CurVal = Addr; + + // If we are using the reverse mapping, add it too + if (!state.getGlobalAddressReverseMap(locked).empty()) { +const GlobalValue *V = state.getGlobalAddressReverseMap(locked)[Addr]; +assert((V == 0 || GV == 0) GlobalMapping already established!); +V = GV; + } +} + +/// getPointerToGlobalIfAvailable - This returns the address of the specified +/// global value if it is has already been codegen'd, otherwise it returns null. +/// +void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) { + MutexGuard locked(lock); + + std::mapconst GlobalValue*, void*::iterator I = + state.getGlobalAddressMap(locked).find(GV); + return I != state.getGlobalAddressMap(locked).end() ? I-second : 0; +} + /// getGlobalValueAtAddress - Return the LLVM global value object that starts /// at the specified address. /// @@ -55,9 +123,11 @@ // If we haven't computed the reverse mapping yet, do so first. if (state.getGlobalAddressReverseMap(locked).empty()) { -for (std::mapconst GlobalValue*, void *::iterator I = - state.getGlobalAddressMap(locked).begin(), E = state.getGlobalAddressMap(locked).end(); I != E; ++I) - state.getGlobalAddressReverseMap(locked).insert(std::make_pair(I-second, I-first)); +for (std::mapconst GlobalValue*, void *::iterator + I = state.getGlobalAddressMap(locked).begin(), + E = state.getGlobalAddressMap(locked).end(); I != E; ++I) + state.getGlobalAddressReverseMap(locked).insert(std::make_pair(I-second, + I-first)); } std::mapvoid *, const GlobalValue*::iterator I = ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.79 - 1.80 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+4 -1) ExecutionEngine.cpp |5 - 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.79 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.80 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.79 Sat Apr 22 00:02:46 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Apr 22 13:53:45 2006 @@ -328,7 +328,10 @@ return Result; } -/// FIXME: document +/// StoreValueToMemory - Stores the data in Val of type Ty at address Ptr. Ptr +/// is the address of the memory at which to store Val, cast to GenericValue *. +/// It is not a pointer to a GenericValue containing the address at which to +/// store Val. /// void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.78 - 1.79 --- Log message: Fix JIT support for static ctors, which was apparently completely broken! This allows Prolangs-C++/city and probably a bunch of other stuff to work well with the new front-end --- Diffs of the changes: (+5 -1) ExecutionEngine.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.78 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.79 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.78 Wed Mar 22 23:43:58 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Apr 22 00:02:46 2006 @@ -103,7 +103,11 @@ void ExecutionEngine::runStaticConstructorsDestructors(bool isDtors) { const char *Name = isDtors ? llvm.global_dtors : llvm.global_ctors; GlobalVariable *GV = CurMod.getNamedGlobal(Name); - if (!GV || GV-isExternal() || !GV-hasInternalLinkage()) return; + + // If this global has internal linkage, or if it has a use, then it must be + // an old-style (llvmgcc3) static ctor with __main linked in and in use. If + // this is the case, don't execute any of the global ctors, __main will do it. + if (!GV || GV-isExternal() || GV-hasInternalLinkage()) return; // Should be an array of '{ int, void ()* }' structs. The first value is the // init priority, which we ignore. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.76 - 1.77 --- Log message: remove the intrinsiclowering hook --- Diffs of the changes: (+5 -7) ExecutionEngine.cpp | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.76 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.77 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.76 Wed Mar 22 00:07:50 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Mar 22 23:22:51 2006 @@ -160,24 +160,22 @@ /// NULL is returned. /// ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP, - bool ForceInterpreter, - IntrinsicLowering *IL) { + bool ForceInterpreter) { ExecutionEngine *EE = 0; // Unless the interpreter was explicitly selected, try making a JIT. if (!ForceInterpreter JITCtor) -EE = JITCtor(MP, IL); +EE = JITCtor(MP); // If we can't make a JIT, make an interpreter instead. if (EE == 0 InterpCtor) -EE = InterpCtor(MP, IL); +EE = InterpCtor(MP); - if (EE == 0) -delete IL; - else + if (EE) { // Make sure we can resolve symbols in the program as well. The zero arg // to the function tells DynamicLibrary to load the program, not a library. sys::DynamicLibrary::LoadLibraryPermanently(0); + } return EE; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.77 - 1.78 --- Log message: prune #includes --- Diffs of the changes: (+0 -1) ExecutionEngine.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.77 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.78 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.77 Wed Mar 22 23:22:51 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Mar 22 23:43:58 2006 @@ -18,7 +18,6 @@ #include llvm/Module.h #include llvm/ModuleProvider.h #include llvm/ADT/Statistic.h -#include llvm/CodeGen/IntrinsicLowering.h #include llvm/ExecutionEngine/ExecutionEngine.h #include llvm/ExecutionEngine/GenericValue.h #include llvm/Support/Debug.h ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.75 - 1.76 --- Log message: Eliminate the dependency of ExecutionEngine on the JIT/Interpreter libraries. Now you can build a tool with just the JIT or just the interpreter. --- Diffs of the changes: (+8 -18) ExecutionEngine.cpp | 26 -- 1 files changed, 8 insertions(+), 18 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.75 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.76 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.75 Wed Mar 8 12:42:46 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Mar 22 00:07:50 2006 @@ -13,8 +13,6 @@ //===--===// #define DEBUG_TYPE jit -#include Interpreter/Interpreter.h -#include JIT/JIT.h #include llvm/Constants.h #include llvm/DerivedTypes.h #include llvm/Module.h @@ -26,6 +24,7 @@ #include llvm/Support/Debug.h #include llvm/System/DynamicLibrary.h #include llvm/Target/TargetData.h +#include iostream using namespace llvm; namespace { @@ -33,6 +32,9 @@ Statistic NumGlobals (lli, Number of global vars initialized); } +ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0; +ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0; + ExecutionEngine::ExecutionEngine(ModuleProvider *P) : CurMod(*P-getModule()), MP(P) { assert(P ModuleProvider is null?); @@ -163,24 +165,12 @@ ExecutionEngine *EE = 0; // Unless the interpreter was explicitly selected, try making a JIT. - if (!ForceInterpreter) -EE = JIT::create(MP, IL); + if (!ForceInterpreter JITCtor) +EE = JITCtor(MP, IL); // If we can't make a JIT, make an interpreter instead. - if (EE == 0) { -try { - Module *M = MP-materializeModule(); - try { -EE = Interpreter::create(M, IL); - } catch (...) { -std::cerr Error creating the interpreter!\n; - } -} catch (std::string errmsg) { - std::cerr Error reading the bytecode file: errmsg \n; -} catch (...) { - std::cerr Error reading the bytecode file!\n; -} - } + if (EE == 0 InterpCtor) +EE = InterpCtor(MP, IL); if (EE == 0) delete IL; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.72 - 1.73 --- Log message: Fixed InitializeMemory to handle ConstantPacked. --- Diffs of the changes: (+6 -0) ExecutionEngine.cpp |6 ++ 1 files changed, 6 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.72 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.73 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.72 Sun Oct 23 18:54:56 2005 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppFri Jan 20 12:18:40 2006 @@ -457,6 +457,12 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { if (isaUndefValue(Init)) { return; + } else if (const ConstantPacked *CP = dyn_castConstantPacked(Init)) { +unsigned ElementSize = + getTargetData().getTypeSize(CP-getType()-getElementType()); +for (unsigned i = 0, e = CP-getNumOperands(); i != e; ++i) + InitializeMemory(CP-getOperand(i), (char*)Addr+i*ElementSize); +return; } else if (Init-getType()-isFirstClassType()) { GenericValue Val = getConstantValue(Init); StoreValueToMemory(Val, (GenericValue*)Addr, Init-getType()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits