edu.ustc.cs.compile.arch.x86.regalloc
类 BasicBlockBuilder

java.lang.Object
  继承者 edu.ustc.cs.compile.arch.x86.regalloc.BasicBlockBuilder

public class BasicBlockBuilder
extends java.lang.Object

The algorithm to construct basic blocks for an procedure is quite simple: We scan the statement list from head to tail, if we discover a Label, then start a new basic block. if we disocver a conditional or unconditional jump instruction, we close a basic block. If a basic block's end is not a conditional or unconditional jump, we add one jump instruction (jump to next basic block's label) to the end of the basic block. We record all the preceeding and successing basic blocks for every BB. The initial basic block has no preceeding BBs. The algorithm is detailed in the Tiger book by Andrew W.Appel.


构造函数摘要
BasicBlockBuilder()
           
 
方法摘要
static java.util.List<BasicBlock> compressBB(java.util.List<BasicBlock> bbs)
          removes those BBs which are empty and unnecessary jump instructions and labels.
static java.util.List<BasicBlock> getBasicBlocks(AssemblySequence stmts)
          returns basic blocks of the input statements.
static void main(java.lang.String[] args)
          main test function.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造函数详细信息

BasicBlockBuilder

public BasicBlockBuilder()
方法详细信息

getBasicBlocks

public static java.util.List<BasicBlock> getBasicBlocks(AssemblySequence stmts)
                                                 throws java.lang.Exception
returns basic blocks of the input statements.

参数:
stmts - the assembly statements that we are going to get the basic blocks out of. stmts should be an intermediate representation of a sub-procedure in text segment, which means we do not process pseudo-directives.
返回:
a list of basic blocks, the first element is the initial basic block.
抛出:
java.lang.Exception

main

public static void main(java.lang.String[] args)
main test function.


compressBB

public static java.util.List<BasicBlock> compressBB(java.util.List<BasicBlock> bbs)
removes those BBs which are empty and unnecessary jump instructions and labels.