@@ -61,8 +61,8 @@ ExecutionEngine *(*ExecutionEngine::InterpCtor)(std::unique_ptr<Module> M,
61
61
62
62
void JITEventListener::anchor () {}
63
63
64
- ExecutionEngine::ExecutionEngine (const DataLayout DL, std::unique_ptr<Module> M)
65
- : DL(std::move(DL)), LazyFunctionCreator(nullptr ) {
64
+ ExecutionEngine::ExecutionEngine (std::unique_ptr<Module> M)
65
+ : LazyFunctionCreator(nullptr ) {
66
66
CompilingLazily = false ;
67
67
GVCompilationDisabled = false ;
68
68
SymbolSearchingDisabled = false ;
@@ -115,7 +115,7 @@ class GVMemoryBlock : public CallbackVH {
115
115
} // anonymous namespace
116
116
117
117
char *ExecutionEngine::getMemoryForGV (const GlobalVariable *GV) {
118
- return GVMemoryBlock::Create (GV, getDataLayout ());
118
+ return GVMemoryBlock::Create (GV, * getDataLayout ());
119
119
}
120
120
121
121
void ExecutionEngine::addObjectFile (std::unique_ptr<object::ObjectFile> O) {
@@ -326,7 +326,7 @@ void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE,
326
326
const std::vector<std::string> &InputArgv) {
327
327
Values.clear (); // Free the old contents.
328
328
Values.reserve (InputArgv.size ());
329
- unsigned PtrSize = EE->getDataLayout (). getPointerSize ();
329
+ unsigned PtrSize = EE->getDataLayout ()-> getPointerSize ();
330
330
Array = make_unique<char []>((InputArgv.size ()+1 )*PtrSize);
331
331
332
332
DEBUG (dbgs () << " JIT: ARGV = " << (void *)Array.get () << " \n " );
@@ -401,7 +401,7 @@ void ExecutionEngine::runStaticConstructorsDestructors(bool isDtors) {
401
401
#ifndef NDEBUG
402
402
// / isTargetNullPtr - Return whether the target pointer stored at Loc is null.
403
403
static bool isTargetNullPtr (ExecutionEngine *EE, void *Loc) {
404
- unsigned PtrSize = EE->getDataLayout (). getPointerSize ();
404
+ unsigned PtrSize = EE->getDataLayout ()-> getPointerSize ();
405
405
for (unsigned i = 0 ; i < PtrSize; ++i)
406
406
if (*(i + (uint8_t *)Loc))
407
407
return false ;
@@ -634,8 +634,8 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
634
634
case Instruction::GetElementPtr: {
635
635
// Compute the index
636
636
GenericValue Result = getConstantValue (Op0);
637
- APInt Offset (DL. getPointerSizeInBits (), 0 );
638
- cast<GEPOperator>(CE)->accumulateConstantOffset (DL, Offset);
637
+ APInt Offset (DL-> getPointerSizeInBits (), 0 );
638
+ cast<GEPOperator>(CE)->accumulateConstantOffset (* DL, Offset);
639
639
640
640
char * tmp = (char *) Result.PointerVal ;
641
641
Result = PTOGV (tmp + Offset.getSExtValue ());
@@ -722,16 +722,16 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
722
722
}
723
723
case Instruction::PtrToInt: {
724
724
GenericValue GV = getConstantValue (Op0);
725
- uint32_t PtrWidth = DL. getTypeSizeInBits (Op0->getType ());
725
+ uint32_t PtrWidth = DL-> getTypeSizeInBits (Op0->getType ());
726
726
assert (PtrWidth <= 64 && " Bad pointer width" );
727
727
GV.IntVal = APInt (PtrWidth, uintptr_t (GV.PointerVal ));
728
- uint32_t IntWidth = DL. getTypeSizeInBits (CE->getType ());
728
+ uint32_t IntWidth = DL-> getTypeSizeInBits (CE->getType ());
729
729
GV.IntVal = GV.IntVal .zextOrTrunc (IntWidth);
730
730
return GV;
731
731
}
732
732
case Instruction::IntToPtr: {
733
733
GenericValue GV = getConstantValue (Op0);
734
- uint32_t PtrWidth = DL. getTypeSizeInBits (CE->getType ());
734
+ uint32_t PtrWidth = DL-> getTypeSizeInBits (CE->getType ());
735
735
GV.IntVal = GV.IntVal .zextOrTrunc (PtrWidth);
736
736
assert (GV.IntVal .getBitWidth () <= 64 && " Bad pointer width" );
737
737
GV.PointerVal = PointerTy (uintptr_t (GV.IntVal .getZExtValue ()));
@@ -1033,7 +1033,7 @@ static void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst,
1033
1033
1034
1034
void ExecutionEngine::StoreValueToMemory (const GenericValue &Val,
1035
1035
GenericValue *Ptr , Type *Ty) {
1036
- const unsigned StoreBytes = getDataLayout (). getTypeStoreSize (Ty);
1036
+ const unsigned StoreBytes = getDataLayout ()-> getTypeStoreSize (Ty);
1037
1037
1038
1038
switch (Ty->getTypeID ()) {
1039
1039
default :
@@ -1073,7 +1073,7 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
1073
1073
break ;
1074
1074
}
1075
1075
1076
- if (sys::IsLittleEndianHost != getDataLayout (). isLittleEndian ())
1076
+ if (sys::IsLittleEndianHost != getDataLayout ()-> isLittleEndian ())
1077
1077
// Host and target are different endian - reverse the stored bytes.
1078
1078
std::reverse ((uint8_t *)Ptr , StoreBytes + (uint8_t *)Ptr );
1079
1079
}
@@ -1110,7 +1110,7 @@ static void LoadIntFromMemory(APInt &IntVal, uint8_t *Src, unsigned LoadBytes) {
1110
1110
void ExecutionEngine::LoadValueFromMemory (GenericValue &Result,
1111
1111
GenericValue *Ptr ,
1112
1112
Type *Ty) {
1113
- const unsigned LoadBytes = getDataLayout (). getTypeStoreSize (Ty);
1113
+ const unsigned LoadBytes = getDataLayout ()-> getTypeStoreSize (Ty);
1114
1114
1115
1115
switch (Ty->getTypeID ()) {
1116
1116
case Type::IntegerTyID:
@@ -1176,28 +1176,28 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
1176
1176
1177
1177
if (const ConstantVector *CP = dyn_cast<ConstantVector>(Init)) {
1178
1178
unsigned ElementSize =
1179
- getDataLayout (). getTypeAllocSize (CP->getType ()->getElementType ());
1179
+ getDataLayout ()-> getTypeAllocSize (CP->getType ()->getElementType ());
1180
1180
for (unsigned i = 0 , e = CP->getNumOperands (); i != e; ++i)
1181
1181
InitializeMemory (CP->getOperand (i), (char *)Addr+i*ElementSize);
1182
1182
return ;
1183
1183
}
1184
1184
1185
1185
if (isa<ConstantAggregateZero>(Init)) {
1186
- memset (Addr, 0 , (size_t )getDataLayout (). getTypeAllocSize (Init->getType ()));
1186
+ memset (Addr, 0 , (size_t )getDataLayout ()-> getTypeAllocSize (Init->getType ()));
1187
1187
return ;
1188
1188
}
1189
1189
1190
1190
if (const ConstantArray *CPA = dyn_cast<ConstantArray>(Init)) {
1191
1191
unsigned ElementSize =
1192
- getDataLayout (). getTypeAllocSize (CPA->getType ()->getElementType ());
1192
+ getDataLayout ()-> getTypeAllocSize (CPA->getType ()->getElementType ());
1193
1193
for (unsigned i = 0 , e = CPA->getNumOperands (); i != e; ++i)
1194
1194
InitializeMemory (CPA->getOperand (i), (char *)Addr+i*ElementSize);
1195
1195
return ;
1196
1196
}
1197
1197
1198
1198
if (const ConstantStruct *CPS = dyn_cast<ConstantStruct>(Init)) {
1199
1199
const StructLayout *SL =
1200
- getDataLayout (). getStructLayout (cast<StructType>(CPS->getType ()));
1200
+ getDataLayout ()-> getStructLayout (cast<StructType>(CPS->getType ()));
1201
1201
for (unsigned i = 0 , e = CPS->getNumOperands (); i != e; ++i)
1202
1202
InitializeMemory (CPS->getOperand (i), (char *)Addr+SL->getElementOffset (i));
1203
1203
return ;
@@ -1342,7 +1342,7 @@ void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) {
1342
1342
InitializeMemory (GV->getInitializer (), GA);
1343
1343
1344
1344
Type *ElTy = GV->getType ()->getElementType ();
1345
- size_t GVSize = (size_t )getDataLayout (). getTypeAllocSize (ElTy);
1345
+ size_t GVSize = (size_t )getDataLayout ()-> getTypeAllocSize (ElTy);
1346
1346
NumInitBytes += (unsigned )GVSize;
1347
1347
++NumGlobals;
1348
1348
}
0 commit comments