[ARC] Consolidate PIC implementation.
authorClaudiu Zissulescu <claziss@synopsys.com>
Mon, 17 Jul 2017 11:04:37 +0000 (13:04 +0200)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Mon, 17 Jul 2017 11:04:37 +0000 (13:04 +0200)
commitb6c354ebc736de36d39b2b81e7dd2e3932b28404
treefff7e1a5f8954a5422284ff2bd280e617fb9fcfc
parent1825c61e15cf34364792180ca017c998cab3fe34
[ARC] Consolidate PIC implementation.

This patch refactors a number of functions and compiler hooks into using a
single function which checks if a rtx is suited for pic or not. Removed
functions are arc_legitimate_pc_offset_p and arc_legitimate_pic_operand_p
beeing replaced by calls to arc_legitimate_pic_addr_p. Thus we have an
unitary way of checking a rtx beeing pic.

gcc/
2017-07-17  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc-protos.h (arc_legitimate_pc_offset_p): Remove
proto.
(arc_legitimate_pic_operand_p): Likewise.
* config/arc/arc.c (arc_legitimate_pic_operand_p): Remove
function.
(arc_needs_pcl_p): Likewise.
(arc_legitimate_pc_offset_p): Likewise.
(arc_legitimate_pic_addr_p): Remove LABEL_REF case, as this
function is also used in constrains.md.
(arc_legitimate_constant_p): Use arc_legitimate_pic_addr_p to
validate pic constants. Handle CONST_INT, CONST_DOUBLE, MINUS and
PLUS.  Only return true/false in known cases, otherwise assert.
(arc_legitimate_address_p): Remove arc_legitimate_pic_addr_p as it
is already called in arc_legitimate_constant_p.
* config/arc/arc.h (CONSTANT_ADDRESS_P): Consider also LABEL for
pic addresses.
(LEGITIMATE_PIC_OPERAND_P): Use
arc_raw_symbolic_reference_mentioned_p function.
* config/arc/constraints.md (Cpc): Use arc_legitimate_pic_addr_p
function.
(Cal): Likewise.
(C32): Likewise.

gcc/testsuite
2017-07-17  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/pr9000674901.c: New file.
* gcc.target/arc/pic-1.c: Likewise.
* gcc.target/arc/pr9001191897.c: Likewise.

From-SVN: r250267
gcc/ChangeLog
gcc/config/arc/arc-protos.h
gcc/config/arc/arc.c
gcc/config/arc/arc.h
gcc/config/arc/constraints.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arc/pic-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arc/pr9000674901.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arc/pr9001191897.c [new file with mode: 0644]