Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.8 KiB

  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. #ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
  14. #define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
  15. #include "llvm/IR/Value.h"
  16. namespace llvm {
  17. class MachineFrameInfo;
  18. class raw_ostream;
  19. /// PseudoSourceValue - Special value supplied for machine level alias
  20. /// analysis. It indicates that a memory access references the functions
  21. /// stack frame (e.g., a spill slot), below the stack frame (e.g., argument
  22. /// space), or constant pool.
  23. class PseudoSourceValue : public Value {
  24. private:
  25. /// printCustom - Implement printing for PseudoSourceValue. This is called
  26. /// from Value::print or Value's operator<<.
  27. ///
  28. virtual void printCustom(raw_ostream &O) const;
  29. public:
  30. explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
  31. /// isConstant - Test whether the memory pointed to by this
  32. /// PseudoSourceValue has a constant value.
  33. ///
  34. virtual bool isConstant(const MachineFrameInfo *) const;
  35. /// isAliased - Test whether the memory pointed to by this
  36. /// PseudoSourceValue may also be pointed to by an LLVM IR Value.
  37. virtual bool isAliased(const MachineFrameInfo *) const;
  38. /// mayAlias - Return true if the memory pointed to by this
  39. /// PseudoSourceValue can ever alias a LLVM IR Value.
  40. virtual bool mayAlias(const MachineFrameInfo *) const;
  41. /// classof - Methods for support type inquiry through isa, cast, and
  42. /// dyn_cast:
  43. ///
  44. static inline bool classof(const Value *V) {
  45. return V->getValueID() == PseudoSourceValueVal ||
  46. V->getValueID() == FixedStackPseudoSourceValueVal;
  47. }
  48. /// A pseudo source value referencing a fixed stack frame entry,
  49. /// e.g., a spill slot.
  50. static const PseudoSourceValue *getFixedStack(int FI);
  51. /// A pseudo source value referencing the area below the stack frame of
  52. /// a function, e.g., the argument space.
  53. static const PseudoSourceValue *getStack();
  54. /// A pseudo source value referencing the global offset table
  55. /// (or something the like).
  56. static const PseudoSourceValue *getGOT();
  57. /// A pseudo source value referencing the constant pool. Since constant
  58. /// pools are constant, this doesn't need to identify a specific constant
  59. /// pool entry.
  60. static const PseudoSourceValue *getConstantPool();
  61. /// A pseudo source value referencing a jump table. Since jump tables are
  62. /// constant, this doesn't need to identify a specific jump table.
  63. static const PseudoSourceValue *getJumpTable();
  64. };
  65. /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
  66. /// for holding FixedStack values, which must include a frame
  67. /// index.
  68. class FixedStackPseudoSourceValue : public PseudoSourceValue {
  69. const int FI;
  70. public:
  71. explicit FixedStackPseudoSourceValue(int fi) :
  72. PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
  73. /// classof - Methods for support type inquiry through isa, cast, and
  74. /// dyn_cast:
  75. ///
  76. static inline bool classof(const Value *V) {
  77. return V->getValueID() == FixedStackPseudoSourceValueVal;
  78. }
  79. virtual bool isConstant(const MachineFrameInfo *MFI) const;
  80. virtual bool isAliased(const MachineFrameInfo *MFI) const;
  81. virtual bool mayAlias(const MachineFrameInfo *) const;
  82. virtual void printCustom(raw_ostream &OS) const;
  83. int getFrameIndex() const { return FI; }
  84. };
  85. } // End llvm namespace
  86. #endif