1 /* Target Code for ft32
2 Copyright (C) 2015-2017 Free Software Foundation, Inc.
3 Contributed by FTDI <support@ftdi.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
28 #include "stringpool.h"
35 #include "diagnostic-core.h"
37 #include "stor-layout.h"
41 #include "print-tree.h"
43 /* This file should be included last. */
44 #include "target-def.h"
48 #define LOSE_AND_RETURN(msgid, x) \
51 ft32_operand_lossage (msgid, x); \
55 /* Worker function for TARGET_RETURN_IN_MEMORY. */
58 ft32_return_in_memory (const_tree type
, const_tree fntype ATTRIBUTE_UNUSED
)
60 const HOST_WIDE_INT size
= int_size_in_bytes (type
);
61 return (size
== -1 || size
> 2 * UNITS_PER_WORD
);
64 /* Define how to find the value returned by a function.
65 VALTYPE is the data type of the value (as a tree).
66 If the precise function being called is known, FUNC is its
67 FUNCTION_DECL; otherwise, FUNC is 0.
69 We always return values in register $r0 for ft32. */
72 ft32_function_value (const_tree valtype
,
73 const_tree fntype_or_decl ATTRIBUTE_UNUSED
,
74 bool outgoing ATTRIBUTE_UNUSED
)
76 return gen_rtx_REG (TYPE_MODE (valtype
), FT32_R0
);
79 /* Define how to find the value returned by a library function.
81 We always return values in register $r0 for ft32. */
84 ft32_libcall_value (machine_mode mode
, const_rtx fun ATTRIBUTE_UNUSED
)
86 return gen_rtx_REG (mode
, FT32_R0
);
89 /* Handle TARGET_FUNCTION_VALUE_REGNO_P.
91 We always return values in register $r0 for ft32. */
94 ft32_function_value_regno_p (const unsigned int regno
)
96 return (regno
== FT32_R0
);
99 /* Emit an error message when we're in an asm, and a fatal error for
100 "normal" insns. Formatted output isn't easily implemented, since we
101 use output_operand_lossage to output the actual message and handle the
102 categorization of the error. */
105 ft32_operand_lossage (const char *msgid
, rtx op
)
108 output_operand_lossage ("%s", msgid
);
111 /* The PRINT_OPERAND_ADDRESS worker. */
114 ft32_print_operand_address (FILE * file
, rtx x
)
116 switch (GET_CODE (x
))
119 fprintf (file
, "%s,0", reg_names
[REGNO (x
)]);
123 switch (GET_CODE (XEXP (x
, 1)))
126 fprintf (file
, "%s,%ld",
127 reg_names
[REGNO (XEXP (x
, 0))], INTVAL (XEXP (x
, 1)));
130 output_addr_const (file
, XEXP (x
, 1));
131 fprintf (file
, "(%s)", reg_names
[REGNO (XEXP (x
, 0))]);
135 rtx plus
= XEXP (XEXP (x
, 1), 0);
136 if (GET_CODE (XEXP (plus
, 0)) == SYMBOL_REF
137 && CONST_INT_P (XEXP (plus
, 1)))
139 output_addr_const (file
, XEXP (plus
, 0));
140 fprintf (file
, "+%ld(%s)", INTVAL (XEXP (plus
, 1)),
141 reg_names
[REGNO (XEXP (x
, 0))]);
153 output_addr_const (file
, x
);
158 /* The PRINT_OPERAND worker. */
161 ft32_print_operand (FILE * file
, rtx x
, int code
)
165 /* New code entries should just be added to the switch below. If
166 handling is finished, just return. If handling was just a
167 modification of the operand, the modified operand should be put in
168 "operand", and then do a break to let default handling
169 (zero-modifier) output the operand. */
174 /* No code, print as usual. */
178 if (GET_CODE (operand
) != REG
)
179 internal_error ("'h' applied to non-register operand");
180 fprintf (file
, "%s", reg_names
[REGNO (operand
) + 1]);
184 fprintf (file
, "%ld", (long) (- INTVAL(x
)));
187 case 'd': // a DW spec, from an integer alignment (for BLKmode insns)
204 internal_error ("bad alignment: %d", i
);
209 fprintf (file
, "%c", dwspec
);
215 int bf
= ft32_as_bitfield (INTVAL (x
));
216 fprintf (file
, "512|(%d<<5)|%d", bf
>> 5, bf
& 31);
222 int bf
= ft32_as_bitfield (0xffffffff ^ INTVAL (x
));
223 fprintf (file
, "(%d<<5)|%d", bf
>> 5, bf
& 31);
229 ft32_print_operand (file
, XEXP (x
, 0), 0);
234 LOSE_AND_RETURN ("invalid operand modifier letter", x
);
237 /* Print an operand as without a modifier letter. */
238 switch (GET_CODE (operand
))
241 fprintf (file
, "%s", reg_names
[REGNO (operand
)]);
245 output_address (GET_MODE (XEXP (operand
, 0)), XEXP (operand
, 0));
249 /* No need to handle all strange variants, let output_addr_const
251 if (CONSTANT_P (operand
))
253 output_addr_const (file
, operand
);
257 LOSE_AND_RETURN ("unexpected operand", x
);
262 ft32_load_immediate (rtx dst
, int32_t i
)
266 if ((-524288 <= i
) && (i
<= 524287))
268 sprintf (pattern
, "ldk.l %%0,%d", i
);
269 output_asm_insn (pattern
, &dst
);
271 else if ((-536870912 <= i
) && (i
<= 536870911))
273 ft32_load_immediate (dst
, i
>> 10);
274 sprintf (pattern
, "ldl.l %%0,%%0,%d", i
& 1023);
275 output_asm_insn (pattern
, &dst
);
279 int rd
; // rotate distance
281 for (rd
= 1; rd
< 32; rd
++)
283 u
= ((u
>> 31) & 1) | (u
<< 1);
284 if ((-524288 <= (int32_t) u
) && ((int32_t) u
<= 524287))
286 ft32_load_immediate (dst
, (int32_t) u
);
287 sprintf (pattern
, "ror.l %%0,%%0,%d", rd
);
288 output_asm_insn (pattern
, &dst
);
292 ft32_load_immediate (dst
, i
>> 10);
293 sprintf (pattern
, "ldl.l %%0,%%0,%d", i
& 1023);
294 output_asm_insn (pattern
, &dst
);
300 // x is a bit mask, for example:
301 // 00000000000000000000001111111110
302 // If x contains a single bit mask, return the bitfield spec.
303 // in the above case it returns ((9 << 5) | 1)
304 // Otherwise return -1.
307 #define NBITS(n) ((1U << (n)) - 1U)
310 ft32_as_bitfield (unsigned int x
)
317 for (lobit
= 0; lobit
< 32; lobit
++)
318 if (x
& (1 << lobit
))
320 for (hibit
= 31; hibit
>= 0; hibit
--)
321 if (x
& (1 << hibit
))
324 int width
= 1 + hibit
- lobit
;
328 if (x
!= (NBITS (width
) << lobit
))
329 return -1; // not a clean bitfield
331 return ((width
& 15) << 5) | lobit
;
334 /* Per-function machine data. */
335 struct GTY (()) machine_function
337 /* Number of bytes saved on the stack for callee saved registers. */
338 int callee_saved_reg_size
;
340 /* Number of bytes saved on the stack for local variables. */
343 /* The sum of 2 sizes: locals vars and padding byte for saving the
344 * registers. Used in expand_prologue () and expand_epilogue (). */
345 int size_for_adjusting_sp
;
348 /* Zero initialization is OK for all current fields. */
350 static struct machine_function
*
351 ft32_init_machine_status (void)
353 return ggc_cleared_alloc
< machine_function
> ();
357 /* The TARGET_OPTION_OVERRIDE worker.
358 All this curently does is set init_machine_status. */
360 ft32_option_override (void)
362 /* Set the per-function-data initializer. */
363 init_machine_status
= ft32_init_machine_status
;
366 /* Implement targetm.select_section. */
368 ft32_select_section (tree decl
, int reloc
, unsigned HOST_WIDE_INT align
)
370 /* Variables and constants defined in the __ea address space
371 go into a special section named "._ea". */
372 if (TREE_TYPE (decl
) != error_mark_node
373 && TYPE_ADDR_SPACE (TREE_TYPE (decl
)) == ADDR_SPACE_PM
)
375 /* We might get called with string constants, but get_named_section
376 doesn't like them as they are not DECLs. Also, we need to set
377 flags in that case. */
379 return get_section ("._pm", SECTION_WRITE
| SECTION_DEBUG
, NULL
);
381 return get_named_section (decl
, "._pm", reloc
);
384 return default_elf_select_section (decl
, reloc
, align
);
387 /* Compute the size of the local area and the size to be adjusted by the
388 * prologue and epilogue. */
391 ft32_compute_frame (void)
393 /* For aligning the local variables. */
394 int stack_alignment
= STACK_BOUNDARY
/ BITS_PER_UNIT
;
398 /* Padding needed for each element of the frame. */
399 cfun
->machine
->local_vars_size
= get_frame_size ();
401 /* Align to the stack alignment. */
402 padding_locals
= cfun
->machine
->local_vars_size
% stack_alignment
;
404 padding_locals
= stack_alignment
- padding_locals
;
406 cfun
->machine
->local_vars_size
+= padding_locals
;
408 cfun
->machine
->callee_saved_reg_size
= 0;
410 /* Save callee-saved registers. */
411 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
412 if (df_regs_ever_live_p (regno
) && (!call_used_regs
[regno
]))
413 cfun
->machine
->callee_saved_reg_size
+= 4;
415 cfun
->machine
->size_for_adjusting_sp
=
416 0 // crtl->args.pretend_args_size
417 + cfun
->machine
->local_vars_size
418 + (ACCUMULATE_OUTGOING_ARGS
? crtl
->outgoing_args_size
: 0);
421 // Must use LINK/UNLINK when...
422 // the frame is bigger than 512 bytes so cannot just "SUB" from SP
423 // the function actually uses $fp
428 int bigframe
= (cfun
->machine
->size_for_adjusting_sp
>= 512);
429 return (bigframe
|| frame_pointer_needed
|| df_regs_ever_live_p (FT32_FP
)
430 || df_regs_ever_live_p (FT32_FP
));
434 ft32_expand_prologue (void)
439 ft32_compute_frame ();
441 int args_to_push
= crtl
->args
.pretend_args_size
;
446 insn
= emit_insn (gen_movsi_pop ((gen_rtx_REG (Pmode
, FT32_R29
))));
448 for (i
= 0; i
< (args_to_push
/ 4); i
++)
451 emit_insn (gen_movsi_push ((gen_rtx_REG (Pmode
, FT32_R5
- i
))));
452 RTX_FRAME_RELATED_P (insn
) = 1;
455 insn
= emit_insn (gen_movsi_push ((gen_rtx_REG (Pmode
, FT32_R29
))));
458 if (flag_stack_usage_info
)
459 current_function_static_stack_size
= cfun
->machine
->size_for_adjusting_sp
;
461 if (!must_link () && (cfun
->machine
->callee_saved_reg_size
== 4))
465 (gen_rtx_REG (Pmode
, FT32_R13
),
466 GEN_INT (-cfun
->machine
->size_for_adjusting_sp
)));
467 RTX_FRAME_RELATED_P (insn
) = 1;
470 /* Save callee-saved registers. */
473 for (regno
= FIRST_PSEUDO_REGISTER
; regno
-- > 0;)
475 if (!fixed_regs
[regno
] && !call_used_regs
[regno
]
476 && df_regs_ever_live_p (regno
))
478 rtx preg
= gen_rtx_REG (Pmode
, regno
);
479 emit_insn (gen_call_prolog (preg
));
486 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
488 if (!fixed_regs
[regno
] && df_regs_ever_live_p (regno
)
489 && !call_used_regs
[regno
])
491 insn
= emit_insn (gen_movsi_push (gen_rtx_REG (Pmode
, regno
)));
492 RTX_FRAME_RELATED_P (insn
) = 1;
497 if (65536 <= cfun
->machine
->size_for_adjusting_sp
)
499 error ("stack frame must be smaller than 64K");
506 (gen_rtx_REG (Pmode
, FT32_FP
),
507 GEN_INT (-cfun
->machine
->size_for_adjusting_sp
)));
508 RTX_FRAME_RELATED_P (insn
) = 1;
510 else if (cfun
->machine
->size_for_adjusting_sp
> 0)
512 int adj
= cfun
->machine
->size_for_adjusting_sp
;
513 insn
= emit_insn (gen_addsi3 (gen_rtx_REG (SImode
, FT32_SP
),
514 gen_rtx_REG (SImode
, FT32_SP
),
516 RTX_FRAME_RELATED_P (insn
) = 1;
521 ft32_expand_epilogue (void)
524 int pretend
= crtl
->args
.pretend_args_size
;
527 && (cfun
->machine
->size_for_adjusting_sp
== 24)
528 && (cfun
->machine
->callee_saved_reg_size
== 0))
530 emit_jump_insn (gen_returner24 ());
534 // Set when the epilog code will also add 24 to $sp
535 int epilog24
= (!must_link ()
536 && (cfun
->machine
->size_for_adjusting_sp
== 24)
541 emit_insn (gen_unlink ());
543 else if (!epilog24
&& (cfun
->machine
->size_for_adjusting_sp
> 0))
545 emit_insn (gen_addsi3 (gen_rtx_REG (SImode
, FT32_SP
),
546 gen_rtx_REG (SImode
, FT32_SP
),
547 GEN_INT (cfun
->machine
->size_for_adjusting_sp
)));
550 if (cfun
->machine
->callee_saved_reg_size
!= 0)
552 for (regno
= FIRST_PSEUDO_REGISTER
; regno
-- > 0;)
554 if (!fixed_regs
[regno
] && !call_used_regs
[regno
]
555 && df_regs_ever_live_p (regno
))
557 rtx preg
= gen_rtx_REG (Pmode
, regno
);
558 if (optimize_size
&& (pretend
== 0))
561 emit_insn (gen_jump_epilog24 (preg
));
563 emit_insn (gen_jump_epilog (preg
));
566 emit_insn (gen_movsi_pop (preg
));
572 emit_jump_insn (gen_pretend_returner (GEN_INT (pretend
)));
574 emit_jump_insn (gen_returner ());
577 #undef TARGET_FRAME_POINTER_REQUIRED
578 #define TARGET_FRAME_POINTER_REQUIRED ft32_frame_pointer_required
580 ft32_frame_pointer_required (void)
582 return cfun
->calls_alloca
;
585 #undef TARGET_CAN_ELIMINATE
586 #define TARGET_CAN_ELIMINATE ft32_can_eliminate
588 /* Return true if register FROM can be eliminated via register TO. */
591 ft32_can_eliminate (const int from ATTRIBUTE_UNUSED
, const int to
)
594 return (to
== FRAME_POINTER_REGNUM
) || !ft32_frame_pointer_required ();
597 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */
600 ft32_initial_elimination_offset (int from
, int to
)
602 ft32_compute_frame ();
604 if (from
== ARG_POINTER_REGNUM
&& to
== FRAME_POINTER_REGNUM
)
606 return cfun
->machine
->callee_saved_reg_size
+ 2 * UNITS_PER_WORD
;
609 if (from
== ARG_POINTER_REGNUM
&& to
== STACK_POINTER_REGNUM
)
612 arg_offset
= must_link ()? 2 : 1;
613 return ((cfun
->machine
->callee_saved_reg_size
614 + arg_offset
* UNITS_PER_WORD
)
615 + cfun
->machine
->size_for_adjusting_sp
);
618 if ((from
== FRAME_POINTER_REGNUM
) && (to
== STACK_POINTER_REGNUM
))
620 return cfun
->machine
->size_for_adjusting_sp
;
626 /* Worker function for TARGET_SETUP_INCOMING_VARARGS. */
629 ft32_setup_incoming_varargs (cumulative_args_t cum_v
,
631 tree type ATTRIBUTE_UNUSED
,
632 int *pretend_size
, int no_rtl ATTRIBUTE_UNUSED
)
634 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
636 GET_MODE_SIZE (SImode
) * (*cum
- FT32_R0
) + GET_MODE_SIZE (mode
);
639 *pretend_size
= 24 - named_size
;
644 /* Return the fixed registers used for condition codes. */
647 ft32_fixed_condition_code_regs (unsigned int *p1
, unsigned int *p2
)
650 *p2
= INVALID_REGNUM
;
654 /* Return the next register to be used to hold a function argument or
655 NULL_RTX if there's no more space. */
658 ft32_function_arg (cumulative_args_t cum_v
, machine_mode mode
,
659 const_tree type ATTRIBUTE_UNUSED
,
660 bool named ATTRIBUTE_UNUSED
)
662 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
665 return gen_rtx_REG (mode
, *cum
);
670 #define FT32_FUNCTION_ARG_SIZE(MODE, TYPE) \
671 ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \
672 : (unsigned) int_size_in_bytes (TYPE))
675 ft32_function_arg_advance (cumulative_args_t cum_v
, machine_mode mode
,
676 const_tree type
, bool named ATTRIBUTE_UNUSED
)
678 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
680 *cum
= (*cum
< FT32_R6
681 ? *cum
+ ((3 + FT32_FUNCTION_ARG_SIZE (mode
, type
)) / 4) : *cum
);
684 /* Return non-zero if the function argument described by TYPE is to be
685 passed by reference. */
688 ft32_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED
,
689 machine_mode mode
, const_tree type
,
690 bool named ATTRIBUTE_UNUSED
)
692 unsigned HOST_WIDE_INT size
;
696 if (AGGREGATE_TYPE_P (type
))
698 size
= int_size_in_bytes (type
);
701 size
= GET_MODE_SIZE (mode
);
706 /* Some function arguments will only partially fit in the registers
707 that hold arguments. Given a new arg, return the number of bytes
708 that fit in argument passing registers. */
711 ft32_arg_partial_bytes (cumulative_args_t cum_v
,
712 machine_mode mode
, tree type
, bool named
)
714 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
715 int bytes_left
, size
;
720 if (ft32_pass_by_reference (cum_v
, mode
, type
, named
))
724 if (AGGREGATE_TYPE_P (type
))
726 size
= int_size_in_bytes (type
);
729 size
= GET_MODE_SIZE (mode
);
731 bytes_left
= (4 * 6) - ((*cum
- 2) * 4);
733 if (size
> bytes_left
)
739 /* Used by constraints.md to distinguish between GENERIC and PM
743 ft32_is_mem_pm (rtx o
)
746 && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (o
)));
749 /* The Global `targetm' Variable. */
751 /* Initialize the GCC target structure. */
753 #undef TARGET_PROMOTE_PROTOTYPES
754 #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
756 #undef TARGET_RETURN_IN_MEMORY
757 #define TARGET_RETURN_IN_MEMORY ft32_return_in_memory
758 #undef TARGET_MUST_PASS_IN_STACK
759 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
760 #undef TARGET_PASS_BY_REFERENCE
761 #define TARGET_PASS_BY_REFERENCE ft32_pass_by_reference
762 #undef TARGET_ARG_PARTIAL_BYTES
763 #define TARGET_ARG_PARTIAL_BYTES ft32_arg_partial_bytes
764 #undef TARGET_FUNCTION_ARG
765 #define TARGET_FUNCTION_ARG ft32_function_arg
766 #undef TARGET_FUNCTION_ARG_ADVANCE
767 #define TARGET_FUNCTION_ARG_ADVANCE ft32_function_arg_advance
770 #undef TARGET_SETUP_INCOMING_VARARGS
771 #define TARGET_SETUP_INCOMING_VARARGS ft32_setup_incoming_varargs
773 #undef TARGET_FIXED_CONDITION_CODE_REGS
774 #define TARGET_FIXED_CONDITION_CODE_REGS ft32_fixed_condition_code_regs
776 /* Define this to return an RTX representing the place where a
777 function returns or receives a value of data type RET_TYPE, a tree
778 node representing a data type. */
779 #undef TARGET_FUNCTION_VALUE
780 #define TARGET_FUNCTION_VALUE ft32_function_value
781 #undef TARGET_LIBCALL_VALUE
782 #define TARGET_LIBCALL_VALUE ft32_libcall_value
783 #undef TARGET_FUNCTION_VALUE_REGNO_P
784 #define TARGET_FUNCTION_VALUE_REGNO_P ft32_function_value_regno_p
786 #undef TARGET_OPTION_OVERRIDE
787 #define TARGET_OPTION_OVERRIDE ft32_option_override
789 #undef TARGET_ASM_SELECT_SECTION
790 #define TARGET_ASM_SELECT_SECTION ft32_select_section
792 #undef TARGET_VALID_POINTER_MODE
793 #define TARGET_VALID_POINTER_MODE ft32_valid_pointer_mode
795 ft32_valid_pointer_mode (scalar_int_mode mode
)
802 #undef TARGET_ADDR_SPACE_POINTER_MODE
803 #define TARGET_ADDR_SPACE_POINTER_MODE ft32_addr_space_pointer_mode
804 static scalar_int_mode
805 ft32_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED
)
810 #undef TARGET_ADDR_SPACE_ADDRESS_MODE
811 #define TARGET_ADDR_SPACE_ADDRESS_MODE ft32_addr_space_address_mode
812 static scalar_int_mode
813 ft32_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED
)
818 #undef TARGET_ADDR_SPACE_SUBSET_P
819 #define TARGET_ADDR_SPACE_SUBSET_P ft32_addr_space_subset_p
821 ft32_addr_space_subset_p (addr_space_t subset ATTRIBUTE_UNUSED
,
822 addr_space_t superset ATTRIBUTE_UNUSED
)
827 #undef TARGET_CASE_VALUES_THRESHOLD
828 #define TARGET_CASE_VALUES_THRESHOLD ft32_target_case_values_threshold
831 ft32_target_case_values_threshold (void)
836 #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
837 #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \
838 ft32_addr_space_legitimate_address_p
841 // Enabling LRA gives the infamous
842 // internal compiler error: Max. number of generated reload insns per insn is achieved (90)
843 // errors e.g. when compiling sieve.c
848 return ft32_lra_flag
;
852 #define TARGET_LRA_P ft32_lra_p
855 reg_ok_for_base_p (rtx r
, bool strict
)
859 return (HARD_REGNO_OK_FOR_BASE_P (NUM
)
860 || HARD_REGNO_OK_FOR_BASE_P (reg_renumber
[(NUM
)]));
862 return ((NUM
) >= FIRST_PSEUDO_REGISTER
|| HARD_REGNO_OK_FOR_BASE_P (NUM
));
866 ft32_addr_space_legitimate_address_p (machine_mode mode
, rtx x
, bool strict
,
867 addr_space_t as ATTRIBUTE_UNUSED
)
871 if (GET_CODE (x
) == PLUS
)
876 if (GET_CODE (op1
) == REG
878 && INTVAL (op2
) >= -128
879 && INTVAL (op2
) < 128 && reg_ok_for_base_p (op1
, strict
))
881 if (GET_CODE (op1
) == SYMBOL_REF
&& CONST_INT_P (op2
))
884 if (REG_P (x
) && reg_ok_for_base_p (x
, strict
))
886 if (GET_CODE (x
) == SYMBOL_REF
887 || GET_CODE (x
) == LABEL_REF
|| CONST_INT_P (x
))
892 if (REG_P (x
) && reg_ok_for_base_p (x
, strict
))
901 #undef TARGET_ENCODE_SECTION_INFO
902 #define TARGET_ENCODE_SECTION_INFO ft32_elf_encode_section_info
905 ft32_elf_encode_section_info (tree decl
, rtx rtl
, int first
)
910 /* Careful not to prod global register variables. */
913 symbol
= XEXP (rtl
, 0);
914 if (GET_CODE (symbol
) != SYMBOL_REF
)
917 default_encode_section_info (decl
, rtl
, first
);
919 code
= TREE_CODE (decl
);
920 switch (TREE_CODE_CLASS (code
))
922 case tcc_declaration
:
924 tree type
= TREE_TYPE (decl
);
925 int is_flash
= (type
&& TYPE_P (type
)
926 && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (type
)));
927 if ((code
== VAR_DECL
) && !is_flash
)
928 SYMBOL_REF_FLAGS (symbol
) |= 0x1000;
933 case tcc_exceptional
:
934 if (code
== STRING_CST
)
935 SYMBOL_REF_FLAGS (symbol
) |= 0x1000;
943 struct gcc_target targetm
= TARGET_INITIALIZER
;