From: Richard Stallman Date: Sat, 29 Aug 1992 03:21:11 +0000 (+0000) Subject: (adjust_copied_decl_tree): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c75ac904f80c5db92690d13f9a941bc68d311c00;p=gcc.git (adjust_copied_decl_tree): New function. (save_for_inline_copying): When making copies of NOTE_INSN_BLOCK_END notes, stash a "forwarding" pointer in the original to point to the copy. Also, when all BLOCKs & insns for a function have been copied, call `adjust_copied_decl_tree' to fixup the end_note pointers in the copied BLOCKs. From-SVN: r1991 --- diff --git a/gcc/integrate.c b/gcc/integrate.c index ba03ecf5c49..ca915434a63 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -331,6 +331,30 @@ finish_inline (fndecl, head) DECL_INLINE (fndecl) = 1; } +/* Adjust the BLOCK_END_NOTE pointers in a given copied DECL tree so that + they all point to the new (copied) rtxs. */ + +static void +adjust_copied_decl_tree (block) + register tree block; +{ + register tree subblock; + register rtx original_end; + + original_end = BLOCK_END_NOTE (block); + if (original_end) + { + BLOCK_END_NOTE (block) = (rtx) NOTE_SOURCE_FILE (original_end); + NOTE_SOURCE_FILE (original_end) = 0; + } + + /* Process all subblocks. */ + for (subblock = BLOCK_SUBBLOCKS (block); + subblock; + subblock = TREE_CHAIN (subblock)) + adjust_copied_decl_tree (subblock); +} + /* Make the insns and PARM_DECLs of the current function permanent and record other information in DECL_SAVED_INSNS to allow inlining of this function in subsequent calls. @@ -509,8 +533,14 @@ save_for_inline_copying (fndecl) continue; copy = rtx_alloc (NOTE); - NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn); NOTE_LINE_NUMBER (copy) = NOTE_LINE_NUMBER (insn); + if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END) + NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn); + else + { + NOTE_SOURCE_FILE (insn) = (char *) copy; + NOTE_SOURCE_FILE (copy) = 0; + } break; case INSN: @@ -542,6 +572,8 @@ save_for_inline_copying (fndecl) last_insn = copy; } + adjust_copied_decl_tree (DECL_INITIAL (fndecl)); + /* Now copy the REG_NOTES. */ for (insn = NEXT_INSN (get_insns ()); insn; insn = NEXT_INSN (insn)) if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'