Skip to content

Commit

Permalink
IA-16: when def'ing __SMALL__, undef. __TINY__, __MEDIUM__, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkchia committed Jun 26, 2018
1 parent 45a945b commit f55717c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
39 changes: 20 additions & 19 deletions gcc/config/ia16/ia16-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def_or_undef_macro (const char *name, bool def_p)
void
ia16_cpu_cpp_builtins (void)
{
bool def_p;

builtin_define_std ("ia16");
def_macro ("__FAR");

Expand Down Expand Up @@ -99,25 +101,24 @@ ia16_cpu_cpp_builtins (void)
an AArch64-style macro __IA16_CMODEL_{TINY | SMALL | ...}__, and a
simple __{TINY | SMALL | ...}__ macro as used in the classical Borland
C and Open Watcom compilers (and others). -- tkchia */
switch (target_cmodel)
{
case CMODEL_TINY:
def_macro ("__IA16_CMODEL_TINY__");
def_macro ("__TINY__");
break;
case CMODEL_SMALL:
def_macro ("__IA16_CMODEL_SMALL__");
def_macro ("__SMALL__");
break;
#if 0
case CMODEL_MEDIUM:
def_macro ("__IA16_CMODEL_MEDIUM__");
def_macro ("__MEDIUM__");
break;
#endif
default:
gcc_unreachable ();
}
def_p = (target_cmodel == CMODEL_TINY);
def_or_undef_macro ("__IA16_CMODEL_TINY__", def_p);
def_or_undef_macro ("__TINY__", def_p);
def_p = (target_cmodel == CMODEL_SMALL);
def_or_undef_macro ("__IA16_CMODEL_SMALL__", def_p);
def_or_undef_macro ("__SMALL__", def_p);
def_p = (target_cmodel == CMODEL_MEDIUM);
def_or_undef_macro ("__IA16_CMODEL_MEDIUM__", def_p);
def_or_undef_macro ("__MEDIUM__", def_p);
def_p = (target_cmodel == CMODEL_COMPACT);
def_or_undef_macro ("__IA16_CMODEL_COMPACT__", def_p);
def_or_undef_macro ("__COMPACT__", def_p);
def_p = (target_cmodel == CMODEL_LARGE);
def_or_undef_macro ("__IA16_CMODEL_LARGE__", def_p);
def_or_undef_macro ("__LARGE__", def_p);
def_p = (target_cmodel == CMODEL_HUGE);
def_or_undef_macro ("__IA16_CMODEL_HUGE__", def_p);
def_or_undef_macro ("__HUGE__", def_p);

/* Define a macro for the chosen -march=. A source file can use this to
decide whether to employ a capability not covered by the
Expand Down
6 changes: 5 additions & 1 deletion gcc/config/ia16/ia16.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,17 @@ enum processor_type

extern int ia16_features;

/* Which memory model to use. */
/* Which memory model to use. Some memory models may not actually be
implemented and available through the front-end. */

enum cmodel_type
{
CMODEL_TINY,
CMODEL_SMALL,
CMODEL_MEDIUM,
CMODEL_COMPACT,
CMODEL_LARGE,
CMODEL_HUGE,
CMODEL_max
};

Expand Down

0 comments on commit f55717c

Please sign in to comment.