MEM_VOLATILE_P (ref) = TYPE_VOLATILE (type);
MEM_IN_STRUCT_P (ref) = AGGREGATE_TYPE_P (type);
RTX_UNCHANGING_P (ref)
- |= (lang_hooks.honor_readonly
- && (TYPE_READONLY (type) || TREE_READONLY (t)));
+ |= ((lang_hooks.honor_readonly
+ && (TYPE_READONLY (type) || TREE_READONLY (t)))
+ || (! TYPE_P (t) && TREE_CONSTANT (t)));
/* If we are making an object of this type, or if this is a DECL, we know
that it is a scalar if the type is not an aggregate. */
MEM_OFFSET (mem), MEM_SIZE (mem), align,
GET_MODE (mem));
}
+
+/* Set the decl for MEM to DECL. */
+
+void
+set_mem_decl (mem, decl)
+ rtx mem;
+ tree decl;
+{
+ MEM_ATTRS (mem)
+ = get_mem_attrs (MEM_ALIAS_SET (mem), decl, MEM_OFFSET (mem),
+ MEM_SIZE (mem), MEM_ALIGN (mem), GET_MODE (mem));
+}
\f
/* Return a memory reference like MEMREF, but with its mode changed to MODE
and its address changed to ADDR. (VOIDmode means don't change the mode.
/* Set the alignment of MEM to ALIGN bits. */
extern void set_mem_align PARAMS ((rtx, unsigned int));
+/* Set the DECL for MEM to DECL. */
+extern void set_mem_decl PARAMS ((rtx, tree));
+
/* Return a memory reference like MEMREF, but with its mode changed
to MODE and its address changed to ADDR.
(VOIDmode means don't change the mode.
*paddressp = 0;
- if (GET_CODE (op) == REG)
+ if (GET_CODE (op) == REG && ORIGINAL_REGNO (op) >= FIRST_PSEUDO_REGISTER)
return REGNO_DECL (ORIGINAL_REGNO (op));
else if (GET_CODE (op) != MEM)
return 0;
if (decl && DECL_NAME (decl))
{
- fprintf (asm_out_file, "%s %s%s",
- wrote ? "," : ASM_COMMENT_START, addressp ? "*" : "",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ fprintf (asm_out_file, "%c%s %s%s",
+ wrote ? ',' : '\t', wrote ? "" : ASM_COMMENT_START,
+ addressp ? "*" : "", IDENTIFIER_POINTER (DECL_NAME (decl)));
wrote = 1;
}
}
/* If we have any adjustment to make, or if the stack slot is the
wrong mode, make a new stack slot. */
- if (adjust != 0 || GET_MODE (x) != GET_MODE (regno_reg_rtx[i]))
- x = adjust_address_nv (x, GET_MODE (regno_reg_rtx[i]), adjust);
+ x = adjust_address_nv (x, GET_MODE (regno_reg_rtx[i]), adjust);
+
+ /* If we have a decl for the original register, set it for the
+ memory. If this is a shared MEM, make a copy. */
+ if (REGNO_DECL (i))
+ {
+ if (from_reg != -1 && spill_stack_slot[from_reg] == x)
+ x = copy_rtx (x);
+
+ set_mem_decl (x, REGNO_DECL (i));
+ }
/* Save the stack slot for later. */
reg_equiv_memory_loc[i] = x;