mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
[opaque pointer types] Push explicit type parameter for geps through the constant folders
Next: more IRBuilder changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233991 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67a2b82b14
commit
dc3292a4b1
@ -130,34 +130,35 @@ public:
|
||||
// Memory Instructions
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return Fold(ConstantExpr::getGetElementPtr(nullptr, C, IdxList));
|
||||
return Fold(ConstantExpr::getGetElementPtr(Ty, C, IdxList));
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const {
|
||||
// This form of the function only exists to avoid ambiguous overload
|
||||
// warnings about whether to convert Idx to ArrayRef<Constant *> or
|
||||
// ArrayRef<Value *>.
|
||||
return Fold(ConstantExpr::getGetElementPtr(nullptr, C, Idx));
|
||||
return Fold(ConstantExpr::getGetElementPtr(Ty, C, Idx));
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return Fold(ConstantExpr::getGetElementPtr(nullptr, C, IdxList));
|
||||
return Fold(ConstantExpr::getGetElementPtr(Ty, C, IdxList));
|
||||
}
|
||||
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(nullptr, C, IdxList));
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList));
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
Constant *Idx) const {
|
||||
// This form of the function only exists to avoid ambiguous overload
|
||||
// warnings about whether to convert Idx to ArrayRef<Constant *> or
|
||||
// ArrayRef<Value *>.
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(nullptr, C, Idx));
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(Ty, C, Idx));
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(nullptr, C, IdxList));
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList));
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -118,34 +118,35 @@ public:
|
||||
// Memory Instructions
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getGetElementPtr(nullptr, C, IdxList);
|
||||
return ConstantExpr::getGetElementPtr(Ty, C, IdxList);
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const {
|
||||
// This form of the function only exists to avoid ambiguous overload
|
||||
// warnings about whether to convert Idx to ArrayRef<Constant *> or
|
||||
// ArrayRef<Value *>.
|
||||
return ConstantExpr::getGetElementPtr(nullptr, C, Idx);
|
||||
return ConstantExpr::getGetElementPtr(Ty, C, Idx);
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return ConstantExpr::getGetElementPtr(nullptr, C, IdxList);
|
||||
return ConstantExpr::getGetElementPtr(Ty, C, IdxList);
|
||||
}
|
||||
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(nullptr, C, IdxList);
|
||||
return ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList);
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
Constant *Idx) const {
|
||||
// This form of the function only exists to avoid ambiguous overload
|
||||
// warnings about whether to convert Idx to ArrayRef<Constant *> or
|
||||
// ArrayRef<Value *>.
|
||||
return ConstantExpr::getInBoundsGetElementPtr(nullptr, C, Idx);
|
||||
return ConstantExpr::getInBoundsGetElementPtr(Ty, C, Idx);
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(nullptr, C, IdxList);
|
||||
return ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -1028,7 +1028,7 @@ public:
|
||||
if (!isa<Constant>(IdxList[i]))
|
||||
break;
|
||||
if (i == e)
|
||||
return Insert(Folder.CreateGetElementPtr(PC, IdxList), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(Ty, PC, IdxList), Name);
|
||||
}
|
||||
return Insert(GetElementPtrInst::Create(Ty, Ptr, IdxList), Name);
|
||||
}
|
||||
@ -1041,7 +1041,8 @@ public:
|
||||
if (!isa<Constant>(IdxList[i]))
|
||||
break;
|
||||
if (i == e)
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IdxList), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(nullptr, PC, IdxList),
|
||||
Name);
|
||||
}
|
||||
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, IdxList), Name);
|
||||
}
|
||||
@ -1051,20 +1052,21 @@ public:
|
||||
Value *CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name = "") {
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
if (Constant *IC = dyn_cast<Constant>(Idx))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, IC), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(Ty, PC, IC), Name);
|
||||
return Insert(GetElementPtrInst::Create(Ty, Ptr, Idx), Name);
|
||||
}
|
||||
Value *CreateInBoundsGEP(Value *Ptr, Value *Idx, const Twine &Name = "") {
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
if (Constant *IC = dyn_cast<Constant>(Idx))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IC), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(nullptr, PC, IC),
|
||||
Name);
|
||||
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idx), Name);
|
||||
}
|
||||
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name = "") {
|
||||
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(nullptr, PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idx), Name);
|
||||
}
|
||||
@ -1073,7 +1075,7 @@ public:
|
||||
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(nullptr, PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idx), Name);
|
||||
}
|
||||
@ -1085,7 +1087,7 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(nullptr, PC, Idxs), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idxs), Name);
|
||||
}
|
||||
@ -1097,7 +1099,8 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(nullptr, PC, Idxs),
|
||||
Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idxs), Name);
|
||||
}
|
||||
@ -1105,7 +1108,7 @@ public:
|
||||
Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(nullptr, PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idx), Name);
|
||||
}
|
||||
@ -1114,7 +1117,7 @@ public:
|
||||
Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(nullptr, PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idx), Name);
|
||||
}
|
||||
@ -1126,7 +1129,7 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(nullptr, PC, Idxs), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(nullptr, Ptr, Idxs), Name);
|
||||
}
|
||||
@ -1138,7 +1141,8 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(nullptr, PC, Idxs),
|
||||
Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(nullptr, Ptr, Idxs), Name);
|
||||
}
|
||||
|
@ -177,34 +177,35 @@ public:
|
||||
// Memory Instructions
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getGetElementPtr(nullptr, C, IdxList);
|
||||
return ConstantExpr::getGetElementPtr(Ty, C, IdxList);
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {
|
||||
Constant *CreateGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const {
|
||||
// This form of the function only exists to avoid ambiguous overload
|
||||
// warnings about whether to convert Idx to ArrayRef<Constant *> or
|
||||
// ArrayRef<Value *>.
|
||||
return ConstantExpr::getGetElementPtr(nullptr, C, Idx);
|
||||
return ConstantExpr::getGetElementPtr(Ty, C, Idx);
|
||||
}
|
||||
Instruction *CreateGetElementPtr(Constant *C,
|
||||
Instruction *CreateGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return GetElementPtrInst::Create(nullptr, C, IdxList);
|
||||
return GetElementPtrInst::Create(Ty, C, IdxList);
|
||||
}
|
||||
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(nullptr, C, IdxList);
|
||||
return ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList);
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {
|
||||
Constant *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
Constant *Idx) const {
|
||||
// This form of the function only exists to avoid ambiguous overload
|
||||
// warnings about whether to convert Idx to ArrayRef<Constant *> or
|
||||
// ArrayRef<Value *>.
|
||||
return ConstantExpr::getInBoundsGetElementPtr(nullptr, C, Idx);
|
||||
return ConstantExpr::getInBoundsGetElementPtr(Ty, C, Idx);
|
||||
}
|
||||
Instruction *CreateInBoundsGetElementPtr(Constant *C,
|
||||
Instruction *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return GetElementPtrInst::CreateInBounds(nullptr, C, IdxList);
|
||||
return GetElementPtrInst::CreateInBounds(Ty, C, IdxList);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
Loading…
x
Reference in New Issue
Block a user