aboutsummaryrefslogtreecommitdiff
path: root/sim/mips/gencode.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1996-07-18 01:21:16 +0000
committerStu Grossman <grossman@cygnus>1996-07-18 01:21:16 +0000
commit4fa14cf71c086365452d4bcde51b5c5ecb64aaf2 (patch)
tree7b0a07fc622b17b98d48109a285057d06d755ae1 /sim/mips/gencode.c
parent2ba0d82d52e44aa355f860d9bdf2c34ab1da2e34 (diff)
downloadgdb-4fa14cf71c086365452d4bcde51b5c5ecb64aaf2.zip
gdb-4fa14cf71c086365452d4bcde51b5c5ecb64aaf2.tar.gz
gdb-4fa14cf71c086365452d4bcde51b5c5ecb64aaf2.tar.bz2
* gencode.c (process_instructions): Generate word64 and uword64
instead of `long long' and `unsigned long long' data types. * interp.c: #include sysdep.h to get signals, and define default for SIGBUS. * (Convert): Work around for Visual-C++ compiler bug with type conversion. * support.h: Make things compile under Visual-C++ by using __int64 instead of `long long'. Change many refs to long long into word64/uword64 typedefs.
Diffstat (limited to 'sim/mips/gencode.c')
-rw-r--r--sim/mips/gencode.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sim/mips/gencode.c b/sim/mips/gencode.c
index 1e93b75..4685c0b 100644
--- a/sim/mips/gencode.c
+++ b/sim/mips/gencode.c
@@ -1017,13 +1017,17 @@ process_instructions(doarch,features)
case ADD:
case SUB:
{
- char *basetype = "unknown";
+ char *signed_basetype = "unknown";
+ char *unsigned_basetype = "unknown";
+
switch (GETDATASIZE()) {
case WORD :
- basetype = "int";
+ signed_basetype = "signed int";
+ unsigned_basetype = "unsigned int";
break;
case DOUBLEWORD :
- basetype = "long long";
+ signed_basetype = "word64";
+ unsigned_basetype = "uword64";
break;
default :
fprintf(stderr,"Opcode table error: size of ADD/SUB operands not known (%d)\n",GETDATASIZE());
@@ -1031,8 +1035,8 @@ process_instructions(doarch,features)
}
if ((MIPS_DECODE[loop].type) == ADD) {
- printf(" unsigned %s temp = (unsigned %s)(op1 + op2);\n",basetype,basetype);
- printf(" signed %s tempS = (signed %s)temp;\n",basetype,basetype);
+ printf(" %s temp = (%s)(op1 + op2);\n", unsigned_basetype, unsigned_basetype);
+ printf(" %s tempS = (%s)temp;\n", signed_basetype, signed_basetype);
if (MIPS_DECODE[loop].flags & OVERFLOW) {
printf(" if (((op1 < 0) == (op2 < 0)) && ((tempS < 0) != (op1 < 0)))\n");
printf(" SignalException(IntegerOverflow);\n");
@@ -1043,8 +1047,8 @@ process_instructions(doarch,features)
else /* only sign-extend when placing 32bit result in 64bit processor */
printf(" GPR[destreg] = SIGNEXTEND(((%s)temp),32);\n",regtype);
} else { /* SUB */
- printf(" unsigned %s temp = (unsigned %s)(op1 - op2);\n",basetype,basetype);
- printf(" signed %s tempS = (signed %s)temp;\n",basetype,basetype);
+ printf(" %s temp = (%s)(op1 - op2);\n", unsigned_basetype, unsigned_basetype);
+ printf(" %s tempS = (%s)temp;\n", signed_basetype, signed_basetype);
if (MIPS_DECODE[loop].flags & OVERFLOW) { /* different signs => overflow if result_sign != arg_sign */
printf(" if (((op1 < 0) != (op2 < 0)) && ((tempS < 0) == (op1 < 0)))\n");
printf(" SignalException(IntegerOverflow);\n");