This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: dwarf2 bug. Was Re: reorder bug in 3.0


>> On Wed, Oct 10, 2001 at 08:00:07AM -0700, Andrew Macleod wrote:
>> > When the outer function is being processed, the nested function is not 
>> > referenced in either the BLOCK_VARS or BLOCK_SUBBLOCKS lists, so it
>> > never gets its parent field set.
>> 
>> Hmm.  I wonder if the original BLOCK that did contain the
>> nested function was removed due to being empty.
>> 
>> Look for the thing before the calls to remove_unnecessary_notes.

It looks like its in reorder_blocks:

  VARRAY_TREE_INIT (block_stack, 10, "block_stack");

  /* Reset the TREE_ASM_WRITTEN bit for all blocks.  */
  reorder_blocks_0 (block);

  /* Prune the old trees away, so that they don't get in the way.  */
  BLOCK_SUBBLOCKS (block) = NULL_TREE;
  BLOCK_CHAIN (block) = NULL_TREE;

  /* Recreate the block tree from the note nesting.  */
  reorder_blocks_1 (get_insns (), block, &block_stack);


After the call to reoder_block_0, its still in the subblock list:

 <block 0x2000000000356c80 used
    supercontext <function_decl 0x2000000000760e00 collate_output
        type <function_type 0x2000000000760fc0 type <void_type 0x2000000000326f40 void>
            TI
            size <integer_cst 0x2000000000328bc0 constant 128>
            unit size <integer_cst 0x2000000000329000 constant 16>
            align 128 symtab 0 alias set -1>
        public static DI file ugg.i line 37
        result <result_decl 0x2000000000760ee0 type <void_type 0x2000000000326f40 void>
            VOID file ugg.i line 37
            align 8 context <function_decl 0x2000000000760e00 collate_output>> initial <block 0x2000000000356c80>
        (mem:DI (symbol_ref/v:DI ("collate_output")) 0)
        chain <type_decl 0x2000000000760b60 type <record_type 0x2000000000760a80 locale_collate_t>
            VOID file ugg.i line 30
            align 1 chain <type_decl 0x20000000007609a0>>>
    subblocks <block 0x2000000000356c00 used
        vars <var_decl 0x2000000000761180 collate type <pointer_type 0x20000000007610a0>
            unsigned used common DI file ugg.i line 38
            size <integer_cst 0x20000000003290c0 constant 64>
            unit size <integer_cst 0x2000000000329180 constant 8>
            align 64 context <function_decl 0x2000000000760e00 collate_output>
            (reg/v/f:DI 340) chain <var_decl 0x2000000000761260 indirectpool>> supercontext <block 0x2000000000356c80>

        subblocks <block 0x2000000000356b80 used vars <function_decl 0x20000000007615e0 add_to_tablewc> supercontext <block 0x2000000000356c00>>>

    ^^ There is a reference to add_to_tablewc in this line:

    chain <block 0x2000000000356e00 used
        vars <var_decl 0x2000000000762300 __o type <pointer_type 0x200000000035bc60>
            unsigned used common DI file ugg.i line 14
            size <integer_cst 0x200000000075ddc0 constant 64>
            unit size <integer_cst 0x200000000075de00 constant 8>
            align 64 context <function_decl 0x2000000000760e00 collate_output> abstract_origin <var_decl 0x2000000000760540 __o> initial <var_decl 0x2000000000762060 obstack>
            (reg/v/f:DI 343)>
        chain <block 0x2000000000356d80 used
            chain <block 0x2000000000356d00 used vars <var_decl 0x2000000000762060 obstack> abstract_origin <function_decl 0x2000000000760380 obstack_int32_grow>>
            abstract_origin <block 0x2000000000355f80 asm_written used
                supercontext <block 0x2000000000356000 used supercontext <function_decl 0x2000000000760380 obstack_int32_grow> subblocks <block 0x2000000000355f80>>
                subblocks <block 0x2000000000355f00 asm_written used vars <var_decl 0x2000000000760540 __o> supercontext <block 0x2000000000355f80>>>> abstract_origin <block 0x2000000000355f00>>>


but after the call to reorder_blocks_1(), its no longer present.

Looking at reorder_blocks_1, there isn't going to be a NOTE for 
the blocks associated with the nested function. There is only
going to be a reference to its address, but it doesnt look like there is
any code present in reorder_blocks_1() that will find this block...
The only reference in the insn list that will be seen is:

  (insn 117 116 118 (set (reg:DI 364)
        (mem/u:DI (reg:DI 365) 0)) -1 (nil)
    (expr_list:REG_EQUAL (symbol_ref/v:DI ("add_to_tablewc.0"))
        (nil)))


so It ends up not getting rebuilt into the outer functions subblock list.

ick. Presumably that means we need to scan the block list looking for
blocks that are needed and that reorder_blocks_1 isn't going to find
and stick either stick them in the list first,or save them in append
them later?  other suggestions?  (maybe Im missing something)

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]