BasicBlock.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "BasicBlock.h"
  2. #include "Procedure.h"
  3. #include "dcc.h"
  4. BB *BB::Create(void *ctx, const std::string &s, Function *parent, BB *insertBefore)
  5. {
  6. return new BB;
  7. }
  8. BB *BB::Create(Int start, Int ip, byte nodeType, Int numOutEdges, Function *parent)
  9. {
  10. parent->cfg;
  11. BB* pnewBB;
  12. pnewBB = new BB;
  13. pnewBB->nodeType = nodeType; /* Initialise */
  14. pnewBB->start = start;
  15. pnewBB->length = ip - start + 1;
  16. pnewBB->numOutEdges = (byte)numOutEdges;
  17. pnewBB->immedDom = NO_DOM;
  18. pnewBB->loopHead = pnewBB->caseHead = pnewBB->caseTail =
  19. pnewBB->latchNode= pnewBB->loopFollow = NO_NODE;
  20. if (numOutEdges)
  21. pnewBB->edges.resize(numOutEdges);
  22. /* Mark the basic block to which the icodes belong to, but only for
  23. * real code basic blocks (ie. not interval bbs) */
  24. if(parent)
  25. {
  26. if (start >= 0)
  27. parent->Icode.SetInBB(start, ip, pnewBB);
  28. parent->heldBBs.push_back(pnewBB);
  29. parent->cfg.push_back(pnewBB);
  30. }
  31. if (start != -1) /* Only for code BB's */
  32. stats.numBBbef++;
  33. return pnewBB;
  34. }