History

added 'A' asm constraint

bellard committed 23 years ago

Commit 4149fed1 parent 6e197e31 file · +30 −5Browse files

Unified · Split

i386-asm.c+30−5
@@ -710,27 +710,30 @@ static inline int constraint_priority(const char *str) · 709 unmodified lines
710710 break;
711711 str++;
712712 switch(c) {
713+ case 'A':
714+ pr = 0;
715+ break;
713716 case 'a':
714717 case 'b':
715718 case 'c':
716719 case 'd':
717720 case 'S':
718721 case 'D':
719− pr = 0;
720− break;
721− case 'q':
722722 pr = 1;
723723 break;
724− case 'r':
724+ case 'q':
725725 pr = 2;
726726 break;
727+ case 'r':
728+ pr = 3;
729+ break;
727730 case 'N':
728731 case 'M':
729732 case 'I':
730733 case 'i':
731734 case 'm':
732735 case 'g':
733− pr = 3;
736+ pr = 4;
734737 break;
735738 default:
736739 error("unknown constraint '%c'", c);
@@ -817,6 +820,15 @@ static void asm_compute_constraints(uint8_t *regs_allocated, · 80 unmodified lines
817820 try_next:
818821 c = *str++;
819822 switch(c) {
823+ case 'A':
824+ /* allocate both eax and edx */
825+ if (regs_allocated[TREG_EAX] || regs_allocated[TREG_EDX])
826+ goto try_next;
827+ op->is_llong = 1;
828+ op->reg = TREG_EAX;
829+ regs_allocated[TREG_EAX] = 1;
830+ regs_allocated[TREG_EDX] = 1;
831+ break;
820832 case 'a':
821833 reg = TREG_EAX;
822834 goto alloc_reg;
@@ -854,6 +866,7 @@ static void asm_compute_constraints(uint8_t *regs_allocated, · 31 unmodified lines
854866 goto try_next;
855867 reg_found:
856868 /* now we can reload in the register */
869+ op->is_llong = 0;
857870 op->reg = reg;
858871 regs_allocated[reg] = 1;
859872 break;
@@ -1027,6 +1040,12 @@ static void asm_gen_code(ASMOperand *operands, int nb_operands, · 167 unmodified lines
10271040 op = &operands[i];
10281041 if (op->reg >= 0) {
10291042 load(op->reg, op->vt);
1043+ if (op->is_llong) {
1044+ SValue sv;
1045+ sv = *op->vt;
1046+ sv.c.ul += 4;
1047+ load(TREG_EDX, &sv);
1048+ }
10301049 }
10311050 }
10321051 /* generate load code for output memory references */
@@ -1045,6 +1064,12 @@ static void asm_gen_code(ASMOperand *operands, int nb_operands, · 12 unmodified lines
10451064 op = &operands[i];
10461065 if (op->reg >= 0 && ((op->vt->r & VT_VALMASK) != VT_LLOCAL)) {
10471066 store(op->reg, op->vt);
1067+ if (op->is_llong) {
1068+ SValue sv;
1069+ sv = *op->vt;
1070+ sv.c.ul += 4;
1071+ store(TREG_EDX, &sv);
1072+ }
10481073 }
10491074 }
10501075 /* generate reg restore code */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t