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)
180 dasm_State *D = Dst_REF; in dasm_put() local
181 dasm_ActList p = D->actionlist + start; in dasm_put()
182 dasm_Section *sec = D->section; in dasm_put()
207 n = (ins & 255); CK(n < D->maxsection, RANGE_SEC); in dasm_put()
208 D->section = &D->sections[n]; goto stop; in dasm_put()
213 n = (ins & 2047) - 10; pl = D->lglabels + n; in dasm_put()
220 pl = D->pclabels + n; CKPL(pc, PC); in dasm_put()
233 pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel; in dasm_put()
235 pl = D->pclabels + n; CKPL(pc, PC); in dasm_put()
238 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos; in dasm_put()
280 dasm_State *D = Dst_REF; in dasm_link() local
286 if (D->status != DASM_S_OK) return D->status; in dasm_link()
289 for (pc = 0; pc*sizeof(int) < D->pcsize; pc++) in dasm_link()
290 if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc; in dasm_link()
296 for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) { in dasm_link()
297 int n = D->lglabels[idx]; in dasm_link()
299 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; } in dasm_link()
304 for (secnum = 0; secnum < D->maxsection; secnum++) { in dasm_link()
305 dasm_Section *sec = D->sections + secnum; in dasm_link()
311 dasm_ActList p = D->actionlist + b[pos++]; in dasm_link()
331 D->codesize = ofs; /* Total size of all code sections */ in dasm_link()
338 do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
346 dasm_State *D = Dst_REF; in dasm_encode() local
352 for (secnum = 0; secnum < D->maxsection; secnum++) { in dasm_encode()
353 dasm_Section *sec = D->sections + secnum; in dasm_encode()
358 dasm_ActList p = D->actionlist + *b++; in dasm_encode()
376 n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) - 4; in dasm_encode()
394 ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); in dasm_encode()
420 if (base + D->codesize != (char *)cp) /* Check for phase errors. */ in dasm_encode()
429 dasm_State *D = Dst_REF; in dasm_getpclabel() local
430 if (pc*sizeof(int) < D->pcsize) { in dasm_getpclabel()
431 int pos = D->pclabels[pc]; in dasm_getpclabel()
432 if (pos < 0) return *DASM_POS2PTR(D, -pos); in dasm_getpclabel()
442 dasm_State *D = Dst_REF; in dasm_checkstep() local
443 if (D->status == DASM_S_OK) { in dasm_checkstep()
446 if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; } in dasm_checkstep()
447 D->lglabels[i] = 0; in dasm_checkstep()
450 if (D->status == DASM_S_OK && secmatch >= 0 && in dasm_checkstep()
451 D->section != &D->sections[secmatch]) in dasm_checkstep()
452 D->status = DASM_S_MATCH_SEC|(D->section-D->sections); in dasm_checkstep()
453 return D->status; in dasm_checkstep()