mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
[opaque pointer type] more gep API migrations
Adding nullptr to all the IRBuilder stuff because it's the first thing that fails to build when testing without the back-compat functions, so I'll keep having to re-add these locally for each chunk of migration I do. Might as well check them in to save me the churn. Eventually I'll have to migrate these too, but I'm going breadth-first. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1026,7 +1026,7 @@ public:
|
|||||||
if (i == e)
|
if (i == e)
|
||||||
return Insert(Folder.CreateGetElementPtr(PC, IdxList), Name);
|
return Insert(Folder.CreateGetElementPtr(PC, IdxList), Name);
|
||||||
}
|
}
|
||||||
return Insert(GetElementPtrInst::Create(Ptr, IdxList), Name);
|
return Insert(GetElementPtrInst::Create(nullptr, Ptr, IdxList), Name);
|
||||||
}
|
}
|
||||||
Value *CreateInBoundsGEP(Value *Ptr, ArrayRef<Value *> IdxList,
|
Value *CreateInBoundsGEP(Value *Ptr, ArrayRef<Value *> IdxList,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1039,19 +1039,19 @@ public:
|
|||||||
if (i == e)
|
if (i == e)
|
||||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IdxList), Name);
|
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IdxList), Name);
|
||||||
}
|
}
|
||||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, IdxList), Name);
|
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, IdxList), Name);
|
||||||
}
|
}
|
||||||
Value *CreateGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
Value *CreateGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
if (Constant *IC = dyn_cast<Constant>(Idx))
|
if (Constant *IC = dyn_cast<Constant>(Idx))
|
||||||
return Insert(Folder.CreateGetElementPtr(PC, IC), Name);
|
return Insert(Folder.CreateGetElementPtr(PC, IC), Name);
|
||||||
return Insert(GetElementPtrInst::Create(Ptr, Idx), Name);
|
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idx), Name);
|
||||||
}
|
}
|
||||||
Value *CreateInBoundsGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
Value *CreateInBoundsGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
if (Constant *IC = dyn_cast<Constant>(Idx))
|
if (Constant *IC = dyn_cast<Constant>(Idx))
|
||||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IC), Name);
|
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IC), Name);
|
||||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idx), Name);
|
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idx), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name = "") {
|
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name = "") {
|
||||||
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
|
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
|
||||||
@@ -1059,7 +1059,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::Create(Ptr, Idx), Name);
|
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idx), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstInBoundsGEP1_32(Value *Ptr, unsigned Idx0,
|
Value *CreateConstInBoundsGEP1_32(Value *Ptr, unsigned Idx0,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1068,7 +1068,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idx), Name);
|
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idx), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1080,7 +1080,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs), Name);
|
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idxs), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstInBoundsGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
Value *CreateConstInBoundsGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1092,7 +1092,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs), Name);
|
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idxs), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name = "") {
|
Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name = "") {
|
||||||
Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
|
Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
|
||||||
@@ -1100,7 +1100,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::Create(Ptr, Idx), Name);
|
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idx), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
|
Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1109,7 +1109,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idx), Name);
|
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idx), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1121,7 +1121,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs), Name);
|
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idxs), Name);
|
||||||
}
|
}
|
||||||
Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
@@ -1133,7 +1133,7 @@ public:
|
|||||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
||||||
|
|
||||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs), Name);
|
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idxs), Name);
|
||||||
}
|
}
|
||||||
Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") {
|
Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") {
|
||||||
return CreateConstInBoundsGEP2_32(Ptr, 0, Idx, Name);
|
return CreateConstInBoundsGEP2_32(Ptr, 0, Idx, Name);
|
||||||
|
@@ -189,7 +189,7 @@ public:
|
|||||||
}
|
}
|
||||||
Instruction *CreateGetElementPtr(Constant *C,
|
Instruction *CreateGetElementPtr(Constant *C,
|
||||||
ArrayRef<Value *> IdxList) const {
|
ArrayRef<Value *> IdxList) const {
|
||||||
return GetElementPtrInst::Create(C, IdxList);
|
return GetElementPtrInst::Create(nullptr, C, IdxList);
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||||
@@ -204,7 +204,7 @@ public:
|
|||||||
}
|
}
|
||||||
Instruction *CreateInBoundsGetElementPtr(Constant *C,
|
Instruction *CreateInBoundsGetElementPtr(Constant *C,
|
||||||
ArrayRef<Value *> IdxList) const {
|
ArrayRef<Value *> IdxList) const {
|
||||||
return GetElementPtrInst::CreateInBounds(C, IdxList);
|
return GetElementPtrInst::CreateInBounds(nullptr, C, IdxList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
@@ -1221,7 +1221,7 @@ static void RewriteHeapSROALoadUser(Instruction *LoadUser,
|
|||||||
GEPIdx.push_back(GEPI->getOperand(1));
|
GEPIdx.push_back(GEPI->getOperand(1));
|
||||||
GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end());
|
GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end());
|
||||||
|
|
||||||
Value *NGEPI = GetElementPtrInst::Create(NewPtr, GEPIdx,
|
Value *NGEPI = GetElementPtrInst::Create(GEPI->getResultElementType(), NewPtr, GEPIdx,
|
||||||
GEPI->getName(), GEPI);
|
GEPI->getName(), GEPI);
|
||||||
GEPI->replaceAllUsesWith(NGEPI);
|
GEPI->replaceAllUsesWith(NGEPI);
|
||||||
GEPI->eraseFromParent();
|
GEPI->eraseFromParent();
|
||||||
|
@@ -733,7 +733,8 @@ static Value *BuildNew(Instruction *I, ArrayRef<Value*> NewOps) {
|
|||||||
case Instruction::GetElementPtr: {
|
case Instruction::GetElementPtr: {
|
||||||
Value *Ptr = NewOps[0];
|
Value *Ptr = NewOps[0];
|
||||||
ArrayRef<Value*> Idx = NewOps.slice(1);
|
ArrayRef<Value*> Idx = NewOps.slice(1);
|
||||||
GetElementPtrInst *GEP = GetElementPtrInst::Create(Ptr, Idx, "", I);
|
GetElementPtrInst *GEP = GetElementPtrInst::Create(
|
||||||
|
cast<GetElementPtrInst>(I)->getSourceElementType(), Ptr, Idx, "", I);
|
||||||
GEP->setIsInBounds(cast<GetElementPtrInst>(I)->isInBounds());
|
GEP->setIsInBounds(cast<GetElementPtrInst>(I)->isInBounds());
|
||||||
return GEP;
|
return GEP;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user