OpenASIP  2.0
TCESubtarget.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 TCESubtarget.cpp
26  *
27  * Implementation of TCESubtargetClass.
28  *
29  * @author Veli-Pekka Jääskeläinen 2007 (vjaaskel-no.spam-cs.tut.fi)
30  * @author Heikki Kultala 2013 (hkultala-no.spam-cs.tut.fi)
31  */
32 
33 #include "TCESubtarget.hh"
34 
35 #include <iostream>
36 
37 #include "LLVMTCECmdLineOptions.hh"
38 #include "TCETargetMachine.hh"
40 #include "llvm/Support/CommandLine.h"
41 
42 #define GET_SUBTARGETINFO_CTOR
43 #define GET_SUBTARGETINFO_MC_DESC
44 #define GET_SUBTARGETINFO_TARGET_DESC
45 
46 #define DEBUG_TYPE ""
47 
48 #include "TCEGenSubTargetInfo.inc"
49 
50 #undef DEBUG_TYPE
51 
52 #undef GET_SUBTARGETINFO_CTOR
53 #undef GET_SUBTARGETINFO_MC_DESC
54 #undef GET_SUBTARGETINFO_TARGET_DESC
55 
56 using namespace llvm;
57 
58 // Add plugin file name option.
59 cl::opt<std::string>
61  "tce-plugin-file",
62  cl::value_desc("plugin file"),
63  cl::desc("TCE target machine plugin file."),
64  cl::NotHidden);
65 
66 /**
67  * The Constructor.
68  */
70  : TCEGenSubtargetInfo(
71  Triple("tce-tut-llvm"), std::string(""), std::string(""),
72  std::string("")),
73 
74  pluginFile_(BackendPluginFile),
75  plugin_(plugin),
76  InstrItins(getInstrItineraryForCPU("generic")) {
77  assert(InstrItins.Itineraries != nullptr && "IstrItins not initialized");
78 }
79 
80 /**
81  * Returns full path of the plugin file name supplied with the
82  * -tce-plugin-file parameter.
83  *
84  * @return plugin file path
85  */
86 std::string
88  return pluginFile_;
89 }
90 
91 const TargetInstrInfo* TCESubtarget::getInstrInfo() const {
92  return plugin_->getInstrInfo();
93 }
94 
95 const TargetRegisterInfo* TCESubtarget::getRegisterInfo() const {
96  return plugin_->getRegisterInfo();
97 }
98 
99 const TargetFrameLowering* TCESubtarget::getFrameLowering() const {
100  return plugin_->getFrameLowering();
101 }
102 
103 const TargetLowering* TCESubtarget::getTargetLowering() const {
104  return plugin_->getTargetLowering();
105 }
106 
107 const SelectionDAGTargetInfo* TCESubtarget::getSelectionDAGInfo() const {
108  return plugin_->getSelectionDAGInfo();
109 }
110 
111 bool
113  return false;
114 }
llvm::TCESubtarget::InstrItins
InstrItineraryData InstrItins
Definition: TCESubtarget.hh:87
llvm
Definition: InlineAsmParser.hh:49
llvm::TCESubtarget::enableMachinePipeliner
virtual bool enableMachinePipeliner() const override
Definition: TCESubtarget.cc:112
TCETargetMachinePlugin.hh
llvm::TCETargetMachinePlugin::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const =0
llvm::TCESubtarget::TCESubtarget
TCESubtarget(TCETargetMachinePlugin *plugin)
Definition: TCESubtarget.cc:69
llvm::TCETargetMachinePlugin::getSelectionDAGInfo
virtual const SelectionDAGTargetInfo * getSelectionDAGInfo() const
Definition: TCETargetMachinePlugin.hh:244
llvm::TCESubtarget::pluginFileName
std::string pluginFileName()
Definition: TCESubtarget.cc:87
llvm::TCETargetMachinePlugin::getInstrInfo
virtual const TargetInstrInfo * getInstrInfo() const =0
llvm::TCETargetMachinePlugin::getTargetLowering
virtual TargetLowering * getTargetLowering() const =0
assert
#define assert(condition)
Definition: Application.hh:86
llvm::TCESubtarget::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const override
Definition: TCESubtarget.cc:95
BackendPluginFile
cl::opt< std::string > BackendPluginFile("tce-plugin-file", cl::value_desc("plugin file"), cl::desc("TCE target machine plugin file."), cl::NotHidden)
LLVMTCECmdLineOptions.hh
TCETargetMachine.hh
llvm::TCESubtarget::plugin_
TCETargetMachinePlugin * plugin_
Definition: TCESubtarget.hh:86
llvm::TCESubtarget::getTargetLowering
virtual const TargetLowering * getTargetLowering() const override
Definition: TCESubtarget.cc:103
llvm::TCETargetMachinePlugin
Definition: TCETargetMachinePlugin.hh:109
llvm::TCESubtarget::getInstrInfo
virtual const TargetInstrInfo * getInstrInfo() const override
Definition: TCESubtarget.cc:91
llvm::TCESubtarget::getSelectionDAGInfo
virtual const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
Definition: TCESubtarget.cc:107
llvm::TCESubtarget::pluginFile_
std::string pluginFile_
Definition: TCESubtarget.hh:85
llvm::TCESubtarget::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const override
Definition: TCESubtarget.cc:99
TCESubtarget.hh
llvm::TCETargetMachinePlugin::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const =0