Commit f1deee91 by Jozef Lawrynowicz

MSP430: Setup exclusion tables for function and data attributes

gcc/ChangeLog:

2019-09-03  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430.c (msp430_attr): Remove warnings about
	conflicting msp430-specific attributes.
	(msp430_section_attr): Likewise.
	Add warnings about conflicts with generic "noinit" and "section"
	attributes.
	Fix grammar in -mlarge error message.
	(msp430_data_attr): Rename to msp430_persist_attr.
	Add warnings about conflicts with generic "noinit" and "section"
	attributes.
	Add warning for when variable is not initialized.
	Chain conditionals which prevent the attribute being added.
	(ATTR_EXCL): New helper.
	(attr_reent_exclusions): New exclusion table.
	(attr_naked_exclusions): Likewise.
	(attr_crit_exclusions): Likewise.
	(attr_lower_exclusions): Likewise.
	(attr_upper_exclusions): Likewise.
	(attr_either_exclusions): Likewise.
	(attr_persist_exclusions): Likewise.
	(msp430_attribute_table): Update with exclusion rules.
	(msp430_output_aligned_decl_common): Don't output common symbol if decl
	has a section.

gcc/testsuite/ChangeLog:

2019-09-03  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* gcc.target/msp430/data-attributes-2.c: New test.
	* gcc.target/msp430/function-attributes-4.c: Update dg-warning
	strings.
	* gcc.target/msp430/region-attribute-misuse.c: Likewise.

From-SVN: r275356
parent 7a4418a5
2019-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com> 2019-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/msp430/msp430.c (msp430_attr): Remove warnings about
conflicting msp430-specific attributes.
(msp430_section_attr): Likewise.
Add warnings about conflicts with generic "noinit" and "section"
attributes.
Fix grammar in -mlarge error message.
(msp430_data_attr): Rename to msp430_persist_attr.
Add warnings about conflicts with generic "noinit" and "section"
attributes.
Add warning for when variable is not initialized.
Chain conditionals which prevent the attribute being added.
(ATTR_EXCL): New helper.
(attr_reent_exclusions): New exclusion table.
(attr_naked_exclusions): Likewise.
(attr_crit_exclusions): Likewise.
(attr_lower_exclusions): Likewise.
(attr_upper_exclusions): Likewise.
(attr_either_exclusions): Likewise.
(attr_persist_exclusions): Likewise.
(msp430_attribute_table): Update with exclusion rules.
(msp430_output_aligned_decl_common): Don't output common symbol if decl
has a section.
2019-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/msp430/msp430.c (TARGET_HANDLE_GENERIC_ATTRIBUTE): Define. * config/msp430/msp430.c (TARGET_HANDLE_GENERIC_ATTRIBUTE): Define.
(msp430_handle_generic_attribute): New function. (msp430_handle_generic_attribute): New function.
* doc/tm.texi: Regenerate. * doc/tm.texi: Regenerate.
......
2019-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* gcc.target/msp430/data-attributes-2.c: New test.
* gcc.target/msp430/function-attributes-4.c: Update dg-warning
strings.
* gcc.target/msp430/region-attribute-misuse.c: Likewise.
2019-09-03 Kamlesh Kumar <kamleshbhalui@gmail.com> 2019-09-03 Kamlesh Kumar <kamleshbhalui@gmail.com>
PR tree-optimization/91504 PR tree-optimization/91504
gcc.dg/tree-ssa/pr91504.c: New test. gcc.dg/tree-ssa/pr91504.c: New test.
2019-09-03 Jakub Jelinek <jakub@redhat.com> 2019-09-03 Jakub Jelinek <jakub@redhat.com>
......
/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-mcpu=msp430" } } */
/* { dg-options "-mlarge" } */
/* The msp430-specific variable attributes "lower", "upper", either", "noinit"
and "persistent", all conflict with one another.
These attributes also conflict with the "section" attribute, since they
specify sections to put the variables into. */
int __attribute__((persistent)) p = 10;
int __attribute__((persistent,lower)) pl = 20; /* { dg-warning "ignoring attribute 'lower' because it conflicts with attribute 'persistent'" } */
int __attribute__((persistent,upper)) pu = 20; /* { dg-warning "ignoring attribute 'upper' because it conflicts with attribute 'persistent'" } */
int __attribute__((persistent,either)) pe = 20; /* { dg-warning "ignoring attribute 'either' because it conflicts with attribute 'persistent'" } */
/* This one results in an error because the handler for persistent sets the
section to .persistent there and then. */
int __attribute__((persistent,section(".data.foo"))) ps = 20; /* { dg-error "section of 'ps' conflicts with previous declaration" } */
int __attribute__((persistent,noinit)) pn = 2; /* { dg-warning "'noinit' attribute cannot be applied to variables with specific sections" } */
int __attribute__((noinit)) n;
int __attribute__((noinit,lower)) nl; /* { dg-warning "ignoring attribute 'lower' because it conflicts with attribute 'noinit'" } */
int __attribute__((noinit,upper)) nu; /* { dg-warning "ignoring attribute 'upper' because it conflicts with attribute 'noinit'" } */
int __attribute__((noinit,either)) ne; /* { dg-warning "ignoring attribute 'either' because it conflicts with attribute 'noinit'" } */
int __attribute__((noinit,persistent)) np; /* { dg-warning "ignoring attribute 'persistent' because it conflicts with attribute 'noinit'" } */
int __attribute__((noinit,section(".data.foo"))) ns; /* { dg-warning "ignoring attribute 'section' because it conflicts with attribute 'noinit'" } */
int __attribute__((lower)) l = 20;
int __attribute__((lower,upper)) lu = 20; /* { dg-warning "ignoring attribute 'upper' because it conflicts with attribute 'lower'" } */
int __attribute__((lower,either)) le = 20; /* { dg-warning "ignoring attribute 'either' because it conflicts with attribute 'lower'" } */
int __attribute__((lower,persistent)) lp = 20; /* { dg-warning "ignoring attribute 'persistent' because it conflicts with attribute 'lower'" } */
int __attribute__((lower,noinit)) ln; /* { dg-warning "ignoring attribute 'noinit' because it conflicts with attribute 'lower'" } */
int __attribute__((lower,section(".data.foo"))) ls = 30; /* { dg-warning "ignoring attribute 'section' because it conflicts with attribute 'lower'" } */
int __attribute__((upper)) u = 20;
int __attribute__((upper,lower)) ul = 20; /* { dg-warning "ignoring attribute 'lower' because it conflicts with attribute 'upper'" } */
int __attribute__((upper,either)) ue = 20; /* { dg-warning "ignoring attribute 'either' because it conflicts with attribute 'upper'" } */
int __attribute__((upper,persistent)) up = 20; /* { dg-warning "ignoring attribute 'persistent' because it conflicts with attribute 'upper'" } */
int __attribute__((upper,noinit)) un; /* { dg-warning "ignoring attribute 'noinit' because it conflicts with attribute 'upper'" } */
int __attribute__((upper,section(".data.foo"))) us = 30; /* { dg-warning "ignoring attribute 'section' because it conflicts with attribute 'upper'" } */
int __attribute__((either)) e = 20;
int __attribute__((either,lower)) el = 20; /* { dg-warning "ignoring attribute 'lower' because it conflicts with attribute 'either'" } */
int __attribute__((either,upper)) ee = 20; /* { dg-warning "ignoring attribute 'upper' because it conflicts with attribute 'either'" } */
int __attribute__((either,persistent)) ep = 20; /* { dg-warning "ignoring attribute 'persistent' because it conflicts with attribute 'either'" } */
int __attribute__((either,noinit)) en; /* { dg-warning "ignoring attribute 'noinit' because it conflicts with attribute 'either'" } */
int __attribute__((either,section(".data.foo"))) es = 30; /* { dg-warning "ignoring attribute 'section' because it conflicts with attribute 'either'" } */
int __attribute__((section(".data.foo"))) s = 20;
int __attribute__((section(".data.foo"),noinit)) sn; /* { dg-warning "ignoring attribute 'noinit' because it conflicts with attribute 'section'" } */
int __attribute__((section(".data.foo"),persistent)) sp = 20; /* { dg-warning "ignoring attribute 'persistent' because it conflicts with attribute 'section'" } */
int __attribute__((section(".data.foo"),lower)) sl = 2; /* { dg-warning "ignoring attribute 'lower' because it conflicts with attribute 'section'" } */
int __attribute__((section(".data.foo"),upper)) su = 20; /* { dg-warning "ignoring attribute 'upper' because it conflicts with attribute 'section'" } */
int __attribute__((section(".data.foo"),either)) se = 2; /* { dg-warning "ignoring attribute 'either' because it conflicts with attribute 'section'" } */
/* { dg-do compile } */ /* { dg-do compile } */
/* Check that the foo interrupt vectors aren't actually removed. */ /* Check that the foo interrupt vectors aren't actually removed. */
/* { dg-final { scan-assembler-times "__interrupt_vector_foo" 2 } } */ /* { dg-final { scan-assembler-times "__interrupt_vector_foo" 2 } } */
/* Check that the out-of-range interrupt vectors aren't actually removed. */
/* { dg-final { scan-assembler "__interrupt_vector_65" } } */
/* { dg-final { scan-assembler "__interrupt_vector_100" } } */
/* Check that warnings are emitted when attributes are used incorrectly and /* Check that warnings are emitted when attributes are used incorrectly and
that attributes are interpreted correctly whether leading and trailing that attributes are interpreted correctly whether leading and trailing
...@@ -8,62 +11,62 @@ ...@@ -8,62 +11,62 @@
void __attribute__((__naked__,__reentrant__)) void __attribute__((__naked__,__reentrant__))
fn1(void) fn1(void)
{ /* { dg-warning "naked functions cannot be reentrant" } */ { /* { dg-warning "ignoring attribute 'reentrant' because it conflicts with attribute 'naked'" } */
} }
void __attribute__((naked,reentrant)) void __attribute__((naked,reentrant))
fn2(void) fn2(void)
{ /* { dg-warning "naked functions cannot be reentrant" } */ { /* { dg-warning "ignoring attribute 'reentrant' because it conflicts with attribute 'naked'" } */
} }
void __attribute__((__reentrant__,__naked__)) void __attribute__((__reentrant__,__naked__))
fn3(void) fn3(void)
{ /* { dg-warning "reentrant functions cannot be naked" } */ { /* { dg-warning "ignoring attribute 'naked' because it conflicts with attribute 'reentrant'" } */
} }
void __attribute__((reentrant,naked)) void __attribute__((reentrant,naked))
fn4(void) fn4(void)
{ /* { dg-warning "reentrant functions cannot be naked" } */ { /* { dg-warning "ignoring attribute 'naked' because it conflicts with attribute 'reentrant'" } */
} }
void __attribute__((__critical__,__reentrant__)) void __attribute__((__critical__,__reentrant__))
fn5(void) fn5(void)
{ /* { dg-warning "critical functions cannot be reentrant" } */ { /* { dg-warning "ignoring attribute 'reentrant' because it conflicts with attribute 'critical'" } */
} }
void __attribute__((critical,reentrant)) void __attribute__((critical,reentrant))
fn6(void) fn6(void)
{ /* { dg-warning "critical functions cannot be reentrant" } */ { /* { dg-warning "ignoring attribute 'reentrant' because it conflicts with attribute 'critical'" } */
} }
void __attribute__((__reentrant__,__critical__)) void __attribute__((__reentrant__,__critical__))
fn7(void) fn7(void)
{ /* { dg-warning "reentrant functions cannot be critical" } */ { /* { dg-warning "ignoring attribute 'critical' because it conflicts with attribute 'reentrant'" } */
} }
void __attribute__((reentrant,critical)) void __attribute__((reentrant,critical))
fn8(void) fn8(void)
{ /* { dg-warning "reentrant functions cannot be critical" } */ { /* { dg-warning "ignoring attribute 'critical' because it conflicts with attribute 'reentrant'" } */
} }
void __attribute__((__critical__,__naked__)) void __attribute__((__critical__,__naked__))
fn9(void) fn9(void)
{ /* { dg-warning "critical functions cannot be naked" } */ { /* { dg-warning "ignoring attribute 'naked' because it conflicts with attribute 'critical'" } */
} }
void __attribute__((critical,naked)) void __attribute__((critical,naked))
fn10(void) fn10(void)
{ /* { dg-warning "critical functions cannot be naked" } */ { /* { dg-warning "ignoring attribute 'naked' because it conflicts with attribute 'critical'" } */
} }
void __attribute__((__naked__,__critical__)) void __attribute__((__naked__,__critical__))
fn11(void) fn11(void)
{ /* { dg-warning "naked functions cannot be critical" } */ { /* { dg-warning "ignoring attribute 'critical' because it conflicts with attribute 'naked'" } */
} }
void __attribute__((naked,critical)) void __attribute__((naked,critical))
fn12(void) fn12(void)
{ /* { dg-warning "naked functions cannot be critical" } */ { /* { dg-warning "ignoring attribute 'critical' because it conflicts with attribute 'naked'" } */
} }
int __attribute__((interrupt)) int __attribute__((interrupt))
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
/* { dg-final { scan-assembler ".section.*lower.data" } } */ /* { dg-final { scan-assembler ".section.*lower.data" } } */
/* { dg-final { scan-assembler ".section.*either.data" } } */ /* { dg-final { scan-assembler ".section.*either.data" } } */
int __attribute__((upper)) upper_bss; /* { dg-warning "'upper' attribute ignored. large memory model .'-mlarge'. is required" } */ int __attribute__((upper)) upper_bss; /* { dg-warning "'upper' attribute ignored. Large memory model .'-mlarge'. is required" } */
int __attribute__((lower)) lower_bss; /* { dg-warning "'lower' attribute ignored. large memory model .'-mlarge'. is required" } */ int __attribute__((lower)) lower_bss; /* { dg-warning "'lower' attribute ignored. Large memory model .'-mlarge'. is required" } */
int __attribute__((either)) either_bss; /* { dg-warning "'either' attribute ignored. large memory model .'-mlarge'. is required" } */ int __attribute__((either)) either_bss; /* { dg-warning "'either' attribute ignored. Large memory model .'-mlarge'. is required" } */
/* Verify that even without -mlarge, objects can still be placed in /* Verify that even without -mlarge, objects can still be placed in
upper/lower/either regions manually. */ upper/lower/either regions manually. */
......
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