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.

92 lines
3.0 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_ARGUMENT_H
  14. #define LLVM_ARGUMENT_H
  15. #include "llvm/Value.h"
  16. #include "llvm/Attributes.h"
  17. #include "llvm/ADT/ilist_node.h"
  18. #include "llvm/ADT/Twine.h"
  19. namespace llvm {
  20. template<typename ValueSubClass, typename ItemParentClass>
  21. class SymbolTableListTraits;
  22. /// A class to represent an incoming formal argument to a Function. An argument
  23. /// is a very simple Value. It is essentially a named (optional) type. When used
  24. /// in the body of a function, it represents the value of the actual argument
  25. /// the function was called with.
  26. /// @brief LLVM Argument representation
  27. class Argument : public Value, public ilist_node<Argument> {
  28. virtual void anchor();
  29. Function *Parent;
  30. friend class SymbolTableListTraits<Argument, Function>;
  31. void setParent(Function *parent);
  32. public:
  33. /// Argument ctor - If Function argument is specified, this argument is
  34. /// inserted at the end of the argument list for the function.
  35. ///
  36. explicit Argument(Type *Ty, const Twine &Name = "", Function *F = 0);
  37. inline const Function *getParent() const { return Parent; }
  38. inline Function *getParent() { return Parent; }
  39. /// getArgNo - Return the index of this formal argument in its containing
  40. /// function. For example in "void foo(int a, float b)" a is 0 and b is 1.
  41. unsigned getArgNo() const;
  42. /// hasByValAttr - Return true if this argument has the byval attribute on it
  43. /// in its containing function.
  44. bool hasByValAttr() const;
  45. /// getParamAlignment - If this is a byval argument, return its alignment.
  46. unsigned getParamAlignment() const;
  47. /// hasNestAttr - Return true if this argument has the nest attribute on
  48. /// it in its containing function.
  49. bool hasNestAttr() const;
  50. /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
  51. /// it in its containing function.
  52. bool hasNoAliasAttr() const;
  53. /// hasNoCaptureAttr - Return true if this argument has the nocapture
  54. /// attribute on it in its containing function.
  55. bool hasNoCaptureAttr() const;
  56. /// hasStructRetAttr - Return true if this argument has the sret attribute on
  57. /// it in its containing function.
  58. bool hasStructRetAttr() const;
  59. /// addAttr - Add a Attribute to an argument
  60. void addAttr(Attributes);
  61. /// removeAttr - Remove a Attribute from an argument
  62. void removeAttr(Attributes);
  63. /// classof - Methods for support type inquiry through isa, cast, and
  64. /// dyn_cast:
  65. ///
  66. static inline bool classof(const Argument *) { return true; }
  67. static inline bool classof(const Value *V) {
  68. return V->getValueID() == ArgumentVal;
  69. }
  70. };
  71. } // End llvm namespace
  72. #endif