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"
33 #include "diagnostic-core.h"
35 #include "stor-layout.h"
39 #include "print-tree.h"
41 /* This file should be included last. */
42 #include "target-def.h"
46 #define LOSE_AND_RETURN(msgid, x) \
49 ft32_operand_lossage (msgid, x); \
53 /* Worker function for TARGET_RETURN_IN_MEMORY. */
56 ft32_return_in_memory (const_tree type
, const_tree fntype ATTRIBUTE_UNUSED
)
58 const HOST_WIDE_INT size
= int_size_in_bytes (type
);
59 return (size
== -1 || size
> 2 * UNITS_PER_WORD
);
62 /* Define how to find the value returned by a function.
63 VALTYPE is the data type of the value (as a tree).
64 If the precise function being called is known, FUNC is its
65 FUNCTION_DECL; otherwise, FUNC is 0.
67 We always return values in register $r0 for ft32. */
70 ft32_function_value (const_tree valtype
,
71 const_tree fntype_or_decl ATTRIBUTE_UNUSED
,
72 bool outgoing ATTRIBUTE_UNUSED
)
74 return gen_rtx_REG (TYPE_MODE (valtype
), FT32_R0
);
77 /* Define how to find the value returned by a library function.
79 We always return values in register $r0 for ft32. */
82 ft32_libcall_value (enum machine_mode mode
, const_rtx fun ATTRIBUTE_UNUSED
)
84 return gen_rtx_REG (mode
, FT32_R0
);
87 /* Handle TARGET_FUNCTION_VALUE_REGNO_P.
89 We always return values in register $r0 for ft32. */
92 ft32_function_value_regno_p (const unsigned int regno
)
94 return (regno
== FT32_R0
);
97 /* Emit an error message when we're in an asm, and a fatal error for
98 "normal" insns. Formatted output isn't easily implemented, since we
99 use output_operand_lossage to output the actual message and handle the
100 categorization of the error. */
103 ft32_operand_lossage (const char *msgid
, rtx op
)
106 output_operand_lossage ("%s", msgid
);
109 /* The PRINT_OPERAND_ADDRESS worker. */
112 ft32_print_operand_address (FILE * file
, rtx x
)
114 switch (GET_CODE (x
))
117 fprintf (file
, "%s,0", reg_names
[REGNO (x
)]);
121 switch (GET_CODE (XEXP (x
, 1)))
124 fprintf (file
, "%s,%ld",
125 reg_names
[REGNO (XEXP (x
, 0))], INTVAL (XEXP (x
, 1)));
128 output_addr_const (file
, XEXP (x
, 1));
129 fprintf (file
, "(%s)", reg_names
[REGNO (XEXP (x
, 0))]);
133 rtx plus
= XEXP (XEXP (x
, 1), 0);
134 if (GET_CODE (XEXP (plus
, 0)) == SYMBOL_REF
135 && CONST_INT_P (XEXP (plus
, 1)))
137 output_addr_const (file
, XEXP (plus
, 0));
138 fprintf (file
, "+%ld(%s)", INTVAL (XEXP (plus
, 1)),
139 reg_names
[REGNO (XEXP (x
, 0))]);
151 output_addr_const (file
, x
);
156 /* The PRINT_OPERAND worker. */
159 ft32_print_operand (FILE * file
, rtx x
, int code
)
163 /* New code entries should just be added to the switch below. If
164 handling is finished, just return. If handling was just a
165 modification of the operand, the modified operand should be put in
166 "operand", and then do a break to let default handling
167 (zero-modifier) output the operand. */
172 /* No code, print as usual. */
176 if (GET_CODE (operand
) != REG
)
177 internal_error ("'h' applied to non-register operand");
178 fprintf (file
, "%s", reg_names
[REGNO (operand
) + 1]);
182 fprintf (file
, "%ld", (long) (- INTVAL(x
)));
185 case 'd': // a DW spec, from an integer alignment (for BLKmode insns)
202 internal_error ("bad alignment: %d", i
);
207 fprintf (file
, "%c", dwspec
);
213 int bf
= ft32_as_bitfield (INTVAL (x
));
214 fprintf (file
, "512|(%d<<5)|%d", bf
>> 5, bf
& 31);
220 int bf
= ft32_as_bitfield (0xffffffff ^ INTVAL (x
));
221 fprintf (file
, "(%d<<5)|%d", bf
>> 5, bf
& 31);
227 ft32_print_operand (file
, XEXP (x
, 0), 0);
232 LOSE_AND_RETURN ("invalid operand modifier letter", x
);
235 /* Print an operand as without a modifier letter. */
236 switch (GET_CODE (operand
))
239 fprintf (file
, "%s", reg_names
[REGNO (operand
)]);
243 output_address (GET_MODE (XEXP (operand
, 0)), XEXP (operand
, 0));
247 /* No need to handle all strange variants, let output_addr_const
249 if (CONSTANT_P (operand
))
251 output_addr_const (file
, operand
);
255 LOSE_AND_RETURN ("unexpected operand", x
);
260 ft32_load_immediate (rtx dst
, int32_t i
)
264 if ((-524288 <= i
) && (i
<= 524287))
266 sprintf (pattern
, "ldk.l %%0,%d", i
);
267 output_asm_insn (pattern
, &dst
);
269 else if ((-536870912 <= i
) && (i
<= 536870911))
271 ft32_load_immediate (dst
, i
>> 10);
272 sprintf (pattern
, "ldl.l %%0,%%0,%d", i
& 1023);
273 output_asm_insn (pattern
, &dst
);
277 int rd
; // rotate distance
279 for (rd
= 1; rd
< 32; rd
++)
281 u
= ((u
>> 31) & 1) | (u
<< 1);
282 if ((-524288 <= (int32_t) u
) && ((int32_t) u
<= 524287))
284 ft32_load_immediate (dst
, (int32_t) u
);
285 sprintf (pattern
, "ror.l %%0,%%0,%d", rd
);
286 output_asm_insn (pattern
, &dst
);
290 ft32_load_immediate (dst
, i
>> 10);
291 sprintf (pattern
, "ldl.l %%0,%%0,%d", i
& 1023);
292 output_asm_insn (pattern
, &dst
);
298 // x is a bit mask, for example:
299 // 00000000000000000000001111111110
300 // If x contains a single bit mask, return the bitfield spec.
301 // in the above case it returns ((9 << 5) | 1)
302 // Otherwise return -1.
305 #define NBITS(n) ((1U << (n)) - 1U)
308 ft32_as_bitfield (unsigned int x
)
315 for (lobit
= 0; lobit
< 32; lobit
++)
316 if (x
& (1 << lobit
))
318 for (hibit
= 31; hibit
>= 0; hibit
--)
319 if (x
& (1 << hibit
))
322 int width
= 1 + hibit
- lobit
;
326 if (x
!= (NBITS (width
) << lobit
))
327 return -1; // not a clean bitfield
329 return ((width
& 15) << 5) | lobit
;
332 /* Per-function machine data. */
333 struct GTY (()) machine_function
335 /* Number of bytes saved on the stack for callee saved registers. */
336 int callee_saved_reg_size
;
338 /* Number of bytes saved on the stack for local variables. */
341 /* The sum of 2 sizes: locals vars and padding byte for saving the
342 * registers. Used in expand_prologue () and expand_epilogue (). */
343 int size_for_adjusting_sp
;
346 /* Zero initialization is OK for all current fields. */
348 static struct machine_function
*
349 ft32_init_machine_status (void)
351 return ggc_cleared_alloc
< machine_function
> ();
355 /* The TARGET_OPTION_OVERRIDE worker.
356 All this curently does is set init_machine_status. */
358 ft32_option_override (void)
360 /* Set the per-function-data initializer. */
361 init_machine_status
= ft32_init_machine_status
;
364 /* Implement targetm.select_section. */
366 ft32_select_section (tree decl
, int reloc
, unsigned HOST_WIDE_INT align
)
368 /* Variables and constants defined in the __ea address space
369 go into a special section named "._ea". */
370 if (TREE_TYPE (decl
) != error_mark_node
371 && TYPE_ADDR_SPACE (TREE_TYPE (decl
)) == ADDR_SPACE_PM
)
373 /* We might get called with string constants, but get_named_section
374 doesn't like them as they are not DECLs. Also, we need to set
375 flags in that case. */
377 return get_section ("._pm", SECTION_WRITE
| SECTION_DEBUG
, NULL
);
379 return get_named_section (decl
, "._pm", reloc
);
382 return default_elf_select_section (decl
, reloc
, align
);
385 /* Compute the size of the local area and the size to be adjusted by the
386 * prologue and epilogue. */
389 ft32_compute_frame (void)
391 /* For aligning the local variables. */
392 int stack_alignment
= STACK_BOUNDARY
/ BITS_PER_UNIT
;
396 /* Padding needed for each element of the frame. */
397 cfun
->machine
->local_vars_size
= get_frame_size ();
399 /* Align to the stack alignment. */
400 padding_locals
= cfun
->machine
->local_vars_size
% stack_alignment
;
402 padding_locals
= stack_alignment
- padding_locals
;
404 cfun
->machine
->local_vars_size
+= padding_locals
;
406 cfun
->machine
->callee_saved_reg_size
= 0;
408 /* Save callee-saved registers. */
409 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
410 if (df_regs_ever_live_p (regno
) && (!call_used_regs
[regno
]))
411 cfun
->machine
->callee_saved_reg_size
+= 4;
413 cfun
->machine
->size_for_adjusting_sp
=
414 0 // crtl->args.pretend_args_size
415 + cfun
->machine
->local_vars_size
416 + (ACCUMULATE_OUTGOING_ARGS
? crtl
->outgoing_args_size
: 0);
419 // Must use LINK/UNLINK when...
420 // the frame is bigger than 512 bytes so cannot just "SUB" from SP
421 // the function actually uses $fp
426 int bigframe
= (cfun
->machine
->size_for_adjusting_sp
>= 512);
427 return (bigframe
|| frame_pointer_needed
|| df_regs_ever_live_p (FT32_FP
)
428 || df_regs_ever_live_p (FT32_FP
));
432 ft32_expand_prologue (void)
437 ft32_compute_frame ();
439 int args_to_push
= crtl
->args
.pretend_args_size
;
444 insn
= emit_insn (gen_movsi_pop ((gen_rtx_REG (Pmode
, FT32_R29
))));
446 for (i
= 0; i
< (args_to_push
/ 4); i
++)
449 emit_insn (gen_movsi_push ((gen_rtx_REG (Pmode
, FT32_R5
- i
))));
450 RTX_FRAME_RELATED_P (insn
) = 1;
453 insn
= emit_insn (gen_movsi_push ((gen_rtx_REG (Pmode
, FT32_R29
))));
456 if (flag_stack_usage_info
)
457 current_function_static_stack_size
= cfun
->machine
->size_for_adjusting_sp
;
459 if (!must_link () && (cfun
->machine
->callee_saved_reg_size
== 4))
463 (gen_rtx_REG (Pmode
, FT32_R13
),
464 GEN_INT (-cfun
->machine
->size_for_adjusting_sp
)));
465 RTX_FRAME_RELATED_P (insn
) = 1;
468 /* Save callee-saved registers. */
471 for (regno
= FIRST_PSEUDO_REGISTER
; regno
-- > 0;)
473 if (!fixed_regs
[regno
] && !call_used_regs
[regno
]
474 && df_regs_ever_live_p (regno
))
476 rtx preg
= gen_rtx_REG (Pmode
, regno
);
477 emit_insn (gen_call_prolog (preg
));
484 for (regno
= 0; regno
< FIRST_PSEUDO_REGISTER
; regno
++)
486 if (!fixed_regs
[regno
] && df_regs_ever_live_p (regno
)
487 && !call_used_regs
[regno
])
489 insn
= emit_insn (gen_movsi_push (gen_rtx_REG (Pmode
, regno
)));
490 RTX_FRAME_RELATED_P (insn
) = 1;
495 if (65536 <= cfun
->machine
->size_for_adjusting_sp
)
497 error ("stack frame must be smaller than 64K");
504 (gen_rtx_REG (Pmode
, FT32_FP
),
505 GEN_INT (-cfun
->machine
->size_for_adjusting_sp
)));
506 RTX_FRAME_RELATED_P (insn
) = 1;
508 else if (cfun
->machine
->size_for_adjusting_sp
> 0)
510 int adj
= cfun
->machine
->size_for_adjusting_sp
;
511 insn
= emit_insn (gen_addsi3 (gen_rtx_REG (SImode
, FT32_SP
),
512 gen_rtx_REG (SImode
, FT32_SP
),
514 RTX_FRAME_RELATED_P (insn
) = 1;
519 ft32_expand_epilogue (void)
522 int pretend
= crtl
->args
.pretend_args_size
;
525 && (cfun
->machine
->size_for_adjusting_sp
== 24)
526 && (cfun
->machine
->callee_saved_reg_size
== 0))
528 emit_jump_insn (gen_returner24 ());
532 // Set when the epilog code will also add 24 to $sp
533 int epilog24
= (!must_link ()
534 && (cfun
->machine
->size_for_adjusting_sp
== 24)
539 emit_insn (gen_unlink ());
541 else if (!epilog24
&& (cfun
->machine
->size_for_adjusting_sp
> 0))
543 emit_insn (gen_addsi3 (gen_rtx_REG (SImode
, FT32_SP
),
544 gen_rtx_REG (SImode
, FT32_SP
),
545 GEN_INT (cfun
->machine
->size_for_adjusting_sp
)));
548 if (cfun
->machine
->callee_saved_reg_size
!= 0)
550 for (regno
= FIRST_PSEUDO_REGISTER
; regno
-- > 0;)
552 if (!fixed_regs
[regno
] && !call_used_regs
[regno
]
553 && df_regs_ever_live_p (regno
))
555 rtx preg
= gen_rtx_REG (Pmode
, regno
);
556 if (optimize_size
&& (pretend
== 0))
559 emit_insn (gen_jump_epilog24 (preg
));
561 emit_insn (gen_jump_epilog (preg
));
564 emit_insn (gen_movsi_pop (preg
));
570 emit_jump_insn (gen_pretend_returner (GEN_INT (pretend
)));
572 emit_jump_insn (gen_returner ());
575 #undef TARGET_FRAME_POINTER_REQUIRED
576 #define TARGET_FRAME_POINTER_REQUIRED ft32_frame_pointer_required
578 ft32_frame_pointer_required (void)
580 return cfun
->calls_alloca
;
583 #undef TARGET_CAN_ELIMINATE
584 #define TARGET_CAN_ELIMINATE ft32_can_eliminate
586 /* Return true if register FROM can be eliminated via register TO. */
589 ft32_can_eliminate (const int from ATTRIBUTE_UNUSED
, const int to
)
592 return (to
== FRAME_POINTER_REGNUM
) || !ft32_frame_pointer_required ();
595 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */
598 ft32_initial_elimination_offset (int from
, int to
)
600 ft32_compute_frame ();
602 if (from
== ARG_POINTER_REGNUM
&& to
== FRAME_POINTER_REGNUM
)
604 return cfun
->machine
->callee_saved_reg_size
+ 2 * UNITS_PER_WORD
;
607 if (from
== ARG_POINTER_REGNUM
&& to
== STACK_POINTER_REGNUM
)
610 arg_offset
= must_link ()? 2 : 1;
611 return ((cfun
->machine
->callee_saved_reg_size
612 + arg_offset
* UNITS_PER_WORD
)
613 + cfun
->machine
->size_for_adjusting_sp
);
616 if ((from
== FRAME_POINTER_REGNUM
) && (to
== STACK_POINTER_REGNUM
))
618 return cfun
->machine
->size_for_adjusting_sp
;
624 /* Worker function for TARGET_SETUP_INCOMING_VARARGS. */
627 ft32_setup_incoming_varargs (cumulative_args_t cum_v
,
628 enum machine_mode mode
,
629 tree type ATTRIBUTE_UNUSED
,
630 int *pretend_size
, int no_rtl ATTRIBUTE_UNUSED
)
632 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
634 GET_MODE_SIZE (SImode
) * (*cum
- FT32_R0
) + GET_MODE_SIZE (mode
);
637 *pretend_size
= 24 - named_size
;
642 /* Return the fixed registers used for condition codes. */
645 ft32_fixed_condition_code_regs (unsigned int *p1
, unsigned int *p2
)
648 *p2
= INVALID_REGNUM
;
652 /* Return the next register to be used to hold a function argument or
653 NULL_RTX if there's no more space. */
656 ft32_function_arg (cumulative_args_t cum_v
, enum machine_mode mode
,
657 const_tree type ATTRIBUTE_UNUSED
,
658 bool named ATTRIBUTE_UNUSED
)
660 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
663 return gen_rtx_REG (mode
, *cum
);
668 #define FT32_FUNCTION_ARG_SIZE(MODE, TYPE) \
669 ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \
670 : (unsigned) int_size_in_bytes (TYPE))
673 ft32_function_arg_advance (cumulative_args_t cum_v
, enum machine_mode mode
,
674 const_tree type
, bool named ATTRIBUTE_UNUSED
)
676 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
678 *cum
= (*cum
< FT32_R6
679 ? *cum
+ ((3 + FT32_FUNCTION_ARG_SIZE (mode
, type
)) / 4) : *cum
);
682 /* Return non-zero if the function argument described by TYPE is to be
683 passed by reference. */
686 ft32_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED
,
687 enum machine_mode mode
, const_tree type
,
688 bool named ATTRIBUTE_UNUSED
)
690 unsigned HOST_WIDE_INT size
;
694 if (AGGREGATE_TYPE_P (type
))
696 size
= int_size_in_bytes (type
);
699 size
= GET_MODE_SIZE (mode
);
704 /* Some function arguments will only partially fit in the registers
705 that hold arguments. Given a new arg, return the number of bytes
706 that fit in argument passing registers. */
709 ft32_arg_partial_bytes (cumulative_args_t cum_v
,
710 enum machine_mode mode
, tree type
, bool named
)
712 CUMULATIVE_ARGS
*cum
= get_cumulative_args (cum_v
);
713 int bytes_left
, size
;
718 if (ft32_pass_by_reference (cum_v
, mode
, type
, named
))
722 if (AGGREGATE_TYPE_P (type
))
724 size
= int_size_in_bytes (type
);
727 size
= GET_MODE_SIZE (mode
);
729 bytes_left
= (4 * 6) - ((*cum
- 2) * 4);
731 if (size
> bytes_left
)
737 /* Used by constraints.md to distinguish between GENERIC and PM
741 ft32_is_mem_pm (rtx o
)
744 && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (o
)));
747 /* The Global `targetm' Variable. */
749 /* Initialize the GCC target structure. */
751 #undef TARGET_PROMOTE_PROTOTYPES
752 #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
754 #undef TARGET_RETURN_IN_MEMORY
755 #define TARGET_RETURN_IN_MEMORY ft32_return_in_memory
756 #undef TARGET_MUST_PASS_IN_STACK
757 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
758 #undef TARGET_PASS_BY_REFERENCE
759 #define TARGET_PASS_BY_REFERENCE ft32_pass_by_reference
760 #undef TARGET_ARG_PARTIAL_BYTES
761 #define TARGET_ARG_PARTIAL_BYTES ft32_arg_partial_bytes
762 #undef TARGET_FUNCTION_ARG
763 #define TARGET_FUNCTION_ARG ft32_function_arg
764 #undef TARGET_FUNCTION_ARG_ADVANCE
765 #define TARGET_FUNCTION_ARG_ADVANCE ft32_function_arg_advance
768 #undef TARGET_SETUP_INCOMING_VARARGS
769 #define TARGET_SETUP_INCOMING_VARARGS ft32_setup_incoming_varargs
771 #undef TARGET_FIXED_CONDITION_CODE_REGS
772 #define TARGET_FIXED_CONDITION_CODE_REGS ft32_fixed_condition_code_regs
774 /* Define this to return an RTX representing the place where a
775 function returns or receives a value of data type RET_TYPE, a tree
776 node representing a data type. */
777 #undef TARGET_FUNCTION_VALUE
778 #define TARGET_FUNCTION_VALUE ft32_function_value
779 #undef TARGET_LIBCALL_VALUE
780 #define TARGET_LIBCALL_VALUE ft32_libcall_value
781 #undef TARGET_FUNCTION_VALUE_REGNO_P
782 #define TARGET_FUNCTION_VALUE_REGNO_P ft32_function_value_regno_p
784 #undef TARGET_OPTION_OVERRIDE
785 #define TARGET_OPTION_OVERRIDE ft32_option_override
787 #undef TARGET_ASM_SELECT_SECTION
788 #define TARGET_ASM_SELECT_SECTION ft32_select_section
790 #undef TARGET_VALID_POINTER_MODE
791 #define TARGET_VALID_POINTER_MODE ft32_valid_pointer_mode
793 ft32_valid_pointer_mode (enum machine_mode mode
)
800 #undef TARGET_ADDR_SPACE_POINTER_MODE
801 #define TARGET_ADDR_SPACE_POINTER_MODE ft32_addr_space_pointer_mode
802 static enum machine_mode
803 ft32_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED
)
808 #undef TARGET_ADDR_SPACE_ADDRESS_MODE
809 #define TARGET_ADDR_SPACE_ADDRESS_MODE ft32_addr_space_address_mode
810 static enum machine_mode
811 ft32_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED
)
816 #undef TARGET_ADDR_SPACE_SUBSET_P
817 #define TARGET_ADDR_SPACE_SUBSET_P ft32_addr_space_subset_p
819 ft32_addr_space_subset_p (addr_space_t subset ATTRIBUTE_UNUSED
,
820 addr_space_t superset ATTRIBUTE_UNUSED
)
825 #undef TARGET_CASE_VALUES_THRESHOLD
826 #define TARGET_CASE_VALUES_THRESHOLD ft32_target_case_values_threshold
829 ft32_target_case_values_threshold (void)
834 #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
835 #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \
836 ft32_addr_space_legitimate_address_p
839 // Enabling LRA gives the infamous
840 // internal compiler error: Max. number of generated reload insns per insn is achieved (90)
841 // errors e.g. when compiling sieve.c
846 return ft32_lra_flag
;
850 #define TARGET_LRA_P ft32_lra_p
853 reg_ok_for_base_p (rtx r
, bool strict
)
857 return (HARD_REGNO_OK_FOR_BASE_P (NUM
)
858 || HARD_REGNO_OK_FOR_BASE_P (reg_renumber
[(NUM
)]));
860 return ((NUM
) >= FIRST_PSEUDO_REGISTER
|| HARD_REGNO_OK_FOR_BASE_P (NUM
));
864 ft32_addr_space_legitimate_address_p (enum machine_mode mode
, rtx x
,
866 addr_space_t as ATTRIBUTE_UNUSED
)
870 if (GET_CODE (x
) == PLUS
)
875 if (GET_CODE (op1
) == REG
877 && INTVAL (op2
) >= -128
878 && INTVAL (op2
) < 128 && reg_ok_for_base_p (op1
, strict
))
880 if (GET_CODE (op1
) == SYMBOL_REF
&& CONST_INT_P (op2
))
883 if (REG_P (x
) && reg_ok_for_base_p (x
, strict
))
885 if (GET_CODE (x
) == SYMBOL_REF
886 || GET_CODE (x
) == LABEL_REF
|| CONST_INT_P (x
))
891 if (REG_P (x
) && reg_ok_for_base_p (x
, strict
))
900 #undef TARGET_ENCODE_SECTION_INFO
901 #define TARGET_ENCODE_SECTION_INFO ft32_elf_encode_section_info
904 ft32_elf_encode_section_info (tree decl
, rtx rtl
, int first
)
909 /* Careful not to prod global register variables. */
912 symbol
= XEXP (rtl
, 0);
913 if (GET_CODE (symbol
) != SYMBOL_REF
)
916 default_encode_section_info (decl
, rtl
, first
);
918 code
= TREE_CODE (decl
);
919 switch (TREE_CODE_CLASS (code
))
921 case tcc_declaration
:
923 tree type
= TREE_TYPE (decl
);
924 int is_flash
= (type
&& TYPE_P (type
)
925 && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (type
)));
926 if ((code
== VAR_DECL
) && !is_flash
)
927 SYMBOL_REF_FLAGS (symbol
) |= 0x1000;
932 case tcc_exceptional
:
933 if (code
== STRING_CST
)
934 SYMBOL_REF_FLAGS (symbol
) |= 0x1000;
942 struct gcc_target targetm
= TARGET_INITIALIZER
;