Move CompilerDriver.h here.
[oota-llvm.git] / tools / llvmc / CompilerDriver.h
1 //===- CompilerDriver.h - Compiler Driver ---------------------------------===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the 
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the CompilerDriver class which implements the bulk of the
11 // LLVM Compiler Driver program (llvmc).
12 //
13 //===------------------------------------------------------------------------===
14
15 namespace llvm {
16   /// This class provides the high level interface to the LLVM Compiler Driver.
17   /// The driver's purpose is to make it easier for compiler writers and users
18   /// of LLVM to utilize the compiler toolkits and LLVM toolset by learning only
19   /// the interface of one program (llvmc).
20   /// 
21   /// @see llvmc.cpp
22   /// @brief The interface to the LLVM Compiler Driver.
23   class CompilerDriver {
24     /// @name Types
25     /// @{
26     public:
27       typedef unsigned OptimizationLevel;
28       enum Phases {
29         PREPROCESSING, ///< Source language combining, filtering, substitution
30         TRANSLATION,   ///< Translate source -> LLVM bytecode/assembly
31         OPTIMIZATION,  ///< Optimize translation result 
32         LINKING,       ///< Link bytecode and native code
33         ASSEMBLY,      ///< Convert program to executable
34       };
35
36       enum OptimizationLevels {
37         OPT_NONE,
38         OPT_FAST_COMPILE,
39         OPT_SIMPLE,
40         OPT_AGGRESSIVE,
41         OPT_LINK_TIME,
42         OPT_AGGRESSIVE_LINK_TIME
43       };
44
45     /// @}
46     /// @name Constructors
47     /// @{
48     public:
49       CompilerDriver();
50
51     /// @}
52     /// @name Accessors
53     /// @{
54     public:
55       void execute(); ///< Execute the actions requested
56
57     /// @}
58     /// @name Mutators
59     /// @{
60     public:
61       /// @brief Set the optimization level for the compilation
62       void setOptimization( OptimizationLevel level );
63       void setFinalPhase( Phases phase );
64
65     /// @}
66     /// @name Data
67     /// @{
68     public:
69       Phases finalPhase;
70       OptimizationLevel optLevel;
71
72     /// @}
73
74   };
75 }