Merging the linear scan register allocator in trunk. It currently passes most tests...
[oota-llvm.git] / include / llvm / Argument.h
1 //===-- llvm/Argument.h - Definition of the Argument class ------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the Argument class, which represents an incoming formal
11 // argument to a Function.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_ARGUMENT_H
16 #define LLVM_ARGUMENT_H
17
18 #include "llvm/Value.h"
19
20 namespace llvm {
21
22 class Argument : public Value {  // Defined in the Function.cpp file
23   Function *Parent;
24
25   Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
26   void setNext(Argument *N) { Next = N; }
27   void setPrev(Argument *N) { Prev = N; }
28   friend class SymbolTableListTraits<Argument, Function, Function,
29                                      ilist_traits<Argument> >;
30   void setParent(Function *parent);
31
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   Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
37
38   /// setName - Specialize setName to handle symbol table majik...
39   virtual void setName(const std::string &name, SymbolTable *ST = 0);
40
41   inline const Function *getParent() const { return Parent; }
42   inline       Function *getParent()       { return Parent; }
43  
44   // getNext/Prev - Return the next or previous argument in the list.
45         Argument *getNext()       { return Next; }
46   const Argument *getNext() const { return Next; }
47         Argument *getPrev()       { return Prev; }
48   const Argument *getPrev() const { return Prev; }
49
50   virtual void print(std::ostream &OS) const;
51
52   /// classof - Methods for support type inquiry through isa, cast, and
53   /// dyn_cast:
54   ///
55   static inline bool classof(const Argument *) { return true; }
56   static inline bool classof(const Value *V) {
57     return V->getValueType() == ArgumentVal;
58   }
59 };
60
61 } // End llvm namespace
62
63 #endif