@@ -64,62 +64,12 @@ const enum reg_class arc64_regno_to_regclass[FIRST_PSEUDO_REGISTER] =
64
64
NO_REGS , NO_REGS , NO_REGS ,
65
65
};
66
66
67
- /* Return 1 if the register is used by the epilogue. We need to say the
68
- return register is used, but only after epilogue generation is complete.
69
- Note that in the case of sibcalls, the values "used by the epilogue" are
70
- considered live at the start of the called function. */
71
-
72
- int
73
- arc64_epilogue_uses (int regno )
74
- {
75
- if (epilogue_completed )
76
- if (regno == BLINK_REGNUM )
77
- return 1 ;
78
-
79
- return 0 ;
80
- }
81
-
82
- /* Implement INITIAL_ELIMINATION_OFFSET. FROM is either the frame pointer
83
- or argument pointer. TO is either the stack pointer or hard frame
84
- pointer. */
85
-
86
- HOST_WIDE_INT
87
- arc64_initial_elimination_offset (unsigned from , unsigned to )
88
- {
89
- return 0 ;
90
- }
91
-
92
- void arc64_init_expanders (void )
93
- {
94
- /* FIXME! Not sure if I need it. */
95
- }
96
-
97
- /* Given a comparison code (EQ, NE, etc.) and the first operand of a
98
- COMPARE, return the mode to be used for the comparison. */
99
-
100
- machine_mode
101
- arc64_select_cc_mode (enum rtx_code op , rtx x , rtx y )
102
- {
103
- return CC_Cmode ;
104
- }
105
-
106
- /* Implement RETURN_ADDR_RTX. We do not support moving back to a
107
- previous frame. */
108
-
109
- rtx
110
- arc64_return_addr (int count , rtx frame ATTRIBUTE_UNUSED )
67
+ /* Emit an insn that's a simple single-set. Both the operands must be
68
+ known to be valid. */
69
+ inline static rtx_insn *
70
+ emit_set_insn (rtx x , rtx y )
111
71
{
112
- if (count != 0 )
113
- return const0_rtx ;
114
- return get_hard_reg_initial_val (Pmode , BLINK_REGNUM );
115
- }
116
-
117
- /* Implement REGMODE_NATURAL_SIZE. */
118
-
119
- HOST_WIDE_INT
120
- arc64_regmode_natural_size (machine_mode mode )
121
- {
122
- return UNITS_PER_WORD ; /*FIXME! do I need it? */
72
+ return emit_insn (gen_rtx_SET (x , y ));
123
73
}
124
74
125
75
/* Given FROM and TO register numbers, say whether this elimination is allowed.
@@ -140,7 +90,7 @@ arc64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
140
90
mode MODE. */
141
91
142
92
static bool
143
- arc_legitimate_address_p (machine_mode mode , rtx x , bool strict )
93
+ arc64_legitimate_address_p (machine_mode mode , rtx x , bool strict )
144
94
{
145
95
return true;
146
96
}
@@ -156,6 +106,26 @@ arc64_legitimate_constant_p (machine_mode mode, rtx x)
156
106
return false;
157
107
}
158
108
109
+ /* This is how to output a definition of an internal numbered label where
110
+ PREFIX is the class of label and NUM is the number within the class. */
111
+
112
+ static void arc64_internal_label (FILE * stream , const char * prefix , unsigned long labelno )
113
+ {
114
+ default_internal_label (stream , prefix , labelno );
115
+ }
116
+
117
+ /* X and Y are two things to compare using CODE. Emit the compare insn and
118
+ return the rtx for the cc reg in the proper mode. */
119
+
120
+ rtx
121
+ arc64_gen_compare_reg (enum rtx_code code , rtx x , rtx y )
122
+ {
123
+ machine_mode mode = SELECT_CC_MODE (code , x , y );
124
+ rtx cc_reg = gen_rtx_REG (mode , CC_REGNUM );
125
+
126
+ emit_set_insn (cc_reg , gen_rtx_COMPARE (mode , x , y ));
127
+ return cc_reg ;
128
+ }
159
129
160
130
/* Prepare operands for move in MODE. Return true iff the move has
161
131
been emitted. */
@@ -280,6 +250,7 @@ arc64_check_mov_const (HOST_WIDE_INT ival)
280
250
281
251
return false;
282
252
}
253
+ #endif
283
254
284
255
/* This function is used by the call expanders of the machine description.
285
256
RESULT is the register in which the result is returned. It's NULL for
292
263
arc64_expand_call (rtx result , rtx mem , bool sibcall )
293
264
{
294
265
rtx call , callee , tmp ;
266
+ rtvec vec ;
295
267
machine_mode mode ;
296
268
297
269
gcc_assert (MEM_P (mem ));
@@ -302,10 +274,10 @@ arc64_expand_call (rtx result, rtx mem, bool sibcall)
302
274
/* Decide if we should generate indirect calls by loading the
303
275
address of the callee into a register before performing the
304
276
branch-and-link. */
305
- if (arc64_is_long_call_p (callee ) && !REG_P (callee ))
306
- XEXP (mem , 0 ) = force_reg (mode , callee );
277
+ // FIXME! if (arc64_is_long_call_p (callee) && !REG_P (callee))
278
+ // FIXME! XEXP (mem, 0) = force_reg (mode, callee);
307
279
308
- call = gen_rtx_call (VOIDmode , mem , cont0_rtx );
280
+ call = gen_rtx_CALL (VOIDmode , mem , const0_rtx );
309
281
310
282
if (result != NULL_RTX )
311
283
call = gen_rtx_SET (result , call );
@@ -320,7 +292,6 @@ arc64_expand_call (rtx result, rtx mem, bool sibcall)
320
292
321
293
emit_call_insn (call );
322
294
}
323
- #endif
324
295
325
296
/* Return nonzero if this function is known to have a null epilogue.
326
297
This allows the optimizer to omit jumps to jumps if no stack
@@ -332,12 +303,63 @@ arc64_can_use_return_insn_p (void)
332
303
return (reload_completed ); //FIXME!: && cfun->machine->frame.frame_size == 0);
333
304
}
334
305
335
- /* This is how to output a definition of an internal numbered label where
336
- PREFIX is the class of label and NUM is the number within the class. */
337
306
338
- static void arc64_internal_label (FILE * stream , const char * prefix , unsigned long labelno )
307
+ /* Return 1 if the register is used by the epilogue. We need to say the
308
+ return register is used, but only after epilogue generation is complete.
309
+ Note that in the case of sibcalls, the values "used by the epilogue" are
310
+ considered live at the start of the called function. */
311
+
312
+ int
313
+ arc64_epilogue_uses (int regno )
339
314
{
340
- default_internal_label (stream , prefix , labelno );
315
+ if (epilogue_completed )
316
+ if (regno == BLINK_REGNUM )
317
+ return 1 ;
318
+
319
+ return 0 ;
320
+ }
321
+
322
+ /* Implement INITIAL_ELIMINATION_OFFSET. FROM is either the frame pointer
323
+ or argument pointer. TO is either the stack pointer or hard frame
324
+ pointer. */
325
+
326
+ HOST_WIDE_INT
327
+ arc64_initial_elimination_offset (unsigned from , unsigned to )
328
+ {
329
+ return 0 ;
330
+ }
331
+
332
+ void arc64_init_expanders (void )
333
+ {
334
+ /* FIXME! Not sure if I need it. */
335
+ }
336
+
337
+ /* Given a comparison code (EQ, NE, etc.) and the first operand of a
338
+ COMPARE, return the mode to be used for the comparison. */
339
+
340
+ machine_mode
341
+ arc64_select_cc_mode (enum rtx_code op , rtx x , rtx y )
342
+ {
343
+ return CC_Cmode ;
344
+ }
345
+
346
+ /* Implement RETURN_ADDR_RTX. We do not support moving back to a
347
+ previous frame. */
348
+
349
+ rtx
350
+ arc64_return_addr (int count , rtx frame ATTRIBUTE_UNUSED )
351
+ {
352
+ if (count != 0 )
353
+ return const0_rtx ;
354
+ return get_hard_reg_initial_val (Pmode , BLINK_REGNUM );
355
+ }
356
+
357
+ /* Helper for TARGET_CPU_CPP_BUILTINS hook. */
358
+
359
+ void
360
+ arc64_cpu_cpp_builtins (cpp_reader * pfile )
361
+ {
362
+ //FIXME! builtin_define ("__arc64__");
341
363
}
342
364
343
365
/* Target hooks. */
@@ -358,8 +380,8 @@ static void arc64_internal_label (FILE *stream, const char *prefix, unsigned lon
358
380
#undef TARGET_CAN_ELIMINATE
359
381
#define TARGET_CAN_ELIMINATE arc64_can_eliminate
360
382
361
- // #undef TARGET_LEGITIMATE_ADDRESS_P
362
- // #define TARGET_LEGITIMATE_ADDRESS_P arc64_legitimate_address_p
383
+ #undef TARGET_LEGITIMATE_ADDRESS_P
384
+ #define TARGET_LEGITIMATE_ADDRESS_P arc64_legitimate_address_p
363
385
364
386
#undef TARGET_LEGITIMATE_CONSTANT_P
365
387
#define TARGET_LEGITIMATE_CONSTANT_P arc64_legitimate_constant_p
0 commit comments