Lines Matching refs:D
50 #define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos)) argument
88 dasm_State *D; in dasm_init() local
93 D = Dst_REF; in dasm_init()
94 D->psize = psz; in dasm_init()
95 D->lglabels = NULL; in dasm_init()
96 D->lgsize = 0; in dasm_init()
97 D->pclabels = NULL; in dasm_init()
98 D->pcsize = 0; in dasm_init()
99 D->globals = NULL; in dasm_init()
100 D->maxsection = maxsection; in dasm_init()
102 D->sections[i].buf = NULL; /* Need this for pass3. */ in dasm_init()
103 D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i); in dasm_init()
104 D->sections[i].bsize = 0; in dasm_init()
105 D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */ in dasm_init()
112 dasm_State *D = Dst_REF; in dasm_free() local
114 for (i = 0; i < D->maxsection; i++) in dasm_free()
115 if (D->sections[i].buf) in dasm_free()
116 DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize); in dasm_free()
117 if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize); in dasm_free()
118 if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize); in dasm_free()
119 DASM_M_FREE(Dst, D, D->psize); in dasm_free()
125 dasm_State *D = Dst_REF; in dasm_setupglobal() local
126 D->globals = gl - 10; /* Negative bias to compensate for locals. */ in dasm_setupglobal()
127 DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); in dasm_setupglobal()
133 dasm_State *D = Dst_REF; in dasm_growpc() local
134 size_t osz = D->pcsize; in dasm_growpc()
135 DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int)); in dasm_growpc()
136 memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz); in dasm_growpc()
142 dasm_State *D = Dst_REF; in dasm_setup() local
144 D->actionlist = (dasm_ActList)actionlist; in dasm_setup()
145 D->status = DASM_S_OK; in dasm_setup()
146 D->section = &D->sections[0]; in dasm_setup()
147 memset((void *)D->lglabels, 0, D->lgsize); in dasm_setup()
148 if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize); in dasm_setup()
149 for (i = 0; i < D->maxsection; i++) { in dasm_setup()
150 D->sections[i].pos = DASM_SEC2POS(i); in dasm_setup()
151 D->sections[i].ofs = 0; in dasm_setup()
159 D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
161 do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
162 D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
220 dasm_State *D = Dst_REF; in dasm_put() local
221 dasm_ActList p = D->actionlist + start; in dasm_put()
222 dasm_Section *sec = D->section; in dasm_put()
247 n = (ins & 255); CK(n < D->maxsection, RANGE_SEC); in dasm_put()
248 D->section = &D->sections[n]; goto stop; in dasm_put()
253 n = (ins & 2047) - 10; pl = D->lglabels + n; in dasm_put()
260 pl = D->pclabels + n; CKPL(pc, PC); in dasm_put()
273 pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel; in dasm_put()
275 pl = D->pclabels + n; CKPL(pc, PC); in dasm_put()
278 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos; in dasm_put()
335 dasm_State *D = Dst_REF; in dasm_link() local
341 if (D->status != DASM_S_OK) return D->status; in dasm_link()
344 for (pc = 0; pc*sizeof(int) < D->pcsize; pc++) in dasm_link()
345 if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc; in dasm_link()
351 for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) { in dasm_link()
352 int n = D->lglabels[idx]; in dasm_link()
354 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; } in dasm_link()
359 for (secnum = 0; secnum < D->maxsection; secnum++) { in dasm_link()
360 dasm_Section *sec = D->sections + secnum; in dasm_link()
366 dasm_ActList p = D->actionlist + b[pos++]; in dasm_link()
387 D->codesize = ofs; /* Total size of all code sections */ in dasm_link()
394 do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
402 dasm_State *D = Dst_REF; in dasm_encode() local
408 for (secnum = 0; secnum < D->maxsection; secnum++) { in dasm_encode()
409 dasm_Section *sec = D->sections + secnum; in dasm_encode()
414 dasm_ActList p = D->actionlist + *b++; in dasm_encode()
432 n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) + 4; in dasm_encode()
451 ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); in dasm_encode()
482 if (base + D->codesize != (char *)cp) /* Check for phase errors. */ in dasm_encode()
491 dasm_State *D = Dst_REF; in dasm_getpclabel() local
492 if (pc*sizeof(int) < D->pcsize) { in dasm_getpclabel()
493 int pos = D->pclabels[pc]; in dasm_getpclabel()
494 if (pos < 0) return *DASM_POS2PTR(D, -pos); in dasm_getpclabel()
504 dasm_State *D = Dst_REF; in dasm_checkstep() local
505 if (D->status == DASM_S_OK) { in dasm_checkstep()
508 if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; } in dasm_checkstep()
509 D->lglabels[i] = 0; in dasm_checkstep()
512 if (D->status == DASM_S_OK && secmatch >= 0 && in dasm_checkstep()
513 D->section != &D->sections[secmatch]) in dasm_checkstep()
514 D->status = DASM_S_MATCH_SEC|(D->section-D->sections); in dasm_checkstep()
515 return D->status; in dasm_checkstep()