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 /// setName - Specialize setName to handle symbol table majik... 00043 virtual void setName(const std::string &name, SymbolTable *ST = 0); 00044 00045 inline const Function *getParent() const { return Parent; } 00046 inline Function *getParent() { return Parent; } 00047 00048 // getNext/Prev - Return the next or previous argument in the list. 00049 Argument *getNext() { return Next; } 00050 const Argument *getNext() const { return Next; } 00051 Argument *getPrev() { return Prev; } 00052 const Argument *getPrev() const { return Prev; } 00053 00054 virtual void print(std::ostream &OS) const; 00055 00056 /// classof - Methods for support type inquiry through isa, cast, and 00057 /// dyn_cast: 00058 /// 00059 static inline bool classof(const Argument *) { return true; } 00060 static inline bool classof(const Value *V) { 00061 return V->getValueType() == ArgumentVal; 00062 } 00063 }; 00064 00065 } // End llvm namespace 00066 00067 #endif