OpenASIP 2.2
Loading...
Searching...
No Matches
Functions | Variables
TDGen.cc File Reference
#include <fstream>
#include <algorithm>
#include "TDGen.hh"
#include "Machine.hh"
#include "ADFSerializer.hh"
#include "ControlUnit.hh"
#include "Operation.hh"
#include "HWOperation.hh"
#include "FUPort.hh"
#include "Conversion.hh"
#include "MachineConnectivityCheck.hh"
#include "ImmediateAnalyzer.hh"
#include "ImmInfo.hh"
#include "Bus.hh"
#include "Guard.hh"
#include "StringTools.hh"
#include "OperationPool.hh"
#include "OperationNode.hh"
#include "TerminalNode.hh"
#include "ConstantNode.hh"
#include "OperationDAG.hh"
#include "OperationDAGEdge.hh"
#include "OperationDAGSelector.hh"
#include "TCEString.hh"
#include "Operand.hh"
#include "Application.hh"
#include "LLVMBackend.hh"
#include "MathTools.hh"
#include "tce_config.h"
#include "LLVMTCECmdLineOptions.hh"
#include "MachineInfo.hh"
#include "boost/assign.hpp"
Include dependency graph for TDGen.cc:

Go to the source code of this file.

Functions

bool numbersToAscending (const TCEString &lhs, const TCEString &rhs)
 
char regOperandCharToImmOperandChar (char c)
 

Variables

static const unsigned REG_RENAMER_PART = 0
 

Function Documentation

◆ numbersToAscending()

bool numbersToAscending ( const TCEString lhs,
const TCEString rhs 
)

Custom comparator that orders operation names correctly number-wise.

For instance, in an std::set operation names are ordered followingly: ADD32X16, ADD32X4, ADD32X8, XOR1024, XOR512, XOR64

This function corrects the operation name order to be the following: ADD32X4, ADD32X8, ADD32X16, XOR64, XOR512, XOR1024

Definition at line 292 of file TDGen.cc.

292 {
293 size_t lhsI = lhs.length() - 1;
294 size_t rhsI = rhs.length() - 1;
295
296 // Reverse operation name to the position where the last number begins.
297 while (lhsI > 0 && std::isdigit(lhs[lhsI])) --lhsI;
298 while (rhsI > 0 && std::isdigit(rhs[rhsI])) --rhsI;
299
300 // Make sure both strings contain a number.
301 if (lhsI > 0 && lhsI != lhs.length() - 1 && rhsI > 0 &&
302 rhsI != rhs.length() - 1) {
303 // The string part before the number must match between both names.
304 if (lhs.substr(0, lhsI + 1) == rhs.substr(0, rhsI + 1)) {
305 // Make the smaller number precede the larger one.
306 try {
307 int lhsNumber = Conversion::toInt(lhs.substr(lhsI + 1));
308 int rhsNumber = Conversion::toInt(rhs.substr(rhsI + 1));
309 return lhsNumber < rhsNumber;
310 } catch (const NumberFormatException& e) {
312 }
313 }
314 }
315
316 // Basic comparison for std::string.
317 return lhs < rhs;
318}
#define abortWithError(message)
static int toInt(const T &source)
std::string errorMessage() const
Definition Exception.cc:123

References abortWithError, Exception::errorMessage(), and Conversion::toInt().

Here is the call graph for this function:

◆ regOperandCharToImmOperandChar()

char regOperandCharToImmOperandChar ( char  c)

Definition at line 4491 of file TDGen.cc.

4491 {
4492 switch(c) {
4493 case TDGen::OT_REG_LONG:
4494 return TDGen::OT_IMM_LONG;
4495 case TDGen::OT_REG_INT:
4496 return TDGen::OT_IMM_INT;
4497 case TDGen::OT_REG_BOOL:
4498 return TDGen::OT_IMM_BOOL;
4499 case TDGen::OT_REG_FP:
4500 return TDGen::OT_IMM_FP;
4501 case TDGen::OT_REG_HFP:
4502 return TDGen::OT_IMM_HFP;
4503 default:
4504 return 0;
4505 }
4506}
static const char OT_REG_LONG
Definition TDGen.hh:499
static const char OT_REG_BOOL
Definition TDGen.hh:497
static const char OT_IMM_LONG
Definition TDGen.hh:507
static const char OT_REG_FP
Definition TDGen.hh:500
static const char OT_IMM_INT
Definition TDGen.hh:504
static const char OT_REG_HFP
Definition TDGen.hh:501
static const char OT_IMM_FP
Definition TDGen.hh:505
static const char OT_IMM_BOOL
Definition TDGen.hh:503
static const char OT_IMM_HFP
Definition TDGen.hh:506
static const char OT_REG_INT
Definition TDGen.hh:498

References TDGen::OT_IMM_BOOL, TDGen::OT_IMM_FP, TDGen::OT_IMM_HFP, TDGen::OT_IMM_INT, TDGen::OT_IMM_LONG, TDGen::OT_REG_BOOL, TDGen::OT_REG_FP, TDGen::OT_REG_HFP, TDGen::OT_REG_INT, and TDGen::OT_REG_LONG.

Referenced by TDGen::writeOperationDefs().

Variable Documentation

◆ REG_RENAMER_PART

const unsigned REG_RENAMER_PART = 0
static

Definition at line 332 of file TDGen.cc.

Referenced by TDGen::analyzeRegisters().