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.

100 lines
3.2 KiB

  1. //===-- llvm/Argument.h - Definition of the Argument class ------*- 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 declares the Argument class.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_IR_ARGUMENT_H
  14. #define LLVM_IR_ARGUMENT_H
  15. #include "llvm/ADT/Twine.h"
  16. #include "llvm/ADT/ilist_node.h"
  17. #include "llvm/IR/Attributes.h"
  18. #include "llvm/IR/Value.h"
  19. namespace llvm {
  20. template<typename ValueSubClass, typename ItemParentClass>
  21. class SymbolTableListTraits;
  22. /// \brief LLVM Argument representation
  23. ///
  24. /// This class represents an incoming formal argument to a Function. A formal
  25. /// argument, since it is ``formal'', does not contain an actual value but
  26. /// instead represents the type, argument number, and attributes of an argument
  27. /// for a specific function. When used in the body of said function, the
  28. /// argument of course represents the value of the actual argument that the
  29. /// function was called with.
  30. class Argument : public Value, public ilist_node<Argument> {
  31. virtual void anchor();
  32. Function *Parent;
  33. friend class SymbolTableListTraits<Argument, Function>;
  34. void setParent(Function *parent);
  35. public:
  36. /// \brief Constructor.
  37. ///
  38. /// If \p F is specified, the argument is inserted at the end of the argument
  39. /// list for \p F.
  40. explicit Argument(Type *Ty, const Twine &Name = "", Function *F = 0);
  41. inline const Function *getParent() const { return Parent; }
  42. inline Function *getParent() { return Parent; }
  43. /// \brief Return the index of this formal argument in its containing
  44. /// function.
  45. ///
  46. /// For example in "void foo(int a, float b)" a is 0 and b is 1.
  47. unsigned getArgNo() const;
  48. /// \brief Return true if this argument has the byval attribute on it in its
  49. /// containing function.
  50. bool hasByValAttr() const;
  51. /// \brief If this is a byval argument, return its alignment.
  52. unsigned getParamAlignment() const;
  53. /// \brief Return true if this argument has the nest attribute on it in its
  54. /// containing function.
  55. bool hasNestAttr() const;
  56. /// \brief Return true if this argument has the noalias attribute on it in its
  57. /// containing function.
  58. bool hasNoAliasAttr() const;
  59. /// \brief Return true if this argument has the nocapture attribute on it in
  60. /// its containing function.
  61. bool hasNoCaptureAttr() const;
  62. /// \brief Return true if this argument has the sret attribute on it in its
  63. /// containing function.
  64. bool hasStructRetAttr() const;
  65. /// \brief Return true if this argument has the returned attribute on it in
  66. /// its containing function.
  67. bool hasReturnedAttr() const;
  68. /// \brief Add a Attribute to an argument.
  69. void addAttr(AttributeSet AS);
  70. /// \brief Remove a Attribute from an argument.
  71. void removeAttr(AttributeSet AS);
  72. /// \brief Method for support type inquiry through isa, cast, and
  73. /// dyn_cast.
  74. static inline bool classof(const Value *V) {
  75. return V->getValueID() == ArgumentVal;
  76. }
  77. };
  78. } // End llvm namespace
  79. #endif