On Wed, Jan 28, 2015 at 4:34 PM, Cary Coutant <ccout...@google.com> wrote: >>> > Not quite clear why we need block_table. This table is not gonna be >>> > emitted. And we can easily get subprog_entry through block->block_num >>> >>> When final_scan_insn() calls dwarf2out_begin_block(), all it passes is >>> a block number. I don't know a way to get from block number to the >>> block, so I traverse all the blocks of a function when >>> dwarf2out_begin_function() is called, and build this table. Now in >>> dwarf2out_source_line, I can look at the current block number and tell >>> what the inline call stack is. >> >> Is it correct that block_num has 1-1 mapping with block_table. And >> block_table has 1-1 mapping with logical_table? > > The first part, yes -- there's one entry in block_table for each > block_num in the function tree. But two or more blocks may map to a > single logical, and some blocks may not correspond to a logical at all > -- if dwarf2out_source_line() is never called for a block, I'll never > create a logical for it.
I don't understand why multiple blocks may map to a single logical_entry. Can you give an example? Thanks, Dehao > > -cary