llvm.org GIT mirror llvm / cf62632
Make FixedStackPseudoSourceValue a first-class PseudoSourceValue by making it visible to clients and adding LLVM-style cast capability. This will be used by AsmPrinter to determine when to emit spill comments for an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87019 91177308-0d34-0410-b5e6-96231b3b80d8 David Greene 10 years ago
2 changed file(s) with 36 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
1414 #define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
1515
1616 #include "llvm/Value.h"
17 #include "llvm/Support/raw_ostream.h"
1718
1819 namespace llvm {
1920 class MachineFrameInfo;
3132 virtual void printCustom(raw_ostream &O) const;
3233
3334 public:
34 PseudoSourceValue();
35 PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
3536
3637 /// isConstant - Test whether the memory pointed to by this
3738 /// PseudoSourceValue has a constant value.
7576 /// constant, this doesn't need to identify a specific jump table.
7677 static const PseudoSourceValue *getJumpTable();
7778 };
79
80 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
81 /// for holding FixedStack values, which must include a frame
82 /// index.
83 class FixedStackPseudoSourceValue : public PseudoSourceValue {
84 const int FI;
85 public:
86 explicit FixedStackPseudoSourceValue(int fi) :
87 PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
88
89 /// classof - Methods for support type inquiry through isa, cast, and
90 /// dyn_cast:
91 ///
92 static inline bool classof(const FixedStackPseudoSourceValue *) {
93 return true;
94 }
95 static inline bool classof(const Value *V) {
96 return V->getValueID() == FixedStackPseudoSourceValueVal;
97 }
98
99 virtual bool isConstant(const MachineFrameInfo *MFI) const;
100
101 virtual bool isAliased(const MachineFrameInfo *MFI) const;
102
103 virtual bool mayAlias(const MachineFrameInfo *) const;
104
105 virtual void printCustom(raw_ostream &OS) const {
106 OS << "FixedStack" << FI;
107 }
108
109 int getFrameIndex(void) const { return FI; }
110 };
78111 } // End llvm namespace
79112
80113 #endif
4242 // Eventually these should be uniqued on LLVMContext rather than in a managed
4343 // static. For now, we can safely use the global context for the time being to
4444 // squeak by.
45 PseudoSourceValue::PseudoSourceValue() :
45 PseudoSourceValue::PseudoSourceValue(enum ValueTy Subclass) :
4646 Value(Type::getInt8PtrTy(getGlobalContext()),
47 PseudoSourceValueVal) {}
47 Subclass) {}
4848
4949 void PseudoSourceValue::printCustom(raw_ostream &O) const {
5050 O << PSVNames[this - *PSVs];
51 }
52
53 namespace {
54 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
55 /// for holding FixedStack values, which must include a frame
56 /// index.
57 class FixedStackPseudoSourceValue : public PseudoSourceValue {
58 const int FI;
59 public:
60 explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {}
61
62 virtual bool isConstant(const MachineFrameInfo *MFI) const;
63
64 virtual bool isAliased(const MachineFrameInfo *MFI) const;
65
66 virtual bool mayAlias(const MachineFrameInfo *) const;
67
68 virtual void printCustom(raw_ostream &OS) const {
69 OS << "FixedStack" << FI;
70 }
71 };
7251 }
7352
7453 static ManagedStatic > FSValues;