LLVM API Documentation

Argument.h

Go to the documentation of this file.
00001 //===-- llvm/Argument.h - Definition of the Argument class ------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by the LLVM research group and is distributed under
00006 // the University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares the Argument class. 
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_ARGUMENT_H
00015 #define LLVM_ARGUMENT_H
00016 
00017 #include "llvm/Value.h"
00018 
00019 namespace llvm {
00020 
00021 template<typename SC> struct ilist_traits;
00022 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
00023          typename SubClass> class SymbolTableListTraits;
00024 
00025 /// A class to represent an incoming formal argument to a Function. An argument
00026 /// is a very simple Value. It is essentially a named (optional) type. When used
00027 /// in the body of a function, it represents the value of the actual argument
00028 /// the function was called with.
00029 /// @brief LLVM Argument representation  
00030 class Argument : public Value {  // Defined in the Function.cpp file
00031   Function *Parent;
00032 
00033   Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
00034   void setNext(Argument *N) { Next = N; }
00035   void setPrev(Argument *N) { Prev = N; }
00036   friend class SymbolTableListTraits<Argument, Function, Function,
00037                                      ilist_traits<Argument> >;
00038   void setParent(Function *parent);
00039 
00040 public:
00041   /// Argument ctor - If Function argument is specified, this argument is
00042   /// inserted at the end of the argument list for the function.
00043   ///
00044   Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
00045 
00046   inline const Function *getParent() const { return Parent; }
00047   inline       Function *getParent()       { return Parent; }
00048 
00049   // getNext/Prev - Return the next or previous argument in the list.
00050         Argument *getNext()       { return Next; }
00051   const Argument *getNext() const { return Next; }
00052         Argument *getPrev()       { return Prev; }
00053   const Argument *getPrev() const { return Prev; }
00054 
00055   virtual void print(std::ostream &OS) const;
00056 
00057   /// classof - Methods for support type inquiry through isa, cast, and
00058   /// dyn_cast:
00059   ///
00060   static inline bool classof(const Argument *) { return true; }
00061   static inline bool classof(const Value *V) {
00062     return V->getValueType() == ArgumentVal;
00063   }
00064 };
00065 
00066 } // End llvm namespace
00067 
00068 #endif