LLVM API Documentation

BasicInliner.h

Go to the documentation of this file.
00001 //===- BasicInliner.h - Basic function level inliner ------------*- 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 defines a simple function based inliner that does not use
00011 // call graph information. 
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef BASICINLINER_H
00016 #define BASICINLINER_H
00017 
00018 #include "llvm/Transforms/Utils/InlineCost.h"
00019 
00020 namespace llvm {
00021 
00022   class Function;
00023   class TargetData;
00024   struct BasicInlinerImpl;
00025 
00026   /// BasicInliner - BasicInliner provides function level inlining interface.
00027   /// Clients provide list of functions which are inline without using
00028   /// module level call graph information. Note that the BasicInliner is
00029   /// free to delete a function if it is inlined into all call sites.
00030   class BasicInliner {
00031   public:
00032     
00033     explicit BasicInliner(TargetData *T = NULL);
00034     ~BasicInliner();
00035 
00036     /// addFunction - Add function into the list of functions to process.
00037     /// All functions must be inserted using this interface before invoking
00038     /// inlineFunctions().
00039     void addFunction(Function *F);
00040 
00041     /// neverInlineFunction - Sometimes a function is never to be inlined 
00042     /// because of one or other reason. 
00043     void neverInlineFunction(Function *F);
00044 
00045     /// inlineFuctions - Walk all call sites in all functions supplied by
00046     /// client. Inline as many call sites as possible. Delete completely
00047     /// inlined functions.
00048     void inlineFunctions();
00049 
00050   private:
00051     BasicInlinerImpl *Impl;
00052   };
00053 }
00054 
00055 #endif