* m32c.opc (parse_unsigned_bitbase): Take a new parameter which

decides if this function accepts symbolic constants or not.
(parse_signed_bitbase): Likewise.
(parse_unsigned_bitbase8): Pass the new parameter.
(parse_unsigned_bitbase11): Likewise.
(parse_unsigned_bitbase16): Likewise.
(parse_unsigned_bitbase19): Likewise.
(parse_unsigned_bitbase27): Likewise.
(parse_signed_bitbase8): Likewise.
(parse_signed_bitbase11): Likewise.
(parse_signed_bitbase19): Likewise.
* m32c-asm.c: Regenerate.
This commit is contained in:
DJ Delorie 2006-04-10 21:19:14 +00:00
parent da28e1e1b0
commit e78efa90d6
4 changed files with 100 additions and 20 deletions

View file

@ -1,3 +1,17 @@
2006-04-10 DJ Delorie <dj@redhat.com>
* m32c.opc (parse_unsigned_bitbase): Take a new parameter which
decides if this function accepts symbolic constants or not.
(parse_signed_bitbase): Likewise.
(parse_unsigned_bitbase8): Pass the new parameter.
(parse_unsigned_bitbase11): Likewise.
(parse_unsigned_bitbase16): Likewise.
(parse_unsigned_bitbase19): Likewise.
(parse_unsigned_bitbase27): Likewise.
(parse_signed_bitbase8): Likewise.
(parse_signed_bitbase11): Likewise.
(parse_signed_bitbase19): Likewise.
2006-03-13 DJ Delorie <dj@redhat.com> 2006-03-13 DJ Delorie <dj@redhat.com>
* m32c.cpu (Bit3-S): New. * m32c.cpu (Bit3-S): New.

View file

@ -608,13 +608,14 @@ parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp,
static const char * static const char *
parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep, int opindex, unsigned long *valuep,
unsigned bits) unsigned bits, int allow_syms)
{ {
const char *errmsg = 0; const char *errmsg = 0;
unsigned long bit; unsigned long bit;
unsigned long base; unsigned long base;
const char *newp = *strp; const char *newp = *strp;
unsigned long long bitbase; unsigned long long bitbase;
long have_zero = 0;
errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
if (errmsg) if (errmsg)
@ -624,6 +625,11 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
return "Missing base for bit,base:8"; return "Missing base for bit,base:8";
++newp; ++newp;
if (strncmp (newp, "0x0", 3) == 0
|| (newp[0] == '0' && newp[1] != 'x'))
have_zero = 1;
errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base); errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base);
if (errmsg) if (errmsg)
return errmsg; return errmsg;
@ -633,6 +639,21 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
if (bitbase >= (1ull << bits)) if (bitbase >= (1ull << bits))
return _("bit,base is out of range"); return _("bit,base is out of range");
/* If this field may require a relocation then use larger displacement. */
if (! have_zero && base == 0)
{
switch (allow_syms) {
case 0:
return _("bit,base out of range for symbol");
case 1:
break;
case 2:
if (strncmp (newp, "[sb]", 4) != 0)
return _("bit,base out of range for symbol");
break;
}
}
*valuep = bitbase; *valuep = bitbase;
*strp = newp; *strp = newp;
return 0; return 0;
@ -641,7 +662,7 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
static const char * static const char *
parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep, int opindex, signed long *valuep,
unsigned bits) unsigned bits, int allow_syms)
{ {
const char *errmsg = 0; const char *errmsg = 0;
unsigned long bit; unsigned long bit;
@ -649,6 +670,7 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
const char *newp = *strp; const char *newp = *strp;
long long bitbase; long long bitbase;
long long limit; long long limit;
long have_zero = 0;
errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
if (errmsg) if (errmsg)
@ -658,6 +680,11 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
return "Missing base for bit,base:8"; return "Missing base for bit,base:8";
++newp; ++newp;
if (strncmp (newp, "0x0", 3) == 0
|| (newp[0] == '0' && newp[1] != 'x'))
have_zero = 1;
errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base); errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base);
if (errmsg) if (errmsg)
return errmsg; return errmsg;
@ -668,6 +695,10 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
if (bitbase < -limit || bitbase >= limit) if (bitbase < -limit || bitbase >= limit)
return _("bit,base is out of range"); return _("bit,base is out of range");
/* If this field may require a relocation then use larger displacement. */
if (! have_zero && base == 0 && ! allow_syms)
return _("bit,base out of range for symbol");
*valuep = bitbase; *valuep = bitbase;
*strp = newp; *strp = newp;
return 0; return 0;
@ -677,56 +708,56 @@ static const char *
parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8, 0);
} }
static const char * static const char *
parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11, 0);
} }
static const char * static const char *
parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16, 1);
} }
static const char * static const char *
parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19, 2);
} }
static const char * static const char *
parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27, 1);
} }
static const char * static const char *
parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
return parse_signed_bitbase (cd, strp, opindex, valuep, 8); return parse_signed_bitbase (cd, strp, opindex, valuep, 8, 1);
} }
static const char * static const char *
parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
return parse_signed_bitbase (cd, strp, opindex, valuep, 11); return parse_signed_bitbase (cd, strp, opindex, valuep, 11, 0);
} }
static const char * static const char *
parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
return parse_signed_bitbase (cd, strp, opindex, valuep, 19); return parse_signed_bitbase (cd, strp, opindex, valuep, 19, 1);
} }
/* Parse the suffix as :<char> or as nothing followed by a whitespace. */ /* Parse the suffix as :<char> or as nothing followed by a whitespace. */

View file

@ -1,3 +1,7 @@
2006-04-10 DJ Delorie <dj@redhat.com>
* m32c-asm.c: Regenerate.
2006-04-06 Carlos O'Donell <carlos@codesourcery.com> 2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.am: Add install-html target. * Makefile.am: Add install-html target.

View file

@ -578,13 +578,14 @@ parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp,
static const char * static const char *
parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep, int opindex, unsigned long *valuep,
unsigned bits) unsigned bits, int allow_syms)
{ {
const char *errmsg = 0; const char *errmsg = 0;
unsigned long bit; unsigned long bit;
unsigned long base; unsigned long base;
const char *newp = *strp; const char *newp = *strp;
unsigned long long bitbase; unsigned long long bitbase;
long have_zero = 0;
errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
if (errmsg) if (errmsg)
@ -594,6 +595,11 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
return "Missing base for bit,base:8"; return "Missing base for bit,base:8";
++newp; ++newp;
if (strncmp (newp, "0x0", 3) == 0
|| (newp[0] == '0' && newp[1] != 'x'))
have_zero = 1;
errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base); errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base);
if (errmsg) if (errmsg)
return errmsg; return errmsg;
@ -603,6 +609,21 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
if (bitbase >= (1ull << bits)) if (bitbase >= (1ull << bits))
return _("bit,base is out of range"); return _("bit,base is out of range");
/* If this field may require a relocation then use larger displacement. */
if (! have_zero && base == 0)
{
switch (allow_syms) {
case 0:
return _("bit,base out of range for symbol");
case 1:
break;
case 2:
if (strncmp (newp, "[sb]", 4) != 0)
return _("bit,base out of range for symbol");
break;
}
}
*valuep = bitbase; *valuep = bitbase;
*strp = newp; *strp = newp;
return 0; return 0;
@ -611,7 +632,7 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
static const char * static const char *
parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep, int opindex, signed long *valuep,
unsigned bits) unsigned bits, int allow_syms)
{ {
const char *errmsg = 0; const char *errmsg = 0;
unsigned long bit; unsigned long bit;
@ -619,6 +640,7 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
const char *newp = *strp; const char *newp = *strp;
long long bitbase; long long bitbase;
long long limit; long long limit;
long have_zero = 0;
errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
if (errmsg) if (errmsg)
@ -628,6 +650,11 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
return "Missing base for bit,base:8"; return "Missing base for bit,base:8";
++newp; ++newp;
if (strncmp (newp, "0x0", 3) == 0
|| (newp[0] == '0' && newp[1] != 'x'))
have_zero = 1;
errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base); errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base);
if (errmsg) if (errmsg)
return errmsg; return errmsg;
@ -638,6 +665,10 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
if (bitbase < -limit || bitbase >= limit) if (bitbase < -limit || bitbase >= limit)
return _("bit,base is out of range"); return _("bit,base is out of range");
/* If this field may require a relocation then use larger displacement. */
if (! have_zero && base == 0 && ! allow_syms)
return _("bit,base out of range for symbol");
*valuep = bitbase; *valuep = bitbase;
*strp = newp; *strp = newp;
return 0; return 0;
@ -647,56 +678,56 @@ static const char *
parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8, 0);
} }
static const char * static const char *
parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11, 0);
} }
static const char * static const char *
parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16, 1);
} }
static const char * static const char *
parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19, 2);
} }
static const char * static const char *
parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp, parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27); return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27, 1);
} }
static const char * static const char *
parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
return parse_signed_bitbase (cd, strp, opindex, valuep, 8); return parse_signed_bitbase (cd, strp, opindex, valuep, 8, 1);
} }
static const char * static const char *
parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
return parse_signed_bitbase (cd, strp, opindex, valuep, 11); return parse_signed_bitbase (cd, strp, opindex, valuep, 11, 0);
} }
static const char * static const char *
parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp, parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
return parse_signed_bitbase (cd, strp, opindex, valuep, 19); return parse_signed_bitbase (cd, strp, opindex, valuep, 19, 1);
} }
/* Parse the suffix as :<char> or as nothing followed by a whitespace. */ /* Parse the suffix as :<char> or as nothing followed by a whitespace. */