On the 0x417 day of Apache Harmony Okonechnikov Konstantin wrote: > On 29 Mar 2008 15:11:14 +0300, Egor Pasko <[EMAIL PROTECTED]> wrote: > > > > Another idea: if you prefer not to start from the IRBuilder > > refactoring, there is an alternative way. The task is to separate > > JavaLabelPrepass into two passes: > > 1. marking basic blocks > > 2. data flow analysis > > > Well, I have decided to start with IRBuilder.
nice! I love that. > I suppose that developing the translator will require much more > time, truly > and it will be better not to interrupt this process. pretty logical :) > But if it is essentially to divide JavaLabelPrepass > at first, I could start with it. obviously, not essential, I would rather recomment to start from IRBuilder. > And I have some more questions: > 1) What for do we need LabelInst, there is a convention that LabelInst stands as the first instruction in each basic block, stores the block name, type and reference-to. You can find it in printed HIR like "I44:L13: bcmap:5" For example, you can write: (LabelInst*)node->getFirstInst())->isCatchLabel() to know if the block is a catch block. Catch blocks correspond to exception handlers. CatchLabelInst (which is a LabelInst in catch block) keeps information about the exact type of the exception handler) > what is IRBuilder::currentLabel? Is it some kind of node index? yes! IRBuilder is stateful, it appends instructions to the current node denoted by currentLabel. > ( IrBuilder::AppenInst uses it to get the node for appending > instructions) 2) As I understood CSE is a part of optimization. Do > we need to remove it? > > If yes, IrBuilder::CSEHashTable serves only this purpose, doesn't > it? yes, it is private. CSE is done locally in IRBuilder, cseHashTable is cleared on each new basic block. > 3) What for does Simplifier need to propgate source operands > copies? well, to always propagate is just a cheap optimization. Reduces expression sizes and makes successful cseHashTable searches more often. > Didn't find out yet how the translator interacts with IrBuilder, continue > working on this subject. -- Egor Pasko
