Thanks Michael.
Please find below updated Change Log.
2018-04-27 Andrew Sadek <[email protected]>
Microblaze Target: PIC data text relative
* gcc/config/microblaze/microblaze.opt: add new option
-mpic-is-data-text-relative.
* gcc/config/microblaze/microblaze-protos.h (microblaze_constant_address_p):
Add microblaze_constant_address_p function to encapsulate CONSTANT_ADDRESS_P
in microblaze.h.
* gcc/config/microblaze/microblaze.h (microblaze_constant_address_p):
change CONSTANT_ADDRESS_P definition to microblaze_constant_address_p.
* gcc/config/microblaze/microblaze.c (TARGET_PIC_DATA_TEXT_REL):
New addressing mode
for data-text relative position independent code.
(microblaze_classify_unspec): add 'UNSPEC_TEXT' case ->
'ADDRESS_SYMBOLIC_TXT_REL'.
(microblaze_classify_address): add handling for UNSPEC + CONST_INT
+ SYMBOL_REF.
(microblaze_legitimate_pic_operand): exclude function calls from
pic operands
in case of TARGET_PIC_DATA_TEXT_REL option.
(microblaze_legitimize_address): generate 'UNSPEC_TEXT' for all possible
addresses cases.
(microblaze_address_insns): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
(print_operand): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
(print_operand_address): add 'ADDRESS_SYMBOLIC_TXT_REL' case + handling for
'address + offset' + set strict with 2 in microblaze_classify_address call.
(microblaze_expand_prologue): add new function prologue call for
'r20' assignation.
(microblaze_asm_generate_pic_addr_dif_vec): override new target hook
'TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC' to disable address diff vector
table in case of TARGET_PIC_DATA_TEXT_REL.
(expand_pic_symbol_ref): add handling for TARGET_PIC_DATA_TEXT_REL cases.
* gcc/config/microblaze/microblaze.md (TARGET_PIC_DATA_TEXT_REL):
Add new macros 'UNSPEC_TEXT' and 'UNSPEC_SET_TEXT' +
add rule for setting r20 in function prologue + exclude function calls
from 'UNSPEC_PLT' in case of data text relative mode.
* gcc/doc/tm.texi.in (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
Add new target hook for generating address diff vector tables in
case of flag_pic.
* gcc/doc/tm.texi : Regenerate.
* gcc/stmt.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): append new condition
'targetm.asm_out.generate_pic_addr_diff_vec' to flag_pic in case
of address diff vector generation.
* gcc/target.def (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): add
target hook definition.
* gcc/targhooks.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
add default function for generate_pic_addr_diff_vec -> flag_pic.
* gcc/targhooks.h (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
add function declaration for generate_pic_addr_diff_vec.
* gcc/doc/invoke.texi (Add new pic option): Add new microblaze pic
option -mpic-is-data-text-relative.
* gcc/testsuite/gcc.target/microblaze/others/data_var1.c: include
PIC case of r20 base register.
* gcc/testsuite/gcc.target/microblaze/others/data_var2.c: include
PIC case of r20 base register.
* gcc/testsuite/gcc.target/microblaze/others/picdtr.c: add new
test case for -mpic-is-data-text-relative.
* gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c: add
-fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c: add
-fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c: add
-fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c: add
-fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c: add
-fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c: add
-fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c:
add -fno-pic to exclude small data from PIC.
* gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c:
add -fno-pic to exclude small data from PIC.
On Fri, Apr 27, 2018 at 3:36 AM, Michael Eager <[email protected]> wrote:
> On 04/19/2018 03:43 AM, Andrew Sadek wrote:
>>
>> On Wed, Apr 18, 2018 at 6:57 PM, Michael Eager <[email protected]> wrote:
>>>
>>>
>>> Hi Andrew --
>>>
>>> Check indents in the following files:
>>> (Make sure that your tabs are set at 8 chars.)
>>> --- gcc/config/microblaze/microblaze.c
>>> --- gcc/config/microblaze/microblaze.md
>>>
>> I have re-run check_GNU_Style.sh and no are issues are found now.
>
>
> I corrected a large number of indent problems in microblaze.c.
>
>>> Just a couple coding notes:
>>>
>>> microblaze.c:
>>>
>>> @@ -858,6 +879,16 @@ microblaze_classify_address (struct microblaze_add
>>> + && strict == 2)
>>>
>>> Include comment in function header describing meaning of strict == 2.
>>
>>
>> Done
>>
>>>
>>> @@ -1022,7 +1065,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
>>> else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
>>> {
>>> ...
>>> }
>>> else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
>>> {
>>> ...
>>> }
>>>
>>> It's better to factor this into
>>> else if (flag_pic == 2)
>>> {
>>> if (TARGET_PIC_DATA_TEXT_REL)
>>> {
>>> ...
>>> }
>>> else
>>> {
>>> ...
>>> }
>>> }
>>>
>>
>> Done
>
>
> This code pattern appears twice in microblaze_legitimize_address.
> I corrected the second one.
>
> The code in the second occurrence can be refactored to move
>
> if (reload_in_progress)
> df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
>
> out of the if(TARGET_PIC_DATA_TEXT_REL) brackets. (Done.)
>
>
> Please send me an updated ChangeLog, including testsuite.
>
>
> --
> Michael Eager [email protected]
>
> 1960 Park Blvd., Palo Alto, CA 94306
--
Andrew