proplong.cpp 20 KB

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