diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-04-15 07:22:52 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-04-15 07:22:52 +0000 |
commit | d63390cba15f10600d550201f2e9109e75933a0f (patch) | |
tree | 4eea1fced6d7f4971d6a10c25aa0c498bc90f5a1 /include/llvm/CodeGen/MachineMemOperand.h | |
parent | 095734c578c74f6d1b1fcbdc4d4264a059cdb9ee (diff) | |
download | llvm-d63390cba15f10600d550201f2e9109e75933a0f.tar.gz llvm-d63390cba15f10600d550201f2e9109e75933a0f.tar.bz2 llvm-d63390cba15f10600d550201f2e9109e75933a0f.tar.xz |
Break PseudoSourceValue out of the Value hierarchy. It is now the root of its own tree containing FixedStackPseudoSourceValue (which you can use isa/dyn_cast on) and MipsCallEntry (which you can't). Anything that needs to use either a PseudoSourceValue* and Value* is strongly encouraged to use a MachinePointerInfo instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206255 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineMemOperand.h')
-rw-r--r-- | include/llvm/CodeGen/MachineMemOperand.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index 68b749a56f..2532c16271 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -16,11 +16,13 @@ #ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H #define LLVM_CODEGEN_MACHINEMEMOPERAND_H +#include "llvm/ADT/PointerUnion.h" +#include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/IR/Value.h" // PointerLikeTypeTraits<Value*> #include "llvm/Support/DataTypes.h" namespace llvm { -class Value; class FoldingSetNodeID; class MDNode; class raw_ostream; @@ -33,7 +35,7 @@ struct MachinePointerInfo { /// V - This is the IR pointer value for the access, or it is null if unknown. /// If this is null, then the access is to a pointer in the default address /// space. - const Value *V; + PointerUnion<const Value *, const PseudoSourceValue *> V; /// Offset - This is an offset from the base Value*. int64_t Offset; @@ -41,9 +43,15 @@ struct MachinePointerInfo { explicit MachinePointerInfo(const Value *v = nullptr, int64_t offset = 0) : V(v), Offset(offset) {} + explicit MachinePointerInfo(const PseudoSourceValue *v, + int64_t offset = 0) + : V(v), Offset(offset) {} + MachinePointerInfo getWithOffset(int64_t O) const { - if (V == nullptr) return MachinePointerInfo(nullptr, 0); - return MachinePointerInfo(V, Offset+O); + if (V.isNull()) return MachinePointerInfo(); + if (V.is<const Value*>()) + return MachinePointerInfo(V.get<const Value*>(), Offset+O); + return MachinePointerInfo(V.get<const PseudoSourceValue*>(), Offset+O); } /// getAddrSpace - Return the LLVM IR address space number that this pointer @@ -121,7 +129,13 @@ public: /// other PseudoSourceValue member functions which return objects which stand /// for frame/stack pointer relative references and other special references /// which are not representable in the high-level IR. - const Value *getValue() const { return PtrInfo.V; } + const Value *getValue() const { return PtrInfo.V.dyn_cast<const Value*>(); } + + const PseudoSourceValue *getPseudoValue() const { + return PtrInfo.V.dyn_cast<const PseudoSourceValue*>(); + } + + const void *getOpaqueValue() const { return PtrInfo.V.getOpaqueValue(); } /// getFlags - Return the raw flags of the source value, \see MemOperandFlags. unsigned int getFlags() const { return Flags & ((1 << MOMaxBits) - 1); } @@ -177,6 +191,7 @@ public: /// should only be used when an object is being relocated and all references /// to it are being updated. void setValue(const Value *NewSV) { PtrInfo.V = NewSV; } + void setValue(const PseudoSourceValue *NewSV) { PtrInfo.V = NewSV; } void setOffset(int64_t NewOffset) { PtrInfo.Offset = NewOffset; } /// Profile - Gather unique data for the object. |