LLVM API Documentation
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 defines the Argument class, which represents an incoming formal 00011 // argument to a Function. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_ARGUMENT_H 00016 #define LLVM_ARGUMENT_H 00017 00018 #include "llvm/Value.h" 00019 00020 namespace llvm { 00021 00022 template<typename SC> struct ilist_traits; 00023 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass, 00024 typename SubClass> class SymbolTableListTraits; 00025 00026 class Argument : public Value { // Defined in the Function.cpp file 00027 Function *Parent; 00028 00029 Argument *Prev, *Next; // Next and Prev links for our intrusive linked list 00030 void setNext(Argument *N) { Next = N; } 00031 void setPrev(Argument *N) { Prev = N; } 00032 friend class SymbolTableListTraits<Argument, Function, Function, 00033 ilist_traits<Argument> >; 00034 void setParent(Function *parent); 00035 00036 public: 00037 /// Argument ctor - If Function argument is specified, this argument is 00038 /// inserted at the end of the argument list for the function. 00039 /// 00040 Argument(const Type *Ty, const std::string &Name = "", Function *F = 0); 00041 00042 inline const Function *getParent() const { return Parent; } 00043 inline Function *getParent() { return Parent; } 00044 00045 // getNext/Prev - Return the next or previous argument in the list. 00046 Argument *getNext() { return Next; } 00047 const Argument *getNext() const { return Next; } 00048 Argument *getPrev() { return Prev; } 00049 const Argument *getPrev() const { return Prev; } 00050 00051 virtual void print(std::ostream &OS) const; 00052 00053 /// classof - Methods for support type inquiry through isa, cast, and 00054 /// dyn_cast: 00055 /// 00056 static inline bool classof(const Argument *) { return true; } 00057 static inline bool classof(const Value *V) { 00058 return V->getValueType() == ArgumentVal; 00059 } 00060 }; 00061 00062 } // End llvm namespace 00063 00064 #endif