aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lto/LTOPostIPODriver.h
blob: 548e732157674671dd7ad18f3a72f6ea07c07c2a (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
//===---------- LTOPostIPODriver.h - PostIPO Driver -----------------------===//
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file declare the PostIPODriver class which is the driver for 
// Post-IPO compilation phase.
//
//===----------------------------------------------------------------------===//

#ifndef LTO_POSTIPO_DRIVER_H
#define LTO_POSTIPO_DRIVER_H

#include "llvm/Target/TargetMachine.h"

namespace lto {
  class IPOPartMgr;
  class IPOFileMgr;
  class IPOFile;

  class PostIPODriver {
  public:
    typedef enum {
      PIDV_Invalid,
      PIDV_SERIAL,      // No partition
      PIDV_MultiThread, // Each partition is compiled by a thread
      PIDV_MultiProc,   // Each partition is compiled by a process
      PIDV_MakeUtil     // Partitions compilation is driven by a make-utility
    } VariantTy;

    PostIPODriver(VariantTy Var, TargetMachine *TM, IPOPartMgr &IPM,
                  IPOFileMgr &IFM, bool ToMergeObjs = false);
  
    // Return the single resulting object file. If there is no prior
    // compilation failure, this function may return NULL iff:
    //   1) Partition is enabled, and 
    //   2) Multiple partitions are generated, and
    //   3) It is not asked to merge together the objects corresponding to the
    //      the partions.
    IPOFile *getSingleObjFile() const;
  
    bool Compile(std::string &ErrMsg);

  private:
    void *DrvImpl;
  };
}

#endif // LTO_POSTIPO_DRIVER_H