LLVM  3.7.0
PseudoSourceValue.h
Go to the documentation of this file.
1 //===-- llvm/CodeGen/PseudoSourceValue.h ------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the PseudoSourceValue class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
15 #define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
16 
17 #include "llvm/IR/Value.h"
18 
19 namespace llvm {
20  class MachineFrameInfo;
21  class MachineMemOperand;
22  class raw_ostream;
23 
24  raw_ostream &operator<<(raw_ostream &OS, const MachineMemOperand &MMO);
25 
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.
31  private:
32  friend class MachineMemOperand; // For printCustom().
33 
34  /// printCustom - Implement printing for PseudoSourceValue. This is called
35  /// from Value::print or Value's operator<<.
36  ///
37  virtual void printCustom(raw_ostream &O) const;
38 
39  public:
40  /// isFixed - Whether this is a FixedStackPseudoSourceValue.
41  bool isFixed;
42 
43  explicit PseudoSourceValue(bool isFixed = false);
44 
45  virtual ~PseudoSourceValue();
46 
47  /// isConstant - Test whether the memory pointed to by this
48  /// PseudoSourceValue has a constant value.
49  ///
50  virtual bool isConstant(const MachineFrameInfo *) const;
51 
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;
55 
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;
59 
60  /// A pseudo source value referencing a fixed stack frame entry,
61  /// e.g., a spill slot.
62  static const PseudoSourceValue *getFixedStack(int FI);
63 
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();
67 
68  /// A pseudo source value referencing the global offset table
69  /// (or something the like).
70  static const PseudoSourceValue *getGOT();
71 
72  /// A pseudo source value referencing the constant pool. Since constant
73  /// pools are constant, this doesn't need to identify a specific constant
74  /// pool entry.
75  static const PseudoSourceValue *getConstantPool();
76 
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();
80  };
81 
82  /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
83  /// for holding FixedStack values, which must include a frame
84  /// index.
86  const int FI;
87  public:
88  explicit FixedStackPseudoSourceValue(int fi) :
89  PseudoSourceValue(true), FI(fi) {}
90 
91  /// classof - Methods for support type inquiry through isa, cast, and
92  /// dyn_cast:
93  ///
94  static inline bool classof(const PseudoSourceValue *V) {
95  return V->isFixed == true;
96  }
97 
98  bool isConstant(const MachineFrameInfo *MFI) const override;
99 
100  bool isAliased(const MachineFrameInfo *MFI) const override;
101 
102  bool mayAlias(const MachineFrameInfo *) const override;
103 
104  void printCustom(raw_ostream &OS) const override;
105 
106  int getFrameIndex() const { return FI; }
107  };
108 } // End llvm namespace
109 
110 #endif
static const PseudoSourceValue * getConstantPool()
A pseudo source value referencing the constant pool.
bool isFixed
isFixed - Whether this is a FixedStackPseudoSourceValue.
static const PseudoSourceValue * getJumpTable()
A pseudo source value referencing a jump table.
MachineMemOperand - A description of a memory reference used in the backend.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
static const PseudoSourceValue * getFixedStack(int FI)
A pseudo source value referencing a fixed stack frame entry, e.g., a spill slot.
bool isConstant(const MachineFrameInfo *MFI) const override
isConstant - Test whether the memory pointed to by this PseudoSourceValue has a constant value...
bool mayAlias(const MachineFrameInfo *) const override
mayAlias - Return true if the memory pointed to by this PseudoSourceValue can ever alias an LLVM IR V...
virtual bool mayAlias(const MachineFrameInfo *) const
mayAlias - Return true if the memory pointed to by this PseudoSourceValue can ever alias an LLVM IR V...
#define true
Definition: ConvertUTF.c:66
virtual bool isConstant(const MachineFrameInfo *) const
isConstant - Test whether the memory pointed to by this PseudoSourceValue has a constant value...
static bool classof(const PseudoSourceValue *V)
classof - Methods for support type inquiry through isa, cast, and dyn_cast:
static const PseudoSourceValue * getGOT()
A pseudo source value referencing the global offset table (or something the like).
static const PseudoSourceValue * getStack()
A pseudo source value referencing the area below the stack frame of a function, e.g., the argument space.
PseudoSourceValue - Special value supplied for machine level alias analysis.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:1738
bool isAliased(const MachineFrameInfo *MFI) const override
isAliased - Test whether the memory pointed to by this PseudoSourceValue may also be pointed to by an...
void printCustom(raw_ostream &OS) const override
printCustom - Implement printing for PseudoSourceValue.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
FixedStackPseudoSourceValue - A specialized PseudoSourceValue for holding FixedStack values...
PseudoSourceValue(bool isFixed=false)
virtual bool isAliased(const MachineFrameInfo *) const
isAliased - Test whether the memory pointed to by this PseudoSourceValue may also be pointed to by an...