OpenASIP  2.0
LLVMTCEPOMBuilder.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 LLVMTCEPOMBuilder.hh
26  *
27  * This builder builds a sequential POM from the new LLVM TTA backend format.
28  *
29  * @author Pekka Jääskeläinen 2010
30  * @note reting: red
31  */
32 
33 #ifndef LLVM_TCE_POM_BUILDER_H
34 #define LLVM_TCE_POM_BUILDER_H
35 
36 #include <map>
37 #include <set>
38 #include <iostream>
39 
40 #include "CompilerWarnings.hh"
41 IGNORE_COMPILER_WARNING("-Wunused-parameter")
42 
43 #include <llvm/CodeGen/MachineFunctionPass.h>
44 #include <llvm/CodeGen/MachineConstantPool.h>
45 #include <llvm/CodeGen/MachineOperand.h>
46 #include <llvm/CodeGen/MachineInstr.h>
47 #include <llvm/CodeGen/MachineBasicBlock.h>
48 
49 #include "tce_config.h"
50 #include <llvm/IR/Mangler.h>
51 #include <llvm/IR/Constant.h>
52 #include <llvm/Transforms/IPO.h>
53 
54 #include "Exception.hh"
55 
56 // tce_config.h defines these. this undef to avoid warning.
57 // TODO: how to do this in tce_config.h???
58 #ifdef LLVM_LIBDIR
59 #undef LLVM_LIBDIR
60 #endif
61 #include "BaseType.hh"
62 #include "LLVMPOMBuilder.hh"
63 
65 
66 namespace TTAProgram {
67  class TerminalFUPort;
68 }
69 
70 namespace llvm {
71 
72  extern "C" MachineFunctionPass* createLLVMTCEPOMBuilderPass();
73 
74  /**
75  * Implements building TCE POM from TTA-style (MOVE) sequential input
76  * from LLVM codegen.
77  *
78  * @note Experimental and still lots to do before can be considered for
79  * real use.
80  */
82  public:
83  static char ID;
85  virtual ~LLVMTCEPOMBuilder() {}
86 
87  virtual unsigned spDRegNum() const;
88  virtual unsigned raPortDRegNum() const;
89  virtual TCEString registerFileName(unsigned llvmRegNum) const;
90  virtual int registerIndex(unsigned llvmRegNum) const;
91  virtual TCEString operationName(const MachineInstr& mi) const;
93  const MachineOperand&) const;
94  bool doFinalization(Module& m);
95  bool doInitialization(Module &M);
97  const MachineInstr* mi, TTAProgram::CodeSnippet* proc,
98  bool conditional=false, bool trueGuard=true);
99  };
100 }
101 
102 #endif
TTAProgram
Definition: Estimator.hh:65
llvm
Definition: InlineAsmParser.hh:49
llvm::LLVMTCEPOMBuilder::~LLVMTCEPOMBuilder
virtual ~LLVMTCEPOMBuilder()
Definition: LLVMTCEPOMBuilder.hh:85
BaseType.hh
Exception.hh
TTAProgram::Instruction
Definition: Instruction.hh:57
llvm::LLVMTCEPOMBuilder::spDRegNum
virtual unsigned spDRegNum() const
Definition: LLVMTCEPOMBuilder.cc:72
llvm::LLVMTCEPOMBuilder::LLVMTCEPOMBuilder
LLVMTCEPOMBuilder()
Definition: LLVMTCEPOMBuilder.cc:67
llvm::LLVMTCEPOMBuilder::doInitialization
bool doInitialization(Module &M)
Definition: LLVMTCEPOMBuilder.cc:184
llvm::createLLVMTCEPOMBuilderPass
MachineFunctionPass * createLLVMTCEPOMBuilderPass()
Definition: LLVMTCEPOMBuilder.cc:179
llvm::LLVMTCEPOMBuilder
Definition: LLVMTCEPOMBuilder.hh:81
llvm::LLVMTCEPOMBuilder::ID
static char ID
Definition: LLVMTCEPOMBuilder.hh:83
LLVMPOMBuilder.hh
llvm::LLVMTCEPOMBuilder::registerFileName
virtual TCEString registerFileName(unsigned llvmRegNum) const
Definition: LLVMTCEPOMBuilder.cc:82
TTAProgram::CodeSnippet
Definition: CodeSnippet.hh:59
IGNORE_COMPILER_WARNING
#define IGNORE_COMPILER_WARNING(X)
Definition: CompilerWarnings.hh:51
llvm::LLVMTCEPOMBuilder::createFUTerminal
virtual TTAProgram::Terminal * createFUTerminal(const MachineOperand &) const
Definition: LLVMTCEPOMBuilder.cc:131
TCEString
Definition: TCEString.hh:53
llvm::LLVMTCEPOMBuilder::operationName
virtual TCEString operationName(const MachineInstr &mi) const
Definition: LLVMTCEPOMBuilder.cc:126
POP_COMPILER_DIAGS
#define POP_COMPILER_DIAGS
Definition: CompilerWarnings.hh:68
llvm::LLVMTCEPOMBuilder::registerIndex
virtual int registerIndex(unsigned llvmRegNum) const
Definition: LLVMTCEPOMBuilder.cc:90
TTAProgram::Terminal
Definition: Terminal.hh:60
llvm::LLVMTCEBuilder
Definition: LLVMTCEBuilder.hh:102
CompilerWarnings.hh
llvm::LLVMTCEPOMBuilder::raPortDRegNum
virtual unsigned raPortDRegNum() const
Definition: LLVMTCEPOMBuilder.cc:77
llvm::LLVMTCEPOMBuilder::doFinalization
bool doFinalization(Module &m)
Definition: LLVMTCEPOMBuilder.cc:190
llvm::LLVMTCEPOMBuilder::emitMove
TTAProgram::Instruction * emitMove(const MachineInstr *mi, TTAProgram::CodeSnippet *proc, bool conditional=false, bool trueGuard=true)
Definition: LLVMTCEPOMBuilder.cc:98