LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Inliner.h

Go to the documentation of this file.
00001 //===- InlineCommon.h - Code common to all inliners -------------*- 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 a simple policy-based bottom-up inliner.  This file
00011 // implements all of the boring mechanics of the bottom-up inlining, while the
00012 // subclass determines WHAT to inline, which is the much more interesting
00013 // component.
00014 //
00015 //===----------------------------------------------------------------------===//
00016 
00017 #ifndef INLINER_H
00018 #define INLINER_H
00019 
00020 #define DEBUG_TYPE "inline"
00021 #include "llvm/CallGraphSCCPass.h"
00022 
00023 namespace llvm {
00024   class CallSite;
00025 
00026 /// Inliner - This class contains all of the helper code which is used to
00027 /// perform the inlining operations that does not depend on the policy.
00028 ///
00029 struct Inliner : public CallGraphSCCPass {
00030   Inliner();
00031 
00032   // Main run interface method, this implements the interface required by the
00033   // Pass class.
00034   virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
00035 
00036   // doFinalization - Remove now-dead linkonce functions at the end of
00037   // processing to avoid breaking the SCC traversal.
00038   virtual bool doFinalization(CallGraph &CG);
00039 
00040 
00041   /// This method returns the value specified by the -inline-threshold value,
00042   /// specified on the command line.  This is typically not directly needed.
00043   ///
00044   unsigned getInlineThreshold() const { return InlineThreshold; }
00045 
00046   /// getInlineCost - This method must be implemented by the subclass to
00047   /// determine the cost of inlining the specified call site.  If the cost
00048   /// returned is greater than the current inline threshold, the call site is
00049   /// not inlined.
00050   ///
00051   virtual int getInlineCost(CallSite CS) = 0;
00052 
00053 private:
00054   // InlineThreshold - Cache the value here for easy access.
00055   unsigned InlineThreshold;
00056 };
00057 
00058 } // End llvm namespace
00059 
00060 #endif