comparison lwasm/pass4.c @ 142:697bc543368c

Implement distinction between . and * for OS9 modules
author lost@l-w.ca
date Fri, 19 Aug 2011 23:55:40 -0600
parents 2c24602be78f
children 02804b7c051c
comparison
equal deleted inserted replaced
141:11ebce0183a5 142:697bc543368c
54 // find an unresolved instruction 54 // find an unresolved instruction
55 for ( ; sl && sl -> len != -1; sl = sl -> next) 55 for ( ; sl && sl -> len != -1; sl = sl -> next)
56 { 56 {
57 as -> cl = sl; 57 as -> cl = sl;
58 lwasm_reduce_expr(as, sl -> addr); 58 lwasm_reduce_expr(as, sl -> addr);
59 59 lwasm_reduce_expr(as, sl -> daddr);
60
60 // simplify each expression 61 // simplify each expression
61 for (le = sl -> exprs; le; le = le -> next) 62 for (le = sl -> exprs; le; le = le -> next)
62 lwasm_reduce_expr(as, le -> expr); 63 lwasm_reduce_expr(as, le -> expr);
63 } 64 }
64 65
65 // simplify address 66 // simplify address
66 as -> cl = sl; 67 as -> cl = sl;
67 lwasm_reduce_expr(as, sl -> addr); 68 lwasm_reduce_expr(as, sl -> addr);
68 69 lwasm_reduce_expr(as, sl -> daddr);
70
69 // simplify each expression 71 // simplify each expression
70 for (le = sl -> exprs; le; le = le -> next) 72 for (le = sl -> exprs; le; le = le -> next)
71 lwasm_reduce_expr(as, le -> expr); 73 lwasm_reduce_expr(as, le -> expr);
72 74
73 75
91 { 93 {
92 as -> cl = cl; 94 as -> cl = cl;
93 95
94 // simplify address 96 // simplify address
95 lwasm_reduce_expr(as, cl -> addr); 97 lwasm_reduce_expr(as, cl -> addr);
96 98 lwasm_reduce_expr(as, cl -> daddr);
97 // simplify each expression 99 // simplify each expression
98 for (le = cl -> exprs; le; le = le -> next) 100 for (le = cl -> exprs; le; le = le -> next)
99 lwasm_reduce_expr(as, le -> expr); 101 lwasm_reduce_expr(as, le -> expr);
100 102
101 if (cl -> len == -1) 103 if (cl -> len == -1)
103 // try resolving the instruction length 105 // try resolving the instruction length
104 // but don't force resolution 106 // but don't force resolution
105 if (cl -> insn >= 0 && instab[cl -> insn].resolve) 107 if (cl -> insn >= 0 && instab[cl -> insn].resolve)
106 { 108 {
107 (instab[cl -> insn].resolve)(as, cl, 0); 109 (instab[cl -> insn].resolve)(as, cl, 0);
108 if (cl -> len != -1) 110 if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0)
111 {
112 if (cl -> len == 0)
113 cl -> len = cl -> dlen;
114 else
115 cl -> dlen = cl -> len;
116 }
117 if (cl -> len != -1 && cl -> dlen != -1)
109 { 118 {
110 rc++; 119 rc++;
111 cnt--; 120 cnt--;
112 if (cnt == 0) 121 if (cnt == 0)
113 return; 122 return;