proplong.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /**************************************************************************
  2. * File : propLong.c
  3. * Purpose: propagate the value of long variables (local variables and
  4. * registers) along the graph. Structure the graph in this way.
  5. * (C) Cristina Cifuentes
  6. **************************************************************************/
  7. #include <string.h>
  8. #include <memory.h>
  9. #include <cassert>
  10. #include <algorithm>
  11. #include "dcc.h"
  12. /* Returns whether the given icode opcode is within the range of valid
  13. * high-level conditional jump icodes (iJB..iJG) */
  14. static boolT isJCond (llIcode opcode)
  15. {
  16. if ((opcode >= iJB) && (opcode <= iJG))
  17. return true;
  18. return false;
  19. }
  20. /* Returns whether the conditions for a 2-3 long variable are satisfied */
  21. static boolT isLong23 (iICODE iter, BB * pbb, Int *off, Int *arc)
  22. {
  23. BB * t, * e, * obb2;
  24. if (pbb->nodeType != TWO_BRANCH)
  25. return false;
  26. t = pbb->edges[THEN].BBptr;
  27. e = pbb->edges[ELSE].BBptr;
  28. /* Check along the THEN path */
  29. if ((t->size() == 1) && (t->nodeType == TWO_BRANCH) && (t->inEdges.size() == 1))
  30. {
  31. obb2 = t->edges[THEN].BBptr;
  32. if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) && (obb2->front().ic.ll.opcode == iCMP))
  33. {
  34. *off = std::distance(iter,obb2->begin2());
  35. *arc = THEN;
  36. return true;
  37. }
  38. }
  39. /* Check along the ELSE path */
  40. else if ((e->size() == 1) && (e->nodeType == TWO_BRANCH) && (e->inEdges.size() == 1))
  41. {
  42. obb2 = e->edges[THEN].BBptr;
  43. if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) && (obb2->front().ic.ll.opcode == iCMP))
  44. {
  45. *off = std::distance(iter,obb2->begin2());//obb2->front().loc_ip - i;
  46. *arc = ELSE;
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. /* Returns whether the conditions for a 2-2 long variable are satisfied */
  53. static boolT isLong22 (iICODE pIcode, iICODE pEnd, Int *off)
  54. {
  55. if(distance(pIcode,pEnd)<4)
  56. return false;
  57. // preincrement because pIcode is not checked here
  58. iICODE icodes[] = { ++pIcode,++pIcode,++pIcode };
  59. if ( icodes[1]->ic.ll.match(iCMP) &&
  60. (isJCond (icodes[0]->ic.ll.opcode)) &&
  61. (isJCond (icodes[2]->ic.ll.opcode)))
  62. {
  63. *off = 2;
  64. return true;
  65. }
  66. return false;
  67. }
  68. /** Creates a long conditional <=, >=, <, or > at (pIcode+1).
  69. * Removes excess nodes from the graph by flagging them, and updates
  70. * the new edges for the remaining nodes.
  71. * @return number of ICODEs to skip
  72. */
  73. static int longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, Int arc, Int off)
  74. {
  75. BB * pbb, * obb1, * obb2, * tbb;
  76. int skipped_insn=0;
  77. if (arc == THEN)
  78. {
  79. /* Find intermediate basic blocks and target block */
  80. pbb = pIcode->inBB;
  81. obb1 = pbb->edges[THEN].BBptr;
  82. obb2 = obb1->edges[THEN].BBptr;
  83. tbb = obb2->edges[THEN].BBptr;
  84. /* Modify out edge of header basic block */
  85. pbb->edges[THEN].BBptr = tbb;
  86. /* Modify in edges of target basic block */
  87. auto newlast=std::remove_if(tbb->inEdges.begin(),tbb->inEdges.end(),
  88. [obb1,obb2](BB *b) -> bool {
  89. return (b==obb1) || (b==obb2); });
  90. tbb->inEdges.erase(newlast,tbb->inEdges.end());
  91. tbb->inEdges.push_back(pbb); /* looses 2 arcs, gains 1 arc */
  92. /* Modify in edges of the ELSE basic block */
  93. tbb = pbb->edges[ELSE].BBptr;
  94. auto iter=std::find(tbb->inEdges.begin(),tbb->inEdges.end(),obb2);
  95. assert(iter!=tbb->inEdges.end());
  96. tbb->inEdges.erase(iter); /* looses 1 arc */
  97. /* Update icode index */
  98. skipped_insn = 5;
  99. }
  100. else /* ELSE arc */
  101. {
  102. /* Find intermediate basic blocks and target block */
  103. pbb = pIcode->inBB;
  104. obb1 = pbb->edges[ELSE].BBptr;
  105. obb2 = obb1->edges[THEN].BBptr;
  106. tbb = obb2->edges[THEN].BBptr;
  107. /* Modify in edges of target basic block */
  108. auto iter=std::find(tbb->inEdges.begin(),tbb->inEdges.end(),obb2);
  109. assert(iter!=tbb->inEdges.end());
  110. tbb->inEdges.erase(iter); /* looses 1 arc */
  111. /* Modify in edges of the ELSE basic block */
  112. tbb = obb2->edges[ELSE].BBptr;
  113. auto newlast=std::remove_if(tbb->inEdges.begin(),tbb->inEdges.end(),
  114. [obb1,obb2](BB *b) -> bool { return (b==obb1) || (b==obb2); });
  115. tbb->inEdges.erase(newlast,tbb->inEdges.end());
  116. tbb->inEdges.push_back(pbb); /* looses 2 arcs, gains 1 arc */
  117. /* Modify out edge of header basic block */
  118. pbb->edges[ELSE].BBptr = tbb;
  119. /* Update icode index */
  120. skipped_insn = 2;
  121. }
  122. iICODE atOffset(pIcode),atOffset1(pIcode),next1(++iICODE(pIcode));
  123. advance(atOffset,off);
  124. advance(atOffset1,off+1);
  125. /* Create new HLI_JCOND and condition */
  126. lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[atOffset1->ic.ll.opcode-iJB]);
  127. next1->setJCond(lhs);
  128. next1->copyDU(*pIcode, eUSE, eUSE);
  129. next1->du.use |= atOffset->du.use;
  130. /* Update statistics */
  131. obb1->flg |= INVALID_BB;
  132. obb2->flg |= INVALID_BB;
  133. stats.numBBaft -= 2;
  134. pIcode->invalidate();
  135. obb1->front().invalidate();
  136. // invalidate 2 first instructions of BB 2
  137. iICODE ibb2 = obb2->begin2();
  138. (ibb2++)->invalidate();
  139. (ibb2++)->invalidate();
  140. return skipped_insn;
  141. }
  142. /** Creates a long conditional equality or inequality at (pIcode+1).
  143. * Removes excess nodes from the graph by flagging them, and updates
  144. * the new edges for the remaining nodes.
  145. * @return number of ICODE's to skip
  146. */
  147. static int longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,iICODE pEnd)
  148. {
  149. Int j;
  150. BB * pbb, * obb1, * tbb;
  151. if(distance(pIcode,pEnd)<4)
  152. return false;
  153. // preincrement because pIcode is not checked here
  154. iICODE icodes[] = { pIcode++,pIcode++,pIcode++,pIcode++ };
  155. /* Form conditional expression */
  156. lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[icodes[3]->ic.ll.opcode - iJB]);
  157. icodes[1]->setJCond(lhs);
  158. icodes[1]->copyDU (*icodes[0], eUSE, eUSE);
  159. icodes[1]->du.use |= icodes[2]->du.use;
  160. /* Adjust outEdges[0] to the new target basic block */
  161. pbb = icodes[0]->inBB;
  162. if (pbb->back().loc_ip == icodes[1]->loc_ip)
  163. {
  164. /* Find intermediate and target basic blocks */
  165. obb1 = pbb->edges[THEN].BBptr;
  166. tbb = obb1->edges[THEN].BBptr;
  167. /* Modify THEN out edge of header basic block */
  168. pbb->edges[THEN].BBptr = tbb;
  169. /* Modify in edges of target basic block */
  170. auto iter=std::find(tbb->inEdges.begin(),tbb->inEdges.end(),obb1);
  171. assert(iter!=tbb->inEdges.end());
  172. tbb->inEdges.erase(iter);
  173. if (icodes[3]->ic.ll.opcode != iJE)
  174. tbb->inEdges.push_back(pbb); /* iJNE => replace arc */
  175. /* Modify ELSE out edge of header basic block */
  176. tbb = obb1->edges[ELSE].BBptr;
  177. pbb->edges[ELSE].BBptr = tbb;
  178. iter=std::find(tbb->inEdges.begin(),tbb->inEdges.end(),obb1);
  179. assert(iter!=tbb->inEdges.end());
  180. tbb->inEdges.erase(iter);
  181. if (icodes[3]->ic.ll.opcode == iJE) /* replace */
  182. tbb->inEdges.push_back(pbb);
  183. /* Update statistics */
  184. obb1->flg |= INVALID_BB;
  185. stats.numBBaft--;
  186. }
  187. icodes[0]->invalidate();
  188. icodes[2]->invalidate();
  189. icodes[3]->invalidate();
  190. return 4;
  191. }
  192. /* Propagates TYPE_LONG_(UN)SIGN icode information to the current pIcode
  193. * Pointer.
  194. * Arguments: i : index into the local identifier table
  195. * pLocId: ptr to the long local identifier
  196. * pProc : ptr to current procedure's record. */
  197. void Function::propLongStk (Int i, const ID &pLocId)
  198. {
  199. Int off, arc;
  200. Assignment asgn;
  201. //COND_EXPR *lhs, *rhs; /* Pointers to left and right hand expression */
  202. iICODE next1, pEnd;
  203. /* Check all icodes for offHi:offLo */
  204. pEnd = Icode.end();
  205. int stat_size=Icode.size();
  206. // for (idx = 0; idx < (Icode.size() - 1); idx++)
  207. for(auto pIcode = Icode.begin(); ;++pIcode)
  208. {
  209. assert(Icode.size()==stat_size);
  210. next1 = ++iICODE(pIcode);
  211. if(next1==pEnd)
  212. break;
  213. if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
  214. continue;
  215. if (pIcode->ic.ll.opcode == next1->ic.ll.opcode)
  216. {
  217. switch (pIcode->ic.ll.opcode)
  218. {
  219. case iMOV:
  220. if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, 1) == TRUE)
  221. {
  222. pIcode->setAsgn(asgn.lhs, asgn.rhs);
  223. next1->invalidate();
  224. }
  225. break;
  226. case iAND: case iOR: case iXOR:
  227. if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, 1) == TRUE)
  228. {
  229. switch (pIcode->ic.ll.opcode)
  230. {
  231. case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND); break;
  232. case iOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR); break;
  233. case iXOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, XOR); break;
  234. }
  235. pIcode->setAsgn(asgn.lhs, asgn.rhs);
  236. next1->invalidate();
  237. }
  238. break;
  239. case iPUSH:
  240. if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, 1) == TRUE)
  241. {
  242. pIcode->setUnary( HLI_PUSH, asgn.lhs);
  243. next1->invalidate();
  244. }
  245. break;
  246. } /*eos*/
  247. }
  248. /* Check long conditional (i.e. 2 CMPs and 3 branches */
  249. else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
  250. {
  251. if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, off) )
  252. {
  253. advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, off));
  254. }
  255. }
  256. /* Check for long conditional equality or inequality. This requires
  257. * 2 CMPs and 2 branches */
  258. else if ((pIcode->ic.ll.opcode == iCMP) && isLong22 (pIcode, pEnd, &off))
  259. {
  260. if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this,asgn, off) )
  261. {
  262. advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd));
  263. }
  264. }
  265. }
  266. }
  267. int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE beg)
  268. {
  269. Assignment asgn;
  270. LLOperand * pmH,* pmL;
  271. iICODE pIcode;
  272. riICODE rev(beg);
  273. bool forced_finish=false;
  274. for (; not forced_finish and rev!=Icode.rend();rev++) //idx = pLocId_idx - 1; idx > 0 ; idx--
  275. {
  276. pIcode = (++riICODE(rev)).base();//forward iterator from rev
  277. ICODE &icode(*pIcode);
  278. ICODE &next1(*(++iICODE(pIcode))); // next instruction
  279. if ((icode.type == HIGH_LEVEL) || (icode.invalid == TRUE))
  280. continue;
  281. if (icode.ic.ll.opcode != next1.ic.ll.opcode)
  282. continue;
  283. switch (icode.ic.ll.opcode)
  284. {
  285. case iMOV:
  286. pmH = &icode.ic.ll.dst;
  287. pmL = &next1.ic.ll.dst;
  288. if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
  289. {
  290. localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1//insert
  291. icode.setRegDU( pmL->regi, eDEF);
  292. asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
  293. asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, 1);
  294. icode.setAsgn(asgn.lhs, asgn.rhs);
  295. next1.invalidate();
  296. forced_finish=true; /* to exit the loop */
  297. }
  298. break;
  299. case iPOP:
  300. pmH = &next1.ic.ll.dst;
  301. pmL = &icode.ic.ll.dst;
  302. if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
  303. {
  304. asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
  305. icode.setRegDU( pmH->regi, eDEF);
  306. icode.setUnary(HLI_POP, asgn.lhs);
  307. next1.invalidate();
  308. asgn.lhs=0;
  309. forced_finish=true; /* to exit the loop */
  310. }
  311. break;
  312. // /**** others missing ***/
  313. case iAND: case iOR: case iXOR:
  314. pmL = &icode.ic.ll.dst;
  315. pmH = &next1.ic.ll.dst;
  316. if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
  317. {
  318. asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
  319. asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode/*idx*/, eUSE, 1);
  320. icode.setRegDU( pmH->regi, USE_DEF);
  321. switch (icode.ic.ll.opcode)
  322. {
  323. case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
  324. break;
  325. case iOR:
  326. asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR);
  327. break;
  328. case iXOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, XOR);
  329. break;
  330. } /* eos */
  331. icode.setAsgn(asgn.lhs, asgn.rhs);
  332. next1.invalidate();
  333. forced_finish=true; /* to exit the loop */
  334. }
  335. break;
  336. } /* eos */
  337. }
  338. return rev!=Icode.rend();
  339. }
  340. int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE beg)
  341. {
  342. bool forced_finish=false;
  343. auto pEnd=Icode.end();
  344. Assignment asgn;
  345. for (auto pIcode=beg; not forced_finish; ++pIcode)
  346. {
  347. iICODE next1(++iICODE(pIcode));
  348. if(next1==pEnd)
  349. break;
  350. LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
  351. int off,arc;
  352. if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
  353. continue;
  354. if (pIcode->ic.ll.opcode == next1->ic.ll.opcode)
  355. switch (pIcode->ic.ll.opcode)
  356. {
  357. case iMOV:
  358. if ((pLocId.id.longId.h == pIcode->ic.ll.src.regi) &&
  359. (pLocId.id.longId.l == next1->ic.ll.src.regi))
  360. {
  361. pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
  362. asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
  363. asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, 1);
  364. pIcode->setAsgn(asgn.lhs, asgn.rhs);
  365. next1->invalidate();
  366. forced_finish =true; /* to exit the loop */
  367. }
  368. break;
  369. case iPUSH:
  370. if ((pLocId.id.longId.h == pIcode->ic.ll.src.regi) &&
  371. (pLocId.id.longId.l == next1->ic.ll.src.regi))
  372. {
  373. asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
  374. pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
  375. pIcode->setUnary(HLI_PUSH, asgn.rhs);
  376. next1->invalidate();
  377. }
  378. forced_finish =true; /* to exit the loop */
  379. break;
  380. /*** others missing ****/
  381. case iAND: case iOR: case iXOR:
  382. pmL = &pIcode->ic.ll.dst;
  383. pmH = &next1->ic.ll.dst;
  384. if ((pLocId.id.longId.h == pmH->regi) &&
  385. (pLocId.id.longId.l == pmL->regi))
  386. {
  387. asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
  388. pIcode->setRegDU( pmH->regi, USE_DEF);
  389. asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
  390. LOW_FIRST, pIcode/*idx*/, eUSE, 1);
  391. switch (pIcode->ic.ll.opcode) {
  392. case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
  393. break;
  394. case iOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR);
  395. break;
  396. case iXOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, XOR);
  397. break;
  398. }
  399. pIcode->setAsgn(asgn.lhs, asgn.rhs);
  400. next1->invalidate();
  401. // ftw loop restart ????
  402. //idx = 0;
  403. // maybe this should end the loop instead
  404. forced_finish =true; /* to exit the loop */
  405. }
  406. break;
  407. } /* eos */
  408. /* Check long conditional (i.e. 2 CMPs and 3 branches */
  409. else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
  410. {
  411. if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn.rhs, asgn.lhs, off) == TRUE)
  412. {
  413. // reduce the advance by 1 here (loop increases) ?
  414. advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, off));
  415. }
  416. }
  417. /* Check for long conditional equality or inequality. This requires
  418. * 2 CMPs and 2 branches */
  419. else if (pIcode->ic.ll.match(iCMP) && (isLong22 (pIcode, pEnd, &off)))
  420. {
  421. if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn.rhs, asgn.lhs, off) == TRUE)
  422. {
  423. advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd) - 1);
  424. }
  425. }
  426. /* Check for OR regH, regL
  427. * JX lab
  428. * => HLI_JCOND (regH:regL X 0) lab
  429. * This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
  430. else if (pIcode->ic.ll.match(iOR) && (next1 != pEnd) && (isJCond (next1->ic.ll.opcode)))
  431. {
  432. if ((pIcode->ic.ll.dst.regi == pLocId.id.longId.h) && (pIcode->ic.ll.src.regi == pLocId.id.longId.l))
  433. {
  434. asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
  435. asgn.rhs = COND_EXPR::idKte (0, 4); /* long 0 */
  436. asgn.lhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, condOpJCond[next1->ic.ll.opcode - iJB]);
  437. next1->setJCond(asgn.lhs);
  438. next1->copyDU(*pIcode, eUSE, eUSE);
  439. pIcode->invalidate();
  440. }
  441. }
  442. } /* end for */
  443. }
  444. /** Finds the definition of the long register pointed to by pLocId, and
  445. * transforms that instruction into a HIGH_LEVEL icode instruction.
  446. * @arg i index into the local identifier table
  447. * @arg pLocId ptr to the long local identifier
  448. *
  449. */
  450. void Function::propLongReg (Int loc_ident_idx, const ID &pLocId)
  451. {
  452. /* Process all definitions/uses of long registers at an icode position */
  453. // WARNING: this loop modifies the iterated-over container.
  454. size_t initial_size=pLocId.idx.size();
  455. for (int j = 0; j < pLocId.idx.size(); j++)
  456. {
  457. auto idx_iter=pLocId.idx.begin();
  458. std::advance(idx_iter,j);
  459. /* Check backwards for a definition of this long register */
  460. if (findBackwarLongDefs(loc_ident_idx,pLocId,*idx_iter))
  461. {
  462. //assert(initial_size==pLocId.idx.size());
  463. continue;
  464. }
  465. /* If no definition backwards, check forward for a use of this long reg */
  466. findForwardLongUses(loc_ident_idx,pLocId,*idx_iter);
  467. //assert(initial_size==pLocId.idx.size());
  468. } /* end for */
  469. }
  470. /* Propagates the long global address across all LOW_LEVEL icodes.
  471. * Transforms some LOW_LEVEL icodes into HIGH_LEVEL */
  472. void Function::propLongGlb (Int i, const ID &pLocId)
  473. {
  474. printf("WARN: Function::propLongGlb not implemented");
  475. }
  476. /* Propagated identifier information, thus converting some LOW_LEVEL icodes
  477. * into HIGH_LEVEL icodes. */
  478. void Function::propLong()
  479. {
  480. Int i;
  481. /* Pointer to current local identifier */
  482. for (i = 0; i < localId.csym(); i++)
  483. {
  484. const ID &pLocId(localId.id_arr[i]);
  485. if ((pLocId.type==TYPE_LONG_SIGN) || (pLocId.type==TYPE_LONG_UNSIGN))
  486. {
  487. switch (pLocId.loc)
  488. {
  489. case STK_FRAME:
  490. propLongStk (i, pLocId);
  491. break;
  492. case REG_FRAME:
  493. propLongReg (i, pLocId);
  494. break;
  495. case GLB_FRAME:
  496. propLongGlb (i, pLocId);
  497. break;
  498. }
  499. }
  500. }
  501. }