summaryrefslogtreecommitdiffstats
path: root/include/llvm/Transforms/Utils/BasicInliner.h
blob: 4bca6b8c4417b002f03067d02a8875fb429f7389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//===- BasicInliner.h - Basic function level inliner ------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a simple function based inliner that does not use
// call graph information. 
//
//===----------------------------------------------------------------------===//

#ifndef BASICINLINER_H
#define BASICINLINER_H

#include "llvm/Analysis/InlineCost.h"

namespace llvm {

  class Function;
  class TargetData;
  struct BasicInlinerImpl;

  /// BasicInliner - BasicInliner provides function level inlining interface.
  /// Clients provide list of functions which are inline without using
  /// module level call graph information. Note that the BasicInliner is
  /// free to delete a function if it is inlined into all call sites.
  class BasicInliner {
  public:
    
    explicit BasicInliner(TargetData *T = NULL);
    ~BasicInliner();

    /// addFunction - Add function into the list of functions to process.
    /// All functions must be inserted using this interface before invoking
    /// inlineFunctions().
    void addFunction(Function *F);

    /// neverInlineFunction - Sometimes a function is never to be inlined 
    /// because of one or other reason. 
    void neverInlineFunction(Function *F);

    /// inlineFuctions - Walk all call sites in all functions supplied by
    /// client. Inline as many call sites as possible. Delete completely
    /// inlined functions.
    void inlineFunctions();

  private:
    BasicInlinerImpl *Impl;
  };
}

#endif
OpenPOWER on IntegriCloud