1 //===-- llvm/CodeGen/PseudoSourceValue.h ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declaration of the PseudoSourceValue class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
15 #define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
17 #include "llvm/IR/Value.h"
20 class MachineFrameInfo;
23 /// PseudoSourceValue - Special value supplied for machine level alias
24 /// analysis. It indicates that a memory access references the functions
25 /// stack frame (e.g., a spill slot), below the stack frame (e.g., argument
26 /// space), or constant pool.
27 class PseudoSourceValue : public Value {
29 /// printCustom - Implement printing for PseudoSourceValue. This is called
30 /// from Value::print or Value's operator<<.
32 virtual void printCustom(raw_ostream &O) const;
35 explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
37 /// isConstant - Test whether the memory pointed to by this
38 /// PseudoSourceValue has a constant value.
40 virtual bool isConstant(const MachineFrameInfo *) const;
42 /// isAliased - Test whether the memory pointed to by this
43 /// PseudoSourceValue may also be pointed to by an LLVM IR Value.
44 virtual bool isAliased(const MachineFrameInfo *) const;
46 /// mayAlias - Return true if the memory pointed to by this
47 /// PseudoSourceValue can ever alias an LLVM IR Value.
48 virtual bool mayAlias(const MachineFrameInfo *) const;
50 /// classof - Methods for support type inquiry through isa, cast, and
53 static inline bool classof(const Value *V) {
54 return V->getValueID() == PseudoSourceValueVal ||
55 V->getValueID() == FixedStackPseudoSourceValueVal;
58 /// A pseudo source value referencing a fixed stack frame entry,
59 /// e.g., a spill slot.
60 static const PseudoSourceValue *getFixedStack(int FI);
62 /// A pseudo source value referencing the area below the stack frame of
63 /// a function, e.g., the argument space.
64 static const PseudoSourceValue *getStack();
66 /// A pseudo source value referencing the global offset table
67 /// (or something the like).
68 static const PseudoSourceValue *getGOT();
70 /// A pseudo source value referencing the constant pool. Since constant
71 /// pools are constant, this doesn't need to identify a specific constant
73 static const PseudoSourceValue *getConstantPool();
75 /// A pseudo source value referencing a jump table. Since jump tables are
76 /// constant, this doesn't need to identify a specific jump table.
77 static const PseudoSourceValue *getJumpTable();
80 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
81 /// for holding FixedStack values, which must include a frame
83 class FixedStackPseudoSourceValue : public PseudoSourceValue {
86 explicit FixedStackPseudoSourceValue(int fi) :
87 PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
89 /// classof - Methods for support type inquiry through isa, cast, and
92 static inline bool classof(const Value *V) {
93 return V->getValueID() == FixedStackPseudoSourceValueVal;
96 virtual bool isConstant(const MachineFrameInfo *MFI) const;
98 virtual bool isAliased(const MachineFrameInfo *MFI) const;
100 virtual bool mayAlias(const MachineFrameInfo *) const;
102 virtual void printCustom(raw_ostream &OS) const;
104 int getFrameIndex() const { return FI; }
106 } // End llvm namespace