comparison lwasm/pseudo.c @ 348:11a95c6414b4

Added third func to instab to split resolve and emit logic
author lost@starbug
date Sat, 27 Mar 2010 22:15:07 -0600
parents 1649bc7bda5a
children dcd2978a7d18
comparison
equal deleted inserted replaced
347:1649bc7bda5a 348:11a95c6414b4
22 #include <config.h> 22 #include <config.h>
23 23
24 #include "lwasm.h" 24 #include "lwasm.h"
25 #include "instab.h" 25 #include "instab.h"
26 26
27 // for no-op pseudos
28 PARSEFUNC(pseudo_parse_noop)
29 {
30 }
31
32 RESOLVEFUNC(pseudo_resolve_noop)
33 {
34 }
35
36 // for "end" 27 // for "end"
37 PARSEFUNC(pseudo_parse_end) 28 PARSEFUNC(pseudo_parse_end)
38 { 29 {
39 lw_expr_t addr; 30 lw_expr_t addr;
40 31
53 addr = lw_expr_build(lw_expr_type_int, 0); 44 addr = lw_expr_build(lw_expr_type_int, 0);
54 } 45 }
55 lwasm_save_expr(l, 0, addr); 46 lwasm_save_expr(l, 0, addr);
56 } 47 }
57 48
58 RESOLVEFUNC(pseudo_resolve_end) 49 EMITFUNC(pseudo_emit_end)
59 { 50 {
60 lw_expr_t addr; 51 lw_expr_t addr;
61 52
62 addr = lwasm_fetch_expr(l, 0); 53 addr = lwasm_fetch_expr(l, 0);
63 54
89 } 80 }
90 81
91 l -> len = i; 82 l -> len = i;
92 } 83 }
93 84
94 RESOLVEFUNC(pseudo_resolve_fcb) 85 EMITFUNC(pseudo_emit_fcb)
95 { 86 {
96 int i; 87 int i;
97 lw_expr_t e; 88 lw_expr_t e;
98 int v; 89 int v;
99 90
122 } 113 }
123 114
124 l -> len = i * 2; 115 l -> len = i * 2;
125 } 116 }
126 117
127 RESOLVEFUNC(pseudo_resolve_fdb) 118 EMITFUNC(pseudo_emit_fdb)
128 { 119 {
129 int i; 120 int i;
130 lw_expr_t e; 121 lw_expr_t e;
131 int v; 122 int v;
132 123
155 } 146 }
156 147
157 l -> len = i * 4; 148 l -> len = i * 4;
158 } 149 }
159 150
160 RESOLVEFUNC(pseudo_resolve_fqb) 151 EMITFUNC(pseudo_emit_fqb)
161 { 152 {
162 int i; 153 int i;
163 lw_expr_t e; 154 lw_expr_t e;
164 int v; 155 int v;
165 156