12 #include <boost/format.hpp>
63 newInstr->
addMove(std::make_shared<TTAProgram::Move>(
66 dstProcedure.
add(newInstr);
81 auto movePtr = std::make_shared<TTAProgram::Move>(
84 movePtr->addAnnotation(annotation);
87 dstProcedure.
add(newInstr);
117 for (
int i = 0; i < rf.
portCount(); i++) {
121 *rf.
port(i), regNum);
126 *rf.
port(i), regNum);
141 size_t findResult = name.find(
".");
143 if (findResult == std::string::npos) {
148 TCEString rfName = name.substr(0, findResult);
151 rf = regNav.
item(rfName);
153 name.substr(findResult + 1, name.length()-findResult+1));
175 if (dstTerminal->
isGPR()) {
180 if (width < defaultWidth) {
181 width = defaultWidth;
184 loadOp = (boost::format(
"ld%d") % width).str();
188 if (
opset_.count(loadOp) == 0) {
190 (boost::format(
"Operation %s not found in the machine") % loadOp)
219 if (srcTerminal->
isGPR()) {
223 if (width < defaultWidth) {
224 width = defaultWidth;
228 storeOp = (boost::format(
"st%d") % width).str();
232 if (
opset_.count(storeOp) == 0) {
234 (boost::format(
"Operation %s not found in the machine") % storeOp)
265 loadTerminal(dstProcedure, srcTerminal, dstRegTerminal);
510 pushToStack(dstProcedure, stackRegister, srcTerminal);
636 dstProcedure, jumpDestTerminal, jump1Terminal, annotation);
639 std::shared_ptr<TTAProgram::Move>
648 return std::make_shared<TTAProgram::Move>(jump0Terminal, jump1Terminal,
656 std::shared_ptr<TTAProgram::Move>
663 return std::make_shared<TTAProgram::Move>(
756 for(RegisterSet::const_iterator i = saveRegs.begin();
757 i != saveRegs.end(); i++) {
778 #ifdef ALL_STACK_PARAMETERS
788 #ifdef ALL_STACK_PARAMETERS
801 retVal->
add(yeldReturnInstruction);
807 for(RegisterSet::const_reverse_iterator i = saveRegs.rbegin();
808 i != saveRegs.rend(); i++) {
817 *yeldReturnInstruction,
820 retVal->
remove(*yeldReturnInstruction);
853 if (bus ==
nullptr) {
859 for (
int i = 0 ; i < bus->
guardCount(); i++) {
875 auto port = pg->
port();
878 for (
int i = 0 ; i < bus->
guardCount(); i++) {
882 if (pg2 && pg2->
port() == port &&
897 std::vector <ProgramOperationPtr>
899 const MoveNode* dynamicLimitMove,
int iterationCount,
int loopSize,
int divider) {
901 std::vector<ProgramOperationPtr> res;
903 if (divider & (divider-1)) {
907 const char* opName =
"lbufs";
916 loopSizeSV = loopSize;
935 if (dynamicLimitMove == NULL) {
937 iterCountSV = iterationCount;
941 bool decrement =
false;
942 bool increment =
false;
943 switch (iterationCount) {
949 if (iterationCount > 0)
961 TCEString adjustName = decrement ?
"sub" :
"add";
965 if (decrement || increment) {
967 subPO = std::make_shared<ProgramOperation>(subOp);
979 subPO->addInputNode(*subAmtMN);
983 subPO->addOutputNode(*iterCountMN);
986 res.push_back(subPO);
1000 shiftAmountSV = shiftAmount;
1016 shiftPO = std::make_shared<ProgramOperation>(shiftOp);
1017 shiftPO->addInputNode(*shiftValMN);
1018 shiftPO->addInputNode(*shiftAmtMN);
1023 res.insert(res.begin(),shiftPO);
1025 if (!(decrement||increment)) {
1027 shiftPO->addOutputNode(*iterCountMN);
1034 subPO->addInputNode(*shift2dec);
1037 shiftPO->addOutputNode(*shift2dec);
1041 if (decrement||increment) {
1046 subPO->addInputNode(*subValMN);
1056 loopBusInitOp->addInputNode(*iterCountMN);
1057 loopBusInitOp->addInputNode(*loopSizeMN);
1061 res.push_back(loopBusInitOp);
1084 const char* opName = rg->
isInverted() ?
"lbufc" :
"lbufz";
1096 *rg->registerFile(), rg->registerIndex(),
true);
1103 po->addInputNode(*loopSizeMN);
1117 const char* opName =
"infloop";
1130 loopSizeSV = loopSize;
1137 loopBufInitOp->addInputNode(*loopSizeMN);
1139 return loopBufInitOp;