OpenASIP  2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
InlineAsmParser Class Reference

#include <InlineAsmParser.hh>

Collaboration diagram for InlineAsmParser:
Collaboration graph

Public Member Functions

 InlineAsmParser ()=delete
 
 InlineAsmParser (const InlineAsmParser &)=delete
 
InlineAsmParseroperator= (const InlineAsmParser &)=delete
 
 InlineAsmParser (const llvm::TCETargetMachine &tm, const llvm::Mangler &mangler)
 
bool parse (const llvm::MachineInstr &inlineAsmMI, const std::map< std::string, unsigned > &symbolTable, TTAProgram::BasicBlock &bb, TTAProgram::InstructionReferenceManager &irm)
 
std::string substituteAsmString (const llvm::MachineInstr &mi, const std::map< std::string, unsigned > &symbolTable, const llvm::Mangler &mangler)
 
void addLiveRangeData (const llvm::MachineInstr &mi, TTAProgram::BasicBlock &bb)
 
bool sanityChecks (const llvm::MachineInstr &mi, TTAProgram::BasicBlock &bb) const
 
std::string registerName (const llvm::MachineOperand &mo) const
 
const AssemblyParserDiagnosticdiagnostics () const
 

Static Public Member Functions

static void addDebugInfoToInlineAsmBB (const llvm::MachineInstr &mi, TTAProgram::BasicBlock &bb)
 
static bool isInlineAsm (const llvm::MachineInstr &mi)
 

Private Member Functions

void reportError (size_t lineNum, const std::string &errorMsg)
 
void reportError (const std::string &errorMsg)
 

Static Private Member Functions

static void copyInstructions (TTAProgram::Program &prog, TTAProgram::BasicBlock &targetBB, TTAProgram::InstructionReferenceManager &irm)
 

Private Attributes

const llvm::TCETargetMachinetm_
 The target machine parsing context. More...
 
const llvm::Mangler & mangler_
 The symbol name mangler for MIs' symbolic references. More...
 
AssemblyParserDiagnostic parserDiagnostic_
 The diagnostic object to report parse and compile warnings and errors to. More...
 
unsigned asmId_ = 0
 The unique id for "%=" template strings. Each parse() call increases the count. More...
 

Detailed Description

The class for parsing TCE assembly listing written as inline assembly in C code.

The inline assembly is parsed as parallel code that does not need or should be scheduled.

Definition at line 64 of file InlineAsmParser.hh.

Constructor & Destructor Documentation

◆ InlineAsmParser() [1/3]

InlineAsmParser::InlineAsmParser ( )
delete

◆ InlineAsmParser() [2/3]

InlineAsmParser::InlineAsmParser ( const InlineAsmParser )
delete

◆ InlineAsmParser() [3/3]

InlineAsmParser::InlineAsmParser ( const llvm::TCETargetMachine tm,
const llvm::Mangler &  mangler 
)

Definition at line 68 of file InlineAsmParser.cc.

70  :
71  tm_(tm), mangler_(mangler) {
72  }

Member Function Documentation

◆ addDebugInfoToInlineAsmBB()

void InlineAsmParser::addDebugInfoToInlineAsmBB ( const llvm::MachineInstr &  mi,
TTAProgram::BasicBlock bb 
)
static

Adds gebug info to moves of the parsed inline asm.

Definition at line 159 of file InlineAsmParser.cc.

161  {
162 
163  // TODO/FIXME For some reason the source locations for asm block are
164  // shifted, pointing to incorrect lines of the source files.
165  // This error(?) can be seen already in disll.
166 
167  std::string sourceFileName;
168  size_t sourceLineNumber;
169  std::tie(sourceFileName, sourceLineNumber) = getSourceLocationInfo(mi);
170 
171  if (sourceFileName.size() >
173  sourceFileName =
174  sourceFileName.substr(
175  sourceFileName.size() -
178  }
181  sourceLineNumber);
182  if (sourceFileName.empty()) sourceFileName = "???";
185  sourceFileName);
186 
187  for (int i = 0; i < bb.instructionCount(); i++) {
189  for (int m = 0; m < instr.moveCount(); m++) {
190  TTAProgram::Move& move = instr.move(m);
191  move.addAnnotation(srcLineAnn);
192  move.addAnnotation(srcFileAnn);
193  }
194  }
195 }

References TTAProgram::AnnotatedInstructionElement::addAnnotation(), TTAProgram::ProgramAnnotation::ANN_DEBUG_SOURCE_CODE_LINE, TTAProgram::ProgramAnnotation::ANN_DEBUG_SOURCE_CODE_PATH, getSourceLocationInfo(), TTAProgram::CodeSnippet::instructionAtIndex(), TTAProgram::CodeSnippet::instructionCount(), TPEF::InstructionAnnotation::MAX_ANNOTATION_BYTES, TTAProgram::Instruction::move(), and TTAProgram::Instruction::moveCount().

Referenced by parse().

Here is the call graph for this function:

◆ addLiveRangeData()

void InlineAsmParser::addLiveRangeData ( const llvm::MachineInstr &  mi,
TTAProgram::BasicBlock bb 
)

Fills live range data structure.

This method only fills inlineAsmX_ fields in the structure. Data dependency graph builder handles the fields later on and build the proper live range data.

Definition at line 205 of file InlineAsmParser.cc.

207  {
208 
209  if (!bb.liveRangeData_) {
210  bb.liveRangeData_ = new LiveRangeData();
211  }
212 
213  auto& liveRangeData = *bb.liveRangeData_;
214  AsmOperandMap asmOperandMap = getInlineAsmOperands(mi);
215  for (auto& opds : asmOperandMap) {
216  auto asmOpdKind = std::get<0>(opds.second);
217  auto& asmOpdNodes = std::get<1>(opds.second);
218  TCEString reg;
219  switch (asmOpdKind) {
220  default:
221  break;
222  case InlineAsm::Kind_RegUse:
223  assert(asmOpdNodes.size() == 1);
224  reg = registerName(*asmOpdNodes.at(0));
225  liveRangeData.inlineAsmRegUses_.insert(reg);
226  break;
227  case InlineAsm::Kind_RegDefEarlyClobber:
228  case InlineAsm::Kind_RegDef:
229  assert(asmOpdNodes.size() == 1);
230  reg = registerName(*asmOpdNodes.at(0));
231  liveRangeData.inlineAsmRegDefs_.insert(reg);
232  break;
233  case InlineAsm::Kind_Clobber:
234  assert(asmOpdNodes.size() == 1);
235  reg = registerName(*asmOpdNodes.at(0));
236  liveRangeData.inlineAsmClobbers_.insert(reg);
237  break;
238  }
239  }
240 }

References assert, getInlineAsmOperands(), TTAProgram::BasicBlock::liveRangeData_, and registerName().

Referenced by parse().

Here is the call graph for this function:

◆ copyInstructions()

void InlineAsmParser::copyInstructions ( TTAProgram::Program prog,
TTAProgram::BasicBlock targetBB,
TTAProgram::InstructionReferenceManager irm 
)
staticprivate

Definition at line 502 of file InlineAsmParser.cc.

505  {
506 
507  using namespace TTAProgram;
508 
509  auto procCount = from.procedureCount();
510  // There should be only one default procedure from parsed inline asm.
511  // However, file-level inline asm could have more: TODO when supported.
512  assert(from.procedureCount() == 1
513  && "Procedures are not allowed in non-file-level inline asm.");
514 
515  // A map for fixing instruction references. Old instr -> copied instr.
516  std::map<const TTAProgram::Instruction*, TTAProgram::Instruction*>
517  instrCopyMap;
518  for (decltype(procCount) i = 0; i < procCount; i++) {
519  const auto& proc = from.procedureAtIndex(i);
520  auto instrCount = proc.instructionCount();
521  for (decltype(instrCount) i = 0; i < instrCount; i++) {
522  const auto& oldInstr = proc.instructionAtIndex(i);
523  auto newInstr = oldInstr.copy();
524  targetBB.add(newInstr);
525  instrCopyMap.insert({&oldInstr, newInstr});
526  }
527  }
528 
529  for (auto& pair : instrCopyMap) {
530  auto& newInstr = *pair.second;
531  for (auto& refTerm : getInstructionReferenceTerminals(newInstr)) {
532  auto& oldRefInstr = refTerm->instructionReference().instruction();
533  assert(instrCopyMap.count(&oldRefInstr));
534  auto newRefInstr = instrCopyMap.at(&oldRefInstr);
535  auto newRef = irm.createReference(*newRefInstr);
536  refTerm->setInstructionReference(newRef);
537  }
538  }
539 }

References TTAProgram::CodeSnippet::add(), assert, TTAProgram::InstructionReferenceManager::createReference(), getInstructionReferenceTerminals(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Program::procedureAtIndex(), and TTAProgram::Program::procedureCount().

Referenced by parse().

Here is the call graph for this function:

◆ diagnostics()

const AssemblyParserDiagnostic& InlineAsmParser::diagnostics ( ) const
inline

Definition at line 99 of file InlineAsmParser.hh.

99  {
100  return parserDiagnostic_;
101  }

References parserDiagnostic_.

Referenced by llvm::LLVMTCEBuilder::emitInlineAsm().

◆ isInlineAsm()

bool InlineAsmParser::isInlineAsm ( const llvm::MachineInstr &  mi)
static

Returns true if the instruction represents an inline asm block recognized by this parser.

Definition at line 450 of file InlineAsmParser.cc.

450  {
451  if (mi.isInlineAsm()) {
452  std::string amsStr(
453  mi.getOperand(InlineAsm::MIOp_AsmString).getSymbolName());
454  return amsStr.find_first_of("->;") != std::string::npos;
455  }
456  return false;
457 }

Referenced by llvm::LLVMTCEBuilder::isInlineAsm(), and substituteAsmString().

◆ operator=()

InlineAsmParser& InlineAsmParser::operator= ( const InlineAsmParser )
delete

◆ parse()

bool InlineAsmParser::parse ( const llvm::MachineInstr &  inlineAsmMI,
const std::map< std::string, unsigned > &  symbolTable,
TTAProgram::BasicBlock bb,
TTAProgram::InstructionReferenceManager irm 
)

Parses the given inline assembly instruction to POM basic block.

After call parser diagnostic object is populated with encountered warning and error reports if any. The object is received via diagnostics() function. The object is cleared next time this method is called.

Parameters
inlineAsmMIThe Instruction holding an inline asm block.
bbThe basic block to add parsed code into.
irmThe manager in where instruction references are copied to.
Returns
False if any errors in parsing. Otherwise returns true;

Definition at line 87 of file InlineAsmParser.cc.

91  {
92 
93 #ifdef DEBUG_INLINE_ASM_PARSER
94  std::cerr << "*** before position string substitution:" << std::endl;
95  inlineAsmMI.print(llvm::dbgs());
96 #endif
97 
98  std::string asmString = substituteAsmString(
99  inlineAsmMI, symbolTable, mangler_);
100 
101 #ifdef DEBUG_INLINE_ASM_PARSER
102  std::cerr << "*** before inline asm parsing:" << std::endl
103  << asmString << std::endl; //DEBUG
104 #endif
105 
106  // Parse inline asm.
107  parserDiagnostic_.reset(std::make_shared<std::string>(asmString));
108  std::unique_ptr<TPEF::Binary> bin(new TPEF::Binary());
109  const TTAMachine::Machine& mach = tm_.ttaMachine();
110  AssemblerParser parser(
111  *bin, mach, &parserDiagnostic_, /* codeLinesOnly = */ true);
112 
113  try {
114  if (!parser.compile(asmString)) {
115  reportError(
116  parser.errorLine(), "Syntax error in inline assembly.");
117  return false;
118  }
119  parser.finalize(mach.isLittleEndian());
120  } catch (CompileError& e) {
121  reportError(parser.errorLine(), e.errorMessage());
122  return false;
123  } catch (Exception& e) {
124  reportError(parser.errorLine(), e.errorMessage());
125  return false;
126  }
127 
128  // Convert to POM.
129  std::unique_ptr<TTAProgram::Program> prog;
130  try {
131  // TODO Add universal machine for sequential code.
132  TTAProgram::TPEFProgramFactory tpefFactory(*bin, mach);
133  prog.reset(tpefFactory.build());
134  } catch (Exception& e) {
136  return false;
137  }
138 
139  assert(prog);
140 
141  copyInstructions(*prog, bb, irm);
142  addDebugInfoToInlineAsmBB(inlineAsmMI, bb);
143  addLiveRangeData(inlineAsmMI, bb);
144 
145  if (!sanityChecks(inlineAsmMI, bb)) return false;
146 
147 #ifdef DEBUG_INLINE_ASM_PARSER
148  std::cerr << "*** After inline asm parsing:" << std::endl
149  << bb.toString() << std::endl;
150 #endif
151 
152  return true;
153 }

References addDebugInfoToInlineAsmBB(), addLiveRangeData(), assert, TTAProgram::TPEFProgramFactory::build(), AssemblerParser::compile(), copyInstructions(), AssemblerParser::errorLine(), Exception::errorMessage(), AssemblerParser::finalize(), TTAMachine::Machine::isLittleEndian(), mangler_, parserDiagnostic_, reportError(), AssemblyParserDiagnostic::reset(), sanityChecks(), substituteAsmString(), tm_, TTAProgram::CodeSnippet::toString(), and llvm::TCETargetMachine::ttaMachine().

Referenced by llvm::LLVMTCEBuilder::emitInlineAsm().

Here is the call graph for this function:

◆ registerName()

std::string InlineAsmParser::registerName ( const llvm::MachineOperand &  mo) const

Returns register name of the machine operand (of reg type).

Definition at line 268 of file InlineAsmParser.cc.

268  {
269  assert(mo.isReg());
270  return tm_.registerName(mo.getReg());
271 }

References assert, llvm::TCETargetMachine::registerName(), and tm_.

Referenced by addLiveRangeData().

Here is the call graph for this function:

◆ reportError() [1/2]

void InlineAsmParser::reportError ( const std::string &  errorMsg)
private

Definition at line 468 of file InlineAsmParser.cc.

468  {
469  parserDiagnostic_.addError(errorMsg);
470 }

References AssemblyParserDiagnostic::addError(), and parserDiagnostic_.

Here is the call graph for this function:

◆ reportError() [2/2]

void InlineAsmParser::reportError ( size_t  lineNum,
const std::string &  errorMsg 
)
private

Definition at line 463 of file InlineAsmParser.cc.

463  {
464  parserDiagnostic_.addError(lineNum, errorMsg);
465 }

References AssemblyParserDiagnostic::addError(), and parserDiagnostic_.

Referenced by parse().

Here is the call graph for this function:

◆ sanityChecks()

bool InlineAsmParser::sanityChecks ( const llvm::MachineInstr &  mi,
TTAProgram::BasicBlock bb 
) const

Performs sanity checks of parsed inline asm snippet.

The method reports issues to the diagnostic object.

Returns
True if no errors were encountered beside some warnings. Otherwise, returns false on any error.

Definition at line 251 of file InlineAsmParser.cc.

253  {
254 
255  // Check unintended input register overwrite. //
256  // TODO
257 
258  // Checks no input operands are clobbered. //
259  // TODO
260 
261  return true;
262 }

Referenced by parse().

◆ substituteAsmString()

std::string InlineAsmParser::substituteAsmString ( const llvm::MachineInstr &  mi,
const std::map< std::string, unsigned > &  symbolTable,
const llvm::Mangler &  mangler 
)

Returns substituted assembly string.

Parameters
miThe instruction holding the inline asm.
symbolTableTable to traslate mangled names to addresses.
manglerThe name mangler.

Definition at line 281 of file InlineAsmParser.cc.

284  {
285 
286 
287  assert(mi.isInlineAsm() && "MI must hold inline asm.");
288  std::string result = mi.getOperand(
289  InlineAsm::MIOp_AsmString).getSymbolName();
290  assert(!result.empty());
291 
292  // If TCE operation macro - the _TCE_<operation> kinds.
293  if (!InlineAsmParser::isInlineAsm(mi)) return result;
294 
295  auto mangledNameFn = [&mangler](const GlobalValue* gv) -> std::string {
296  SmallString<256> Buffer;
297  mangler.getNameWithPrefix(Buffer, gv, false);
298  std::string name(Buffer.c_str());
299 
300  return name;
301  };
302 
303  // Maps template strings to the assigned operand. e.g "$0" => "RF.5".
304  std::map<std::string, std::string> templateStringMap;
305 
306  const std::string tmplPrefix = "$";
307  std::string unhandledKind;
308  AsmOperandMap opdMap = getInlineAsmOperands(mi);
309  for (auto& asmOpd : opdMap) {
310  unsigned asmOpdPos = asmOpd.first;
311  unsigned asmOpdKind = std::get<0>(asmOpd.second);
312  std::vector<const llvm::MachineOperand*>& flagOpds =
313  std::get<1>(asmOpd.second);
314  unsigned numAsmOpds = flagOpds.size();
315  switch (asmOpdKind) {
316  case InlineAsm::Kind_Mem:
317  if (unhandledKind.empty()) unhandledKind = "mem";
318  // fall-through
319  default:
320  if (unhandledKind.empty()) unhandledKind = "??";
321  if (Application::spamVerbose()) {
322  std::cerr << "substituteAsmString():"
323  << " Ignoring asm operand kind: "
324  << unhandledKind << std::endl;
325  }
326  unhandledKind.clear();
327  break;
328 
329  case InlineAsm::Kind_RegDefEarlyClobber:
330  case InlineAsm::Kind_RegDef:
331  case InlineAsm::Kind_RegUse:
332  assert(numAsmOpds == 1);
333  templateStringMap.insert(std::make_pair(
334  tmplPrefix + std::to_string(asmOpdPos),
335  tm_.registerName(flagOpds.at(0)->getReg())));
336  break;
337 
338  case InlineAsm::Kind_Imm:
339  assert(numAsmOpds == 1);
340  if (flagOpds.at(0)->isImm()) {
341  templateStringMap.insert(std::make_pair(
342  tmplPrefix + std::to_string(asmOpdPos),
343  std::to_string(flagOpds.at(0)->getImm())));
344  } else if (flagOpds.at(0)->isGlobal()) {
345  std::string name = mangledNameFn(flagOpds.at(0)->getGlobal());
346  unsigned address = 0;
347  if (symbolTable.find(name) != symbolTable.end()) {
348  address = symbolTable.at(name)
349  + flagOpds.at(0)->getOffset();
350  // TODO: could be address to function. Can not handle that
351  // yet.
352  } else {
354  CompileError,
355  "Could not determine address of symbol '"
356  + name + "'. \nNote: Functions as inline asm "
357  "operands are not supported.");
358  }
359 
360  templateStringMap.insert(std::make_pair(
361  tmplPrefix + std::to_string(asmOpdPos),
362  std::to_string(address)));
363  } else {
364  assert(false);
365  }
366  break;
367  case InlineAsm::Kind_Clobber:
368  break; // No need to handle.
369  }
370  }
371 
372  // Searches for "$<num>" string. Returns tuple of (position, length)
373  // if found. Returns (string::npos, 0) if not found.
374  auto findTemplateStrFn = [](const std::string& str, size_t pos)
375  -> std::tuple<size_t, size_t> {
376  if (pos > str.size()) {
377  return std::make_tuple(std::string::npos, 0);
378  }
379  size_t len = 0;
380  while ((pos = str.find("$", pos)) != std::string::npos) {
381  size_t endPos = str.find_first_not_of("0123456789", pos+1);
382  if (endPos == std::string::npos) {
383  // Check template string at end of string, e.g '$4<EOF>'
384  if (str.size()-pos > 1) {
385  return std::make_tuple(pos, str.size()-pos);
386  }
387  pos = std::string::npos;
388  break;
389  }
390  len = endPos-pos;
391  if (len > 1) break; // Ignores "$$" and "${:uid}" strings.
392  pos += len;
393  }
394  return std::make_tuple(pos, len);
395  };
396 
397  size_t pos = 0;
398  size_t len = 0;
399  std::set<std::string> replacedTemplStrs;
400  while (true) {
401  std::tie(pos, len) = findTemplateStrFn(result, pos);
402  if (pos == std::string::npos) break;
403  const std::string& templStr = result.substr(pos, len);
404  replacedTemplStrs.insert(templStr);
405  result.replace(pos, len, templateStringMap.at(templStr));
406  pos += len;
407  }
408 
409  // Unreferenced template string, especially for output operands, may break
410  // semantics of a program code.
411  for (auto& tmplStrPair : templateStringMap) {
412  const std::string& tmplStr = tmplStrPair.first;
413  if (replacedTemplStrs.count(tmplStr)) continue;
414  std::string msg;
415  try {
416  auto opdIdx = Conversion::toInt(tmplStr.substr(1))+1;
417  msg = std::to_string(opdIdx) + ". operand is unreferenced";
418  } catch (NumberFormatException&) {
419  msg = "There is unreferenced operand";
420  }
421  std::string srcFile;
422  size_t srcLine;
423  std::tie(srcFile, srcLine) = getSourceLocationInfo(mi);
424  std::string srcLoc;
425  if (!srcFile.empty()) {
426  srcLoc = srcFile + ":" + std::to_string(srcLine) + ": ";
427  }
428  std::cerr << srcLoc << "Warning: " << msg
429  << " in an inline asm block."
430  << std::endl;
431  }
432 
433  // Replace "%=" template strings (redubbed as "${:uid}" in LLVM).
434  std::string uidTmplStr = "${:uid}";
435  auto uid = std::to_string(asmId_++);
436  pos = 0;
437  while ((pos = result.find(uidTmplStr, pos)) != std::string::npos) {
438  result.replace(pos, uidTmplStr.size(), uid);
439  pos += uid.size();
440  }
441  assert(!result.empty());
442  return result;
443 }

References asmId_, assert, getInlineAsmOperands(), getSourceLocationInfo(), isInlineAsm(), llvm::TCETargetMachine::registerName(), Application::spamVerbose(), THROW_EXCEPTION, tm_, and Conversion::toInt().

Referenced by parse().

Here is the call graph for this function:

Member Data Documentation

◆ asmId_

unsigned InlineAsmParser::asmId_ = 0
private

The unique id for "%=" template strings. Each parse() call increases the count.

Definition at line 125 of file InlineAsmParser.hh.

Referenced by substituteAsmString().

◆ mangler_

const llvm::Mangler& InlineAsmParser::mangler_
private

The symbol name mangler for MIs' symbolic references.

Definition at line 119 of file InlineAsmParser.hh.

Referenced by parse().

◆ parserDiagnostic_

AssemblyParserDiagnostic InlineAsmParser::parserDiagnostic_
private

The diagnostic object to report parse and compile warnings and errors to.

Definition at line 122 of file InlineAsmParser.hh.

Referenced by diagnostics(), parse(), and reportError().

◆ tm_

const llvm::TCETargetMachine& InlineAsmParser::tm_
private

The target machine parsing context.

Definition at line 117 of file InlineAsmParser.hh.

Referenced by parse(), registerName(), and substituteAsmString().


The documentation for this class was generated from the following files:
AssemblerParser
Definition: AssemblerParser.hh:331
getSourceLocationInfo
POP_COMPILER_DIAGS std::tuple< std::string, size_t > getSourceLocationInfo(const llvm::MachineInstr &mi)
Definition: LLVMUtilities.cc:54
InlineAsmParser::addLiveRangeData
void addLiveRangeData(const llvm::MachineInstr &mi, TTAProgram::BasicBlock &bb)
Definition: InlineAsmParser.cc:205
TTAProgram
Definition: Estimator.hh:65
InlineAsmParser::registerName
std::string registerName(const llvm::MachineOperand &mo) const
Definition: InlineAsmParser.cc:268
NumberFormatException
Definition: Exception.hh:421
InlineAsmParser::parserDiagnostic_
AssemblyParserDiagnostic parserDiagnostic_
The diagnostic object to report parse and compile warnings and errors to.
Definition: InlineAsmParser.hh:122
TTAProgram::Instruction::move
Move & move(int i) const
Definition: Instruction.cc:193
InlineAsmParser::mangler_
const llvm::Mangler & mangler_
The symbol name mangler for MIs' symbolic references.
Definition: InlineAsmParser.hh:119
InlineAsmParser::addDebugInfoToInlineAsmBB
static void addDebugInfoToInlineAsmBB(const llvm::MachineInstr &mi, TTAProgram::BasicBlock &bb)
Definition: InlineAsmParser.cc:159
InlineAsmParser::tm_
const llvm::TCETargetMachine & tm_
The target machine parsing context.
Definition: InlineAsmParser.hh:117
TPEF::Binary
Definition: Binary.hh:49
TTAProgram::Instruction
Definition: Instruction.hh:57
TPEF::InstructionAnnotation::MAX_ANNOTATION_BYTES
static const size_t MAX_ANNOTATION_BYTES
Maximum number of bytes that annotation may contain.
Definition: InstructionElement.hh:65
TTAProgram::InstructionReferenceManager::createReference
InstructionReference createReference(Instruction &ins)
Definition: InstructionReferenceManager.cc:73
CompileError
Definition: Exception.hh:1019
TTAProgram::ProgramAnnotation::ANN_DEBUG_SOURCE_CODE_LINE
@ ANN_DEBUG_SOURCE_CODE_LINE
The line number in the source code file the annotated move originates from.
Definition: ProgramAnnotation.hh:138
TTAMachine::Machine::isLittleEndian
bool isLittleEndian() const
Definition: Machine.hh:258
getInlineAsmOperands
AsmOperandMap getInlineAsmOperands(const llvm::MachineInstr &mi)
Definition: LLVMUtilities.cc:92
TTAProgram::TPEFProgramFactory
Definition: TPEFProgramFactory.hh:87
assert
#define assert(condition)
Definition: Application.hh:86
InlineAsmParser::isInlineAsm
static bool isInlineAsm(const llvm::MachineInstr &mi)
Definition: InlineAsmParser.cc:450
Application::spamVerbose
static bool spamVerbose()
Definition: Application.hh:182
llvm::TCETargetMachine::registerName
std::string registerName(unsigned dwarfRegNum) const
Definition: TCETargetMachine.hh:216
AsmOperandMap
std::map< AsmPosition, AsmOperands > AsmOperandMap
Definition: LLVMUtilities.hh:60
TTAProgram::BasicBlock::liveRangeData_
LiveRangeData * liveRangeData_
Definition: BasicBlock.hh:111
TTAProgram::CodeSnippet::instructionCount
virtual int instructionCount() const
Definition: CodeSnippet.cc:205
THROW_EXCEPTION
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition: Exception.hh:39
TTAProgram::CodeSnippet::add
virtual void add(Instruction *ins)
Definition: CodeSnippet.cc:432
LiveRangeData
Definition: LiveRangeData.hh:47
InlineAsmParser::asmId_
unsigned asmId_
The unique id for "%=" template strings. Each parse() call increases the count.
Definition: InlineAsmParser.hh:125
TTAProgram::Move
Definition: Move.hh:55
Exception
Definition: Exception.hh:54
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
AssemblyParserDiagnostic::addError
void addError(UValue lineNumber, const std::string &message)
Definition: AssemblyParserDiagnostic.cc:68
InlineAsmParser::copyInstructions
static void copyInstructions(TTAProgram::Program &prog, TTAProgram::BasicBlock &targetBB, TTAProgram::InstructionReferenceManager &irm)
Definition: InlineAsmParser.cc:502
InlineAsmParser::sanityChecks
bool sanityChecks(const llvm::MachineInstr &mi, TTAProgram::BasicBlock &bb) const
Definition: InlineAsmParser.cc:251
TTAProgram::AnnotatedInstructionElement::addAnnotation
void addAnnotation(const ProgramAnnotation &annotation)
Definition: AnnotatedInstructionElement.cc:63
TCEString
Definition: TCEString.hh:53
llvm::TCETargetMachine::ttaMachine
virtual const TTAMachine::Machine & ttaMachine() const
Definition: TCETargetMachine.hh:137
TTAProgram::CodeSnippet::instructionAtIndex
virtual Instruction & instructionAtIndex(int index) const
Definition: CodeSnippet.cc:285
TTAProgram::ProgramAnnotation::ANN_DEBUG_SOURCE_CODE_PATH
@ ANN_DEBUG_SOURCE_CODE_PATH
debugging info annotations
Definition: ProgramAnnotation.hh:134
TTAProgram::CodeSnippet::toString
virtual std::string toString() const
Definition: CodeSnippet.hh:117
Conversion::toInt
static int toInt(const T &source)
InlineAsmParser::substituteAsmString
std::string substituteAsmString(const llvm::MachineInstr &mi, const std::map< std::string, unsigned > &symbolTable, const llvm::Mangler &mangler)
Definition: InlineAsmParser.cc:281
TTAProgram::ProgramAnnotation
Definition: ProgramAnnotation.hh:49
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
getInstructionReferenceTerminals
std::vector< TTAProgram::TerminalInstructionReference * > getInstructionReferenceTerminals(TTAProgram::Instruction &instr)
Definition: InlineAsmParser.cc:473
AssemblyParserDiagnostic::reset
void reset(std::shared_ptr< const std::string > assemblyText)
Definition: AssemblyParserDiagnostic.cc:40
InlineAsmParser::reportError
void reportError(size_t lineNum, const std::string &errorMsg)
Definition: InlineAsmParser.cc:463
TTAMachine::Machine
Definition: Machine.hh:73