--- tools/gen-sel-parser.y.~1.14.~	2004-06-16 05:02:08.000000000 -0400
+++ tools/gen-sel-parser.y	2004-12-03 14:42:23.000000000 -0500
@@ -136,15 +136,13 @@
  */
 static void gensel_declare_regs(gensel_clause_t clauses, int options)
 {
-	int have_reg1 = 0;
-	int have_reg2 = 0;
-	int have_reg3 = 0;
-	int have_imm = 0;
+	int have_reg[8] = { 0 };
+	int have_imm[8] = { 0 };
 	int have_local = 0;
 	int index;
 	while(clauses != 0)
 	{
-		for(index = 0; clauses->pattern[index] != GENSEL_PATT_END; ++index)
+		for(index = 0; index < 8 && clauses->pattern[index] != GENSEL_PATT_END; ++index)
 		{
 			switch(clauses->pattern[index])
 			{
@@ -152,12 +150,7 @@
 				case GENSEL_PATT_LREG:
 				case GENSEL_PATT_FREG:
 				{
-					if(index == 0)
-						have_reg1 = 1;
-					else if(index == 1)
-						have_reg2 = 1;
-					else
-						have_reg3 = 1;
+					have_reg[index] = 1;
 				}
 				break;
 
@@ -169,7 +162,7 @@
 				case GENSEL_PATT_IMMS16:
 				case GENSEL_PATT_IMMU16:
 				{
-					have_imm = 1;
+					have_imm[index] = 1;
 				}
 				break;
 
@@ -182,21 +175,12 @@
 		}
 		clauses = clauses->next;
 	}
-	if(have_reg1)
-	{
-		printf("\tint reg;\n");
-	}
-	if(have_reg2 && (options & GENSEL_OPT_STACK) == 0)
-	{
-		printf("\tint reg2;\n");
-	}
-	if(have_reg3 && (options & GENSEL_OPT_STACK) == 0)
+	for(index = 0; index < 8; index++)
 	{
-		printf("\tint reg3;\n");
-	}
-	if(have_imm)
-	{
-		printf("\tjit_nint imm_value;\n");
+		if(have_reg[index] && (index == 0 || (options & GENSEL_OPT_STACK) == 0))
+			printf("\tint reg%d;\n", index+1);
+		if(have_imm[index])
+			printf("\tint imm_value%d;\n", index+1);
 	}
 	if(have_local)
 	{
@@ -229,12 +213,8 @@
 				case GENSEL_PATT_LREG:
 				case GENSEL_PATT_FREG:
 				{
-					if(index == 0)
-						printf("_jit_reg_info[reg].cpu_reg");
-					else if(index == 1)
-						printf("_jit_reg_info[reg2].cpu_reg");
-					else
-						printf("_jit_reg_info[reg3].cpu_reg");
+					printf("_jit_reg_info[reg%d].cpu_reg",
+					       index+1);
 				}
 				break;
 
@@ -245,7 +225,7 @@
 				case GENSEL_PATT_IMMS16:
 				case GENSEL_PATT_IMMU16:
 				{
-					printf("imm_value");
+					printf("imm_value%d", index+1);
 				}
 				break;
 
@@ -266,12 +246,8 @@
 				case GENSEL_PATT_LREG:
 				case GENSEL_PATT_FREG:
 				{
-					if(index == 0)
-						printf("_jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg");
-					else if(index == 1)
-						printf("_jit_reg_info[_jit_reg_info[reg2].other_reg].cpu_reg");
-					else
-						printf("_jit_reg_info[_jit_reg_info[reg3].other_reg].cpu_reg");
+				    printf("_jit_reg_info[_jit_reg_info[%d].other_reg].cpu_reg",
+					   index+1);
 				}
 				break;
 			}
@@ -337,7 +313,6 @@
 	const char *arg2;
 	const char *arg3;
 	const char *arg;
-	const char *reg;
 	const char *flag1;
 	const char *flag2;
 	const char *flag3;
@@ -414,7 +389,7 @@
 		}
 		if(!clause)
 		{
-			printf("\treg = _jit_regs_load_value(gen, %s, %d, ",
+			printf("\treg1 = _jit_regs_load_value(gen, %s, %d, ",
 				   arg1, destroy1);
 			printf("(insn->flags & (JIT_INSN_%s_NEXT_USE | "
 								   "JIT_INSN_%s_LIVE)));\n", flag1, flag1);
@@ -524,21 +499,18 @@
 				if(index == 0)
 				{
 					arg = arg1;
-					reg = "reg";
 					flag = flag1;
 					destroy = destroy1;
 				}
 				else if(index == 1)
 				{
 					arg = arg2;
-					reg = "reg2";
 					flag = flag2;
 					destroy = destroy2;
 				}
 				else
 				{
 					arg = arg3;
-					reg = "reg3";
 					flag = flag3;
 					destroy = destroy3;
 				}
@@ -548,8 +520,8 @@
 					case GENSEL_PATT_LREG:
 					case GENSEL_PATT_FREG:
 					{
-						printf("\t\t%s = _jit_regs_load_value(gen, %s, %d, ",
-							   reg, arg, destroy);
+						printf("\t\treg%d = _jit_regs_load_value(gen, %s, %d, ",
+							   index+1, arg, destroy);
 						printf("(insn->flags & (JIT_INSN_%s_NEXT_USE | "
 											   "JIT_INSN_%s_LIVE)));\n",
 							   flag, flag);
@@ -564,7 +536,7 @@
 					case GENSEL_PATT_IMMS16:
 					case GENSEL_PATT_IMMU16:
 					{
-						printf("\t\timm_value = %s->address;\n", arg);
+						printf("\t\timm_value%d = %s->address;\n", index+1, arg);
 					}
 					break;
 	
@@ -589,7 +561,7 @@
 			}
 			if((options & GENSEL_OPT_TERNARY) != 0)
 			{
-				printf("\t\treg = _jit_regs_load_to_top_three\n");
+				printf("\t\treg1 = _jit_regs_load_to_top_three\n");
 				printf("\t\t\t(gen, insn->dest, insn->value1, insn->value2,\n");
 				printf("\t\t\t\t(insn->flags & (JIT_INSN_DEST_NEXT_USE | "
 											   "JIT_INSN_DEST_LIVE)),\n");
@@ -603,7 +575,7 @@
 			else if((options & (GENSEL_OPT_BINARY |
 								GENSEL_OPT_BINARY_BRANCH)) != 0)
 			{
-				printf("\t\treg = _jit_regs_load_to_top_two\n");
+				printf("\t\treg1 = _jit_regs_load_to_top_two\n");
 				printf("\t\t\t(gen, insn->value1, insn->value2,\n");
 				printf("\t\t\t\t(insn->flags & (JIT_INSN_VALUE1_NEXT_USE | "
 											   "JIT_INSN_VALUE1_LIVE)),\n");
@@ -616,7 +588,7 @@
 								GENSEL_OPT_UNARY_BRANCH |
 								GENSEL_OPT_UNARY_NOTE)) != 0)
 			{
-				printf("\t\treg = _jit_regs_load_to_top\n");
+				printf("\t\treg1 = _jit_regs_load_to_top\n");
 				printf("\t\t\t(gen, insn->value1,\n");
 				printf("\t\t\t\t(insn->flags & (JIT_INSN_VALUE1_NEXT_USE | "
 											   "JIT_INSN_VALUE1_LIVE)), "
@@ -804,16 +776,16 @@
 				{
 					printf("\tif((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0)\n");
 					printf("\t{\n");
-					printf("\t\t_jit_regs_set_value(gen, reg, insn->dest, 0);\n");
+					printf("\t\t_jit_regs_set_value(gen, reg1, insn->dest, 0);\n");
 					printf("\t}\n");
 					printf("\telse\n");
 					printf("\t{\n");
-					printf("\t\t_jit_gen_spill_reg(gen, reg, -1, insn->dest);\n");
+					printf("\t\t_jit_gen_spill_reg(gen, reg1, -1, insn->dest);\n");
 					printf("\t\tif(insn->dest->has_global_register)\n");
 					printf("\t\t\tinsn->dest->in_global_register = 1;\n");
 					printf("\t\telse\n");
 					printf("\t\t\tinsn->dest->in_frame = 1;\n");
-					printf("\t\t_jit_regs_free_reg(gen, reg, 1);\n");
+					printf("\t\t_jit_regs_free_reg(gen, reg1, 1);\n");
 					printf("\t}\n");
 				}
 				printf("}\nbreak;\n\n");
--- jit/jit-rules-x86.sel.~1.32.~	2004-11-20 19:05:07.000000000 -0500
+++ jit/jit-rules-x86.sel	2004-12-03 14:37:07.000000000 -0500
@@ -1712,19 +1726,19 @@
 
 JIT_OP_RETURN_FLOAT32: unary_note, stack, only
 	[freg] -> {
-		_jit_regs_free_reg(gen, reg, 1);
+		_jit_regs_free_reg(gen, reg1, 1);
 		inst = jump_to_epilog(gen, inst, block);
 	}
 
 JIT_OP_RETURN_FLOAT64: unary_note, stack, only
 	[freg] -> {
-		_jit_regs_free_reg(gen, reg, 1);
+		_jit_regs_free_reg(gen, reg1, 1);
 		inst = jump_to_epilog(gen, inst, block);
 	}
 
 JIT_OP_RETURN_NFLOAT: unary_note, stack, only
 	[freg] -> {
-		_jit_regs_free_reg(gen, reg, 1);
+		_jit_regs_free_reg(gen, reg1, 1);
 		inst = jump_to_epilog(gen, inst, block);
 	}
 
@@ -2115,7 +2129,7 @@
 	[reg] -> {
 		x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float32));
 		x86_fst_membase(inst, X86_ESP, 0, 0, 1);
-		_jit_regs_free_reg(gen, reg, 1);
+		_jit_regs_free_reg(gen, reg1, 1);
 		gen->stack_changed = 1;
 	}
 
@@ -2134,7 +2148,7 @@
 	[reg] -> {
 		x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float64));
 		x86_fst_membase(inst, X86_ESP, 0, 1, 1);
-		_jit_regs_free_reg(gen, reg, 1);
+		_jit_regs_free_reg(gen, reg1, 1);
 		gen->stack_changed = 1;
 	}
 
@@ -2169,7 +2183,7 @@
 			x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float64));
 			x86_fst_membase(inst, X86_ESP, 0, 1, 1);
 		}
-		_jit_regs_free_reg(gen, reg, 1);
+		_jit_regs_free_reg(gen, reg1, 1);
 		gen->stack_changed = 1;
 	}
 
@@ -2851,16 +2891,37 @@
 	}
 
 JIT_OP_STORE_ELEMENT_BYTE: ternary
+	[imm, reg, reg] -> {
+		inst = mov_memindex_reg_byte(inst, X86_NOBASEREG, $1, $2, $3);
+	}
 	[reg, reg, reg] -> {
 		inst = mov_memindex_reg_byte(inst, $1, 0, $2, $3);
 	}
 
 JIT_OP_STORE_ELEMENT_SHORT: ternary
+	[imm, reg, imm] -> {
+		x86_mov_memindex_imm(inst, X86_NOBASEREG, $1, $2, 1, $3, 2);
+	}
+	[imm, reg, reg] -> {
+		x86_mov_memindex_reg(inst, X86_NOBASEREG, $1, $2, 1, $3, 2);
+	}
+	[reg, reg, imm] -> {
+		x86_mov_memindex_imm(inst, $1, 0, $2, 1, $3, 2);
+	}
 	[reg, reg, reg] -> {
 		x86_mov_memindex_reg(inst, $1, 0, $2, 1, $3, 2);
 	}
 
 JIT_OP_STORE_ELEMENT_INT: ternary
+	[imm, reg, imm] -> {
+		x86_mov_memindex_imm(inst, X86_NOBASEREG, $1, $2, 2, $3, 4);
+	}
+	[imm, reg, reg] -> {
+		x86_mov_memindex_reg(inst, X86_NOBASEREG, $1, $2, 2, $3, 4);
+	}
+	[reg, reg, imm] -> {
+		x86_mov_memindex_imm(inst, $1, 0, $2, 2, $3, 4);
+	}
 	[reg, reg, reg] -> {
 		x86_mov_memindex_reg(inst, $1, 0, $2, 2, $3, 4);
 	}
