Commit 576ba35c by Pitchumani Sivanupandi Committed by Denis Chertykov

avr-arch.h (avr_mcu_t): Add dev_attribute field to have device specific ISA/ feature information.

	* config/avr/avr-arch.h (avr_mcu_t): Add dev_attribute field to have device
	specific ISA/ feature information. Remove short_sp and errata_skip ds.
	Add avr_device_specific_features enum to have device specific info.
	* config/avr/avr-c.c (avr_cpu_cpp_builtins): use dev_attribute to check
	errata_skip. Add __AVR_ISA_RMW__ builtin macro if RMW ISA available.
	* config/avr/avr-devices.c (avr_mcu_types): Update AVR_MCU macro for
	updated device specific info.
	* config/avr/avr-mcus.def: Merge device specific details to
	dev_attribute field.
	* config/avr/avr.c (avr_2word_insn_p): use dev_attribute field to check
	errata_skip.
	* config/avr/avr.h (AVR_HAVE_8BIT_SP): same for short sp info.
	* config/avr/driver-avr.c (avr_device_to_as): Pass -mrmw option to
	assembler if RMW isa supported by current device.
	* config/avr/genmultilib.awk: Update as device info structure changed.
	* doc/invoke.texi: Add info for __AVR_ISA_RMW__ builtin macro

	* gcc.target/avr/dev-specific-rmw.c: New test.

From-SVN: r209141
parent ebc047a2
2014-04-05 Pitchumani Sivanupandi <Pitchumani.S@atmel.com>
* config/avr/avr-arch.h (avr_mcu_t): Add dev_attribute field to have device
specific ISA/ feature information. Remove short_sp and errata_skip ds.
Add avr_device_specific_features enum to have device specific info.
* config/avr/avr-c.c (avr_cpu_cpp_builtins): use dev_attribute to check
errata_skip. Add __AVR_ISA_RMW__ builtin macro if RMW ISA available.
* config/avr/avr-devices.c (avr_mcu_types): Update AVR_MCU macro for
updated device specific info.
* config/avr/avr-mcus.def: Merge device specific details to
dev_attribute field.
* config/avr/avr.c (avr_2word_insn_p): use dev_attribute field to check
errata_skip.
* config/avr/avr.h (AVR_HAVE_8BIT_SP): same for short sp info.
* config/avr/driver-avr.c (avr_device_to_as): Pass -mrmw option to
assembler if RMW isa supported by current device.
* config/avr/genmultilib.awk: Update as device info structure changed.
* doc/invoke.texi: Add info for __AVR_ISA_RMW__ builtin macro
2014-04-04 Cong Hou <congh@google.com> 2014-04-04 Cong Hou <congh@google.com>
PR tree-optimization/60656 PR tree-optimization/60656
...@@ -33,7 +52,7 @@ ...@@ -33,7 +52,7 @@
symtab_remove_unreachable_nodes): Drop bodies of always inline symtab_remove_unreachable_nodes): Drop bodies of always inline
after early inlining. after early inlining.
(symtab_remove_unreachable_nodes): Remove always_inline attribute. (symtab_remove_unreachable_nodes): Remove always_inline attribute.
2014-04-04 Jakub Jelinek <jakub@redhat.com> 2014-04-04 Jakub Jelinek <jakub@redhat.com>
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
......
...@@ -100,32 +100,12 @@ typedef struct ...@@ -100,32 +100,12 @@ typedef struct
/* Index in avr_arch_types[]. */ /* Index in avr_arch_types[]. */
enum avr_arch arch; enum avr_arch arch;
/* device specific feature */
int dev_attribute;
/* Must lie outside user's namespace. NULL == no macro. */ /* Must lie outside user's namespace. NULL == no macro. */
const char *const macro; const char *const macro;
/* Stack pointer have 8 bits width. */
int short_sp;
/* Some AVR devices have a core erratum when skipping a 2-word instruction.
Skip instructions are: SBRC, SBRS, SBIC, SBIS, CPSE.
Problems will occur with return address is IRQ executes during the
skip sequence.
A support ticket from Atmel returned the following information:
Subject: (ATTicket:644469) On AVR skip-bug core Erratum
From: avr@atmel.com Date: 2011-07-27
(Please keep the subject when replying to this mail)
This errata exists only in AT90S8515 and ATmega103 devices.
For information please refer the following respective errata links
http://www.atmel.com/dyn/resources/prod_documents/doc2494.pdf
http://www.atmel.com/dyn/resources/prod_documents/doc1436.pdf */
/* Core Erratum: Must not skip 2-word instruction. */
int errata_skip;
/* Start of data section. */ /* Start of data section. */
int data_section_start; int data_section_start;
...@@ -136,6 +116,42 @@ typedef struct ...@@ -136,6 +116,42 @@ typedef struct
const char *const library_name; const char *const library_name;
} avr_mcu_t; } avr_mcu_t;
/* AVR device specific features.
AVR_ISA_RMW
Only few avr devices have Read-Modify-Write (RMW) instructions
(XCH, LAC, LAS and LAT)
AVR_SHORT_SP
Stack Pointer has only 8 bit width.
The device / multilib has an 8-bit stack pointer (no SPH).
AVR_ERRATA_SKIP
Some AVR devices have a core erratum when skipping a 2-word instruction.
Skip instructions are: SBRC, SBRS, SBIC, SBIS, CPSE.
Problems will occur with return address is IRQ executes during the
skip sequence.
A support ticket from Atmel returned the following information:
Subject: (ATTicket:644469) On AVR skip-bug core Erratum
From: avr@atmel.com Date: 2011-07-27
(Please keep the subject when replying to this mail)
This errata exists only in AT90S8515 and ATmega103 devices.
For information please refer the following respective errata links
http://www.atmel.com/dyn/resources/prod_documents/doc2494.pdf
http://www.atmel.com/dyn/resources/prod_documents/doc1436.pdf */
enum avr_device_specific_features
{
AVR_ISA_NONE,
AVR_ISA_RMW = 0x1, /* device has RMW instructions. */
AVR_SHORT_SP = 0x2, /* Stack Pointer has 8 bits width. */
AVR_ERRATA_SKIP = 0x4 /* device has a core erratum. */
};
/* Map architecture to its texinfo string. */ /* Map architecture to its texinfo string. */
typedef struct typedef struct
......
...@@ -347,7 +347,7 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) ...@@ -347,7 +347,7 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
if (TARGET_NO_INTERRUPTS) if (TARGET_NO_INTERRUPTS)
cpp_define (pfile, "__NO_INTERRUPTS__"); cpp_define (pfile, "__NO_INTERRUPTS__");
if (avr_current_device->errata_skip) if (avr_current_device->dev_attribute & AVR_ERRATA_SKIP)
{ {
cpp_define (pfile, "__AVR_ERRATA_SKIP__"); cpp_define (pfile, "__AVR_ERRATA_SKIP__");
...@@ -355,6 +355,9 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) ...@@ -355,6 +355,9 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__"); cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__");
} }
if (avr_current_device->dev_attribute & AVR_ISA_RMW)
cpp_define (pfile, "__AVR_ISA_RMW__");
cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x", cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x",
avr_current_arch->sfr_offset); avr_current_arch->sfr_offset);
......
...@@ -104,11 +104,11 @@ avr_texinfo[] = ...@@ -104,11 +104,11 @@ avr_texinfo[] =
const avr_mcu_t const avr_mcu_t
avr_mcu_types[] = avr_mcu_types[] =
{ {
#define AVR_MCU(NAME, ARCH, MACRO, SP8, ERR_SKIP, DATA_SEC, N_FLASH, LIBNAME)\ #define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, N_FLASH, LIBNAME)\
{ NAME, ARCH, MACRO, SP8, ERR_SKIP, DATA_SEC, N_FLASH, LIBNAME }, { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, N_FLASH, LIBNAME },
#include "avr-mcus.def" #include "avr-mcus.def"
#undef AVR_MCU #undef AVR_MCU
/* End of list. */ /* End of list. */
{ NULL, ARCH_UNKNOWN, NULL, 0, 0, 0, 0, NULL } { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, NULL }
}; };
...@@ -10120,7 +10120,7 @@ test_hard_reg_class (enum reg_class rclass, rtx x) ...@@ -10120,7 +10120,7 @@ test_hard_reg_class (enum reg_class rclass, rtx x)
static bool static bool
avr_2word_insn_p (rtx insn) avr_2word_insn_p (rtx insn)
{ {
if (avr_current_device->errata_skip if ((avr_current_device->dev_attribute & AVR_ERRATA_SKIP)
|| !insn || !insn
|| 2 != get_attr_length (insn)) || 2 != get_attr_length (insn))
{ {
......
...@@ -88,8 +88,9 @@ enum ...@@ -88,8 +88,9 @@ enum
__AVR_HAVE_8BIT_SP__ and __AVR_HAVE_16BIT_SP__. During multilib generation __AVR_HAVE_8BIT_SP__ and __AVR_HAVE_16BIT_SP__. During multilib generation
there is always __AVR_SP8__ == __AVR_HAVE_8BIT_SP__. */ there is always __AVR_SP8__ == __AVR_HAVE_8BIT_SP__. */
#define AVR_HAVE_8BIT_SP \ #define AVR_HAVE_8BIT_SP \
(avr_current_device->short_sp || TARGET_TINY_STACK || avr_sp8) ((avr_current_device->dev_attribute & AVR_SHORT_SP) || \
TARGET_TINY_STACK || avr_sp8)
#define AVR_HAVE_SPH (!avr_sp8) #define AVR_HAVE_SPH (!avr_sp8)
......
...@@ -5342,7 +5342,7 @@ ...@@ -5342,7 +5342,7 @@
(label_ref (match_operand 0 "" "")) (label_ref (match_operand 0 "" ""))
(pc)))] (pc)))]
"!AVR_HAVE_JMP_CALL "!AVR_HAVE_JMP_CALL
|| !avr_current_device->errata_skip" || !(avr_current_device->dev_attribute & AVR_ERRATA_SKIP)"
{ {
if (operands[2] == CONST0_RTX (<MODE>mode)) if (operands[2] == CONST0_RTX (<MODE>mode))
operands[2] = zero_reg_rtx; operands[2] = zero_reg_rtx;
......
...@@ -59,8 +59,8 @@ avr_device_to_as (int argc, const char **argv) ...@@ -59,8 +59,8 @@ avr_device_to_as (int argc, const char **argv)
avr_set_current_device (argv[0]); avr_set_current_device (argv[0]);
return concat ("-mmcu=", avr_current_arch->arch_name, return concat ("-mmcu=", avr_current_arch->arch_name,
avr_current_device->errata_skip ? "" : " -mno-skip-bug", avr_current_device->dev_attribute & AVR_ERRATA_SKIP ? "" : " -mno-skip-bug",
NULL); avr_current_device->dev_attribute & AVR_ISA_RMW ? " -mrmw" : "", NULL);
} }
/* Returns command line parameters to pass to ld. */ /* Returns command line parameters to pass to ld. */
...@@ -144,7 +144,7 @@ avr_device_to_sp8 (int argc, const char **argv) ...@@ -144,7 +144,7 @@ avr_device_to_sp8 (int argc, const char **argv)
|| avr_current_device->arch == ARCH_AVR25)) || avr_current_device->arch == ARCH_AVR25))
return ""; return "";
return avr_current_device->short_sp return (avr_current_device->dev_attribute & AVR_SHORT_SP)
? "-msp8" ? "-msp8"
: "%<msp8"; : "%<msp8";
} }
...@@ -86,7 +86,7 @@ BEGIN { ...@@ -86,7 +86,7 @@ BEGIN {
name = $2 name = $2
gsub ("\"", "", name) gsub ("\"", "", name)
if ($4 == "NULL") if ($5 == "NULL")
{ {
core = name core = name
...@@ -106,7 +106,17 @@ BEGIN { ...@@ -106,7 +106,17 @@ BEGIN {
if (core == "avr1") if (core == "avr1")
next next
tiny_stack[name] = $5 # split device specific feature list
n = split($4,dev_attribute,"|")
# set tiny_stack false by default
tiny_stack[name] = 0
for (i=1; i <= n; i++)
if (dev_attribute[i] == "AVR_SHORT_SP") {
tiny_stack[name] = 1
break
}
mcu[n_mcu] = name mcu[n_mcu] = name
n_mcu++ n_mcu++
option[name] = "mmcu=" name option[name] = "mmcu=" name
......
2014-05-04 Pitchumani Sivanupandi <Pitchumani.S@atmel.com>
* gcc.target/avr/dev-specific-rmw.c: New test.
2014-04-04 Cong Hou <congh@google.com> 2014-04-04 Cong Hou <congh@google.com>
PR tree-optimization/60656 PR tree-optimization/60656
......
/* Verify that rmw instructions supported */
/* { dg-do assemble } */
int main()
{
#ifdef __AVR_ISA_RMW__
__asm("xch Z, r12");
__asm("las Z, r12");
__asm("lac Z, r12");
__asm("lat Z, r12");
#endif
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment