diff options
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-z8k.c | 12 | ||||
-rw-r--r-- | opcodes/ChangeLog | 8 | ||||
-rw-r--r-- | opcodes/z8k-opc.h | 10 | ||||
-rw-r--r-- | opcodes/z8kgen.c | 64 |
5 files changed, 68 insertions, 33 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index eaa252a..2793980 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2001-08-01 Christian Groessler <cpg@aladdin.de> + + * config/tc-z8k.c (parse_reg): If a string starts with "r", "rl", + "rh", "rr", "rq", or "sp" then don't automatically assume + it's a register name. Check whether there is a number + following. + 2001-08-01 Alan Modra <amodra@bigpond.net.au> * config/tc-i386.c (lex_got): Match lower case relocation tokens. diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index 73666ca..d8bbb8b 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -259,7 +259,7 @@ parse_reg (src, mode, reg) char *res = 0; char regno; - if (src[0] == 's' && src[1] == 'p') + if (src[0] == 's' && src[1] == 'p' && (src[2] == 0 || src[2] == ',')) { if (segmented_mode) { @@ -277,6 +277,8 @@ parse_reg (src, mode, reg) { if (src[1] == 'r') { + if (src[2] < '0' || src[2] > '9') + return res; /* Assume no register name but a label starting with 'rr'. */ *mode = CLASS_REG_LONG; res = whatreg (reg, src + 2); regno = *reg; @@ -285,6 +287,8 @@ parse_reg (src, mode, reg) } else if (src[1] == 'h') { + if (src[2] < '0' || src[2] > '9') + return res; /* Assume no register name but a label starting with 'rh'. */ *mode = CLASS_REG_BYTE; res = whatreg (reg, src + 2); regno = *reg; @@ -293,6 +297,8 @@ parse_reg (src, mode, reg) } else if (src[1] == 'l') { + if (src[2] < '0' || src[2] > '9') + return res; /* Assume no register name but a label starting with 'rl'. */ *mode = CLASS_REG_BYTE; res = whatreg (reg, src + 2); regno = *reg; @@ -302,6 +308,8 @@ parse_reg (src, mode, reg) } else if (src[1] == 'q') { + if (src[2] < '0' || src[2] > '9') + return res; /* Assume no register name but a label starting with 'rq'. */ *mode = CLASS_REG_QUAD; res = whatreg (reg, src + 2); regno = *reg; @@ -310,6 +318,8 @@ parse_reg (src, mode, reg) } else { + if (src[1] < '0' || src[1] > '9') + return res; /* Assume no register name but a label starting with 'r'. */ *mode = CLASS_REG_WORD; res = whatreg (reg, src + 1); regno = *reg; diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 4103ff8..bf3e14a 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,11 @@ +2001-08-01 Christian Groessler <cpg@aladdin.de> + + * z8kgen.c: Fixed indentation of opt[] array. Include stdio.h to + get stderr definition. + (internal, gas): Removed warnings. + (gas): Create a correct final entry for created array. + * z8k-opc.h: Recreated with new z8kgen. + 2001-07-28 Kazu Hirata <kazu@hxi.com> * i386-dis.c: Fix formatting. diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h index 379568a..80c8c82 100644 --- a/opcodes/z8k-opc.h +++ b/opcodes/z8k-opc.h @@ -4467,5 +4467,13 @@ opcode_entry_type z8k_table[] = { #endif "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,420}, -0,0}; + +/* end marker */ +{ +#ifdef NICENAMES +NULL,0,0, +0, +#endif +NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0} +}; #endif diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c index 4029bf1c..b565f3c 100644 --- a/opcodes/z8kgen.c +++ b/opcodes/z8kgen.c @@ -19,6 +19,7 @@ /* This program generates z8k-opc.h */ +#include <stdio.h> #include "sysdep.h" #define BYTE_INFO_LEN 10 @@ -81,12 +82,12 @@ struct op opt[] = "CZSV--", 5, 16, "1011 0101 ssss dddd", "adc rd,rs", 0, "CZSVDH", 5, 8, "1011 0100 ssss dddd", "adcb rbd,rbs", 0, "CZSV--", 7, 16, "0000 0001 ssN0 dddd", "add rd,@rs", 0, -"CZSV--", 9, 16, "0100 0001 0000 dddd address_src", "add rd,address_src", 0, + "CZSV--", 9, 16, "0100 0001 0000 dddd address_src", "add rd,address_src", 0, "CZSV--", 10, 16, "0100 0001 ssN0 dddd address_src", "add rd,address_src(rs)", 0, "CZSV--", 7, 16, "0000 0001 0000 dddd imm16", "add rd,imm16", 0, "CZSV--", 4, 16, "1000 0001 ssss dddd", "add rd,rs", 0, "CZSVDH", 7, 8, "0000 0000 ssN0 dddd", "addb rbd,@rs", 0, -"CZSVDH", 9, 8, "0100 0000 0000 dddd address_src", "addb rbd,address_src", 0, + "CZSVDH", 9, 8, "0100 0000 0000 dddd address_src", "addb rbd,address_src", 0, "CZSVDH", 10, 8, "0100 0000 ssN0 dddd address_src", "addb rbd,address_src(rs)", 0, "CZSVDH", 7, 8, "0000 0000 0000 dddd imm8 imm8", "addb rbd,imm8", 0, "CZSVDH", 4, 8, "1000 0000 ssss dddd", "addb rbd,rbs", 0, @@ -97,12 +98,12 @@ struct op opt[] = "CZSV--", 8, 32, "1001 0110 ssss dddd", "addl rrd,rrs", 0, "-ZS---", 7, 16, "0000 0111 ssN0 dddd", "and rd,@rs", 0, -"-ZS---", 9, 16, "0100 0111 0000 dddd address_src", "and rd,address_src", 0, + "-ZS---", 9, 16, "0100 0111 0000 dddd address_src", "and rd,address_src", 0, "-ZS---", 10, 16, "0100 0111 ssN0 dddd address_src", "and rd,address_src(rs)", 0, "-ZS---", 7, 16, "0000 0111 0000 dddd imm16", "and rd,imm16", 0, "-ZS---", 4, 16, "1000 0111 ssss dddd", "and rd,rs", 0, "-ZSP--", 7, 8, "0000 0110 ssN0 dddd", "andb rbd,@rs", 0, -"-ZSP--", 9, 8, "0100 0110 0000 dddd address_src", "andb rbd,address_src", 0, + "-ZSP--", 9, 8, "0100 0110 0000 dddd address_src", "andb rbd,address_src", 0, "-ZSP--", 10, 8, "0100 0110 ssN0 dddd address_src", "andb rbd,address_src(rs)", 0, "-ZSP--", 7, 8, "0000 0110 0000 dddd imm8 imm8", "andb rbd,imm8", 0, "-ZSP--", 4, 8, "1000 0110 ssss dddd", "andb rbd,rbs", 0, @@ -111,13 +112,13 @@ struct op opt[] = "-Z----", 11, 16, "0110 0111 ddN0 imm4 address_dst", "bit address_dst(rd),imm4", 0, "-Z----", 10, 16, "0110 0111 0000 imm4 address_dst", "bit address_dst,imm4", 0, "-Z----", 4, 16, "1010 0111 dddd imm4", "bit rd,imm4", 0, -"-Z----", 10, 16, "0010 0111 0000 ssss 0000 dddd 0000 0000", "bit rd,rs", 0, + "-Z----", 10, 16, "0010 0111 0000 ssss 0000 dddd 0000 0000", "bit rd,rs", 0, "-Z----", 8, 8, "0010 0110 ddN0 imm4", "bitb @rd,imm4", 0, "-Z----", 11, 8, "0110 0110 ddN0 imm4 address_dst", "bitb address_dst(rd),imm4", 0, "-Z----", 10, 8, "0110 0110 0000 imm4 address_dst", "bitb address_dst,imm4", 0, "-Z----", 4, 8, "1010 0110 dddd imm4", "bitb rbd,imm4", 0, -"-Z----", 10, 8, "0010 0110 0000 ssss 0000 dddd 0000 0000", "bitb rbd,rs", 0, + "-Z----", 10, 8, "0010 0110 0000 ssss 0000 dddd 0000 0000", "bitb rbd,rs", 0, "------", 10, 32, "0001 1111 ddN0 0000", "call @rd", 0, "------", 12, 32, "0101 1111 0000 0000 address_dst", "call address_dst", 0, @@ -156,7 +157,7 @@ struct op opt[] = "CZSV--", 15, 8, "0100 1100 ddN0 0001 address_dst imm8 imm8", "cpb address_dst(rd),imm8", 0, "CZSV--", 14, 8, "0100 1100 0000 0001 address_dst imm8 imm8", "cpb address_dst,imm8", 0, "CZSV--", 7, 8, "0000 1010 ssN0 dddd", "cpb rbd,@rs", 0, -"CZSV--", 9, 8, "0100 1010 0000 dddd address_src", "cpb rbd,address_src", 0, + "CZSV--", 9, 8, "0100 1010 0000 dddd address_src", "cpb rbd,address_src", 0, "CZSV--", 10, 8, "0100 1010 ssN0 dddd address_src", "cpb rbd,address_src(rs)", 0, "CZSV--", 7, 8, "0000 1010 0000 dddd imm8 imm8", "cpb rbd,imm8", 0, "CZSV--", 4, 8, "1000 1010 ssss dddd", "cpb rbd,rbs", 0, @@ -194,11 +195,11 @@ struct op opt[] = "------", 7, 16, "0111 1100 0000 01ii", "ei i2", 0, "------", 6, 16, "1010 1101 ssss dddd", "ex rd,rs", 0, "------", 12, 16, "0010 1101 ssN0 dddd", "ex rd,@rs", 0, -"------", 15, 16, "0110 1101 0000 dddd address_src", "ex rd,address_src", 0, + "------", 15, 16, "0110 1101 0000 dddd address_src", "ex rd,address_src", 0, "------", 16, 16, "0110 1101 ssN0 dddd address_src", "ex rd,address_src(rs)", 0, "------", 12, 8, "0010 1100 ssN0 dddd", "exb rbd,@rs", 0, -"------", 15, 8, "0110 1100 0000 dddd address_src", "exb rbd,address_src", 0, + "------", 15, 8, "0110 1100 0000 dddd address_src", "exb rbd,address_src", 0, "------", 16, 8, "0110 1100 ssN0 dddd address_src", "exb rbd,address_src(rs)", 0, "------", 6, 8, "1010 1100 ssss dddd", "exb rbd,rbs", 0, @@ -234,7 +235,7 @@ struct op opt[] = "------", 15, 16, "0100 1101 ddN0 0101 address_dst imm16", "ld address_dst(rd),imm16", 0, "------", 12, 16, "0110 1111 ddN0 ssss address_dst", "ld address_dst(rd),rs", 0, "------", 14, 16, "0100 1101 0000 0101 address_dst imm16", "ld address_dst,imm16", 0, -"------", 11, 16, "0110 1111 0000 ssss address_dst", "ld address_dst,rs", 0, + "------", 11, 16, "0110 1111 0000 ssss address_dst", "ld address_dst,rs", 0, "------", 14, 16, "0011 0011 ddN0 ssss imm16", "ld rd(imm16),rs", 0, "------", 14, 16, "0111 0011 ddN0 ssss 0000 xxxx 0000 0000", "ld rd(rx),rs", 0, "------", 7, 16, "0010 0001 ssN0 dddd", "ld rd,@rs", 0, @@ -250,11 +251,11 @@ struct op opt[] = "------", 15, 8, "0100 1100 ddN0 0101 address_dst imm8 imm8", "ldb address_dst(rd),imm8", 0, "------", 12, 8, "0110 1110 ddN0 ssss address_dst", "ldb address_dst(rd),rbs", 0, "------", 14, 8, "0100 1100 0000 0101 address_dst imm8 imm8", "ldb address_dst,imm8", 0, -"------", 11, 8, "0110 1110 0000 ssss address_dst", "ldb address_dst,rbs", 0, + "------", 11, 8, "0110 1110 0000 ssss address_dst", "ldb address_dst,rbs", 0, "------", 14, 8, "0011 0010 ddN0 ssss imm16", "ldb rd(imm16),rbs", 0, "------", 14, 8, "0111 0010 ddN0 ssss 0000 xxxx 0000 0000", "ldb rd(rx),rbs", 0, "------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0, -"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0, + "------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0, "------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0, "------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0, "------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0, @@ -335,7 +336,7 @@ struct op opt[] = "CZS---", 4, 16, "1000 0101 ssss dddd", "or rd,rs", 0, "CZSP--", 7, 8, "0000 0100 ssN0 dddd", "orb rbd,@rs", 0, -"CZSP--", 9, 8, "0100 0100 0000 dddd address_src", "orb rbd,address_src", 0, + "CZSP--", 9, 8, "0100 0100 0000 dddd address_src", "orb rbd,address_src", 0, "CZSP--", 10, 8, "0100 0100 ssN0 dddd address_src", "orb rbd,address_src(rs)", 0, "CZSP--", 7, 8, "0000 0100 0000 dddd imm8 imm8", "orb rbd,imm8", 0, "CZSP--", 4, 8, "1000 0100 ssss dddd", "orb rbd,rbs", 0, @@ -375,13 +376,13 @@ struct op opt[] = "------", 14, 16, "0110 0011 ddN0 imm4 address_dst", "res address_dst(rd),imm4", 0, "------", 13, 16, "0110 0011 0000 imm4 address_dst", "res address_dst,imm4", 0, "------", 4, 16, "1010 0011 dddd imm4", "res rd,imm4", 0, -"------", 10, 16, "0010 0011 0000 ssss 0000 dddd 0000 0000", "res rd,rs", 0, + "------", 10, 16, "0010 0011 0000 ssss 0000 dddd 0000 0000", "res rd,rs", 0, "------", 11, 8, "0010 0010 ddN0 imm4", "resb @rd,imm4", 0, "------", 14, 8, "0110 0010 ddN0 imm4 address_dst", "resb address_dst(rd),imm4", 0, "------", 13, 8, "0110 0010 0000 imm4 address_dst", "resb address_dst,imm4", 0, "------", 4, 8, "1010 0010 dddd imm4", "resb rbd,imm4", 0, -"------", 10, 8, "0010 0010 0000 ssss 0000 dddd 0000 0000", "resb rbd,rs", 0, + "------", 10, 8, "0010 0010 0000 ssss 0000 dddd 0000 0000", "resb rbd,rs", 0, "CZSV--", 7, 16, "1000 1101 flags 0011", "resflg flags", 0, "------", 10, 16, "1001 1110 0000 cccc", "ret cc", 0, @@ -404,24 +405,24 @@ struct op opt[] = "CZSVDH", 33, 8, "0111 1111 imm8", "sc imm8", 0, -"CZSV--", 15, 16, "1011 0011 dddd 1011 0000 ssss 0000 0000", "sda rd,rs", 0, -"CZSV--", 15, 8, "1011 0010 dddd 1011 0000 ssss 0000 0000", "sdab rbd,rs", 0, + "CZSV--", 15, 16, "1011 0011 dddd 1011 0000 ssss 0000 0000", "sda rd,rs", 0, + "CZSV--", 15, 8, "1011 0010 dddd 1011 0000 ssss 0000 0000", "sdab rbd,rs", 0, "CZSV--", 15, 32, "1011 0011 dddd 1111 0000 ssss 0000 0000", "sdal rrd,rs", 0, -"CZS---", 15, 16, "1011 0011 dddd 0011 0000 ssss 0000 0000", "sdl rd,rs", 0, -"CZS---", 15, 8, "1011 0010 dddd 0011 0000 ssss 0000 0000", "sdlb rbd,rs", 0, + "CZS---", 15, 16, "1011 0011 dddd 0011 0000 ssss 0000 0000", "sdl rd,rs", 0, + "CZS---", 15, 8, "1011 0010 dddd 0011 0000 ssss 0000 0000", "sdlb rbd,rs", 0, "CZS---", 15, 32, "1011 0011 dddd 0111 0000 ssss 0000 0000", "sdll rrd,rs", 0, "------", 11, 16, "0010 0101 ddN0 imm4", "set @rd,imm4", 0, "------", 14, 16, "0110 0101 ddN0 imm4 address_dst", "set address_dst(rd),imm4", 0, "------", 13, 16, "0110 0101 0000 imm4 address_dst", "set address_dst,imm4", 0, "------", 4, 16, "1010 0101 dddd imm4", "set rd,imm4", 0, -"------", 10, 16, "0010 0101 0000 ssss 0000 dddd 0000 0000", "set rd,rs", 0, + "------", 10, 16, "0010 0101 0000 ssss 0000 dddd 0000 0000", "set rd,rs", 0, "------", 11, 8, "0010 0100 ddN0 imm4", "setb @rd,imm4", 0, "------", 14, 8, "0110 0100 ddN0 imm4 address_dst", "setb address_dst(rd),imm4", 0, "------", 13, 8, "0110 0100 0000 imm4 address_dst", "setb address_dst,imm4", 0, "------", 4, 8, "1010 0100 dddd imm4", "setb rbd,imm4", 0, -"------", 10, 8, "0010 0100 0000 ssss 0000 dddd 0000 0000", "setb rbd,rs", 0, + "------", 10, 8, "0010 0100 0000 ssss 0000 dddd 0000 0000", "setb rbd,rs", 0, "CZSV--", 7, 16, "1000 1101 flags 0001", "setflg flags", 0, @@ -456,13 +457,13 @@ struct op opt[] = "CZSV--", 13, 32, "1011 0011 dddd 0101 1111 1111 nim8", "srll rrd,imm8", 0, "CZSV--", 7, 16, "0000 0011 ssN0 dddd", "sub rd,@rs", 0, -"CZSV--", 9, 16, "0100 0011 0000 dddd address_src", "sub rd,address_src", 0, + "CZSV--", 9, 16, "0100 0011 0000 dddd address_src", "sub rd,address_src", 0, "CZSV--", 10, 16, "0100 0011 ssN0 dddd address_src", "sub rd,address_src(rs)", 0, "CZSV--", 7, 16, "0000 0011 0000 dddd imm16", "sub rd,imm16", 0, "CZSV--", 4, 16, "1000 0011 ssss dddd", "sub rd,rs", 0, "CZSVDH", 7, 8, "0000 0010 ssN0 dddd", "subb rbd,@rs", 0, -"CZSVDH", 9, 8, "0100 0010 0000 dddd address_src", "subb rbd,address_src", 0, + "CZSVDH", 9, 8, "0100 0010 0000 dddd address_src", "subb rbd,address_src", 0, "CZSVDH", 10, 8, "0100 0010 ssN0 dddd address_src", "subb rbd,address_src(rs)", 0, "CZSVDH", 7, 8, "0000 0010 0000 dddd imm8 imm8", "subb rbd,imm8", 0, "CZSVDH", 4, 8, "1000 0010 ssss dddd", "subb rbd,rbs", 0, @@ -487,7 +488,7 @@ struct op opt[] = "-ZSP--", 7, 8, "1000 1100 dddd 0100", "testb rbd", 0, "-ZS---", 13, 32, "0001 1100 ddN0 1000", "testl @rd", 0, -"-ZS---", 16, 32, "0101 1100 0000 1000 address_dst", "testl address_dst", 0, + "-ZS---", 16, 32, "0101 1100 0000 1000 address_dst", "testl address_dst", 0, "-ZS---", 17, 32, "0101 1100 ddN0 1000 address_dst", "testl address_dst(rd)", 0, "-ZS---", 13, 32, "1001 1100 dddd 1000", "testl rrd", 0, @@ -512,13 +513,13 @@ struct op opt[] = "--S---", 7, 8, "1000 1100 dddd 0110", "tsetb rbd", 0, "-ZS---", 7, 16, "0000 1001 ssN0 dddd", "xor rd,@rs", 0, -"-ZS---", 9, 16, "0100 1001 0000 dddd address_src", "xor rd,address_src", 0, + "-ZS---", 9, 16, "0100 1001 0000 dddd address_src", "xor rd,address_src", 0, "-ZS---", 10, 16, "0100 1001 ssN0 dddd address_src", "xor rd,address_src(rs)", 0, "-ZS---", 7, 16, "0000 1001 0000 dddd imm16", "xor rd,imm16", 0, "-ZS---", 4, 16, "1000 1001 ssss dddd", "xor rd,rs", 0, "-ZSP--", 7, 8, "0000 1000 ssN0 dddd", "xorb rbd,@rs", 0, -"-ZSP--", 9, 8, "0100 1000 0000 dddd address_src", "xorb rbd,address_src", 0, + "-ZSP--", 9, 8, "0100 1000 0000 dddd address_src", "xorb rbd,address_src", 0, "-ZSP--", 10, 8, "0100 1000 ssN0 dddd address_src", "xorb rbd,address_src(rs)", 0, "-ZSP--", 7, 8, "0000 1000 0000 dddd imm8 imm8", "xorb rbd,imm8", 0, "-ZSP--", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0, @@ -703,7 +704,6 @@ struct tok_struct toks[] = "01ii", "CLASS_01II", 1, "00ii", "CLASS_00II", 1, 0, 0 - }; char * @@ -899,7 +899,7 @@ void internal () { int c = count (); - struct op *new = xmalloc (sizeof (struct op) * c); + struct op *new = (struct op *) xmalloc (sizeof (struct op) * c); struct op *p = opt; memcpy (new, p, c * sizeof (struct op)); @@ -958,7 +958,7 @@ gas () struct op *p = opt; int idx = 0; char *oldname = ""; - struct op *new = xmalloc (sizeof (struct op) * c); + struct op *new = (struct op *) xmalloc (sizeof (struct op) * c); memcpy (new, p, c * sizeof (struct op)); @@ -1278,7 +1278,9 @@ gas () printf ("},\n"); new++; } - printf ("0,0};\n"); + printf ("\n/* end marker */\n"); + printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n"); + printf ("NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}\n};\n"); printf ("#endif\n"); } @@ -1319,5 +1321,5 @@ main (ac, av) printf ("-d : generate new table for disassemble\n"); printf ("-h : generate new table for humans\n"); } -return 0; + return 0; } |