OpenASIP  2.0
LLVMTCEBuilder.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2015 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 LLVMTCEBuilder.hh
26  *
27  * Declaration of LLVMTCEBuilder class.
28  *
29  * @author Pekka Jääskeläinen 2010-2015
30  * @note reting: red
31  */
32 
33 #ifndef LLVM_TCE_BUILDER_H
34 #define LLVM_TCE_BUILDER_H
35 
36 #include <map>
37 #include <set>
38 #include <llvm/CodeGen/MachineFunctionPass.h>
39 #include <llvm/CodeGen/MachineConstantPool.h>
40 #include <llvm/CodeGen/MachineOperand.h>
41 #include <llvm/CodeGen/MachineInstr.h>
42 #include <llvm/CodeGen/MachineBasicBlock.h>
43 
44 #include "tce_config.h"
45 #include <llvm/IR/Mangler.h>
46 #include <llvm/IR/Constant.h>
47 #include <llvm/Transforms/IPO.h>
48 
49 // tce_config.h defines these. this undef to avoid warning.
50 // TODO: how to do this in tce_config.h???
51 #ifdef LLVM_LIBDIR
52 #undef LLVM_LIBDIR
53 #endif
54 
55 #include "Exception.hh"
56 #include "BaseType.hh"
57 #include "TCEString.hh"
58 #include "passes/MachineDCE.hh"
59 #include "TCETargetMachine.hh"
60 #include "ProgramOperation.hh"
61 #include "InlineAsmParser.hh"
62 
63 namespace TTAProgram {
64  class Program;
65  class Procedure;
66  class CodeSnippet;
67  class BasicBlock;
68  class Terminal;
69  class TerminalRegister;
70  class TerminalInstructionAddress;
71  class InstructionReferenceManager;
72  class TerminalProgramOperation;
73  class Instruction;
74  class DataMemory;
75  class DataDefinition;
76  class Move;
77  class MoveGuard;
78 }
79 
81 class UniversalMachine;
82 class Operation;
84 
85 namespace TTAMachine {
86  class Machine;
87  class AddressSpace;
88  class Bus;
89  class HWOperation;
90 }
91 namespace llvm {
92 
93  class ConstantInt;
94  class ConstantFP;
95  class ConstantExpr;
96  class ConstantDataSequential;
97  class TCETargetMachine;
98 
99  /**
100  * Base class for the various LLVM to TCE builder implementations.
101  */
102  class LLVMTCEBuilder : public MachineFunctionPass {
103 
104  public:
105  static char ID; // Pass identification, replacement for typeid
106 
107  LLVMTCEBuilder(char& ID);
108 
110  const TargetMachine& tm,
111  TTAMachine::Machine* mach,
112  char& ID,
113  bool functionAtATime=false);
114 
115  virtual ~LLVMTCEBuilder();
116 
118 
120  const llvm::BasicBlock* bb) {
121  return bbIndex_[bb];
122  }
124 
125  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
126  AU.addRequired<AAResultsWrapperPass>();
127  AU.addRequired<MachineDCE>();
128  AU.addPreserved<MachineDCE>();
129  MachineFunctionPass::getAnalysisUsage(AU);
130  }
131 
132  virtual bool isTTATarget() const {
133  return (dynamic_cast<const TCETargetMachine*>(
134  &targetMachine()) != NULL);
135  }
136 
137  void deleteDeadProcedures();
138 
139  void setInitialStackPointerValue(unsigned value);
140 
141  protected:
142 
143  bool doInitialization(Module &M);
144  bool runOnMachineFunction(MachineFunction &MF);
145  bool doFinalization(Module &M);
146 
148  const TTAProgram::Instruction& instr) const;
149 
150  virtual bool writeMachineFunction(MachineFunction &MF);
151  void initDataSections();
152 
153  std::shared_ptr<TTAProgram::Move> createMove(
154  const MachineOperand& src, const MachineOperand& dst,
155  TTAProgram::MoveGuard* guard);
156 
157  const TargetMachine& targetMachine() const { return *tm_; }
158 
159  /* Methods used for overriding TTA backend-specific behavior. */
160  // the stack pointer register's llvm reg number
161  virtual unsigned spDRegNum() const = 0;
162  // the return address register's llvm reg number
163  virtual unsigned raPortDRegNum() const = 0;
164  // the ADF register file name of the llvm reg number
165  virtual TCEString registerFileName(unsigned llvmRegNum) const = 0;
166  // the ADF register index of the llvm reg number
167  virtual int registerIndex(unsigned llvmRegNum) const = 0;
168  // OSAL operation name from a LLVM MachineInstr
169  TCEString registerName(unsigned llvmRegNum) const;
170  virtual TCEString operationName(const MachineInstr& mi) const = 0;
172  const MachineOperand&) const {
173  return NULL;
174  }
175 
176  /* Helper methods */
177  std::string mbbName(const MachineBasicBlock& mbb);
178 
179  const TTAMachine::HWOperation& getHWOperation(std::string opName);
180 
182  const std::string& rfName, int index);
183 
185  const MachineOperand& mo, int bitLimit = 0);
186 
187  std::shared_ptr<TTAProgram::Move> createMove(
190  const TTAMachine::Bus &bus,
191  TTAProgram::MoveGuard *guard = NULL);
192 
193  void emitConstantPool(const llvm::MachineConstantPool& cp);
194 
196  const MachineOperand& mo);
197 
199  const MachineOperand& mo);
200 
202  const MachineOperand& mo);
203 
205  const TCEString& symbolName);
206 
208  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
209 
211  const MachineInstr* mi, TTAProgram::CodeSnippet* proc,
212  bool conditional=false, bool trueGuard=true);
213 
215  const MachineFunction& mf,
216  const MachineInstr* mi,
219 
221 
223  TCEString label, ProgramOperationPtr po) {
224  labeledPOs_[label] = po;
225  }
226 
227  virtual void emitSPInitialization();
228 
230 
232  labeledPOs_.clear();
233  symbolicPORefs_.clear();
234  }
235 
236  static bool isInlineAsm(const MachineInstr& instr);
237 
238  /// Code labels.
239  std::map<std::string, TTAProgram::Instruction*> codeLabels_;
240 
241  /// Machine for building the program.
243 
244  /// Target machine description.
245  const llvm::TargetMachine* tm_;
246  /// Mangler for mangling label strings.
247  llvm::Mangler* mang_;
248 
249  /// Current program being built.
251 
252  /// The operations supported by the current target machine.
253  std::set<std::string> opset_;
254 
255  // set to true in case the builder is used to schedule one
256  // function at a time (the default processes the whole module)
258 
260 
262 
264 
265  MachineFrameInfo* curFrameInfo_;
266 
267  /// The compiler options.
269 
270  private:
271 
272  /// Data definition structure for global values.
273  struct DataDef {
274  std::string name;
275  //llvm::Constant* initializer;
276  unsigned address;
277  unsigned addressSpaceId;
278  unsigned alignment;
279  unsigned size;
281  };
282 
283  /// Data definition structure for constant pool values
285  unsigned address = 0;
286  unsigned alignment = 0;
287  unsigned size = 0;
288  const llvm::Constant* value = nullptr;
289 
291  unsigned addr,
292  unsigned align,
293  unsigned size,
294  const llvm::Constant* value)
295  : address(addr), alignment(align), size(size), value(value) {}
296  };
297 
298  typedef std::map<TTAMachine::AddressSpace*, TTAProgram::DataMemory*>
300 
301  void initMembers();
302 
303  void emitDataDef(const DataDef& def);
304  void emitDataDef(const ConstantDataDef& def);
305 
306  unsigned createDataDefinition(
307  int addressSpaceId, unsigned& addr, const Constant* cv,
308  bool forceInitialize=false, unsigned forceAlignment=0);
309 
311  int addressSpaceId, unsigned& addr, const llvm::ConstantInt* ci,
312  bool isPointer = false);
313 
315  int addressSpaceId, unsigned& addr, const llvm::ConstantFP* cfp);
316 
318  int addressSpaceId, unsigned& addr, const GlobalValue* gv,
319  int offset = 0);
320 
322  int addressSpaceId, unsigned& addr, const ConstantExpr* gv,
323  int offset = 0);
324 
325  void padToAlignment(
326  int addressSpaceId, unsigned& addr, unsigned align);
327 
329  const MachineOperand& base, const MachineOperand& offset);
330 
332  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
333 
335  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
336 
338  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
339 
341  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
342 
344  const std::string op,
345  const MachineInstr* mi,
347 
349  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
350 
352  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
353 
355  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
356 
358  const MachineInstr* mi, TTAProgram::CodeSnippet* proc,
359  bool constructors);
360 
362  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
363 
365  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
366 
368  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
369 
371  const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
372 
374  TCEString firstOp, const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
375 
377  TCEString opName, const MachineInstr* mi, TTAProgram::CodeSnippet* proc);
378 
379  void createSPInitLoad(
380  TTAProgram::CodeSnippet& target,
382  TTAProgram::Terminal& dst);
383 
384  bool isInitialized(const Constant* cv);
385 
387  const TTAProgram::Terminal* guardReg, bool trueOrFalse);
388 
390  const llvm::MachineInstr* mi, TTAProgram::Move& move);
392  const llvm::MachineInstr* mi, TTAProgram::Move& move);
393 
394  bool isBaseOffsetMemOperation(const Operation& operation) const;
395 
396  // Create MoveNodes before calling DDGBuilder.
397  virtual void createMoveNode(
399  std::shared_ptr<TTAProgram::Move> m,
400  bool /*isDestination*/) {}
401 
402  unsigned addressSpaceId(TTAMachine::AddressSpace& aSpace) const;
404  unsigned& dataEnd(TTAMachine::AddressSpace& aSpace);
405 
407  unsigned asNum, TTAProgram::Move& move);
408 
411 
412  void copyFUAnnotations(
413  const std::vector<TTAProgram::Instruction*>& operandMoves,
414  TTAProgram::Move& move) const;
415 
416  std::string getAsmString(const MachineInstr& mi) const;
417 
418  /// Target architechture MAU size in bits.
419  static unsigned MAU_BITS;
420 
421  /// Target architecture pointer size in maus.
422  static unsigned POINTER_SIZE_32;
423  static unsigned POINTER_SIZE_64;
424 
425  llvm::Module* mod_;
426 
428 
429  /// The default data memory address space (address space 0).
431 
432  /// Set to true in case this machine has more than one data
433  /// address spaces.
435 
436 #if 0
437  /// Data memory initializations.
438  TTAProgram::DataMemory* dmem_;
439 #endif
441 
442  /// Data definitions.
443  std::vector<DataDef> data_;
444  std::vector<DataDef> udata_;
445  std::vector<ConstantDataDef> cpData_;
446 
447  /// Machine basic block -> first instruction in the BB map.
448  std::map<std::string, TTAProgram::Instruction*> mbbs_;
449 
450  /// Basic Block -> first instruction in the BB map
451  std::map<const llvm::BasicBlock*, TTAProgram::Instruction*> bbIndex_;
452 
453  /// Data labels.
454  std::map<std::string, unsigned> dataLabels_;
455 
456  /// Dummy code label references that have to be fixed after
457  /// all instrutions have been built.
458  std::map<TTAProgram::TerminalInstructionAddress*, std::string>
460 
461  /// Dummy basic block references that have to be fixed after
462  /// all basic blocks have been built.
464  std::string>
466 
467  /// Dummy references to the _end symbol.
468  std::vector<std::shared_ptr<TTAProgram::Move> > endReferences_;
469 
470  /// Global constant pool for all constants gathered from machine
471  /// functions. Map key is unique constant and the value is address of
472  /// the constant.
473  std::map<const llvm::Constant*, unsigned> globalCP_;
474  /// Constant pool for the current machine function. Map key is constant
475  /// pool index and the value is address.
476  std::map<unsigned, unsigned> currentFnCP_;
477 
478  /// The first position after the last data in the given address space.
479  std::map<TTAMachine::AddressSpace*, unsigned> dataEnds_;
480 
481 #if 0
482  unsigned end_;
483 #endif
484 
485  /// set to true in case at least one 'noalias' attribute (from
486  /// the use of 'restricted' pointers) has been found
488  /// set to true in case at least one non-default address space
489  /// memory access has been found in the generated code
491 
492  /// List of machine functions collected from runForMachineFunction.
493  std::vector<MachineFunction*> functions_;
494 
496 
497  std::set<TTAProgram::TerminalProgramOperation*> symbolicPORefs_;
498 
499  std::map<TCEString, ProgramOperationPtr > labeledPOs_;
500 
501  /// The data layout for the machine.
502  const llvm::DataLayout* dl_;
503  };
504 }
505 #endif
llvm::LLVMTCEBuilder::spillMoveCount_
int spillMoveCount_
Definition: LLVMTCEBuilder.hh:261
llvm::LLVMTCEBuilder::createSymbolReference
virtual TTAProgram::Terminal * createSymbolReference(const MachineOperand &mo)
Definition: LLVMTCEBuilder.cc:2298
llvm::LLVMTCEBuilder::dataEnd
unsigned & dataEnd(TTAMachine::AddressSpace &aSpace)
Definition: LLVMTCEBuilder.cc:3789
llvm::LLVMTCEBuilder::getAsmString
std::string getAsmString(const MachineInstr &mi) const
TTAProgram::TerminalInstructionAddress
Definition: TerminalInstructionAddress.hh:45
PRegionMarkerAnalyzer
Definition: PRegionMarkerAnalyzer.hh:42
llvm::LLVMTCEBuilder::MAU_BITS
static unsigned MAU_BITS
Target architechture MAU size in bits.
Definition: LLVMTCEBuilder.hh:419
TTAProgram
Definition: Estimator.hh:65
llvm
Definition: InlineAsmParser.hh:49
TTAProgram::Program
Definition: Program.hh:63
llvm::LLVMTCEBuilder::ConstantDataDef::size
unsigned size
Definition: LLVMTCEBuilder.hh:287
llvm::LLVMTCEBuilder::ID
static char ID
Definition: LLVMTCEBuilder.hh:105
llvm::LLVMTCEBuilder::doFinalization
bool doFinalization(Module &M)
Definition: LLVMTCEBuilder.cc:1090
llvm::LLVMTCEBuilder::LLVMTCEBuilder
LLVMTCEBuilder(char &ID)
Definition: LLVMTCEBuilder.cc:167
llvm::LLVMTCEBuilder::emitInstruction
TTAProgram::Instruction * emitInstruction(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:1322
llvm::LLVMTCEBuilder::dl_
const llvm::DataLayout * dl_
The data layout for the machine.
Definition: LLVMTCEBuilder.hh:502
llvm::LLVMTCEBuilder::prog_
TTAProgram::Program * prog_
Current program being built.
Definition: LLVMTCEBuilder.hh:250
BaseType.hh
llvm::LLVMTCEBuilder::multiDataMemMachine_
bool multiDataMemMachine_
Set to true in case this machine has more than one data address spaces.
Definition: LLVMTCEBuilder.hh:434
llvm::LLVMTCEBuilder::DataDef::name
std::string name
Definition: LLVMTCEBuilder.hh:274
llvm::LLVMTCEBuilder::createExprDataDefinition
void createExprDataDefinition(int addressSpaceId, unsigned &addr, const ConstantExpr *gv, int offset=0)
Definition: LLVMTCEBuilder.cc:836
llvm::LLVMTCEBuilder::dataMemoryForAddressSpace
TTAProgram::DataMemory & dataMemoryForAddressSpace(TTAMachine::AddressSpace &aSpace)
Definition: LLVMTCEBuilder.cc:3816
llvm::LLVMTCEBuilder::result
TTAProgram::Program * result()
Definition: LLVMTCEBuilder.cc:3713
llvm::LLVMTCEBuilder::emitMove
virtual TTAProgram::Instruction * emitMove(const MachineInstr *mi, TTAProgram::CodeSnippet *proc, bool conditional=false, bool trueGuard=true)
Definition: LLVMTCEBuilder.cc:2418
llvm::LLVMTCEBuilder::functions_
std::vector< MachineFunction * > functions_
List of machine functions collected from runForMachineFunction.
Definition: LLVMTCEBuilder.hh:493
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
Exception.hh
llvm::LLVMTCEBuilder::addCandidateLSUAnnotations
void addCandidateLSUAnnotations(unsigned asNum, TTAProgram::Move &move)
Definition: LLVMTCEBuilder.cc:3830
llvm::LLVMTCEBuilder::DataDef
Data definition structure for global values.
Definition: LLVMTCEBuilder.hh:273
llvm::LLVMTCEBuilder::codeLabelReferences_
std::map< TTAProgram::TerminalInstructionAddress *, std::string > codeLabelReferences_
Dummy code label references that have to be fixed after all instrutions have been built.
Definition: LLVMTCEBuilder.hh:459
llvm::LLVMTCEBuilder::DataDef::alignment
unsigned alignment
Definition: LLVMTCEBuilder.hh:278
llvm::LLVMTCEBuilder::firstInstructionOfBasicBlock
TTAProgram::Instruction * firstInstructionOfBasicBlock(const llvm::BasicBlock *bb)
Definition: LLVMTCEBuilder.hh:119
llvm::LLVMTCEBuilder::opset_
std::set< std::string > opset_
The operations supported by the current target machine.
Definition: LLVMTCEBuilder.hh:253
llvm::LLVMTCEBuilder::options_
LLVMTCECmdLineOptions * options_
The compiler options.
Definition: LLVMTCEBuilder.hh:268
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAMachine::Bus
Definition: Bus.hh:53
llvm::LLVMTCEBuilder::emitComparisonForBranch
TTAProgram::Instruction * emitComparisonForBranch(TCEString firstOp, const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:1727
llvm::LLVMTCEBuilder::addPointerAnnotations
void addPointerAnnotations(const llvm::MachineInstr *mi, TTAProgram::Move &move)
Definition: LLVMTCEBuilder.cc:1823
llvm::LLVMTCEBuilder::emitSpecialInlineAsm
TTAProgram::Instruction * emitSpecialInlineAsm(const std::string op, const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3156
llvm::LLVMTCEBuilder::createAddrTerminal
TTAProgram::Terminal * createAddrTerminal(const MachineOperand &base, const MachineOperand &offset)
llvm::LLVMTCEBuilder::createGlobalValueDataDefinition
void createGlobalValueDataDefinition(int addressSpaceId, unsigned &addr, const GlobalValue *gv, int offset=0)
Definition: LLVMTCEBuilder.cc:785
llvm::LLVMTCEBuilder::tm_
const llvm::TargetMachine * tm_
Target machine description.
Definition: LLVMTCEBuilder.hh:245
llvm::LLVMTCEBuilder::DataDef::initialize
bool initialize
Definition: LLVMTCEBuilder.hh:280
llvm::LLVMTCEBuilder::defaultDataAddressSpace_
TTAMachine::AddressSpace * defaultDataAddressSpace_
The default data memory address space (address space 0).
Definition: LLVMTCEBuilder.hh:430
llvm::LLVMTCEBuilder::curFrameInfo_
MachineFrameInfo * curFrameInfo_
Definition: LLVMTCEBuilder.hh:265
llvm::LLVMTCEBuilder::POINTER_SIZE_32
static unsigned POINTER_SIZE_32
Target architecture pointer size in maus.
Definition: LLVMTCEBuilder.hh:422
llvm::LLVMTCEBuilder::udata_
std::vector< DataDef > udata_
Definition: LLVMTCEBuilder.hh:444
llvm::LLVMTCEBuilder::emitOperationMacro
TTAProgram::Instruction * emitOperationMacro(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:2860
llvm::LLVMTCEBuilder::noAliasFound_
bool noAliasFound_
set to true in case at least one 'noalias' attribute (from the use of 'restricted' pointers) has been...
Definition: LLVMTCEBuilder.hh:487
llvm::LLVMTCEBuilder::functionAtATime_
bool functionAtATime_
Definition: LLVMTCEBuilder.hh:257
llvm::LLVMTCEBuilder::createSPInitLoad
void createSPInitLoad(TTAProgram::CodeSnippet &target, TTAProgram::Terminal &src, TTAProgram::Terminal &dst)
Definition: LLVMTCEBuilder.cc:3654
llvm::LLVMTCEBuilder::emitReturnTo
TTAProgram::Instruction * emitReturnTo(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3244
llvm::LLVMTCEBuilder::mach_
TTAMachine::Machine * mach_
Machine for building the program.
Definition: LLVMTCEBuilder.hh:242
llvm::LLVMTCEBuilder::emitWriteSP
TTAProgram::Instruction * emitWriteSP(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3275
llvm::LLVMTCEBuilder::initialStackPointerValue_
unsigned initialStackPointerValue_
Definition: LLVMTCEBuilder.hh:263
llvm::LLVMTCEBuilder::fixProgramOperationReferences
void fixProgramOperationReferences()
Definition: LLVMTCEBuilder.cc:2276
llvm::LLVMTCEBuilder::mbbs_
std::map< std::string, TTAProgram::Instruction * > mbbs_
Machine basic block -> first instruction in the BB map.
Definition: LLVMTCEBuilder.hh:448
llvm::LLVMTCEBuilder::dataLabels_
std::map< std::string, unsigned > dataLabels_
Data labels.
Definition: LLVMTCEBuilder.hh:454
llvm::LLVMTCEBuilder::createTerminal
TTAProgram::Terminal * createTerminal(const MachineOperand &mo, int bitLimit=0)
Definition: LLVMTCEBuilder.cc:2149
llvm::LLVMTCEBuilder::mang_
llvm::Mangler * mang_
Mangler for mangling label strings.
Definition: LLVMTCEBuilder.hh:247
llvm::LLVMTCEBuilder::createIntDataDefinition
void createIntDataDefinition(int addressSpaceId, unsigned &addr, const llvm::ConstantInt *ci, bool isPointer=false)
Definition: LLVMTCEBuilder.cc:634
llvm::LLVMTCEBuilder::cpData_
std::vector< ConstantDataDef > cpData_
Definition: LLVMTCEBuilder.hh:445
llvm::LLVMTCEBuilder::emitConstantPool
void emitConstantPool(const llvm::MachineConstantPool &cp)
Definition: LLVMTCEBuilder.cc:2346
llvm::LLVMTCEBuilder::initMembers
void initMembers()
Definition: LLVMTCEBuilder.cc:172
llvm::LLVMTCEBuilder::bbIndex_
std::map< const llvm::BasicBlock *, TTAProgram::Instruction * > bbIndex_
Basic Block -> first instruction in the BB map.
Definition: LLVMTCEBuilder.hh:451
llvm::LLVMTCEBuilder::multiAddrSpacesFound_
bool multiAddrSpacesFound_
set to true in case at least one non-default address space memory access has been found in the genera...
Definition: LLVMTCEBuilder.hh:490
llvm::LLVMTCEBuilder::mod_
llvm::Module * mod_
Definition: LLVMTCEBuilder.hh:425
ProgramOperationPtr
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition: MoveNode.hh:52
llvm::LLVMTCEBuilder::endReferences_
std::vector< std::shared_ptr< TTAProgram::Move > > endReferences_
Dummy references to the _end symbol.
Definition: LLVMTCEBuilder.hh:468
llvm::LLVMTCEBuilder::isInitialized
bool isInitialized(const Constant *cv)
Definition: LLVMTCEBuilder.cc:2648
llvm::LLVMTCEBuilder::emitSPInitialization
virtual void emitSPInitialization()
Definition: LLVMTCEBuilder.cc:2669
llvm::LLVMTCEBuilder::ConstantDataDef::ConstantDataDef
ConstantDataDef(unsigned addr, unsigned align, unsigned size, const llvm::Constant *value)
Definition: LLVMTCEBuilder.hh:290
llvm::LLVMTCEBuilder::copyFUAnnotations
void copyFUAnnotations(const std::vector< TTAProgram::Instruction * > &operandMoves, TTAProgram::Move &move) const
Definition: LLVMTCEBuilder.cc:1797
TCEString.hh
llvm::LLVMTCEBuilder::emitDataDef
void emitDataDef(const DataDef &def)
Definition: LLVMTCEBuilder.cc:443
llvm::LLVMTCEBuilder::createMoveNode
virtual void createMoveNode(ProgramOperationPtr &, std::shared_ptr< TTAProgram::Move > m, bool)
Definition: LLVMTCEBuilder.hh:397
llvm::LLVMTCEBuilder::createTerminalRegister
TTAProgram::TerminalRegister * createTerminalRegister(const std::string &rfName, int index)
Definition: LLVMTCEBuilder.cc:2120
llvm::LLVMTCEBuilder::getAnalysisUsage
virtual void getAnalysisUsage(AnalysisUsage &AU) const
Definition: LLVMTCEBuilder.hh:125
llvm::LLVMTCEBuilder::createGuard
TTAProgram::MoveGuard * createGuard(const TTAProgram::Terminal *guardReg, bool trueOrFalse)
Definition: LLVMTCEBuilder.cc:3720
InlineAsmParser.hh
llvm::LLVMTCEBuilder::registerIndex
virtual int registerIndex(unsigned llvmRegNum) const =0
UniversalMachine
Definition: UniversalMachine.hh:56
llvm::LLVMTCEBuilder::DataDef::size
unsigned size
Definition: LLVMTCEBuilder.hh:279
TCETargetMachine.hh
llvm::LLVMTCEBuilder::raPortDRegNum
virtual unsigned raPortDRegNum() const =0
llvm::LLVMTCEBuilder::emitSelect
TTAProgram::Instruction * emitSelect(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:2561
llvm::LLVMTCEBuilder::emitLoad
TTAProgram::Instruction * emitLoad(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
llvm::LLVMTCEBuilder::globalCP_
std::map< const llvm::Constant *, unsigned > globalCP_
Global constant pool for all constants gathered from machine functions. Map key is unique constant an...
Definition: LLVMTCEBuilder.hh:473
llvm::LLVMTCEBuilder::emitLongjmp
TTAProgram::Instruction * emitLongjmp(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3584
llvm::LLVMTCEBuilder::DataDef::address
unsigned address
Definition: LLVMTCEBuilder.hh:276
llvm::LLVMTCEBuilder::instrAddressSpace_
TTAMachine::AddressSpace * instrAddressSpace_
Definition: LLVMTCEBuilder.hh:427
llvm::LLVMTCEBuilder::isInlineAsm
static bool isInlineAsm(const MachineInstr &instr)
Definition: LLVMTCEBuilder.cc:3908
llvm::LLVMTCEBuilder::~LLVMTCEBuilder
virtual ~LLVMTCEBuilder()
Definition: LLVMTCEBuilder.cc:196
llvm::LLVMTCEBuilder::dataInitialized_
bool dataInitialized_
Definition: LLVMTCEBuilder.hh:495
llvm::LLVMTCEBuilder::registerName
TCEString registerName(unsigned llvmRegNum) const
TTAProgram::Move
Definition: Move.hh:55
llvm::LLVMTCEBuilder::operationName
virtual TCEString operationName(const MachineInstr &mi) const =0
llvm::LLVMTCEBuilder::emitSetjmp
TTAProgram::Instruction * emitSetjmp(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3375
llvm::LLVMTCEBuilder::DataDef::addressSpaceId
unsigned addressSpaceId
Definition: LLVMTCEBuilder.hh:277
llvm::LLVMTCEBuilder::ConstantDataDef::address
unsigned address
Definition: LLVMTCEBuilder.hh:285
llvm::MachineDCE
Definition: MachineDCE.hh:66
llvm::LLVMTCEBuilder::symbolicPORefs_
std::set< TTAProgram::TerminalProgramOperation * > symbolicPORefs_
Definition: LLVMTCEBuilder.hh:497
llvm::LLVMTCEBuilder::currentFnCP_
std::map< unsigned, unsigned > currentFnCP_
Constant pool for the current machine function. Map key is constant pool index and the value is addre...
Definition: LLVMTCEBuilder.hh:476
LLVMTCECmdLineOptions
Definition: LLVMTCECmdLineOptions.hh:48
llvm::LLVMTCEBuilder::createMBBReference
virtual TTAProgram::Terminal * createMBBReference(const MachineOperand &mo)
Definition: LLVMTCEBuilder.cc:2288
llvm::LLVMTCEBuilder::emitReadSP
TTAProgram::Instruction * emitReadSP(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3207
Operation
Definition: Operation.hh:59
llvm::LLVMTCEBuilder::data_
std::vector< DataDef > data_
Data definitions.
Definition: LLVMTCEBuilder.hh:443
TTAProgram::CodeSnippet
Definition: CodeSnippet.hh:59
llvm::LLVMTCEBuilder::createFUTerminal
virtual TTAProgram::Terminal * createFUTerminal(const MachineOperand &) const
Definition: LLVMTCEBuilder.hh:171
llvm::LLVMTCEBuilder::mbbReferences_
std::map< TTAProgram::TerminalInstructionAddress *, std::string > mbbReferences_
Dummy basic block references that have to be fixed after all basic blocks have been built.
Definition: LLVMTCEBuilder.hh:465
llvm::LLVMTCEBuilder::labeledPOs_
std::map< TCEString, ProgramOperationPtr > labeledPOs_
Definition: LLVMTCEBuilder.hh:499
ProgramOperation.hh
llvm::LLVMTCEBuilder::isBaseOffsetMemOperation
bool isBaseOffsetMemOperation(const Operation &operation) const
llvm::LLVMTCEBuilder::dataEnds_
std::map< TTAMachine::AddressSpace *, unsigned > dataEnds_
The first position after the last data in the given address space.
Definition: LLVMTCEBuilder.hh:479
llvm::LLVMTCEBuilder::createProgramOperationReference
virtual TTAProgram::Terminal * createProgramOperationReference(const MachineOperand &mo)
Definition: LLVMTCEBuilder.cc:2260
llvm::LLVMTCEBuilder::getHWOperation
const TTAMachine::HWOperation & getHWOperation(std::string opName)
Definition: LLVMTCEBuilder.cc:1288
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
llvm::LLVMTCEBuilder::isProgramUsingRestrictedPointers
bool isProgramUsingRestrictedPointers() const
Definition: LLVMTCEBuilder.hh:123
llvm::LLVMTCEBuilder::doInitialization
bool doInitialization(Module &M)
Definition: LLVMTCEBuilder.cc:429
llvm::LLVMTCEBuilder::spDRegNum
virtual unsigned spDRegNum() const =0
TTAProgram::InstructionReferenceManager
Definition: InstructionReferenceManager.hh:82
llvm::LLVMTCEBuilder::ConstantDataDef::value
const llvm::Constant * value
Definition: LLVMTCEBuilder.hh:288
llvm::LLVMTCEBuilder::padToAlignment
void padToAlignment(int addressSpaceId, unsigned &addr, unsigned align)
Definition: LLVMTCEBuilder.cc:917
llvm::LLVMTCEBuilder::POINTER_SIZE_64
static unsigned POINTER_SIZE_64
Definition: LLVMTCEBuilder.hh:423
llvm::LLVMTCEBuilder::hasAmbiguousASpaceRefs
bool hasAmbiguousASpaceRefs(const TTAProgram::Instruction &instr) const
Definition: LLVMTCEBuilder.cc:1259
llvm::LLVMTCEBuilder::runOnMachineFunction
bool runOnMachineFunction(MachineFunction &MF)
Definition: LLVMTCEBuilder.cc:947
llvm::LLVMTCEBuilder::emitReturn
TTAProgram::Instruction * emitReturn(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:2530
llvm::LLVMTCEBuilder::addressSpaceById
TTAMachine::AddressSpace & addressSpaceById(unsigned id)
Definition: LLVMTCEBuilder.cc:3765
llvm::LLVMTCEBuilder::ConstantDataDef
Data definition structure for constant pool values.
Definition: LLVMTCEBuilder.hh:284
llvm::LLVMTCEBuilder::writeMachineFunction
virtual bool writeMachineFunction(MachineFunction &MF)
Definition: LLVMTCEBuilder.cc:959
TCEString
Definition: TCEString.hh:53
llvm::LLVMTCEBuilder::dmemIndex_
DataMemIndex dmemIndex_
Definition: LLVMTCEBuilder.hh:440
llvm::LLVMTCEBuilder::codeLabels_
std::map< std::string, TTAProgram::Instruction * > codeLabels_
Code labels.
Definition: LLVMTCEBuilder.hh:239
MachineDCE.hh
llvm::LLVMTCEBuilder::pregions_
PRegionMarkerAnalyzer * pregions_
Definition: LLVMTCEBuilder.hh:259
llvm::TCETargetMachine
Definition: TCETargetMachine.hh:106
TTAProgram::Terminal
Definition: Terminal.hh:60
llvm::LLVMTCEBuilder::setInitialStackPointerValue
void setInitialStackPointerValue(unsigned value)
Definition: LLVMTCEBuilder.cc:1240
llvm::LLVMTCEBuilder::debugDataToAnnotations
void debugDataToAnnotations(const llvm::MachineInstr *mi, TTAProgram::Move &move)
Definition: LLVMTCEBuilder.cc:2057
llvm::LLVMTCEBuilder::createFPDataDefinition
void createFPDataDefinition(int addressSpaceId, unsigned &addr, const llvm::ConstantFP *cfp)
Definition: LLVMTCEBuilder.cc:690
llvm::LLVMTCEBuilder::DataMemIndex
std::map< TTAMachine::AddressSpace *, TTAProgram::DataMemory * > DataMemIndex
Definition: LLVMTCEBuilder.hh:299
llvm::LLVMTCEBuilder::emitGlobalXXtructorCalls
TTAProgram::Instruction * emitGlobalXXtructorCalls(const MachineInstr *mi, TTAProgram::CodeSnippet *proc, bool constructors)
Definition: LLVMTCEBuilder.cc:3486
llvm::LLVMTCEBuilder::registerFileName
virtual TCEString registerFileName(unsigned llvmRegNum) const =0
TTAProgram::DataMemory
Definition: DataMemory.hh:56
TTAMachine
Definition: Assembler.hh:48
llvm::LLVMTCEBuilder::addressSpaceId
unsigned addressSpaceId(TTAMachine::AddressSpace &aSpace) const
TTAProgram::MoveGuard
Definition: MoveGuard.hh:47
llvm::LLVMTCEBuilder::createDataDefinition
unsigned createDataDefinition(int addressSpaceId, unsigned &addr, const Constant *cv, bool forceInitialize=false, unsigned forceAlignment=0)
Definition: LLVMTCEBuilder.cc:519
llvm::LLVMTCEBuilder::clearFunctionBookkeeping
void clearFunctionBookkeeping()
Definition: LLVMTCEBuilder.hh:231
llvm::LLVMTCEBuilder::emitStore
TTAProgram::Instruction * emitStore(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
llvm::LLVMTCEBuilder
Definition: LLVMTCEBuilder.hh:102
llvm::LLVMTCEBuilder::targetMachine
const TargetMachine & targetMachine() const
Definition: LLVMTCEBuilder.hh:157
llvm::LLVMTCEBuilder::addLabelForProgramOperation
void addLabelForProgramOperation(TCEString label, ProgramOperationPtr po)
Definition: LLVMTCEBuilder.hh:222
llvm::LLVMTCEBuilder::deleteDeadProcedures
void deleteDeadProcedures()
Definition: LLVMTCEBuilder.cc:1197
llvm::LLVMTCEBuilder::emitRemaingingBrach
TTAProgram::Instruction * emitRemaingingBrach(TCEString opName, const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:1765
llvm::LLVMTCEBuilder::initDataSections
void initDataSections()
Definition: LLVMTCEBuilder.cc:210
TTAProgram::TerminalRegister
Definition: TerminalRegister.hh:53
llvm::LLVMTCEBuilder::emitInlineAsm
TTAProgram::Instruction * emitInlineAsm(const MachineFunction &mf, const MachineInstr *mi, TTAProgram::BasicBlock *bb, TTAProgram::InstructionReferenceManager &irm)
Definition: LLVMTCEBuilder.cc:2786
TTAMachine::Machine
Definition: Machine.hh:73
llvm::LLVMTCEBuilder::isTTATarget
virtual bool isTTATarget() const
Definition: LLVMTCEBuilder.hh:132
llvm::LLVMTCEBuilder::mbbName
std::string mbbName(const MachineBasicBlock &mbb)
Definition: LLVMTCEBuilder.cc:2632
llvm::LLVMTCEBuilder::handleMemoryCategoryInfo
TTAProgram::Instruction * handleMemoryCategoryInfo(const MachineInstr *mi, TTAProgram::CodeSnippet *proc)
Definition: LLVMTCEBuilder.cc:3318
llvm::LLVMTCEBuilder::createMove
std::shared_ptr< TTAProgram::Move > createMove(const MachineOperand &src, const MachineOperand &dst, TTAProgram::MoveGuard *guard)
Definition: LLVMTCEBuilder.cc:2389
llvm::LLVMTCEBuilder::ConstantDataDef::alignment
unsigned alignment
Definition: LLVMTCEBuilder.hh:286