OpenASIP  2.0
LLVMBackend.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2012 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file LLVMBackend.hh
26  *
27  * Declaration of LLVMBackend class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2008 (vjaaskel-no.spam-cs.tut.fi)
30  * @author Pekka Jääskeläinen 2008-2012
31  * @note rating: red
32  */
33 
34 #ifndef LLVM_TCE_HH
35 #define LLVM_TCE_HH
36 
37 #include <string>
38 
39 #include "Exception.hh"
40 #include "PluginTools.hh"
41 #include "OperationDAGSelector.hh"
42 
43 namespace TTAProgram {
44  class Program;
45 }
46 
47 namespace TTAMachine {
48  class Machine;
49 }
50 
51 namespace llvm {
52  class Module;
53  class TCETargetMachinePlugin;
54 }
55 
56 class InterPassData;
57 class SchedulingPlan;
59 
60 /**
61  * LLVM compiler backend and compiler interface for TCE.
62  */
63 class LLVMBackend {
64 public:
66  llvmRequiredOpset(bool includeFloatOps, bool isLittleEndian, bool bits64);
67 
68  LLVMBackend(bool useInstalledVersion, TCEString tempDir);
69  virtual ~LLVMBackend();
70 
72  const std::string& bytecodeFile,
73  const std::string& emulationBytecodeFile, TTAMachine::Machine& target,
74  int optLevel, bool debug = false, InterPassData* ipData = NULL);
75 
77  llvm::Module& module, llvm::Module* emulationModule,
79  int optLevel, bool debug = false, InterPassData* ipData = NULL);
80 
82  const std::string& bytecodeFile,
83  const std::string& emulationBytecodeFile, TTAMachine::Machine& target,
84  int optLevel = 2, bool debug = false, SchedulingPlan* plan = NULL);
85 
87  const TTAMachine::Machine& target);
88 
89  std::string pluginFilename(const TTAMachine::Machine& target);
90 
91 private:
92 
93  unsigned maxAllocaAlignment(const llvm::Module& mod) const;
94 
95  /// Assume we are running an installed TCE version.
97 
98  /// Plugin tool for loading target machine plugin.
100  /// Path to the cache where precompiled plugins are stored.
102  /// Directory to store temporary files.
104 
106 
108 
109  static const std::string TBLGEN_INCLUDES;
110  static const std::string PLUGIN_PREFIX;
111  static const std::string PLUGIN_SUFFIX;
112  static const TCEString CXX0X_FLAG;
113  static const TCEString CXX11_FLAG;
114  static const TCEString CXX14_FLAG;
115 };
116 
117 #endif
LLVMBackend::cachePath_
TCEString cachePath_
Path to the cache where precompiled plugins are stored.
Definition: LLVMBackend.hh:101
TTAProgram
Definition: Estimator.hh:65
llvm
Definition: InlineAsmParser.hh:49
TTAProgram::Program
Definition: Program.hh:63
LLVMBackend::PLUGIN_SUFFIX
static const std::string PLUGIN_SUFFIX
Definition: LLVMBackend.hh:111
Exception.hh
LLVMBackend::PLUGIN_PREFIX
static const std::string PLUGIN_PREFIX
Definition: LLVMBackend.hh:110
PluginTools
Definition: PluginTools.hh:53
LLVMBackend::pluginTool_
PluginTools pluginTool_
Plugin tool for loading target machine plugin.
Definition: LLVMBackend.hh:99
LLVMBackend::compile
TTAProgram::Program * compile(const std::string &bytecodeFile, const std::string &emulationBytecodeFile, TTAMachine::Machine &target, int optLevel, bool debug=false, InterPassData *ipData=NULL)
Definition: LLVMBackend.cc:360
LLVMBackend::ipData_
InterPassData * ipData_
Definition: LLVMBackend.hh:107
LLVMBackend::CXX0X_FLAG
static const TCEString CXX0X_FLAG
Definition: LLVMBackend.hh:112
LLVMBackend::tempDir_
TCEString tempDir_
Directory to store temporary files.
Definition: LLVMBackend.hh:103
LLVMBackend::options_
LLVMTCECmdLineOptions * options_
Definition: LLVMBackend.hh:105
LLVMBackend::createPlugin
llvm::TCETargetMachinePlugin * createPlugin(const TTAMachine::Machine &target)
Definition: LLVMBackend.cc:809
InterPassData
Definition: InterPassData.hh:48
LLVMBackend::TBLGEN_INCLUDES
static const std::string TBLGEN_INCLUDES
Definition: LLVMBackend.hh:109
OperationDAGSelector.hh
OperationDAGSelector::OperationSet
TCETools::CIStringSet OperationSet
Definition: OperationDAGSelector.hh:88
PluginTools.hh
LLVMTCECmdLineOptions
Definition: LLVMTCECmdLineOptions.hh:48
llvm::TCETargetMachinePlugin
Definition: TCETargetMachinePlugin.hh:109
LLVMBackend::~LLVMBackend
virtual ~LLVMBackend()
Definition: LLVMBackend.cc:348
LLVMBackend::maxAllocaAlignment
unsigned maxAllocaAlignment(const llvm::Module &mod) const
Definition: LLVMBackend.cc:509
TCEString
Definition: TCEString.hh:53
LLVMBackend::LLVMBackend
LLVMBackend(bool useInstalledVersion, TCEString tempDir)
Definition: LLVMBackend.cc:324
LLVMBackend::CXX11_FLAG
static const TCEString CXX11_FLAG
Definition: LLVMBackend.hh:113
LLVMBackend::pluginFilename
std::string pluginFilename(const TTAMachine::Machine &target)
Definition: LLVMBackend.cc:1097
TTAMachine
Definition: Assembler.hh:48
LLVMBackend
Definition: LLVMBackend.hh:63
LLVMBackend::llvmRequiredOpset
static OperationDAGSelector::OperationSet llvmRequiredOpset(bool includeFloatOps, bool isLittleEndian, bool bits64)
Definition: LLVMBackend.cc:150
LLVMBackend::useInstalledVersion_
bool useInstalledVersion_
Assume we are running an installed TCE version.
Definition: LLVMBackend.hh:96
LLVMBackend::schedule
TTAProgram::Program * schedule(const std::string &bytecodeFile, const std::string &emulationBytecodeFile, TTAMachine::Machine &target, int optLevel=2, bool debug=false, SchedulingPlan *plan=NULL)
LLVMBackend::CXX14_FLAG
static const TCEString CXX14_FLAG
Definition: LLVMBackend.hh:114
TTAMachine::Machine
Definition: Machine.hh:73