This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This fixes a number of inconsistent/meaningless error messages on ill uses of operands to the index operator. Built and tested on ia64-unknown-linux-gnu. Jan include/opcode/ 2005-10-21 Jan Beulich <jbeulich@novell.com> * ia64.h (enum ia64_opnd): Move memory operand out of set of indirect operands. bfd/ 2005-10-21 Jan Beulich <jbeulich@novell.com> * cpu-ia64-opc.c (elf64_ia64_operands): Move memory operand out of set of indirect operands. gas/ 2005-10-21 Jan Beulich <jbeulich@novell.com> * config/tc-ia64.c (enum reg_symbol): Delete IND_MEM. (dot_rot): Change type of num_* variables. Check for positive count. (ia64_optimize_expr): Re-structure. (md_operand): Check for general register. gas/testsuite/ 2005-10-21 Jan Beulich <jbeulich@novell.com> * gas/ia64/index.[sl]: New. * gas/ia64/rotX.[sl]: New. * gas/ia64/ia64.exp: Run new tests. opcodes/ 2005-10-21 Jan Beulich <jbeulich@novell.com> * ia64-asmtab.c: Regenerate. --- /home/jbeulich/src/binutils/mainline/2005-10-20/bfd/cpu-ia64-opc.c 2005-05-06 08:24:20.000000000 +0200 +++ 2005-10-20/bfd/cpu-ia64-opc.c 2005-10-21 11:27:22.574142670 +0200 @@ -457,6 +457,10 @@ const struct ia64_operand elf64_ia64_ope { REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */ "a general register r0-r3" }, + /* memory operands: */ + { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */ + "a memory address" }, + /* indirect operands: */ { IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */ "a cpuid register" }, @@ -468,8 +472,6 @@ const struct ia64_operand elf64_ia64_ope "an itr register" }, { IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */ "an ibr register" }, - { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */ - "an indirect memory address" }, { IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */ "an msr register" }, { IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */ --- /home/jbeulich/src/binutils/mainline/2005-10-20/gas/config/tc-ia64.c 2005-10-12 09:50:45.000000000 +0200 +++ 2005-10-20/gas/config/tc-ia64.c 2005-10-21 10:50:20.361279267 +0200 @@ -124,7 +124,6 @@ enum reg_symbol IND_DTR, IND_ITR, IND_IBR, - IND_MEM, IND_MSR, IND_PKR, IND_PMC, @@ -4772,7 +4771,8 @@ static void dot_rot (type) int type; { - unsigned num_regs, num_alloced = 0; + offsetT num_regs; + valueT num_alloced = 0; struct dynreg **drpp, *dr; int ch, base_reg = 0; char *name, *start; @@ -4817,6 +4817,11 @@ dot_rot (type) as_bad ("Expected ']'"); goto err; } + if (num_regs <= 0) + { + as_bad ("Number of elements must be positive"); + goto err; + } SKIP_WHITESPACE (); num_alloced += num_regs; @@ -7989,31 +7994,38 @@ ia64_optimize_expr (l, op, r) operatorT op; expressionS *r; { - unsigned num_regs; - - if (op == O_index) + if (op != O_index) + return 0; + resolve_expression (l); + if (l->X_op == O_register) { - if (l->X_op == O_register && r->X_op == O_constant) + unsigned num_regs = l->X_add_number >> 16; + + resolve_expression (r); + if (num_regs) { - num_regs = (l->X_add_number >> 16); - if ((unsigned) r->X_add_number >= num_regs) + /* Left side is a .rotX-allocated register. */ + if (r->X_op != O_constant) { - if (!num_regs) - as_bad ("No current frame"); - else - as_bad ("Index out of range 0..%u", num_regs - 1); + as_bad ("Rotating register index must be a non-negative constant"); + r->X_add_number = 0; + } + else if ((valueT) r->X_add_number >= num_regs) + { + as_bad ("Index out of range 0..%u", num_regs - 1); r->X_add_number = 0; } l->X_add_number = (l->X_add_number & 0xffff) + r->X_add_number; return 1; } - else if (l->X_op == O_register && r->X_op == O_register) + else if (l->X_add_number >= IND_CPUID && l->X_add_number <= IND_RR) { - if (l->X_add_number < IND_CPUID || l->X_add_number > IND_RR - || l->X_add_number == IND_MEM) + if (r->X_op != O_register + || r->X_add_number < REG_GR + || r->X_add_number > REG_GR + 127) { - as_bad ("Indirect register set name expected"); - l->X_add_number = IND_CPUID; + as_bad ("Indirect register index must be a general register"); + r->X_add_number = REG_GR; } l->X_op = O_index; l->X_op_symbol = md.regsym[l->X_add_number]; @@ -8021,7 +8033,12 @@ ia64_optimize_expr (l, op, r) return 1; } } - return 0; + as_bad ("Index can only be applied to rotating or indirect registers"); + /* Fall back to some register use of which has as little as possible + side effects, to minimize subsequent error messages. */ + l->X_op = O_register; + l->X_add_number = REG_GR + 3; + return 1; } int @@ -11030,8 +11047,13 @@ md_operand (e) } else { - if (e->X_op != O_register) - as_bad ("Register expected as index"); + if (e->X_op != O_register + || e->X_add_number < REG_GR + || e->X_add_number > REG_GR + 127) + { + as_bad ("Index must be a general register"); + e->X_add_number = REG_GR; + } ++input_line_pointer; e->X_op = O_index; --- /home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/ia64.exp 2005-10-12 09:50:45.000000000 +0200 +++ 2005-10-20/gas/testsuite/gas/ia64/ia64.exp 2005-10-21 10:50:20.363232392 +0200 @@ -79,12 +79,14 @@ if [istarget "ia64-*"] then { run_list_test "alloc" "" run_dump_test "bundling" run_dump_test "forward" + run_list_test "index" "" run_list_test "label" "" run_list_test "last" "" run_list_test "no-fit" "" run_list_test "pound" "-al" run_list_test "proc" "-munwind-check=error" run_list_test "radix" "" + run_list_test "rotX" "" run_list_test "slot2" "" run_dump_test "strange" run_list_test "unwind-bad" "" --- /home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/index.l 1970-01-01 01:00:00.000000000 +0100 +++ 2005-10-20/gas/testsuite/gas/ia64/index.l 2005-10-21 08:44:30.000000000 +0200 @@ -0,0 +1,42 @@ +.*: Assembler messages: +.*.s:6: Error: [Ii]ndex must be a general register +.*.s:7: Error: [Ii]ndex must be a general register +.*.s:8: Error: [Ii]ndex must be a general register +.*.s:9: Error: [Ii]ndex must be a general register +.*.s:13: Error: [Ii]ndirect register index must be a general register +.*.s:14: Error: [Ii]ndirect register index must be a general register +.*.s:15: Error: [Ii]ndirect register index must be a general register +.*.s:16: Error: [Ii]ndirect register index must be a general register +.*.s:20: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:21: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:22: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:23: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:24: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:25: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:27: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:28: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:29: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:30: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:31: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:32: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:37: Error: [Rr]otating register index must be a non-negative constant +.*.s:39: Error: [Ii]ndex out of range 0\.\.[[:digit:]]+ +.*.s:40: Error: [Rr]otating register index must be a non-negative constant +.*.s:41: Error: [Rr]otating register index must be a non-negative constant +.*.s:42: Error: [Rr]otating register index must be a non-negative constant +.*.s:44: Error: [Ii]ndirect register index must be a general register +.*.s:45: Error: [Ii]ndirect register index must be a general register +.*.s:46: Error: [Ii]ndirect register index must be a general register +.*.s:47: Error: [Ii]ndirect register index must be a general register +.*.s:51: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:52: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:53: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:54: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:55: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:56: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:58: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:59: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:60: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:61: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:62: Error: [Ii]ndex can only be applied to rotating or indirect registers +.*.s:63: Error: [Ii]ndex can only be applied to rotating or indirect registers --- /home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/index.s 1970-01-01 01:00:00.000000000 +0100 +++ 2005-10-20/gas/testsuite/gas/ia64/index.s 2005-10-20 17:16:18.000000000 +0200 @@ -0,0 +1,63 @@ +z == zero +zero == r0 + +.text +_start: + ld8 r2 = [ar.lc] + ld8 r3 = [1] + ld8 r4 = [-1] + ld8 r5 = [xyz] + ld8 r6 = [zero] + ld8 r7 = [z] + + mov r2 = cpuid[ar.lc] + mov r3 = cpuid[1] + mov r4 = cpuid[-1] + mov r5 = cpuid[xyz] + mov r6 = cpuid[zero] + mov r7 = cpuid[z] + + mov r2 = b0[ar.lc] + mov r3 = b0[1] + mov r4 = b0[-1] + mov r5 = b0[xyz] + mov r6 = b0[zero] + mov r7 = b0[z] + + mov r2 = xyz[ar.lc] + mov r3 = xyz[1] + mov r4 = xyz[-1] + mov r5 = xyz[xyz] + mov r6 = xyz[zero] + mov r7 = xyz[z] + +.regstk 0, 8, 0, 8 +.rotr reg[8] + + mov r2 = reg[ar.lc] + mov r3 = reg[1] + mov r4 = reg[-1] + mov r5 = reg[xyz] + mov r6 = reg[zero] + mov r7 = reg[z] + + mov r2 = cpuid[ar.lc] + mov r3 = cpuid[1] + mov r4 = cpuid[-1] + mov r5 = cpuid[xyz] + mov r6 = cpuid[zero] + mov r7 = cpuid[z] + + mov r2 = b0[ar.lc] + mov r3 = b0[1] + mov r4 = b0[-1] + mov r5 = b0[xyz] + mov r6 = b0[zero] + mov r7 = b0[z] + + mov r2 = xyz[ar.lc] + mov r3 = xyz[1] + mov r4 = xyz[-1] + mov r5 = xyz[xyz] + mov r6 = xyz[zero] + mov r7 = xyz[z] --- /home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/rotX.l 1970-01-01 01:00:00.000000000 +0100 +++ 2005-10-20/gas/testsuite/gas/ia64/rotX.l 2005-10-21 08:39:19.000000000 +0200 @@ -0,0 +1,5 @@ +.*: Assembler messages: +.*.s:[[:digit:]]+: Error: [Nn]umber of elements must be positive +.*.s:[[:digit:]]+: Error: [Nn]umber of elements must be positive +.*.s:[[:digit:]]+: Error: [Bb]ad or irreducible absolute expression +#pass --- /home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/rotX.s 1970-01-01 01:00:00.000000000 +0100 +++ 2005-10-20/gas/testsuite/gas/ia64/rotX.s 2005-10-20 17:50:26.000000000 +0200 @@ -0,0 +1,4 @@ +.regstk 0, 8, 0, 8 +.rotr a[8], b[-8] +.rotp c[8], d[0] +.rotf e[8], f[x] --- /home/jbeulich/src/binutils/mainline/2005-10-20/include/opcode/ia64.h 2005-03-04 15:52:17.000000000 +0100 +++ 2005-10-20/include/opcode/ia64.h 2005-10-21 10:50:20.367138642 +0200 @@ -75,13 +75,15 @@ enum ia64_opnd IA64_OPND_R3, /* third register # */ IA64_OPND_R3_2, /* third register # (limited to gr0-gr3) */ + /* memory operands: */ + IA64_OPND_MR3, /* memory at addr of third register # */ + /* indirect operands: */ IA64_OPND_CPUID_R3, /* cpuid[reg] */ IA64_OPND_DBR_R3, /* dbr[reg] */ IA64_OPND_DTR_R3, /* dtr[reg] */ IA64_OPND_ITR_R3, /* itr[reg] */ IA64_OPND_IBR_R3, /* ibr[reg] */ - IA64_OPND_MR3, /* memory at addr of third register # */ IA64_OPND_MSR_R3, /* msr[reg] */ IA64_OPND_PKR_R3, /* pkr[reg] */ IA64_OPND_PMC_R3, /* pmc[reg] */
Attachment:
binutils-mainline-ia64-index-cleanup.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |