Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces the creaetion of reverse dominance frontier (RDF) to support dead code elimination (DCE). Method for implementing RDF is similar to that of dominance frontier (DF). The key difference is that RDF is computed on the reverse CFG. In other words, operations were performed on "prev[]" which in the basic block structure, now switched to operate on "next", "then_" and "else_". In the "dce_insn" function, mark useful instructions during the initial analysis of the current basic block. Continue identifying useful instructions by tracing back from the last assigned instruction of the both operands of the current "insn". In the "dce_sweep" function remove the useless instruction from the current "insn_list". If a branch instruction is encountered, remove it and reconnect the current basic block to its reverse immediate dominator. Before implementing DCE, compiling "src/main.c" resulted in an executable with 51,357 instructions for ARMv7-A. After DCE, the executable was 51,330 instructions. DCE reduced the executable by 27 instructions.
- Loading branch information