1 /* Target Code for ft32
2 Copyright (C) 2015-2025 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/>. */
21 #define IN_TARGET_CODE 1
25 #include "coretypes.h"
30 #include "stringpool.h"
37 #include "diagnostic-core.h"
39 #include "stor-layout.h"
43 #include "print-tree.h"
45 /* This file should be included last. */
46 #include "target-def.h"
50 #define LOSE_AND_RETURN(msgid, x) \
53 ft32_operand_lossage (msgid, x); \
57 /* Worker function for TARGET_RETURN_IN_MEMORY. */
60 ft32_return_in_memory (const_tree type
, const_tree fntype ATTRIBUTE_UNUSED
)
62 const HOST_WIDE_INT size
= int_size_in_bytes (type
);
63 return (size
== -1 || size
> 2 * UNITS_PER_WORD
);
66 /* Define how to find the value returned by a function.
67 VALTYPE is the data type of the value (as a tree).
68 If the precise function being called is known, FUNC is its
69 FUNCTION_DECL; otherwise, FUNC is 0.
71 We always return values in register $r0 for ft32. */
74 ft32_function_value (const_tree valtype
,
75 const_tree fntype_or_decl ATTRIBUTE_UNUSED
,
76 bool outgoing ATTRIBUTE_UNUSED
)
78 return gen_rtx_REG (TYPE_MODE (valtype
), FT32_R0
);
81 /* Define how to find the value returned by a library function.
83 We always return values in register $r0 for ft32. */
86 ft32_libcall_value (machine_mode mode
, const_rtx fun ATTRIBUTE_UNUSED
)
88 return gen_rtx_REG (mode
, FT32_R0
);
91 /* Handle TARGET_FUNCTION_VALUE_REGNO_P.
93 We always return values in register $r0 for ft32. */
96 ft32_function_value_regno_p (const unsigned int regno
)
98 return (regno
== FT32_R0
);
101 /* Emit an error message when we're in an asm, and a fatal error for
102 "normal" insns. Formatted output isn't easily implemented, since we
103 use output_operand_lossage to output the actual message and handle the
104 categorization of the error. */
107 ft32_operand_lossage (const char *msgid
, rtx op
)
110 output_operand_lossage ("%s", msgid
);
113 /* The PRINT_OPERAND_ADDRESS worker. */
116 ft32_print_operand_address (FILE * file
, rtx x
)
118 switch (GET_CODE (x
))
121 fprintf (file
, "%s,0", reg_names
[REGNO (x
)]);
125 switch (GET_CODE (XEXP (x
, 1)))
128 fprintf (file
, "%s,%ld",
129 reg_names
[REGNO (XEXP (x
, 0))], INTVAL (XEXP (x
, 1)));
132 output_addr_const (file
, XEXP (x
, 1));
133 fprintf (file
, "(%s)", reg_names
[REGNO (XEXP (x
, 0))]);
137 rtx plus
= XEXP (XEXP (x
, 1), 0);
138 if (GET_CODE (XEXP (plus
, 0)) == SYMBOL_REF
139 && CONST_INT_P (XEXP (plus
, 1)))
141 output_addr_const (file
, XEXP (plus
, 0));
142 fprintf (file
, "+%ld(%s)", INTVAL (XEXP (plus
, 1)),
143 reg_names
[REGNO (XEXP (x
, 0))]);
155 output_addr_const (file
, x
);
160 /* The PRINT_OPERAND worker. */
163 ft32_print_operand (FILE * file
, rtx x
, int code
)
167 /* New code entries should just be added to the switch below. If
168 handling is finished, just return. If handling was just a
169 modification of the operand, the modified operand should be put in
170 "operand", and then do a break to let default handling
171 (zero-modifier) output the operand. */
176 /* No code, print as usual. */
180 if (GET_CODE (operand
) != REG
)
181 internal_error ("%<h%> applied to non-register operand");
182 fprintf (file
, "%s", reg_names
[REGNO (operand
) + 1]);
186 fprintf (file
, "%ld", (long) (- INTVAL(x
)));
189 case 'd': // a DW spec, from an integer alignment (for BLKmode insns)
206 internal_error ("bad alignment: %d", i
);
211 fprintf (file
, "%c", dwspec
);
217 int bf
= ft32_as_bitfield (INTVAL (x
));
218 fprintf (file
, "512|(%d<<5)|%d", bf
>> 5, bf
& 31);
224 int bf
= ft32_as_bitfield (0xffffffff ^ INTVAL (x
));
225 fprintf (file
, "(%d<<5)|%d", bf
>> 5, bf
& 31);
231 ft32_print_operand (file
, XEXP (x
, 0), 0);
236 LOSE_AND_RETURN ("invalid operand modifier letter", x
);
239 /* Print an operand as without a modifier letter. */
240 switch (GET_CODE (operand
))
243 fprintf (file
, "%s", reg_names
[REGNO (operand
)]);
247 output_address (GET_MODE (XEXP (operand
, 0)), XEXP (operand
, 0));
251 /* No need to handle all strange variants, let output_addr_const
253 if (CONSTANT_P (operand
))
255 output_addr_const (file
, operand
);
259 LOSE_AND_RETURN ("unexpected operand", x
);
264 ft32_load_immediate (rtx dst
, int32_t i
)
268 if (i
>= -524288 && i
<= 524287)
270 sprintf (pattern
, "ldk.l %%0,%d", i
);
271 output_asm_insn (pattern
, &dst
);
273 else if (i
>= -536870912 && i
<= 536870911)
275 ft32_load_immediate (dst
, i
>> 10);
276 sprintf (pattern
, "ldl.l %%0,%%0,%d", i
& 1023);
277 output_asm_insn (pattern
, &dst
);
281 int rd
; // rotate distance
283 for (rd
= 1; rd
< 32; rd
++)
285 u
= ((u
>> 31) & 1) | (u
<< 1);
286 if ((int32_t) u
>= -524288 && (int32_t) u
<= 524287)
288 ft32_load_immediate (dst
, (int32_t) u
);
289 sprintf (pattern
, "ror.l %%0,%%0,%d", rd
);
290 output_asm_insn (pattern
, &dst
);
294 ft32_load_immediate (dst
, i
>> 10);
295 sprintf (pattern
, "ldl.l %%0,%%0,%d", i
& 1023);
296 output_asm_insn (pattern
, &dst
);
302 // x is a bit mask, for example:
303 // 00000000000000000000001111111110
304 // If x contains a single bit mask, return the bitfield spec.
305 // in the above case it returns ((9 << 5) | 1)
306 // Otherwise return -1.
309 #define NBITS(n) ((1U << (n)) - 1U)
312 ft32_as_bitfield (unsigned int x
)
319 for (lobit
= 0; lobit
< 32; lobit
++)
320 if (x
& (1 << lobit
))
322 for (hibit
= 31; hibit
>= 0; hibit
--)
323 if (x
& (1 << hibit
))
326 int width
= 1 + hibit
- lobit
;
330 if (x
!= (NBITS (width
) << lobit
))
331 return -1; // not a clean bitfield
333 return ((width
& 15) << 5) | lobit
;
336 /* Per-function machine data. */
337 struct GTY (()) machine_function
339 /* Number of bytes saved on the stack for callee saved registers. */
340 int callee_saved_reg_size
;
342 /* Number of bytes saved on the stack for local variables. */
345 /* The sum of 2 sizes: locals vars and padding byte for saving the
346 * registers. Used in expand_prologue () and expand_epilogue (). */
347 int size_for_adjusting_sp
;
350 /* Zero initialization is OK for all current fields. */
352 static struct machine_function
*
353 ft32_init_machine_status (void)
355 return ggc_cleared_alloc
< machine_function
> ();
359 /* The TARGET_OPTION_OVERRIDE worker.
360 All this curently does is set init_machine_status. */
362 ft32_option_override (void)
364 /* Set the per-function-data initializer. */
365 init_machine_status
= ft32_init_machine_status
;
368 /* Implement targetm.select_section. */
370 ft32_select_section (tree decl
, int reloc
, unsigned HOST_WIDE_INT align
)
372 /* Variables and constants defined in the __ea address space
373 go into a special section named "._ea". */
374 if (TREE_TYPE (decl
) != error_mark_node
375 && TYPE_ADDR_SPACE (TREE_TYPE (decl
)) == ADDR_SPACE_PM
)
377 /* We might get called with string constants, but get_named_section
378 doesn't like them as they are not DECLs. Also, we need to set
379 flags in that case. */
381 return get_section ("._pm", SECTION_WRITE
| SECTION_DEBUG
, NULL
);
383 return get_named_section (decl
, "._pm", reloc
);
386 return default_elf_select_section (decl
, reloc
, align
);
389 /* Compute the size of the local area and the size to be adjusted by the
390 * prologue and epilogue. */
393 ft32_compute_frame (void)
395 /* For aligning the local variables. */
396 int stack_alignment
= STACK_BOUNDARY
/ BITS_PER_UNIT
;
400 /* Padding needed for each element of the frame. */
401 cfun
->machine
->local_vars_size
= get_frame_size ();
403 /* Align to the stack alignment. */
404 padding_locals
= cfun
->machine
->local_vars_size
% stack_alignment
;
406 padding_locals
= stack_alignment
- padding_locals
;
408 cfun
->machine
->local_vars_size
+= padding_locals
;
410 cfun
->machine
->callee_saved_reg_size
= 0;
412 /* Save callee-saved registers. */
413 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
414 if (df_regs_ever_live_p (regno
) && !call_used_or_fixed_reg_p (regno
))
415 cfun
->machine
->callee_saved_reg_size
+= 4;
417 cfun
->machine
->size_for_adjusting_sp
=
418 0 // crtl->args.pretend_args_size
419 + cfun
->machine
->local_vars_size
420 + (ACCUMULATE_OUTGOING_ARGS
421 ? (HOST_WIDE_INT
) crtl
->outgoing_args_size
: 0);
424 // Must use LINK/UNLINK when...
425 // the frame is bigger than 512 bytes so cannot just "SUB" from SP
426 // the function actually uses $fp
431 int bigframe
= (cfun
->machine
->size_for_adjusting_sp
>= 512);
432 return (bigframe
|| frame_pointer_needed
|| df_regs_ever_live_p (FT32_FP
)
433 || df_regs_ever_live_p (FT32_FP
));
437 ft32_expand_prologue (void)
442 ft32_compute_frame ();
444 int args_to_push
= crtl
->args
.pretend_args_size
;
449 insn
= emit_insn (gen_movsi_pop ((gen_rtx_REG (Pmode
, FT32_R29
))));
451 for (i
= 0; i
< (args_to_push
/ 4); i
++)
454 emit_insn (gen_movsi_push ((gen_rtx_REG (Pmode
, FT32_R5
- i
))));
455 RTX_FRAME_RELATED_P (insn
) = 1;
458 insn
= emit_insn (gen_movsi_push ((gen_rtx_REG (Pmode
, FT32_R29
))));
461 if (flag_stack_usage_info
)
462 current_function_static_stack_size
= cfun
->machine
->size_for_adjusting_sp
;
464 if (!must_link () && (cfun
->machine
->callee_saved_reg_size
== 4))
468 (gen_rtx_REG (Pmode
, FT32_R13
),
469 GEN_INT (-cfun
->machine
->size_for_adjusting_sp
)));
470 RTX_FRAME_RELATED_P (insn
) = 1;
473 /* Save callee-saved registers. */
476 for (regno
= FIRST_PSEUDO_REGISTER
; regno
-- > 0;)
478 if (!call_used_or_fixed_reg_p (regno
)
479 && df_regs_ever_live_p (regno
))
481 rtx preg
= gen_rtx_REG (Pmode
, regno
);
482 emit_insn (gen_call_prolog (preg
));
489 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
491 if (df_regs_ever_live_p (regno
)
492 && !call_used_or_fixed_reg_p (regno
))
494 insn
= emit_insn (gen_movsi_push (gen_rtx_REG (Pmode
, regno
)));
495 RTX_FRAME_RELATED_P (insn
) = 1;
500 if (cfun
->machine
->size_for_adjusting_sp
>= 65536)
502 error ("stack frame must be smaller than 64K");
509 (gen_rtx_REG (Pmode
, FT32_FP
),
510 GEN_INT (-cfun
->machine
->size_for_adjusting_sp
)));
511 RTX_FRAME_RELATED_P (insn
) = 1;
513 else if (cfun
->machine
->size_for_adjusting_sp
> 0)
515 int adj
= cfun
->machine
->size_for_adjusting_sp
;
516 insn
= emit_insn (gen_addsi3 (gen_rtx_REG (SImode
, FT32_SP
),
517 gen_rtx_REG (SImode
, FT32_SP
),
519 RTX_FRAME_RELATED_P (insn
) = 1;
524 ft32_expand_epilogue (void)
527 int pretend
= crtl
->args
.pretend_args_size
;
530 && (cfun
->machine
->size_for_adjusting_sp
== 24)
531 && (cfun
->machine
->callee_saved_reg_size
== 0))
533 emit_jump_insn (gen_returner24 ());
537 // Set when the epilog code will also add 24 to $sp
538 int epilog24
= (!must_link ()
539 && (cfun
->machine
->size_for_adjusting_sp
== 24)
544 emit_insn (gen_unlink ());
546 else if (!epilog24
&& (cfun
->machine
->size_for_adjusting_sp
> 0))
548 emit_insn (gen_addsi3 (gen_rtx_REG (SImode
, FT32_SP
),
549 gen_rtx_REG (SImode
, FT32_SP
),
550 GEN_INT (cfun
->machine
->size_for_adjusting_sp
)));
553 if (cfun
->machine
->callee_saved_reg_size
!= 0)
555 for (regno
= FIRST_PSEUDO_REGISTER
; regno
-- > 0;)
557 if (!call_used_or_fixed_reg_p (regno
)
558 && df_regs_ever_live_p (regno
))
560 rtx preg
= gen_rtx_REG (Pmode
, regno
);
561 if (optimize_size
&& (pretend
== 0))
564 emit_insn (gen_jump_epilog24 (preg
));
566 emit_insn (gen_jump_epilog (preg
));
569 emit_insn (gen_movsi_pop (preg
));
575 emit_jump_insn (gen_pretend_returner (GEN_INT (pretend
)));
577 emit_jump_insn (gen_returner ());
580 #undef TARGET_FRAME_POINTER_REQUIRED
581 #define TARGET_FRAME_POINTER_REQUIRED ft32_frame_pointer_required
583 ft32_frame_pointer_required (void)
585 return cfun
->calls_alloca
;
588 #undef TARGET_CAN_ELIMINATE
589 #define TARGET_CAN_ELIMINATE ft32_can_eliminate
591 /* Return true if register FROM can be eliminated via register TO. */
594 ft32_can_eliminate (const int from ATTRIBUTE_UNUSED
, const int to
)
597 return (to
== FRAME_POINTER_REGNUM
) || !ft32_frame_pointer_required ();
600 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */
603 ft32_initial_elimination_offset (int from
, int to
)
605 ft32_compute_frame ();
607 if (from
== ARG_POINTER_REGNUM
&& to
== FRAME_POINTER_REGNUM
)
609 return cfun
->machine
->callee_saved_reg_size
+ 2 * UNITS_PER_WORD
;
612 if (from
== ARG_POINTER_REGNUM
&& to
== STACK_POINTER_REGNUM
)
615 arg_offset
= must_link ()? 2 : 1;
616 return ((cfun
->machine
->callee_saved_reg_size
617 + arg_offset
* UNITS_PER_WORD
)
618 + cfun
->machine
->size_for_adjusting_sp
);
621 if ((from
== FRAME_POINTER_REGNUM
) && (to
== STACK_POINTER_REGNUM
))
623 return cfun
->machine
->size_for_adjusting_sp
;
629 /* Worker function for TARGET_SETUP_INCOMING_VARARGS. */
632 ft32_setup_incoming_varargs (cumulative_args_t cum_v
,
633 const function_arg_info
&arg
,
634 int *pretend_size
, int no_rtl ATTRIBUTE_UNUSED
)
636 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
638 if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl
))
639 || arg
.type
!= NULL_TREE
)
641 = GET_MODE_SIZE (SImode
) * (*cum
- FT32_R0
) + GET_MODE_SIZE (arg
.mode
);
644 *pretend_size
= 24 - named_size
;
649 /* Return the fixed registers used for condition codes. */
652 ft32_fixed_condition_code_regs (unsigned int *p1
, unsigned int *p2
)
655 *p2
= INVALID_REGNUM
;
659 /* Return the next register to be used to hold a function argument or
660 NULL_RTX if there's no more space. */
663 ft32_function_arg (cumulative_args_t cum_v
, const function_arg_info
&arg
)
665 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
668 return gen_rtx_REG (arg
.mode
, *cum
);
673 #define FT32_FUNCTION_ARG_SIZE(MODE, TYPE) \
674 ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \
675 : (unsigned) int_size_in_bytes (TYPE))
678 ft32_function_arg_advance (cumulative_args_t cum_v
,
679 const function_arg_info
&arg
)
681 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
683 *cum
= (*cum
< FT32_R6
684 ? *cum
+ ((3 + FT32_FUNCTION_ARG_SIZE (arg
.mode
, arg
.type
)) / 4)
688 /* Return non-zero if the function argument described by ARG is to be
689 passed by reference. */
692 ft32_pass_by_reference (cumulative_args_t
, const function_arg_info
&arg
)
694 if (arg
.aggregate_type_p ())
696 unsigned HOST_WIDE_INT size
= arg
.type_size_in_bytes ();
700 /* Some function arguments will only partially fit in the registers
701 that hold arguments. Given a new arg, return the number of bytes
702 that fit in argument passing registers. */
705 ft32_arg_partial_bytes (cumulative_args_t cum_v
, const function_arg_info
&arg
)
707 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
708 int bytes_left
, size
;
713 if (ft32_pass_by_reference (cum_v
, arg
))
717 if (AGGREGATE_TYPE_P (arg
.type
))
719 size
= int_size_in_bytes (arg
.type
);
722 size
= GET_MODE_SIZE (arg
.mode
);
724 bytes_left
= (4 * 6) - ((*cum
- 2) * 4);
726 if (size
> bytes_left
)
732 /* Used by constraints.md to distinguish between GENERIC and PM
736 ft32_is_mem_pm (rtx o
)
739 && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (o
)));
742 /* The Global `targetm' Variable. */
744 /* Initialize the GCC target structure. */
746 #undef TARGET_PROMOTE_PROTOTYPES
747 #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
749 #undef TARGET_RETURN_IN_MEMORY
750 #define TARGET_RETURN_IN_MEMORY ft32_return_in_memory
751 #undef TARGET_MUST_PASS_IN_STACK
752 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
753 #undef TARGET_PASS_BY_REFERENCE
754 #define TARGET_PASS_BY_REFERENCE ft32_pass_by_reference
755 #undef TARGET_ARG_PARTIAL_BYTES
756 #define TARGET_ARG_PARTIAL_BYTES ft32_arg_partial_bytes
757 #undef TARGET_FUNCTION_ARG
758 #define TARGET_FUNCTION_ARG ft32_function_arg
759 #undef TARGET_FUNCTION_ARG_ADVANCE
760 #define TARGET_FUNCTION_ARG_ADVANCE ft32_function_arg_advance
763 #undef TARGET_SETUP_INCOMING_VARARGS
764 #define TARGET_SETUP_INCOMING_VARARGS ft32_setup_incoming_varargs
766 #undef TARGET_FIXED_CONDITION_CODE_REGS
767 #define TARGET_FIXED_CONDITION_CODE_REGS ft32_fixed_condition_code_regs
769 /* Define this to return an RTX representing the place where a
770 function returns or receives a value of data type RET_TYPE, a tree
771 node representing a data type. */
772 #undef TARGET_FUNCTION_VALUE
773 #define TARGET_FUNCTION_VALUE ft32_function_value
774 #undef TARGET_LIBCALL_VALUE
775 #define TARGET_LIBCALL_VALUE ft32_libcall_value
776 #undef TARGET_FUNCTION_VALUE_REGNO_P
777 #define TARGET_FUNCTION_VALUE_REGNO_P ft32_function_value_regno_p
779 #undef TARGET_OPTION_OVERRIDE
780 #define TARGET_OPTION_OVERRIDE ft32_option_override
782 #undef TARGET_ASM_SELECT_SECTION
783 #define TARGET_ASM_SELECT_SECTION ft32_select_section
785 #undef TARGET_VALID_POINTER_MODE
786 #define TARGET_VALID_POINTER_MODE ft32_valid_pointer_mode
788 ft32_valid_pointer_mode (scalar_int_mode mode
)
795 #undef TARGET_ADDR_SPACE_POINTER_MODE
796 #define TARGET_ADDR_SPACE_POINTER_MODE ft32_addr_space_pointer_mode
797 static scalar_int_mode
798 ft32_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED
)
803 #undef TARGET_ADDR_SPACE_ADDRESS_MODE
804 #define TARGET_ADDR_SPACE_ADDRESS_MODE ft32_addr_space_address_mode
805 static scalar_int_mode
806 ft32_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED
)
811 #undef TARGET_ADDR_SPACE_SUBSET_P
812 #define TARGET_ADDR_SPACE_SUBSET_P ft32_addr_space_subset_p
814 ft32_addr_space_subset_p (addr_space_t subset ATTRIBUTE_UNUSED
,
815 addr_space_t superset ATTRIBUTE_UNUSED
)
820 #undef TARGET_CASE_VALUES_THRESHOLD
821 #define TARGET_CASE_VALUES_THRESHOLD ft32_target_case_values_threshold
824 ft32_target_case_values_threshold (void)
829 #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
830 #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \
831 ft32_addr_space_legitimate_address_p
835 reg_ok_for_base_p (rtx r
, bool strict
)
839 return (HARD_REGNO_OK_FOR_BASE_P (NUM
)
840 || HARD_REGNO_OK_FOR_BASE_P (reg_renumber
[(NUM
)]));
842 return ((NUM
) >= FIRST_PSEUDO_REGISTER
|| HARD_REGNO_OK_FOR_BASE_P (NUM
));
846 ft32_addr_space_legitimate_address_p (machine_mode mode
, rtx x
, bool strict
,
847 addr_space_t as ATTRIBUTE_UNUSED
,
848 code_helper
= ERROR_MARK
)
850 int max_offset
= TARGET_FT32B
? 16384 : 128;
854 if (GET_CODE (x
) == PLUS
)
859 if (GET_CODE (op1
) == REG
861 && (-max_offset
<= INTVAL (op2
))
862 && (INTVAL (op2
) < max_offset
)
863 && reg_ok_for_base_p (op1
, strict
))
865 if (GET_CODE (op1
) == SYMBOL_REF
&& CONST_INT_P (op2
))
868 if (REG_P (x
) && reg_ok_for_base_p (x
, strict
))
870 if (GET_CODE (x
) == SYMBOL_REF
871 || GET_CODE (x
) == LABEL_REF
|| CONST_INT_P (x
))
876 if (REG_P (x
) && reg_ok_for_base_p (x
, strict
))
885 #undef TARGET_ENCODE_SECTION_INFO
886 #define TARGET_ENCODE_SECTION_INFO ft32_elf_encode_section_info
889 ft32_elf_encode_section_info (tree decl
, rtx rtl
, int first
)
894 /* Careful not to prod global register variables. */
897 symbol
= XEXP (rtl
, 0);
898 if (GET_CODE (symbol
) != SYMBOL_REF
)
901 default_encode_section_info (decl
, rtl
, first
);
903 code
= TREE_CODE (decl
);
904 switch (TREE_CODE_CLASS (code
))
906 case tcc_declaration
:
908 tree type
= TREE_TYPE (decl
);
909 int is_flash
= (type
&& TYPE_P (type
)
910 && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (type
)));
911 if ((code
== VAR_DECL
) && !is_flash
)
912 SYMBOL_REF_FLAGS (symbol
) |= 0x1000;
917 case tcc_exceptional
:
918 if (code
== STRING_CST
)
919 SYMBOL_REF_FLAGS (symbol
) |= 0x1000;
927 #undef TARGET_CONSTANT_ALIGNMENT
928 #define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings
930 struct gcc_target targetm
= TARGET_INITIALIZER
;