This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
12 bits compiler
- From: Pierre Mallard <pierremallard at yahoo dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 19 Jun 2002 13:24:21 +0200 (CEST)
- Subject: 12 bits compiler
Hi,
I'd like to make a compiler that would support a cpu
as spark architecture but instead of 32 bits I'd like
to have 12 bits for data words.
Here is a sample code I made wich works with either 16
and 8 bit configuration but stop on compilation of
tmp-dum.c when I put it in 12 bit.
If GVPP_FORMAT_12 define, it compiles in 12 bit and
stop at tmp-dum.c without outputing any message
(infinite loop)
If GVPP_FORMAT_16 define, it compiles in 16 bit and go
until the end
If no define, it compiles in 8 bit and go until the
end
**** HERE IS THE CODE (cpu.h in gcc/config/cpu/)****
**** I'm working on gcc 3.0.4 **********************
/* Define this if most significant byte of a word is
the lowest numbered. */
#define BITS_BIG_ENDIAN 0
/* Define this if most significant byte of a word is
the lowest numbered. */
#define BYTES_BIG_ENDIAN 0
/* Define this if most significant word of a multiword
number is the lowest
numbered. */
#define WORDS_BIG_ENDIAN 0
/* number of bits in an addressable storage unit */
#ifdef GVPP_FORMAT_12
#define BITS_PER_UNIT 12
#else
#ifdef GVPP_FORMAT_16
#define BITS_PER_UNIT 8
#else
#define BITS_PER_UNIT 8 /* Ancienne conf Avr */
#endif
#endif
/* Width in bits of a "word", which is the contents of
a machine register.
Note that this is not necessarily the width of data
type `int'; */
#ifdef GVPP_FORMAT_12
#define BITS_PER_WORD 12
#else
#ifdef GVPP_FORMAT_16
#define BITS_PER_WORD 16
#else
#define BITS_PER_WORD 8
#endif
#endif
/* Width of a word, in units (bytes). */
#ifdef IN_LIBGCC2
/* This is to get correct SI and DI modes in libgcc2.c
(64 and 64 bits). */
#define UNITS_PER_WORD 4
#else
#define UNITS_PER_WORD 1
#endif
/*Define this macro if functions should assume that
stack space
has been allocated for arguments even when their
values are passed in registers.
The value of this macro is the size, in bytes, of the
area reserved for arguments
passed in registers for the function represented by
fndecl.
This space can be allocated by the caller, or be a
part of the machine-dependent stack frame:
OUTGOING_REG_PARM_STACK_SPACE says which.*/
#ifdef GVPP_FORMAT_12
#define REG_PARM_STACK_SPACE(DECL) (4*UNITS_PER_WORD)
#else
#ifdef GVPP_FORMAT_16
#define REG_PARM_STACK_SPACE(DECL) (4*UNITS_PER_WORD)
#else
#define REG_PARM_STACK_SPACE(DECL) (4*UNITS_PER_WORD)
#endif
#endif
/* Keep the stack pointer constant throughout the
function. */
#define ACCUMULATE_OUTGOING_ARGS 1
/* Width in bits of a pointer.
See also the macro `Pmode' defined below. */
#ifdef GVPP_FORMAT_12
#define POINTER_SIZE 24
#else
#ifdef GVPP_FORMAT_16
#define POINTER_SIZE 32
#else
#define POINTER_SIZE 16
#endif
#endif
/* Maximum sized of reasonable data type
DImode or Dfmode ... */
#ifdef GVPP_FORMAT_12
#define MAX_FIXED_MODE_SIZE 48
#else
#ifdef GVPP_FORMAT_16
#define MAX_FIXED_MODE_SIZE 64
#else
#define MAX_FIXED_MODE_SIZE 32
#endif
#endif
/* Allocation boundary (in *bits*) for storing
arguments in argument list. */
#ifdef GVPP_FORMAT_12
#define PARM_BOUNDARY 12
#else
#ifdef GVPP_FORMAT_16
#define PARM_BOUNDARY 16
#else
#define PARM_BOUNDARY 8
#endif
#endif
/* Allocation boundary (in *bits*) for the code of a
function. */
#ifdef GVPP_FORMAT_12
#define FUNCTION_BOUNDARY 12
#else
#ifdef GVPP_FORMAT_16
#define FUNCTION_BOUNDARY 16
#else
#define FUNCTION_BOUNDARY 8
#endif
#endif
/* Alignment of field after `int : 0' in a structure.
*/
#ifdef GVPP_FORMAT_12
#define EMPTY_FIELD_BOUNDARY 12
#else
#ifdef GVPP_FORMAT_16
#define EMPTY_FIELD_BOUNDARY 16
#else
#define EMPTY_FIELD_BOUNDARY 8
#endif
#endif
#ifdef GVPP_FORMAT_12
#define STACK_BOUNDARY 12/*_*/
#else
#ifdef GVPP_FORMAT_16
#define STACK_BOUNDARY 16/*_*/
#else
#define STACK_BOUNDARY 8/*_*/
#endif
#endif
/* Define this macro if there is a guaranteed
alignment for the stack
pointer on this machine. The definition is a C
expression for the
desired alignment (measured in bits). This value
is used as a
default if PREFERRED_STACK_BOUNDARY is not defined.
*/
/* No data type wants to be aligned rounder than this.
*/
#ifdef GVPP_FORMAT_12
#define BIGGEST_ALIGNMENT 12
#else
#ifdef GVPP_FORMAT_16
#define BIGGEST_ALIGNMENT 16
#else
#define BIGGEST_ALIGNMENT 8
#endif
#endif
/* Define this if move instructions will actually fail
to work
when given unaligned data. */
#define STRICT_ALIGNMENT 0
/* A C expression for the size in bits of the type
`int' on the
target machine. If you don't define this, the
default is one word. */
#ifdef GVPP_FORMAT_12
#define INT_TYPE_SIZE 24
#else
#ifdef GVPP_FORMAT_16
#define INT_TYPE_SIZE 32
#else
#define INT_TYPE_SIZE 16
#endif
#endif
/* A C expression for the size in bits of the type
`short' on the
target machine. If you don't define this, the
default is half a
word. (If this would be less than one storage
unit, it is rounded
up to one unit.) */
#ifdef GVPP_FORMAT_12
#define SHORT_TYPE_SIZE 24
#else
#ifdef GVPP_FORMAT_16
#define SHORT_TYPE_SIZE 32
#else
#define SHORT_TYPE_SIZE 16
#endif
#endif
/* A C expression for the size in bits of the type
`long' on the
target machine. If you don't define this, the
default is one word. */
#ifdef GVPP_FORMAT_12
#define LONG_TYPE_SIZE 24
#else
#ifdef GVPP_FORMAT_16
#define LONG_TYPE_SIZE 32
#else
#define LONG_TYPE_SIZE 16
#endif
#endif
#ifdef GVPP_FORMAT_12
#define MAX_LONG_TYPE_SIZE 48
#else
#ifdef GVPP_FORMAT_16
#define MAX_LONG_TYPE_SIZE 64
#else
#define MAX_LONG_TYPE_SIZE 32
#endif
#endif
/* Maximum number for the size in bits of the type
`long' on the
target machine. If this is undefined, the default
is
`LONG_TYPE_SIZE'. Otherwise, it is the constant
value that is the
largest value that `LONG_TYPE_SIZE' can have at
run-time. This is
used in `cpp'. */
#ifdef GVPP_FORMAT_12
#define LONG_LONG_TYPE_SIZE 96
#else
#ifdef GVPP_FORMAT_16
#define LONG_LONG_TYPE_SIZE 128
#else
#define LONG_LONG_TYPE_SIZE 64
#endif
#endif
/* A C expression for the size in bits of the type
`long long' on the
target machine. If you don't define this, the
default is two
words. If you want to support GNU Ada on your
machine, the value
of macro must be at least 64. */
#ifdef GVPP_FORMAT_12
#define CHAR_TYPE_SIZE 12
#else
#ifdef GVPP_FORMAT_16
#define CHAR_TYPE_SIZE 16
#else
#define CHAR_TYPE_SIZE 8
#endif
#endif
/* A C expression for the size in bits of the type
`char' on the
target machine. If you don't define this, the
default is one
quarter of a word. (If this would be less than one
storage unit,
it is rounded up to one unit.) */
#ifdef GVPP_FORMAT_12
#define FLOAT_TYPE_SIZE 48
#else
#ifdef GVPP_FORMAT_16
#define FLOAT_TYPE_SIZE 64
#else
#define FLOAT_TYPE_SIZE 32
#endif
#endif
/* A C expression for the size in bits of the type
`float' on the
target machine. If you don't define this, the
default is one word. */
#ifdef GVPP_FORMAT_12
#define DOUBLE_TYPE_SIZE 48
#else
#ifdef GVPP_FORMAT_16
#define DOUBLE_TYPE_SIZE 64
#else
#define DOUBLE_TYPE_SIZE 32
#endif
#endif
/* A C expression for the size in bits of the type
`double' on the
target machine. If you don't define this, the
default is two
words. */
#ifdef GVPP_FORMAT_12
#define LONG_DOUBLE_TYPE_SIZE 48
#else
#ifdef GVPP_FORMAT_16
#define LONG_DOUBLE_TYPE_SIZE 64
#else
#define LONG_DOUBLE_TYPE_SIZE 32
#endif
#endif
/* A C expression for the size in bits of the type
`long double' on
the target machine. If you don't define this, the
default is two
words. */
#define DEFAULT_SIGNED_CHAR 1
/* An expression whose value is 1 or 0, according to
whether the type
`char' should be signed or unsigned by default.
The user can
always override this default with the options
`-fsigned-char' and
`-funsigned-char'. */
/* `DEFAULT_SHORT_ENUMS'
A C expression to determine whether to give an
`enum' type only as
many bytes as it takes to represent the range of
possible values
of that type. A nonzero value means to do that; a
zero value
means all `enum' types should be allocated like
`int'.
If you don't define the macro, the default is 0.
*/
#ifdef GVPP_FORMAT_12
#define SIZE_TYPE "long unsigned int"
#else
#ifdef GVPP_FORMAT_16
#define SIZE_TYPE "long unsigned int"
#else
#define SIZE_TYPE "unsigned int"
#endif
#endif
/* A C expression for a string describing the name of
the data type
to use for size values. The typedef name `size_t'
is defined
using the contents of the string.
The string can contain more than one keyword. If
so, separate
them with spaces, and write first any length
keyword, then
`unsigned' if appropriate, and finally `int'. The
string must
exactly match one of the data type names defined in
the function
`init_decl_processing' in the file `c-decl.c'. You
may not omit
`int' or change the order--that would cause the
compiler to crash
on startup.
If you don't define this macro, the default is
`"long unsigned
int"'. */
#ifdef GVPP_FORMAT_12
#define PTRDIFF_TYPE "unsigned int"
#else
#ifdef GVPP_FORMAT_16
#define PTRDIFF_TYPE "unsigned int"
#else
#define PTRDIFF_TYPE "unsigned int"
#endif
#endif
/* A C expression for a string describing the name of
the data type
to use for the result of subtracting two pointers.
The typedef
name `ptrdiff_t' is defined using the contents of
the string. See
`SIZE_TYPE' above for more information.
If you don't define this macro, the default is
`"long int"'. */
#ifdef GVPP_FORMAT_12
#define WCHAR_TYPE_SIZE 24
#else
#ifdef GVPP_FORMAT_16
#define WCHAR_TYPE_SIZE 32
#else
#define WCHAR_TYPE_SIZE 16
#endif
#endif
Hope you would be able to help me
Thanks
Pierre Mallard
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com