mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Add new function getPtrPtrFromArrayPtr().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20684 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -562,6 +562,10 @@ public:
|
|||||||
///
|
///
|
||||||
static Constant *getSizeOf(const Type *Ty);
|
static Constant *getSizeOf(const Type *Ty);
|
||||||
|
|
||||||
|
/// getPtrPtrFromArrayPtr constant expr - given a pointer to a constant array,
|
||||||
|
/// return a pointer to a pointer of the array element type.
|
||||||
|
static Constant *getPtrPtrFromArrayPtr(Constant *C);
|
||||||
|
|
||||||
/// ConstantExpr::get - Return a binary or shift operator constant expression,
|
/// ConstantExpr::get - Return a binary or shift operator constant expression,
|
||||||
/// folding if possible.
|
/// folding if possible.
|
||||||
///
|
///
|
||||||
|
@@ -1298,6 +1298,13 @@ Constant *ConstantExpr::getSizeOf(const Type *Ty) {
|
|||||||
Type::ULongTy);
|
Type::ULongTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Constant *ConstantExpr::getPtrPtrFromArrayPtr(Constant *C) {
|
||||||
|
// pointer from array is implemented as: getelementptr arr ptr, 0, 0
|
||||||
|
static std::vector<Constant*> Indices(2, ConstantUInt::get(Type::UIntTy, 0));
|
||||||
|
|
||||||
|
return ConstantExpr::getGetElementPtr(C, Indices);
|
||||||
|
}
|
||||||
|
|
||||||
Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode,
|
Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode,
|
||||||
Constant *C1, Constant *C2) {
|
Constant *C1, Constant *C2) {
|
||||||
if (Opcode == Instruction::Shl || Opcode == Instruction::Shr)
|
if (Opcode == Instruction::Shl || Opcode == Instruction::Shr)
|
||||||
|
Reference in New Issue
Block a user