aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-09-26 20:40:25 +0000
committerRichard Stallman <rms@gnu.org>1992-09-26 20:40:25 +0000
commit28b039e3025d95c870e134eb24668ef0370175cc (patch)
tree35322dfb8cd3892293de24166ab81c05d4174de5 /gcc
parent68703794d6004427054a7562926ab7271978a59d (diff)
downloadgcc-28b039e3025d95c870e134eb24668ef0370175cc.zip
gcc-28b039e3025d95c870e134eb24668ef0370175cc.tar.gz
gcc-28b039e3025d95c870e134eb24668ef0370175cc.tar.bz2
(location_attribute): If DECL_RTL looks like (MEM pseudo),
treat that variable as optimized away. From-SVN: r2253
Diffstat (limited to 'gcc')
-rw-r--r--gcc/dwarfout.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c
index c9d5725..d282329 100644
--- a/gcc/dwarfout.c
+++ b/gcc/dwarfout.c
@@ -1478,7 +1478,19 @@ output_mem_loc_descriptor (rtl)
be referred to as a "base register". This distinction is not
based in any way upon what category of register the hardware
believes the given register belongs to. This is strictly
- Dwarf terminology we're dealing with here. */
+ Dwarf terminology we're dealing with here.
+
+ Note that in cases where the location of a memory-resident data
+ object could be expressed as:
+
+ OP_ADD (OP_BASEREG (basereg), OP_CONST (0))
+
+ the actual DWARF location descriptor that we generate may just
+ be OP_BASEREG (basereg). This may look deceptively like the
+ object in question was allocated to a register (rather than
+ in memory) so DWARF consumers need to be aware of the subtle
+ distinction between OP_REG and OP_BASEREG.
+ */
ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_BASEREG);
ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
@@ -1877,13 +1889,27 @@ location_attribute (rtl)
/* Handle a special case. If we are about to output a location descriptor
for a variable or parameter which has been optimized out of existence,
don't do that. Instead we output a zero-length location descriptor
- value as part of the location attribute. Note that we cannot simply
- suppress the entire location attribute, because the absence of a
- location attribute in certain kinds of DIEs is used to indicate some-
- thing entirely different... i.e. that the DIE represents an object
- declaration, but not a definition. So sayeth the PLSIG. */
+ value as part of the location attribute.
+
+ A variable which has been optimized out of existance will have a
+ DECL_RTL value which denotes a pseudo-reg.
+
+ Currently, in some rare cases, variables can have DECL_RTL values
+ which look like (MEM (REG pseudo-reg#)). These cases are due to
+ bugs elsewhere in the compiler. We treat such cases
+ as if the variable(s) in question had been optimized out of existance.
+
+ Note that in all cases where we wish to express the fact that a
+ variable has been optimized out of existance, we do not simply
+ suppress the generation of the entire location attribute because
+ the absence of a location attribute in certain kinds of DIEs is
+ used to indicate something else entirely... i.e. that the DIE
+ represents an object declaration, but not a definition. So sayeth
+ the PLSIG.
+ */
- if (! is_pseudo_reg (rtl))
+ if (! is_pseudo_reg (rtl)
+ && (GET_CODE (rtl) != MEM || ! is_pseudo_reg (XEXP (rtl, 0))))
output_loc_descriptor (eliminate_regs (rtl, 0, NULL_RTX));
ASM_OUTPUT_LABEL (asm_out_file, end_label);