Lines Matching refs:ai

54    struct asm_instruction *ai = &instructions[num_instructions++];
56 ai->tok = tok;
57 return ai;
144 struct asm_instruction *ai = &instructions[i];
152 assert(ai->is_literal);
153 ai->literal &= ~0xffff;
154 ai->literal |= num_instructions;
157 if (ai->is_literal) {
158 write(outfd, &ai->literal, 4);
162 switch (ai->tok) {
185 if (ai->has_immed) {
187 assert(ai->tok != T_OP_MSB);
188 if (ai->xmov) {
193 opc = tok2alu(ai->tok);
194 instr.alui.dst = ai->dst;
195 instr.alui.src = ai->src1;
196 instr.alui.uimm = ai->immed;
199 instr.alu.dst = ai->dst;
200 instr.alu.src1 = ai->src1;
201 instr.alu.src2 = ai->src2;
202 instr.alu.xmov = ai->xmov;
203 instr.alu.alu = tok2alu(ai->tok);
210 if ((ai->has_immed || ai->label) && ai->xmov) {
214 if (ai->has_immed) {
216 instr.movi.dst = ai->dst;
217 instr.movi.uimm = ai->immed;
218 instr.movi.shift = ai->shift;
219 } else if (ai->label) {
225 instr.movi.dst = ai->dst;
226 instr.movi.uimm = resolve_label(ai->label);
227 instr.movi.shift = ai->shift;
231 instr.alu.dst = ai->dst;
233 instr.alu.src2 = ai->src1;
234 instr.alu.xmov = ai->xmov;
243 if (ai->tok == T_OP_CWRITE) {
245 } else if (ai->tok == T_OP_CREAD) {
247 } else if (ai->tok == T_OP_STORE) {
249 } else if (ai->tok == T_OP_LOAD) {
255 if (ai->tok == T_OP_CWRITE) {
257 } else if (ai->tok == T_OP_CREAD) {
259 } else if (ai->tok == T_OP_STORE || ai->tok == T_OP_LOAD) {
266 instr.control.src1 = ai->src1;
267 instr.control.src2 = ai->src2;
268 instr.control.flags = ai->bit;
269 instr.control.uimm = ai->immed;
273 if (ai->has_immed) {
274 opc = (ai->tok == T_OP_BRNE) ? OPC_BRNEI : OPC_BREQI;
275 instr.br.bit_or_imm = ai->immed;
277 opc = (ai->tok == T_OP_BRNE) ? OPC_BRNEB : OPC_BREQB;
278 instr.br.bit_or_imm = ai->bit;
280 instr.br.src = ai->src1;
281 instr.br.ioff = resolve_label(ai->label) - i;
292 instr.call.uoff = resolve_label(ai->label);
296 instr.call.uoff = resolve_label(ai->label);
300 if (resolve_label(ai->label) != i + 3) {
302 ai->label);
305 if (ai->src1 != 0x2) {
315 instr.br.ioff = resolve_label(ai->label) - i;
324 afuc_set_opc(&instr, opc, ai->rep);