示例#1
0
文件: cfg.c 项目: genlu/js_analysis
/*
 * print detail info of given BasicBlock list
 */
void printBasicBlockList(ArrayList *blockList) {
  int i, sz = al_size(blockList);
  BasicBlock *block;

  printf("\nBasic Block List:\n");
  for (i = 0; i < sz; i++) {
	  block = (BasicBlock *)al_get(blockList, i);
    printBasicBlock(block);
  }
  printf("=================================================================\n");
}
示例#2
0
文件: branch.cpp 项目: gtanski/lljvm
/**
 * Print a loop.
 * 
 * @param l  the loop
 */
void JVMWriter::printLoop(const Loop *l) {
    printLabel(getLabelName(l->getHeader()));
    for(Loop::block_iterator i = l->block_begin(),
                             e = l->block_end(); i != e; i++) {
        const BasicBlock *block = *i;
        Loop *blockLoop = getAnalysis<LoopInfo>().getLoopFor(block);
        if(l == blockLoop)
            // the loop is the innermost parent of this block
            printBasicBlock(block);
        else if(block == blockLoop->getHeader()
                 && l == blockLoop->getParentLoop())
            // this block is the header of its innermost parent loop,
            // and the loop is the parent of that loop
            printLoop(blockLoop);
    }
    printSimpleInstruction("goto", getLabelName(l->getHeader()));
}