LLVM  mainline
Function.h
Go to the documentation of this file.
00001 //===-- llvm/Function.h - Class to represent a single function --*- 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 contains the declaration of the Function class, which represents a
00011 // single function/procedure in LLVM.
00012 //
00013 // A function basically consists of a list of basic blocks, a list of arguments,
00014 // and a symbol table.
00015 //
00016 //===----------------------------------------------------------------------===//
00017 
00018 #ifndef LLVM_IR_FUNCTION_H
00019 #define LLVM_IR_FUNCTION_H
00020 
00021 #include "llvm/ADT/iterator_range.h"
00022 #include "llvm/ADT/Optional.h"
00023 #include "llvm/IR/Argument.h"
00024 #include "llvm/IR/Attributes.h"
00025 #include "llvm/IR/BasicBlock.h"
00026 #include "llvm/IR/CallingConv.h"
00027 #include "llvm/IR/GlobalObject.h"
00028 #include "llvm/IR/OperandTraits.h"
00029 #include "llvm/Support/Compiler.h"
00030 
00031 namespace llvm {
00032 
00033 class FunctionType;
00034 class LLVMContext;
00035 
00036 template<> struct ilist_traits<Argument>
00037   : public SymbolTableListTraits<Argument, Function> {
00038 
00039   Argument *createSentinel() const {
00040     return static_cast<Argument*>(&Sentinel);
00041   }
00042   static void destroySentinel(Argument*) {}
00043 
00044   Argument *provideInitialHead() const { return createSentinel(); }
00045   Argument *ensureHead(Argument*) const { return createSentinel(); }
00046   static void noteHead(Argument*, Argument*) {}
00047 
00048   static ValueSymbolTable *getSymTab(Function *ItemParent);
00049 private:
00050   mutable ilist_half_node<Argument> Sentinel;
00051 };
00052 
00053 class Function : public GlobalObject, public ilist_node<Function> {
00054 public:
00055   typedef iplist<Argument> ArgumentListType;
00056   typedef iplist<BasicBlock> BasicBlockListType;
00057 
00058   // BasicBlock iterators...
00059   typedef BasicBlockListType::iterator iterator;
00060   typedef BasicBlockListType::const_iterator const_iterator;
00061 
00062   typedef ArgumentListType::iterator arg_iterator;
00063   typedef ArgumentListType::const_iterator const_arg_iterator;
00064 
00065 private:
00066   // Important things that make up a function!
00067   BasicBlockListType  BasicBlocks;        ///< The basic blocks
00068   mutable ArgumentListType ArgumentList;  ///< The formal arguments
00069   ValueSymbolTable *SymTab;               ///< Symbol table of args/instructions
00070   AttributeSet AttributeSets;             ///< Parameter attributes
00071   FunctionType *Ty;
00072 
00073   /*
00074    * Value::SubclassData
00075    *
00076    * bit 0  : HasLazyArguments
00077    * bit 1  : HasPrefixData
00078    * bit 2  : HasPrologueData
00079    * bit 3-6: CallingConvention
00080    */
00081 
00082   /// Bits from GlobalObject::GlobalObjectSubclassData.
00083   enum {
00084     /// Whether this function is materializable.
00085     IsMaterializableBit = 1 << 0,
00086     HasMetadataHashEntryBit = 1 << 1
00087   };
00088   void setGlobalObjectBit(unsigned Mask, bool Value) {
00089     setGlobalObjectSubClassData((~Mask & getGlobalObjectSubClassData()) |
00090                                 (Value ? Mask : 0u));
00091   }
00092 
00093   friend class SymbolTableListTraits<Function, Module>;
00094 
00095   void setParent(Module *parent);
00096 
00097   /// hasLazyArguments/CheckLazyArguments - The argument list of a function is
00098   /// built on demand, so that the list isn't allocated until the first client
00099   /// needs it.  The hasLazyArguments predicate returns true if the arg list
00100   /// hasn't been set up yet.
00101   bool hasLazyArguments() const {
00102     return getSubclassDataFromValue() & (1<<0);
00103   }
00104   void CheckLazyArguments() const {
00105     if (hasLazyArguments())
00106       BuildLazyArguments();
00107   }
00108   void BuildLazyArguments() const;
00109 
00110   Function(const Function&) = delete;
00111   void operator=(const Function&) = delete;
00112 
00113   /// Function ctor - If the (optional) Module argument is specified, the
00114   /// function is automatically inserted into the end of the function list for
00115   /// the module.
00116   ///
00117   Function(FunctionType *Ty, LinkageTypes Linkage,
00118            const Twine &N = "", Module *M = nullptr);
00119 
00120 public:
00121   static Function *Create(FunctionType *Ty, LinkageTypes Linkage,
00122                           const Twine &N = "", Module *M = nullptr) {
00123     return new(1) Function(Ty, Linkage, N, M);
00124   }
00125 
00126   ~Function() override;
00127 
00128   /// \brief Provide fast operand accessors
00129   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
00130 
00131   /// \brief Get the personality function associated with this function.
00132   bool hasPersonalityFn() const { return getNumOperands() != 0; }
00133   Constant *getPersonalityFn() const {
00134     assert(hasPersonalityFn());
00135     return cast<Constant>(Op<0>());
00136   }
00137   void setPersonalityFn(Constant *C);
00138 
00139   Type *getReturnType() const;           // Return the type of the ret val
00140   FunctionType *getFunctionType() const; // Return the FunctionType for me
00141 
00142   /// getContext - Return a reference to the LLVMContext associated with this
00143   /// function.
00144   LLVMContext &getContext() const;
00145 
00146   /// isVarArg - Return true if this function takes a variable number of
00147   /// arguments.
00148   bool isVarArg() const;
00149 
00150   bool isMaterializable() const;
00151   void setIsMaterializable(bool V);
00152 
00153   /// getIntrinsicID - This method returns the ID number of the specified
00154   /// function, or Intrinsic::not_intrinsic if the function is not an
00155   /// intrinsic, or if the pointer is null.  This value is always defined to be
00156   /// zero to allow easy checking for whether a function is intrinsic or not.
00157   /// The particular intrinsic functions which correspond to this value are
00158   /// defined in llvm/Intrinsics.h.
00159   Intrinsic::ID getIntrinsicID() const LLVM_READONLY { return IntID; }
00160   bool isIntrinsic() const { return getName().startswith("llvm."); }
00161 
00162   /// \brief Recalculate the ID for this function if it is an Intrinsic defined
00163   /// in llvm/Intrinsics.h.  Sets the intrinsic ID to Intrinsic::not_intrinsic
00164   /// if the name of this function does not match an intrinsic in that header.
00165   /// Note, this method does not need to be called directly, as it is called
00166   /// from Value::setName() whenever the name of this function changes.
00167   void recalculateIntrinsicID();
00168 
00169   /// getCallingConv()/setCallingConv(CC) - These method get and set the
00170   /// calling convention of this function.  The enum values for the known
00171   /// calling conventions are defined in CallingConv.h.
00172   CallingConv::ID getCallingConv() const {
00173     return static_cast<CallingConv::ID>(getSubclassDataFromValue() >> 3);
00174   }
00175   void setCallingConv(CallingConv::ID CC) {
00176     setValueSubclassData((getSubclassDataFromValue() & 7) |
00177                          (static_cast<unsigned>(CC) << 3));
00178   }
00179 
00180   /// @brief Return the attribute list for this Function.
00181   AttributeSet getAttributes() const { return AttributeSets; }
00182 
00183   /// @brief Set the attribute list for this Function.
00184   void setAttributes(AttributeSet attrs) { AttributeSets = attrs; }
00185 
00186   /// @brief Add function attributes to this function.
00187   void addFnAttr(Attribute::AttrKind N) {
00188     setAttributes(AttributeSets.addAttribute(getContext(),
00189                                              AttributeSet::FunctionIndex, N));
00190   }
00191 
00192   /// @brief Remove function attributes from this function.
00193   void removeFnAttr(Attribute::AttrKind N) {
00194     setAttributes(AttributeSets.removeAttribute(
00195         getContext(), AttributeSet::FunctionIndex, N));
00196   }
00197 
00198   /// @brief Add function attributes to this function.
00199   void addFnAttr(StringRef Kind) {
00200     setAttributes(
00201       AttributeSets.addAttribute(getContext(),
00202                                  AttributeSet::FunctionIndex, Kind));
00203   }
00204   void addFnAttr(StringRef Kind, StringRef Value) {
00205     setAttributes(
00206       AttributeSets.addAttribute(getContext(),
00207                                  AttributeSet::FunctionIndex, Kind, Value));
00208   }
00209 
00210   /// Set the entry count for this function.
00211   void setEntryCount(uint64_t Count);
00212 
00213   /// Get the entry count for this function.
00214   Optional<uint64_t> getEntryCount() const;
00215 
00216   /// @brief Return true if the function has the attribute.
00217   bool hasFnAttribute(Attribute::AttrKind Kind) const {
00218     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);
00219   }
00220   bool hasFnAttribute(StringRef Kind) const {
00221     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);
00222   }
00223 
00224   /// @brief Return the attribute for the given attribute kind.
00225   Attribute getFnAttribute(Attribute::AttrKind Kind) const {
00226     return AttributeSets.getAttribute(AttributeSet::FunctionIndex, Kind);
00227   }
00228   Attribute getFnAttribute(StringRef Kind) const {
00229     return AttributeSets.getAttribute(AttributeSet::FunctionIndex, Kind);
00230   }
00231 
00232   /// \brief Return the stack alignment for the function.
00233   unsigned getFnStackAlignment() const {
00234     return AttributeSets.getStackAlignment(AttributeSet::FunctionIndex);
00235   }
00236 
00237   /// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
00238   ///                             to use during code generation.
00239   bool hasGC() const;
00240   const char *getGC() const;
00241   void setGC(const char *Str);
00242   void clearGC();
00243 
00244   /// @brief adds the attribute to the list of attributes.
00245   void addAttribute(unsigned i, Attribute::AttrKind attr);
00246 
00247   /// @brief adds the attributes to the list of attributes.
00248   void addAttributes(unsigned i, AttributeSet attrs);
00249 
00250   /// @brief removes the attributes from the list of attributes.
00251   void removeAttributes(unsigned i, AttributeSet attr);
00252 
00253   /// @brief adds the dereferenceable attribute to the list of attributes.
00254   void addDereferenceableAttr(unsigned i, uint64_t Bytes);
00255 
00256   /// @brief adds the dereferenceable_or_null attribute to the list of
00257   /// attributes.
00258   void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes);
00259 
00260   /// @brief Extract the alignment for a call or parameter (0=unknown).
00261   unsigned getParamAlignment(unsigned i) const {
00262     return AttributeSets.getParamAlignment(i);
00263   }
00264 
00265   /// @brief Extract the number of dereferenceable bytes for a call or
00266   /// parameter (0=unknown).
00267   uint64_t getDereferenceableBytes(unsigned i) const {
00268     return AttributeSets.getDereferenceableBytes(i);
00269   }
00270   
00271   /// @brief Extract the number of dereferenceable_or_null bytes for a call or
00272   /// parameter (0=unknown).
00273   uint64_t getDereferenceableOrNullBytes(unsigned i) const {
00274     return AttributeSets.getDereferenceableOrNullBytes(i);
00275   }
00276   
00277   /// @brief Determine if the function does not access memory.
00278   bool doesNotAccessMemory() const {
00279     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00280                                       Attribute::ReadNone);
00281   }
00282   void setDoesNotAccessMemory() {
00283     addFnAttr(Attribute::ReadNone);
00284   }
00285 
00286   /// @brief Determine if the function does not access or only reads memory.
00287   bool onlyReadsMemory() const {
00288     return doesNotAccessMemory() ||
00289       AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00290                                  Attribute::ReadOnly);
00291   }
00292   void setOnlyReadsMemory() {
00293     addFnAttr(Attribute::ReadOnly);
00294   }
00295 
00296   /// @brief Determine if the function cannot return.
00297   bool doesNotReturn() const {
00298     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00299                                       Attribute::NoReturn);
00300   }
00301   void setDoesNotReturn() {
00302     addFnAttr(Attribute::NoReturn);
00303   }
00304 
00305   /// @brief Determine if the function cannot unwind.
00306   bool doesNotThrow() const {
00307     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00308                                       Attribute::NoUnwind);
00309   }
00310   void setDoesNotThrow() {
00311     addFnAttr(Attribute::NoUnwind);
00312   }
00313 
00314   /// @brief Determine if the call cannot be duplicated.
00315   bool cannotDuplicate() const {
00316     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00317                                       Attribute::NoDuplicate);
00318   }
00319   void setCannotDuplicate() {
00320     addFnAttr(Attribute::NoDuplicate);
00321   }
00322 
00323   /// @brief Determine if the call is convergent.
00324   bool isConvergent() const {
00325     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00326                                       Attribute::Convergent);
00327   }
00328   void setConvergent() {
00329     addFnAttr(Attribute::Convergent);
00330   }
00331 
00332 
00333   /// @brief True if the ABI mandates (or the user requested) that this
00334   /// function be in a unwind table.
00335   bool hasUWTable() const {
00336     return AttributeSets.hasAttribute(AttributeSet::FunctionIndex,
00337                                       Attribute::UWTable);
00338   }
00339   void setHasUWTable() {
00340     addFnAttr(Attribute::UWTable);
00341   }
00342 
00343   /// @brief True if this function needs an unwind table.
00344   bool needsUnwindTableEntry() const {
00345     return hasUWTable() || !doesNotThrow();
00346   }
00347 
00348   /// @brief Determine if the function returns a structure through first
00349   /// pointer argument.
00350   bool hasStructRetAttr() const {
00351     return AttributeSets.hasAttribute(1, Attribute::StructRet) ||
00352            AttributeSets.hasAttribute(2, Attribute::StructRet);
00353   }
00354 
00355   /// @brief Determine if the parameter does not alias other parameters.
00356   /// @param n The parameter to check. 1 is the first parameter, 0 is the return
00357   bool doesNotAlias(unsigned n) const {
00358     return AttributeSets.hasAttribute(n, Attribute::NoAlias);
00359   }
00360   void setDoesNotAlias(unsigned n) {
00361     addAttribute(n, Attribute::NoAlias);
00362   }
00363 
00364   /// @brief Determine if the parameter can be captured.
00365   /// @param n The parameter to check. 1 is the first parameter, 0 is the return
00366   bool doesNotCapture(unsigned n) const {
00367     return AttributeSets.hasAttribute(n, Attribute::NoCapture);
00368   }
00369   void setDoesNotCapture(unsigned n) {
00370     addAttribute(n, Attribute::NoCapture);
00371   }
00372 
00373   bool doesNotAccessMemory(unsigned n) const {
00374     return AttributeSets.hasAttribute(n, Attribute::ReadNone);
00375   }
00376   void setDoesNotAccessMemory(unsigned n) {
00377     addAttribute(n, Attribute::ReadNone);
00378   }
00379 
00380   bool onlyReadsMemory(unsigned n) const {
00381     return doesNotAccessMemory(n) ||
00382       AttributeSets.hasAttribute(n, Attribute::ReadOnly);
00383   }
00384   void setOnlyReadsMemory(unsigned n) {
00385     addAttribute(n, Attribute::ReadOnly);
00386   }
00387 
00388   /// copyAttributesFrom - copy all additional attributes (those not needed to
00389   /// create a Function) from the Function Src to this one.
00390   void copyAttributesFrom(const GlobalValue *Src) override;
00391 
00392   /// deleteBody - This method deletes the body of the function, and converts
00393   /// the linkage to external.
00394   ///
00395   void deleteBody() {
00396     dropAllReferences();
00397     setLinkage(ExternalLinkage);
00398   }
00399 
00400   /// removeFromParent - This method unlinks 'this' from the containing module,
00401   /// but does not delete it.
00402   ///
00403   void removeFromParent() override;
00404 
00405   /// eraseFromParent - This method unlinks 'this' from the containing module
00406   /// and deletes it.
00407   ///
00408   void eraseFromParent() override;
00409 
00410 
00411   /// Get the underlying elements of the Function... the basic block list is
00412   /// empty for external functions.
00413   ///
00414   const ArgumentListType &getArgumentList() const {
00415     CheckLazyArguments();
00416     return ArgumentList;
00417   }
00418   ArgumentListType &getArgumentList() {
00419     CheckLazyArguments();
00420     return ArgumentList;
00421   }
00422   static iplist<Argument> Function::*getSublistAccess(Argument*) {
00423     return &Function::ArgumentList;
00424   }
00425 
00426   const BasicBlockListType &getBasicBlockList() const { return BasicBlocks; }
00427         BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
00428   static iplist<BasicBlock> Function::*getSublistAccess(BasicBlock*) {
00429     return &Function::BasicBlocks;
00430   }
00431 
00432   const BasicBlock       &getEntryBlock() const   { return front(); }
00433         BasicBlock       &getEntryBlock()         { return front(); }
00434 
00435   //===--------------------------------------------------------------------===//
00436   // Symbol Table Accessing functions...
00437 
00438   /// getSymbolTable() - Return the symbol table...
00439   ///
00440   inline       ValueSymbolTable &getValueSymbolTable()       { return *SymTab; }
00441   inline const ValueSymbolTable &getValueSymbolTable() const { return *SymTab; }
00442 
00443 
00444   //===--------------------------------------------------------------------===//
00445   // BasicBlock iterator forwarding functions
00446   //
00447   iterator                begin()       { return BasicBlocks.begin(); }
00448   const_iterator          begin() const { return BasicBlocks.begin(); }
00449   iterator                end  ()       { return BasicBlocks.end();   }
00450   const_iterator          end  () const { return BasicBlocks.end();   }
00451 
00452   size_t                   size() const { return BasicBlocks.size();  }
00453   bool                    empty() const { return BasicBlocks.empty(); }
00454   const BasicBlock       &front() const { return BasicBlocks.front(); }
00455         BasicBlock       &front()       { return BasicBlocks.front(); }
00456   const BasicBlock        &back() const { return BasicBlocks.back();  }
00457         BasicBlock        &back()       { return BasicBlocks.back();  }
00458 
00459 /// @name Function Argument Iteration
00460 /// @{
00461 
00462   arg_iterator arg_begin() {
00463     CheckLazyArguments();
00464     return ArgumentList.begin();
00465   }
00466   const_arg_iterator arg_begin() const {
00467     CheckLazyArguments();
00468     return ArgumentList.begin();
00469   }
00470   arg_iterator arg_end() {
00471     CheckLazyArguments();
00472     return ArgumentList.end();
00473   }
00474   const_arg_iterator arg_end() const {
00475     CheckLazyArguments();
00476     return ArgumentList.end();
00477   }
00478 
00479   iterator_range<arg_iterator> args() {
00480     return iterator_range<arg_iterator>(arg_begin(), arg_end());
00481   }
00482 
00483   iterator_range<const_arg_iterator> args() const {
00484     return iterator_range<const_arg_iterator>(arg_begin(), arg_end());
00485   }
00486 
00487 /// @}
00488 
00489   size_t arg_size() const;
00490   bool arg_empty() const;
00491 
00492   bool hasPrefixData() const {
00493     return getSubclassDataFromValue() & (1<<1);
00494   }
00495 
00496   Constant *getPrefixData() const;
00497   void setPrefixData(Constant *PrefixData);
00498 
00499   bool hasPrologueData() const {
00500     return getSubclassDataFromValue() & (1<<2);
00501   }
00502 
00503   Constant *getPrologueData() const;
00504   void setPrologueData(Constant *PrologueData);
00505 
00506   /// Print the function to an output stream with an optional
00507   /// AssemblyAnnotationWriter.
00508   void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr) const;
00509 
00510   /// viewCFG - This function is meant for use from the debugger.  You can just
00511   /// say 'call F->viewCFG()' and a ghostview window should pop up from the
00512   /// program, displaying the CFG of the current function with the code for each
00513   /// basic block inside.  This depends on there being a 'dot' and 'gv' program
00514   /// in your path.
00515   ///
00516   void viewCFG() const;
00517 
00518   /// viewCFGOnly - This function is meant for use from the debugger.  It works
00519   /// just like viewCFG, but it does not include the contents of basic blocks
00520   /// into the nodes, just the label.  If you are only interested in the CFG
00521   /// this can make the graph smaller.
00522   ///
00523   void viewCFGOnly() const;
00524 
00525   /// Methods for support type inquiry through isa, cast, and dyn_cast:
00526   static inline bool classof(const Value *V) {
00527     return V->getValueID() == Value::FunctionVal;
00528   }
00529 
00530   /// dropAllReferences() - This method causes all the subinstructions to "let
00531   /// go" of all references that they are maintaining.  This allows one to
00532   /// 'delete' a whole module at a time, even though there may be circular
00533   /// references... first all references are dropped, and all use counts go to
00534   /// zero.  Then everything is deleted for real.  Note that no operations are
00535   /// valid on an object that has "dropped all references", except operator
00536   /// delete.
00537   ///
00538   /// Since no other object in the module can have references into the body of a
00539   /// function, dropping all references deletes the entire body of the function,
00540   /// including any contained basic blocks.
00541   ///
00542   void dropAllReferences();
00543 
00544   /// hasAddressTaken - returns true if there are any uses of this function
00545   /// other than direct calls or invokes to it, or blockaddress expressions.
00546   /// Optionally passes back an offending user for diagnostic purposes.
00547   ///
00548   bool hasAddressTaken(const User** = nullptr) const;
00549 
00550   /// isDefTriviallyDead - Return true if it is trivially safe to remove
00551   /// this function definition from the module (because it isn't externally
00552   /// visible, does not have its address taken, and has no callers).  To make
00553   /// this more accurate, call removeDeadConstantUsers first.
00554   bool isDefTriviallyDead() const;
00555 
00556   /// callsFunctionThatReturnsTwice - Return true if the function has a call to
00557   /// setjmp or other function that gcc recognizes as "returning twice".
00558   bool callsFunctionThatReturnsTwice() const;
00559 
00560   /// \brief Check if this has any metadata.
00561   bool hasMetadata() const { return hasMetadataHashEntry(); }
00562 
00563   /// \brief Get the current metadata attachment, if any.
00564   ///
00565   /// Returns \c nullptr if such an attachment is missing.
00566   /// @{
00567   MDNode *getMetadata(unsigned KindID) const;
00568   MDNode *getMetadata(StringRef Kind) const;
00569   /// @}
00570 
00571   /// \brief Set a particular kind of metadata attachment.
00572   ///
00573   /// Sets the given attachment to \c MD, erasing it if \c MD is \c nullptr or
00574   /// replacing it if it already exists.
00575   /// @{
00576   void setMetadata(unsigned KindID, MDNode *MD);
00577   void setMetadata(StringRef Kind, MDNode *MD);
00578   /// @}
00579 
00580   /// \brief Get all current metadata attachments.
00581   void
00582   getAllMetadata(SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs) const;
00583 
00584   /// \brief Drop metadata not in the given list.
00585   ///
00586   /// Drop all metadata from \c this not included in \c KnownIDs.
00587   void dropUnknownMetadata(ArrayRef<unsigned> KnownIDs);
00588 
00589 private:
00590   // Shadow Value::setValueSubclassData with a private forwarding method so that
00591   // subclasses cannot accidentally use it.
00592   void setValueSubclassData(unsigned short D) {
00593     Value::setValueSubclassData(D);
00594   }
00595 
00596   bool hasMetadataHashEntry() const {
00597     return getGlobalObjectSubClassData() & HasMetadataHashEntryBit;
00598   }
00599   void setHasMetadataHashEntry(bool HasEntry) {
00600     setGlobalObjectBit(HasMetadataHashEntryBit, HasEntry);
00601   }
00602 
00603   void clearMetadata();
00604 };
00605 
00606 inline ValueSymbolTable *
00607 ilist_traits<BasicBlock>::getSymTab(Function *F) {
00608   return F ? &F->getValueSymbolTable() : nullptr;
00609 }
00610 
00611 inline ValueSymbolTable *
00612 ilist_traits<Argument>::getSymTab(Function *F) {
00613   return F ? &F->getValueSymbolTable() : nullptr;
00614 }
00615 
00616 template <>
00617 struct OperandTraits<Function> : public OptionalOperandTraits<Function> {};
00618 
00619 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Function, Value)
00620 
00621 } // End llvm namespace
00622 
00623 #endif