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 is distributed under the University of Illinois Open Source
00006 // 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 #include "llvm/Attributes.h"
00019 #include "llvm/ADT/ilist_node.h"
00020 
00021 namespace llvm {
00022 
00023 template<typename ValueSubClass, typename ItemParentClass>
00024   class SymbolTableListTraits;
00025 
00026 /// A class to represent an incoming formal argument to a Function. An argument
00027 /// is a very simple Value. It is essentially a named (optional) type. When used
00028 /// in the body of a function, it represents the value of the actual argument
00029 /// the function was called with.
00030 /// @brief LLVM Argument representation  
00031 class Argument : public Value, public ilist_node<Argument> {
00032   Function *Parent;
00033 
00034   friend class SymbolTableListTraits<Argument, Function>;
00035   void setParent(Function *parent);
00036 
00037 public:
00038   /// Argument ctor - If Function argument is specified, this argument is
00039   /// inserted at the end of the argument list for the function.
00040   ///
00041   explicit Argument(const Type *Ty, const std::string &Name = "",
00042                     Function *F = 0);
00043 
00044   inline const Function *getParent() const { return Parent; }
00045   inline       Function *getParent()       { return Parent; }
00046 
00047   /// getArgNo - Return the index of this formal argument in its containing
00048   /// function.  For example in "void foo(int a, float b)" a is 0 and b is 1. 
00049   unsigned getArgNo() const;
00050   
00051   /// hasByValAttr - Return true if this argument has the byval attribute on it
00052   /// in its containing function.
00053   bool hasByValAttr() const;
00054 
00055   /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
00056   /// it in its containing function.
00057   bool hasNoAliasAttr() const;
00058   
00059   /// hasNoCaptureAttr - Return true if this argument has the nocapture
00060   /// attribute on it in its containing function.
00061   bool hasNoCaptureAttr() const;
00062   
00063   /// hasSRetAttr - Return true if this argument has the sret attribute on it in
00064   /// its containing function.
00065   bool hasStructRetAttr() const;
00066 
00067   /// addAttr - Add a Attribute to an argument
00068   void addAttr(Attributes);
00069   
00070   /// removeAttr - Remove a Attribute from an argument
00071   void removeAttr(Attributes);
00072 
00073   /// classof - Methods for support type inquiry through isa, cast, and
00074   /// dyn_cast:
00075   ///
00076   static inline bool classof(const Argument *) { return true; }
00077   static inline bool classof(const Value *V) {
00078     return V->getValueID() == ArgumentVal;
00079   }
00080 };
00081 
00082 } // End llvm namespace
00083 
00084 #endif



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.