Example #1
0
/*-----------------------------------------------------------------*/
static void 
addSuccessor (eBBlock * thisBlock, eBBlock * succ)
{
  /* check for boundary conditions */
  if (!thisBlock || !succ)
    return;

  /* add it to the succ of thisBlock */
  addSetIfnotP (&thisBlock->succList, succ);

  thisBlock->succVect =
    bitVectSetBit (thisBlock->succVect, succ->bbnum);
  /* add this edge to the list of edges */
  addSet (&graphEdges, newEdge (thisBlock, succ));

}
Example #2
0
/*-----------------------------------------------------------------*
 * void pCodeRegMapLiveRangesInFlow(pCodeFlow *pcfl)
 *-----------------------------------------------------------------*/
static void pCodeRegMapLiveRangesInFlow(pCodeFlow *pcfl)
{

  pCode *pc=NULL;
  pCode *pcprev=NULL;

  regs *reg;

  if(!pcfl)
    return;


  pc = pic16_findNextInstruction(pcfl->pc.next);

  while(pic16_isPCinFlow(pc,PCODE(pcfl))) {


    reg = pic16_getRegFromInstruction(pc);

    if(reg && (reg->type != REG_TMP)) {

#if 0
      fprintf(stderr, "reg= %p\n", reg);
      fprintf(stderr, "flow seq %d, inst seq %d  %s  ",PCODE(pcfl)->seq,pc->seq,reg->name);
      fprintf(stderr, "addr = 0x%03x, type = %d  rIdx=0x%03x ",
      	      reg->address,reg->type,reg->rIdx);
      fprintf(stderr, "command = %s\n", PCI(pc)->mnemonic);
      	      
#endif

//      fprintf(stderr, "%s:%d: trying to get first operand from pCode reg= %s\n", __FILE__, __LINE__, reg->name);
      addSetIfnotP(& (PCFL(pcfl)->registers), reg);

      if((PCC_REGISTER | PCC_LITERAL) & PCI(pc)->inCond)
	addSetIfnotP(& (reg->reglives.usedpFlows), pcfl);

      if(PCC_REGISTER & PCI(pc)->outCond)
	addSetIfnotP(& (reg->reglives.assignedpFlows), pcfl);

	addSetIfnotP(& (reg->reglives.usedpCodes), pc);

//    reg->wasUsed=1;

#if 1
	/* check to see if this pCode has 2 memory operands,
	   and set up the second operand too */
	if(PCI(pc)->is2MemOp) {
			reg = pic16_getRegFromInstruction2(pc);
			if(reg) {
//				fprintf(stderr, "%s:%d: trying to get second operand from pCode reg= %s\n", __FILE__, __LINE__, reg->name);
				addSetIfnotP(& (PCFL(pcfl)->registers), reg);

				if((PCC_REGISTER | PCC_LITERAL) & PCI(pc)->inCond)
					addSetIfnotP(& (reg->reglives.usedpFlows), pcfl);
					
				if((PCC_REGISTER | PCC_REGISTER2) & PCI(pc)->outCond)
					addSetIfnotP(& (reg->reglives.assignedpFlows), pcfl);
			
				addSetIfnotP(& (reg->reglives.usedpCodes), pc);
				
//				reg->wasUsed=1;
			}
	}
#endif

    }


    pcprev = pc;
    pc = pic16_findNextInstruction(pc->next);

  }

}