mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 21:31:03 +00:00
Convert ConstantFolder APIs to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135671 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c30a38f34b
commit
12fc16f195
@ -118,22 +118,36 @@ public:
|
||||
// Memory Instructions
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getGetElementPtr(C, IdxList.data(), IdxList.size());
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
|
||||
Constant *CreateGetElementPtr(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(C, &Idx, 1);
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return ConstantExpr::getGetElementPtr(C, IdxList.data(), IdxList.size());
|
||||
}
|
||||
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx);
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size());
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx);
|
||||
Constant *CreateInBoundsGetElementPtr(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(C, &Idx, 1);
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size());
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -774,8 +774,8 @@ public:
|
||||
if (!isa<Constant>(*i))
|
||||
break;
|
||||
if (i == IdxEnd)
|
||||
return Insert(Folder.CreateGetElementPtr(PC, &IdxBegin[0],
|
||||
IdxEnd - IdxBegin),
|
||||
return Insert(Folder.CreateGetElementPtr(PC, makeArrayRef(IdxBegin,
|
||||
IdxEnd)),
|
||||
Name);
|
||||
}
|
||||
return Insert(GetElementPtrInst::Create(Ptr, IdxBegin, IdxEnd), Name);
|
||||
@ -792,8 +792,8 @@ public:
|
||||
break;
|
||||
if (i == IdxEnd)
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC,
|
||||
&IdxBegin[0],
|
||||
IdxEnd - IdxBegin),
|
||||
makeArrayRef(IdxBegin,
|
||||
IdxEnd)),
|
||||
Name);
|
||||
}
|
||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, IdxBegin, IdxEnd),
|
||||
@ -802,20 +802,20 @@ public:
|
||||
Value *CreateGEP(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, 1), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(PC, IC), Name);
|
||||
return Insert(GetElementPtrInst::Create(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, 1), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, IC), Name);
|
||||
return Insert(GetElementPtrInst::CreateInBounds(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, 1), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
@ -824,7 +824,7 @@ public:
|
||||
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, &Idx, 1), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
@ -836,7 +836,7 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs, 2), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
|
||||
}
|
||||
@ -848,7 +848,7 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs, 2), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs, Idxs+2), Name);
|
||||
}
|
||||
@ -856,7 +856,7 @@ public:
|
||||
Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, &Idx, 1), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
@ -865,7 +865,7 @@ public:
|
||||
Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, &Idx, 1), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idx), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
@ -877,7 +877,7 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs, 2), Name);
|
||||
return Insert(Folder.CreateGetElementPtr(PC, Idxs), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
|
||||
}
|
||||
@ -889,7 +889,7 @@ public:
|
||||
};
|
||||
|
||||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs, 2), Name);
|
||||
return Insert(Folder.CreateInBoundsGetElementPtr(PC, Idxs), Name);
|
||||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs, Idxs+2), Name);
|
||||
}
|
||||
|
@ -177,22 +177,23 @@ public:
|
||||
// Memory Instructions
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getGetElementPtr(C, IdxList.data(), IdxList.size());
|
||||
}
|
||||
Instruction *CreateGetElementPtr(Constant *C, Value* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return GetElementPtrInst::Create(C, IdxList, IdxList+NumIdx);
|
||||
Instruction *CreateGetElementPtr(Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return GetElementPtrInst::Create(C, IdxList.begin(), IdxList.end());
|
||||
}
|
||||
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx);
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size());
|
||||
}
|
||||
Instruction *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return GetElementPtrInst::CreateInBounds(C, IdxList, IdxList+NumIdx);
|
||||
Instruction *CreateInBoundsGetElementPtr(Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return GetElementPtrInst::CreateInBounds(C, IdxList.begin(), IdxList.end());
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -130,22 +130,32 @@ public:
|
||||
// Memory Instructions
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx));
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return Fold(ConstantExpr::getGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size()));
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx));
|
||||
Constant *CreateGetElementPtr(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(C, &Idx, 1));
|
||||
}
|
||||
Constant *CreateGetElementPtr(Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return Fold(ConstantExpr::getGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size()));
|
||||
}
|
||||
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx));
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
ArrayRef<Constant *> IdxList) const {
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size()));
|
||||
}
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList,
|
||||
unsigned NumIdx) const {
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx));
|
||||
Constant *CreateInBoundsGetElementPtr(Constant *C,
|
||||
ArrayRef<Value *> IdxList) const {
|
||||
return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
|
||||
IdxList.size()));
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
Loading…
x
Reference in New Issue
Block a user