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;
21 class MachineMemOperand;
24 raw_ostream &operator<<(raw_ostream &OS, const MachineMemOperand &MMO);
26 /// PseudoSourceValue - Special value supplied for machine level alias
27 /// analysis. It indicates that a memory access references the functions
28 /// stack frame (e.g., a spill slot), below the stack frame (e.g., argument
29 /// space), or constant pool.
30 class PseudoSourceValue {
32 friend raw_ostream &llvm::operator<<(raw_ostream &OS,
33 const MachineMemOperand &MMO);
35 /// printCustom - Implement printing for PseudoSourceValue. This is called
36 /// from Value::print or Value's operator<<.
38 virtual void printCustom(raw_ostream &O) const;
41 /// isFixed - Whether this is a FixedStackPseudoSourceValue.
44 explicit PseudoSourceValue(bool isFixed = false);
46 virtual ~PseudoSourceValue();
48 /// isConstant - Test whether the memory pointed to by this
49 /// PseudoSourceValue has a constant value.
51 virtual bool isConstant(const MachineFrameInfo *) const;
53 /// isAliased - Test whether the memory pointed to by this
54 /// PseudoSourceValue may also be pointed to by an LLVM IR Value.
55 virtual bool isAliased(const MachineFrameInfo *) const;
57 /// mayAlias - Return true if the memory pointed to by this
58 /// PseudoSourceValue can ever alias an LLVM IR Value.
59 virtual bool mayAlias(const MachineFrameInfo *) const;
61 /// A pseudo source value referencing a fixed stack frame entry,
62 /// e.g., a spill slot.
63 static const PseudoSourceValue *getFixedStack(int FI);
65 /// A pseudo source value referencing the area below the stack frame of
66 /// a function, e.g., the argument space.
67 static const PseudoSourceValue *getStack();
69 /// A pseudo source value referencing the global offset table
70 /// (or something the like).
71 static const PseudoSourceValue *getGOT();
73 /// A pseudo source value referencing the constant pool. Since constant
74 /// pools are constant, this doesn't need to identify a specific constant
76 static const PseudoSourceValue *getConstantPool();
78 /// A pseudo source value referencing a jump table. Since jump tables are
79 /// constant, this doesn't need to identify a specific jump table.
80 static const PseudoSourceValue *getJumpTable();
83 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
84 /// for holding FixedStack values, which must include a frame
86 class FixedStackPseudoSourceValue : public PseudoSourceValue {
89 explicit FixedStackPseudoSourceValue(int fi) :
90 PseudoSourceValue(true), FI(fi) {}
92 /// classof - Methods for support type inquiry through isa, cast, and
95 static inline bool classof(const PseudoSourceValue *V) {
96 return V->isFixed == true;
99 bool isConstant(const MachineFrameInfo *MFI) const override;
101 bool isAliased(const MachineFrameInfo *MFI) const override;
103 bool mayAlias(const MachineFrameInfo *) const override;
105 void printCustom(raw_ostream &OS) const override;
107 int getFrameIndex() const { return FI; }
109 } // End llvm namespace