/* * is the next assembler directive an non-instruction generation * * this is used to keep marksequencepoint from getting multiple calls * with no intervening instructions, which causes it to work incorrectly */ private bool IsNextNonInsnGen(IAsm a) { IAsm cur = a.getNext(); if (cur == null) { return(true); } int type = cur.getIType(); /* * skip intervening labels */ while (type == IAsm.I_LABEL) { cur = cur.getNext(); type = cur.getIType(); } /* * if next is comment then return true */ if (type == IAsm.I_COMMENT) { return(true); } return(false); }
void NextInsn(int incr) { int ncount = 0; if (iroot == null) { icur = iroot = new IAsm(); } else { ncount = icur.getICount() + incr; /* propogate previous count */ icur.setNext(new IAsm()); icur = icur.getNext(); } icur.setICount(ncount); }
/* * is the next assembler directive an non-instruction generation * * this is used to keep marksequencepoint from getting multiple calls * with no intervening instructions, which causes it to work incorrectly */ private bool IsNextNonInsnGen(IAsm a) { IAsm cur = a.getNext(); if (cur == null) return true; int type = cur.getIType(); /* * skip intervening labels */ while (type == IAsm.I_LABEL) { cur = cur.getNext(); type = cur.getIType(); } /* * if next is comment then return true */ if (type == IAsm.I_COMMENT) return true; return false; }
/* * Emit assembly instructions now * this flushes the istream */ public void LIST() { IAsm a = iroot; IAsm p; Asm x = new Asm(io); while (a != null) { switch (a.getIType()) { case IAsm.I_INSN: x.Insn(a); break; case IAsm.I_LABEL: x.Label(a); break; case IAsm.I_BRANCH: x.Branch(a); break; case IAsm.I_INSN_STORE: x.Store(a); break; case IAsm.I_INSN_LOAD: x.Load(a); break; case IAsm.I_INSN_LOAD_CONST: x.LoadConst(a); break; case IAsm.I_FUNC_BEGIN: x.FuncBegin(a); /* Emit function beginning */ break; case IAsm.I_FUNC_END: x.FuncEnd(); break; case IAsm.I_CALL: x.Call(a); break; case IAsm.I_RET: x.Ret(a); break; case IAsm.I_COMMENT: x.Comment(a); break; case IAsm.I_FIELD: x.FieldDef(a); break; case IAsm.I_LOCALDEF: x.LocalVars(localvars); break; default: io.Abort("Unhandled instruction type " + a.getIType()); break; } p = a; a = a.getNext(); } }