mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
add a GEP helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36515 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -442,6 +442,12 @@ public:
|
|||||||
/// value, just potentially different types.
|
/// value, just potentially different types.
|
||||||
bool hasAllZeroIndices() const;
|
bool hasAllZeroIndices() const;
|
||||||
|
|
||||||
|
/// hasAllConstantIndices - Return true if all of the indices of this GEP are
|
||||||
|
/// constant integers. If so, the result pointer and the first operand have
|
||||||
|
/// a constant offset between them.
|
||||||
|
bool hasAllConstantIndices() const;
|
||||||
|
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const GetElementPtrInst *) { return true; }
|
static inline bool classof(const GetElementPtrInst *) { return true; }
|
||||||
static inline bool classof(const Instruction *I) {
|
static inline bool classof(const Instruction *I) {
|
||||||
|
@@ -1043,6 +1043,17 @@ bool GetElementPtrInst::hasAllZeroIndices() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// hasAllConstantIndices - Return true if all of the indices of this GEP are
|
||||||
|
/// constant integers. If so, the result pointer and the first operand have
|
||||||
|
/// a constant offset between them.
|
||||||
|
bool GetElementPtrInst::hasAllConstantIndices() const {
|
||||||
|
for (unsigned i = 1, e = getNumOperands(); i != e; ++i) {
|
||||||
|
if (!isa<ConstantInt>(getOperand(i)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ExtractElementInst Implementation
|
// ExtractElementInst Implementation
|
||||||
|
Reference in New Issue
Block a user