On 3/16/2026 8:13 AM, Yoshinori Sato wrote:
> gcc/ChangeLog:
>
>          * config/rx/rx.cc (rx_legitimize_address): Add PIC support.
>       (gen_pcrel_label): New.
>          (legitimize_pic_address): New.
>          (rx_is_legitimate_address): Add PIC case.
>          (nonpic_symbol_mentioned_p): New.
>          (rx_print_operand_address): Add PIC symbol attribute.
>       (rx_expand_prologue): Add PIC prologue.
>       (rx_elf_asm_cdtor): Add FDPIC output.
>          (rx_assemble_integer): Add PIC case output.
>          (rx_option_override): fdpic support.
>          (rx_function_ok_for_sibcall): Use relative call in fdpic mode.
>          (rx_is_legitimate_constant): Add PIC support.
>          (rx_legitimate_pic_operand_p): New.
>          (rx_get_fdpic_reg_initial_val) New.
>          (rx_mov_pic_operands): New.
>          (rx_asm_output_addr_const_extra) New.
>          (rx_const_not_ok_for_debug_p): New.
>          (rx_cannot_force_const_mem_p): New.
>       (rx_is_unspec_offset): New.
>       (rx_delegitimize_address): New.
>          (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): New.
>          (TARGET_CONST_NOT_OK_FOR_DEBUG_P): New.
>          (TARGET_CANNOT_FORCE_CONST_MEM): New.
>       (TARGET_DELEGITIMIZE_ADDRESS): New.
>
> Signed-off-by: Yoshinori Sato <[email protected]>
> ---
>   gcc/config/rx/rx.cc | 467 ++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 456 insertions(+), 11 deletions(-)
>
> diff --git a/gcc/config/rx/rx.cc b/gcc/config/rx/rx.cc
> index 46d933ec157..1a16f4892c4 100644
> --- a/gcc/config/rx/rx.cc
> +++ b/gcc/config/rx/rx.cc
>
> @@ -163,6 +170,79 @@ rx_legitimize_address (rtx x,
>     return x;
>   }
>   
> +
> +static rtx
> +gen_pcrel_label (rtx sym)
Needs a function comment.  This is true for any newly added function.


> +
> +  if ((GET_CODE (inner) == UNSPEC && XINT (inner, 1) == UNSPEC_PCREL) &&
> +      (!SYMBOL_REF_P (x) && !LABEL_REF_P (x) && GET_CODE (x) != CONST))
Our formatting standards would bring that trailing "&&" down on the next 
line.  This nit appears in several places.



> +  else if ((MEM_P(orig) && GET_CODE (XEXP (orig, 1)) == LABEL_REF) &&
> +        (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_DECL (orig)
> +         && (TREE_READONLY (SYMBOL_REF_DECL (orig)))))
Something looks wrong here.  ORIG can't be both a MEM and a SYMBOL_REF 
at the same time. Unless I'm missing something this conditional is 
always false.

> @@ -421,7 +558,7 @@ rx_print_operand_address (FILE * file, machine_mode 
> /*mode*/, rtx addr)
>       else if (REG_P (arg2) && RTX_OK_FOR_BASE (arg2, true))
>         base = arg2, index = arg1;
>       else
> -       {
> +       { /* symbol + offset[Rn] */
We generally don't use that kind of comment style.  Bring the comment 
down to its own line.

My sense is this between the general issues noted in the prior patch as 
well a those here that this needs a V2 after cleanup.  It'll hopefully 
be easier to read then.  Right now my brain is turning to mush :-)

Jeff

Reply via email to