#include <TDGen.hh>
|
bool | writeRegisterInfo (std::ostream &o) |
|
void | writeStartOfRegisterInfo (std::ostream &o) |
|
void | writeOperandDefs (std::ostream &o) |
|
void | writeIntegerImmediateDefs (std::ostream &o, const ImmInfo &iivis) |
|
void | writeMoveImmediateDefs (std::ostream &o) |
|
void | writeInstrInfo (std::ostream &o) |
|
void | writeBackendCode (std::ostream &o) |
|
void | writeTopLevelTD (std::ostream &o) |
|
void | writeInstrFormats (std::ostream &o) |
|
bool | checkRequiredRegisters () |
|
void | analyzeRegisters () |
|
void | analyzeRegisterFileClasses () |
|
void | analyzeRegisters (RegsToProcess regsToProcess) |
|
void | gatherAllMachineOperations () |
|
void | analyzeMachineVectorRegisterClasses () |
|
void | analyzeMachineRegisters () |
|
void | associateRegistersWithVectorRegisterClasses () |
|
void | orderEqualWidthRegistersToRoundRobin () |
|
void | verbose (const TCEString &msg) const |
|
bool | isVectorLoadOperation (const Operation &op) const |
|
bool | isVectorStoreOperation (const Operation &op) const |
|
bool | isWrongEndianessVectorOp (const Operation &op) const |
|
bool | isVectorBitwiseOperation (const Operation &op) const |
|
bool | hasRawOperands (const Operation &op) const |
|
int | subwordWidthOfRawData (const Operation &op) const |
|
bool | hasRegisterClassSupport (const Operation &op) const |
|
bool | hasRegisterClassSupport (const TDGenerator::ValueType &vt) const |
|
TCEString | associatedVectorRegisterClass (const Operand &operand) const |
|
void | writePatternReplacement (std::ostream &o, const TCEString &origPat, const TCEString &replacerPat) const |
|
void | writeOperationDefUsingGivenOperandTypes (std::ostream &o, Operation &op, bool skipPattern, std::vector< TDGenerator::ValueType > inputs, std::vector< TDGenerator::ValueType > outputs, TCEString instrSuffix="") |
|
void | writeRegisterDef (std::ostream &o, const RegInfo ®, const std::string regName, const std::string regTemplate, const std::string aliases, RegType type) |
|
void | write64bitRegisterInfo (std::ostream &o) |
|
void | write32bitRegisterInfo (std::ostream &o) |
|
void | write16bitRegisterInfo (std::ostream &o) |
|
void | write8bitRegisterInfo (std::ostream &o) |
|
void | write1bitRegisterInfo (std::ostream &o) |
|
void | writeRARegisterInfo (std::ostream &o) |
|
void | writeGuardRegisterClassInfo (std::ostream &o) |
|
void | writeVectorRegisterBaseClasses (std::ostream &o) const |
|
void | writeVectorRegisterNames (std::ostream &o) |
|
void | writeVectorRegisterClasses (std::ostream &o) const |
|
void | writeVectorOperationDefs (std::ostream &o, Operation &op, bool skipPattern) |
|
void | writeVectorOperationDef (std::ostream &o, Operation &op, TCEString valueTypes, const TCEString &attributes, bool skipPattern) |
|
void | saveAdditionalVectorOperationInfo (const Operation &op, const TCEString &valueTypes, bool isRegisterOp) |
|
void | writeVectorMemoryOperationDefs (std::ostream &o, Operation &op, bool skipPattern) |
|
void | writeVectorBitwiseOperationDefs (std::ostream &o, Operation &op, bool skipPattern) |
|
void | writeVectorRegisterMoveDefs (std::ostream &o) |
|
void | writeVectorTruncStoreDefs (std::ostream &o) const |
|
void | writeScalarToVectorDefs (std::ostream &o) const |
|
void | writeVectorBitConversions (std::ostream &o) const |
|
void | writeScalarOperationExploitations (std::ostream &o) |
|
void | writeVectorLoadStoreOperationExploitations (std::ostream &o) |
|
void | writeWiderVectorOperationExploitations (std::ostream &o) |
|
void | genGeneratedTCEPlugin_getStore (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getLoad (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_isVectorRegisterMove (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorValueType (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorBroadcastOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorPackOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorSelectOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorShuffle1Opcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorShuffle2Opcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getConstantVectorShuffleOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getExtractElemOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorShlSameOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorShrSameOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorShruSameOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorAndSameOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorIorSameOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorXorSameOpcode (std::ostream &o) const |
|
void | genTCETargetLoweringSIMD_addVectorRegisterClasses (std::ostream &o) const |
|
void | genTCETargetLoweringSIMD_associatedVectorRegClass (std::ostream &o) const |
|
void | genTCETargetLoweringSIMD_getSetCCResultVT (std::ostream &o) const |
|
void | genTCEInstrInfoSIMD_copyPhysVectorReg (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getVectorImmediateOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getGatherOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getLoadOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getAddOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getShlOpcode (std::ostream &o) const |
|
void | genGeneratedTCEPlugin_getIorOpcode (std::ostream &o) const |
|
void | writeVectorImmediateWriteDefs (std::ostream &instrInfoTD) |
|
void | createMinMaxDef (const TCEString &opName, const TCEString &valueName, std::ostream &os) |
|
void | createVectorMinMaxDef (const TCEString &opName, int bits, char llvmTypeChar, const TCEString &postFix, std::ostream &os) |
|
void | writeOperationDefs (std::ostream &o, Operation &op, bool skipPattern) |
|
void | writeOperationDef (std::ostream &o, Operation &op, const std::string &operandTypes, const std::string &attrs, bool skipPattern, std::string backendPrefix="") |
|
std::string | emulatingOpNodeLLVMName (const Operation &op, const OperationDAG &dag, const OperationNode &node, const std::string &operandTypes) |
|
void | writeEmulationPattern (std::ostream &o, const Operation &op, const OperationDAG &dag) |
|
void | write64bitMoveDefs (std::ostream &o) |
|
void | writeControlFlowInstrDefs (std::ostream &os) |
|
void | writeCondBranchDefs (std::ostream &os) |
|
void | writeCallDef (std::ostream &o) |
|
void | writeHWLoopDef (std::ostream &o) |
|
virtual void | writeCallDefRegs (std::ostream &o) |
|
void | writeRegisterClasses (std::ostream &o) |
|
virtual TCEString | llvmOperationPattern (const Operation &op, char operandType=' ') const |
|
virtual TCEString | llvmOperationName (const TCEString &opName) const |
|
bool | operationCanBeMatched (const Operation &op, std::set< std::string > *recursionCycleCheck=NULL, bool recursionHasStore=false) |
|
bool | operationDAGCanBeMatched (const OperationDAG &op, std::set< std::string > *recursionCycleCheck=NULL, bool recursionHasStore=false) |
|
const OperationDAG * | getMatchableOperationDAG (const Operation &op) |
|
std::string | tceOperationPattern (const Operation &op) |
|
std::string | patOutputs (const Operation &op, const std::string &oprTypes) |
|
std::string | patInputs (const Operation &op, const std::string &oprTypes) |
|
virtual std::string | operandToString (const Operand &operand, bool match, char operandType, const std::string &immDefName="") |
|
std::string | operationNodeToString (const Operation &op, const OperationDAG &dag, const OperationNode &node, bool emulationPattern, const std::string &operandTypes) |
|
std::string | constantNodeString (const Operation &op, const OperationDAG &dag, const ConstantNode &node, const std::string &operandTypes, const OperationDAGNode *successor=nullptr) |
|
std::string | dagNodeToString (const Operation &op, const OperationDAG &dag, const OperationDAGNode &node, bool emulationPattern, const std::string &operandTypes, const Operation *emulatingOp=nullptr, const OperationDAGNode *successor=nullptr) |
|
std::string | operationPattern (const Operation &op, const OperationDAG &dag, const std::string &operandTypes) |
|
virtual char | operandChar (Operand &operand) |
|
std::string | createDefaultOperandTypeString (const Operation &op) |
|
void | writeVectorStoreDefs (std::ostream &o, const TCEString &opName, const TCEString &opNameSuffix, bool addrImm, const TCEString &dataType, bool writePredicatedVersions) |
|
void | genTCEInstrInfo_copyPhys64bitReg (std::ostream &o) const |
|
void | writeArgRegsArray (std::ostream &os) |
|
virtual void | createSelectPatterns (std::ostream &os) |
|
void | writeAddressingModeDefs (std::ostream &o) |
|
void | createByteExtLoadPatterns (std::ostream &os) |
|
void | createShortExtLoadPatterns (std::ostream &os) |
|
void | create32BitExtLoadPatterns (std::ostream &os) |
|
void | createEndiannesQuery (std::ostream &os) |
|
void | createConstantMaterializationQuery (std::ostream &os) |
|
void | createConstShiftPatterns (std::ostream &os) |
|
void | writeOperationDefs (std::ostream &o, Operation &op, const std::string &operandTypes, const std::string &attrs, bool skipPattern, std::string backendPrefix="") |
|
void | writeVectorStoreDefs (std::ostream &o, Operation &op, int vectorLen) |
|
void | writeVectorTruncStoreDefs (std::ostream &o, Operation &op, int bitsize, int vectorLen) |
|
void | createGetMaxMemoryAlignment (std::ostream &os) const |
|
void | writeVectorAnyextPattern (std::ostream &o, Operation &op, const TCEString &loadPatternName, int vectorLen) |
|
void | writeVectorLoadDefs (std::ostream &o, const TCEString &opName, const TCEString &opNameSuffix, bool addrImm, const TCEString &resultType, const TCEString &loadPatternName, bool writePredicatedVersions) |
|
virtual void | writeImmediateDef (std::ostream &o, const std::string &defName, const std::string &operandType, const std::string &predicate) |
|
void | writeInstrDef (std::ostream &o, const std::string &instrDefName, const std::string &outs, const std::string &ins, const std::string &asmString, const std::string &pattern) |
|
void | writeVectorLoadDefs (std::ostream &o, Operation &op, const TCEString &loadPatternName, int vectorLen) |
|
void | writeBooleanStorePatterns (std::ostream &os) |
|
std::string | immediatePredicate (int64_t lowerBoundInclusive, uint64_t upperBoundInclusive) |
|
std::string | immediateOperandNameForEmulatedOperation (const OperationDAG &, const Operand &operand) |
|
bool | areImmediateOperandsLegal (const Operation &operation, const std::string &operandTypes) const |
|
void | writeBroadcastDefs (std::ostream &o, Operation &op, int vectorLen) |
|
bool | writePortGuardedJumpDefPair (std::ostream &os, const TCEString &tceop1, const TCEString &tceop2, bool fp=false) |
|
std::string | subPattern (const Operation &op, const OperationDAG &dag) |
|
OperationDAG * | createTrivialDAG (Operation &op) |
|
bool | canBeImmediate (const OperationDAG &dag, const TerminalNode &node) |
|
virtual void | createMinMaxGenerator (std::ostream &os) |
|
void | writeCallSeqStart (std::ostream &os) |
|
void | writeMiscPatterns (std::ostream &o) |
|
void | generateLoadStoreCopyGenerator (std::ostream &os) |
|
void | createParamDRegNums (std::ostream &os) |
|
virtual void | createVectorRVDRegNums (std::ostream &os) |
|
void | writeCallingConv (std::ostream &os) |
|
void | writeCallingConvLicenceText (std::ostream &os) |
|
void | writeConstShiftPat (std::ostream &os, const TCEString &nodeName, const TCEString &opNameBase, int i) |
|
void | createBoolAndHalfLoadPatterns (std::ostream &os) |
|
virtual void | createConstantMaterializationPatterns (std::ostream &os) |
|
void | createBranchAnalysis (std::ostream &os) |
|
void | genTCERegisterInfo_setReservedVectorRegs (std::ostream &os) const |
|
void | writeGetPointerAdjustmentQuery (std::ostream &os) const |
|
bool | canBePredicated (Operation &op, const std::string &operandTypes) |
|
TCEString | getLLVMPatternWithConstants (const Operation &op, const std::string &operandTypes, const std::string &operand0, const std::string &operand1) const |
|
std::string | operandTypesToRegisters (const std::string &opdTypes) const |
|
char | operandTypeToRegister (const char &opdType) const |
|
TCEString | getMovePattern (const char &opdType, const std::string &inputPattern) const |
|
|
ImmInfo * | immInfo_ = nullptr |
|
std::map< ImmInfoKey, std::string > | immOperandDefs_ |
| Maps (operation, operand) pairs to i32 immediate operand definition names. More...
|
|
const TTAMachine::Machine & | mach_ |
|
unsigned | dregNum_ |
|
OperationDAGSelector::OperationSet | allOpNames_ |
| Contains all operation names in upper case. More...
|
|
std::map< TCEString, Operation * > | scalarOps_ |
| Contains all scalar operations (<Name, Operation>). More...
|
|
std::map< TCEString, Operation * > | vectorOps_ |
| Contains all vector operations (<Name, Operation>). More...
|
|
std::map< int, TCEString > | baseClasses_ |
| Contains vector base classes for register files (<Width, Name>). More...
|
|
std::map< int, std::vector< TDGenerator::RegisterInfo > > | registers_ |
| Contains registers fit for being vector registers (<Width, Registers>). More...
|
|
std::map< TCEString, TDGenerator::RegisterClass > | vRegClasses_ |
| Contains required vector register classes (<ValueType, RegClass>). More...
|
|
std::map< TCEString, TDGenerator::InstructionInfo > | registerStores_ |
| All register store operations (<ValueType, InstrInfo>). More...
|
|
std::map< TCEString, TDGenerator::InstructionInfo > | registerLoads_ |
| All register load operations (<ValueType, InstrInfo>). More...
|
|
std::map< TCEString, TDGenerator::InstructionInfo > | immediateStores_ |
| All immediate store operations (<ValueType, InstrInfo>). More...
|
|
std::map< TCEString, TDGenerator::InstructionInfo > | immediateLoads_ |
| All immediate load operations (<ValueType, InstrInfo>). More...
|
|
std::map< TCEString, TCEString > | packOperations_ |
| Contains machine's PACK instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | vbcastOperations_ |
| Contains machine's VBCAST instructions (<ValueType, InstrName>). More...
|
|
std::vector< std::pair< const Operation *, TCEString > > | truncOperations_ |
| Contains machine's TRUNCxx/CFH instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | vselectOperations_ |
| Contains machine's VSELECT instructions (<instrName, ValueType>). More...
|
|
std::map< TCEString, TCEString > | vshuffle1Operations_ |
| Contains machine's VSHUFFLE1 instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | vshuffle2Operations_ |
| Contains machine's VSHUFFLE2 instructions (<ValueType, InstrName>). More...
|
|
std::map< std::pair< TCEString, std::vector< int > >, TCEString > | vcshuffleOperations_ |
| Contains machine's VCSHUFFLE instructions (<<ValueType, ConstantSelects>, InstrName>). More...
|
|
std::map< TCEString, TCEString > | extractElemOperations_ |
| Contains machine's EXTRACTELEM instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | shlSameOperations_ |
| Contains machine's SHLSAME instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | shrSameOperations_ |
| Contains machine's SHRSAME instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | shruSameOperations_ |
| Contains machine's SHRUSAME instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | andSameOperations_ |
| Contains machine's ANDSAME instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | iorSameOperations_ |
| Contains machine's IORSAME instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | xorSameOperations_ |
| Contains machine's XORSAME instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | gatherOperations_ |
| Contains machine's GATHER instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | addOperations_ |
| Contains machine's add instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | shlOperations_ |
| Contains machine's shl instructions (<ValueType, InstrName>). More...
|
|
std::map< TCEString, TCEString > | iorOperations_ |
| Contains machine's shl instructions (<ValueType, InstrName>). More...
|
|
std::set< TCEString > | movOperations_ |
| Contains all moves between register classes (<InstrName>). More...
|
|
std::vector< RegInfo > | regs1bit_ |
|
std::vector< RegInfo > | regs8bit_ |
|
std::vector< RegInfo > | regs16bit_ |
|
std::vector< RegInfo > | regs32bit_ |
|
std::vector< RegInfo > | regs64bit_ |
|
std::vector< std::string > | llvmGuardRegs_ |
| The LLVM register defs used as guards. More...
|
|
std::map< std::string, RegInfo > | regs_ |
| Map of generated llvm register names to physical register in the machine. More...
|
|
std::vector< std::string > | argRegNames_ |
|
std::vector< std::string > | resRegNames_ |
|
std::vector< std::string > | gprRegNames_ |
|
std::map< std::string, std::string > | opNames_ |
|
std::map< std::string, std::string > | truePredOps_ |
|
std::map< std::string, std::string > | falsePredOps_ |
|
int | maxVectorSize_ |
|
int | highestLaneInt_ |
|
int | highestLaneBool_ |
|
bool | hasExBoolRegs_ |
|
bool | hasExIntRegs_ |
|
bool | hasSelect_ |
|
bool | hasConditionalMoves_ |
|
int | maxScalarWidth_ |
|
bool | littleEndian_ |
|
unsigned int | argRegCount_ |
|
unsigned int | requiredI32Regs_ |
| Minimum number of 32 bit registers. More...
|
|
unsigned int | requiredI64Regs_ |
|
bool | prebypassStackIndeces_ |
|
bool | use64bitForFP_ |
|
std::set< RegInfo > | guardedRegs_ |
| List of register that are associated with a guard on a bus. More...
|
|
std::set< const TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > | tempRegFiles_ |
| Register files whose last reg reserved for temp reg copies. More...
|
|
RegClassMap | regsInClasses_ |
| All registers in certain group. More...
|
|
RegClassMap | regsInRFClasses_ |
|
std::vector< std::string > | constantMaterializationPredicates_ |
| All predicates used in constant materialization patterns. More...
|
|
TCE Backend plugin source code and .td definition generator.
Generates files for building target architecture plugin for LLVM-TCE backend. This version generates the backend files for the "RISC
instruction set style" output and provides useful methods.
Definition at line 77 of file TDGen.hh.
◆ RegClassMap
◆ RegsToProcess
Enumerator |
---|
ALL_REGISTERS | |
ONLY_EXTRAS | |
ONLY_LANES | |
ONLY_NORMAL | |
Definition at line 126 of file TDGen.hh.
◆ RegType
Enumerator |
---|
GPR | |
RESERVED | |
ARGUMENT | |
RESULT | |
Definition at line 96 of file TDGen.hh.
◆ TDGen()
Constructor.
- Parameters
-
mach | Machine to generate plugin for. |
Definition at line 341 of file TDGen.cc.
354 std::set<int> scalarWidths { 1, 32 };
363 std::set<int> scalarWidths { 1, 32 };
References ImmediateAnalyzer::analyze(), argRegCount_, MachineConnectivityCheck::hasConditionalMoves(), hasConditionalMoves_, immInfo_, TTAMachine::Machine::is64bit(), mach_, maxScalarWidth_, prebypassStackIndeces_, requiredI32Regs_, requiredI64Regs_, tempRegFiles_, and MachineConnectivityCheck::tempRegisterFiles().
◆ ~TDGen()
◆ analyzeMachineRegisters()
void TDGen::analyzeMachineRegisters |
( |
| ) |
|
|
protected |
Groups all registers in the machine by register width.
Goes through register files and sorts all real machine registers into <Width, vector<Register>> groups. A base class for each Width is also created.
- Todo:
- Apparently TDGen does not write information of 8 bit registers -> can't add them.
Definition at line 1422 of file TDGen.cc.
1425 std::map<int, std::vector<RegisterInfo>>::iterator it;
1428 for (
int i = 0; i < nav.
count(); i++) {
1433 bool hasInput =
false;
1434 bool hasOutput =
false;
1435 for (
int p = 0; p < rf->
portCount(); p++) {
1445 <<
"Warning: Skipping register file '"
1447 <<
"': no input ports."
1457 <<
"Warning Skipping register file '"
1459 <<
"': no output ports."
1465 int rfWidth = rf->
width();
1470 std::make_pair(rfWidth, std::vector<RegisterInfo>()));
1474 std::vector<RegisterInfo>& registers = it->second;
1484 int lastIdx = rf->
size();
1495 for (
int index = 0; index < lastIdx; ++index) {
1499 registers.push_back(reg);
1509 std::vector<RegisterInfo> regs1bit;
1510 for (
size_t i = 0; i <
regs1bit_.size(); ++i) {
1516 regs1bit.push_back(reg);
1523 std::vector<RegisterInfo> regs16bit;
1524 for (
size_t i = 0; i <
regs16bit_.size(); ++i) {
1532 reg.regName_ =
"HIRES0";
1535 regs16bit.push_back(reg);
1539 std::vector<RegisterInfo> regs32bit;
1540 for (
size_t i = 0; i <
regs32bit_.size(); ++i) {
1550 reg.regName_ =
"SP";
1551 }
else if (i == 1) {
1552 reg.regName_ =
"IRES0";
1553 }
else if (i == 2) {
1554 reg.regName_ =
"FP";
1555 }
else if (i == 3) {
1556 reg.regName_ =
"KLUDGE_REGISTER";
1561 regs32bit.push_back(reg);
1565 std::vector<RegisterInfo> regs64bit;
1566 for (
size_t i = 0; i <
regs64bit_.size(); ++i) {
1575 reg.regName_ =
"SP";
1576 }
else if (i == 1) {
1577 reg.regName_ =
"IRES0";
1578 }
else if (i == 2) {
1579 reg.regName_ =
"FP";
1580 }
else if (i == 3) {
1581 reg.regName_ =
"KLUDGE_REGISTER";
1586 regs64bit.push_back(reg);
1592 int width = it->first;
References argRegCount_, assert, baseClasses_, AssocTools::containsKey(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::is64bit(), TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), TTAMachine::Machine::Navigator< ComponentType >::item(), Application::logStream(), mach_, MAX_SCALAR_WIDTH, TTAMachine::Component::name(), orderEqualWidthRegistersToRoundRobin(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), TTAMachine::Machine::registerFileNavigator(), registers_, TDGenerator::RegisterInfo::regName_, regs16bit_, regs1bit_, regs32bit_, regs64bit_, TTAMachine::BaseRegisterFile::size(), tempRegFiles_, Conversion::toString(), Application::VERBOSE_LEVEL_DEFAULT, Application::verboseLevel(), vRegClasses_, and TTAMachine::BaseRegisterFile::width().
Referenced by writeRegisterInfo().
◆ analyzeMachineVectorRegisterClasses()
void TDGen::analyzeMachineVectorRegisterClasses |
( |
| ) |
|
|
protected |
Creates vector register classes required by the machine.
The function goes through all operations and lists all different vector operand value types, after which a register class is created for each vector value type to support the vector value type.
Definition at line 1226 of file TDGen.cc.
1232 std::set<TCEString> reqRegClassTypes;
1235 OperationDAGSelector::OperationSet::iterator opnIt;
1252 TCEString vtStr = ValueType::valueTypeStr(operand);
1254 reqRegClassTypes.insert(vtStr);
1265 const TCEString floatVtStr = vt.valueTypeStr();
1268 reqRegClassTypes.insert(floatVtStr);
1277 std::set<TCEString>::iterator it;
1278 for (it = reqRegClassTypes.begin(); it != reqRegClassTypes.end(); ++it) {
1282 if (vt.isSupportedByLLVM()) {
1295 vRegClasses_.insert(std::make_pair(vtStr, newRegClass));
1297 verbose(
"Warning: RegisterClass not created for type: " + vtStr);
References allOpNames_, Operand::elementWidth(), FP_SUBW_WIDTH, HFP_SUBW_WIDTH, NullOperation::instance(), TDGenerator::ValueType::isFloat_, TDGenerator::ValueType::isSupportedByLLVM(), Operand::isVector(), Operation::operand(), Operation::operandCount(), OperationPool::operation(), Operand::RAW_DATA, TDGenerator::ValueType::subwCount_, TDGenerator::ValueType::subwWidth_, Conversion::toString(), Operand::type(), TDGenerator::ValueType::valueTypeStr(), verbose(), and vRegClasses_.
Referenced by writeRegisterInfo().
◆ analyzeRegisterFileClasses()
void TDGen::analyzeRegisterFileClasses |
( |
| ) |
|
|
protected |
◆ analyzeRegisters() [1/2]
void TDGen::analyzeRegisters |
( |
| ) |
|
|
protected |
Iterates through all registers in the machine and adds register information to the register sets.
Definition at line 783 of file TDGen.cc.
790 for (
int i = 0; i < busNav.
count(); i++) {
809 bool regsFound =
true;
813 for (
int i = 0; i < nav.
count(); i++) {
825 bool hasInput =
false;
826 bool hasOutput =
false;
827 for (
int p = 0; p < rf->
portCount(); p++) {
837 <<
"Warning: Skipping register file '"
839 <<
"': no input ports."
850 <<
"Warning Skipping register file '"
852 <<
"': no output ports."
858 unsigned width = rf->
width();
859 std::vector<RegInfo>* ri = NULL;
869 int lastIdx = rf->
size();
884 lastIdx -= renamerRegs;
887 if (currentIdx < lastIdx) {
888 RegInfo reg = {rf->
name(), (unsigned)currentIdx};
References TTAMachine::Machine::busNavigator(), AssocTools::containsKey(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), guardedRegs_, TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), TTAMachine::RegisterFile::isReserved(), TTAMachine::Machine::Navigator< ComponentType >::item(), Application::logStream(), mach_, TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), REG_RENAMER_PART, TTAMachine::RegisterGuard::registerFile(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::RegisterGuard::registerIndex(), regs1bit_, regs32bit_, regs64bit_, regs8bit_, TTAMachine::BaseRegisterFile::size(), tempRegFiles_, Application::VERBOSE_LEVEL_DEFAULT, Application::verboseLevel(), TTAMachine::BaseRegisterFile::width(), and TTAMachine::RegisterFile::zeroRegister().
Referenced by writeRegisterInfo().
◆ analyzeRegisters() [2/2]
◆ areImmediateOperandsLegal()
bool TDGen::areImmediateOperandsLegal |
( |
const Operation & |
operation, |
|
|
const std::string & |
operandTypes |
|
) |
| const |
|
protected |
Checks if the operation can have the specified immediate operands.
Definition at line 7543 of file TDGen.cc.
7568 for (
int swappableWith : operand.
swap()) {
7571 && operation.
name() !=
"EQ"
7572 && operation.
name() !=
"NE") {
References assert, ImmInfo::count(), immInfo_, Operand::isAddress(), Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::operand(), Operation::operandCount(), OT_IMM_INT, and Operand::swap().
Referenced by writeOperationDef().
◆ associatedVectorRegisterClass()
Returns the name of the vector class that supports given operand.
- Parameters
-
operand | Checked if any register class supports value type of this. |
- Returns
- Name of the register class that supports operand's value type.
Definition at line 1786 of file TDGen.cc.
1787 std::map<TCEString, RegisterClass>::const_iterator it =
1797 return regClass.
name();
References assert, TDGenerator::RegisterClass::name(), and vRegClasses_.
Referenced by operandToString().
◆ associateRegistersWithVectorRegisterClasses()
void TDGen::associateRegistersWithVectorRegisterClasses |
( |
| ) |
|
|
protected |
◆ canBeImmediate()
◆ canBePredicated()
bool TDGen::canBePredicated |
( |
Operation & |
op, |
|
|
const std::string & |
operandTypes |
|
) |
| |
|
protected |
◆ checkRequiredRegisters()
bool TDGen::checkRequiredRegisters |
( |
| ) |
|
|
protected |
Checks that the target machine has required registers to build a usable plugin.
- Returns
- True if required registers were found, false if not.
Definition at line 3280 of file TDGen.cc.
3284 "Architecture doesn't meet the minimal requirements.\n"
3285 "Only %d 32-bit general purpose registers found. At least %d\n"
3291 msg +=
"Your machine is not fully connected, thus one register\n"
3292 "from each register file are reserved for temp moves and\n"
3293 "not used as general purpose registers.";
3303 "Architecture doesn't meet the minimal requirements.\n"
3304 "Only %d 64-bit general purpose registers found. At least %d\n"
3310 msg +=
"Your machine is not fully connected, thus one register\n"
3311 "from each register file is reserved for temp moves and\n"
3312 "not used as general purpose registers.";
References __func__, TTAMachine::Machine::is64bit(), mach_, regs32bit_, regs64bit_, requiredI32Regs_, requiredI64Regs_, and tempRegFiles_.
Referenced by writeRegisterInfo().
◆ constantNodeString()
Definition at line 5541 of file TDGen.cc.
5554 for (OperationDAG::NodeSet::iterator i = siblings.begin();
5555 i!= siblings.end(); i++) {
5557 if (tNode != NULL) {
5563 switch (operandType) {
References assert, BoostGraph< GraphNode, GraphEdge >::headNode(), BoostGraph< GraphNode, GraphEdge >::inDegree(), Operand::index(), TTAMachine::Machine::is64bit(), Operand::isInput(), mach_, Operation::numberOfOutputs(), Operation::operand(), TerminalNode::operandIndex(), OT_IMM_BOOL, OT_IMM_FP, OT_IMM_INT, OT_IMM_LONG, OT_REG_BOOL, OT_REG_DOUBLE, OT_REG_FP, OT_REG_HFP, OT_REG_INT, OT_REG_LONG, BoostGraph< GraphNode, GraphEdge >::outDegree(), BoostGraph< GraphNode, GraphEdge >::outEdge(), BoostGraph< GraphNode, GraphEdge >::predecessors(), Conversion::toString(), and ConstantNode::value().
Referenced by dagNodeToString().
◆ create32BitExtLoadPatterns()
void TDGen::create32BitExtLoadPatterns |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 6734 of file TDGen.cc.
6744 os <<
"def : Pat<(i64 (zextloadi32 ADDRrr:$addr)), "
6745 <<
"(AND64ssa (LD32ss ADDRrr:$addr),"
6746 <<
"0xffffffff)>;" << std::endl;
6748 os <<
"def : Pat<(i64 (zextloadi32 ADDRri:$addr)), "
6749 <<
"(AND64ssa (LD32sa ADDRri:$addr),"
6750 <<
"0xffffffff)>;" << std::endl;
6753 os <<
"def : Pat<(i64 (zextloadi32 ADDRrr:$addr)), "
6754 <<
"(" << ZXOPC <<
" (LD32ss ADDRrr:$addr))>;" <<std::endl;
6756 os <<
"def : Pat<(i64 (zextloadi32 ADDRri:$addr)), "
6757 <<
"(" << ZXOPC <<
" (LD32sa ADDRri:$addr))>;" <<std::endl;
6762 std::cerr <<
"Warning: The architecture is missing any 16-bit loads."
6770 os <<
"def : Pat<(i64 (sextloadi32 ADDRrr:$addr)), "
6771 <<
"(SXW64ss (LDU32ss ADDRrr:$addr))>;" << std::endl;
6773 os <<
"def : Pat<(i64 (sextloadi32 ADDRri:$addr)), "
6774 <<
"(SXW64ss (LDU32sa ADDRri:$addr))>;" << std::endl;
6776 std::cerr <<
"Warning: no sign-extending 32-bit loads or"
6777 <<
" 32-bit sign extension instruction!"
6778 <<
" in the processor. All code may not compile!"
6783 os <<
"def : Pat<(i64 (extloadi32 ADDRrr:$src)), "
6784 <<
"(" << load <<
"ss ADDRrr:$src)>;" << std::endl
6786 <<
"def : Pat<(i64 (extloadi32 ADDRri:$src)), "
6787 <<
"(" << load <<
"sa ADDRrr:$src)>;" << std::endl;
References TTAMachine::Machine::hasOperation(), and mach_.
Referenced by writeInstrInfo().
◆ createBoolAndHalfLoadPatterns()
void TDGen::createBoolAndHalfLoadPatterns |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 8534 of file TDGen.cc.
8543 os <<
"def " << load
8544 <<
"Br : InstTCE<(outs R1Regs:$op2), (ins MEMrr:$op1), \"\", "
8545 <<
"[(set R1Regs:$op2, (sextloadi1 ADDRrr:$op1))]>;" << std::endl
8547 <<
"Bi : InstTCE<(outs R1Regs:$op2), (ins MEMri:$op1), \"\", "
8548 <<
"[(set R1Regs:$op2, (sextloadi1 ADDRri:$op1))]>; " << std::endl;
8555 os <<
"def " << uload
8556 <<
"Br : InstTCE<(outs R1Regs:$op2), (ins MEMrr:$op1), \"\", "
8557 <<
"[(set R1Regs:$op2, (zextloadi1 ADDRrr:$op1))]>;" << std::endl
8559 <<
"Bi : InstTCE<(outs R1Regs:$op2), (ins MEMri:$op1), \"\", "
8560 <<
"[(set R1Regs:$op2, (zextloadi1 ADDRri:$op1))]>;" << std::endl;
8564 os <<
"def : Pat<(i1 (load ADDRrr:$addr)), ("
8565 << uload <<
"Br ADDRrr:$addr)>;" << std::endl;
8566 os <<
"def : Pat<(i1 (load ADDRri:$addr)), ("
8567 << uload <<
"Bi ADDRri:$addr)>;" << std::endl;
8570 os <<
"def : Pat<(i1 (load ADDRrr:$addr)), ("
8571 << load <<
"Br ADDRrr:$addr)>;" << std::endl;
8572 os <<
"def : Pat<(i1 (load ADDRri:$addr)), ("
8573 << load <<
"Bi ADDRri:$addr)>;" << std::endl;
8583 os <<
"def " << wload
8584 <<
"Br : InstTCE<(outs R1Regs:$op2), (ins MEMrr:$op1), \"\", "
8585 <<
"[]>;" << std::endl
8587 <<
"Bi : InstTCE<(outs R1Regs:$op2), (ins MEMri:$op1), \"\", "
8588 <<
"[]>;" << std::endl;
8598 halfLoad = halfULoad;
8604 os <<
"def " << halfLoad <<
"hr : InstTCE<(outs HFPRegs:$op2), "
8605 <<
"(ins MEMrr:$op1), \"\", [(set HFPRegs:$op2, "
8606 <<
"(load ADDRrr:$op1))]>;" << std::endl;
8608 os <<
"def " << halfLoad <<
"hi : InstTCE<(outs HFPRegs:$op2), "
8609 <<
"(ins MEMri:$op1), \"\", [(set HFPRegs:$op2, "
8610 <<
"(load ADDRri:$op1))]>;" << std::endl;
8612 opNames_[halfLoad +
"hr"] = halfLoad;
8613 opNames_[halfLoad +
"hi"] = halfLoad;
References TTAMachine::Machine::hasOperation(), TTAMachine::Machine::is64bit(), littleEndian_, mach_, and opNames_.
Referenced by writeInstrInfo().
◆ createBranchAnalysis()
void TDGen::createBranchAnalysis |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 7896 of file TDGen.cc.
7897 os <<
"bool GeneratedTCEPlugin::analyzeCCBranch(" << std::endl
7898 <<
"\tllvm::MachineInstr& i," << std::endl
7899 <<
"\tllvm::SmallVectorImpl<llvm::MachineOperand>& cond) const {"
7906 os <<
"\tif (i.getOpcode() == TCE::EQ_JUMP) {" << std::endl
7907 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7908 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7909 <<
"\t\tcond.push_back(MachineOperand::CreateImm(2));"
7911 <<
"\t\treturn false; }" << std::endl;
7913 os <<
"\tif (i.getOpcode() == TCE::NE_JUMP) {" << std::endl
7914 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7915 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7916 <<
"\t\tcond.push_back(MachineOperand::CreateImm(3));"
7918 <<
"\t\treturn false; }" << std::endl;
7920 os <<
"\tif (i.getOpcode() == TCE::GT_JUMP) {" << std::endl
7921 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7922 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7923 <<
"\t\tcond.push_back(MachineOperand::CreateImm(4));"
7925 <<
"\t\treturn false; }" << std::endl;
7927 os <<
"\tif (i.getOpcode() == TCE::LE_JUMP) {" << std::endl
7928 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7929 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7930 <<
"\t\tcond.push_back(MachineOperand::CreateImm(5));"
7932 <<
"\t\treturn false; }" << std::endl;
7934 os <<
"\tif (i.getOpcode() == TCE::GTU_JUMP) {" << std::endl
7935 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7936 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7937 <<
"\t\tcond.push_back(MachineOperand::CreateImm(6));"
7939 <<
"\t\treturn false; }" << std::endl;
7941 os <<
"\tif (i.getOpcode() == TCE::LEU_JUMP) {" << std::endl
7942 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7943 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7944 <<
"\t\tcond.push_back(MachineOperand::CreateImm(7));"
7946 <<
"\t\treturn false; }" << std::endl;
7949 os <<
"\tif (i.getOpcode() == TCE::EQF_JUMP) {" << std::endl
7950 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7951 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7952 <<
"\t\tcond.push_back(MachineOperand::CreateImm(8));"
7954 <<
"\t\treturn false; }" << std::endl;
7958 os <<
"\tif (i.getOpcode() == TCE::NEF_JUMP) {" << std::endl
7959 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7960 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7961 <<
"\t\tcond.push_back(MachineOperand::CreateImm(9));"
7963 <<
"\t\treturn false; }" << std::endl;
7967 os <<
"\tif (i.getOpcode() == TCE::LEF_JUMP) {" << std::endl
7968 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7969 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7970 <<
"\t\tcond.push_back(MachineOperand::CreateImm(10));"
7972 <<
"\t\treturn false; }" << std::endl;
7976 os <<
"\tif (i.getOpcode() == TCE::GEF_JUMP) {" << std::endl
7977 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7978 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7979 <<
"\t\tcond.push_back(MachineOperand::CreateImm(10));"
7981 <<
"\t\treturn false; }" << std::endl;
7985 os <<
"\tif (i.getOpcode() == TCE::LTF_JUMP) {" << std::endl
7986 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7987 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7988 <<
"\t\tcond.push_back(MachineOperand::CreateImm(12));"
7990 <<
"\t\treturn false; }" << std::endl;
7994 os <<
"\tif (i.getOpcode() == TCE::GTF_JUMP) {" << std::endl
7995 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
7996 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
7997 <<
"\t\tcond.push_back(MachineOperand::CreateImm(13));"
7999 <<
"\t\treturn false; }" << std::endl;
8006 os <<
"\tif (i.getOpcode() == TCE::TCEBREQrr) {" << std::endl
8007 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8008 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8009 <<
"\t\tcond.push_back(MachineOperand::CreateImm(2));"
8011 <<
"\t\treturn false;" << std::endl
8012 <<
"\t}" << std::endl;
8014 os <<
"\tif (i.getOpcode() == TCE::TCEBREQri) {" << std::endl
8015 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8016 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8017 <<
"\t\tcond.push_back(MachineOperand::CreateImm(102));"
8019 <<
"\t\treturn false;" << std::endl
8020 <<
"\t}" << std::endl;
8024 os <<
"\tif (i.getOpcode() == TCE::TCEBRNErr) {" << std::endl
8025 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8026 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8027 <<
"\t\tcond.push_back(MachineOperand::CreateImm(3));"
8029 <<
"\t\treturn false;" << std::endl
8030 <<
"\t}" << std::endl;
8032 os <<
"\tif (i.getOpcode() == TCE::TCEBRNEri) {" << std::endl
8033 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8034 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8035 <<
"\t\tcond.push_back(MachineOperand::CreateImm(103));"
8037 <<
"\t\treturn false;" << std::endl
8038 <<
"\t}" << std::endl;
8042 os <<
"\tif (i.getOpcode() == TCE::TCEBRGTrr) {" << std::endl
8043 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8044 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8045 <<
"\t\tcond.push_back(MachineOperand::CreateImm(4));"
8047 <<
"\t\treturn false;" << std::endl
8048 <<
"\t}" << std::endl;
8050 os <<
"\tif (i.getOpcode() == TCE::TCEBRGTri) {" << std::endl
8051 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8052 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8053 <<
"\t\tcond.push_back(MachineOperand::CreateImm(104));"
8055 <<
"\t\treturn false;" << std::endl
8056 <<
"\t}" << std::endl;
8059 if (
opNames_.count(
"TCEBRGTUrr")) {
8060 os <<
"\tif (i.getOpcode() == TCE::TCEBRGTUrr) {" << std::endl
8061 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8062 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8063 <<
"\t\tcond.push_back(MachineOperand::CreateImm(6));"
8065 <<
"\t\treturn false;" << std::endl
8066 <<
"\t}" << std::endl;
8068 os <<
"\tif (i.getOpcode() == TCE::TCEBRGTUri) {" << std::endl
8069 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8070 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8071 <<
"\t\tcond.push_back(MachineOperand::CreateImm(106));"
8073 <<
"\t\treturn false;" << std::endl
8074 <<
"\t}" << std::endl;
8078 os <<
"\tif (i.getOpcode() == TCE::TCEBRLTrr) {" << std::endl
8079 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8080 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8081 <<
"\t\tcond.push_back(MachineOperand::CreateImm(14));"
8083 <<
"\t\treturn false;" << std::endl
8084 <<
"\t}" << std::endl;
8086 os <<
"\tif (i.getOpcode() == TCE::TCEBRLTri) {" << std::endl
8087 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8088 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8089 <<
"\t\tcond.push_back(MachineOperand::CreateImm(114));"
8091 <<
"\t\treturn false;" << std::endl
8092 <<
"\t}" << std::endl;
8095 if (
opNames_.count(
"TCEBRLTUrr")) {
8096 os <<
"\tif (i.getOpcode() == TCE::TCEBRLTUrr) {" << std::endl
8097 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8098 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8099 <<
"\t\tcond.push_back(MachineOperand::CreateImm(15));"
8101 <<
"\t\treturn false;" << std::endl
8102 <<
"\t}" << std::endl;
8104 os <<
"\tif (i.getOpcode() == TCE::TCEBRLTUri) {" << std::endl
8105 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8106 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8107 <<
"\t\tcond.push_back(MachineOperand::CreateImm(115));"
8109 <<
"\t\treturn false;" << std::endl
8110 <<
"\t}" << std::endl;
8114 os <<
"\tif (i.getOpcode() == TCE::TCEBRLErr) {" << std::endl
8115 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8116 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8117 <<
"\t\tcond.push_back(MachineOperand::CreateImm(5));"
8119 <<
"\t\treturn false;" << std::endl
8120 <<
"\t}" << std::endl;
8122 os <<
"\tif (i.getOpcode() == TCE::TCEBRLEri) {" << std::endl
8123 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8124 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8125 <<
"\t\tcond.push_back(MachineOperand::CreateImm(105));"
8127 <<
"\t\treturn false;" << std::endl
8128 <<
"\t}" << std::endl;
8131 if (
opNames_.count(
"TCEBRLEUrr")) {
8132 os <<
"\tif (i.getOpcode() == TCE::TCEBRLEUrr) {" << std::endl
8133 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8134 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8135 <<
"\t\tcond.push_back(MachineOperand::CreateImm(7));"
8137 <<
"\t\treturn false;" << std::endl
8138 <<
"\t}" << std::endl;
8140 os <<
"\tif (i.getOpcode() == TCE::TCEBRLEUri) {" << std::endl
8141 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8142 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8143 <<
"\t\tcond.push_back(MachineOperand::CreateImm(107));"
8145 <<
"\t\treturn false;" << std::endl
8146 <<
"\t}" << std::endl;
8150 os <<
"\tif (i.getOpcode() == TCE::TCEBRGErr) {" << std::endl
8151 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8152 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8153 <<
"\t\tcond.push_back(MachineOperand::CreateImm(16));"
8155 <<
"\t\treturn false;" << std::endl
8156 <<
"\t}" << std::endl;
8158 os <<
"\tif (i.getOpcode() == TCE::TCEBRGEri) {" << std::endl
8159 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8160 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8161 <<
"\t\tcond.push_back(MachineOperand::CreateImm(116));"
8163 <<
"\t\treturn false;" << std::endl
8164 <<
"\t}" << std::endl;
8167 if (
opNames_.count(
"TCEBRGEUrr")) {
8168 os <<
"\tif (i.getOpcode() == TCE::TCEBRGEUrr) {" << std::endl
8169 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8170 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8171 <<
"\t\tcond.push_back(MachineOperand::CreateImm(17));"
8173 <<
"\t\treturn false;" << std::endl
8174 <<
"\t}" << std::endl;
8176 os <<
"\tif (i.getOpcode() == TCE::TCEBRGEUri) {" << std::endl
8177 <<
"\t\tcond.push_back(i.getOperand(0));" << std::endl
8178 <<
"\t\tcond.push_back(i.getOperand(1));" << std::endl
8179 <<
"\t\tcond.push_back(MachineOperand::CreateImm(117));"
8181 <<
"\t\treturn false;" << std::endl
8182 <<
"\t}" << std::endl;
8185 os <<
"\treturn true;"
8186 <<
"}" << std::endl << std::endl;
8190 os <<
"#include <llvm/CodeGen/MachineInstrBuilder.h>" << std::endl
8193 os <<
"void TCEInstrInfo::insertCCBranch( " << std::endl
8194 <<
"\tMachineBasicBlock& mbb," << std::endl
8195 <<
"\tMachineBasicBlock& tbb," << std::endl
8196 <<
"\tArrayRef<MachineOperand> cond," << std::endl
8197 <<
"const DebugLoc& dl) const {" << std::endl
8198 <<
"\tassert(cond.size() == 3);" << std::endl;
8200 os <<
"\tint opcode;" << std::endl;
8204 os <<
"\tswitch (cond[2].getImm()) {" << std::endl
8205 <<
"\t\tcase 2: opcode = TCE::EQ_JUMP;break;" << std::endl
8206 <<
"\t\tcase 3: opcode = TCE::NE_JUMP;break;" << std::endl
8207 <<
"\t\tcase 4: opcode = TCE::GT_JUMP;break;" << std::endl
8208 <<
"\t\tcase 5: opcode = TCE::LE_JUMP;break;" << std::endl
8209 <<
"\t\tcase 6: opcode = TCE::GTU_JUMP;break;" << std::endl
8210 <<
"\t\tcase 7: opcode = TCE::LEU_JUMP;break;" << std::endl;
8213 os <<
"\t\tcase 8: opcode = TCE::EQF_JUMP;break;" << std::endl;
8216 os <<
"\t\tcase 9: opcode = TCE::NEF_JUMP;break;" << std::endl;
8219 os <<
"\t\tcase 10: opcode = TCE::LEF_JUMP;break;" << std::endl;
8222 os <<
"\t\tcase 11: opcode = TCE::GEF_JUMP;break;" << std::endl;
8225 os <<
"\t\tcase 12: opcode = TCE::LTF_JUMP;break;" << std::endl;
8228 os <<
"\t\tcase 13: opcode = TCE::GTF_JUMP;break;" << std::endl;
8231 os <<
"\t\tdefault: assert(false && \"Unknown condition code\");}"
8235 os <<
"\tswitch (cond[2].getImm()) {" << std::endl;
8237 os <<
"\t\tcase 2: opcode = TCE::TCEBREQrr; break;" << std::endl
8238 <<
"\t\tcase 102: opcode = TCE::TCEBREQri; break;"
8242 os <<
"\t\tcase 3: opcode = TCE::TCEBRNErr; break;" << std::endl
8243 <<
"\t\tcase 103: opcode = TCE::TCEBRNEri; break;"
8247 os <<
"\t\tcase 4: opcode = TCE::TCEBRGTrr; break;" << std::endl
8248 <<
"\t\tcase 104: opcode = TCE::TCEBRGTri; break;"
8251 if (
opNames_.count(
"TCEBRGTUrr")) {
8252 os <<
"\t\tcase 6: opcode = TCE::TCEBRGTUrr; break;" << std::endl
8253 <<
"\t\tcase 106: opcode = TCE::TCEBRGTUri; break;"
8257 os <<
"\t\tcase 14: opcode = TCE::TCEBRLTrr; break;" << std::endl
8258 <<
"\t\tcase 114: opcode = TCE::TCEBRLTri; break;"
8261 if (
opNames_.count(
"TCEBRLTUrr")) {
8262 os <<
"\t\tcase 15: opcode = TCE::TCEBRLTUrr; break;" << std::endl
8263 <<
"\t\tcase 115: opcode = TCE::TCEBRLTUri; break;"
8267 os <<
"\t\tcase 5: opcode = TCE::TCEBRLErr; break;" << std::endl
8268 <<
"\t\tcase 105: opcode = TCE::TCEBRLEri; break;"
8271 if (
opNames_.count(
"TCEBRLEUrr")) {
8272 os <<
"\t\tcase 7: opcode = TCE::TCEBRLEUrr; break;" << std::endl
8273 <<
"\t\tcase 107: opcode = TCE::TCEBRLEUri; break;"
8277 os <<
"\t\tcase 16: opcode = TCE::TCEBRGErr; break;" << std::endl
8278 <<
"\t\tcase 116: opcode = TCE::TCEBRGEri; break;"
8281 if (
opNames_.count(
"TCEBRGEUrr")) {
8282 os <<
"\t\tcase 17: opcode = TCE::TCEBRGEUrr; break;" << std::endl
8283 <<
"\t\tcase 117: opcode = TCE::TCEBRGEUri; break;"
8286 os <<
"\t\tdefault: assert(false && \"Unknown condition code\");}"
8289 os <<
"\tassert(false && \"Unknown condition code\");" << std::endl;
8292 os <<
"\tif (cond[1].isReg()) {" << std::endl
8293 <<
"\t\tBuildMI(&mbb, dl, get(opcode)).addReg(cond[0].getReg())"
8295 <<
"\t\t .addReg(cond[1].getReg()).addMBB(&tbb);" << std::endl
8296 <<
"\t} else {" << std::endl
8297 <<
"\t\tBuildMI(&mbb, dl, get(opcode)).addReg(cond[0].getReg())"
8299 <<
"\t\t .addImm(cond[1].getImm()).addMBB(&tbb);" << std::endl
8300 <<
"\t}" << std::endl;
References mach_, opNames_, MachineInfo::supportsBoolRegisterGuardedJumps(), and MachineInfo::supportsPortGuardedJumps().
Referenced by writeBackendCode().
◆ createByteExtLoadPatterns()
void TDGen::createByteExtLoadPatterns |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 6457 of file TDGen.cc.
6479 TCEString loadOpcReg = load + dstTypeChar + regSrcChar;
6480 TCEString loadOpcImm = load + dstTypeChar + immSrcChar;
6486 os <<
"def : Pat<(i" << destSize <<
" (zextloadi8 ADDRrr:$addr)), "
6487 <<
"(" << ANDIMM <<
" ("
6488 << loadOpcReg <<
" ADDRrr:$addr), 255)>;"
6490 os <<
"def : Pat<(i" << destSize <<
" (zextloadi8 ADDRri:$addr)), "
6491 <<
"(" << ANDIMM <<
" ("
6492 << loadOpcImm <<
" ADDRri:$addr), 255)>;"
6498 std::cerr <<
"Warning: The architecture is missing any 8-bit loads."
6499 <<
" All code may not compile!"
6503 loadOpcReg = uload + dstTypeChar + regSrcChar;
6504 loadOpcImm = uload + dstTypeChar + immSrcChar;
6508 os <<
"def : Pat<(i" << destSize
6509 <<
" (sextloadi8 ADDRrr:$addr)), "
6510 <<
"(" << EXTOPC <<
" ("
6511 << loadOpcReg <<
" ADDRrr:$addr))>;" << std::endl;
6512 os <<
"def : Pat<(i" << destSize
6513 <<
" (sextloadi8 ADDRri:$addr)), "
6514 <<
"(" << EXTOPC <<
" ("
6515 << loadOpcImm <<
" ADDRri:$addr))>;" << std::endl;
6521 os <<
"def : Pat<(i" << destSize
6522 <<
" (sextloadi16 ADDRrr:$addr)), "
6523 <<
"(" << SHROPC <<
" (" << SHLOPC <<
" ("
6524 << load <<
"rr ADDRrr:$addr), "
6525 << sb <<
"), " << sb <<
")>;" << std::endl;
6527 os <<
"def : Pat<(i" << destSize
6528 <<
" (sextloadi16 ADDRri:$addr)), "
6529 <<
"(" << SHROPC <<
" (" << SHLOPC <<
" ("
6530 << load <<
"ri ADDRri:$addr), "
6531 << sb <<
"), " << sb <<
")>;" << std::endl;
6535 os <<
"def : Pat<(i32 (sextloadi8 ADDRrr:$addr)), "
6536 <<
"(SHR4_32rr (SHR4_32rr (SHR4_32rr (SHR4_32rr "
6537 <<
"(SHR4_32rr (SHR4_32rr "
6538 <<
"(SHL4_32rr (SHL4_32rr (SHL4_32rr (SHL4_32rr "
6539 <<
"(SHL4_32rr (SHL4_32rr ("
6540 << load <<
"rr ADDRrr:$addr)))))))))))))>;"
6543 os <<
"def : Pat<(i32 (sextloadi8 ADDRri:$addr)), "
6544 <<
"(SHR4_32rr (SHR4_32rr (SHR4_32rr (SHR4_32rr "
6545 <<
"(SHR4_32rr (SHR4_32rr "
6546 <<
"(SHL4_32rr (SHL4_32rr (SHL4_32rr (SHL4_32rr "
6547 <<
"(SHL4_32rr (SHL4_32rr ("
6548 << load <<
"ri ADDRri:$addr)))))))))))))>;"
6551 os <<
"def : Pat<(i64 (sextloadi8 ADDRrr:$addr)), "
6552 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6553 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6554 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6555 <<
"(SHR4_64ss (SHR4_64ss "
6556 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6557 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6558 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6559 <<
"(SHL4_64ss (SHL4_64ss ("
6560 << load <<
"rr ADDRrr:$addr)))))))))))))>;"
6563 os <<
"def : Pat<(i64 (sextloadi8 ADDRri:$addr)), "
6564 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6565 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6566 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6567 <<
"(SHR4_64ss (SHR4_64ss "
6568 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6569 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6570 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6571 <<
"(SHL4_64ss (SHL4_64ss ("
6572 << load <<
"ri ADDRri:$addr)))))))))))))>;"
6576 std::cerr <<
"Warning: no sign-extending 8-bit loads,"
6577 <<
" 8-bit sign extension instruction or suitable"
6578 <<
" shifts for sext-emulation in the processor."
6579 <<
" All code may not compile!" << std::endl;
6587 os <<
"def : Pat<(i" << destSize <<
" (zextloadi1 ADDRrr:$addr)), ("
6588 << loadOpcReg <<
" ADDRrr:$addr)>;"
6590 <<
"def : Pat<(i" << destSize <<
" (zextloadi1 ADDRri:$addr)), ("
6591 << loadOpcImm <<
" ADDRri:$addr)>;"
6594 os <<
"def : Pat<(i" << destSize <<
" (sextloadi1 ADDRrr:$addr)), "
6595 <<
"(" <<
SUBIMM <<
" 0, "
6596 <<
"(" << ANDREG <<
" ("
6597 << loadOpcReg <<
" ADDRrr:$addr), 1))>;"
6599 <<
"def : Pat<(i" << destSize <<
" (sextloadi1 ADDRri:$addr)), "
6600 <<
"(" <<
SUBIMM <<
" 0, "
6601 <<
"(" << ANDREG <<
" ("
6602 << loadOpcImm <<
" ADDRri:$addr), 1))>;"
6604 <<
"// anyextloads" << std::endl;
6606 os <<
"def : Pat<(i" << destSize <<
" (extloadi1 ADDRrr:$src)), ("
6607 << loadOpcReg <<
" ADDRrr:$src)>;" << std::endl
6608 <<
"def : Pat<(i" << destSize <<
" (extloadi1 ADDRri:$src)), ("
6609 << loadOpcImm <<
" ADDRri:$src)>;" << std::endl
6610 <<
"def : Pat<(i" << destSize <<
" (extloadi8 ADDRrr:$src)), ("
6611 << loadOpcReg <<
" ADDRrr:$src)>;" << std::endl
6612 <<
"def : Pat<(i" << destSize <<
" (extloadi8 ADDRri:$src)), ("
6613 << loadOpcImm <<
" ADDRri:$src)>;" << std::endl
References TTAMachine::Machine::hasOperation(), TTAMachine::Machine::is64bit(), littleEndian_, mach_, OT_IMM_INT, OT_IMM_LONG, OT_REG_INT, OT_REG_LONG, and SUBIMM.
Referenced by writeInstrInfo().
◆ createConstantMaterializationPatterns()
void TDGen::createConstantMaterializationPatterns |
( |
std::ostream & |
os | ) |
|
|
protectedvirtual |
Generates llvm patterns for constants which are not supported directly as immediates by the target machine.
For example, if a target does not sign extending immediates, a pattern is generated that transforms negative constants C to (SUB 0, -C).
Definition at line 7384 of file TDGen.cc.
7393 os << std::endl <<
"// Arithmetic negation XForm fragment."
7394 << std::endl <<
"def aneg_xform : SDNodeXForm<imm, [{"
7395 << std::endl <<
" return CurDAG->getTargetConstant("
7396 << std::endl <<
" -(N->getZExtValue()), SDLoc(N), MVT::i32);"
7397 << std::endl <<
"}]>;"
7398 << std::endl << std::endl;
7410 std::vector<std::string> ops;
7411 if (
opNames_.count(
"NEGri")) ops.push_back(
"NEG");
7412 if (
opNames_.count(
"SUBrri")) ops.push_back(
"SUB");
7413 for (
auto op : ops) {
7415 std::string predicate =
"Imm < 0";
7418 if (tmp.second < 2)
continue;
7428 os << std::endl <<
"def : Pat<(i32 minus_i32imm:$imm)," << std::endl;
7430 os <<
" (NEGri (aneg_xform imm:$imm))>;";
7431 }
else if (op ==
"SUB") {
7432 os <<
" (SUBrri (MOVI32ri 0), (aneg_xform imm:$imm))>;";
References constantMaterializationPredicates_, ImmInfo::immediateValueBounds(), immInfo_, opNames_, Conversion::toString(), and writeImmediateDef().
Referenced by writeInstrInfo().
◆ createConstantMaterializationQuery()
void TDGen::createConstantMaterializationQuery |
( |
std::ostream & |
os | ) |
|
|
protected |
Creates query function for TCEISelLowering for testing if otherwise unsupported constant as immediate can be materialized instead of converting it to constant pool load.
Definition at line 6427 of file TDGen.cc.
6430 os <<
"bool GeneratedTCEPlugin::canMaterializeConstant("
6431 <<
"const ConstantInt&) const { " << std::endl
6432 <<
" return false;" << std::endl
6433 <<
"};" << std::endl;
6437 os <<
"bool GeneratedTCEPlugin::canMaterializeConstant("
6438 <<
"const ConstantInt& ci) const {"
6440 <<
" int64_t Imm = ci.getSExtValue();" << std::endl
6445 os << std::endl <<
" || ";
6447 os <<
"(" << predicate <<
")";
6451 <<
" return true;" << std::endl
6452 <<
" }" << std::endl
6453 <<
" return false;" << std::endl
6454 <<
"}" << std::endl;
References constantMaterializationPredicates_.
Referenced by writeBackendCode().
◆ createConstShiftPatterns()
void TDGen::createConstShiftPatterns |
( |
std::ostream & |
os | ) |
|
|
protected |
◆ createDefaultOperandTypeString()
std::string TDGen::createDefaultOperandTypeString |
( |
const Operation & |
op | ) |
|
|
protected |
◆ createEndiannesQuery()
void TDGen::createEndiannesQuery |
( |
std::ostream & |
os | ) |
|
|
protected |
◆ createGetMaxMemoryAlignment()
void TDGen::createGetMaxMemoryAlignment |
( |
std::ostream & |
os | ) |
const |
|
protected |
Definition at line 6974 of file TDGen.cc.
6977 <<
"unsigned GeneratedTCEPlugin::getMaxMemoryAlignment() const {"
6980 << std::endl <<
"}" << std::endl;
6983 <<
"unsigned GeneratedTCEPlugin::getMaxMemoryAlignment() const {"
6986 << std::endl <<
"}" << std::endl;
References TTAMachine::Machine::is64bit(), and mach_.
◆ createMinMaxDef()
void TDGen::createMinMaxDef |
( |
const TCEString & |
opName, |
|
|
const TCEString & |
valueName, |
|
|
std::ostream & |
os |
|
) |
| |
|
protected |
◆ createMinMaxGenerator()
void TDGen::createMinMaxGenerator |
( |
std::ostream & |
os | ) |
|
|
protectedvirtual |
Definition at line 6324 of file TDGen.cc.
6328 os <<
"int GeneratedTCEPlugin::getMinOpcode(SDNode* n) const {" << std::endl
6329 <<
"\tEVT vt = n->getOperand(1).getValueType();" << std::endl;
6332 os <<
"if (vt == MVT::i32) return TCE::MINrrr;" << std::endl;
6336 os <<
"if (vt == MVT::i64) return TCE::MIN64sss;" << std::endl;
6340 os <<
"if (vt == MVT::f32) return TCE::MINFfff;" << std::endl;
6348 os <<
"\treturn -1; " << std::endl <<
"}" << std::endl;
6351 os <<
"int GeneratedTCEPlugin::getMaxOpcode(SDNode* n) const {" << std::endl
6352 <<
"\tEVT vt = n->getOperand(1).getValueType();" << std::endl;
6356 os <<
"if (vt == MVT::i32) return TCE::MAXrrr;" << std::endl;
6360 os <<
"if (vt == MVT::i64) return TCE::MAX64sss;" << std::endl;
6365 os <<
"if (vt == MVT::f32) return TCE::MAXFfff;" << std::endl;
6373 os <<
"\treturn -1; " << std::endl <<
"}" << std::endl;
6376 os <<
"int GeneratedTCEPlugin::getMinuOpcode(SDNode* n) const {" << std::endl;
6377 os <<
"\tEVT vt = n->getOperand(1).getValueType();" << std::endl;
6381 os <<
"if (vt == MVT::i32) return TCE::MINUrrr;" << std::endl;
6385 os <<
"if (vt == MVT::i64) return TCE::MINU64sss;" << std::endl;
6391 os <<
"\treturn -1; " << std::endl <<
"}" << std::endl;
6394 os <<
"int GeneratedTCEPlugin::getMaxuOpcode(SDNode* n) const {" << std::endl;
6395 os <<
"\tEVT vt = n->getOperand(1).getValueType();" << std::endl;
6400 os <<
"if (vt == MVT::i32) return TCE::MAXUrrr;" << std::endl;
6404 os <<
"if (vt == MVT::i64) return TCE::MAXU64sss;" << std::endl;
6410 os <<
"\treturn -1; " << std::endl <<
"}" << std::endl;
References createVectorMinMaxDef(), TTAMachine::Machine::is64bit(), mach_, and opNames_.
Referenced by writeBackendCode().
◆ createParamDRegNums()
void TDGen::createParamDRegNums |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 6936 of file TDGen.cc.
6938 "std::vector<unsigned>" << std::endl <<
6939 "GeneratedTCEPlugin::getParamDRegNums() const {" << std::endl <<
6940 "std::vector<unsigned> res;" << std::endl;
6942 os <<
"res.push_back(TCE::A" << i <<
");" << std::endl;
6944 os <<
"return res;}" << std::endl;
References argRegCount_.
Referenced by writeBackendCode().
◆ createSelectPatterns()
void TDGen::createSelectPatterns |
( |
std::ostream & |
os | ) |
|
|
protectedvirtual |
Definition at line 6991 of file TDGen.cc.
6992 os <<
"// Creating select patterns. " << std::endl;
6994 os <<
"// Does not have select instr. " << std::endl;
6997 std::string NEGOPC =
mach_.
is64bit() ?
"NEG64ss" :
"NEGrr";
6998 std::string gprRegs =
mach_.
is64bit() ?
"R64IRegs" :
"R32IRegs";
7000 std::string typeStrInv =
mach_.
is64bit() ?
"sas" :
"rir";
7006 std::string andReg =
mach_.
is64bit() ?
"AND64sss" :
"ANDrrr";
7007 std::string iorReg =
mach_.
is64bit() ?
"IOR64sss" :
"IORrrr";
7009 std::string iorBool =
mach_.
is64bit() ?
"IOR64bbb" :
"IORbbb";
7010 std::string andBool =
mach_.
is64bit() ?
"AND64bbb" :
"ANDbbb";
7011 std::string xorBooli =
mach_.
is64bit() ?
"XOR64bbj" :
"XORbbj";
7013 bool hasNeg =
opNames_.count(
"NEGrr");
7015 std::string condRC =
regs1bit_.empty() ? gprRegs :
"R1Regs";
7016 std::string truncOp =
regs1bit_.empty() ? std::string(iand) + typeStr :
"ANDext";
7018 std::string truncPattern =
regs1bit_.empty()
7020 : std::string(
"(") + truncOp +
" " + condRC +
":$c" +
", 1)";
7024 std::string trueMask = hasNeg ?
7025 std::string(
"(" + NEGOPC +
" ") + truncPattern +
7028 opPool.operation(
sub), typeStrInv,
"0", truncPattern);
7031 opPool.
operation(iand), typeStr, trueMask,
"imm:$t");
7033 opPool.
operation(iand), typeStr, falseMask,
"imm:$f");
7035 #if 0 // TODO: why is this commented out???
7038 <<
"def : Pat<(i64 (select R1Regs:$c, R64Regs:$t, R64Regs:$f)), "
7039 <<
"(IOR64sss (AND64sss R32Regs:$t, (SUB64sas 0, (ANDext R1Regs:$c, 1))),"
7040 <<
"(AND64sss R32Regs:$f, (SUB64ssa (ANDext R1Regs:$c, 1), 1)))>;"
7041 << std::endl << std::endl
7043 <<
"def : Pat<(i64 (select R1Regs:$c, (i64 imm:$t),(i64 imm:$f))),"
7044 <<
"(IOR64sss (AND64ssa (SUB64sas 0, (ANDext R1Regs:$c, 1)), imm:$t),"
7045 <<
"(AND64ssa (SUB64ssa (ANDext R1Regs:$c, 1), 1), imm:$f))>;"
7046 << std::endl << std::endl
7048 <<
"def : Pat<(i64 (select R1Regs:$c, R64Regs:$t, (i64 imm:$f))),"
7049 <<
"(IOR64sss (AND64sss (SUB64sas 0, (ANDext R1Regs:$c, 1)), R32Regs:$t),"
7050 <<
"(AND64ssa (SUB64ssa (ANDext R1Regs:$c, 1), 1), imm:$f))>;"
7051 << std::endl << std::endl
7053 <<
"def : Pat<(i64 (select R1Regs:$c, (i64 imm:$t), R64Regs:$f)),"
7054 <<
"(IOR64sss (AND64ssa (SUB64sas 0, (ANDext R1Regs:$c, 1)), imm:$t),"
7055 <<
"(AND64sss (SUB64ssa (ANDext R1Regs:$c, 1), 1), R32Regs:$f))>;"
7056 << std::endl << std::endl;
7059 <<
"def : Pat<(i64 (select R1Regs:$c, R64Regs:$t, R64Regs:$f)), "
7060 <<
"(IOR64sss (AND64sss R64Regs:$t, (SUB64sas 0, (ANDext R1Regs:$c, 1))),"
7061 <<
"(AND64sss R64Regs:$f, (SUB64ssa (ANDext R1Regs:$c, 1), 1)))>;"
7062 << std::endl << std::endl
7064 <<
"def : Pat<(i64 (select R1Regs:$c, (i64 imm:$t),(i64 imm:$f))),"
7065 <<
"(IOR64sss (AND64ssa (SUB64sas 0, (ANDext R1Regs:$c, 1)), imm:$t),"
7066 <<
"(AND64ssa (SUB64ssa (ANDext R1Regs:$c, 1), 1), imm:$f))>;"
7067 << std::endl << std::endl
7069 <<
"def : Pat<(i64 (select R1Regs:$c, R64Regs:$t, (i64 imm:$f))),"
7070 <<
"(IOR64sss (AND64sss (SUB64sas 0, (ANDext R1Regs:$c, 1)), R64Regs:$t),"
7071 <<
"(AND64ssa (SUB64ssa (ANDext R1Regs:$c, 1), 1), imm:$f))>;"
7072 << std::endl << std::endl
7074 <<
"def : Pat<(i64 (select R1Regs:$c, (i64 imm:$t), R64Regs:$f)),"
7075 <<
"(IOR64sss (ANDssa (SUB64sas 0, (ANDext R1Regs:$c, 1)), imm:$t),"
7076 <<
"(ANDsss (SUBssa (ANDext R1Regs:$c, 1), 1), R64Regs:$f))>;"
7077 << std::endl << std::endl
7079 <<
"def : Pat<(i1 (select R1Regs:$c, R1Regs:$t, R1Regs:$f)),"
7080 <<
"(IOR64bbb (AND64bbb R1Regs:$c, R1Regs:$t), "
7081 <<
"(AND64bbb (XOR64bbj R1Regs:$c, 1), R1Regs:$f))>;"
7082 << std::endl << std::endl
7084 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 0), R1Regs:$f)),"
7085 <<
"(AND64bbb (XOR64bbj R1Regs:$c, 1), R1Regs:$f)>;"
7086 << std::endl << std::endl
7088 <<
"def : Pat<(i1 (select R1Regs:$c, R1Regs:$t, (i1 -1))),"
7089 <<
"(IOR64bbb (AND64bbb R1Regs:$c, R1Regs:$t),"
7090 <<
"(XOR64bbj R1Regs:$c, 1))>;"
7091 << std::endl << std::endl;
7097 os <<
"def : Pat<(i64 (select "
7098 << condRC <<
":$c, R64Regs:$t, (i64 0)))," << std::endl
7100 << trueMask <<
", R64Regs:$t)>;"
7101 << std::endl << std::endl
7103 <<
"def : Pat<(i64 (select "
7104 << condRC <<
":$c, (i64 0), R64Regs:$f))," << std::endl
7105 <<
"(AND64sss " << falseMask <<
", R64Regs:$f)>;"
7106 << std::endl << std::endl;
7109 os <<
"def : Pat<(i64 (select "
7110 << condRC <<
":$c, (i64 imm:$t),(i64 0)))," << std::endl
7111 <<
" " << applyTrueMaskOnImm <<
">;"
7112 << std::endl << std::endl;
7114 os <<
"def : Pat<(i64 (select "
7115 << condRC <<
":$c, (i64 0),(i64 imm:$f)))," << std::endl
7116 <<
" " << applyFalseMaskOnImm <<
">;"
7117 << std::endl << std::endl;
7120 os <<
"def : Pat<(i32 (select "
7121 << condRC <<
":$c, R32Regs:$t, (i32 0)))," << std::endl
7123 << trueMask <<
", R32Regs:$t)>;"
7124 << std::endl << std::endl
7126 <<
"def : Pat<(i32 (select "
7127 << condRC <<
":$c, (i32 0), R32Regs:$f))," << std::endl
7128 <<
"(ANDrrr " << falseMask <<
", R32Regs:$f)>;"
7129 << std::endl << std::endl;
7132 os <<
"def : Pat<(i32 (select "
7133 << condRC <<
":$c, (i32 imm:$t),(i32 0)))," << std::endl
7134 <<
" " << applyTrueMaskOnImm <<
">;"
7135 << std::endl << std::endl;
7137 os <<
"def : Pat<(i32 (select "
7138 << condRC <<
":$c, (i32 0),(i32 imm:$f)))," << std::endl
7139 <<
" " << applyFalseMaskOnImm <<
">;"
7140 << std::endl << std::endl;
7148 <<
"def : Pat<(" << defType <<
" (select "
7149 << condRC <<
":$c, " << gprRegs <<
":$t, " << gprRegs <<
":$f)), " << std::endl
7150 <<
" (" << iorReg <<
" (" << andReg <<
" " << gprRegs <<
":$t, "
7152 <<
"(" << andReg <<
" " << gprRegs <<
":$f, " << falseMask <<
"))>;"
7153 << std::endl << std::endl
7155 <<
"def : Pat<(" << defType <<
" (select "
7156 << condRC <<
":$c, (" << defType <<
" imm:$t),(" << defType <<
" imm:$f)))," << std::endl
7157 <<
" (" << iorReg <<
" " << applyTrueMaskOnImm <<
","
7158 << applyFalseMaskOnImm <<
")>;"
7159 << std::endl << std::endl
7161 <<
"def : Pat<(" << defType <<
" (select "
7162 << condRC <<
":$c, " << gprRegs <<
":$t, (" << defType <<
" imm:$f)))," << std::endl
7163 <<
" (" << iorReg <<
" (" << andReg <<
" "
7164 << trueMask <<
", " << gprRegs <<
":$t)," << applyFalseMaskOnImm <<
")>;"
7165 << std::endl << std::endl
7167 <<
"def : Pat<(" << defType <<
" (select "
7168 << condRC <<
":$c, (" << defType <<
" imm:$t), " << gprRegs <<
":$f))," << std::endl
7169 <<
" (" << iorReg <<
" " << applyTrueMaskOnImm <<
","
7170 <<
"(" << andReg <<
" " << falseMask <<
", " << gprRegs <<
":$f))>;"
7171 << std::endl << std::endl;
7174 os <<
"def : Pat<(i1 (select R1Regs:$c, R1Regs:$t, R1Regs:$f)),"
7176 <<
" (" << iorBool <<
" (" << andBool <<
" R1Regs:$c, R1Regs:$t), "
7177 <<
"(" << andBool <<
" (" << xorBooli <<
" R1Regs:$c, 1), R1Regs:$f))>;"
7178 << std::endl << std::endl
7180 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 0), R1Regs:$f)),"
7182 <<
" (" << andBool <<
" (" << xorBooli <<
" R1Regs:$c, 1), R1Regs:$f)>;"
7183 << std::endl << std::endl
7185 <<
"def : Pat<(i1 (select R1Regs:$c, R1Regs:$t, (i1 -1))),"
7187 <<
" (" << iorBool <<
" (" << andBool <<
" R1Regs:$c, R1Regs:$t),"
7188 <<
"(" << xorBooli <<
" R1Regs:$c, 1))>;"
7189 << std::endl << std::endl;
7192 os <<
"def : Pat<(f32 (select " << condRC <<
":$c, "
7193 "FPRegs:$t,FPRegs:$f))," << std::endl
7194 <<
" (IORfff (ANDfff FPRegs:$t, (SUBfir 0, "
7195 << truncPattern <<
")),"
7196 <<
"(ANDfff FPRegs:$f, (SUBfri "
7197 << truncPattern <<
",1)))>;"
7198 << std::endl << std::endl
7200 <<
"def : Pat<(f16 (select " << condRC <<
":$c, "
7201 "R32HFPRegs:$t, R32HFPRegs:$f))," << std::endl
7202 <<
" (IORhhh (ANDhhh R32HFPRegs:$t, (SUBhir 0, "
7203 << truncPattern <<
")),"
7204 <<
"(ANDhhh R32HFPRegs:$f, (SUBhri "
7205 << truncPattern <<
",1)))>;"
7206 << std::endl << std::endl;
7209 opNames_[
"SELECT_I1bb"] =
"CMOV_SELECT";
7210 opNames_[
"SELECT_I1bj"] =
"CMOV_SELECT";
7211 opNames_[
"SELECT_I1jb"] =
"CMOV_SELECT";
7212 opNames_[
"SELECT_I1jj"] =
"CMOV_SELECT";
7213 opNames_[
"SELECT_I32rr"] =
"CMOV_SELECT";
7214 opNames_[
"SELECT_I32ir"] =
"CMOV_SELECT";
7215 opNames_[
"SELECT_I32ri"] =
"CMOV_SELECT";
7216 opNames_[
"SELECT_I32ii"] =
"CMOV_SELECT";
7217 opNames_[
"SELECT_F32"] =
"CMOV_SELECT";
7218 opNames_[
"SELECT_F16"] =
"CMOV_SELECT";
7221 os <<
" let isSelect = 1 in {" << std::endl;
7224 opNames_[
"SELECT_I64rr"] =
"CMOV_SELECT";
7225 opNames_[
"SELECT_I64ir"] =
"CMOV_SELECT";
7226 opNames_[
"SELECT_I64ri"] =
"CMOV_SELECT";
7227 opNames_[
"SELECT_I64ii"] =
"CMOV_SELECT";
7228 opNames_[
"SELECT_F64"] =
"CMOV_SELECT";
7232 os <<
"def SELECT_I64rr : InstTCE<(outs R64IRegs:$dst),"
7233 <<
"(ins R1Regs:$c, R64IRegs:$T, R64IRegs:$F),"
7234 <<
"\"# SELECT_I64 PSEUDO!\","
7235 <<
"[(set R64IRegs:$dst,"
7236 <<
"(select R1Regs:$c, R64IRegs:$T, R64IRegs:$F))]>;"
7237 << std::endl << std::endl
7239 <<
"def SELECT_I64ri : InstTCE<(outs R64IRegs:$dst),"
7240 <<
"(ins R64IRegs:$c, R64IRegs:$T, i64imm:$F),"
7241 <<
"\"# SELECT_I64 PSEUDO!\","
7242 <<
"[(set R64IRegs:$dst,"
7243 <<
"(select R64IRegs:$c, R64IRegs:$T, (i64 imm:$F)))]>;"
7244 << std::endl << std::endl
7246 <<
"def SELECT_I64ir : InstTCE<(outs R64IRegs:$dst),"
7247 <<
"(ins R64IRegs:$c, i64imm:$T, R64IRegs:$F),"
7248 <<
"\"# SELECT_I64 PSEUDO!\","
7249 <<
"[(set R64IRegs:$dst,"
7250 <<
"(select R64IRegs:$c, (i64 imm:$T), R64IRegs:$F))]>;"
7251 << std::endl << std::endl
7253 <<
"def SELECT_I64ii : InstTCE<(outs R64IRegs:$dst),"
7254 <<
"(ins R64IRegs:$c, i64imm:$T, i64imm:$F),"
7255 <<
"\"# SELECT_I64 PSEUDO!\","
7256 <<
"[(set R64IRegs:$dst,"
7257 <<
"(select R64IRegs:$c, (i64 imm:$T), (i64 imm:$F)))]>;"
7258 << std::endl << std::endl
7260 <<
"def SELECT_F64 : InstTCE<(outs R64DFPRegs:$dst),"
7261 <<
"(ins R1Regs:$c, R64DFPRegs:$T, R64DFPRegs:$F),"
7262 <<
"\"# SELECT_F64 PSEUDO!\","
7263 <<
"[(set R64DFPRegs:$dst,"
7264 <<
"(select R1Regs:$c, R64DFPRegs:$T, R64DFPRegs:$F))]>;"
7265 << std::endl << std::endl;
7268 os <<
"def SELECT_I1bb : InstTCE<(outs R1Regs:$dst),"
7269 <<
"(ins GuardRegs:$c, R1Regs:$T, R1Regs:$F),"
7270 <<
"\"# SELECT_I1 PSEUDO!\","
7271 <<
" [(set R1Regs:$dst,"
7272 <<
"(select GuardRegs:$c, R1Regs:$T, R1Regs:$F))]>;"
7273 << std::endl << std::endl
7275 <<
"def SELECT_I1bj : InstTCE<(outs R1Regs:$dst),"
7276 <<
" (ins GuardRegs:$c, R1Regs:$T, i1imm:$F),"
7277 <<
"\"# SELECT_I1 PSEUDO!\","
7278 <<
"[(set R1Regs:$dst,"
7279 <<
"(select GuardRegs:$c, R1Regs:$T, (i1 imm:$F)))]>;"
7280 << std::endl << std::endl
7282 <<
"def SELECT_I1jb : InstTCE<(outs R1Regs:$dst),"
7283 <<
"(ins GuardRegs:$c, i1imm:$T, R1Regs:$F),"
7284 <<
"\"# SELECT_I1 PSEUDO!\","
7285 <<
"[(set R1Regs:$dst,"
7286 <<
"(select GuardRegs:$c, (i1 imm:$T), R1Regs:$F))]>;"
7287 << std::endl << std::endl
7289 <<
"def SELECT_I1jj : InstTCE<(outs R1Regs:$dst),"
7290 <<
"(ins GuardRegs:$c, i1imm:$T, i1imm:$F),"
7291 <<
"\"# SELECT_I1 PSEUDO!\","
7292 <<
"[(set R1Regs:$dst,"
7293 <<
"(select GuardRegs:$c, (i1 imm:$T), (i1 imm:$F)))]>;"
7294 << std::endl << std::endl
7296 <<
"def SELECT_I32rr : InstTCE<(outs R32IRegs:$dst),"
7297 <<
"(ins GuardRegs:$c, R32IRegs:$T, R32IRegs:$F),"
7298 <<
"\"# SELECT_I32 PSEUDO!\","
7299 <<
"[(set R32IRegs:$dst,"
7300 <<
"(select GuardRegs:$c, R32IRegs:$T, R32IRegs:$F))]>;"
7301 << std::endl << std::endl
7304 <<
"def SELECT_I32ri : InstTCE<(outs R32IRegs:$dst),"
7305 <<
"(ins R32IRegs:$c, R32IRegs:$T, i32imm:$F),"
7306 <<
"\"# SELECT_I32 PSEUDO!\","
7307 <<
"[(set R32IRegs:$dst,"
7308 <<
"(select R32IRegs:$c, R32IRegs:$T, i32MoveImm:$F))]>;"
7309 << std::endl << std::endl
7311 <<
"def SELECT_I32ir : InstTCE<(outs R32IRegs:$dst),"
7312 <<
"(ins R32IRegs:$c, i32imm:$T, R32IRegs:$F),"
7313 <<
"\"# SELECT_I32 PSEUDO!\","
7314 <<
"[(set R32IRegs:$dst,"
7315 <<
"(select R32IRegs:$c, i32MoveImm:$T, R32IRegs:$F))]>;"
7316 << std::endl << std::endl
7318 <<
"def SELECT_I32ii : InstTCE<(outs R32IRegs:$dst),"
7319 <<
"(ins R32IRegs:$c, i32imm:$T, i32imm:$F),"
7320 <<
"\"# SELECT_I32 PSEUDO!\","
7321 <<
"[(set R32IRegs:$dst,"
7322 <<
"(select R32IRegs:$c, i32MoveImm:$T, i32MoveImm:$F))]>;"
7323 << std::endl << std::endl
7325 <<
"def SELECT_F32 : InstTCE<(outs FPRegs:$dst),"
7326 <<
"(ins GuardRegs:$c, FPRegs:$T, FPRegs:$F),"
7327 <<
"\"# SELECT_F32 PSEUDO!\","
7328 <<
"[(set FPRegs:$dst,"
7329 <<
"(select GuardRegs:$c, FPRegs:$T, FPRegs:$F))]>;"
7330 << std::endl << std::endl
7332 <<
"def SELECT_F16 : InstTCE<(outs HFPRegs:$dst),"
7333 <<
"(ins GuardRegs:$c, HFPRegs:$T, HFPRegs:$F),"
7334 <<
"\"# SELECT_F16 PSEUDO!\","
7335 <<
"[(set HFPRegs:$dst, "
7336 <<
"(select GuardRegs:$c, HFPRegs:$T, HFPRegs:$F))]>;"
7337 << std::endl << std::endl;
7339 os <<
"}" << std::endl << std::endl;
7342 os <<
"def : Pat<(i64 (select R64IRegs:$c, R64IRegs:$T, R64IRegs:$F)),"
7343 <<
"(SELECT_I64rr (MOVI64I1ss R64Regs:$c),"
7344 <<
"R64IRegs:$T, R64IRegs:$F)>;"
7345 << std::endl << std::endl;
7348 os <<
"def : Pat<(i32 (select R32IRegs:$c, R32IRegs:$T, R32IRegs:$F)),"
7349 <<
"(SELECT_I32rr (MOVI32I1rr R32Regs:$c),"
7350 <<
"R32IRegs:$T, R32IRegs:$F)>;"
7351 << std::endl << std::endl;
7355 os <<
"// Has select instr!. " << std::endl;
7357 std::map<TCEString, RegisterClass>::const_iterator it;
7364 os <<
"def SELECT_" << valTypeName <<
" : InstTCE<(outs "
7365 << regClassName <<
":$dst), (ins R1Regs:$c, " << regClassName
7366 <<
":$T, " << regClassName <<
":$F), \"\","
7367 <<
"[(set " << regClassName <<
":$dst,"
7368 <<
"(select R1Regs:$c, " << regClassName <<
":$T, " << regClassName
7369 <<
":$F))]>;" << std::endl
7372 opNames_[
"SELECT_" + valTypeName] =
"CMOV_SELECT";
References getLLVMPatternWithConstants(), hasConditionalMoves_, hasSelect_, TTAMachine::Machine::is64bit(), mach_, TDGenerator::RegisterClass::name(), OperationPool::operation(), opNames_, regs1bit_, sub, TDGenerator::RegisterClass::valueType(), TDGenerator::ValueType::valueTypeStr(), and vRegClasses_.
Referenced by writeInstrInfo().
◆ createShortExtLoadPatterns()
void TDGen::createShortExtLoadPatterns |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 6617 of file TDGen.cc.
6628 TCEString loadOpcReg = load + dstTypeChar + regSrcChar;
6629 TCEString loadOpcImm = load + dstTypeChar + immSrcChar;
6644 os <<
"def : Pat<(i" << destSize
6645 <<
" (zextloadi16 ADDRrr:$addr)), "
6646 <<
"(" << ANDOPC <<
" (" << loadOpcReg
6647 <<
" ADDRrr:$addr), 65535)>;" << std::endl;
6648 os <<
"def : Pat<(i" << destSize
6649 <<
" (zextloadi16 ADDRri:$addr)), "
6650 <<
"(" << ANDOPC <<
" ("
6651 << loadOpcImm <<
" ADDRri:$addr), 65535)>;" << std::endl;
6655 std::cerr <<
"Warning: The architecture is missing any 16-bit loads."
6659 loadOpcReg = uload + dstTypeChar + regSrcChar;
6660 loadOpcImm = uload + dstTypeChar + immSrcChar;
6664 os <<
"def : Pat<(i" << destSize
6665 <<
" (sextloadi16 ADDRrr:$addr)), "
6667 <<
" (" << loadOpcReg <<
" ADDRrr:$addr))>;" << std::endl;
6668 os <<
"def : Pat<(i" << destSize
6669 <<
" (sextloadi16 ADDRri:$addr)), "
6671 <<
" (" << loadOpcImm <<
" ADDRri:$addr))>;" << std::endl;
6675 os <<
"def : Pat<(i" << destSize
6676 <<
" (sextloadi16 ADDRrr:$addr)), "
6677 <<
"(" << SHROPC <<
" (" << SHLOPC <<
" ("
6678 << load <<
"rr ADDRrr:$addr), "
6679 << sb <<
"), " << sb <<
")>;" << std::endl;
6681 os <<
"def : Pat<(i" << destSize
6682 <<
" (sextloadi16 ADDRri:$addr)), "
6683 <<
"(" << SHROPC <<
" (" << SHLOPC <<
" ("
6684 << load <<
"ri ADDRri:$addr), "
6685 << sb <<
"), " << sb <<
")>;" << std::endl;
6689 os <<
"def : Pat<(i32 (sextloadi16 ADDRrr:$addr)), "
6690 <<
"(SHR4_32rr (SHR4_32rr (SHR4_32rr (SHR4_32rr "
6691 <<
"(SHL4_32rr (SHL4_32rr (SHL4_32rr (SHL4_32rr ("
6692 << load <<
"rr ADDRrr:$addr)))))))))>;" << std::endl;
6694 os <<
"def : Pat<(i32 (sextloadi16 ADDRri:$addr)), "
6695 <<
"(SHR4_32rr (SHR4_32rr (SHR4_32rr (SHR4_32rr "
6696 <<
"(SHL4_32rr (SHL4_32rr (SHL4_32rr (SHL4_32rr ("
6697 << load <<
"ri ADDRri:$addr)))))))))>;" << std::endl;
6699 os <<
"def : Pat<(i64 (sextloadi8 ADDRrr:$addr)), "
6700 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6701 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6702 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6703 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6704 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6705 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss ("
6706 << load <<
"rr ADDRrr:$addr)))))))))))))>;"
6709 os <<
"def : Pat<(i64 (sextloadi8 ADDRri:$addr)), "
6710 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6711 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6712 <<
"(SHR4_64ss (SHR4_64ss (SHR4_64ss (SHR4_64ss "
6713 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6714 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss "
6715 <<
"(SHL4_64ss (SHL4_64ss (SHL4_64ss (SHL4_64ss ("
6716 << load <<
"ri ADDRri:$addr)))))))))))))>;"
6720 std::cerr <<
"Warning: no sign-extending 16-bit loads,"
6721 <<
" 16-bit sign extension instruction or suitable"
6722 <<
" shifts for sext-emulation in the processor."
6723 <<
" All code may not compile!" << std::endl;
6728 os <<
"def : Pat<(i" << destSize <<
" (extloadi16 ADDRrr:$src)), ("
6729 << loadOpcReg <<
" ADDRrr:$src)>;" << std::endl
6730 <<
"def : Pat<(i" << destSize <<
" (extloadi16 ADDRri:$src)), ("
6731 << loadOpcImm <<
" ADDRri:$src)>;" << std::endl;
References TTAMachine::Machine::hasOperation(), TTAMachine::Machine::is64bit(), littleEndian_, mach_, OT_IMM_INT, OT_IMM_LONG, OT_REG_INT, and OT_REG_LONG.
Referenced by writeInstrInfo().
◆ createTrivialDAG()
◆ createVectorMinMaxDef()
void TDGen::createVectorMinMaxDef |
( |
const TCEString & |
opName, |
|
|
int |
bits, |
|
|
char |
llvmTypeChar, |
|
|
const TCEString & |
postFix, |
|
|
std::ostream & |
os |
|
) |
| |
|
protected |
◆ createVectorRVDRegNums()
void TDGen::createVectorRVDRegNums |
( |
std::ostream & |
os | ) |
|
|
protectedvirtual |
◆ dagNodeToString()
Converts single OperationDAG node to llvm pattern fragment string.
- Parameters
-
op | Operation that the whole DAG is for. |
dag | Whole operation DAG. |
node | DAG node to return string for. |
immOp | Index of an operand to define as an immediate or 0 if none. |
emulationPattern | True, if the returned string should be in emulation pattern format. |
- Returns
- DAG node as a llvm .td string.
Definition at line 5436 of file TDGen.cc.
5441 if (oNode != NULL) {
5447 op, dag, *oNode, emulationPattern, operandTypes);
5451 if (tNode != NULL) {
5464 "Invalid immediate operand for " + op.
name() +
5469 if (emulationPattern) {
5470 assert(emulatingOp !=
nullptr);
5473 *emulatingOp, operand)]);
5483 int globalOperandIndex =
5485 assert(globalOperandIndex == 1);
5494 std::string dnString =
5496 op, dag, srcNode, emulationPattern, operandTypes,
5497 emulatingOp, successor);
5499 bool needTrunc = (operandTypes[globalOperandIndex-1] ==
5507 if (dnString.substr(0,4) ==
"(set" ||
5508 dnString.substr(0,5) ==
"(zext" ||
5509 dnString.substr(0,5) ==
"(load") {
5515 std::string pattern =
5517 operand, emulationPattern, operandTypes[0])
5518 +
", (trunc " + dnString +
"))";
5521 std::string pattern =
5523 operand, emulationPattern, operandTypes[0])
5524 +
", " + dnString +
")";
5532 if (cNode != NULL) {
References __func__, abortWithError, assert, canBeImmediate(), constantNodeString(), immOperandDefs_, BoostGraph< GraphNode, GraphEdge >::inDegree(), Operand::index(), BoostGraph< GraphNode, GraphEdge >::inEdge(), Operand::isInput(), Operand::isOutput(), ImmInfo::key(), Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::operand(), TerminalNode::operandIndex(), operandToString(), operationNodeToString(), OT_IMM_BOOL, OT_IMM_INT, OT_REG_BOOL, BoostGraph< GraphNode, GraphEdge >::outDegree(), OperationNode::referencedOperation(), BoostGraph< GraphNode, GraphEdge >::tailNode(), and Conversion::toString().
Referenced by operationNodeToString(), operationPattern(), subPattern(), and writeEmulationPattern().
◆ emulatingOpNodeLLVMName()
Returns an llvm name for an operation node in an emulation dag.
- Parameters
-
op | the operation being emulated. |
dag | dag of the emulated operation |
node | node whose name is being asked |
operandTypes | string containing oeprand types for the emulated op. |
Definition at line 5600 of file TDGen.cc.
5614 for (
int e = 0; e < dag.
outDegree(node); e++) {
5624 assert((
int)operandTypes.length() > strIndex &&
5626 if (c != 0 && c != operandTypes[strIndex]) {
5628 "conflicting output types!");
5630 c = operandTypes[strIndex];
5635 if (c != 0 && c!= type) {
5637 "conflicting output types!");
5653 for (
int i = 1; i < inputs + 1; i++) {
5655 for (
int e = 0; e < dag.
inDegree(node); e++) {
5680 if ((
int)operandTypes.length() <= strIndex ||
5682 std::cerr <<
"Invalid operand types length or"
5683 <<
"strIndex in operation:"
5685 <<
" OperandTypes string is: "
5687 <<
" strIndex is: " << strIndex
5691 operationName += operandTypes[strIndex];
5697 return operationName;
References __func__, assert, OperationDAGEdge::dstOperand(), BoostGraph< GraphNode, GraphEdge >::headNode(), BoostGraph< GraphNode, GraphEdge >::inDegree(), BoostGraph< GraphNode, GraphEdge >::inEdge(), TTAMachine::Machine::is64bit(), mach_, Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::operand(), operandChar(), TerminalNode::operandIndex(), OT_IMM_INT, OT_IMM_LONG, BoostGraph< GraphNode, GraphEdge >::outDegree(), BoostGraph< GraphNode, GraphEdge >::outEdge(), Operand::RAW_DATA, OperationNode::referencedOperation(), Operand::SINT_WORD, Operand::SLONG_WORD, OperationDAGEdge::srcOperand(), StringTools::stringToUpper(), BoostGraph< GraphNode, GraphEdge >::tailNode(), Operand::type(), Operand::UINT_WORD, and Operand::ULONG_WORD.
Referenced by operationNodeToString().
◆ gatherAllMachineOperations()
void TDGen::gatherAllMachineOperations |
( |
| ) |
|
|
protected |
◆ generateBackend()
void TDGen::generateBackend |
( |
std::string & |
path | ) |
|
Generates all files required to build a tce backend plugin (excluding static plugin code included from include/llvm/TCE/).
Definition at line 388 of file TDGen.cc.
390 regTD.open((path +
"/GenRegisterInfo.td").c_str());
394 std::ofstream instrTD0;
395 instrTD0.open((path +
"/GenInstrInfo0.td").c_str());
399 std::ofstream operandTD;
400 operandTD.open((path +
"/GenOperandInfo.td").c_str());
404 std::ofstream instrTD;
405 instrTD.open((path +
"/GenInstrInfo.td").c_str());
412 std::ofstream formatTD;
413 formatTD.open((path +
"/GenTCEInstrFormats.td").c_str());
418 ccTD.open((path +
"/GenCallingConv.td").c_str());
422 std::ofstream argArr;
423 argArr.open((path +
"/ArgRegs.hh").c_str());
427 std::ofstream pluginInc;
428 pluginInc.open((path +
"/Backend.inc").c_str());
432 std::ofstream topLevelTD;
433 topLevelTD.open((path +
"/TCE.td").c_str());
References writeAddressingModeDefs(), writeArgRegsArray(), writeBackendCode(), writeCallingConv(), writeInstrFormats(), writeInstrInfo(), writeOperandDefs(), writeRegisterInfo(), and writeTopLevelTD().
Referenced by LLVMBackend::createPlugin().
◆ generateLoadStoreCopyGenerator()
void TDGen::generateLoadStoreCopyGenerator |
( |
std::ostream & |
os | ) |
|
|
protected |
◆ genGeneratedTCEPlugin_getAddOpcode()
void TDGen::genGeneratedTCEPlugin_getAddOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
Definition at line 3229 of file TDGen.cc.
3231 <<
"// Returns correct vector ADD opcode" << endl
3232 <<
"int GeneratedTCEPlugin::getAddOpcode("
3233 <<
"const EVT& vt) const {" << endl;
3236 o <<
"\tif (vt == MVT::" << it->first
3237 <<
") return TCE::" << it->second <<
";" << endl;
3240 o <<
"\treturn -1;" << endl <<
"}" << endl;
References addOperations_.
Referenced by writeBackendCode().
◆ genGeneratedTCEPlugin_getConstantVectorShuffleOpcode()
void TDGen::genGeneratedTCEPlugin_getConstantVectorShuffleOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getExtractElemOpcode()
void TDGen::genGeneratedTCEPlugin_getExtractElemOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getGatherOpcode()
void TDGen::genGeneratedTCEPlugin_getGatherOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
Definition at line 3199 of file TDGen.cc.
3201 <<
"// Returns correct vector GATHER opcode" << endl
3202 <<
"int GeneratedTCEPlugin::getGatherOpcode("
3203 <<
"const EVT& vt) const {" << endl;
3207 o <<
"\tif (vt == MVT::" << it->first
3208 <<
") return TCE::" << it->second <<
";" << endl;
3211 o <<
"\treturn -1;" << endl <<
"}" << endl;
References gatherOperations_.
◆ genGeneratedTCEPlugin_getIorOpcode()
void TDGen::genGeneratedTCEPlugin_getIorOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
Definition at line 3259 of file TDGen.cc.
3261 <<
"// Returns correct vector SHL opcode" << endl
3262 <<
"int GeneratedTCEPlugin::getIorOpcode("
3263 <<
"const EVT& vt) const {" << endl;
3266 o <<
"\tif (vt == MVT::" << it->first
3267 <<
") return TCE::" << it->second <<
";" << endl;
3270 o <<
"\treturn -1;" << endl <<
"}" << endl;
References iorOperations_.
Referenced by writeBackendCode().
◆ genGeneratedTCEPlugin_getLoad()
void TDGen::genGeneratedTCEPlugin_getLoad |
( |
std::ostream & |
o | ) |
const |
|
protected |
Generates implementation of getLoad() function.
Definition at line 2883 of file TDGen.cc.
2906 o <<
"int GeneratedTCEPlugin::getLoad(const TargetRegisterClass *rc)"
2907 <<
" const {" << endl;
2909 o <<
"\tif (rc == " << prefix << rapf <<
") return TCE::"
2910 << loadW <<
"RAr;" << endl;
2918 if ((ri->first.find(
"R1") == 0 ||
2920 ri->first.find(
"R16") != 0 && loadB !=
"") {
2921 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2922 << rcpf <<
") return TCE::" << loadB <<
"Br;" << endl;
2924 if (ri->first.find(
"R32") == 0) {
2925 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2926 << rcpf <<
") return TCE::" << loadW <<
"rr;" << endl;
2928 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2929 <<
"I" << rcpf <<
") return TCE::" << loadW <<
"rr;" << endl;
2931 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2932 <<
"FP" << rcpf <<
") return TCE::" << loadW <<
"fr;" << endl;
2934 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2935 <<
"HFP" << rcpf <<
") return TCE::" << loadH <<
"hr;" << endl;
2939 if (ri->first.find(
"R64") == 0) {
2940 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2941 << rcpf <<
") return TCE::" << loadL <<
"ss;" << endl;
2943 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2944 <<
"I" << rcpf <<
") return TCE::" << loadL <<
"ss;" << endl;
2946 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2947 <<
"DFP" << rcpf <<
") return TCE::" << loadL <<
"ds;" << endl;
2954 o <<
"\tif (rc == &TCE::FPRegsRegClass) return TCE::LD64fs;"
2957 o <<
"\tif (rc == &TCE::HFPRegsRegClass) return TCE::LD64hs;"
2960 o <<
"\tif (rc == &TCE::FPRegsRegClass) return TCE::"
2961 << loadW <<
"fr;" << std::endl;
2963 o <<
"\tif (rc == &TCE::HFPRegsRegClass) return TCE::"
2964 << loadW <<
"hr;" << std::endl;
2967 std::map<TCEString, RegisterClass>::const_iterator it;
2972 std::map<TCEString, InstructionInfo>::const_iterator loadIt =
2976 o <<
"\tif (rc == &TCE::" << regClass.
name() <<
"RegClass) "
2977 <<
"return TCE::" << (loadIt->second).instrName_ <<
";" << endl;
2979 verbose(
"Warning: no load generated for RegisterClass " +
2980 regClass.
name() +
" to GeneratedTCEPlugin::getLoad");
2984 o <<
"\tprintf(\"regclass of size %d \\n\", rc->MC->RegsSize);" << std::endl
2985 <<
"\tassert(0&&\"loading from stack to given regclass not supported."
2986 <<
" Bug in backend?\");"
References guardRegTemplateName, TTAMachine::Machine::hasOperation(), TTAMachine::Machine::is64bit(), littleEndian_, mach_, TDGenerator::RegisterClass::name(), registerLoads_, regsInClasses_, use64bitForFP_, verbose(), and vRegClasses_.
Referenced by generateLoadStoreCopyGenerator().
◆ genGeneratedTCEPlugin_getLoadOpcode()
void TDGen::genGeneratedTCEPlugin_getLoadOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
Definition at line 3215 of file TDGen.cc.
3217 <<
"// Returns correct load opcode" << endl
3218 <<
"int GeneratedTCEPlugin::getLoadOpcode("
3219 <<
"const EVT& vt) const {" << endl;
3222 o <<
"\tif (vt == MVT::" << it->first
3223 <<
") return TCE::" << it->second.instrName_ <<
";" << endl;
3225 o <<
"\treturn -1;" << endl <<
"}" << endl;
References registerLoads_.
Referenced by writeBackendCode().
◆ genGeneratedTCEPlugin_getShlOpcode()
void TDGen::genGeneratedTCEPlugin_getShlOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
Definition at line 3244 of file TDGen.cc.
3246 <<
"// Returns correct vector SHL opcode" << endl
3247 <<
"int GeneratedTCEPlugin::getShlOpcode("
3248 <<
"const EVT& vt) const {" << endl;
3251 o <<
"\tif (vt == MVT::" << it->first
3252 <<
") return TCE::" << it->second <<
";" << endl;
3255 o <<
"\treturn -1;" << endl <<
"}" << endl;
References shlOperations_.
Referenced by writeBackendCode().
◆ genGeneratedTCEPlugin_getStore()
void TDGen::genGeneratedTCEPlugin_getStore |
( |
std::ostream & |
o | ) |
const |
|
protected |
Generates implementation of getStore() function.
Definition at line 2783 of file TDGen.cc.
2792 o <<
"#include <stdio.h>" << endl
2793 <<
"int GeneratedTCEPlugin::getStore(const TargetRegisterClass *rc)"
2794 <<
" const {" << endl;
2796 o <<
"\tif (rc == " << prefix << rapf
2797 <<
") return TCE::STWRArr;"
2803 if ((ri->first.find(
"R1") == 0 ||
2805 ri->first.find(
"R16") != 0) {
2806 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2807 << rcpf <<
") return TCE::" << storeB << endl;
2809 if (ri->first.find(
"R32") == 0) {
2810 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2811 << rcpf <<
") return TCE::" << storeW <<
"rr;" << endl;
2813 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2814 <<
"I" << rcpf <<
") return TCE::" << storeW <<
"rr;" << endl;
2816 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2817 <<
"FP" << rcpf <<
") return TCE::" << storeW <<
"fr;" << endl;
2819 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2820 <<
"HFP" << rcpf <<
") return TCE::" << storeH <<
"hr;" << endl;
2823 if (ri->first.find(
"R64") == 0) {
2824 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2825 << rcpf <<
") return TCE::" << storeL <<
"ss;" << endl;
2827 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2828 <<
"I" << rcpf <<
") return TCE::" << storeL <<
"ss;"
2831 o <<
"\tif (rc == " << prefix <<
"TCE::" << ri->first
2832 <<
"DFP" << rcpf <<
") return TCE::" << storeL <<
"ds;"
2840 o <<
"\tif (rc == &TCE::FPRegsRegClass) return TCE::ST64fs;"
2843 o <<
"\tif (rc == &TCE::HFPRegsRegClass) return TCE::ST64hs;"
2846 o <<
"\tif (rc == &TCE::FPRegsRegClass) return TCE::"
2847 << storeW <<
"fr;" << std::endl;
2849 o <<
"\tif (rc == &TCE::HFPRegsRegClass) return TCE::"
2850 << storeW <<
"hr;" << std::endl;
2853 std::map<TCEString, RegisterClass>::const_iterator it;
2858 std::map<TCEString, InstructionInfo>::const_iterator storeIt =
2862 o <<
"\tif (rc == &TCE::" << regClass.
name() <<
"RegClass) "
2863 <<
"return TCE::" << (storeIt->second).instrName_ <<
";" << endl;
2865 verbose(
"Warning: no store generated for RegisterClass " +
2866 regClass.
name() +
" to GeneratedTCEPlugin::getStore");
2870 o <<
"\tstd::cerr << \"regclass id:\" <<rc->getID() << \"of size \" "
2871 <<
"<<rc->MC->RegsSize<< std::endl;" << std::endl;
2872 o <<
"\tassert(0&&\"Storing given regclass to stack not supported. "
2873 <<
"Bug in backend?\");"
References guardRegTemplateName, TTAMachine::Machine::is64bit(), littleEndian_, mach_, TDGenerator::RegisterClass::name(), registerStores_, regsInClasses_, use64bitForFP_, verbose(), and vRegClasses_.
Referenced by generateLoadStoreCopyGenerator().
◆ genGeneratedTCEPlugin_getVectorAndSameOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorAndSameOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorBroadcastOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorBroadcastOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorImmediateOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorImmediateOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorIorSameOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorIorSameOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorPackOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorPackOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorSelectOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorSelectOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorShlSameOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorShlSameOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorShrSameOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorShrSameOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorShruSameOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorShruSameOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorShuffle1Opcode()
void TDGen::genGeneratedTCEPlugin_getVectorShuffle1Opcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorShuffle2Opcode()
void TDGen::genGeneratedTCEPlugin_getVectorShuffle2Opcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorValueType()
void TDGen::genGeneratedTCEPlugin_getVectorValueType |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_getVectorXorSameOpcode()
void TDGen::genGeneratedTCEPlugin_getVectorXorSameOpcode |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genGeneratedTCEPlugin_isVectorRegisterMove()
void TDGen::genGeneratedTCEPlugin_isVectorRegisterMove |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ genTCEInstrInfo_copyPhys64bitReg()
void TDGen::genTCEInstrInfo_copyPhys64bitReg |
( |
std::ostream & |
o | ) |
const |
|
protected |
Definition at line 8322 of file TDGen.cc.
8324 <<
"#include <llvm/CodeGen/MachineInstrBuilder.h>" << std::endl
8325 <<
"// copies 64-bit reg to a another" << std::endl
8326 <<
"bool TCEInstrInfo::copyPhys64bitReg(" << std::endl
8327 <<
"\tMachineBasicBlock& mbb," << std::endl
8328 <<
"\tMachineBasicBlock::iterator mbbi," << std::endl
8329 <<
"const DebugLoc& dl," << std::endl
8330 <<
"\tunsigned destReg, unsigned srcReg," << std::endl
8331 <<
"\tbool killSrc) const {" << std::endl
8335 o <<
"\tif (TCE::R64RegsRegClass.contains(destReg, srcReg)) {\n"
8336 <<
"\t\tBuildMI(mbb, mbbi, dl, get(TCE::MOV64rr), destReg)\n"
8337 <<
"\t\t\t.addReg(srcReg, getKillRegState(killSrc));" << std::endl
8338 <<
"\t\treturn true;" << std::endl
8339 <<
"}" << std::endl;
8341 o <<
"\treturn false;" << std::endl
References TTAMachine::Machine::is64bit(), and mach_.
◆ genTCEInstrInfoSIMD_copyPhysVectorReg()
void TDGen::genTCEInstrInfoSIMD_copyPhysVectorReg |
( |
std::ostream & |
o | ) |
const |
|
protected |
Generates implementation of copyPhysVectorReg().
Only the previously created vector register classes are added to the implementation to make LLVM compilation flow work.
Definition at line 3131 of file TDGen.cc.
3133 <<
"#include <llvm/CodeGen/MachineInstrBuilder.h>" << endl
3134 <<
"// Copies a vector register to another" << endl
3136 <<
"bool TCEInstrInfo::copyPhysVectorReg(" << endl
3137 <<
"\tMachineBasicBlock& mbb," << endl
3138 <<
"\tMachineBasicBlock::iterator mbbi," << endl
3139 <<
"const DebugLoc& dl," << endl
3140 <<
"\tMCRegister destReg, MCRegister srcReg," << endl
3141 <<
"\tbool killSrc) const {" << endl
3144 std::map<TCEString, RegisterClass>::const_iterator it;
3148 o <<
"\tif (TCE::" << regClass.
name()
3149 <<
"RegClass.contains(destReg, srcReg)) {" << endl
3150 <<
"\t\tBuildMI(mbb, mbbi, dl, get(TCE::"
3151 <<
"MOV" << regClass.
name() <<
"), destReg)" << endl
3152 <<
"\t\t.addReg(srcReg, getKillRegState(killSrc));" << endl
3153 <<
"\t\treturn true;" << endl
3156 o <<
"\treturn false;" << endl <<
"}" << endl;
References TDGenerator::RegisterClass::name(), and vRegClasses_.
Referenced by writeBackendCode().
◆ genTCERegisterInfo_setReservedVectorRegs()
void TDGen::genTCERegisterInfo_setReservedVectorRegs |
( |
std::ostream & |
os | ) |
const |
|
protected |
◆ genTCETargetLoweringSIMD_addVectorRegisterClasses()
void TDGen::genTCETargetLoweringSIMD_addVectorRegisterClasses |
( |
std::ostream & |
o | ) |
const |
|
protected |
Generates a function that adds existing register classes in lowering phase.
Definition at line 2997 of file TDGen.cc.
2999 o << endl <<
"// Adds all vector classes to backend" << endl
3000 <<
"void TCETargetLowering::addVectorRegisterClasses() {" << endl;
3001 std::map<TCEString, RegisterClass>::const_iterator it;
3005 o <<
"\taddRegisterClass("
3007 <<
"&TCE::" << regClass.
name() <<
"RegClass);"
3013 o << endl <<
"// Sets build and extract lowering" << endl
3014 <<
"void TCETargetLowering::addVectorLowerings() {" << endl;
3019 o <<
"\tsetOperationAction(ISD::BUILD_VECTOR,"
3021 <<
"Custom);" << endl;
3023 o <<
"\tsetOperationAction(ISD::EXTRACT_SUBVECTOR,"
3025 <<
"Expand);" << endl;
3027 for (
auto vt : ValueType::SUPPORTED_LLVM_VALUE_TYPES) {
3029 o <<
"\tsetTruncStoreAction(MVT::"
3031 <<
", MVT::" << vt <<
", Expand);" << endl;
References TDGenerator::RegisterClass::name(), TDGenerator::RegisterClass::valueType(), TDGenerator::ValueType::valueTypeStr(), and vRegClasses_.
Referenced by writeBackendCode().
◆ genTCETargetLoweringSIMD_associatedVectorRegClass()
void TDGen::genTCETargetLoweringSIMD_associatedVectorRegClass |
( |
std::ostream & |
o | ) |
const |
|
protected |
Generates a function that returns correct reg class for a value type.
Definition at line 3042 of file TDGen.cc.
3044 o << endl <<
"// Returns vector register class for given value type"
3046 <<
"std::pair<unsigned, const TargetRegisterClass*> "
3047 <<
"TCETargetLowering::associatedVectorRegClass(const EVT& vt) "
3051 std::map<TCEString, RegisterClass>::const_iterator it;
3056 o <<
"\tif (vt == MVT::" << vtStr <<
") "
3057 <<
"return std::make_pair(0U, &TCE::"
3058 << regClass.
name() <<
"RegClass);" << endl;
3061 o <<
"\treturn std::make_pair(0U, (TargetRegisterClass*)0);" << endl
References TDGenerator::RegisterClass::name(), and vRegClasses_.
Referenced by writeBackendCode().
◆ genTCETargetLoweringSIMD_getSetCCResultVT()
void TDGen::genTCETargetLoweringSIMD_getSetCCResultVT |
( |
std::ostream & |
o | ) |
const |
|
protected |
Generates a function that returns correct return value type for comparisons.
In LLVM vector comparison operations result into boolean vectors, which have the same subword count as input vectors.
Definition at line 3072 of file TDGen.cc.
3074 <<
"llvm::EVT TCETargetLowering::getSetCCResultVT(const EVT& vt) "
3083 if (!boolVecVt.isSupportedByLLVM()) {
3087 o <<
"\tif (vt.getVectorElementCount().getKnownMinValue() == "
3089 << boolVecVtStr <<
";" << endl;
3093 o <<
"\treturn llvm::MVT::INVALID_SIMPLE_VALUE_TYPE;" << endl
References TDGenerator::ValueType::isSupportedByLLVM(), MAX_SUBW_COUNT, and Conversion::toString().
Referenced by writeBackendCode().
◆ getLLVMPatternWithConstants()
TCEString TDGen::getLLVMPatternWithConstants |
( |
const Operation & |
op, |
|
|
const std::string & |
operandTypes, |
|
|
const std::string & |
operand0, |
|
|
const std::string & |
operand1 |
|
) |
| const |
|
protected |
Returns LLVM pattern for the expression with constant value(s) supported by target machine.
For example, for pattern (SUBrri (foo ...), 123) the method returns (SUBrrr (foo ...), (MOVI32ri 123)) if the target machine can not supply the constant "123" as an immediate.
The method should be called after all operation definitions have been created (after all calls to writeOperationDef()).
Return empty string if the given pattern can not be handled because:
- Operation is not supported by target machine.
- Parameters
-
op | The operation. |
operandTypes | The preferred operand types. |
operand0 | The pattern for the first operand or constant indicated by operandTypes. |
operand1 | The pattern for the second operand or constant indicated by operandTypes. |
Definition at line 7682 of file TDGen.cc.
7694 auto makePattern = [](
7695 const std::string& opc,
7696 const std::string& opdTypes,
7697 const std::string& operand0,
7698 const std::string& operand1) ->
TCEString {
7699 return std::string(
"(") + opc + opdTypes +
" " + operand0
7700 +
", " + operand1 +
")";
7704 const std::string outputOpdTypes = operandTypes.substr(
7706 const std::string inputOpdTypes = operandTypes.substr(
7708 assert(inputOpdTypes.size() == 2);
7710 if (!
opNames_.count(opc + regOperandsOnly)) {
7715 if (
opNames_.count(opc + operandTypes)) {
7717 return makePattern(opc, operandTypes, operand0, operand1);
7720 std::vector<std::string> supportedOperandTypes;
7721 for (
auto i = 0u; i < inputOpdTypes.size(); i++) {
7722 std::string oneInputChanged = inputOpdTypes;
7724 if (oneInputChanged == inputOpdTypes)
continue;
7725 if (
opNames_.count(opc + outputOpdTypes + oneInputChanged)) {
7726 supportedOperandTypes.push_back(oneInputChanged);
7730 supportedOperandTypes.push_back(regOperandsOnly);
7732 std::vector<const std::string*> inputOpdValues{&operand0, &operand1};
7736 for (
const auto& supportedOpdType : supportedOperandTypes) {
7740 bool isSupported =
true;
7741 for (
auto i = 0u; i < supportedOpdType.size(); i++) {
7742 auto& opdType = supportedOpdType.at(i);
7751 bool isOperandReference =
7752 inputOpdValues.at(i)->find(
":$") != std::string::npos;
7753 if (isOperandReference) {
7760 *inputOpdValues.at(i));
7767 op, osalOpdIdx, 32);
7771 op, osalOpdIdx, 16);
7779 isSupported =
false;
7784 if (!isSupported)
continue;
7786 std::string result = std::string(
"(") + opc + outputOpdTypes
7787 + supportedOpdType +
" ";
7788 if (supportedOpdType.at(0) == inputOpdTypes.at(0)) {
7789 result += *inputOpdValues.at(0);
7792 inputOpdTypes.at(0), *inputOpdValues.at(0));
7794 for (
auto i = 1u; i < supportedOpdType.size(); i++) {
7796 if (supportedOpdType.at(i) == inputOpdTypes.at(i)) {
7797 result += *inputOpdValues.at(i);
7800 inputOpdTypes.at(i), *inputOpdValues.at(i));
References assert, ImmInfo::canTakeImmediate(), ImmInfo::canTakeImmediateByWidth(), getMovePattern(), immInfo_, Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), operandTypesToRegisters(), operandTypeToRegister(), opNames_, OT_IMM_BOOL, OT_IMM_FP, OT_IMM_HFP, OT_IMM_INT, StringTools::stringToUpper(), and Conversion::toInt().
Referenced by createSelectPatterns().
◆ getMatchableOperationDAG()
◆ getMovePattern()
TCEString TDGen::getMovePattern |
( |
const char & |
opdType, |
|
|
const std::string & |
inputPattern |
|
) |
| const |
|
protected |
◆ hasRawOperands()
bool TDGen::hasRawOperands |
( |
const Operation & |
op | ) |
const |
|
protected |
◆ hasRegisterClassSupport() [1/2]
bool TDGen::hasRegisterClassSupport |
( |
const Operation & |
op | ) |
const |
|
protected |
◆ hasRegisterClassSupport() [2/2]
◆ immediateOperandNameForEmulatedOperation()
std::string TDGen::immediateOperandNameForEmulatedOperation |
( |
const OperationDAG & |
dag, |
|
|
const Operand & |
operand |
|
) |
| |
|
protected |
◆ immediatePredicate()
std::string TDGen::immediatePredicate |
( |
int64_t |
lowerBoundInclusive, |
|
|
uint64_t |
upperBoundInclusive |
|
) |
| |
|
protected |
◆ isVectorBitwiseOperation()
bool TDGen::isVectorBitwiseOperation |
( |
const Operation & |
op | ) |
const |
|
protected |
Checks if the given operation is a bitwise operation.
- Parameters
-
- Returns
- True, if operation is a bitwise operation.
Definition at line 1939 of file TDGen.cc.
References abortWithError.
Referenced by writeInstrInfo().
◆ isVectorLoadOperation()
bool TDGen::isVectorLoadOperation |
( |
const Operation & |
op | ) |
const |
|
protected |
Checks if the given operation is a vector load memory operation.
- Parameters
-
- Returns
- True, if operation is a vector load memory operation.
Definition at line 1909 of file TDGen.cc.
References abortWithError.
Referenced by writeInstrInfo().
◆ isVectorStoreOperation()
bool TDGen::isVectorStoreOperation |
( |
const Operation & |
op | ) |
const |
|
protected |
Checks if the given operation is a vector store memory operation.
- Parameters
-
- Returns
- True, if operation is a vector store memory operation.
Definition at line 1921 of file TDGen.cc.
References abortWithError.
Referenced by writeInstrInfo().
◆ isWrongEndianessVectorOp()
bool TDGen::isWrongEndianessVectorOp |
( |
const Operation & |
op | ) |
const |
|
protected |
◆ llvmOperationName()
Returns llvm operation name for the given OSAL operation name, if any.
Definition at line 5068 of file TDGen.cc.
5072 if (opName ==
"add")
return "add";
5073 if (opName ==
"sub")
return "sub";
5074 if (opName ==
"mul")
return "mul";
5075 if (opName ==
"div")
return "sdiv";
5076 if (opName ==
"divu")
return "udiv";
5077 if (opName ==
"mod")
return "srem";
5078 if (opName ==
"modu")
return "urem";
5080 if (opName ==
"add64")
return "add";
5081 if (opName ==
"sub64")
return "sub";
5082 if (opName ==
"mul64")
return "mul";
5083 if (opName ==
"div64")
return "sdiv";
5084 if (opName ==
"divu64")
return "udiv";
5085 if (opName ==
"mod64")
return "srem";
5086 if (opName ==
"modu64")
return "urem";
5088 if (opName ==
"shl")
return "shl";
5089 if (opName ==
"shr")
return "sra";
5090 if (opName ==
"shru")
return "srl";
5091 if (opName ==
"rotl")
return "rotl";
5092 if (opName ==
"rotr")
return "rotr";
5094 if (opName ==
"shl64")
return "shl";
5095 if (opName ==
"shr64")
return "sra";
5096 if (opName ==
"shru64")
return "srl";
5097 if (opName ==
"rotl64")
return "rotl";
5098 if (opName ==
"rotr64")
return "rotr";
5100 if (opName ==
"and")
return "and";
5101 if (opName ==
"ior")
return "or";
5102 if (opName ==
"xor")
return "xor";
5104 if (opName ==
"and64")
return "and";
5105 if (opName ==
"ior64")
return "or";
5106 if (opName ==
"xor64")
return "xor";
5108 if (opName ==
"eq")
return "seteq";
5109 if (opName ==
"eq64")
return "seteq";
5110 if (opName ==
"ne")
return "setne";
5111 if (opName ==
"ne64")
return "setne";
5112 if (opName ==
"lt")
return "setlt";
5113 if (opName ==
"lt64")
return "setlt";
5114 if (opName ==
"le")
return "setle";
5115 if (opName ==
"le64")
return "setle";
5116 if (opName ==
"gt")
return "setgt";
5117 if (opName ==
"gt64")
return "setgt";
5118 if (opName ==
"ge")
return "setge";
5119 if (opName ==
"ltu")
return "setult";
5120 if (opName ==
"ltu64")
return "setult";
5121 if (opName ==
"leu")
return "setule";
5122 if (opName ==
"leu64")
return "setule";
5123 if (opName ==
"gtu")
return "setugt";
5124 if (opName ==
"gtu64")
return "setugt";
5125 if (opName ==
"geu")
return "setuge";
5126 if (opName ==
"geu64")
return "setuge";
5128 if (opName ==
"eqf" || opName ==
"eqd")
return "setoeq";
5129 if (opName ==
"nef" || opName ==
"ned")
return "setone";
5130 if (opName ==
"ltf" || opName ==
"ltd")
return "setolt";
5131 if (opName ==
"lef" || opName ==
"led")
return "setole";
5132 if (opName ==
"gtf" || opName ==
"gtd")
return "setogt";
5133 if (opName ==
"gef" || opName ==
"ged")
return "setoge";
5135 if (opName ==
"equf" || opName ==
"equd")
return "setueq";
5136 if (opName ==
"neuf" || opName ==
"neud")
return "setune";
5137 if (opName ==
"ltuf" || opName ==
"ltud")
return "setult";
5138 if (opName ==
"leuf" || opName ==
"leud")
return "setule";
5139 if (opName ==
"gtuf" || opName ==
"gtud")
return "setugt";
5140 if (opName ==
"geuf" || opName ==
"geud")
return "setuge";
5142 if (opName ==
"ordf" || opName ==
"ordd")
return "seto";
5143 if (opName ==
"uordf" || opName ==
"uordd")
return "setuo";
5145 if (opName ==
"addf")
return "fadd";
5146 if (opName ==
"subf")
return "fsub";
5147 if (opName ==
"mulf")
return "fmul";
5148 if (opName ==
"divf")
return "fdiv";
5149 if (opName ==
"absf")
return "fabs";
5150 if (opName ==
"negf")
return "fneg";
5151 if (opName ==
"sqrtf")
return "fsqrt";
5153 if (opName ==
"cif")
return "sint_to_fp";
5154 if (opName ==
"cfi")
return "fp_to_sint";
5155 if (opName ==
"cifu")
return "uint_to_fp";
5156 if (opName ==
"cfiu")
return "fp_to_uint";
5158 if (opName ==
"cfh")
return "fpround";
5159 if (opName ==
"chf")
return "fpextend";
5162 if (opName ==
"ld8")
return "sextloadi8";
5163 if (opName ==
"ldu8")
return "zextloadi8";
5164 if (opName ==
"ld16")
return "sextloadi16";
5165 if (opName ==
"ldu16")
return "zextloadi16";
5167 if (opName ==
"ld32")
return "sextloadi32";
5168 if (opName ==
"ldu32")
return "zextloadi32";
5170 if (opName ==
"ld32" || opName ==
"ldu32")
return "load";
5172 if (opName ==
"ld64")
return "load";
5176 if (opName ==
"st8")
return "truncstorei8";
5177 if (opName ==
"st16")
return "truncstorei16";
5178 if (opName ==
"st32") {
5180 return "truncstorei32";
5186 if (opName ==
"st32")
return "store";
5187 if (opName ==
"st64")
return "store";
5190 if (opName ==
"ldq")
return "sextloadi8";
5191 if (opName ==
"ldqu")
return "zextloadi8";
5192 if (opName ==
"ldh")
return "sextloadi16";
5193 if (opName ==
"ldhu")
return "zextloadi16";
5194 if (opName ==
"ldw")
return "load";
5197 if (opName ==
"stq")
return "truncstorei8";
5198 if (opName ==
"sth")
return "truncstorei16";
5199 if (opName ==
"stw")
return "store";
5203 if (opName.length() >2 && opName.substr(0,2) ==
"sx") {
5204 return "sext_inreg";
5207 if (opName ==
"truncwh" || opName ==
"truncwb" || opName ==
"trunchb")
5210 if (opName ==
"neg")
return "ineg";
5211 if (opName ==
"not")
return "not";
5212 if (opName ==
"cas")
return "atomic_cmp_swap_32";
5214 if (opName ==
"select")
return "select";
References TTAMachine::Machine::is64bit(), littleEndian_, mach_, and StringTools::stringToLower().
Referenced by writePortGuardedJumpDefPair().
◆ llvmOperationPattern()
TCEString TDGen::llvmOperationPattern |
( |
const Operation & |
op, |
|
|
char |
operandType = ' ' |
|
) |
| const |
|
protectedvirtual |
Returns LLVM operation pattern for given OSAL operation.
- Parameters
-
op | Operation for which the LLVM pattern should be returned. |
- Returns
- Operation pattern in llvm.
Definition at line 4854 of file TDGen.cc.
4857 if (opName ==
"add")
return "add %1%, %2%";
4858 if (opName ==
"add64")
return "add %1%, %2%";
4859 if (opName ==
"sub")
return "sub %1%, %2%";
4860 if (opName ==
"sub64")
return "sub %1%, %2%";
4861 if (opName ==
"mul")
return "mul %1%, %2%";
4862 if (opName ==
"mul64")
return "mul %1%, %2%";
4863 if (opName ==
"div")
return "sdiv %1%, %2%";
4864 if (opName ==
"divu")
return "udiv %1%, %2%";
4865 if (opName ==
"div64")
return "sdiv %1%, %2%";
4866 if (opName ==
"divu64")
return "udiv %1%, %2%";
4867 if (opName ==
"mod")
return "srem %1%, %2%";
4868 if (opName ==
"modu")
return "urem %1%, %2%";
4869 if (opName ==
"mod64")
return "srem %1%, %2%";
4870 if (opName ==
"modu64")
return "urem %1%, %2%";
4872 if (opName ==
"shl")
return "shl %1%, %2%";
4873 if (opName ==
"shr")
return "sra %1%, %2%";
4874 if (opName ==
"shru")
return "srl %1%, %2%";
4875 if (opName ==
"rotl")
return "rotl %1%, %2%";
4876 if (opName ==
"rotr")
return "rotr %1%, %2%";
4879 if (opName ==
"shl64")
return "shl %1%, %2%";
4880 if (opName ==
"shr64")
return "sra %1%, %2%";
4881 if (opName ==
"shru64")
return "srl %1%, %2%";
4882 if (opName ==
"rotl64")
return "rotl %1%, %2%";
4883 if (opName ==
"rotr64")
return "rotr %1%, %2%";
4885 if (opName ==
"and")
return "and %1%, %2%";
4886 if (opName ==
"ior")
return "or %1%, %2%";
4887 if (opName ==
"xor")
return "xor %1%, %2%";
4889 if (opName ==
"and64")
return "and %1%, %2%";
4890 if (opName ==
"ior64")
return "or %1%, %2%";
4891 if (opName ==
"xor64")
return "xor %1%, %2%";
4893 if (opName ==
"eq")
return "seteq %1%, %2%";
4894 if (opName ==
"eq64")
return "seteq %1%, %2%";
4895 if (opName ==
"ne")
return "setne %1%, %2%";
4896 if (opName ==
"ne64")
return "setne %1%, %2%";
4897 if (opName ==
"lt")
return "setlt %1%, %2%";
4898 if (opName ==
"lt64")
return "setlt %1%, %2%";
4899 if (opName ==
"le")
return "setle %1%, %2%";
4900 if (opName ==
"le64")
return "setle %1%, %2%";
4901 if (opName ==
"gt")
return "setgt %1%, %2%";
4902 if (opName ==
"gt64")
return "setgt %1%, %2%";
4903 if (opName ==
"ge")
return "setge %1%, %2%";
4904 if (opName ==
"ge64")
return "setge %1%, %2%";
4905 if (opName ==
"ltu")
return "setult %1%, %2%";
4906 if (opName ==
"ltu64")
return "setult %1%, %2%";
4907 if (opName ==
"leu")
return "setule %1%, %2%";
4908 if (opName ==
"leu64")
return "setule %1%, %2%";
4909 if (opName ==
"gtu")
return "setugt %1%, %2%";
4910 if (opName ==
"gtu64")
return "setugt %1%, %2%";
4911 if (opName ==
"geu")
return "setuge %1%, %2%";
4912 if (opName ==
"geu64")
return "setuge %1%, %2%";
4914 if (opName ==
"eqf" || opName ==
"eqd")
return "setoeq %1%, %2%";
4915 if (opName ==
"nef" || opName ==
"ned")
return "setone %1%, %2%";
4916 if (opName ==
"ltf" || opName ==
"ltd")
return "setolt %1%, %2%";
4917 if (opName ==
"lef" || opName ==
"led")
return "setole %1%, %2%";
4918 if (opName ==
"gtf" || opName ==
"gtd")
return "setogt %1%, %2%";
4919 if (opName ==
"gef" || opName ==
"ged")
return "setoge %1%, %2%";
4921 if (opName ==
"equf" || opName ==
"equd")
return "setueq %1%, %2%";
4922 if (opName ==
"neuf" || opName ==
"neud")
return "setune %1%, %2%";
4923 if (opName ==
"ltuf" || opName ==
"ltud")
return "setult %1%, %2%";
4924 if (opName ==
"leuf" || opName ==
"leud")
return "setule %1%, %2%";
4925 if (opName ==
"gtuf" || opName ==
"gtud")
return "setugt %1%, %2%";
4926 if (opName ==
"geuf" || opName ==
"geud")
return "setuge %1%, %2%";
4928 if (opName ==
"ordf" || opName ==
"ordd")
return "seto %1%, %2%";
4929 if (opName ==
"uordf"|| opName ==
"uordd")
return "setuo %1%, %2%";
4931 if (opName ==
"addf" || opName ==
"addd")
return "fadd %1%, %2%";
4932 if (opName ==
"subf" || opName ==
"subd")
return "fsub %1%, %2%";
4933 if (opName ==
"mulf" || opName ==
"muld")
return "fmul %1%, %2%";
4934 if (opName ==
"divf" || opName ==
"divd")
return "fdiv %1%, %2%";
4935 if (opName ==
"absf" || opName ==
"absd")
return "fabs %1%";
4936 if (opName ==
"negf" || opName ==
"negd")
return "fneg %1%";
4937 if (opName ==
"sqrtf"|| opName ==
"sqrtd")
return "fsqrt %1%";
4939 if (opName ==
"cif")
return "sint_to_fp %1%";
4940 if (opName ==
"cfi")
return "fp_to_sint %1%";
4941 if (opName ==
"cifu")
return "uint_to_fp %1%";
4942 if (opName ==
"cfiu")
return "fp_to_uint %1%";
4944 if (opName ==
"cld")
return "sint_to_fp %1%";
4945 if (opName ==
"cdl")
return "fp_to_sint %1%";
4946 if (opName ==
"cldu")
return "uint_to_fp %1%";
4947 if (opName ==
"cdlu")
return "fp_to_uint %1%";
4949 if (opName ==
"cfh" || opName ==
"cdf")
return "fpround %1%";
4950 if (opName ==
"chf")
return "f32 (fpextend %1%)";
4951 if (opName ==
"cfd")
return "f64 (fpextend %1%)";
4953 if (opName ==
"cih")
return "sint_to_fp %1%";
4954 if (opName ==
"chi")
return "i32 (fp_to_sint %1%)";
4955 if (opName ==
"cihu")
return "uint_to_fp %1%";
4956 if (opName ==
"chiu")
return "i32 (fp_to_uint %1%)";
4958 if (opName ==
"neuh")
return "setune %1%, %2%";
4959 if (opName ==
"eqh")
return "setoeq %1%, %2%";
4960 if (opName ==
"neh")
return "setone %1%, %2%";
4961 if (opName ==
"lth")
return "setolt %1%, %2%";
4962 if (opName ==
"leh")
return "setole %1%, %2%";
4963 if (opName ==
"gth")
return "setogt %1%, %2%";
4964 if (opName ==
"geh")
return "setoge %1%, %2%";
4966 if (opName ==
"ordh")
return "seto %1%, %2%";
4967 if (opName ==
"uordh")
return "setuo %1%, %2%";
4969 if (opName ==
"addh")
return "fadd %1%, %2%";
4970 if (opName ==
"subh")
return "fsub %1%, %2%";
4971 if (opName ==
"mulh")
return "fmul %1%, %2%";
4972 if (opName ==
"divh")
return "fdiv %1%, %2%";
4973 if (opName ==
"absh")
return "fabs %1%";
4974 if (opName ==
"negh")
return "fneg %1%";
4975 if (opName ==
"sqrth")
return "fsqrt %1%";
4977 if (opName ==
"cih")
return "sint_to_fp %1%";
4978 if (opName ==
"chi")
return "fp_to_sint %1%";
4979 if (opName ==
"cihu")
return "uint_to_fp %1%";
4980 if (opName ==
"chiu")
return "fp_to_uint %1%";
4982 if (opName ==
"csh")
return "sint_to_fp %1%";
4983 if (opName ==
"cshu")
return "uint_to_fp %1%";
4984 if (opName ==
"chs")
return "fp_to_sint %1%";
4985 if (opName ==
"chsu")
return "fp_to_uint %1%";
4988 if (opName ==
"ld8")
return "sextloadi8 %1%";
4989 if (opName ==
"ldu8")
return "zextloadi8 %1%";
4990 if (opName ==
"ld16")
return "sextloadi16 %1%";
4991 if (opName ==
"ldu16")
return "zextloadi16 %1%";
4993 if (opName ==
"ld32")
return "sextloadi32 %1%";
4994 if (opName ==
"ldu32")
return "zextloadi32 %1%";
4996 if (opName ==
"ld32" || opName ==
"ldu32")
return "load %1%";
4998 if (opName ==
"ld64")
return "load %1%";
5001 if (opName ==
"st8")
return "truncstorei8 %2%, %1%";
5002 if (opName ==
"st16")
return "truncstorei16 %2%, %1%";
5004 if (opName ==
"st32")
return "truncstorei32 %2%, %1%";
5006 if (opName ==
"st32")
return "store %2%, %1%";
5008 if (opName ==
"st64")
return "store %2%, %1%";
5010 if (opName ==
"ldq")
return "sextloadi8 %1%";
5011 if (opName ==
"ldqu")
return "zextloadi8 %1%";
5012 if (opName ==
"ldh")
return "sextloadi16 %1%";
5013 if (opName ==
"ldhu")
return "zextloadi16 %1%";
5014 if (opName ==
"ldw")
return "load %1%";
5017 if (opName ==
"stq")
return "truncstorei8 %2%, %1%";
5018 if (opName ==
"sth")
return "truncstorei16 %2%, %1%";
5019 if (opName ==
"stw")
return "store %2%, %1%";
5023 if (opName ==
"sxw64") {
5024 return "sext_inreg %1%, i32";
5027 if (opName ==
"sxb64") {
5028 return "sext_inreg %1%, i1";
5031 if (opName ==
"sxq64") {
5032 return "sext_inreg %1%, i8";
5034 if (opName ==
"sxh64") {
5035 return "sext_inreg %1%, i16";
5038 if (opName ==
"sxhw") {
5039 return "sext_inreg %1%, i16";
5041 if (opName ==
"sxqw") {
5042 return "sext_inreg %1%, i8";
5045 if (opName ==
"sxw")
5046 return mach_.
is64bit() ?
"sext_inreg %1%, i64":
"sext_inreg %1%, i32";
5048 if (opName ==
"sxbw")
return "sext_inreg %1%, i1";
5050 if (opName ==
"truncwh" || opName ==
"truncwb" || opName ==
"trunchb")
5053 if (opName ==
"neg")
return "ineg %1%";
5054 if (opName ==
"not")
return "not %1%";
5056 if (opName ==
"cas")
return "atomic_cmp_swap_32 %1%, %2%, %3%";
5057 if (opName ==
"select")
return "select %3%, %1%, %2%";
References TTAMachine::Machine::is64bit(), littleEndian_, mach_, Operation::name(), and StringTools::stringToLower().
Referenced by operationCanBeMatched(), operationNodeToString(), writeEmulationPattern(), and writeOperationDef().
◆ operandChar()
char TDGen::operandChar |
( |
Operand & |
operand | ) |
|
|
protectedvirtual |
Returns corresponding character for given operand type.
- Parameters
-
- Returns
- Corresponding character of operand type.
Definition at line 4714 of file TDGen.cc.
References Operand::BOOL, Operand::elementWidth(), Operand::FLOAT_WORD, Operand::HALF_FLOAT_WORD, TTAMachine::Machine::is64bit(), Operand::isVector(), mach_, OT_REG_BOOL, OT_REG_FP, OT_REG_HFP, OT_REG_INT, OT_REG_LONG, OT_VREG_BOOL, OT_VREG_FP, OT_VREG_HFP, OT_VREG_INT16, OT_VREG_INT32, OT_VREG_INT8, Operand::RAW_DATA, Operand::SINT_WORD, Operand::SLONG_WORD, Operand::type(), Operand::UINT_WORD, and Operand::ULONG_WORD.
Referenced by createDefaultOperandTypeString(), emulatingOpNodeLLVMName(), operationCanBeMatched(), writeEmulationPattern(), and writeOperationDef().
◆ operandToString()
std::string TDGen::operandToString |
( |
const Operand & |
operand, |
|
|
bool |
match, |
|
|
char |
operandType, |
|
|
const std::string & |
immDefName = "" |
|
) |
| |
|
protectedvirtual |
Returns LLVM .td format string for an operand.
- Parameters
-
operand | Operand to return string for. |
match | True, if the string should be in the matching pattern format. |
operandType | Character that identifies the type of the operand. |
- Returns
- Operand string to be used in a llvm .td pattern.
- Todo:
- Vector of pointers once supported. Change operand types for GATHER and SCATTER to be mem-data and mem-address, because that will direct the address operand into this if-clause.
Definition at line 5796 of file TDGen.cc.
5801 int idx = operand.
index();
5804 switch (operandType) {
5823 switch (operandType) {
5840 "invalid operation type for mem operand:";
5850 switch (operandType) {
5858 assert(!immDefName.empty() &&
5859 "No immediate operand defined for the operand.");
5887 "invalid operation type for integer operand:";
5893 switch (operandType) {
5907 "invalid operation type for float operand:";
5913 switch (operandType) {
5927 "invalid operation type for half operand:";
5949 "(i64 imm:$op" +
Conversion::toString(idx) +
")";
5955 std::cerr <<
"Unknown operand type: " << operandType << std::endl;
5956 assert(
false &&
"Unknown operand type.");
5958 abortWithError(
"Unknown operand type on osal? Should not get here.");
References __func__, abortWithError, assert, associatedVectorRegisterClass(), Operand::BOOL, Operand::DOUBLE_WORD, Operand::FLOAT_WORD, Operand::HALF_FLOAT_WORD, Operand::index(), TTAMachine::Machine::is64bit(), Operand::isAddress(), Operand::isVector(), mach_, OT_IMM_BOOL, OT_IMM_FP, OT_IMM_HFP, OT_IMM_INT, OT_IMM_LONG, OT_REG_BOOL, OT_REG_FP, OT_REG_HFP, OT_REG_INT, OT_REG_LONG, OT_VREG_BOOL, OT_VREG_FP, OT_VREG_HFP, OT_VREG_INT16, OT_VREG_INT32, OT_VREG_INT8, Operand::RAW_DATA, Operand::SINT_WORD, Operand::SLONG_WORD, Conversion::toString(), Operand::type(), Operand::UINT_WORD, and Operand::ULONG_WORD.
Referenced by dagNodeToString(), patInputs(), patOutputs(), and writeEmulationPattern().
◆ operandTypesToRegisters()
std::string TDGen::operandTypesToRegisters |
( |
const std::string & |
opdTypes | ) |
const |
|
protected |
◆ operandTypeToRegister()
char TDGen::operandTypeToRegister |
( |
const char & |
opdType | ) |
const |
|
protected |
◆ operationCanBeMatched()
bool TDGen::operationCanBeMatched |
( |
const Operation & |
op, |
|
|
std::set< std::string > * |
recursionCycleCheck = NULL , |
|
|
bool |
recursionHasStore = false |
|
) |
| |
|
protected |
Check if operation can be matched with llvm pattern.
Check if operation has llvmOperationPatters or one of it's DAGs contain only operations, which can be matched.
Definition at line 5240 of file TDGen.cc.
5255 std::set<std::string> useSet;
5256 if (recursionCycleCheck != NULL) {
5257 useSet = *recursionCycleCheck;
5259 useSet.insert(op.
name());
5262 for (
int i = 0; i < op.
dagCount(); i++) {
References Operation::dag(), Operation::dagCount(), TTAMachine::Machine::is64bit(), llvmOperationPattern(), mach_, Operation::name(), Operation::numberOfInputs(), operandChar(), operationDAGCanBeMatched(), OT_REG_INT, and OT_REG_LONG.
Referenced by operationDAGCanBeMatched(), and writeInstrInfo().
◆ operationDAGCanBeMatched()
bool TDGen::operationDAGCanBeMatched |
( |
const OperationDAG & |
op, |
|
|
std::set< std::string > * |
recursionCycleCheck = NULL , |
|
|
bool |
recursionHasStore = false |
|
) |
| |
|
protected |
◆ operationNodeToString()
std::string TDGen::operationNodeToString |
( |
const Operation & |
op, |
|
|
const OperationDAG & |
dag, |
|
|
const OperationNode & |
node, |
|
|
bool |
emulationPattern, |
|
|
const std::string & |
operandTypes |
|
) |
| |
|
protected |
Converts OSAL dag operation node to llvm .td pattern fragment string.
- Parameters
-
op | Operation which this operation node is part of. |
dag | Parent DAG of the operation node. |
node | Node to convert to string. |
immOp | Index of an operand to define as immediate or 0 if none. |
emulationPattern | True, if the string should be in emulation pattern format. |
Definition at line 5711 of file TDGen.cc.
5716 std::string operationPat;
5718 if (emulationPattern) {
5720 op, dag, node, operandTypes);
5724 operationPat +=
", ";
5726 operationPat +=
" ";
5736 if (operationPat ==
"") {
5746 if (operationPat ==
"") {
5747 std::string msg(
"Unknown operation node in dag: " +
5748 std::string(operation.
name()));
5753 boost::format pattern(operationPat);
5761 assert(outputs == 0 || outputs == 1);
5763 for (
int i = 1; i < inputs + 1; i++) {
5764 for (
int e = 0; e < dag.
inDegree(node); e++) {
5770 op, dag, in, emulationPattern, operandTypes,
5773 pattern % dagNodeString;
5775 TCEString msg =
"Boost format threw exception! ";
5776 msg <<
"Input format: " << operationPat;
5783 return std::string(
"(") + pattern.str() +
")";
References __func__, assert, dagNodeToString(), OperationDAGEdge::dstOperand(), emulatingOpNodeLLVMName(), getMatchableOperationDAG(), BoostGraph< GraphNode, GraphEdge >::inDegree(), BoostGraph< GraphNode, GraphEdge >::inEdge(), llvmOperationPattern(), Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), OperationNode::referencedOperation(), subPattern(), BoostGraph< GraphNode, GraphEdge >::tailNode(), tceOperationPattern(), and Conversion::toString().
Referenced by dagNodeToString().
◆ operationPattern()
std::string TDGen::operationPattern |
( |
const Operation & |
op, |
|
|
const OperationDAG & |
dag, |
|
|
const std::string & |
operandTypes |
|
) |
| |
|
protected |
◆ orderEqualWidthRegistersToRoundRobin()
void TDGen::orderEqualWidthRegistersToRoundRobin |
( |
| ) |
|
|
protected |
Sets registers to use round robin order in register allocation.
Starting from register index number 0, all same width registers having the same index number are pushed to a vector. Then, index is increased by one and same action is performed, index increased etc., until all registers of same width are pushed to the vector. Then, the vector is used to replace old register order.
For example, two register files R64_1 (register indices 0, 1, 2 and 3) and R64_2 (register indices 0, 1) are ordered as: R64_1(0), R64_2(0), R64_1(1), R64_2(1), R64_1(2), R64_1(3), and LLVM register allocator will use this order to allocate the registers.
Definition at line 1618 of file TDGen.cc.
1619 std::vector<RegisterInfo> roundRobinOrder;
1622 std::map<int, std::vector<RegisterInfo>>::iterator it;
1624 roundRobinOrder.clear();
1625 std::vector<RegisterInfo>& registers = it->second;
1631 while (roundRobinOrder.size() != registers.size()) {
1634 roundRobinOrder.push_back(info);
1637 if (i == registers.size() - 1) {
1645 registers = roundRobinOrder;
References TDGenerator::RegisterInfo::regIndex_, and registers_.
Referenced by analyzeMachineRegisters().
◆ patInputs()
std::string TDGen::patInputs |
( |
const Operation & |
op, |
|
|
const std::string & |
inputTypes |
|
) |
| |
|
protected |
◆ patOutputs()
std::string TDGen::patOutputs |
( |
const Operation & |
op, |
|
|
const std::string & |
operandTypes |
|
) |
| |
|
protected |
◆ saveAdditionalVectorOperationInfo()
void TDGen::saveAdditionalVectorOperationInfo |
( |
const Operation & |
op, |
|
|
const TCEString & |
valueTypes, |
|
|
bool |
isRegisterOp |
|
) |
| |
|
protected |
Saves information of some operations.
Additional information of some operations is needed later, and thus, they need to be saved for later reference.
- Parameters
-
op | Vector operation. |
valueTypes | Operand value type identifier characters. |
isRegisterOp | If false, operation has immediate operands. |
Definition at line 2190 of file TDGen.cc.
References abortWithError.
Referenced by writeVectorOperationDef().
◆ subPattern()
◆ subwordWidthOfRawData()
int TDGen::subwordWidthOfRawData |
( |
const Operation & |
op | ) |
const |
|
protected |
Returns subword width of vector operands of "raw" type.
- Note
- This function chooses the subword width based on subword width of the WIDEST "raw" data operand that can be found from the operation, since that approach works for current SIMD operation definitions. If this approach doesn't work for your operation, modify the function properly to fulfil your needs.
- Parameters
-
- Returns
- Subword width of the raw vector operands.
Definition at line 1722 of file TDGen.cc.
1723 int widestWidth = -1;
1724 int widestRawOperandIndex = -1;
1728 if (operand.
width() > widestWidth) {
1729 widestWidth = operand.
width();
1730 widestRawOperandIndex = i;
1735 if (widestRawOperandIndex >= 0) {
1739 assert(
false &&
"Invalid input operation.");
References assert, Operand::elementWidth(), Operand::isVector(), Operation::operand(), Operation::operandCount(), Operand::RAW_DATA, Operand::type(), and Operand::width().
◆ supportedStackAccessOperations()
std::vector< std::string > TDGen::supportedStackAccessOperations |
( |
const TTAMachine::Machine & |
mach | ) |
|
|
staticprotected |
Returns OSAL operation names valid for stack accesses.
- Parameters
-
Definition at line 7611 of file TDGen.cc.
7615 std::vector<std::string> opcodes;
7617 auto collectMemoryOps = [](
7618 std::vector<std::string>& newOpcodes,
7621 for (
int i = 0; i < fu.operationCount(); i++) {
7630 std::map<const AddressSpace*, std::set<const FunctionUnit*>>
7633 if (fu->hasAddressSpace()) {
7634 addrSpaceLsuMap[fu->addressSpace()].insert(fu);
7638 const int stackAddressSpaceId = 0;
7639 if (addrSpaceLsuMap.size() == 1) {
7641 for (
auto lsu : addrSpaceLsuMap.begin()->second) {
7642 collectMemoryOps(opcodes, *lsu);
7647 for (
auto asLsusPair : addrSpaceLsuMap) {
7648 if (asLsusPair.first->hasNumericalId(stackAddressSpaceId)) {
7649 for (
auto lsu : asLsusPair.second) {
7650 collectMemoryOps(opcodes, *lsu);
References TTAMachine::Machine::functionUnitNavigator(), Operation::name(), MachineInfo::osalOperation(), Operation::readsMemory(), StringTools::stringToUpper(), and Operation::writesMemory().
Referenced by writeBackendCode().
◆ tceOperationPattern()
std::string TDGen::tceOperationPattern |
( |
const Operation & |
op | ) |
|
|
protected |
◆ verbose()
void TDGen::verbose |
( |
const TCEString & |
msg | ) |
const |
|
protected |
◆ write16bitRegisterInfo()
void TDGen::write16bitRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes 16-bit register definitions to the output stream.
Definition at line 1155 of file TDGen.cc.
1161 for (
unsigned i = 1; i <
regs16bit_.size(); i++) {
1172 if (ri->first.find(
"R16") == 0) {
1173 o <<
"def " << ri->first
1174 <<
"Regs : RegisterClass<\"TCE\", [i16], 32, (add ";
1176 for (
unsigned i = 1; i < ri->second.size(); i++) {
1177 o <<
" , " << ri->second[i];
1179 o <<
")>;" << std::endl;
1187 if (ri->first.find(
"R16") == 0) {
1188 o <<
"def " << ri->first
1189 <<
"IRegs : RegisterClass<\"TCE\", [i16], 32, (add ";
1191 for (
unsigned i = 1; i < ri->second.size(); i++) {
1192 o <<
" , " << ri->second[i];
1194 o <<
")>;" << std::endl;
1204 if (ri->first.find(
"R16") == 0) {
1205 o <<
"def " << ri->first
1206 <<
"FPRegs : RegisterClass<\"TCE\", [f16], 32, (add ";
1208 for (
unsigned i = 1; i < ri->second.size(); i++) {
1209 o <<
" , " << ri->second[i];
1211 o <<
")>;" << std::endl;
References GPR, regs16bit_, regsInClasses_, RESULT, Conversion::toString(), and writeRegisterDef().
◆ write1bitRegisterInfo()
void TDGen::write1bitRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes 1-bit register definitions to the output stream.
Definition at line 905 of file TDGen.cc.
907 RegInfo reg = {
"dummy1", 0};
908 std::string name =
"I1DUMMY";
911 for (
unsigned i = 0; i <
regs1bit_.size(); i++) {
921 if (ri->first.find(
"R1") == 0) {
923 <<
"def " << ri->first <<
"Regs : RegisterClass<\"TCE\", [i1]"
924 <<
", " << stackSize <<
", (add ";
926 for (
unsigned i = 1; i < ri->second.size(); i++) {
927 o <<
" , " << ri->second[i];
929 o <<
")> {" << std::endl
930 <<
" let Size=" << stackSize <<
";" << std::endl
References GPR, TTAMachine::Machine::is64bit(), mach_, regs1bit_, regsInClasses_, RESERVED, Conversion::toString(), and writeRegisterDef().
Referenced by writeRegisterInfo().
◆ write32bitRegisterInfo()
void TDGen::write32bitRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Definition at line 965 of file TDGen.cc.
984 i32regs =
"SP, IRES0, FP, KLUDGE_REGISTER";
998 RegInfo reg = {
"dummy32", 0 };
1000 o <<
"def R32Regs : RegisterClass<\"TCE\", [i32,f32,f16,i1], 32, (add dummy32)>;"
1002 o <<
"def R32IRegs : RegisterClass<\"TCE\", [i32], 32, (add dummy32)>;"
1004 o <<
"def R32FPRegs : RegisterClass<\"TCE\", [f32], 32, (add dummy32)>;"
1006 o <<
"def R32HFPRegs : RegisterClass<\"TCE\", [f16], 32, (add dummy32)>;"
1028 for (
size_t j = 0; j < 256; ++j) {
1031 o <<
"def " << regName <<
" : "
1032 <<
"R32<\"ByPass_Regs"
1033 <<
"\", []>, DwarfRegNum<"
1039 o <<
"def R32_ByPass_Regs : RegisterClass<\"TCE\", [i32,f32,f16], 32, (add ";
1040 for (
size_t j = 0; j < 256; ++j) {
1050 o <<
")>;" << std::endl;
1054 for (RegClassMap::iterator
1058 <<
"_Regs : RegisterClass<\"TCE\", [i32,f32,f16], 32, (add ";
1060 for (std::vector<std::string>::iterator r = it->second.begin();
1061 r != it->second.end(); ++r) {
1062 if (r != it->second.begin()) {
1069 o <<
")>;" << std::endl;
1079 if (ri->first.find(
"R32") == 0) {
1081 o <<
"def " << ri->first <<
"Regs : RegisterClass<\"TCE\", [i32,f32,f16,i1], 32, (add ";
1083 for (
unsigned i = 1; i < ri->second.size(); i++) {
1084 o <<
" , " << ri->second[i];
1086 o <<
")>;" << std::endl;
1095 if (ri->first.find(
"R32") == 0) {
1096 o <<
"def " << ri->first <<
"IRegs : RegisterClass<\"TCE\", [i32], 32, (add ";
1098 for (
unsigned i = 1; i < ri->second.size(); i++) {
1099 o <<
" , " << ri->second[i];
1101 o <<
")>;" << std::endl;
1110 if (ri->first.find(
"R32") == 0) {
1112 o <<
"def " << ri->first <<
"FPRegs : RegisterClass<\"TCE\", [f32], 32, (add ";
1114 for (
unsigned i = 1; i < ri->second.size(); i++) {
1115 o <<
" , " << ri->second[i];
1117 o <<
")>;" << std::endl;
1125 if (ri->first.find(
"R32") == 0) {
1126 o <<
"def " << ri->first <<
"HFPRegs : RegisterClass<\"TCE\", [f16], 32, (add ";
1128 for (
unsigned i = 1; i < ri->second.size(); i++) {
1129 o <<
" , " << ri->second[i];
1131 o <<
")>;" << std::endl;
1142 o <<
"def FPRegs : RegisterClass<\"TCE\", [f32], 32, (add "
1143 << i32regs <<
")>;" << std::endl;
1145 o <<
"def HFPRegs : RegisterClass<\"TCE\", [f16], 32, (add "
1146 << i32regs <<
")>;" << std::endl;
References argRegCount_, ARGUMENT, dregNum_, GPR, TTAMachine::Machine::is64bit(), mach_, prebypassStackIndeces_, regs32bit_, regsInClasses_, regsInRFClasses_, RESERVED, RESULT, Conversion::toString(), use64bitForFP_, and writeRegisterDef().
Referenced by writeRegisterInfo().
◆ write64bitMoveDefs()
void TDGen::write64bitMoveDefs |
( |
std::ostream & |
o | ) |
|
|
protected |
Definition at line 8304 of file TDGen.cc.
8305 o << std::endl <<
"// 64-bit register->register move definitions."
8306 << std::endl <<
"let isAsCheapAsAMove = 1 in {" << std::endl;
8308 o <<
"def MOV64rr : InstTCE<(outs R64Regs:$dst), (ins R64Regs:$src),"
8309 <<
" \"$src -> $dst;\", []>;" << std::endl;
8311 o <<
"def PRED_TRUE_MOV64rr : InstTCE<(outs R64Regs:$dst), "
8312 <<
"(ins R1Regs:$pred, R64Regs:$src), \"$src -> $dst;\", []>;"
8315 o <<
"def PRED_FALSE_MOV64rr : InstTCE<(outs R64Regs:$dst), "
8316 <<
"(ins R1Regs:$pred, R64Regs:$src), \"$src -> $dst;\", []>;"
8319 o <<
"} // end of is as cheap as move" << std::endl;
◆ write64bitRegisterInfo()
void TDGen::write64bitRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes 64-bit register definitions to the output stream.
Definition at line 1307 of file TDGen.cc.
1310 std::string i64regs;
1311 std::string f64regs;
1321 i64regs =
"SP, IRES0, FP, KLUDGE_REGISTER";
1335 RegInfo reg = {
"DUMMY64", 0 };
1337 i64regs =
"DUMMY64";
1347 i64regs += intRegName;
1353 for (
size_t j = 0; j < 256; ++j) {
1356 o <<
"def " << regName <<
" : "
1357 <<
"R64<\"ByPass_Regs"
1358 <<
"\", []>, DwarfRegNum<"
1364 o <<
"def R64_ByPass_Regs : RegisterClass<\"TCE\", [i64,i32,f64,f32,f16], 64, (add ";
1365 for (
size_t j = 0; j < 256; ++j) {
1375 o <<
")>;" << std::endl;
1379 "[i64,f64,f32,f16]" :
1383 <<
"def R64Regs : RegisterClass<\"TCE\", " << dataTypes64
1384 <<
", 64, (add " << i64regs <<
")> ;"
1388 <<
"def R64IRegs : RegisterClass<\"TCE\", [i64], 64, (add "
1389 << i64regs <<
")> ;"
1393 <<
"def R64FPRegs : RegisterClass<\"TCE\", [f32], 64, (add "
1394 << i64regs <<
")>;" << std::endl;
1397 <<
"def R64HFPRegs : RegisterClass<\"TCE\", [f16], 64, (add "
1398 << i64regs <<
")>;" << std::endl;
1401 <<
"def R64DFPRegs : RegisterClass<\"TCE\", [f64], 64, (add "
1402 << i64regs <<
")>;" << std::endl << std::endl;
1405 o <<
"def FPRegs : RegisterClass<\"TCE\", [f32], 64, (add "
1406 << i64regs <<
")>;" << std::endl << std::endl;
1408 o <<
"def HFPRegs : RegisterClass<\"TCE\", [f16], 64, (add "
1409 << i64regs <<
")>;" << std::endl << std::endl;
References argRegCount_, ARGUMENT, dregNum_, GPR, TTAMachine::Machine::is64bit(), mach_, regs64bit_, RESERVED, RESULT, Conversion::toString(), use64bitForFP_, and writeRegisterDef().
Referenced by writeRegisterInfo().
◆ write8bitRegisterInfo()
void TDGen::write8bitRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
◆ writeAddressingModeDefs()
void TDGen::writeAddressingModeDefs |
( |
std::ostream & |
o | ) |
|
|
protected |
Definition at line 8345 of file TDGen.cc.
8348 <<
"// Addressing modes." << std::endl
8349 <<
"def ADDRrr : ComplexPattern<i32, 2, \"SelectADDRrr\", [], []>;" << std::endl
8350 <<
"def ADDRri : ComplexPattern<i32, 2, \"SelectADDRri\", [frameindex], []>;" << std::endl
8352 <<
"// Address operands" << std::endl
8353 <<
"def MEMrr : Operand<i32> {" << std::endl
8354 <<
"let PrintMethod = \"printMemOperand\";" << std::endl
8355 <<
"let MIOperandInfo = (ops R32IRegs, R32IRegs);" << std::endl
8357 <<
"def MEMri : Operand<i32> {" << std::endl
8358 <<
"let PrintMethod = \"printMemOperand\";" << std::endl
8359 <<
"let MIOperandInfo = (ops R32IRegs, i32imm);" << std::endl
8362 <<
"// Branch targets have OtherVT type." << std::endl
8363 <<
"def brtarget : Operand<OtherVT>; " << std::endl
8364 <<
"def calltarget : Operand<i32>;" << std::endl;
8366 o <<
"def SDT_TCECall : SDTypeProfile<0, 1, [SDTCisVT<0, i32>]>;" << std::endl;
8369 <<
"// Addressing modes." << std::endl
8370 <<
"def ADDRrr : ComplexPattern<i64, 2, \"SelectADDRrr\", [], []>;" << std::endl
8371 <<
"def ADDRri : ComplexPattern<i64, 2, \"SelectADDRri\", [frameindex], []>;" << std::endl
8373 <<
"// Address operands" << std::endl
8374 <<
"def MEMrr : Operand<i64> {" << std::endl
8375 <<
"let PrintMethod = \"printMemOperand\";" << std::endl
8376 <<
"let MIOperandInfo = (ops R64IRegs, R64IRegs);" << std::endl
8378 <<
"def MEMri : Operand<i64> {" << std::endl
8379 <<
"let PrintMethod = \"printMemOperand\";" << std::endl
8380 <<
"let MIOperandInfo = (ops R64IRegs, i64imm);" << std::endl
8383 <<
"// Branch targets have OtherVT type." << std::endl
8384 <<
"def brtarget : Operand<OtherVT>; " << std::endl
8385 <<
"def calltarget : Operand<i64>;" << std::endl;
8387 o <<
"def SDT_TCECall : SDTypeProfile<0, 1, [SDTCisVT<0, i64>]>;" << std::endl;
References TTAMachine::Machine::is64bit(), and mach_.
Referenced by generateBackend().
◆ writeArgRegsArray()
void TDGen::writeArgRegsArray |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 6922 of file TDGen.cc.
6923 os <<
"#ifndef ARGREGS_HH" << std::endl
6924 <<
"#define ARGREGS_HH" << std::endl << std::endl
6925 <<
"static const unsigned ArgRegs[] = { TCE::IRES0" << std::endl;
6926 for (
unsigned int i = 4; i < (3 +
argRegCount_); i++) {
6927 os <<
",TCE::A" << i;
6929 os <<
"};" << std::endl;
6931 os <<
"static const int argRegCount = " <<
argRegCount_ <<
";" << std::endl
6932 <<
"#endif" << std::endl;
References argRegCount_.
Referenced by generateBackend().
◆ writeBackendCode()
void TDGen::writeBackendCode |
( |
std::ostream & |
o | ) |
|
|
protected |
Generates required function definitions for the backend plugin.
- Parameters
-
o | Output stream to write the c++ code to. |
Definition at line 3941 of file TDGen.cc.
3944 o <<
"void" << std::endl
3945 <<
"GeneratedTCEPlugin::initialize() {" << std::endl;
3948 std::map<std::string, std::string>::const_iterator iter =
3951 for (; iter !=
opNames_.end(); iter++) {
3952 o <<
" opNames_[TCE::" << (*iter).first
3953 <<
"] = \"" << (*iter).second
3954 <<
"\";" << std::endl;
3958 o <<
" truePredOps_[TCE::" << (*iter).first
3959 <<
"] = TCE::" << (*iter).second
3960 <<
";" << std::endl;
3964 o <<
" falsePredOps_[TCE::" << (*iter).first
3965 <<
"] = TCE::" << (*iter).second
3966 <<
";" << std::endl;
3970 std::map<std::string, RegInfo>::const_iterator rIter =
regs_.begin();
3971 rIter =
regs_.begin();
3972 for (; rIter !=
regs_.end(); rIter++) {
3973 const RegInfo& regInfo = rIter->second;
3974 o <<
" regNames_[TCE::" << (*rIter).first
3975 <<
"] = \"" << regInfo.rf
3976 <<
"\";" << std::endl;
3978 o <<
" regIndices_[TCE::" << (*rIter).first
3979 <<
"] = " << regInfo.idx
3980 <<
";" << std::endl;
3982 TCEString ttaRegName = regInfo.rf +
"." + std::to_string(regInfo.idx);
3983 o <<
" ttallvmRegMap_[\"" << ttaRegName <<
"\"] = "
3984 <<
"TCE::" << (*rIter).first <<
";" << std::endl;
3990 o <<
" validStackAccessOperations_.insert(\"" << opName <<
"\");"
4000 o <<
" adfXML_ = \"";
4001 for (
unsigned int i = 0; i < adfXML.length(); i++) {
4002 if (adfXML[i] ==
'"') o <<
"\\\"";
4003 else if (adfXML[i] ==
'\n') o <<
"\"\n\"";
4004 else o << adfXML[i];
4006 o <<
"\";" << std::endl;
4012 std::string asName =
"";
4013 for (
int i = 0; i < nav.
count(); i++) {
4015 nav.
item(i)->addressSpace() != NULL) {
4016 asName = nav.
item(i)->addressSpace()->name();
4021 std::string msg =
"Couldn't determine data address space.";
4024 o <<
" dataASName_ = \"" << asName <<
"\";" << std::endl;
4026 o <<
"}" << std::endl;
4029 bool hasSDIV =
false;
4030 bool hasUDIV =
false;
4031 bool hasSREM =
false;
4032 bool hasUREM =
false;
4033 bool hasMUL =
false;
4034 bool hasROTL =
false;
4035 bool hasROTR =
false;
4036 bool hasSXHW =
false;
4037 bool hasSXQW =
false;
4038 bool hasSQRTF =
false;
4039 bool hasSHR =
false;
4040 bool hasSHRU =
false;
4041 bool hasSHL =
false;
4042 bool has8bitLoads =
false;
4043 bool has16bitLoads =
false;
4049 for (
int i = 0; i < fuNav.
count(); i++) {
4052 const std::string opName =
4056 if (opName ==
"div64") hasSDIV =
true;
4057 if (opName ==
"divu64") hasUDIV =
true;
4058 if (opName ==
"mod64") hasSREM =
true;
4059 if (opName ==
"modu64") hasUREM =
true;
4060 if (opName ==
"mul64") hasMUL =
true;
4061 if (opName ==
"rotl64") hasROTL =
true;
4062 if (opName ==
"rotr64") hasROTR =
true;
4063 if (opName ==
"sxh64") hasSXHW =
true;
4064 if (opName ==
"sxq64") hasSXQW =
true;
4065 if (opName ==
"shr64") hasSHR =
true;
4066 if (opName ==
"shru64") hasSHRU =
true;
4067 if (opName ==
"shl64") hasSHL =
true;
4069 if (opName ==
"div") hasSDIV =
true;
4070 if (opName ==
"divu") hasUDIV =
true;
4071 if (opName ==
"mod") hasSREM =
true;
4072 if (opName ==
"modu") hasUREM =
true;
4073 if (opName ==
"mul") hasMUL =
true;
4074 if (opName ==
"rotl") hasROTL =
true;
4075 if (opName ==
"rotr") hasROTR =
true;
4076 if (opName ==
"sxhw") hasSXHW =
true;
4077 if (opName ==
"sxqw") hasSXQW =
true;
4078 if (opName ==
"shr") hasSHR =
true;
4079 if (opName ==
"shru") hasSHRU =
true;
4080 if (opName ==
"shl") hasSHL =
true;
4082 if (opName ==
"sqrtf") hasSQRTF =
true;
4085 if (opName ==
"ld16" || opName ==
"ldu16") {
4086 has16bitLoads =
true;
4087 }
else if(opName ==
"ld8" || opName ==
"ldu8") {
4088 has8bitLoads =
true;
4093 if (opName ==
"ldh" || opName ==
"ldhu") {
4094 has16bitLoads =
true;
4095 }
else if (opName ==
"ldq" || opName ==
"ldqu") {
4096 has8bitLoads =
true;
4104 o <<
"bool GeneratedTCEPlugin::hasSDIV() const { return "
4105 << hasSDIV <<
"; }" << std::endl
4106 <<
"bool GeneratedTCEPlugin::hasUDIV() const { return "
4107 << hasUDIV <<
"; }" << std::endl
4108 <<
"bool GeneratedTCEPlugin::hasSREM() const { return "
4109 << hasSREM <<
"; }" << std::endl
4110 <<
"bool GeneratedTCEPlugin::hasUREM() const { return "
4111 << hasUREM <<
"; }" << std::endl
4112 <<
"bool GeneratedTCEPlugin::hasMUL() const { return "
4113 << hasMUL <<
"; }" << std::endl
4114 <<
"bool GeneratedTCEPlugin::hasROTL() const { return "
4115 << hasROTL <<
"; }" << std::endl
4116 <<
"bool GeneratedTCEPlugin::hasROTR() const { return "
4117 << hasROTR <<
"; }" << std::endl
4118 <<
"bool GeneratedTCEPlugin::hasSXHW() const { return "
4119 << hasSXHW <<
"; }" << std::endl
4120 <<
"bool GeneratedTCEPlugin::hasSXQW() const { return "
4121 << hasSXQW <<
"; }" << std::endl
4122 <<
"bool GeneratedTCEPlugin::hasSQRTF() const { return "
4123 << hasSQRTF <<
"; }" << std::endl
4124 <<
"bool GeneratedTCEPlugin::hasSHR() const { return "
4125 << hasSHR <<
"; }" << std::endl
4126 <<
"bool GeneratedTCEPlugin::hasSHL() const { return "
4127 << hasSHL <<
"; }" << std::endl
4128 <<
"bool GeneratedTCEPlugin::hasSHRU() const { return "
4129 << hasSHRU <<
";}" << std::endl
4130 <<
"bool GeneratedTCEPlugin::has8bitLoads() const { return "
4131 << has8bitLoads <<
";}" << std::endl
4132 <<
"bool GeneratedTCEPlugin::has16bitLoads() const { return "
4133 << has16bitLoads <<
";}" << std::endl;
4137 o <<
"int GeneratedTCEPlugin::maxVectorSize() const { return "
References __func__, TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), createBranchAnalysis(), createConstantMaterializationQuery(), createEndiannesQuery(), createMinMaxGenerator(), createParamDRegNums(), createVectorRVDRegNums(), falsePredOps_, TTAMachine::Machine::functionUnitNavigator(), generateLoadStoreCopyGenerator(), genGeneratedTCEPlugin_getAddOpcode(), genGeneratedTCEPlugin_getIorOpcode(), genGeneratedTCEPlugin_getLoadOpcode(), genGeneratedTCEPlugin_getShlOpcode(), genTCEInstrInfoSIMD_copyPhysVectorReg(), genTCERegisterInfo_setReservedVectorRegs(), genTCETargetLoweringSIMD_addVectorRegisterClasses(), genTCETargetLoweringSIMD_associatedVectorRegClass(), genTCETargetLoweringSIMD_getSetCCResultVT(), TDGen::RegInfo::idx, TTAMachine::Machine::is64bit(), TTAMachine::Machine::Navigator< ComponentType >::item(), littleEndian_, mach_, maxVectorSize_, TTAMachine::HWOperation::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), opNames_, regs_, TDGen::RegInfo::rf, XMLSerializer::setDestinationString(), StringTools::stringToLower(), supportedStackAccessOperations(), truePredOps_, writeGetPointerAdjustmentQuery(), and ADFSerializer::writeMachine().
Referenced by generateBackend().
◆ writeBooleanStorePatterns()
void TDGen::writeBooleanStorePatterns |
( |
std::ostream & |
os | ) |
|
|
protected |
Writes special store patterns for i1 types.
Definition at line 4527 of file TDGen.cc.
4528 std::string storeOp(
"");
4530 ? std::vector<std::string>{
"ST8ri",
"ST8rr"}
4531 : std::vector<std::string>{
"STQri",
"STQrr"};
4532 for (
auto op : storeOps) {
4538 if (storeOp.empty())
return;
4541 auto storeConstBit = [=](
const std::string& bitVal) -> std::string {
4542 return std::string(
"(") + storeOp +
" ADDRrr:$addr, " +
4543 (storeOp.back() ==
'i' ?
"(i32 " :
"(MOVI32ri ") + bitVal +
4551 os <<
"def : Pat<(store (i1 -1), ADDRrr:$addr), " << std::endl
4552 <<
" " << storeConstBit(
"1") <<
">;" << std::endl;
4553 os <<
"def : Pat<(store (i1 1), ADDRrr:$addr), " << std::endl
4554 <<
" " << storeConstBit(
"1") <<
">;" << std::endl;
4555 os <<
"def : Pat<(store (i1 0), ADDRrr:$addr), " << std::endl
4556 <<
" " << storeConstBit(
"0") <<
">;" << std::endl;
References littleEndian_, and opNames_.
Referenced by writeInstrInfo().
◆ writeBroadcastDefs()
void TDGen::writeBroadcastDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
int |
vectorLen |
|
) |
| |
|
protected |
◆ writeCallDef()
void TDGen::writeCallDef |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes .td pattern for the call instruction(s) to the output stream.
Definition at line 3899 of file TDGen.cc.
3905 if (i > 0) o <<
", ";
3911 o <<
"hasDelaySlot = 1, isCall = 1,";
3916 o <<
"] in {" << std::endl;
3917 o <<
"def CALL : InstTCE<(outs), (ins calltarget:$dst),";
3918 o <<
"\"$dst -> call.1;\", []>;" << std::endl;
3920 o <<
"def CALL_MEMrr : InstTCE<(outs), (ins MEMrr:$ptr),";
3921 o <<
"\"$ptr -> call.1;\", [(call ADDRrr:$ptr)]>;" << std::endl;
3923 o <<
"def CALL_MEMri : InstTCE<(outs), (ins MEMri:$ptr),";
3924 o <<
"\"$ptr -> call.1;\", [(call ADDRri:$ptr)]>;" << std::endl;
3925 o <<
"}" << std::endl;
3927 o <<
"def : Pat<(call tglobaladdr:$dst), (CALL tglobaladdr:$dst)>;"
3930 o <<
"def : Pat<(call texternalsym:$dst), (CALL texternalsym:$dst)>;"
References argRegNames_, and writeCallDefRegs().
Referenced by writeControlFlowInstrDefs().
◆ writeCallDefRegs()
void TDGen::writeCallDefRegs |
( |
std::ostream & |
o | ) |
|
|
protectedvirtual |
◆ writeCallingConv()
void TDGen::writeCallingConv |
( |
std::ostream & |
os | ) |
|
|
protected |
Writes details about function arguments and returns values.
- Parameters
-
o | Output stream to the file. |
Definition at line 6796 of file TDGen.cc.
6802 os <<
"// Function return value types." << endl;
6803 os <<
"def RetCC_TCE : CallingConv<[" << endl;
6805 os <<
" CCIfType<[i1], CCPromoteToType<i64>>," << endl
6806 <<
" CCIfType<[i32], CCPromoteToType<i64>>," << endl
6807 <<
" CCIfType<[i64], CCAssignToReg<[IRES0]>>," << endl
6808 <<
" CCIfType<[f64], CCAssignToReg<[IRES0]>>," << endl << endl;
6810 os <<
" CCIfType<[i1], CCPromoteToType<i32>>," << endl;
6811 os <<
" CCIfType<[i32], CCAssignToReg<[IRES0]>>," << endl;
6814 os <<
" CCIfType<[f16], CCAssignToReg<[IRES0]>>," << endl
6815 <<
" CCIfType<[f32], CCAssignToReg<[IRES0]>>," << endl << endl;
6817 os <<
" // Vector value types." << endl;
6818 std::map<TCEString, RegisterClass>::const_iterator rcIt;
6824 os <<
" CCIfType<[" << vtStr <<
"], CCAssignToReg<[";
6830 os <<
"]>>," << endl;
6832 verbose(
"ValueType " + vtStr +
" can not be a return value");
6836 os <<
" CCAssignToStack<" << bytes <<
", " << bytes <<
">" << endl
6837 <<
"]>;" << endl << endl;
6840 os <<
"// Function argument value types." << endl;
6841 os <<
"def CC_TCE : CallingConv<[" << endl;
6843 os <<
" CCIfType<[i1, i8, i16, i32], CCPromoteToType<i64>>," << endl
6844 <<
" CCIfType<[i64], CCAssignToReg<[IRES0]>>," << endl << endl;
6846 for (
unsigned int i = 4; i < (3 +
argRegCount_); i++) {
6847 os <<
" CCIfType<[i64], CCAssignToReg<[A" << i <<
"]>>," << endl;
6851 os <<
" CCIfType<[i1, i8, i16], CCPromoteToType<i32>>," << endl
6852 <<
" CCIfType<[i32], CCAssignToReg<[IRES0]>>," << endl << endl;
6854 for (
unsigned int i = 4; i < (3 +
argRegCount_); i++) {
6855 os <<
" CCIfType<[i32], CCAssignToReg<[A" << i <<
"]>>," << endl;
6860 os <<
" // 64-bit integer values get stored in stack slots that are"
6862 <<
" // 8 bytes insize and 8-byte aligned." << endl
6863 <<
" CCIfType<[i64, f64, f32], CCAssignToStack<8, 8>>,"
6866 os <<
" // Integer values get stored in stack slots that are" << endl
6867 <<
" // 4 bytes insize and 4-byte aligned." << endl
6868 <<
" CCIfType<[i32, f32], CCAssignToStack<4, 4>>," << endl << endl;
6870 os <<
" // Double values get stored in stack slots that are" << endl
6871 <<
" // 8 bytes in size and 8-byte aligned." << endl
6872 <<
" CCIfType<[f64], CCAssignToStack<8, 8>>";
6879 os <<
" // Vector value types." << endl;
6884 int byteAlignment = regClass.
alignment() / 8;
6885 if (byteAlignment < bytes) {
6886 byteAlignment = bytes;
6889 os <<
" CCIfType<[" << vtStr <<
"], CCAssignToStack<"
6890 << byteAlignment <<
", " << byteAlignment <<
">>";
6897 os <<
"]>;" << endl;
References TDGenerator::RegisterClass::alignment(), argRegCount_, TTAMachine::Machine::is64bit(), mach_, TDGenerator::RegisterClass::numberOfRegisters(), TDGenerator::RegisterClass::registerInfo(), TDGenerator::RegisterInfo::regName_, TDGenerator::RegisterClass::valueType(), verbose(), vRegClasses_, TDGenerator::ValueType::width(), and writeCallingConvLicenceText().
Referenced by generateBackend().
◆ writeCallingConvLicenceText()
void TDGen::writeCallingConvLicenceText |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 6901 of file TDGen.cc.
6902 os <<
"//===- GenCallingConv.td - Calling Conventions TCE ---------*- "
6903 <<
"tablegen -*-===//" << std::endl
6904 <<
"// " << std::endl
6905 <<
"// The LLVM Compiler Infrastructure" << std::endl
6906 <<
"//" << std::endl
6907 <<
"// This file is distributed under the University of "
6908 <<
"Illinois Open Source" << std::endl
6909 <<
"// License. See LICENSE.TXT for details." << std::endl
6910 <<
"// " << std::endl
6911 <<
"//===--------------------------------------------------------"
6912 <<
"--------------===//" << std::endl
6913 <<
"//" << std::endl
6914 <<
"// This describes the calling conventions for the TCE "
6915 <<
"architectures." << std::endl
6916 <<
"//" << std::endl
6917 <<
"//===--------------------------------------------------------"
6918 <<
"--------------===//" << std::endl << std::endl;
Referenced by writeCallingConv().
◆ writeCallSeqStart()
void TDGen::writeCallSeqStart |
( |
std::ostream & |
os | ) |
|
|
protected |
Definition at line 7870 of file TDGen.cc.
7875 os <<
"def SDT_TCECallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32>,"
7876 <<
"SDTCisVT<1, i32> ]>;" << std::endl << std::endl;
7878 os <<
"def SDT_TCECallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i64>,"
7879 <<
"SDTCisVT<1, i64> ]>;" << std::endl << std::endl;
7881 os <<
"def callseq_start : SDNode<\"ISD::CALLSEQ_START\", "
7882 <<
"SDT_TCECallSeqStart, [SDNPHasChain, SDNPOutGlue]>;" << std::endl
7884 <<
"let Defs = [SP], Uses = [SP] in {" << std::endl
7885 <<
"def ADJCALLSTACKDOWN : Pseudo<(outs),";
7887 os <<
"(ins i32imm:$amt1, i32imm:$amt2),";
7889 os <<
"(ins i64imm:$amt1, i64imm:$amt2),";
7891 os <<
"\"# ADJCALLSTACKDOWN $amt1, $amt2\","
7892 <<
"[(callseq_start timm:$amt1, timm:$amt2)]>;}"
7893 << std::endl << std::endl;
References TTAMachine::Machine::is64bit(), and mach_.
Referenced by writeInstrInfo().
◆ writeCondBranchDefs()
void TDGen::writeCondBranchDefs |
( |
std::ostream & |
os | ) |
|
|
protected |
Writes instructions definitions and patterns for conditional branches.
Definition at line 3605 of file TDGen.cc.
3611 os << std::endl <<
"let isTerminator = 1, isBranch = 1 in {" << std::endl;
3613 if (cuOpset.count(
"JUMP") &&
opNames_.count(
"TCEBRCOND") == 0) {
3615 "GuardRegs:$gr, brtarget:$dst",
3616 "? $gr $dst -> jump.1;",
3617 "(brcond GuardRegs:$gr, bb:$dst)");
3622 if (cuOpset.count(
"JUMP") &&
opNames_.count(
"TCEBRICOND") == 0) {
3624 "GuardRegs:$gr, brtarget:$dst",
3625 "! $gr $dst -> jump.1;",
3626 "(brcond (not GuardRegs:$gr), bb:$dst)");
3629 os <<
"}" << std::endl;
3636 abortWithError(
"Required eq/ne op not found. please add to adf.");
3639 abortWithError(
"Required gt/le op not found. please add to adf.");
3642 abortWithError(
"Required gtu/leu op not found. please add to adf.");
3652 "R32IRegs:$cmp1, R32IRegs:$cmp2, brtarget:$dst",
"",
3653 "(brcond (and R32IRegs:$cmp1, R32IRegs:$cmp2), bb:$dst)");
3655 std::cerr <<
"Missing AND operation as true-guard source to jump." << std::endl;
3661 "R32IRegs:$cmp1, R32IRegs:$cmp2, brtarget:$dst",
"",
3662 "(brcond (or R32IRegs:$cmp1, R32IRegs:$cmp2), bb:$dst)");
3664 std::cerr <<
"Missing IOR operation as true-guard source to jump." << std::endl;
3668 os << std::endl <<
"let isTerminator = 1, isBranch = 1 in {" << std::endl;
3672 "GuardRegs:$gr, brtarget:$dst",
3673 "? $gr $dst -> jump.1;",
3678 "GuardRegs:$gr, brtarget:$dst",
3679 "? $gr $dst -> jump.1;",
3684 os <<
"}" << std::endl;
3686 os <<
"def: Pat<(brcc SETLT, R32IRegs:$cmp1, R32IRegs:$cmp2, bb:$dst),"
3687 <<
" (GT_JUMP R32IRegs:$cmp2, R32IRegs:$cmp1, brtarget:$dst)>;" << std::endl;
3690 os <<
"def: Pat<(brcc SETGE, R32IRegs:$cmp1, R32IRegs:$cmp2, bb:$dst),"
3691 <<
" (LE_JUMP R32IRegs:$cmp2, R32IRegs:$cmp1, brtarget:$dst)>;" << std::endl;
3693 os <<
"def: Pat<(brcc SETULT, R32IRegs:$cmp1, R32IRegs:$cmp2, bb:$dst),"
3694 <<
" (GTU_JUMP R32IRegs:$cmp2, R32IRegs:$cmp1, brtarget:$dst)>;" << std::endl;
3697 os <<
"def: Pat<(brcc SETUGE, R32IRegs:$cmp1, R32IRegs:$cmp2, bb:$dst),"
3698 <<
" (LEU_JUMP R32IRegs:$cmp2, R32IRegs:$cmp1, brtarget:$dst)>;" << std::endl;
3701 opNames_[
"AND_JUMP"] =
"and+?jump";
3702 opNames_[
"IOR_JUMP"] =
"ior+?jump";
3707 os << std::endl <<
"let isTerminator = 1, isBranch = 1 in {" << std::endl;
3709 if (cuOpset.count(
"BNZ1")) {
3712 writeInstrDef(os,
"TCEBRCOND",
"",
"R32IRegs:$gr, brtarget:$dst",
3713 "",
"(brcond R32IRegs:$gr, bb:$dst)");
3717 if (cuOpset.count(
"BNZ")) {
3718 writeInstrDef(os,
"TCEBRCOND",
"",
"R32IRegs:$gr, brtarget:$dst",
3719 "",
"(brcond R32IRegs:$gr, bb:$dst)");
3723 std::cerr <<
"Does not have guarded jumps or neither bnz or bnz1" << std::endl;
3727 if (cuOpset.count(
"BZ1")) {
3730 writeInstrDef(os,
"TCEBRICOND",
"",
"R32IRegs:$gr, brtarget:$dst",
3731 "",
"(brcond (not R32IRegs:$gr), bb:$dst)");
3735 if (cuOpset.count(
"BZ")) {
3736 writeInstrDef(os,
"TCEBRICOND",
"",
"R32IRegs:$gr, brtarget:$dst",
3737 "",
"(brcond (not R32IRegs:$gr), bb:$dst)");
3741 std::cerr <<
"Does not have guarded jumps or neither bz or bz1" << std::endl;
3745 if (cuOpset.count(
"BEQ")) {
3746 writeInstrDef(os,
"TCEBREQrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3747 "",
"(brcond (i32 (seteq R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3749 writeInstrDef(os,
"TCEBREQri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3750 "",
"(brcond (i32 (seteq R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3754 if (cuOpset.count(
"BNE")) {
3755 writeInstrDef(os,
"TCEBRNErr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3756 "",
"(brcond (i32 (setne R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3758 writeInstrDef(os,
"TCEBRNEri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3759 "",
"(brcond (i32 (setne R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3763 if (cuOpset.count(
"BGT")) {
3764 writeInstrDef(os,
"TCEBRGTrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3765 "",
"(brcond (i32 (setgt R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3767 writeInstrDef(os,
"TCEBRGTri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3768 "",
"(brcond (i32 (setgt R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3772 if (cuOpset.count(
"BGTU")) {
3773 writeInstrDef(os,
"TCEBRGTUrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3774 "",
"(brcond (i32 (setugt R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3776 writeInstrDef(os,
"TCEBRGTUri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3777 "",
"(brcond (i32 (setugt R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3781 if (cuOpset.count(
"BLT")) {
3782 writeInstrDef(os,
"TCEBRLTrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3783 "",
"(brcond (i32 (setlt R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3785 writeInstrDef(os,
"TCEBRLTri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3786 "",
"(brcond (i32 (setlt R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3790 if (cuOpset.count(
"BLTU")) {
3791 writeInstrDef(os,
"TCEBRLTUrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3792 "",
"(brcond (i32 (setult R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3794 writeInstrDef(os,
"TCEBRLTUri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3795 "",
"(brcond (i32 (setult R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3799 if (cuOpset.count(
"BLE")) {
3800 writeInstrDef(os,
"TCEBRLErr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3801 "",
"(brcond (i32 (setle R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3803 writeInstrDef(os,
"TCEBRLEri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3804 "",
"(brcond (i32 (setle R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3808 if (cuOpset.count(
"BLEU")) {
3809 writeInstrDef(os,
"TCEBRLEUrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3810 "",
"(brcond (i32 (setule R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3812 writeInstrDef(os,
"TCEBRLEUri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3813 "",
"(brcond (i32 (setule R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3817 if (cuOpset.count(
"BGE")) {
3818 writeInstrDef(os,
"TCEBRGErr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3819 "",
"(brcond (i32 (setge R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3821 writeInstrDef(os,
"TCEBRGEri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3822 "",
"(brcond (i32 (setge R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3826 if (cuOpset.count(
"BGEU")) {
3827 writeInstrDef(os,
"TCEBRGEUrr",
"",
"R32IRegs:$c1, R32IRegs:$c2, brtarget:$dst",
3828 "",
"(brcond (i32 (setuge R32IRegs:$c1, R32IRegs:$c2)), bb:$dst)");
3830 writeInstrDef(os,
"TCEBRGEUri",
"",
"R32IRegs:$c1, i32imm:$c2, brtarget:$dst",
3831 "",
"(brcond (i32 (setuge R32IRegs:$c1, i32MoveImm:$c2)), bb:$dst)");
3835 os <<
"}" << std::endl;
References abortWithError, assert, TTAMachine::Machine::controlUnit(), MachineInfo::getOpset(), mach_, opNames_, MachineInfo::supportsBoolRegisterGuardedJumps(), MachineInfo::supportsPortGuardedJump(), MachineInfo::supportsPortGuardedJumps(), writeInstrDef(), and writePortGuardedJumpDefPair().
Referenced by writeControlFlowInstrDefs().
◆ writeConstShiftPat()
void TDGen::writeConstShiftPat |
( |
std::ostream & |
os, |
|
|
const TCEString & |
nodeName, |
|
|
const TCEString & |
opNameBase, |
|
|
int |
i |
|
) |
| |
|
protected |
Definition at line 8503 of file TDGen.cc.
8508 TCEString opName = opNameBase; opName << i <<
"_32rr";
8510 os <<
"def : Pat<(i32 (" << nodeName
8511 <<
" R32IRegs:$val, (i32 " << i <<
"))), ("
8512 << opName <<
" R32IRegs:$val)>;" << std::endl;
8515 TCEString opName = opNameBase; opName << i <<
"_64rr";
8517 os <<
"def : Pat<(i64 (" << nodeName
8518 <<
" R64IRegs:$val, (i64 " << i <<
"))), ("
8519 << opName <<
" R64IRegs:$val)>;" << std::endl;
References TTAMachine::Machine::is64bit(), mach_, and opNames_.
Referenced by createConstShiftPatterns().
◆ writeControlFlowInstrDefs()
void TDGen::writeControlFlowInstrDefs |
( |
std::ostream & |
os | ) |
|
|
protected |
◆ writeEmulationPattern()
Writes operation emulation pattern in .td format to an output stream.
- Parameters
-
o | Output stream to write the definition to. |
op | Emulated operation. |
dag | Emulation pattern. |
Definition at line 4759 of file TDGen.cc.
4768 std::cerr <<
"end nodes of dag for operation: " << op.
name()
4769 <<
" is empty!" << std::endl;
4774 if (opNode == NULL) {
4785 if (llvmPat ==
"") {
4786 std::cerr <<
"unknown op: " << op.
name() << std::endl;
4788 assert(llvmPat !=
"" &&
"Unknown operation to emulate.");
4790 boost::format match1(llvmPat);
4794 std::string operandTypes;
4795 for (
int i = 0; i < outputs; i++) {
4805 operandTypes += inputType;
4809 o <<
"def : Pat<(" << match1.str() <<
"), "
4811 <<
">;" << std::endl;
4815 if (op.
name() ==
"LTF" || op.
name() ==
"LTUF" ||
4816 op.
name() ==
"EQF" || op.
name() ==
"EQUF" ||
4817 op.
name() ==
"GEF" || op.
name() ==
"GEUF" ||
4818 op.
name() ==
"LEF" || op.
name() ==
"LEUF" ||
4819 op.
name() ==
"GTF" || op.
name() ==
"GTUF" ||
4820 op.
name() ==
"NEF" || op.
name() ==
"NEUF" ||
4821 op.
name() ==
"EQ" || op.
name() ==
"NE" ||
4822 op.
name() ==
"EQ64" || op.
name() ==
"NE64" ||
4823 op.
name() ==
"GE" ||op.
name() ==
"GEU" ||
4824 op.
name() ==
"GE64" ||op.
name() ==
"GEU64" ||
4825 op.
name() ==
"GT" || op.
name() ==
"GTU" ||
4826 op.
name() ==
"GT64" || op.
name() ==
"GTU64" ||
4827 op.
name() ==
"LE" || op.
name() ==
"LEU" ||
4828 op.
name() ==
"LE64" || op.
name() ==
"LEU64" ||
4829 op.
name() ==
"LT" || op.
name() ==
"LTU" ||
4830 op.
name() ==
"LT64" || op.
name() ==
"LTU64" ||
4831 op.
name() ==
"LTD" || op.
name() ==
"LTUD" ||
4832 op.
name() ==
"EQD" || op.
name() ==
"EQUD" ||
4833 op.
name() ==
"GED" || op.
name() ==
"GEUD" ||
4834 op.
name() ==
"LED" || op.
name() ==
"LEUD" ||
4835 op.
name() ==
"GTD" || op.
name() ==
"GTUD" ||
4836 op.
name() ==
"NED" || op.
name() ==
"NEUD" ||
4837 op.
name() ==
"ORDD" || op.
name() ==
"UORDD" ||
4838 op.
name() ==
"ORDF" || op.
name() ==
"UORDF") {
4839 std::string boolOperandTypes = operandTypes;
4840 boolOperandTypes[0] =
'b';
4841 o <<
"def : Pat<(" << match1.str() <<
"), "
4843 <<
">;" << std::endl;
References assert, dagNodeToString(), OperationDAG::endNodes(), immediateOperandNameForEmulatedOperation(), BoostGraph< GraphNode, GraphEdge >::inDegree(), BoostGraph< GraphNode, GraphEdge >::inEdge(), TTAMachine::Machine::is64bit(), llvmOperationPattern(), mach_, Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::operand(), operandChar(), operandToString(), OT_REG_INT, OT_REG_LONG, and BoostGraph< GraphNode, GraphEdge >::tailNode().
Referenced by writeInstrInfo().
◆ writeGetPointerAdjustmentQuery()
void TDGen::writeGetPointerAdjustmentQuery |
( |
std::ostream & |
os | ) |
const |
|
protected |
Writes query method for retrieving LLVM instruction for pointer adjustment and suitable offset value.
Some machines may not SUBrri definition (second operand can not take an immediate) and, therefore, pointer adjustments must use other operation for it.
Definition at line 7448 of file TDGen.cc.
7455 boost::format queryTmpl(
7456 "// <MI opcode, adjusted offset>\n"
7457 "std::tuple<int, int> GeneratedTCEPlugin::getPointerAdjustment(\n"
7458 " int offset) const {\n"
7459 " if (offset > 0) // Adjust pointer up.\n"
7460 " return std::make_tuple(TCE::%1%, offset);\n"
7462 " return std::make_tuple(TCE::%2%, %3%);\n"
7467 os << queryTmpl %
ADDIMM %
SUBIMM %
"-offset" << std::endl;
7469 }
else if (
opNames_.count(
"ADDrri")) {
7470 os << queryTmpl %
ADDIMM %
ADDIMM %
"offset" << std::endl;
7476 "The machine is missing ADD or SUB operation with direct\n"
7477 "immediate source for pointer adjustment operations.");
References ADDIMM, TTAMachine::Machine::is64bit(), mach_, opNames_, SUBIMM, and THROW_EXCEPTION.
Referenced by writeBackendCode().
◆ writeGuardRegisterClassInfo()
void TDGen::writeGuardRegisterClassInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes register class for registers usable as guard.
Call this after all regular register definitions are written (after all calls to writeRegisterDef());
Definition at line 1952 of file TDGen.cc.
1956 <<
"// #################################" << std::endl
1957 <<
"// Register class definitions for guards" << std::endl;
1960 o <<
"// No guard registers in this machine" << std::endl;
1961 RegInfo reg = {
"noGuardReg", 0};
1962 std::string name =
"NOGUARD";
1965 <<
"Regs : RegisterClass<\"TCE\", [i1], " << bits <<
", (add "
1966 << name <<
")>;" << std::endl;
1971 <<
"Regs : RegisterClass<\"TCE\", [i1], " << bits <<
", (add ";
1972 bool firstItem =
true;
1979 o <<
", " << regDef;
1981 o <<
")> {" << std::endl;
1982 o <<
" let Size=" << bits <<
";" << std::endl;
1983 o <<
"}" << std::endl;
1984 o <<
"// #################################" << std::endl << std::endl;
References guardRegTemplateName, TTAMachine::Machine::is64bit(), llvmGuardRegs_, mach_, RESERVED, and writeRegisterDef().
Referenced by writeRegisterInfo().
◆ writeHWLoopDef()
void TDGen::writeHWLoopDef |
( |
std::ostream & |
os | ) |
|
|
protected |
Writes hwloop instructions and patterns.
Definition at line 3571 of file TDGen.cc.
3572 os << std::endl <<
"// Hardware loop instructions" << std::endl;
3574 os <<
"let isTerminator=1 in {" << std::endl
3575 <<
" def HWLOOPii : InstTCE<(outs), (ins i32imm0:$rIter, "
3576 "i32imm0:$rInstr), \"\", []>;"
3578 <<
" def HWLOOPri : InstTCE<(outs), (ins i32imm0:$rIter, "
3579 "i32imm0:$rInstr), \"\", []>;"
3582 <<
"def : Pat<(int_set_loop_iterations i32imm0:$rIter), "
3583 "(HWLOOPii i32imm0:$rIter, 0)>;"
3585 <<
"def : Pat<(int_set_loop_iterations R32IRegs:$rIter), "
3586 "(HWLOOPri R32IRegs:$rIter, 0)>;"
3593 os <<
"let isTerminator = 1 in {" << std::endl
3594 <<
" def LJUMP : InstTCE<(outs), (ins brtarget:$dst), \"\", []>;"
References TTAMachine::Machine::controlUnit(), TTAMachine::FunctionUnit::hasOperation(), mach_, and opNames_.
Referenced by writeInstrInfo().
◆ writeImmediateDef()
void TDGen::writeImmediateDef |
( |
std::ostream & |
o, |
|
|
const std::string & |
defName, |
|
|
const std::string & |
operandType, |
|
|
const std::string & |
predicate |
|
) |
| |
|
protectedvirtual |
Writes single immediate operand definitions to the stream.
- Parameters
-
o | The output stream. |
defName | The name of the immediate operand definition. |
operandType | The target type (i.e "i32"). |
predicate | The predicate expression without return statement or ';' at the end. |
Definition at line 4569 of file TDGen.cc.
4575 o <<
"def " << defName <<
" : Operand<" << operandType
4576 <<
"> , ImmLeaf<" << operandType <<
", [{" << std::endl
4577 <<
" return " << predicate <<
";}]>;" << std::endl;
Referenced by createConstantMaterializationPatterns(), writeIntegerImmediateDefs(), and writeMoveImmediateDefs().
◆ writeInstrDef()
void TDGen::writeInstrDef |
( |
std::ostream & |
o, |
|
|
const std::string & |
instrDefName, |
|
|
const std::string & |
outs, |
|
|
const std::string & |
ins, |
|
|
const std::string & |
asmString, |
|
|
const std::string & |
pattern |
|
) |
| |
|
protected |
Writes LLVM instruction definition in TCE format to the stream.
Definition at line 4585 of file TDGen.cc.
4593 o <<
"def " << instrDefName <<
" : InstTCE<" << std::endl
4594 <<
" (outs " << outs <<
")," << std::endl
4595 <<
" (ins " << ins <<
")," << std::endl
4596 <<
" \"" << asmString <<
"\", " << std::endl
4597 <<
" [" << pattern <<
"]>;" << std::endl;
Referenced by writeCondBranchDefs(), and writePortGuardedJumpDefPair().
◆ writeInstrFormats()
void TDGen::writeInstrFormats |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes details about instruction formatting
- Parameters
-
o | Output stream to the file. |
Definition at line 4214 of file TDGen.cc.
4216 o <<
"// TCE Instruction formats." << endl;
4218 o <<
"// Only one simple format is currently available" << endl;
4220 o <<
"// Automatically generated file, do not edit!" << endl;
4223 o <<
"class InstTCE<dag outOps, dag inOps, string asmstr," << endl;
4224 o <<
" list<dag> pattern = []," << endl;
4225 o <<
" InstrItinClass itin = IT_FU>" << endl;
4226 o <<
" : Instruction {" << endl;
4227 o <<
" let Namespace = \"TCE\";" << endl;
4228 o <<
" dag InOperandList = inOps;" << endl;
4229 o <<
" dag OutOperandList = outOps;" << endl;
4230 o <<
" let AsmString = asmstr;" << endl;
4231 o <<
" let Pattern = pattern;" << endl;
4232 o <<
" let Itinerary = itin;" << endl;
4235 o <<
"class Pseudo<dag outOps, dag inOps," << endl;
4236 o <<
" string asmstr, list<dag> pattern>" << endl;
4237 o <<
" : InstTCE<outOps, inOps, asmstr, pattern>;" << endl;
Referenced by generateBackend().
◆ writeInstrInfo()
void TDGen::writeInstrInfo |
( |
std::ostream & |
os | ) |
|
|
protected |
Writes all machine instructions to instruction info .td file.
- Parameters
-
os | Output stream to the file. |
- Note
- This todo marking is from TDGenSIMD
Definition at line 3328 of file TDGen.cc.
3341 for (
int i = 0; i < fuNav.
count(); i++) {
3419 OperationDAGSelector::OperationSet::const_iterator iter = opNames.begin();
3420 for (; iter != opNames.end(); iter++) {
3421 OperationDAGSelector::OperationSet::iterator r =
3422 requiredOps.find(*iter);
3423 if (r != requiredOps.end()) {
3424 requiredOps.erase(r);
3427 bool skipPattern =
false;
3440 <<
"Skipped writing operation pattern for "
3441 << op.
name() << endl;
3484 for (iter = requiredOps.begin(); iter != requiredOps.end(); iter++) {
3488 std::string msg =
"Required OP '" + *iter +
"' not found.";
3495 if (emulationDAGs.empty()) {
3499 <<
"' not supported." << endl;
References __func__, allOpNames_, TTAMachine::Machine::Navigator< ComponentType >::count(), create32BitExtLoadPatterns(), createBoolAndHalfLoadPatterns(), createByteExtLoadPatterns(), createConstantMaterializationPatterns(), createConstShiftPatterns(), createSelectPatterns(), createShortExtLoadPatterns(), falsePredOps_, OperationDAGSelector::findDags(), TTAMachine::Machine::functionUnitNavigator(), hasConditionalMoves_, TTAMachine::Machine::hasOperation(), immInfo_, NullOperation::instance(), TTAMachine::Machine::is64bit(), isVectorBitwiseOperation(), isVectorLoadOperation(), Operation::isVectorOperation(), isVectorStoreOperation(), TTAMachine::Machine::Navigator< ComponentType >::item(), littleEndian_, LLVMBackend::llvmRequiredOpset(), Application::logStream(), mach_, TTAMachine::HWOperation::name(), Operation::name(), Operation::numberOfOutputs(), OperationPool::operation(), TTAMachine::FunctionUnit::operation(), operationCanBeMatched(), TTAMachine::FunctionUnit::operationCount(), opNames_, OperationDAGSelector::OperationDAGList::smallestNodeCount(), StringTools::stringToUpper(), truePredOps_, Application::VERBOSE_LEVEL_DEFAULT, Application::verboseLevel(), writeBooleanStorePatterns(), writeCallSeqStart(), writeControlFlowInstrDefs(), writeEmulationPattern(), writeHWLoopDef(), writeMiscPatterns(), writeOperationDefs(), writeScalarOperationExploitations(), writeScalarToVectorDefs(), writeVectorBitConversions(), writeVectorBitwiseOperationDefs(), writeVectorImmediateWriteDefs(), writeVectorLoadStoreOperationExploitations(), writeVectorMemoryOperationDefs(), writeVectorOperationDefs(), writeVectorRegisterMoveDefs(), and writeVectorTruncStoreDefs().
Referenced by generateBackend().
◆ writeIntegerImmediateDefs()
void TDGen::writeIntegerImmediateDefs |
( |
std::ostream & |
o, |
|
|
const ImmInfo & |
iivs |
|
) |
| |
|
protected |
Writes unique immediate operands (ImmLeafs) for all operations that can have short immediates to transported to theirs operands.
The names of the immediate operands are stored in i32immOperandDefs_ map. Note: operations, that can not have short immediates to be trasported at all, do not entry in the map.
- Parameters
-
o | The output stream. |
iivs | The immediate info. |
Definition at line 594 of file TDGen.cc.
601 using ImmBounds = std::pair<int64_t, int64_t>;
604 std::set<const Operation*> opset;
605 for (
auto& iiv : iivs) {
612 std::map<ImmBounds, std::string> immediateClasses;
614 for (
auto op : opset) {
620 std::vector<std::set<int>> inputGroups;
621 for (
int opdIdx = 1; opdIdx < op->
numberOfInputs() + 1; opdIdx++) {
624 bool alreadyGrouped =
false;
625 for (
auto& group : inputGroups) {
626 if (group.count(opdIdx)) {
627 alreadyGrouped =
true;
631 if (alreadyGrouped)
continue;
633 inputGroups.push_back(std::set<int>());
634 inputGroups.back().insert(opdIdx);
635 for (
int otherOpdIdx : opd.
swap()) {
636 inputGroups.back().insert(otherOpdIdx);
643 for (
auto group : inputGroups) {
644 ImmBounds widestImmBound;
645 for (
auto idx : group) {
647 if (iivs.count(*op, idx)) {
649 ImmBounds immBound = iivs.immediateValueBounds(
651 widestImmBound.first = std::min(
652 widestImmBound.first, immBound.first);
653 widestImmBound.second = std::max(
654 widestImmBound.second, immBound.second);
657 if (widestImmBound == ImmBounds())
continue;
661 if (immediateClasses.count(widestImmBound) == 0) {
662 std::string immDefName = std::string(
"i32imm")
665 immediateClasses[widestImmBound] = immDefName;
669 widestImmBound.first, widestImmBound.second));
671 immDefName = std::string(
"i64imm")
675 immediateClasses[widestImmBound] = immDefName;
680 widestImmBound.first, widestImmBound.second));
686 immediateClasses.at(widestImmBound);
References immediatePredicate(), immOperandDefs_, NullOperation::instance(), TTAMachine::Machine::is64bit(), ImmInfo::key(), mach_, OperationPool::operation(), Operand::swap(), Conversion::toString(), and writeImmediateDef().
Referenced by writeOperandDefs().
◆ writeMiscPatterns()
void TDGen::writeMiscPatterns |
( |
std::ostream & |
o | ) |
|
|
protected |
Definition at line 8391 of file TDGen.cc.
8393 o <<
"// zero extending moves used in some patterns" << std::endl
8394 <<
"def ANDext : InstTCE<(outs R32IRegs:$dst), (ins R1Regs:$src, i32imm:$val), \"\", []>;" << std::endl
8395 <<
"def PRED_TRUE_ANDext : InstTCE<(outs R32IRegs:$dst),"
8396 <<
" (ins R1Regs:$pred, R1Regs:$src, i32imm:$val), \"\", []>;" << std::endl
8397 <<
"def PRED_FALSE_ANDext : InstTCE<(outs R32IRegs:$dst),"
8398 <<
" (ins R1Regs:$pred, R1Regs:$src, i32imm:$val),\"\", []>;" << std::endl
8399 <<
"def XORbicmp: InstTCE<(outs R1Regs:$dst),"
8400 <<
" (ins R1Regs:$src, i32imm:$val), \"\", []>;" << std::endl
8401 <<
"def PRED_TRUE_XORbicmp: InstTCE<(outs R1Regs:$dst),"
8402 <<
" (ins R1Regs:$pred, R1Regs:$src, i32imm:$val), \"\", []>;" << std::endl
8403 <<
"def PRED_FALSE_XORbicmp: InstTCE<(outs R1Regs:$dst),"
8404 <<
" (ins R1Regs:$pred, R1Regs:$src, i32imm:$val), \"\", []>;" << std::endl;
8406 o <<
"def: Pat <(i32 (anyext R1Regs:$src)), (ANDext R1Regs:$src, 1)>;" << std::endl
8407 <<
"def: Pat <(i32 (zext R1Regs:$src)), (ANDext R1Regs:$src, 1)>;" << std::endl;
8409 o <<
"// select of 1 or 0." << std::endl
8410 <<
"def : Pat<(i32 (select R1Regs:$c, (i32 1), (i32 0))),"
8411 <<
" (ANDext R1Regs:$c, 1)>;" << std::endl;
8414 <<
"def: Pat <(i32 (sext R1Regs:$src)), (SUBrir 0,(ANDext R1Regs:$src, 1))>;"
8417 o <<
"// ------ Shift (emulation) patterns. " << std::endl
8418 <<
"def: Pat <(i32 (shl R32IRegs:$val, (i32 1))),"
8419 <<
" (ADDrrr R32Regs:$val, R32Regs:$val)>;" << std::endl
8420 <<
"def: Pat <(i32 (TCESHLConst R32IRegs:$val, (i32 1))),"
8421 <<
" (ADDrrr R32IRegs:$val, R32IRegs:$val)>;" << std::endl;
8423 o <<
"// ----- Global addresses, constant pool entries ------" << std::endl
8424 <<
"def TCEGlobalAddr : SDNode<\"TCEISD::GLOBAL_ADDR\", SDTIntUnaryOp>;" << std::endl
8425 <<
"def TCEConstPool : SDNode<\"TCEISD::CONST_POOL\", SDTIntUnaryOp>;" << std::endl
8426 <<
"def : Pat<(TCEGlobalAddr tglobaladdr:$in), (MOVI32ri tglobaladdr:$in)>;" << std::endl
8427 <<
"def : Pat<(TCEGlobalAddr tconstpool:$in), (MOVI32ri tconstpool:$in)>;" << std::endl
8428 <<
"def : Pat<(TCEConstPool tglobaladdr:$in), (MOVI32ri tglobaladdr:$in)>;" << std::endl
8429 <<
"def : Pat<(TCEConstPool tconstpool:$in), (MOVI32ri tconstpool:$in)>;" << std::endl;
8432 o <<
"// some peephole patterns." << std::endl
8433 <<
"// 1-bit select with imm values - xor or mov." << std::endl
8434 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 0), (i1 -1))), (XORbbj R1Regs:$c, 1)>;" << std::endl
8435 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 -1), (i1 0))), (MOVI1rr R1Regs:$c)>;" << std::endl
8436 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 -1), R1Regs:$F)), (IORbbb R1Regs:$c, R1Regs:$F)>;" << std::endl
8437 <<
"def : Pat<(i1 (select R1Regs:$c, R1Regs:$T, (i1 0))), (ANDbbb R1Regs:$c, R1Regs:$T)>;" << std::endl;
8439 o <<
"// 1-bit comparison between booleans - xor or xnor(implemented with 2 xors)" << std::endl
8440 <<
"def : Pat<(i1 (setne R1Regs:$op1, R1Regs:$op2)), (XORbbb R1Regs:$op1, R1Regs:$op2)>;" << std::endl
8441 <<
"// TODO: should the temp values be converted to i32? usually more i32 regs." << std::endl
8442 <<
"def : Pat<(i1 (seteq R1Regs:$op1, R1Regs:$op2)), (XORbbj (XORbbb R1Regs:$op1, R1Regs:$op2), 1)>;" << std::endl;
8444 o <<
"def TCEBlockAddress : SDNode<\"TCEISD::BLOCK_ADDR\", SDTIntUnaryOp>;" << std::endl
8445 <<
"def : Pat<(TCEBlockAddress tblockaddress:$src1), (MOVI32ri tblockaddress:$src1)>;" << std::endl;
8448 o <<
"// zero extending moves used in some patterns" << std::endl
8449 <<
"def ANDext : InstTCE<(outs R64IRegs:$dst),"
8450 <<
" (ins R1Regs:$src, i64imm:$val), \"\", []>;" << std::endl
8451 <<
"def PRED_TRUE_ANDext : InstTCE<(outs R64IRegs:$dst),"
8452 <<
" (ins R1Regs:$pred, R1Regs:$src, i64imm:$val), \"\", []>;" << std::endl
8453 <<
"def PRED_FALSE_ANDext : InstTCE<(outs R64IRegs:$dst),"
8454 <<
" (ins R1Regs:$pred, R1Regs:$src, i64imm:$val),\"\", []>;" << std::endl
8455 <<
"def XORbicmp: InstTCE<(outs R1Regs:$dst),"
8456 <<
" (ins R1Regs:$src, i64imm:$val), \"\", []>;" << std::endl
8457 <<
"def PRED_TRUE_XORbicmp: InstTCE<(outs R1Regs:$dst),"
8458 <<
" (ins R1Regs:$pred, R1Regs:$src, i64imm:$val), \"\", []>;" << std::endl
8459 <<
"def PRED_FALSE_XORbicmp: InstTCE<(outs R1Regs:$dst),"
8460 <<
" (ins R1Regs:$pred, R1Regs:$src, i64imm:$val), \"\", []>;" << std::endl;
8462 o <<
"def: Pat <(i64 (anyext R1Regs:$src)), (ANDext R1Regs:$src, 1)>;" << std::endl
8463 <<
"def: Pat <(i64 (zext R1Regs:$src)), (ANDext R1Regs:$src, 1)>;" << std::endl;
8465 o <<
"// select of 1 or 0." << std::endl
8466 <<
"def : Pat<(i64 (select R1Regs:$c, (i64 1), (i64 0))), (ANDext R1Regs:$c, 1)>;" << std::endl;
8469 <<
"def: Pat <(i64 (sext R1Regs:$src)), (SUB64sas 0,(ANDext R1Regs:$src, 1))>;"
8472 o <<
"// ------ Shift (emulation) patterns. " << std::endl
8473 <<
"def: Pat <(i64 (shl R64IRegs:$val, (i64 1))),"
8474 <<
" (ADD64sss R64Regs:$val, R64Regs:$val)>;" << std::endl
8475 <<
"def: Pat <(i64 (TCESHLConst R64IRegs:$val, (i64 1))),"
8476 <<
" (ADD64sss R64IRegs:$val, R64IRegs:$val)>;" << std::endl;
8478 o <<
"// ----- Global addresses, constant pool entries ------" << std::endl
8479 <<
"def TCEGlobalAddr : SDNode<\"TCEISD::GLOBAL_ADDR\", SDTIntUnaryOp>;" << std::endl
8480 <<
"def TCEConstPool : SDNode<\"TCEISD::CONST_POOL\", SDTIntUnaryOp>;" << std::endl
8481 <<
"def : Pat<(TCEGlobalAddr tglobaladdr:$in), (MOVI64sa tglobaladdr:$in)>;" << std::endl
8482 <<
"def : Pat<(TCEGlobalAddr tconstpool:$in), (MOVI64sa tconstpool:$in)>;" << std::endl
8483 <<
"def : Pat<(TCEConstPool tglobaladdr:$in), (MOVI64sa tglobaladdr:$in)>;" << std::endl
8484 <<
"def : Pat<(TCEConstPool tconstpool:$in), (MOVI64sa tconstpool:$in)>;" << std::endl;
8486 o <<
"// some peephole patterns." << std::endl
8487 <<
"// 1-bit select with imm values - xor or mov." << std::endl
8488 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 0), (i1 -1))), (XOR64bbj R1Regs:$c, 1)>;" << std::endl
8489 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 -1), (i1 0))), (MOVI1rr R1Regs:$c)>;" << std::endl
8490 <<
"def : Pat<(i1 (select R1Regs:$c, (i1 -1), R1Regs:$F)), (IOR64bbb R1Regs:$c, R1Regs:$F)>;" << std::endl
8491 <<
"def : Pat<(i1 (select R1Regs:$c, R1Regs:$T, (i1 0))), (AND64bbb R1Regs:$c, R1Regs:$T)>;" << std::endl;
8493 o <<
"// 1-bit comparison between booleans - xor or xnor(implemented with 2 xors)" << std::endl
8494 <<
"def : Pat<(i1 (setne R1Regs:$op1, R1Regs:$op2)), (XOR64bbb R1Regs:$op1, R1Regs:$op2)>;" << std::endl
8495 <<
"// TODO: should the temp values be converted to i64? usually more i64 regs." << std::endl
8496 <<
"def : Pat<(i1 (seteq R1Regs:$op1, R1Regs:$op2)), (XOR64bbj (XOR64bbb R1Regs:$op1, R1Regs:$op2), 1)>;" << std::endl;
8498 o <<
"def TCEBlockAddress : SDNode<\"TCEISD::BLOCK_ADDR\", SDTIntUnaryOp>;" << std::endl
8499 <<
"def : Pat<(TCEBlockAddress tblockaddress:$src1), (MOVI64sa tblockaddress:$src1)>;" << std::endl;
References TTAMachine::Machine::is64bit(), and mach_.
Referenced by writeInstrInfo().
◆ writeMoveImmediateDefs()
void TDGen::writeMoveImmediateDefs |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes immediate operand definitions that are used for MOV instructions.
Creates immediate operand definitions for immediate to register instructions (MOVI), that only accept supported immediate values.
- Note
- Implemented currently only for i32 registers.
Definition at line 701 of file TDGen.cc.
708 std::pair<int64_t, uint64_t> moveImm{ 0, 0 };
710 if (rf->width() != bits)
continue;
713 if (!MCC::busConnectedToRF(*bus, *rf)
714 || bus->immediateWidth() == 0) {
718 if (bus->immediateWidth() >= bits) {
719 moveImm.first = -(1ll << (bits-1));
720 moveImm.second = (1ll << bits)-1;
723 std::pair<int64_t, uint64_t> imm =
724 MathTools::bitsToIntegerRange<int64_t, uint64_t>(
725 bus->immediateWidth(),
728 moveImm.first = std::min(moveImm.first, imm.first);
729 moveImm.second = std::max(moveImm.second, imm.second);
736 int supportedWidth = it->supportedWidth(*iu);
737 if (supportedWidth >= bits) {
738 moveImm.first = -(1ll << (bits-1));
739 moveImm.second = (1ll << bits)-1;
742 std::pair<int64_t, uint64_t> imm =
743 MathTools::bitsToIntegerRange<int64_t, uint64_t>(
744 supportedWidth, iu->signExtends());
746 moveImm.first = std::min(moveImm.first, imm.first);
747 moveImm.second = std::max(moveImm.second, imm.second);
753 moveImm.first, moveImm.second));
756 moveImm.first, moveImm.second));
References TTAMachine::Machine::busNavigator(), immediatePredicate(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::is64bit(), mach_, TTAMachine::Machine::registerFileNavigator(), and writeImmediateDef().
Referenced by writeOperandDefs().
◆ writeOperandDefs()
void TDGen::writeOperandDefs |
( |
std::ostream & |
o | ) |
|
|
protected |
◆ writeOperationDef()
void TDGen::writeOperationDef |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
const std::string & |
operandTypes, |
|
|
const std::string & |
attrs, |
|
|
bool |
skipPattern, |
|
|
std::string |
backendPrefix = "" |
|
) |
| |
|
protected |
Writes a single operation def for single operation.
- Parameters
-
o | Output stream to write the definition to. |
op | Operation to write definition for. |
operandTypes | value types of operands. |
Definition at line 4608 of file TDGen.cc.
4612 assert (operandTypes.size() > 0);
4620 <<
"Skipped writing operation pattern for: "
4621 << op.
name() + operandTypes
4622 <<
": Can not have immediate operand."
4630 std::string outputs, inputs, asmstr, pattern;
4631 outputs =
"(outs" +
patOutputs(op, operandTypes) +
")";
4632 inputs =
"(ins " +
patInputs(op, operandTypes) +
")";
4633 std::string predicatedInputs =
4634 "(ins GuardRegs:$pred, " +
patInputs(op, operandTypes)+
")";
4652 o <<
"let" << attrs <<
" in { " << std::endl;
4655 std::string opcEnum =
4658 o <<
"def " << opcEnum <<
" : "
4663 if(operandTypes[0] ==
'b') {
4664 o <<
"[" << pattern <<
"]>"
4666 <<
"{ let isCompare = 1;}" << std::endl;
4668 o <<
"[" << pattern <<
"]>;"
4674 if (opCanBePredicated) {
4676 o <<
"def PRED_TRUE_" << opcEnum <<
" : "
4679 << predicatedInputs <<
", "
4684 o <<
"def PRED_FALSE_" << opcEnum <<
" : "
4687 << predicatedInputs <<
", "
4694 o <<
"}" << std::endl;
4698 if (opCanBePredicated) {
4699 opNames_[
"PRED_TRUE_" + opcEnum] =
"?" + backendPrefix + op.
name();
4700 opNames_[
"PRED_FALSE_" + opcEnum] =
"!" + backendPrefix + op.
name();
References areImmediateOperandsLegal(), assert, canBePredicated(), createTrivialDAG(), Operation::dagCount(), falsePredOps_, getMatchableOperationDAG(), TTAMachine::Machine::is64bit(), llvmOperationPattern(), Application::logStream(), mach_, Operation::name(), operandChar(), operationPattern(), opNames_, OT_REG_INT, OT_REG_LONG, patInputs(), patOutputs(), StringTools::stringToUpper(), truePredOps_, Application::VERBOSE_LEVEL_DEFAULT, and Application::verboseLevel().
Referenced by writeOperationDefs(), and writeVectorOperationDef().
◆ writeOperationDefs() [1/2]
void TDGen::writeOperationDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
bool |
skipPattern |
|
) |
| |
|
protected |
Writes scalar operation definition(s).
- Parameters
-
o | Output stream to write the definition to. |
op | Operation to write definition for. |
skipPattern | True, if skip pattern generation. |
- Note
- This todo marking is from TDGen.
-
This todo marking is from TDGen.
Definition at line 4271 of file TDGen.cc.
4281 if (op.
name() !=
"LDQ" && op.
name() !=
"LDQU" &&
4282 op.
name() !=
"LDH" && op.
name() !=
"LDHU" &&
4283 op.
name() !=
"LDW" && op.
name() !=
"LDD" &&
4284 op.
name() !=
"STQ" && op.
name() !=
"STH" &&
4285 op.
name() !=
"STW" && op.
name() !=
"STD" &&
4286 op.
name() !=
"ALDQ" && op.
name() !=
"ALDQU" &&
4287 op.
name() !=
"ALDH" && op.
name() !=
"ALDHU" &&
4288 op.
name() !=
"ALDW" && op.
name() !=
"ALDD" &&
4289 op.
name() !=
"ASTQ" && op.
name() !=
"ASTH" &&
4290 op.
name() !=
"ASTW" && op.
name() !=
"ASTD" &&
4292 op.
name() !=
"LD8" && op.
name() !=
"LDU8" &&
4293 op.
name() !=
"LD16" && op.
name() !=
"LDU16" &&
4294 op.
name() !=
"LD32" && op.
name() !=
"LDU32" &&
4295 op.
name() !=
"LD64" &&
4296 op.
name() !=
"ST8" && op.
name() !=
"ST16" &&
4297 op.
name() !=
"ST32" && op.
name() !=
"ST64" &&
4298 op.
name() !=
"ALD8" && op.
name() !=
"ALDU8" &&
4299 op.
name() !=
"ALD16" && op.
name() !=
"ALDU16" &&
4300 op.
name() !=
"ALD32" && op.
name() !=
"ALDU32" &&
4301 op.
name() !=
"ALD64" &&
4302 op.
name() !=
"AST8" && op.
name() !=
"AST16" &&
4303 op.
name() !=
"AST32" && op.
name() !=
"AST64" &&
4304 op.
name() !=
"CAS") {
4312 if (op.
name() ==
"CFI" || op.
name() ==
"CFIU") {
4317 if (op.
name() ==
"CDL" || op.
name() ==
"CDLU") {
4322 if (op.
name() ==
"CLD" || op.
name() ==
"CLDU") {
4328 if (op.
name() ==
"CFD") {
4334 if (op.
name() ==
"CDF") {
4340 if (op.
name() ==
"ROTL" || op.
name() ==
"ROTR" ||
4341 op.
name() ==
"SHL" || op.
name() ==
"SHR" || op.
name() ==
"SHRU") {
4346 if (op.
name() ==
"SXHW" || op.
name() ==
"SXQW") {
4351 if (op.
name() ==
"SXW64" || op.
name() ==
"ZXW64") {
4358 if (op.
name() ==
"XOR" || op.
name() ==
"IOR" || op.
name() ==
"AND" ||
4359 op.
name() ==
"ANDN" || op.
name() ==
"ADD" || op.
name() ==
"SUB" ||
4360 op.
name() ==
"XOR64" || op.
name() ==
"IOR64" || op.
name() ==
"AND64") {
4364 if (op.
name() ==
"SELECT") {
4394 std::cerr <<
"The target architecture has both"
4395 <<
"conditional moves and select instruction."
4396 <<
"Ignoring select and using conditional moves instead"
References createDefaultOperandTypeString(), hasConditionalMoves_, hasSelect_, TTAMachine::Machine::is64bit(), mach_, Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::operand(), OT_REG_BOOL, Operand::RAW_DATA, Operation::readsMemory(), Operand::SINT_WORD, Operand::SLONG_WORD, Operand::type(), Operand::UINT_WORD, Operand::ULONG_WORD, writeOperationDef(), and Operation::writesMemory().
Referenced by writeInstrInfo().
◆ writeOperationDefs() [2/2]
void TDGen::writeOperationDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
const std::string & |
operandTypes, |
|
|
const std::string & |
attrs, |
|
|
bool |
skipPattern, |
|
|
std::string |
backendPrefix = "" |
|
) |
| |
|
protected |
◆ writeOperationDefUsingGivenOperandTypes()
Writes operation definition using given operand types.
Changes the operands to match the provided ones, after which a definition is written. Finally, original operands are restored.
- Parameters
-
o | Output stream. |
op | Operation used to create new operation definitions. |
skipPattern | If true, operation pattern writing is skipped. |
inputs | Input operand types for the new operation. |
outputs | Output operand types for the new operation. |
instrSuffix | Optional suffix that will be added to instruction name. |
Definition at line 1840 of file TDGen.cc.
1849 "Given input operand count doesn't match operation's count.");
1852 "Given output operand count doesn't match operation's count.");
1854 std::vector<ValueType> oldInputs;
1855 std::vector<ValueType> oldOutputs;
1870 oldOutputs.push_back(
ValueType(output));
References assert, createDefaultOperandTypeString(), Operation::input(), Operation::numberOfInputs(), Operation::numberOfOutputs(), TDGenerator::ValueType::operandType(), Operation::output(), Operand::setElementCount(), Operand::setElementWidth(), Operand::setType(), TDGenerator::ValueType::subwCount_, TDGenerator::ValueType::subwWidth_, and writeVectorOperationDef().
Referenced by writeScalarOperationExploitations(), writeVectorBitwiseOperationDefs(), and writeVectorLoadStoreOperationExploitations().
◆ writePatternReplacement()
void TDGen::writePatternReplacement |
( |
std::ostream & |
o, |
|
|
const TCEString & |
origPat, |
|
|
const TCEString & |
replacerPat |
|
) |
| const |
|
protected |
◆ writePortGuardedJumpDefPair()
bool TDGen::writePortGuardedJumpDefPair |
( |
std::ostream & |
os, |
|
|
const TCEString & |
tceop1, |
|
|
const TCEString & |
tceop2, |
|
|
bool |
fp = false |
|
) |
| |
|
protected |
Definition at line 3841 of file TDGen.cc.
3847 TCEString regclass = fp ?
"R32FPRegs" :
"R32IRegs";
3851 os << std::endl <<
"let isTerminator = 1, isBranch = 1 in {" << std::endl;
3854 regclass +
":$cmp1, "+ regclass +
":$cmp2, brtarget:$dst",
"",
3855 "(brcc "+ llvmop1 +
", "+ regclass +
":$cmp1, " + regclass +
":$cmp2, bb:$dst)");
3857 os <<
"}" << std::endl;
3859 opNames_[tceop1 +
"_JUMP"] = tceop1 +
"+?jump";
3861 opNames_[tceop1 +
"_JUMP"] = tceop2 +
"+!jump";
3864 std::cerr <<
"Missing "<< tceop1 <<
" operation as true-guard source"
3865 <<
" or " << tceop2 <<
" operation as invarted guard source to jump." << std::endl;
3872 os << std::endl <<
"let isTerminator = 1, isBranch = 1 in {" << std::endl;
3876 regclass +
":$cmp1, "+ regclass +
":$cmp2, brtarget:$dst",
"",
3877 "(brcc "+ llvmop2 +
", "+ regclass +
":$cmp1, " + regclass +
":$cmp2, bb:$dst)");
3879 os <<
"}" << std::endl;
3882 opNames_[tceop2 +
"_JUMP"] = tceop2 +
"+?jump";
3884 opNames_[tceop2 +
"_JUMP"] = tceop1 +
"+!jump";
3887 std::cerr <<
"Missing " << tceop2 <<
" operation as true-guard source"
3888 <<
" or " << tceop1 <<
" operation as inverted guard source to jump."
References llvmOperationName(), mach_, opNames_, MachineInfo::supportsPortGuardedJump(), TCEString::upper(), and writeInstrDef().
Referenced by writeCondBranchDefs().
◆ writeRARegisterInfo()
void TDGen::writeRARegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes return address register definition to the output stream.
Definition at line 3101 of file TDGen.cc.
3102 o <<
"class Rra<string n> : TCEReg<n, []>;" << std::endl;
3103 o <<
"def RA : Rra<\"return-address\">, ";
3104 o <<
"DwarfRegNum<[" <<
dregNum_++ <<
"]>;";
3107 o <<
"def RAReg : RegisterClass<\"TCE\", [i64], 64, (add RA)>;" <<
3110 o <<
"def RAReg : RegisterClass<\"TCE\", [i32], 32, (add RA)>;" <<
References dregNum_, TTAMachine::Machine::is64bit(), and mach_.
Referenced by writeRegisterInfo().
◆ writeRegisterClasses()
void TDGen::writeRegisterClasses |
( |
std::ostream & |
o | ) |
|
|
protected |
Definition at line 761 of file TDGen.cc.
763 o <<
"class R1<string n, list<Register> aliases> : TCEReg<n, aliases> {"
766 o <<
"class R32<string n, list<Register> aliases> : TCEReg<n, aliases> {"
769 o <<
"class R64<string n, list<Register> aliases> : TCEReg<n, aliases> {"
773 o <<
"class R16<string n, list<Register> aliases> : TCEReg<n, aliases> {"
Referenced by writeRegisterInfo().
◆ writeRegisterDef()
void TDGen::writeRegisterDef |
( |
std::ostream & |
o, |
|
|
const RegInfo & |
reg, |
|
|
const std::string |
regName, |
|
|
const std::string |
regTemplate, |
|
|
const std::string |
aliases, |
|
|
RegType |
type |
|
) |
| |
|
protected |
Writes .td definition of a single register to the output stream.
- Parameters
-
o | Output stream to write the definition to. |
reg | Information about the physical register. |
regName | Name for the register in the llvm framework. |
regTemplate | Base class for the register. |
aliases | Comma-separated list of aliases for this register. |
Definition at line 448 of file TDGen.cc.
456 std::string templ = regTemplate;
458 o <<
"def " << regName <<
" : " << templ
459 <<
"<\"" << reg.rf <<
"." << reg.idx
460 <<
"\", [" << aliases <<
"]>, DwarfRegNum<"
469 }
else if (type ==
RESULT) {
476 regs_[regName] = reg;
References argRegNames_, ARGUMENT, assert, dregNum_, GPR, gprRegNames_, guardedRegs_, guardRegTemplateName, TDGen::RegInfo::idx, llvmGuardRegs_, regs_, regsInClasses_, RESERVED, resRegNames_, RESULT, and TDGen::RegInfo::rf.
Referenced by write16bitRegisterInfo(), write1bitRegisterInfo(), write32bitRegisterInfo(), write64bitRegisterInfo(), writeGuardRegisterClassInfo(), and writeVectorRegisterNames().
◆ writeRegisterInfo()
bool TDGen::writeRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes .td definitions of all registers in the machine to an output stream.
- Parameters
-
o | Output stream for the .td definitions. |
- Returns
- True, if the definitions were succesfully generated.
Definition at line 496 of file TDGen.cc.
References analyzeMachineRegisters(), analyzeMachineVectorRegisterClasses(), analyzeRegisters(), assert, associateRegistersWithVectorRegisterClasses(), checkRequiredRegisters(), gatherAllMachineOperations(), regs32bit_, requiredI32Regs_, write1bitRegisterInfo(), write32bitRegisterInfo(), write64bitRegisterInfo(), writeGuardRegisterClassInfo(), writeRARegisterInfo(), writeRegisterClasses(), writeStartOfRegisterInfo(), writeVectorRegisterBaseClasses(), writeVectorRegisterClasses(), and writeVectorRegisterNames().
Referenced by generateBackend().
◆ writeScalarOperationExploitations()
void TDGen::writeScalarOperationExploitations |
( |
std::ostream & |
o | ) |
|
|
protected |
This function writes scalar operation exploitations.
Some scalar operations can be exploited to execute vector operations. For instance, bitwise logical operations are same for any operand width. A 32-bit scalar XOR operation can execute bitwise exclusive OR operation for v32i1, v4i8 and v2i16 vector operands similarly as it does for i32 type.
Definition at line 2419 of file TDGen.cc.
2422 <<
"// Scalar operations exploited to execute small vector operations."
2429 std::vector<Operation*> scalarBitwiseOps;
2430 scalarBitwiseOps.push_back(&opPool.
operation(
"NOT"));
2431 scalarBitwiseOps.push_back(&opPool.
operation(
"AND"));
2432 scalarBitwiseOps.push_back(&opPool.
operation(
"IOR"));
2433 scalarBitwiseOps.push_back(&opPool.
operation(
"XOR"));
2434 scalarBitwiseOps.push_back(&opPool.
operation(
"NOT64"));
2435 scalarBitwiseOps.push_back(&opPool.
operation(
"AND64"));
2436 scalarBitwiseOps.push_back(&opPool.
operation(
"IOR64"));
2437 scalarBitwiseOps.push_back(&opPool.
operation(
"XOR64"));
2440 for (
size_t opI = 0; opI < scalarBitwiseOps.size(); ++opI) {
2452 std::vector<ValueType> intVecVts =
2453 ValueType::vectorTypesOfWidth(width,
true);
2455 for (
size_t i = 0; i < intVecVts.size(); ++i) {
2460 std::vector<ValueType> inputs;
2461 std::vector<ValueType> outputs;
2464 inputs.push_back(vecVt);
2467 outputs.push_back(vecVt);
2471 o, op,
false, inputs, outputs, vecVtStr);
2481 int memDataOpndWidth = 2;
2483 const char* defaultType =
mach_.
is64bit() ?
"i64" :
"i32";
2486 std::vector<ValueType> vecVts =
2487 ValueType::vectorTypesOfWidth(memDataOpndWidth);
2489 for (
size_t i = 0; i < vecVts.size(); ++i) {
2490 const ValueType& dataOpndVt = vecVts[i];
2495 if (memDataOpndWidth <= 8) {
2501 }
else if (memDataOpndWidth <= 16) {
2507 }
else if (memDataOpndWidth <= 32){
2518 std::cerr <<
"Warning: SIMD support with "
2519 <<
"big-endian adf is deprecated" << std::endl;
2523 std::vector<ValueType> inputs;
2524 std::vector<ValueType> outputs;
2527 inputs.push_back(
ValueType(defaultType));
2529 outputs.push_back(dataOpndVt);
2532 o, *op,
false, inputs, outputs, dataOpndVtStr);
2536 for (
size_t i = 0; i< vecVts.size(); ++i) {
2537 const ValueType& dataOpndVt = vecVts[i];
2542 if (memDataOpndWidth <= 8) {
2548 }
else if (memDataOpndWidth <= 16) {
2554 }
else if (memDataOpndWidth <= 32) {
2565 std::cerr <<
"Warning: SIMD support with "
2566 <<
"big-endian adf is deprecated" << std::endl;
2570 std::vector<ValueType> inputs;
2571 std::vector<ValueType> outputs;
2574 inputs.push_back(
ValueType(defaultType));
2575 inputs.push_back(dataOpndVt);
2579 o, *op,
false, inputs, outputs, dataOpndVtStr);
2584 memDataOpndWidth *= 2;
References TTAMachine::Machine::hasOperation(), hasRegisterClassSupport(), NullOperation::instance(), TTAMachine::Machine::is64bit(), littleEndian_, mach_, MAX_SCALAR_WIDTH, Operation::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), OperationPool::operation(), Operation::output(), TDGenerator::ValueType::valueTypeStr(), Operand::width(), and writeOperationDefUsingGivenOperandTypes().
Referenced by writeInstrInfo().
◆ writeScalarToVectorDefs()
void TDGen::writeScalarToVectorDefs |
( |
std::ostream & |
o | ) |
const |
|
protected |
Writes scalar_to_vector patterns for vector value types.
- Todo:
- Add i8 and i16 subword support once those types have RegisterClass support. For now, just skip generation for them.
Definition at line 2332 of file TDGen.cc.
2333 o << endl <<
"// Scalar to vector definitions." << endl;
2334 std::map<TCEString, TCEString>::const_iterator it;
2338 const TCEString& vbcastInstr = it->second;
2341 scalarVt.subwCount_ = 1;
2342 TCEString scalarVtStr = scalarVt.valueTypeStr();
2346 if (scalarVtStr ==
"f16" || scalarVtStr ==
"f32" ||
2347 scalarVtStr ==
"i32") {
2349 vtStr +
" (scalar_to_vector " + scalarVtStr +
":$in)";
2351 vbcastInstr +
" " + scalarVtStr +
":$in";
References TDGenerator::ValueType::subwCount_, TDGenerator::ValueType::valueTypeStr(), vbcastOperations_, and writePatternReplacement().
Referenced by writeInstrInfo().
◆ writeStartOfRegisterInfo()
void TDGen::writeStartOfRegisterInfo |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes static register info to the beginning of register info .td file.
- Parameters
-
o | Output stream to the file. |
Definition at line 539 of file TDGen.cc.
541 o <<
"// This file is generated automatically!" << endl;
542 o <<
"// Do not edit." << endl;
546 o <<
"class TCEReg<string n, list<Register> aliases> : "
550 o <<
" let Namespace = \"TCE\";" << endl;
551 o <<
" let Aliases = aliases;" << endl;
553 o <<
"class TCEVectorReg<string n, list<Register> subregs> : "
554 <<
"RegisterWithSubRegs<n, subregs> {"
556 <<
" let Namespace = \"TCE\";" << endl
Referenced by writeRegisterInfo().
◆ writeTopLevelTD()
void TDGen::writeTopLevelTD |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes a top level TCE.td file which includes generated .td definitions.
- Parameters
-
o | Output stream to the file. |
Definition at line 4190 of file TDGen.cc.
4191 o <<
"include \"Target.td\"" << std::endl;
4192 o <<
"include \"TCEItinerary.td\"" << std::endl;
4193 o <<
"include \"GenRegisterInfo.td\"" << std::endl;
4194 o <<
"include \"GenTCEInstrFormats.td\"" << std::endl;
4195 o <<
"include \"TCEInstrInfo.td\"" << std::endl;
4196 o <<
"include \"GenCallingConv.td\"" << std::endl;
4197 o <<
"def TCEInstrInfo : InstrInfo { }" << std::endl;
4198 o <<
"class Proc<string Name, SchedMachineModel Model,";
4199 o <<
" list<SubtargetFeature> Features>";
4200 o <<
" : ProcessorModel<Name, Model, Features>;";
4202 o <<
"def : Proc<\"generic\", TCEModelV0,[]>;";
4204 o <<
"def TCE : Target { let InstructionSet = TCEInstrInfo; }"
Referenced by generateBackend().
◆ writeVectorAnyextPattern()
void TDGen::writeVectorAnyextPattern |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
const TCEString & |
loadPatternName, |
|
|
int |
vectorLen |
|
) |
| |
|
protected |
◆ writeVectorBitConversions()
void TDGen::writeVectorBitConversions |
( |
std::ostream & |
o | ) |
const |
|
protected |
◆ writeVectorBitwiseOperationDefs()
void TDGen::writeVectorBitwiseOperationDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
bool |
skipPattern |
|
) |
| |
|
protected |
Writes bitwise NOT/AND/IOR/XOR operation definitions for vector operations.
For 32-bit or less vector widths, 32-bit base operation is used. For bitwise bool vector operations wider than 32 bits, corresponding bitwise operation is searched from the machine, and used to create operation definitions if it exists.
- Parameters
-
o | Output stream. |
op | Operation used to create bitwise operations. |
skipPattern | If true, operation pattern writing is skipped. |
Definition at line 2601 of file TDGen.cc.
2606 assert(
false &&
"Bitwise operation has 0 outputs.");
2610 std::vector<ValueType> vts = ValueType::vectorTypesOfWidth(opWidth);
2612 for (
size_t i = 0; i < vts.size(); ++i) {
2618 std::vector<ValueType> inputs;
2619 std::vector<ValueType> outputs;
2622 inputs.push_back(vecVt);
2625 outputs.push_back(vecVt);
2629 o, op, skipPattern, inputs, outputs, vecVtStr);
References assert, hasRegisterClassSupport(), TDGenerator::ValueType::isFloat_, Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::output(), TDGenerator::ValueType::valueTypeStr(), Operand::width(), and writeOperationDefUsingGivenOperandTypes().
Referenced by writeInstrInfo().
◆ writeVectorImmediateWriteDefs()
void TDGen::writeVectorImmediateWriteDefs |
( |
std::ostream & |
instrInfoTD | ) |
|
|
protected |
◆ writeVectorLoadDefs() [1/2]
void TDGen::writeVectorLoadDefs |
( |
std::ostream & |
o, |
|
|
const TCEString & |
opName, |
|
|
const TCEString & |
opNameSuffix, |
|
|
bool |
addrImm, |
|
|
const TCEString & |
resultType, |
|
|
const TCEString & |
loadPatternName, |
|
|
bool |
writePredicatedVersions |
|
) |
| |
|
protected |
◆ writeVectorLoadDefs() [2/2]
void TDGen::writeVectorLoadDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
const TCEString & |
loadPatternName, |
|
|
int |
vectorLen |
|
) |
| |
|
protected |
◆ writeVectorLoadStoreOperationExploitations()
void TDGen::writeVectorLoadStoreOperationExploitations |
( |
std::ostream & |
o | ) |
|
|
protected |
Attaches load and store operations to vector types that don't have them.
Checks first which vector value types don't have load and store operations for memory accessing. After collecting the value types without load/store, the function tries to search existing load/store instructions whose data operand width matches the vector value type that doesn't have a load/store operation. If the function can find matching memory instructions, it creates new memory instructions for the vector value types by exploiting existing matching memory instructions.
Definition at line 2648 of file TDGen.cc.
2651 const char* defaultTypeStr =
mach_.
is64bit() ?
"i64" :
"i32";
2654 std::set<TCEString> withoutLoadOperation;
2655 std::set<TCEString> withoutStoreOperation;
2659 std::map<TCEString, RegisterClass>::iterator it;
2668 withoutLoadOperation.insert(vtStr);
2672 withoutStoreOperation.insert(vtStr);
2677 o << endl <<
"// Define memory operations for vector operands without"
2678 << endl <<
"// load or store operation definition by exploiting"
2679 << endl <<
"// existing memory operations of proper width." << endl;
2683 std::set<TCEString>::const_iterator wLoadIt;
2684 for (wLoadIt = withoutLoadOperation.begin();
2685 wLoadIt != withoutLoadOperation.end(); ++wLoadIt) {
2686 const TCEString& dataOpndVtStr = *wLoadIt;
2689 bool foundExploitable =
false;
2690 std::map<TCEString, InstructionInfo>::const_iterator loadIt =
2696 const ValueType loadInstrVt(loadIt->first);
2700 if (vt.width() == loadInstrVt.width()) {
2701 foundExploitable =
true;
2702 const TCEString opName = (loadIt->second).osalOpName_;
2705 std::vector<ValueType> inputs;
2706 std::vector<ValueType> outputs;
2709 inputs.push_back(
ValueType(defaultTypeStr));
2711 outputs.push_back(dataOpndVtStr);
2714 o, op,
false, inputs, outputs, dataOpndVtStr);
2721 std::set<TCEString>::const_iterator wStoreIt;
2722 for (wStoreIt = withoutStoreOperation.begin();
2723 wStoreIt != withoutStoreOperation.end(); ++wStoreIt) {
2724 const TCEString& dataOpndVtStr = *wStoreIt;
2727 bool foundExploitable =
false;
2728 std::map<TCEString, InstructionInfo>::const_iterator storeIt =
2734 const ValueType storeInstrVt(storeIt->first);
2738 if (vt.width() == storeInstrVt.width()) {
2739 foundExploitable =
true;
2740 const TCEString opName = (storeIt->second).osalOpName_;
2743 std::vector<ValueType> inputs;
2744 std::vector<ValueType> outputs;
2747 inputs.push_back(
ValueType(defaultTypeStr));
2748 inputs.push_back(dataOpndVtStr);
2752 o, op,
false, inputs, outputs, dataOpndVtStr);
References TTAMachine::Machine::is64bit(), mach_, maxScalarWidth_, OperationPool::operation(), registerLoads_, registerStores_, vRegClasses_, TDGenerator::ValueType::width(), and writeOperationDefUsingGivenOperandTypes().
Referenced by writeInstrInfo().
◆ writeVectorMemoryOperationDefs()
void TDGen::writeVectorMemoryOperationDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
bool |
skipPattern |
|
) |
| |
|
protected |
Writes instruction definitions for memory vector operations.
Subword aligned LDQ/LDH/LDW/STQ/STH/STQ vector operations can be passed directly to writing vector operation definitions, but vector aligned LOAD and STORE operations can be used for several different vector types of the same width, thus, all the different vector types need to be covered and separate memory instruction have to be made for them.
Definition at line 2205 of file TDGen.cc.
References abortWithError.
Referenced by writeInstrInfo().
◆ writeVectorOperationDef()
void TDGen::writeVectorOperationDef |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
TCEString |
valueTypes, |
|
|
const TCEString & |
attributes, |
|
|
bool |
skipPattern |
|
) |
| |
|
protected |
Writes instruction of the vector operation to the .td file.
Creates register version and possibly an immediate version of the vector operation in case there are any scalar operands.
- Parameters
-
o | Output stream to the file. |
op | Operation to be written as an instruction to the .td file. |
valueTypes | Operand value type identifier characters. |
attributes | Operation attributes. |
skipPattern | True, if skip pattern creation. |
Definition at line 2125 of file TDGen.cc.
2132 "Warning: " + op.
name() + valueTypes +
2133 " was not created due to unsupported operands.");
2145 bool scalarsFound =
false;
2147 char& c = valueTypes[i];
2151 scalarsFound =
true;
2155 scalarsFound =
true;
2159 scalarsFound =
true;
2163 scalarsFound =
true;
References hasRegisterClassSupport(), Operation::name(), Operation::numberOfOutputs(), Operation::operandCount(), OT_IMM_BOOL, OT_IMM_FP, OT_IMM_HFP, OT_IMM_INT, OT_REG_BOOL, OT_REG_FP, OT_REG_HFP, OT_REG_INT, saveAdditionalVectorOperationInfo(), verbose(), and writeOperationDef().
Referenced by writeOperationDefUsingGivenOperandTypes().
◆ writeVectorOperationDefs()
void TDGen::writeVectorOperationDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
bool |
skipPattern |
|
) |
| |
|
protected |
Writes needed defitinion(s) of the vector operation to the .td file.
Creates 4 differend instructions of the operation at most:
- Integer version (register)
- Integer version (immediate)
- Float/half float version (register)
- Float/half float version (immediate)
- Parameters
-
o | Output stream to the .td file. |
op | Vector operation of which the definitions will be created. |
skipPattern | True, if skip pattern creation. |
Definition at line 2108 of file TDGen.cc.
References abortWithError.
Referenced by writeInstrInfo().
◆ writeVectorRegisterBaseClasses()
void TDGen::writeVectorRegisterBaseClasses |
( |
std::ostream & |
o | ) |
const |
|
protected |
Writes base class definitions to the .td file.
Definition at line 1991 of file TDGen.cc.
1993 <<
"// #################################" << endl
1994 <<
"// Vector register base class definitions" << endl;
1996 std::map<int, TCEString>::const_iterator bcIt;
1998 int width = bcIt->first;
2002 o <<
"class " << baseClassName
2003 <<
"<string n, list<Register> aliases> : "
2004 <<
"TCEVectorReg<n, aliases> {}" << endl;
2007 o <<
"// #################################" << endl;
References baseClasses_, and MAX_SCALAR_WIDTH.
Referenced by writeRegisterInfo().
◆ writeVectorRegisterClasses()
void TDGen::writeVectorRegisterClasses |
( |
std::ostream & |
o | ) |
const |
|
protected |
Writes register class definitions to the .td file.
Definition at line 2046 of file TDGen.cc.
2048 <<
"// #################################" << endl
2049 <<
"// Register class definitions for vector registers" << endl;
2051 std::map<TCEString, RegisterClass>::const_iterator it;
2058 std::string(
"The machine is missing registers for ") +
2060 " required by some operation(s).";
2062 std::cerr <<
"Error: Illegal machine: " << msg << std::endl;
2066 o <<
"def " << regClass.
name() <<
" : "
2067 <<
"RegisterClass<\"TCE\", "
2068 <<
"[" << vtStr <<
"], " << regClass.
alignment() <<
", (add ";
2085 o <<
"{" << endl <<
" let Size=8;" << endl <<
"}" << endl;
2091 o <<
"// #################################" << endl;
References TDGenerator::RegisterClass::alignment(), TDGenerator::RegisterClass::name(), TDGenerator::RegisterClass::numberOfRegisters(), TDGenerator::RegisterClass::registerInfo(), TDGenerator::RegisterInfo::regName_, THROW_EXCEPTION, TDGenerator::RegisterClass::valueType(), TDGenerator::ValueType::valueTypeStr(), vRegClasses_, and TDGenerator::ValueType::width().
Referenced by writeRegisterInfo().
◆ writeVectorRegisterMoveDefs()
void TDGen::writeVectorRegisterMoveDefs |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes MOV instructions between vector register classes.
Definition at line 2214 of file TDGen.cc.
2216 <<
"// Vector register->register move definitions." << endl
2217 <<
"let isAsCheapAsAMove = 1 in {" << endl;
2219 std::map<TCEString, RegisterClass>::const_iterator it;
2226 const TCEString outs =
"(outs " + regClass.
name() +
":$dst), ";
2227 const TCEString ins =
"(ins " + regClass.
name() +
":$src), ";
2229 "(ins GuardRegs:$pred, " + regClass.
name() +
":$src), ";
2230 const TCEString asmOp =
"\"$src -> $dst;\", []";
2232 o <<
"def " << opcode <<
" : "
2233 <<
"InstTCE<" << outs << ins << asmOp <<
">;" << endl;
2239 o <<
"def PRED_TRUE_" << opcode <<
" : "
2240 <<
"InstTCE<" << outs << insPred << asmOp <<
">;" << endl;
2242 o <<
"def PRED_FALSE_" << opcode <<
" : "
2243 <<
"InstTCE<" << outs << insPred << asmOp <<
">;" << endl;
2245 opNames_[
"PRED_TRUE_" + opcode] =
"?" + opcode;
2246 opNames_[
"PRED_FALSE_" + opcode] =
"!" + opcode;
References falsePredOps_, hasConditionalMoves_, movOperations_, TDGenerator::RegisterClass::name(), opNames_, truePredOps_, TDGenerator::RegisterClass::valueType(), TDGenerator::ValueType::valueTypeStr(), and vRegClasses_.
Referenced by writeInstrInfo().
◆ writeVectorRegisterNames()
void TDGen::writeVectorRegisterNames |
( |
std::ostream & |
o | ) |
|
|
protected |
◆ writeVectorStoreDefs() [1/2]
void TDGen::writeVectorStoreDefs |
( |
std::ostream & |
o, |
|
|
const TCEString & |
opName, |
|
|
const TCEString & |
opNameSuffix, |
|
|
bool |
addrImm, |
|
|
const TCEString & |
dataType, |
|
|
bool |
writePredicatedVersions |
|
) |
| |
|
protected |
◆ writeVectorStoreDefs() [2/2]
void TDGen::writeVectorStoreDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
int |
vectorLen |
|
) |
| |
|
protected |
◆ writeVectorTruncStoreDefs() [1/2]
void TDGen::writeVectorTruncStoreDefs |
( |
std::ostream & |
o | ) |
const |
|
protected |
Writes truncstore patterns for vector value types.
Definition at line 2262 of file TDGen.cc.
2263 o << endl <<
"// Vector truncstore definitions, needed below." << endl;
2271 std::map<TCEString, RegisterClass>::const_iterator rcIt;
2273 o <<
"def truncstore" << rcIt->first <<
" : "
2274 <<
"PatFrag<(ops node:$val, node:$ptr),"
2275 <<
"(truncstore node:$val, node:$ptr), "
2276 <<
"[{return cast<StoreSDNode>(N)->getMemoryVT() == "
2277 <<
"MVT::" << rcIt->first <<
";}]>;" << endl;
2282 o << endl <<
"// Pattern definitions for truncstores." << endl;
2283 std::vector<std::pair<const Operation*, TCEString>>::const_iterator it;
2285 const TCEString& truncInstr = it->second;
2287 ValueType::valueTypeStr(it->first->input(0));
2289 ValueType::valueTypeStr(it->first->output(0));
2291 std::map<TCEString, InstructionInfo>::const_iterator regStoreIt =
2296 const TCEString& regStoreInstr = (regStoreIt->second).instrName_;
2297 const TCEString originalPattern =
"truncstore" + targetVtStr +
2299 ":$op2, ADDRrr:$op1";
2303 regStoreInstr +
" ADDRrr:$op1, (" + truncInstr +
" " +
2304 regClass.
name() +
":$op2)";
2309 std::map<TCEString, InstructionInfo>::const_iterator immStoreIt =
2314 const TCEString& immStoreInstr = (immStoreIt->second).instrName_;
2315 const TCEString originalPattern =
"truncstore" + targetVtStr +
2317 ":$op2, ADDRri:$op1";
2321 immStoreInstr +
" ADDRri:$op1, (" + truncInstr +
" " +
2322 regClass.
name() +
":$op2)";
References immediateStores_, TDGenerator::RegisterClass::name(), registerStores_, truncOperations_, vRegClasses_, and writePatternReplacement().
Referenced by writeInstrInfo().
◆ writeVectorTruncStoreDefs() [2/2]
void TDGen::writeVectorTruncStoreDefs |
( |
std::ostream & |
o, |
|
|
Operation & |
op, |
|
|
int |
bitsize, |
|
|
int |
vectorLen |
|
) |
| |
|
protected |
◆ writeWiderVectorOperationExploitations()
void TDGen::writeWiderVectorOperationExploitations |
( |
std::ostream & |
o | ) |
|
|
protected |
Writes vector operation definitions that exploit bigger vector operations.
Exploited vector operands are written in ascending order by their subword count, meaning that e.g. ADD32X16, ADD32X32, and ADD32X4 operation exploitations are listed so that ADD32X4 are written first, then ADD32X16, and then ADD32X32. This way the instruction selection will first use ADD32X4 to execute vector addition for v2i32 vector operand types, and thus, is more optimal solution than executing the same v2i32 addition with ADD32X16 (though ADD32X4 would be also available in the machine).
Definition at line 2775 of file TDGen.cc.
References abortWithError.
◆ addOperations_
◆ allOpNames_
◆ andSameOperations_
Contains machine's ANDSAME instructions (<ValueType, InstrName>).
Definition at line 556 of file TDGen.hh.
◆ argRegCount_
unsigned int TDGen::argRegCount_ |
|
protected |
◆ argRegNames_
std::vector<std::string> TDGen::argRegNames_ |
|
protected |
◆ baseClasses_
◆ BOOL_SUBW_WIDTH
const int TDGen::BOOL_SUBW_WIDTH |
|
staticprotected |
Initial value:
Bool type subword width.
Definition at line 469 of file TDGen.hh.
◆ constantMaterializationPredicates_
std::vector<std::string> TDGen::constantMaterializationPredicates_ |
|
protected |
◆ dregNum_
◆ EXPLOIT_BIGGER_REGISTERS
const bool TDGen::EXPLOIT_BIGGER_REGISTERS = true |
|
staticprotected |
◆ extractElemOperations_
Contains machine's EXTRACTELEM instructions (<ValueType, InstrName>).
Definition at line 548 of file TDGen.hh.
◆ falsePredOps_
std::map<std::string, std::string> TDGen::falsePredOps_ |
|
protected |
◆ FP_SUBW_WIDTH
const int TDGen::FP_SUBW_WIDTH |
|
staticprotected |
◆ gatherOperations_
◆ gprRegNames_
std::vector<std::string> TDGen::gprRegNames_ |
|
protected |
◆ guardedRegs_
std::set<RegInfo> TDGen::guardedRegs_ |
|
protected |
◆ guardRegTemplateName
const std::string TDGen::guardRegTemplateName = "Guard" |
|
staticprotected |
◆ hasConditionalMoves_
bool TDGen::hasConditionalMoves_ |
|
protected |
◆ hasExBoolRegs_
bool TDGen::hasExBoolRegs_ |
|
protected |
◆ hasExIntRegs_
bool TDGen::hasExIntRegs_ |
|
protected |
◆ hasSelect_
◆ HFP_SUBW_WIDTH
const int TDGen::HFP_SUBW_WIDTH |
|
staticprotected |
◆ highestLaneBool_
int TDGen::highestLaneBool_ |
|
protected |
◆ highestLaneInt_
int TDGen::highestLaneInt_ |
|
protected |
◆ immediateLoads_
All immediate load operations (<ValueType, InstrInfo>).
Definition at line 529 of file TDGen.hh.
◆ immediateStores_
◆ immInfo_
◆ immOperandDefs_
std::map<ImmInfoKey, std::string> TDGen::immOperandDefs_ |
|
protected |
◆ iorOperations_
◆ iorSameOperations_
Contains machine's IORSAME instructions (<ValueType, InstrName>).
Definition at line 558 of file TDGen.hh.
◆ littleEndian_
bool TDGen::littleEndian_ |
|
protected |
Definition at line 612 of file TDGen.hh.
Referenced by createBoolAndHalfLoadPatterns(), createByteExtLoadPatterns(), createEndiannesQuery(), createShortExtLoadPatterns(), genGeneratedTCEPlugin_getLoad(), genGeneratedTCEPlugin_getStore(), llvmOperationName(), llvmOperationPattern(), writeBackendCode(), writeBooleanStorePatterns(), writeInstrInfo(), and writeScalarOperationExploitations().
◆ llvmGuardRegs_
std::vector<std::string> TDGen::llvmGuardRegs_ |
|
protected |
◆ mach_
Definition at line 459 of file TDGen.hh.
Referenced by analyzeMachineRegisters(), analyzeRegisters(), checkRequiredRegisters(), constantNodeString(), create32BitExtLoadPatterns(), createBoolAndHalfLoadPatterns(), createBranchAnalysis(), createByteExtLoadPatterns(), createConstShiftPatterns(), createEndiannesQuery(), createGetMaxMemoryAlignment(), createMinMaxGenerator(), createSelectPatterns(), createShortExtLoadPatterns(), emulatingOpNodeLLVMName(), gatherAllMachineOperations(), genGeneratedTCEPlugin_getLoad(), genGeneratedTCEPlugin_getStore(), genTCEInstrInfo_copyPhys64bitReg(), llvmOperationName(), llvmOperationPattern(), operandChar(), operandToString(), operationCanBeMatched(), TDGen(), write1bitRegisterInfo(), write32bitRegisterInfo(), write64bitRegisterInfo(), writeAddressingModeDefs(), writeBackendCode(), writeCallingConv(), writeCallSeqStart(), writeCondBranchDefs(), writeConstShiftPat(), writeEmulationPattern(), writeGetPointerAdjustmentQuery(), writeGuardRegisterClassInfo(), writeHWLoopDef(), writeInstrInfo(), writeIntegerImmediateDefs(), writeMiscPatterns(), writeMoveImmediateDefs(), writeOperationDef(), writeOperationDefs(), writePortGuardedJumpDefPair(), writeRARegisterInfo(), writeScalarOperationExploitations(), and writeVectorLoadStoreOperationExploitations().
◆ MAX_SCALAR_WIDTH
const int TDGen::MAX_SCALAR_WIDTH = 64 |
|
staticprotected |
◆ MAX_SUBW_COUNT
◆ maxScalarWidth_
int TDGen::maxScalarWidth_ |
|
protected |
◆ maxVectorSize_
int TDGen::maxVectorSize_ |
|
protected |
◆ movOperations_
◆ OPERATION_PATTERNS_
Contains <BaseOpName, OpPattern> key-value pairs.
Definition at line 502 of file TDGen.hh.
◆ opNames_
std::map<std::string, std::string> TDGen::opNames_ |
|
protected |
Definition at line 594 of file TDGen.hh.
Referenced by createBoolAndHalfLoadPatterns(), createBranchAnalysis(), createConstantMaterializationPatterns(), createMinMaxDef(), createMinMaxGenerator(), createSelectPatterns(), getLLVMPatternWithConstants(), writeBackendCode(), writeBooleanStorePatterns(), writeCondBranchDefs(), writeConstShiftPat(), writeGetPointerAdjustmentQuery(), writeHWLoopDef(), writeInstrInfo(), writeOperationDef(), writePortGuardedJumpDefPair(), writeVectorImmediateWriteDefs(), and writeVectorRegisterMoveDefs().
◆ OT_IMM_BOOL
const char TDGen::OT_IMM_BOOL = 'j' |
|
static |
◆ OT_IMM_FP
const char TDGen::OT_IMM_FP = 'k' |
|
static |
◆ OT_IMM_HFP
const char TDGen::OT_IMM_HFP = 'l' |
|
static |
◆ OT_IMM_INT
const char TDGen::OT_IMM_INT = 'i' |
|
static |
Definition at line 489 of file TDGen.hh.
Referenced by areImmediateOperandsLegal(), canBePredicated(), constantNodeString(), createByteExtLoadPatterns(), createShortExtLoadPatterns(), dagNodeToString(), emulatingOpNodeLLVMName(), getLLVMPatternWithConstants(), getMovePattern(), operandToString(), operandTypeToRegister(), patInputs(), regOperandCharToImmOperandChar(), and writeVectorOperationDef().
◆ OT_IMM_LONG
const char TDGen::OT_IMM_LONG = 'a' |
|
static |
◆ OT_REG_BOOL
const char TDGen::OT_REG_BOOL = 'b' |
|
static |
◆ OT_REG_DOUBLE
const char TDGen::OT_REG_DOUBLE = 'd' |
|
static |
◆ OT_REG_FP
const char TDGen::OT_REG_FP = 'f' |
|
static |
◆ OT_REG_HFP
const char TDGen::OT_REG_HFP = 'h' |
|
static |
◆ OT_REG_INT
const char TDGen::OT_REG_INT = 'r' |
|
static |
Definition at line 483 of file TDGen.hh.
Referenced by constantNodeString(), createByteExtLoadPatterns(), createShortExtLoadPatterns(), getMovePattern(), operandChar(), operandToString(), operandTypeToRegister(), operationCanBeMatched(), regOperandCharToImmOperandChar(), writeEmulationPattern(), writeOperationDef(), and writeVectorOperationDef().
◆ OT_REG_LONG
const char TDGen::OT_REG_LONG = 's' |
|
static |
◆ OT_VREG_BOOL
const char TDGen::OT_VREG_BOOL = 'a' |
|
static |
◆ OT_VREG_FP
const char TDGen::OT_VREG_FP = 'e' |
|
static |
◆ OT_VREG_HFP
const char TDGen::OT_VREG_HFP = 'g' |
|
static |
◆ OT_VREG_INT16
const char TDGen::OT_VREG_INT16 = 't' |
|
static |
◆ OT_VREG_INT32
const char TDGen::OT_VREG_INT32 = 'u' |
|
static |
◆ OT_VREG_INT8
const char TDGen::OT_VREG_INT8 = 'q' |
|
static |
◆ packOperations_
Contains machine's PACK instructions (<ValueType, InstrName>).
Definition at line 532 of file TDGen.hh.
◆ prebypassStackIndeces_
bool TDGen::prebypassStackIndeces_ |
|
protected |
◆ registerLoads_
◆ registers_
◆ registerStores_
◆ regs16bit_
std::vector<RegInfo> TDGen::regs16bit_ |
|
protected |
◆ regs1bit_
std::vector<RegInfo> TDGen::regs1bit_ |
|
protected |
◆ regs32bit_
std::vector<RegInfo> TDGen::regs32bit_ |
|
protected |
◆ regs64bit_
std::vector<RegInfo> TDGen::regs64bit_ |
|
protected |
◆ regs8bit_
std::vector<RegInfo> TDGen::regs8bit_ |
|
protected |
◆ regs_
std::map<std::string, RegInfo> TDGen::regs_ |
|
protected |
◆ regsInClasses_
◆ regsInRFClasses_
◆ requiredI32Regs_
unsigned int TDGen::requiredI32Regs_ |
|
protected |
◆ requiredI64Regs_
unsigned int TDGen::requiredI64Regs_ |
|
protected |
◆ resRegNames_
std::vector<std::string> TDGen::resRegNames_ |
|
protected |
◆ scalarOps_
◆ shlOperations_
◆ shlSameOperations_
Contains machine's SHLSAME instructions (<ValueType, InstrName>).
Definition at line 550 of file TDGen.hh.
◆ shrSameOperations_
Contains machine's SHRSAME instructions (<ValueType, InstrName>).
Definition at line 552 of file TDGen.hh.
◆ shruSameOperations_
Contains machine's SHRUSAME instructions (<ValueType, InstrName>).
Definition at line 554 of file TDGen.hh.
◆ tempRegFiles_
◆ truePredOps_
std::map<std::string, std::string> TDGen::truePredOps_ |
|
protected |
◆ truncOperations_
◆ use64bitForFP_
bool TDGen::use64bitForFP_ |
|
protected |
◆ vbcastOperations_
◆ vcshuffleOperations_
Contains machine's VCSHUFFLE instructions (<<ValueType, ConstantSelects>, InstrName>).
Definition at line 546 of file TDGen.hh.
◆ vectorOps_
◆ vRegClasses_
Contains required vector register classes (<ValueType, RegClass>).
Definition at line 520 of file TDGen.hh.
Referenced by analyzeMachineRegisters(), analyzeMachineVectorRegisterClasses(), associatedVectorRegisterClass(), associateRegistersWithVectorRegisterClasses(), createSelectPatterns(), createVectorRVDRegNums(), genGeneratedTCEPlugin_getLoad(), genGeneratedTCEPlugin_getStore(), genGeneratedTCEPlugin_getVectorImmediateOpcode(), genTCEInstrInfoSIMD_copyPhysVectorReg(), genTCERegisterInfo_setReservedVectorRegs(), genTCETargetLoweringSIMD_addVectorRegisterClasses(), genTCETargetLoweringSIMD_associatedVectorRegClass(), hasRegisterClassSupport(), writeCallingConv(), writeVectorBitConversions(), writeVectorImmediateWriteDefs(), writeVectorLoadStoreOperationExploitations(), writeVectorRegisterClasses(), writeVectorRegisterMoveDefs(), and writeVectorTruncStoreDefs().
◆ vselectOperations_
Contains machine's VSELECT instructions (<instrName, ValueType>).
Definition at line 538 of file TDGen.hh.
◆ vshuffle1Operations_
Contains machine's VSHUFFLE1 instructions (<ValueType, InstrName>).
Definition at line 540 of file TDGen.hh.
◆ vshuffle2Operations_
Contains machine's VSHUFFLE2 instructions (<ValueType, InstrName>).
Definition at line 542 of file TDGen.hh.
◆ xorSameOperations_
Contains machine's XORSAME instructions (<ValueType, InstrName>).
Definition at line 560 of file TDGen.hh.
The documentation for this class was generated from the following files:
unsigned int requiredI64Regs_
std::vector< std::string > gprRegNames_
void createEndiannesQuery(std::ostream &os)
TCEString regFileName_
Name of the register file the register belongs to, e.g. "RF".
bool writePortGuardedJumpDefPair(std::ostream &os, const TCEString &tceop1, const TCEString &tceop2, bool fp=false)
virtual NodeSet predecessors(const Node &node, bool ignoreBackEdges=false, bool ignoreForwardEdges=false) const
static const char OT_REG_FP
void genTCETargetLoweringSIMD_associatedVectorRegClass(std::ostream &o) const
std::pair< int64_t, int64_t > immediateValueBounds(const ImmInfoKey &key, int destWidth) const
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
virtual Edge & outEdge(const Node &node, const int index) const
virtual bool writesMemory() const
Operation & operation(const char *name)
static const char OT_REG_INT
const OperationDAG * getMatchableOperationDAG(const Operation &op)
void writeHWLoopDef(std::ostream &o)
void writeBooleanStorePatterns(std::ostream &os)
unsigned regIndex_
Register index in the register file.
bool hasOperation(const TCEString &opName) const
bool checkRequiredRegisters()
std::vector< std::string > resRegNames_
void createConstantMaterializationQuery(std::ostream &os)
void writeConstShiftPat(std::ostream &os, const TCEString &nodeName, const TCEString &opNameBase, int i)
void writeVectorRegisterClasses(std::ostream &o) const
virtual void setElementCount(int elementCount)
static const char OT_IMM_HFP
static const char OT_VREG_INT32
virtual Node & tailNode(const Edge &edge) const
bool canTakeImmediateByWidth(const Operation &operation, int inputOperandId, int bitWidth)
bool canBeImmediate(const OperationDAG &dag, const TerminalNode &node)
virtual TCEString name() const
std::map< TCEString, TDGenerator::InstructionInfo > immediateStores_
All immediate store operations (<ValueType, InstrInfo>).
virtual bool isReserved() const
void write64bitRegisterInfo(std::ostream &o)
virtual Node & headNode(const Edge &edge) const
virtual Operand & output(int index) const
RegisterInfo registerInfo(int index) const
ValueType valueType() const
unsigned int requiredI32Regs_
Minimum number of 32 bit registers.
size_t count(const ImmInfoKey &key) const
int registerIndex() const
static const char OT_VREG_BOOL
void writeVectorBitConversions(std::ostream &o) const
static const char OT_IMM_INT
virtual TCEString dagError(int index) const
std::string tceOperationPattern(const Operation &op)
std::string operationPattern(const Operation &op, const OperationDAG &dag, const std::string &operandTypes)
std::string createDefaultOperandTypeString(const Operation &op)
void createByteExtLoadPatterns(std::ostream &os)
void writeVectorRegisterNames(std::ostream &o)
std::set< OperationDAGNode *, typename OperationDAGNode ::Comparator > NodeSet
void writeCallDef(std::ostream &o)
void genGeneratedTCEPlugin_getIorOpcode(std::ostream &o) const
int subwCount_
Subword count of the value type.
std::vector< RegInfo > regs16bit_
static const unsigned REG_RENAMER_PART
TCEString associatedVectorRegisterClass(const Operand &operand) const
void addRegisters(const std::vector< RegisterInfo > ®isters)
std::map< std::string, std::string > truePredOps_
std::pair< std::string, int > ImmInfoKey
void writeOperationDefs(std::ostream &o, Operation &op, bool skipPattern)
virtual int width() const
virtual void setType(OperandType type)
void writeCallSeqStart(std::ostream &os)
static const int VERBOSE_LEVEL_DEFAULT
Default verbose level - do not print anything unnecessary.
static Operation & osalOperation(const TTAMachine::HWOperation &hwOp)
void writeInstrInfo(std::ostream &o)
virtual int numberOfInputs() const
void writeVectorImmediateWriteDefs(std::ostream &instrInfoTD)
virtual void setElementWidth(int elementWidth)
void analyzeMachineRegisters()
std::map< std::string, std::string > falsePredOps_
unsigned int argRegCount_
virtual void createVectorRVDRegNums(std::ostream &os)
static int verboseLevel()
Operation & referencedOperation() const
std::map< TCEString, Operation * > scalarOps_
Contains all scalar operations (<Name, Operation>).
virtual TCEString llvmOperationPattern(const Operation &op, char operandType=' ') const
static const char OT_REG_BOOL
static std::vector< std::string > supportedStackAccessOperations(const TTAMachine::Machine &mach)
static const char OT_VREG_HFP
virtual int elementWidth() const
void write32bitRegisterInfo(std::ostream &o)
static std::ostream & logStream()
virtual void addNode(Node &node)
void orderEqualWidthRegistersToRoundRobin()
std::set< RegInfo > guardedRegs_
List of register that are associated with a guard on a bus.
static const char OT_REG_LONG
virtual bool isOutput() const
static NullOperation & instance()
void writeScalarToVectorDefs(std::ostream &o) const
virtual TCEString name() const
void writeVectorRegisterMoveDefs(std::ostream &o)
void writeVectorOperationDefs(std::ostream &o, Operation &op, bool skipPattern)
static bool hasConditionalMoves(const TTAMachine::Machine &mach, const std::set< int > &rfWidths)
static const char OT_VREG_INT8
void genGeneratedTCEPlugin_getLoad(std::ostream &o) const
static std::string toString(const T &source)
void writeInstrDef(std::ostream &o, const std::string &instrDefName, const std::string &outs, const std::string &ins, const std::string &asmString, const std::string &pattern)
void writeVectorMemoryOperationDefs(std::ostream &o, Operation &op, bool skipPattern)
std::vector< RegInfo > regs8bit_
std::map< TCEString, TCEString > vbcastOperations_
Contains machine's VBCAST instructions (<ValueType, InstrName>).
bool isVectorStoreOperation(const Operation &op) const
std::map< TCEString, TCEString > shlOperations_
Contains machine's shl instructions (<ValueType, InstrName>).
bool areImmediateOperandsLegal(const Operation &operation, const std::string &operandTypes) const
virtual TCEString dagCode(int index) const
bool isVectorLoadOperation(const Operation &op) const
void writeGetPointerAdjustmentQuery(std::ostream &os) const
const OperationDAG::NodeSet & endNodes() const
static ImmInfoKey key(const Operation &operation, int inputOperandId)
virtual int outDegree(const Node &node) const
OperationDAGSelector::OperationSet allOpNames_
Contains all operation names in upper case.
bool isLittleEndian() const
virtual bool canSwap(int id1, int id2) const
static const char OT_VREG_INT16
void writeOperandDefs(std::ostream &o)
bool hasRegisterClassSupport(const Operation &op) const
#define assert(condition)
virtual bool isVector() const
bool hasConditionalMoves_
void genTCETargetLoweringSIMD_addVectorRegisterClasses(std::ostream &o) const
OperationDAG * createTrivialDAG(Operation &op)
std::map< TCEString, TDGenerator::RegisterClass > vRegClasses_
Contains required vector register classes (<ValueType, RegClass>).
void writeStartOfRegisterInfo(std::ostream &o)
void writeTopLevelTD(std::ostream &o)
std::map< TCEString, TDGenerator::InstructionInfo > registerStores_
All register store operations (<ValueType, InstrInfo>).
static OperationDAGList findDags(const std::string &opName, OperationSet opSet, const ImmInfo *immInfo=nullptr)
void writeCallingConvLicenceText(std::ostream &os)
virtual void createMinMaxGenerator(std::ostream &os)
std::set< const TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > tempRegFiles_
Register files whose last reg reserved for temp reg copies.
std::string immediatePredicate(int64_t lowerBoundInclusive, uint64_t upperBoundInclusive)
virtual ControlUnit * controlUnit() const
void writeIntegerImmediateDefs(std::ostream &o, const ImmInfo &iivis)
#define abortWithError(message)
RegClassMap regsInRFClasses_
const std::string & name() const
TCEString getLLVMPatternWithConstants(const Operation &op, const std::string &operandTypes, const std::string &operand0, const std::string &operand1) const
static bool supportsPortGuardedJump(const TTAMachine::Machine &machine, bool inverted, const TCEString &opName)
std::map< TCEString, TCEString > addOperations_
Contains machine's add instructions (<ValueType, InstrName>).
void writeAddressingModeDefs(std::ostream &o)
char regOperandCharToImmOperandChar(char c)
std::string operationNodeToString(const Operation &op, const OperationDAG &dag, const OperationNode &node, bool emulationPattern, const std::string &operandTypes)
virtual ImmediateUnitNavigator immediateUnitNavigator() const
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
void saveAdditionalVectorOperationInfo(const Operation &op, const TCEString &valueTypes, bool isRegisterOp)
int subwWidth_
Subword width of the value type.
void writeGuardRegisterClassInfo(std::ostream &o)
virtual Edge & inEdge(const Node &node, const int index) const
bool canBePredicated(Operation &op, const std::string &operandTypes)
void writeVectorLoadStoreOperationExploitations(std::ostream &o)
void writeOperationDef(std::ostream &o, Operation &op, const std::string &operandTypes, const std::string &attrs, bool skipPattern, std::string backendPrefix="")
virtual std::string operandToString(const Operand &operand, bool match, char operandType, const std::string &immDefName="")
static const int FP_SUBW_WIDTH
Float type subword width.
std::map< int, TCEString > baseClasses_
Contains vector base classes for register files (<Width, Name>).
void genTCERegisterInfo_setReservedVectorRegs(std::ostream &os) const
bool canTakeImmediate(const Operation &operation, int inputOperandId, int64_t value, int destWidth)
void writeArgRegsArray(std::ostream &os)
std::string subPattern(const Operation &op, const OperationDAG &dag)
virtual FunctionUnitNavigator functionUnitNavigator() const
std::map< TCEString, TCEString > gatherOperations_
Contains machine's GATHER instructions (<ValueType, InstrName>).
void genGeneratedTCEPlugin_getLoadOpcode(std::ostream &o) const
std::map< int, std::vector< TDGenerator::RegisterInfo > > registers_
Contains registers fit for being vector registers (<Width, Registers>).
virtual int index() const
void genGeneratedTCEPlugin_getStore(std::ostream &o) const
const TTAMachine::Machine & mach_
static OperationSet getOpset(const TTAMachine::Machine &mach)
TCEString regName_
Register name in GenRegisterInfo.td, e.g. "KLUDGE_REGISTER".
virtual int operationCount() const
void writeOperationDefUsingGivenOperandTypes(std::ostream &o, Operation &op, bool skipPattern, std::vector< TDGenerator::ValueType > inputs, std::vector< TDGenerator::ValueType > outputs, TCEString instrSuffix="")
virtual bool readsMemory() const
std::map< std::string, std::string > opNames_
void createBranchAnalysis(std::ostream &os)
bool isFloat_
If true, the value type is a floating point type.
static const int MAX_SCALAR_WIDTH
Distincts wide vs scalar registers.
virtual bool hasOperation(const std::string &name) const
static const bool EXPLOIT_BIGGER_REGISTERS
If set to true, smaller vector value types can be stored to larger register files,...
static const std::string guardRegTemplateName
TCETools::CIStringSet OperationSet
void writeRegisterDef(std::ostream &o, const RegInfo ®, const std::string regName, const std::string regTemplate, const std::string aliases, RegType type)
virtual bool isVectorOperation() const
bool prebypassStackIndeces_
virtual char operandChar(Operand &operand)
virtual int inDegree(const Node &node) const
virtual bool isOutput() const
virtual void writeImmediateDef(std::ostream &o, const std::string &defName, const std::string &operandType, const std::string &predicate)
Guard * guard(int index) const
virtual int portCount() const
RegClassMap regsInClasses_
All registers in certain group.
virtual int operandCount() const
std::vector< RegInfo > regs32bit_
static const int HFP_SUBW_WIDTH
Half float type subword width.
TCEString getMovePattern(const char &opdType, const std::string &inputPattern) const
void create32BitExtLoadPatterns(std::ostream &os)
void writeControlFlowInstrDefs(std::ostream &os)
static std::set< const TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > tempRegisterFiles(const TTAMachine::Machine &machine)
void writeRARegisterInfo(std::ostream &o)
bool writeRegisterInfo(std::ostream &o)
void writePatternReplacement(std::ostream &o, const TCEString &origPat, const TCEString &replacerPat) const
void createMinMaxDef(const TCEString &opName, const TCEString &valueName, std::ostream &os)
std::map< TCEString, Operation * > vectorOps_
Contains all vector operations (<Name, Operation>).
OperationDAG & smallestNodeCount() const
static const char OT_IMM_LONG
virtual Operand & input(int index) const
void writeVectorRegisterBaseClasses(std::ostream &o) const
void writeCallingConv(std::ostream &os)
virtual EdgeSet outEdges(const Node &node) const
void writeVectorTruncStoreDefs(std::ostream &o) const
virtual Operand & operand(int id) const
void analyzeMachineVectorRegisterClasses()
void verbose(const TCEString &msg) const
void setDestinationString(std::string &destination)
virtual RFPort * port(const std::string &name) const
virtual int dagCount() const
static const char OT_REG_DOUBLE
void writeBackendCode(std::ostream &o)
virtual RegisterFileNavigator registerFileNavigator() const
void writeCondBranchDefs(std::ostream &os)
void writeMoveImmediateDefs(std::ostream &o)
std::string immediateOperandNameForEmulatedOperation(const OperationDAG &, const Operand &operand)
void writeVectorOperationDef(std::ostream &o, Operation &op, TCEString valueTypes, const TCEString &attributes, bool skipPattern)
static const char OT_VREG_FP
void writeRegisterClasses(std::ostream &o)
virtual long value() const
virtual void createConstantMaterializationPatterns(std::ostream &os)
virtual OperandType type() const
std::vector< RegInfo > regs1bit_
std::map< std::string, RegInfo > regs_
Map of generated llvm register names to physical register in the machine.
std::string dagNodeToString(const Operation &op, const OperationDAG &dag, const OperationDAGNode &node, bool emulationPattern, const std::string &operandTypes, const Operation *emulatingOp=nullptr, const OperationDAGNode *successor=nullptr)
size_t numberOfRegisters() const
bool isVectorBitwiseOperation(const Operation &op) const
virtual BusNavigator busNavigator() const
void genGeneratedTCEPlugin_getShlOpcode(std::ostream &o) const
std::string patOutputs(const Operation &op, const std::string &oprTypes)
void writeInstrFormats(std::ostream &o)
void createVectorMinMaxDef(const TCEString &opName, int bits, char llvmTypeChar, const TCEString &postFix, std::ostream &os)
virtual void writeCallDefRegs(std::ostream &o)
void writeMachine(const TTAMachine::Machine &machine)
static bool supportsPortGuardedJumps(const TTAMachine::Machine &machine)
void gatherAllMachineOperations()
void createShortExtLoadPatterns(std::ostream &os)
virtual bool isInput() const
std::string constantNodeString(const Operation &op, const OperationDAG &dag, const ConstantNode &node, const std::string &operandTypes, const OperationDAGNode *successor=nullptr)
std::vector< std::string > constantMaterializationPredicates_
All predicates used in constant materialization patterns.
void writeScalarOperationExploitations(std::ostream &o)
std::map< TCEString, TDGenerator::InstructionInfo > registerLoads_
All register load operations (<ValueType, InstrInfo>).
std::vector< std::string > argRegNames_
std::string patInputs(const Operation &op, const std::string &oprTypes)
bool operationDAGCanBeMatched(const OperationDAG &op, std::set< std::string > *recursionCycleCheck=NULL, bool recursionHasStore=false)
std::map< TCEString, TCEString > iorOperations_
Contains machine's shl instructions (<ValueType, InstrName>).
ComponentType * item(int index) const
virtual HWOperation * operation(const std::string &name) const
virtual bool isAddress() const
void createParamDRegNums(std::ostream &os)
static int toInt(const T &source)
TCEString valueTypeStr() const
void writeVectorBitwiseOperationDefs(std::ostream &o, Operation &op, bool skipPattern)
std::vector< std::pair< const Operation *, TCEString > > truncOperations_
Contains machine's TRUNCxx/CFH instructions (<ValueType, InstrName>).
std::vector< std::string > llvmGuardRegs_
The LLVM register defs used as guards.
void createBoolAndHalfLoadPatterns(std::ostream &os)
std::string emulatingOpNodeLLVMName(const Operation &op, const OperationDAG &dag, const OperationNode &node, const std::string &operandTypes)
char operandTypeToRegister(const char &opdType) const
std::map< ImmInfoKey, std::string > immOperandDefs_
Maps (operation, operand) pairs to i32 immediate operand definition names.
void associateRegistersWithVectorRegisterClasses()
Operand::OperandType operandType() const
void writeMiscPatterns(std::ostream &o)
bool operationCanBeMatched(const Operation &op, std::set< std::string > *recursionCycleCheck=NULL, bool recursionHasStore=false)
void createConstShiftPatterns(std::ostream &os)
virtual NodeSet rootNodes() const
useful utility functions
virtual bool isInput() const
void genTCEInstrInfoSIMD_copyPhysVectorReg(std::ostream &o) const
virtual TCEString llvmOperationName(const TCEString &opName) const
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
virtual int width() const
static OperationDAGSelector::OperationSet llvmRequiredOpset(bool includeFloatOps, bool isLittleEndian, bool bits64)
const RegisterFile * registerFile() const
static bool supportsBoolRegisterGuardedJumps(const TTAMachine::Machine &machine)
void writeEmulationPattern(std::ostream &o, const Operation &op, const OperationDAG &dag)
virtual int numberOfOutputs() const
void write1bitRegisterInfo(std::ostream &o)
static int defaultElementWidth(OperandType type)
virtual OperationDAG & dag(int index) const
std::set< TCEString > movOperations_
Contains all moves between register classes (<InstrName>).
virtual int operandIndex() const
void genGeneratedTCEPlugin_getAddOpcode(std::ostream &o) const
std::vector< RegInfo > regs64bit_
void generateLoadStoreCopyGenerator(std::ostream &os)
virtual void createSelectPatterns(std::ostream &os)
virtual bool zeroRegister() const
std::string operandTypesToRegisters(const std::string &opdTypes) const
static const char OT_IMM_BOOL
static const char OT_IMM_FP
static const int MAX_SUBW_COUNT
Maximum number of subwords that any SIMD operation can have.
virtual const std::set< int > & swap() const
static const char OT_REG_HFP
void genTCETargetLoweringSIMD_getSetCCResultVT(std::ostream &o) const