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 class MachineMemOperand; // For printCustom().
34 /// printCustom - Implement printing for PseudoSourceValue. This is called
35 /// from Value::print or Value's operator<<.
37 virtual void printCustom(raw_ostream &O) const;
40 /// isFixed - Whether this is a FixedStackPseudoSourceValue.
43 explicit PseudoSourceValue(bool isFixed = false);
45 virtual ~PseudoSourceValue();
47 /// isConstant - Test whether the memory pointed to by this
48 /// PseudoSourceValue has a constant value.
50 virtual bool isConstant(const MachineFrameInfo *) const;
52 /// isAliased - Test whether the memory pointed to by this
53 /// PseudoSourceValue may also be pointed to by an LLVM IR Value.
54 virtual bool isAliased(const MachineFrameInfo *) const;
56 /// mayAlias - Return true if the memory pointed to by this
57 /// PseudoSourceValue can ever alias an LLVM IR Value.
58 virtual bool mayAlias(const MachineFrameInfo *) const;
60 /// A pseudo source value referencing a fixed stack frame entry,
61 /// e.g., a spill slot.
62 static const PseudoSourceValue *getFixedStack(int FI);
64 /// A pseudo source value referencing the area below the stack frame of
65 /// a function, e.g., the argument space.
66 static const PseudoSourceValue *getStack();
68 /// A pseudo source value referencing the global offset table
69 /// (or something the like).
70 static const PseudoSourceValue *getGOT();
72 /// A pseudo source value referencing the constant pool. Since constant
73 /// pools are constant, this doesn't need to identify a specific constant
75 static const PseudoSourceValue *getConstantPool();
77 /// A pseudo source value referencing a jump table. Since jump tables are
78 /// constant, this doesn't need to identify a specific jump table.
79 static const PseudoSourceValue *getJumpTable();
82 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
83 /// for holding FixedStack values, which must include a frame
85 class FixedStackPseudoSourceValue : public PseudoSourceValue {
88 explicit FixedStackPseudoSourceValue(int fi) :
89 PseudoSourceValue(true), FI(fi) {}
91 /// classof - Methods for support type inquiry through isa, cast, and
94 static inline bool classof(const PseudoSourceValue *V) {
95 return V->isFixed == true;
98 bool isConstant(const MachineFrameInfo *MFI) const override;
100 bool isAliased(const MachineFrameInfo *MFI) const override;
102 bool mayAlias(const MachineFrameInfo *) const override;
104 void printCustom(raw_ostream &OS) const override;
106 int getFrameIndex() const { return FI; }
108 } // End llvm namespace