Skip to content

Commit 4b11b8e

Browse files
clazissartemiy-volkov
authored andcommitted
[ARCx] Configurations
1 parent bbf0a23 commit 4b11b8e

13 files changed

+711
-6
lines changed

config.sub

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# shellcheck disable=SC2006,SC2268 # see below for rationale
66

7-
timestamp='2021-10-27'
7+
timestamp='2022-06-15'
88

99
# This file is free software; you can redistribute it and/or modify it
1010
# under the terms of the GNU General Public License as published by

gcc/config.gcc

+9-3
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,16 @@ amdgcn*)
366366
am33_2.0-*-linux*)
367367
cpu_type=mn10300
368368
;;
369-
arc*-*-*)
369+
arc-*-* | arc[eb]*-*-*)
370370
cpu_type=arc
371371
c_target_objs="arc-c.o"
372372
cxx_target_objs="arc-c.o"
373373
extra_options="${extra_options} arc/arc-tables.opt g.opt"
374374
extra_headers="arc-simd.h"
375375
;;
376+
arc64-*-*)
377+
cpu_type=arc64
378+
;;
376379
arm*-*-*)
377380
cpu_type=arm
378381
extra_objs="arm-builtins.o arm-mve-builtins.o arm-mve-builtins-shapes.o arm-mve-builtins-base.o aarch-common.o aarch-bti-insert.o"
@@ -1301,7 +1304,7 @@ alpha*-dec-*vms*)
13011304
tm_file="${tm_file} vms/vms.h alpha/vms.h"
13021305
tmake_file="${tmake_file} alpha/t-vms alpha/t-alpha"
13031306
;;
1304-
arc*-*-elf*)
1307+
arc-*-elf* | arc[eb]*-*-*)
13051308
tm_file="arc/arc-arch.h elfos.h newlib-stdint.h arc/elf.h ${tm_file}"
13061309
tmake_file="arc/t-multilib arc/t-arc"
13071310
extra_gcc_objs="driver-arc.o"
@@ -1322,7 +1325,7 @@ arc*-*-elf*)
13221325
big*) tm_file="arc/big.h ${tm_file}"
13231326
esac
13241327
;;
1325-
arc*-*-linux*)
1328+
arc-*-linux* | arc[eb]*-*linux*)
13261329
tm_file="arc/arc-arch.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arc/linux.h ${tm_file}"
13271330
tmake_file="${tmake_file} arc/t-multilib-linux arc/t-arc"
13281331
extra_gcc_objs="driver-arc.o"
@@ -1346,6 +1349,9 @@ arc*-*-linux*)
13461349
# automatically detect that GAS supports it, yet we require it.
13471350
gcc_cv_initfini_array=yes
13481351
;;
1352+
arc64-*-elf*)
1353+
tm_file="arc64/elf.h ${tm_file}"
1354+
;;
13491355
arm-wrs-vxworks7*)
13501356
# We only support VxWorks 7 now on ARM, post SR600. Pre SR600
13511357
# VxWorks 7 was transitory and major versions prior to 7 were based

gcc/config/arc64/arc64-protos.h

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef GCC_ARC64_PROTOS_H
2+
#define GCC_ARC64_PROTOS_H
3+
4+
int arc64_epilogue_uses (int);
5+
poly_int64 arc64_initial_elimination_offset (unsigned, unsigned);
6+
void arc64_init_expanders (void);
7+
machine_mode arc64_select_cc_mode (RTX_CODE, rtx, rtx);
8+
rtx arc64_return_addr (int, rtx);
9+
poly_uint64 arc64_regmode_natural_size (machine_mode);
10+
11+
#endif /* GCC_ARC64_PROTOS_H */

gcc/config/arc64/arc64.c

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
#define IN_TARGET_CODE 1
2+
3+
#include "config.h"
4+
#include "system.h"
5+
#include "coretypes.h"
6+
#include "memmodel.h"
7+
#include "backend.h"
8+
#include "target.h"
9+
#include "rtl.h"
10+
#include "tree.h"
11+
#include "cfghooks.h"
12+
#include "df.h"
13+
#include "tm_p.h"
14+
#include "stringpool.h"
15+
#include "attribs.h"
16+
#include "optabs.h"
17+
#include "regs.h"
18+
#include "emit-rtl.h"
19+
#include "recog.h"
20+
#include "diagnostic.h"
21+
#include "fold-const.h"
22+
#include "varasm.h"
23+
#include "stor-layout.h"
24+
#include "calls.h"
25+
#include "output.h"
26+
#include "insn-attr.h"
27+
#include "flags.h"
28+
#include "explow.h"
29+
#include "expr.h"
30+
#include "langhooks.h"
31+
#include "tm-constrs.h"
32+
#include "cfgrtl.h"
33+
#include "tree-pass.h"
34+
#include "context.h"
35+
#include "builtins.h"
36+
#include "rtl-iter.h"
37+
#include "alias.h"
38+
#include "opts.h"
39+
40+
/* This file should be included last. */
41+
#include "target-def.h"
42+
43+
/* Implement REGNO_REG_CLASS. */
44+
const enum reg_class arc64_regno_to_regclass[FIRST_PSEUDO_REGISTER] =
45+
{
46+
AC16_REGS, AC16_REGS, AC16_REGS, AC16_REGS,
47+
HI_REGS, HI_REGS, HI_REGS, HI_REGS,
48+
HI_REGS, HI_REGS, HI_REGS, HI_REGS,
49+
AC16_REGS, AC16_REGS, AC16_REGS, AC16_REGS,
50+
HI_REGS, HI_REGS, HI_REGS, HI_REGS,
51+
HI_REGS, HI_REGS, HI_REGS, HI_REGS,
52+
HI_REGS, HI_REGS, HI_REGS, HI_REGS,
53+
NO_REGS, NO_REGS, HI_REGS, NO_REGS,
54+
55+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
56+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
57+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
58+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
59+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
60+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
61+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
62+
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
63+
64+
NO_REGS, NO_REGS, NO_REGS,
65+
};
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 (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)
111+
{
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? */
123+
}
124+
125+
/* Given FROM and TO register numbers, say whether this elimination is allowed.
126+
Frame pointer elimination is automatically handled.
127+
128+
All eliminations are permissible. If we need a frame
129+
pointer, we must eliminate ARG_POINTER_REGNUM into
130+
FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */
131+
132+
static bool
133+
arc64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
134+
{
135+
return ((to == HARD_FRAME_POINTER_REGNUM) || (to == STACK_POINTER_REGNUM));
136+
}
137+
138+
139+
/* Return TRUE if X is a legitimate address for accessing memory in
140+
mode MODE. */
141+
142+
static bool
143+
arc_legitimate_address_p (machine_mode mode, rtx x, bool strict)
144+
{
145+
return true;
146+
}
147+
148+
/* Implement TARGET_LEGITIMATE_CONSTANT_P hook. Return true for constants
149+
that should be rematerialized rather than spilled. */
150+
151+
static bool
152+
arc64_legitimate_constant_p (machine_mode mode, rtx x)
153+
{
154+
if (CONST_INT_P (x))
155+
return true;
156+
return false;
157+
}
158+
159+
/* Target hooks. */
160+
161+
#undef TARGET_ASM_ALIGNED_DI_OP
162+
#define TARGET_ASM_ALIGNED_DI_OP "\t.xword\t"
163+
164+
#undef TARGET_ASM_ALIGNED_HI_OP
165+
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
166+
167+
#undef TARGET_ASM_ALIGNED_SI_OP
168+
#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
169+
170+
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
171+
#define TARGET_ASM_CAN_OUTPUT_MI_THUNK \
172+
hook_bool_const_tree_hwi_hwi_const_tree_true
173+
174+
#undef TARGET_CAN_ELIMINATE
175+
#define TARGET_CAN_ELIMINATE arc64_can_eliminate
176+
177+
#undef TARGET_LEGITIMATE_ADDRESS_P
178+
#define TARGET_LEGITIMATE_ADDRESS_P arc64_legitimate_address_p
179+
180+
#undef TARGET_LEGITIMATE_CONSTANT_P
181+
#define TARGET_LEGITIMATE_CONSTANT_P arc64_legitimate_constant_p
182+
183+
struct gcc_target targetm = TARGET_INITIALIZER;
184+
185+
#include "gt-arc64.h"

0 commit comments

Comments
 (0)