mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
[opaque pointer type] API migration for GEP constant factories
Require the pointee type to be passed explicitly and assert that it is correct. For now it's possible to pass nullptr here (and I've done so in a few places in this patch) but eventually that will be disallowed once all clients have been updated or removed. It'll be a long road to get all the way there... but if you have the cahnce to update your callers to pass the type explicitly without depending on a pointer's element type, that would be a good thing to do soon and a necessary thing to do eventually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -349,7 +349,8 @@ void LowerBitSets::allocateByteArrays() {
|
||||
|
||||
Constant *Idxs[] = {ConstantInt::get(IntPtrTy, 0),
|
||||
ConstantInt::get(IntPtrTy, ByteArrayOffsets[I])};
|
||||
Constant *GEP = ConstantExpr::getInBoundsGetElementPtr(ByteArray, Idxs);
|
||||
Constant *GEP = ConstantExpr::getInBoundsGetElementPtr(
|
||||
ByteArrayConst->getType(), ByteArray, Idxs);
|
||||
|
||||
// Create an alias instead of RAUW'ing the gep directly. On x86 this ensures
|
||||
// that the pc-relative displacement is folded into the lea instead of the
|
||||
@ -546,8 +547,8 @@ void LowerBitSets::buildBitSetsFromGlobals(
|
||||
// Multiply by 2 to account for padding elements.
|
||||
Constant *CombinedGlobalIdxs[] = {ConstantInt::get(Int32Ty, 0),
|
||||
ConstantInt::get(Int32Ty, I * 2)};
|
||||
Constant *CombinedGlobalElemPtr =
|
||||
ConstantExpr::getGetElementPtr(CombinedGlobal, CombinedGlobalIdxs);
|
||||
Constant *CombinedGlobalElemPtr = ConstantExpr::getGetElementPtr(
|
||||
NewInit->getType(), CombinedGlobal, CombinedGlobalIdxs);
|
||||
if (LinkerSubsectionsViaSymbols) {
|
||||
Globals[I]->replaceAllUsesWith(CombinedGlobalElemPtr);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user