mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the logic in Value::getUnderlyingObject. The difference with stripPointerCasts is that stripPointerCasts only strips GEPs if all indices are zero, while getUnderlyingObject strips GEPs no matter what the indices are. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -228,11 +228,20 @@ public:
|
||||
|
||||
/// stripPointerCasts - This method strips off any unneeded pointer
|
||||
/// casts from the specified value, returning the original uncasted value.
|
||||
/// Note that the returned value is guaranteed to have pointer type.
|
||||
/// Note that the returned value has pointer type if the specified value does.
|
||||
Value *stripPointerCasts();
|
||||
const Value *stripPointerCasts() const {
|
||||
return const_cast<Value*>(this)->stripPointerCasts();
|
||||
}
|
||||
|
||||
/// getUnderlyingObject - This method strips off any GEP address adjustments
|
||||
/// and pointer casts from the specified value, returning the original object
|
||||
/// being addressed. Note that the returned value has pointer type if the
|
||||
/// specified value does.
|
||||
Value *getUnderlyingObject();
|
||||
const Value *getUnderlyingObject() const {
|
||||
return const_cast<Value*>(this)->getUnderlyingObject();
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &OS, const Value &V) {
|
||||
|
Reference in New Issue
Block a user