mirror of git://gcc.gnu.org/git/gcc.git
re PR target/53344 (Dont' emit an assembler warning when assembling 3-byte symbols)
PR target/53344 * config/avr/avr.c (avr_const_address_lo16): Remove. (avr_assemble_integer): Print ".byte lo8(x)", ".byte hi8(x)", ".byte hh8(x)" instead of emit an assembler .warning if 3-byte address is assembled. * doc/extend.texi (AVR Named Address Spaces): Document that binutils 2.23 is needed to assemble 3-byte addresses. From-SVN: r187470
This commit is contained in:
parent
6ba840107a
commit
5bb53d1a1d
|
@ -1,3 +1,13 @@
|
||||||
|
2012-05-14 Georg-Johann Lay <avr@gjlay.de>
|
||||||
|
|
||||||
|
PR target/53344
|
||||||
|
* config/avr/avr.c (avr_const_address_lo16): Remove.
|
||||||
|
(avr_assemble_integer): Print ".byte lo8(x)",
|
||||||
|
".byte hi8(x)", ".byte hh8(x)" instead of emit an assembler
|
||||||
|
.warning if 3-byte address is assembled.
|
||||||
|
* doc/extend.texi (AVR Named Address Spaces): Document that
|
||||||
|
binutils 2.23 is needed to assemble 3-byte addresses.
|
||||||
|
|
||||||
2012-05-14 Richard Guenther <rguenther@suse.de>
|
2012-05-14 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
* tree-vect-data-refs.c (vect_setup_realignment): Remove
|
* tree-vect-data-refs.c (vect_setup_realignment): Remove
|
||||||
|
|
|
@ -6639,48 +6639,6 @@ _reg_unused_after (rtx insn, rtx reg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return RTX that represents the lower 16 bits of a constant address.
|
|
||||||
Unfortunately, simplify_gen_subreg does not handle this case. */
|
|
||||||
|
|
||||||
static rtx
|
|
||||||
avr_const_address_lo16 (rtx x)
|
|
||||||
{
|
|
||||||
rtx lo16;
|
|
||||||
|
|
||||||
switch (GET_CODE (x))
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONST:
|
|
||||||
if (PLUS == GET_CODE (XEXP (x, 0))
|
|
||||||
&& SYMBOL_REF == GET_CODE (XEXP (XEXP (x, 0), 0))
|
|
||||||
&& CONST_INT_P (XEXP (XEXP (x, 0), 1)))
|
|
||||||
{
|
|
||||||
HOST_WIDE_INT offset = INTVAL (XEXP (XEXP (x, 0), 1));
|
|
||||||
const char *name = XSTR (XEXP (XEXP (x, 0), 0), 0);
|
|
||||||
|
|
||||||
lo16 = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
|
|
||||||
lo16 = gen_rtx_CONST (Pmode, plus_constant (Pmode, lo16, offset));
|
|
||||||
|
|
||||||
return lo16;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYMBOL_REF:
|
|
||||||
{
|
|
||||||
const char *name = XSTR (x, 0);
|
|
||||||
|
|
||||||
return gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
avr_edump ("\n%?: %r\n", x);
|
|
||||||
gcc_unreachable();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Target hook for assembling integer objects. The AVR version needs
|
/* Target hook for assembling integer objects. The AVR version needs
|
||||||
special handling for references to certain labels. */
|
special handling for references to certain labels. */
|
||||||
|
|
||||||
|
@ -6688,7 +6646,7 @@ static bool
|
||||||
avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
|
avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
|
||||||
{
|
{
|
||||||
if (size == POINTER_SIZE / BITS_PER_UNIT && aligned_p
|
if (size == POINTER_SIZE / BITS_PER_UNIT && aligned_p
|
||||||
&& text_segment_operand (x, VOIDmode) )
|
&& text_segment_operand (x, VOIDmode))
|
||||||
{
|
{
|
||||||
fputs ("\t.word\tgs(", asm_out_file);
|
fputs ("\t.word\tgs(", asm_out_file);
|
||||||
output_addr_const (asm_out_file, x);
|
output_addr_const (asm_out_file, x);
|
||||||
|
@ -6698,17 +6656,19 @@ avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
|
||||||
}
|
}
|
||||||
else if (GET_MODE (x) == PSImode)
|
else if (GET_MODE (x) == PSImode)
|
||||||
{
|
{
|
||||||
default_assemble_integer (avr_const_address_lo16 (x),
|
/* This needs binutils 2.23+, see PR binutils/13503 */
|
||||||
GET_MODE_SIZE (HImode), aligned_p);
|
|
||||||
|
fputs ("\t.byte\tlo8(", asm_out_file);
|
||||||
fputs ("\t.warning\t\"assembling 24-bit address needs binutils"
|
|
||||||
" extension for hh8(", asm_out_file);
|
|
||||||
output_addr_const (asm_out_file, x);
|
output_addr_const (asm_out_file, x);
|
||||||
fputs (")\"\n", asm_out_file);
|
fputs (")" ASM_COMMENT_START "need binutils PR13503\n", asm_out_file);
|
||||||
|
|
||||||
fputs ("\t.byte\t0\t" ASM_COMMENT_START " hh8(", asm_out_file);
|
fputs ("\t.byte\thi8(", asm_out_file);
|
||||||
output_addr_const (asm_out_file, x);
|
output_addr_const (asm_out_file, x);
|
||||||
fputs (")\n", asm_out_file);
|
fputs (")" ASM_COMMENT_START "need binutils PR13503\n", asm_out_file);
|
||||||
|
|
||||||
|
fputs ("\t.byte\thh8(", asm_out_file);
|
||||||
|
output_addr_const (asm_out_file, x);
|
||||||
|
fputs (")" ASM_COMMENT_START "need binutils PR13503\n", asm_out_file);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1273,6 +1273,7 @@ If the high bit of the address is set, data is read from
|
||||||
RAM using the lower two bytes as RAM address.
|
RAM using the lower two bytes as RAM address.
|
||||||
If the high bit of the address is clear, data is read from flash
|
If the high bit of the address is clear, data is read from flash
|
||||||
with @code{RAMPZ} set according to the high byte of the address.
|
with @code{RAMPZ} set according to the high byte of the address.
|
||||||
|
@xref{AVR Built-in Functions,,@code{__builtin_avr_flash_segment}}.
|
||||||
|
|
||||||
Objects in this address space will be located in @code{.progmem.data}.
|
Objects in this address space will be located in @code{.progmem.data}.
|
||||||
@end table
|
@end table
|
||||||
|
@ -1302,6 +1303,7 @@ int main (void)
|
||||||
@}
|
@}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@noindent
|
||||||
For each named address space supported by avr-gcc there is an equally
|
For each named address space supported by avr-gcc there is an equally
|
||||||
named but uppercase built-in macro defined.
|
named but uppercase built-in macro defined.
|
||||||
The purpose is to facilitate testing if respective address space
|
The purpose is to facilitate testing if respective address space
|
||||||
|
@ -1327,7 +1329,8 @@ int read_var (void)
|
||||||
#endif /* __FLASH */
|
#endif /* __FLASH */
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Notice that attribute @ref{AVR Variable Attributes,@code{progmem}}
|
@noindent
|
||||||
|
Notice that attribute @ref{AVR Variable Attributes,,@code{progmem}}
|
||||||
locates data in flash but
|
locates data in flash but
|
||||||
accesses to these data will read from generic address space, i.e.@:
|
accesses to these data will read from generic address space, i.e.@:
|
||||||
from RAM,
|
from RAM,
|
||||||
|
@ -1335,6 +1338,7 @@ so that you need special accessors like @code{pgm_read_byte}
|
||||||
from @w{@uref{http://nongnu.org/avr-libc/user-manual,AVR-LibC}}
|
from @w{@uref{http://nongnu.org/avr-libc/user-manual,AVR-LibC}}
|
||||||
together with attribute @code{progmem}.
|
together with attribute @code{progmem}.
|
||||||
|
|
||||||
|
@noindent
|
||||||
@b{Limitations and caveats}
|
@b{Limitations and caveats}
|
||||||
|
|
||||||
@itemize
|
@itemize
|
||||||
|
@ -1361,17 +1365,14 @@ must not optimize away known values or insert them
|
||||||
as immediates into operands of instructions.
|
as immediates into operands of instructions.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Code like the following is not yet supported because of missing
|
The following code initializes a variable @code{pfoo}
|
||||||
support in avr-binutils,
|
located in static storage with a 24-bit address:
|
||||||
see @w{@uref{http://sourceware.org/PR13503,PR13503}}.
|
|
||||||
@example
|
@example
|
||||||
extern const __memx char foo;
|
extern const __memx char foo;
|
||||||
const __memx void *pfoo = &foo;
|
const __memx void *pfoo = &foo;
|
||||||
@end example
|
@end example
|
||||||
The code will throw an assembler warning and the high byte of
|
Such code requires at least binutils 2.23, see
|
||||||
@code{pfoo} will be initialized with@tie{}@code{0}, i.e.@: the
|
@w{@uref{http://sourceware.org/PR13503,PR13503}}.
|
||||||
initialization will be as if @code{foo} was located in the first
|
|
||||||
64@tie{}KiB chunk of flash.
|
|
||||||
|
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue