mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of VMCore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -346,27 +346,6 @@ Value *Value::stripPointerCasts() {
|
||||
return V;
|
||||
}
|
||||
|
||||
Value *Value::getUnderlyingObject(unsigned MaxLookup) {
|
||||
if (!getType()->isPointerTy())
|
||||
return this;
|
||||
Value *V = this;
|
||||
for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) {
|
||||
if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
|
||||
V = GEP->getPointerOperand();
|
||||
} else if (Operator::getOpcode(V) == Instruction::BitCast) {
|
||||
V = cast<Operator>(V)->getOperand(0);
|
||||
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
|
||||
if (GA->mayBeOverridden())
|
||||
return V;
|
||||
V = GA->getAliasee();
|
||||
} else {
|
||||
return V;
|
||||
}
|
||||
assert(V->getType()->isPointerTy() && "Unexpected operand type!");
|
||||
}
|
||||
return V;
|
||||
}
|
||||
|
||||
/// isDereferenceablePointer - Test if this value is always a pointer to
|
||||
/// allocated and suitably aligned memory for a simple load or store.
|
||||
bool Value::isDereferenceablePointer() const {
|
||||
|
||||
Reference in New Issue
Block a user