[ARC] Consolidate PIC implementation

Programming / Compilers / GCC - claziss [138bc75d-0d04-0410-961f-82ee72b054a4] - 17 July 2017 07:04 EDT

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

- 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

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

da2134e [ARC] Consolidate PIC implementation.
gcc/ChangeLog | 25 +++++
gcc/config/arc/arc-protos.h | 2 -
gcc/config/arc/arc.c | 150 +++++++++-------------------
gcc/config/arc/arc.h | 11 +-
gcc/config/arc/constraints.md | 6 +-
gcc/testsuite/ChangeLog | 6 ++
gcc/testsuite/gcc.target/arc/pic-1.c | 11 ++
gcc/testsuite/gcc.target/arc/pr9000674901.c | 58 +++++++++++
gcc/testsuite/gcc.target/arc/pr9001191897.c | 10 ++
9 files changed, 167 insertions(+), 112 deletions(-)

Upstream: gcc.gnu.org


  • Share