aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/cil32/cil32.h
blob: 3769f4495c9ef75990dee6731dff75a9d0b259ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
/* Definitions for GCC.  Part of the machine description for cil32.

   Copyright (C) 2006 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.

Authors:
   Andrea Bona
   Andrea Ornstein
   Erven Rohou
   Roberto Costa

Contact information at STMicroelectronics:
Roberto Costa <roberto.costa@st.com>   */

#define DISABLE_RTL_PASSES 1

#define IN_NAMED_SECTION(DECL) 0
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) do { } while(0)
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) do { } while(0)

/*  make_decl_cil (stream, decl); */
#define TARGET_DECLARE_VARIABLE(STREAM,DECL) make_decl_cil(STREAM,DECL)

/* Node: Driver */

#define CC1_SPEC "%{!mnoopensystemc:-mopensystemc}"
#define LIB_SPEC ""
#define LIBGCC_SPEC ""
#define LINK_SPEC "--no-stdlib %{!nostdlib:-l gcc4net.dll} %{shared:--format dll}"
#define STARTFILE_SPEC ""
#define ENDFILE_SPEC ""

/* Node: Run-time Target */

#define TARGET_CPU_CPP_BUILTINS()		\
  do						\
    {						\
      builtin_define_std ("__cil32__");		\
      builtin_define_std ("__GNU_CIL__");	\
      builtin_assert ("cpu=cil32");		\
      builtin_assert ("machine=cil32");		\
    }						\
  while(0)

/* This needs to be at least 32 bits.  */
extern int target_flags;

/* Print subsidiary information on the compiler version in use.
   Do not use VD.D syntax (D=digit), since this will cause confusion
   with the base gcc version among users, when we ask which version of
   gcc-cil32 they are using.  Please use some flavor of "R<number>" for
   the version (no need for major.minor versions, I believe).  */
#define TARGET_VERSION \
 fprintf (stderr, " [cil32]")

/* Node: Storage Layout */

#define BITS_BIG_ENDIAN 0
#define BYTES_BIG_ENDIAN 0
#define WORDS_BIG_ENDIAN 0

#define UNITS_PER_WORD 4
#define UNITS_PER_SIMD_WORD 4

/* Unused by cil32 machine */
#define PARM_BOUNDARY 32

/* Unused by cil32 machine */
#define STACK_BOUNDARY 64

/* Unused by cil32 machine */
#define FUNCTION_BOUNDARY 16

#define BIGGEST_ALIGNMENT 64

#define STRICT_ALIGNMENT 1

#define PCC_BITFIELD_TYPE_MATTERS 1

#define MAX_FIXED_MODE_SIZE 64


/* Node: Type Layout */

/* Note that DOUBLE_TYPE_SIZE is not defined anymore, since the default
   value gives a 64-bit double, which is what we now use.  */

/* For compatibility and historical reasons, a char should be signed.  */
#define DEFAULT_SIGNED_CHAR 1

/* Note that WCHAR_TYPE_SIZE is used in cexp.y,
   where TARGET_SHORT is not available.  */
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"


/* Node: Register Basics */

#define FIRST_PSEUDO_REGISTER (1)
#define FIXED_REGISTERS {0}
#define CALL_USED_REGISTERS {1}

/* Node: Allocation Order */

#define REG_ALLOC_ORDER {0}


/* Node: Values in Registers */

/* The VOIDmode test is so we can omit mode on anonymous insns.  FIXME:
   Still needed in 2.9x, at least for Axis-20000319.  */
#define HARD_REGNO_NREGS(REGNO, MODE)	\
 (MODE == VOIDmode \
  ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))

#define HARD_REGNO_MODE_OK(REGNO, MODE)	1

#define MODES_TIEABLE_P(MODE1, MODE2) 1


/* Node: Leaf Functions */
/* (no definitions) */

/* Node: Stack Registers */
/* (no definitions) */


/* Node: Register Classes */

enum reg_class
  {
    NO_REGS,
    GENERAL_REGS, ALL_REGS,
    LIM_REG_CLASSES
  };

#define N_REG_CLASSES (int) LIM_REG_CLASSES

#define REG_CLASS_NAMES							\
  {"NO_REGS",								\
   "GENERAL_REGS", "ALL_REGS"}

/* Count in the faked argument register in GENERAL_REGS.  Keep out SRP.  */
#define REG_CLASS_CONTENTS			\
  {						\
   {0},						\
   {1},                  			\
   {1}                                          \
  }

#define REGNO_REG_CLASS(REGNO) GENERAL_REGS

#define BASE_REG_CLASS GENERAL_REGS

#define INDEX_REG_CLASS GENERAL_REGS

#define REG_CLASS_FROM_LETTER(C) NO_REGS

#define REGNO_OK_FOR_BASE_P(REGNO)		\
  ((REGNO) == CIL32_FAKE_REG)

#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)

#define PREFERRED_RELOAD_CLASS(X, CLASS) GENERAL_REGS

#define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) NO_REGS

#define CLASS_MAX_NREGS(CLASS, MODE)					\
 ((MODE) == VOIDmode							\
  ? 1                                                    		\
  : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))

#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, STR) 0

#define CONST_DOUBLE_OK_FOR_CONSTRAINT_P(VALUE, C, STR) 0

/* We want the unary operators visible for constraint checking.
   (will always be the case in 4.2).  */
#define KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING


/* Node: Frame Layout */

#define STACK_GROWS_DOWNWARD
#define FRAME_GROWS_DOWNWARD 1

/* It seems to be indicated in the code (at least 2.1) that this is
   better a constant, and best 0.  */
#define STARTING_FRAME_OFFSET 0

#define FIRST_PARM_OFFSET(FNDECL) 0

#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, CIL32_FAKE_REG)

#define EH_RETURN_DATA_REGNO(N) CIL32_FAKE_REG

#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CIL32_FAKE_REG)

#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (CIL32_FAKE_REG)

/* FIXME: Move this to right node (it's not documented properly yet).
   FIXME: Check what alignment we can assume regarding
   TARGET_STACK_ALIGN and TARGET_ALIGN_BY_32.  */
#define DWARF_CIE_DATA_ALIGNMENT -1

/* If we would ever need an exact mapping between canonical register
   number and dwarf frame register, we would either need to include all
   registers in the gcc description (with some marked fixed of course), or
   an inverse mapping from dwarf register to gcc register.  There is one
   need in dwarf2out.c:expand_builtin_init_dwarf_reg_sizes.  Right now, I
   don't see that we need exact correspondence between DWARF *frame*
   registers and DBX_REGISTER_NUMBER, so map them onto GCC registers.  */
#define DWARF_FRAME_REGNUM(REG) (REG)

/* Node: Stack Checking */
/* (no definitions) */

/* Node: Frame Registers */

#define STACK_POINTER_REGNUM CIL32_FAKE_REG

/* Register used for frame pointer.  This is also the last of the saved
   registers, when a frame pointer is not used.  */
#define FRAME_POINTER_REGNUM CIL32_FAKE_REG

/* Faked register, is always eliminated.  We need it to eliminate
   allocating stack slots for the return address and the frame pointer.  */
#define ARG_POINTER_REGNUM CIL32_FAKE_REG

#define STATIC_CHAIN_REGNUM CIL32_FAKE_REG


/* Node: Elimination */

/* Really only needed if the stack frame has variable length (alloca
   or variable sized local arguments (GNU C extension).  */
#define FRAME_POINTER_REQUIRED 0

#define INITIAL_FRAME_POINTER_OFFSET(n) \
  do { n = 0; } while(0)

/* We need not worry about when the frame-pointer is required for other
   reasons.  */
#define CAN_ELIMINATE(FROM, TO) 1

#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) (gcc_unreachable ())


/* Node: Stack Arguments */

#define ACCUMULATE_OUTGOING_ARGS 1

#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0


/* Node: Register Arguments */

/* The void_type_node is sent as a "closing" call.  */
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)			\
 (NULL_RTX)

/* This no longer *needs* to be a structure; but keeping it as such should
   not hurt (and hacking the ABI is simpler).  */
#define CUMULATIVE_ARGS struct cum_args
struct cum_args {int regs;};

/* The regs member is an integer, the number of arguments got into
   registers so far.  */
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
 ((CUM).regs = 0)

#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)		\
 ((CUM).regs += 1)

#define FUNCTION_ARG_REGNO_P(REGNO) 0


/* Node: Scalar Return */

#define FUNCTION_VALUE(VALTYPE, FUNC)  \
 gen_rtx_REG (TYPE_MODE (VALTYPE), CIL32_FAKE_REG)

#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, CIL32_FAKE_REG)

#define FUNCTION_VALUE_REGNO_P(N) ((N) == CIL32_FAKE_REG)


/* Node: Aggregate Return */
/* (no definitions) */

/* Node: Caller Saves */
/* (no definitions) */

/* Node: Function entry */
/* (no definitions) */

/* Node: Profiling */

#define FUNCTION_PROFILER(FILE, LABELNO)  \
 error ("no FUNCTION_PROFILER for CIL32 yet")

/* FIXME: Some of the undefined macros might be mandatory.  If so, fix
   documentation.  */


/* Node: Trampolines */
/* TODO */

#define TRAMPOLINE_SIZE 0

#define TRAMPOLINE_ALIGNMENT 0

#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
   do {} while(0)

/* Node: Library Calls */

/* If you change this, you have to check whatever libraries and systems
   that use it.  */
#define TARGET_EDOM 33


/* Node: Addressing Modes */

#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)

#define MAX_REGS_PER_ADDRESS 2

#define CONSTANT_INDEX_P(X) \
 (CONSTANT_P (X))

#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                 \
 {								\
   if (REG_P (X))			                        \
     goto ADDR;							\
   if (CONSTANT_INDEX_P (X))					\
     goto ADDR;							\
   if (GET_CODE (X) == PLUS)					\
     {								\
       rtx x1 = XEXP (X, 0);					\
       rtx x2 = XEXP (X, 1);					\
       /* BDAP o, Rd.  */					\
       if ((REG_P (x1) || CONSTANT_INDEX_P (x1))		\
	   && (REG_P (x2) && CONSTANT_INDEX_P (x2)))		\
	 goto ADDR;						\
     }								\
 }

#ifndef REG_OK_STRICT
 /* Nonzero if X is a hard reg that can be used as a base reg
    or if it is a pseudo reg.  */
# define REG_OK_FOR_BASE_P(X) 1
#else
 /* Nonzero if X is a hard reg that can be used as a base reg.  */
# define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
#endif

#ifndef REG_OK_STRICT
 /* Nonzero if X is a hard reg that can be used as an index
    or if it is a pseudo reg.  */
# define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
#else
 /* Nonzero if X is a hard reg that can be used as an index.  */
# define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
#endif

#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)	\
  do {} while(0)

#define LEGITIMATE_CONSTANT_P(X) 1


/* Node: Condition Code */

#define NOTICE_UPDATE_CC(EXP, INSN) (gcc_unreachable ())


/* Node: Costs */

#define SLOW_BYTE_ACCESS 0


/* Node: Sections */

#define TEXT_SECTION_ASM_OP ""

#define DATA_SECTION_ASM_OP ""


/* Node: PIC */
/* (no definitions) */

/* Node: File Framework */

#undef  ASM_OUTPUT_SKIP
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
  do {} while(0)

#define ASM_APP_ON ""
#define ASM_APP_OFF ""


/* Node: Data Output */

#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) (C) == '@'

/* Node: Uninitialized Data */

#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
 do {} while(0)

#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
 do {} while(0)

/* Node: Label Output */

/* Globalizing directive for a label.  */
#define GLOBAL_ASM_OP "\t.global "

#define SUPPORTS_WEAK 1

/* Remove any previous definition (elfos.h).  */
#undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)	\
  sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long) NUM)

/* Node: Initialization */
/* (no definitions) */

/* Node: Macros for Initialization */
/* (no definitions) */

/* Node: Instruction Output */

#define REGISTER_NAMES {"fake"}

#define PRINT_OPERAND(FILE, X, CODE) (gcc_unreachable ())

/* For delay-slot handling.  */
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) 0

#define PRINT_OPERAND_ADDRESS(FILE, ADDR) (gcc_unreachable ())

#define LOCAL_LABEL_PREFIX "."

#define REGISTER_PREFIX "$"

#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) (gcc_unreachable ())
#define ASM_OUTPUT_REG_POP(FILE, REGNO) (gcc_unreachable ())


/* Node: Dispatch Tables */
/* (no definitions) */

/* Node: Exception Region Output */
/* (no definitions) */

/* Node: Alignment Output */

/* Node: All Debuggers */

#define DBX_REGISTER_NUMBER(REGNO) (REGNO)


/* Node: DBX Options */
/* (no definitions) */

/* Node: DBX Hooks */
/* (no definitions) */

/* Node: File names and DBX */
/* (no definitions) */


/* Node: SDB and DWARF */
/* (no definitions) */

/* Node: Misc */

#define CASE_VECTOR_MODE HImode

/* The maximum number of bytes that a single instruction can move quickly
   between memory and registers or between two memory locations.  */
#define MOVE_MAX 8
#define MOVE_MAX_PIECES 4

/* Determine whether to use move_by_pieces or block move insn.  */
#define MOVE_BY_PIECES_P(SIZE, ALIGN)		\
  ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4 || (SIZE) == 8 )

/* Determine whether to use clear_by_pieces or block clear insn.  */
#define CLEAR_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN)

/* This macro is used to determine whether store_by_pieces should be
   called to "memset" storage with byte values other than zero, or
   to "memcpy" storage when the source is a constant string.  */
#define STORE_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN)

#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1

#define Pmode SImode

#define FUNCTION_MODE QImode

#define NO_IMPLICIT_EXTERN_C

extern struct tree_opt_pass pass_gen_cil;
extern struct tree_opt_pass pass_simp_cil;

/* cil32 builtin ID */
enum cil32_builtin
{
  CIL32_BUILTIN_VA_ARG,
  CIL32_BUILTIN_IS_LITTLE_ENDIAN
};

extern tree cil32_is_LE_decl;

/*
 * Local variables:
 * eval: (c-set-style "gnu")
 * indent-tabs-mode: t
 * End:
 */