6c2458d9d08138f97c5ac172aa0202c494309ce6
[oota-llvm.git] / include / llvm / Argument.h
1 //===-- llvm/Argument.h - Definition of the Argument class -------*- C++ -*--=//
2 //
3 // This file defines the Argument class, which represents and incoming formal
4 // argument to a function.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef LLVM_ARGUMENT_H
9 #define LLVM_ARGUMENT_H
10
11 #include "llvm/Value.h"
12
13 class Argument : public Value {  // Defined in the InstrType.cpp file
14   Function *Parent;
15
16   Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
17   void setNext(Argument *N) { Next = N; }
18   void setPrev(Argument *N) { Prev = N; }
19   friend class SymbolTableListTraits<Argument, Function, Function>;
20   inline void setParent(Function *parent) { Parent = parent; }
21
22 public:
23   Argument(const Type *Ty, const std::string &Name = "") 
24     : Value(Ty, Value::ArgumentVal, Name) {
25     Parent = 0;
26   }
27
28   // Specialize setName to handle symbol table majik...
29   virtual void setName(const std::string &name, SymbolTable *ST = 0);
30
31   inline const Function *getParent() const { return Parent; }
32   inline       Function *getParent()       { return Parent; }
33  
34   // getNext/Prev - Return the next or previous argument in the list.
35         Argument *getNext()       { return Next; }
36   const Argument *getNext() const { return Next; }
37         Argument *getPrev()       { return Prev; }
38   const Argument *getPrev() const { return Prev; }
39
40   virtual void print(std::ostream &OS) const;
41
42   // Methods for support type inquiry through isa, cast, and dyn_cast:
43   static inline bool classof(const Argument *) { return true; }
44   static inline bool classof(const Value *V) {
45     return V->getValueType() == ArgumentVal;
46   }
47 };
48
49 #endif