mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
Move all the RAA code out of nasmlib
The RAA code doesn't have to be in nasmlib; it is only used by nasm itself, and is better handled in a separate module.
This commit is contained in:
parent
35d620d2fd
commit
fcb8909749
17
Makefile.in
17
Makefile.in
@ -58,7 +58,7 @@ X = @EXEEXT@
|
||||
.1.man:
|
||||
$(NROFF) -man $< > $@
|
||||
|
||||
NASM = nasm.$(O) nasmlib.$(O) saa.$(O) \
|
||||
NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) \
|
||||
float.$(O) insnsa.$(O) insnsb.$(O) \
|
||||
assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
|
||||
outform.$(O) output/outbin.$(O) \
|
||||
@ -261,7 +261,7 @@ listing.$(O): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
|
||||
macros.$(O): macros.c compiler.h config.h insnsi.h tables.h
|
||||
nasm.$(O): nasm.c assemble.h compiler.h config.h eval.h float.h insns.h \
|
||||
insnsi.h labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h \
|
||||
preproc.h regs.h stdscan.h tokens.h version.h
|
||||
preproc.h raa.h regs.h saa.h stdscan.h tokens.h version.h
|
||||
nasmlib.$(O): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
|
||||
nasmlib.h regs.h tokens.h version.h
|
||||
ndisasm.$(O): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
|
||||
@ -269,23 +269,23 @@ ndisasm.$(O): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
|
||||
outform.$(O): outform.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h version.h
|
||||
output/outaout.$(O): output/outaout.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
nasmlib.h outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outas86.$(O): output/outas86.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h version.h
|
||||
nasmlib.h outform.h raa.h regs.h saa.h version.h
|
||||
output/outbin.$(O): output/outbin.c compiler.h config.h eval.h insnsi.h \
|
||||
labels.h nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
output/outcoff.$(O): output/outcoff.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h version.h
|
||||
nasmlib.h outform.h raa.h regs.h saa.h version.h
|
||||
output/outdbg.$(O): output/outdbg.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h version.h
|
||||
output/outelf32.$(O): output/outelf32.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
nasmlib.h outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outelf64.$(O): output/outelf64.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
nasmlib.h outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outieee.$(O): output/outieee.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h version.h
|
||||
output/outmacho.$(O): output/outmacho.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h version.h
|
||||
nasmlib.h outform.h raa.h regs.h saa.h version.h
|
||||
output/outobj.$(O): output/outobj.c compiler.h config.h insnsi.h nasm.h \
|
||||
nasmlib.h outform.h regs.h stdscan.h version.h
|
||||
output/outrdf.$(O): output/outrdf.c compiler.h config.h insnsi.h nasm.h \
|
||||
@ -300,6 +300,7 @@ preproc.$(O): preproc.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
|
||||
nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h \
|
||||
version.h
|
||||
quote.$(O): quote.c compiler.h config.h nasmlib.h quote.h
|
||||
raa.$(O): raa.c compiler.h config.h nasmlib.h raa.h
|
||||
regdis.$(O): regdis.c regdis.h regs.h
|
||||
regflags.$(O): regflags.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
|
||||
regs.h tables.h version.h
|
||||
|
@ -32,7 +32,7 @@ X = .exe
|
||||
.c.obj:
|
||||
$(CC) /c $(ALL_CFLAGS) /Fo$@ $<
|
||||
|
||||
NASM = nasm.$(O) nasmlib.$(O) saa.$(O) \
|
||||
NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) \
|
||||
float.$(O) insnsa.$(O) insnsb.$(O) \
|
||||
assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
|
||||
outform.$(O) output/outbin.$(O) \
|
||||
@ -207,7 +207,7 @@ listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
|
||||
macros.$(O): macros.c compiler.h insnsi.h tables.h
|
||||
nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
|
||||
labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
|
||||
regs.h stdscan.h tokens.h version.h
|
||||
raa.h regs.h saa.h stdscan.h tokens.h version.h
|
||||
nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
|
||||
tokens.h version.h
|
||||
ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
|
||||
@ -215,23 +215,23 @@ ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
|
||||
outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h version.h
|
||||
output/outaout.$(O): output/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outas86.$(O): output/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output/outbin.$(O): output/outbin.c compiler.h eval.h insnsi.h labels.h \
|
||||
nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
output/outcoff.$(O): output/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output/outdbg.$(O): output/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h version.h
|
||||
output/outelf32.$(O): output/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outelf64.$(O): output/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outieee.$(O): output/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h version.h
|
||||
output/outmacho.$(O): output/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output/outobj.$(O): output/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h stdscan.h version.h
|
||||
output/outrdf.$(O): output/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
@ -244,6 +244,7 @@ pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
|
||||
preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
|
||||
pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
|
||||
quote.$(O): quote.c compiler.h nasmlib.h quote.h
|
||||
raa.$(O): raa.c compiler.h nasmlib.h raa.h
|
||||
regdis.$(O): regdis.c regdis.h regs.h
|
||||
regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
|
||||
tables.h version.h
|
||||
|
@ -28,7 +28,7 @@ LDFLAGS+=-s
|
||||
|
||||
O = o
|
||||
|
||||
NASM = nasm.$(O) nasmlib.$(O) saa.$(O) \
|
||||
NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) \
|
||||
float.$(O) insnsa.$(O) insnsb.$(O) \
|
||||
assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
|
||||
outform.$(O) output/outbin.$(O) \
|
||||
@ -147,7 +147,7 @@ listing.o: listing.c compiler.h config.h insnsi.h listing.h nasm.h nasmlib.h \
|
||||
macros.o: macros.c compiler.h config.h insnsi.h tables.h
|
||||
nasm.o: nasm.c assemble.h compiler.h config.h eval.h float.h insns.h \
|
||||
insnsi.h labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h \
|
||||
preproc.h regs.h stdscan.h tokens.h version.h
|
||||
preproc.h raa.h regs.h saa.h stdscan.h tokens.h version.h
|
||||
nasmlib.o: nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
|
||||
regs.h tokens.h version.h
|
||||
ndisasm.o: ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
|
||||
@ -155,23 +155,23 @@ ndisasm.o: ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
|
||||
outform.o: outform.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h version.h
|
||||
outaout.o: outaout.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h saa.h stdscan.h version.h
|
||||
raa.h regs.h saa.h stdscan.h version.h
|
||||
outas86.o: outas86.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h saa.h version.h
|
||||
raa.h regs.h saa.h version.h
|
||||
outbin.o: outbin.c compiler.h config.h eval.h insnsi.h labels.h nasm.h \
|
||||
nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
outcoff.o: outcoff.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h saa.h version.h
|
||||
raa.h regs.h saa.h version.h
|
||||
outdbg.o: outdbg.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h version.h
|
||||
outelf32.o: outelf32.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
outelf64.o: outelf64.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
outieee.o: outieee.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h version.h
|
||||
outmacho.o: outmacho.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
outobj.o: outobj.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h stdscan.h version.h
|
||||
outrdf.o: outrdf.c compiler.h config.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
@ -184,6 +184,7 @@ pptok.o: pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h preproc.h
|
||||
preproc.o: preproc.c compiler.h config.h hashtbl.h insnsi.h nasm.h nasmlib.h \
|
||||
pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
|
||||
quote.o: quote.c compiler.h config.h nasmlib.h quote.h
|
||||
raa.o: raa.c compiler.h config.h nasmlib.h raa.h
|
||||
regdis.o: regdis.c regdis.h regs.h
|
||||
regflags.o: regflags.c compiler.h config.h insnsi.h nasm.h nasmlib.h regs.h \
|
||||
tables.h version.h
|
||||
|
@ -44,7 +44,7 @@ X = .exe
|
||||
$(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
|
||||
|
||||
# Note: wcl386 is broken if forward slashes are used as path separators.
|
||||
NASM = nasm.$(O) nasmlib.$(O) saa.$(O) &
|
||||
NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) &
|
||||
float.$(O) insnsa.$(O) insnsb.$(O) &
|
||||
assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) &
|
||||
outform.$(O) output\outbin.$(O) &
|
||||
@ -236,7 +236,7 @@ listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h &
|
||||
macros.$(O): macros.c compiler.h insnsi.h tables.h
|
||||
nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h &
|
||||
labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h &
|
||||
regs.h stdscan.h tokens.h version.h
|
||||
raa.h regs.h saa.h stdscan.h tokens.h version.h
|
||||
nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
|
||||
tokens.h version.h
|
||||
ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h &
|
||||
@ -244,23 +244,23 @@ ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h &
|
||||
outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h &
|
||||
regs.h version.h
|
||||
output\outaout.$(O): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output\outas86.$(O): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output\outbin.$(O): output\outbin.c compiler.h eval.h insnsi.h labels.h &
|
||||
nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
output\outcoff.$(O): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output\outdbg.$(O): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h version.h
|
||||
output\outelf32.$(O): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output\outelf64.$(O): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output\outieee.$(O): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h version.h
|
||||
output\outmacho.$(O): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output\outobj.$(O): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
outform.h regs.h stdscan.h version.h
|
||||
output\outrdf.$(O): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h &
|
||||
@ -273,6 +273,7 @@ pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
|
||||
preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
|
||||
pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
|
||||
quote.$(O): quote.c compiler.h nasmlib.h quote.h
|
||||
raa.$(O): raa.c compiler.h nasmlib.h raa.h
|
||||
regdis.$(O): regdis.c regdis.h regs.h
|
||||
regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h &
|
||||
tables.h version.h
|
||||
|
@ -55,7 +55,7 @@ X = .exe
|
||||
.c.$(O):
|
||||
$(CC) -c $(ALL_CFLAGS) -fo=$@ $<
|
||||
|
||||
NASM = nasm.$(O) nasmlib.$(O) saa.$(O) \
|
||||
NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) \
|
||||
float.$(O) insnsa.$(O) insnsb.$(O) \
|
||||
assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
|
||||
outform.$(O) output/outbin.$(O) \
|
||||
@ -246,7 +246,7 @@ listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
|
||||
macros.$(O): macros.c compiler.h insnsi.h tables.h
|
||||
nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
|
||||
labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
|
||||
regs.h stdscan.h tokens.h version.h
|
||||
raa.h regs.h saa.h stdscan.h tokens.h version.h
|
||||
nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
|
||||
tokens.h version.h
|
||||
ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
|
||||
@ -254,23 +254,23 @@ ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
|
||||
outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
|
||||
regs.h version.h
|
||||
output/outaout.$(O): output/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outas86.$(O): output/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output/outbin.$(O): output/outbin.c compiler.h eval.h insnsi.h labels.h \
|
||||
nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
|
||||
output/outcoff.$(O): output/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output/outdbg.$(O): output/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h version.h
|
||||
output/outelf32.$(O): output/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outelf64.$(O): output/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h stdscan.h version.h
|
||||
outform.h raa.h regs.h saa.h stdscan.h version.h
|
||||
output/outieee.$(O): output/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h version.h
|
||||
output/outmacho.$(O): output/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h saa.h version.h
|
||||
outform.h raa.h regs.h saa.h version.h
|
||||
output/outobj.$(O): output/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
outform.h regs.h stdscan.h version.h
|
||||
output/outrdf.$(O): output/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
|
||||
@ -283,6 +283,7 @@ pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
|
||||
preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
|
||||
pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
|
||||
quote.$(O): quote.c compiler.h nasmlib.h quote.h
|
||||
raa.$(O): raa.c compiler.h nasmlib.h raa.h
|
||||
regdis.$(O): regdis.c regdis.h regs.h
|
||||
regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
|
||||
tables.h version.h
|
||||
|
1
nasm.c
1
nasm.c
@ -20,6 +20,7 @@
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "float.h"
|
||||
#include "stdscan.h"
|
||||
#include "insns.h"
|
||||
|
93
nasmlib.c
93
nasmlib.c
@ -469,99 +469,6 @@ void standard_extension(char *inname, char *outname, char *extension,
|
||||
strcpy(p, extension);
|
||||
}
|
||||
|
||||
#define LEAFSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_LEAF))
|
||||
#define BRANCHSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_BRANCH))
|
||||
|
||||
#define LAYERSHIFT(r) ( (r)->layers==0 ? RAA_BLKSHIFT : RAA_LAYERSHIFT )
|
||||
|
||||
static struct RAA *real_raa_init(int layers)
|
||||
{
|
||||
struct RAA *r;
|
||||
int i;
|
||||
|
||||
if (layers == 0) {
|
||||
r = nasm_zalloc(LEAFSIZ);
|
||||
r->shift = 0;
|
||||
} else {
|
||||
r = nasm_malloc(BRANCHSIZ);
|
||||
r->layers = layers;
|
||||
for (i = 0; i < RAA_LAYERSIZE; i++)
|
||||
r->u.b.data[i] = NULL;
|
||||
r->shift = (RAA_BLKSHIFT-RAA_LAYERSHIFT) + layers*RAA_LAYERSHIFT;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
struct RAA *raa_init(void)
|
||||
{
|
||||
return real_raa_init(0);
|
||||
}
|
||||
|
||||
void raa_free(struct RAA *r)
|
||||
{
|
||||
if (r->layers) {
|
||||
struct RAA **p;
|
||||
for (p = r->u.b.data; p - r->u.b.data < RAA_LAYERSIZE; p++)
|
||||
if (*p)
|
||||
raa_free(*p);
|
||||
}
|
||||
nasm_free(r);
|
||||
}
|
||||
|
||||
int64_t raa_read(struct RAA *r, int32_t posn)
|
||||
{
|
||||
if ((uint32_t)posn >= (UINT32_C(1) << (r->shift + LAYERSHIFT(r))))
|
||||
return 0; /* Return 0 for undefined entries */
|
||||
while (r->layers > 0) {
|
||||
int32_t l = posn >> r->shift;
|
||||
posn &= (UINT32_C(1) << r->shift)-1;
|
||||
r = r->u.b.data[l];
|
||||
if (!r)
|
||||
return 0; /* Return 0 for undefined entries */
|
||||
}
|
||||
return r->u.l.data[posn];
|
||||
}
|
||||
|
||||
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value)
|
||||
{
|
||||
struct RAA *result;
|
||||
|
||||
if (posn < 0)
|
||||
nasm_malloc_error(ERR_PANIC, "negative position in raa_write");
|
||||
|
||||
while ((UINT32_C(1) << (r->shift+LAYERSHIFT(r))) <= (uint32_t)posn) {
|
||||
/*
|
||||
* Must add a layer.
|
||||
*/
|
||||
struct RAA *s;
|
||||
int i;
|
||||
|
||||
s = nasm_malloc(BRANCHSIZ);
|
||||
for (i = 0; i < RAA_LAYERSIZE; i++)
|
||||
s->u.b.data[i] = NULL;
|
||||
s->layers = r->layers + 1;
|
||||
s->shift = LAYERSHIFT(r) + r->shift;
|
||||
s->u.b.data[0] = r;
|
||||
r = s;
|
||||
}
|
||||
|
||||
result = r;
|
||||
|
||||
while (r->layers > 0) {
|
||||
struct RAA **s;
|
||||
int32_t l = posn >> r->shift;
|
||||
posn &= (UINT32_C(1) << r->shift)-1;
|
||||
s = &r->u.b.data[l];
|
||||
if (!*s)
|
||||
*s = real_raa_init(r->layers - 1);
|
||||
r = *s;
|
||||
}
|
||||
|
||||
r->u.l.data[posn] = value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common list of prefix names
|
||||
*/
|
||||
|
50
nasmlib.h
50
nasmlib.h
@ -280,56 +280,6 @@ void fwriteint32_t(uint32_t data, FILE * fp);
|
||||
void fwriteint64_t(uint64_t data, FILE * fp);
|
||||
void fwriteaddr(uint64_t data, int size, FILE * fp);
|
||||
|
||||
/*
|
||||
* Routines to manage a dynamic random access array of int64_ts which
|
||||
* may grow in size to be more than the largest single malloc'able
|
||||
* chunk.
|
||||
*/
|
||||
|
||||
#define RAA_BLKSHIFT 15 /* 2**this many longs allocated at once */
|
||||
#define RAA_BLKSIZE (1 << RAA_BLKSHIFT)
|
||||
#define RAA_LAYERSHIFT 15 /* 2**this many _pointers_ allocated */
|
||||
#define RAA_LAYERSIZE (1 << RAA_LAYERSHIFT)
|
||||
|
||||
typedef struct RAA RAA;
|
||||
typedef union RAA_UNION RAA_UNION;
|
||||
typedef struct RAA_LEAF RAA_LEAF;
|
||||
typedef struct RAA_BRANCH RAA_BRANCH;
|
||||
|
||||
struct RAA {
|
||||
/*
|
||||
* Number of layers below this one to get to the real data. 0
|
||||
* means this structure is a leaf, holding RAA_BLKSIZE real
|
||||
* data items; 1 and above mean it's a branch, holding
|
||||
* RAA_LAYERSIZE pointers to the next level branch or leaf
|
||||
* structures.
|
||||
*/
|
||||
int layers;
|
||||
|
||||
/*
|
||||
* Number of real data items spanned by one position in the
|
||||
* `data' array at this level. This number is 0 trivially, for
|
||||
* a leaf (level 0): for a level 1 branch it should be
|
||||
* RAA_BLKSHIFT, and for a level 2 branch it's
|
||||
* RAA_LAYERSHIFT+RAA_BLKSHIFT.
|
||||
*/
|
||||
int shift;
|
||||
|
||||
union RAA_UNION {
|
||||
struct RAA_LEAF {
|
||||
int64_t data[RAA_BLKSIZE];
|
||||
} l;
|
||||
struct RAA_BRANCH {
|
||||
struct RAA *data[RAA_LAYERSIZE];
|
||||
} b;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct RAA *raa_init(void);
|
||||
void raa_free(struct RAA *);
|
||||
int64_t raa_read(struct RAA *, int32_t);
|
||||
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value);
|
||||
|
||||
/*
|
||||
* Binary search routine. Returns index into `array' of an entry
|
||||
* matching `string', or <0 if no match. `array' is taken to
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "stdscan.h"
|
||||
#include "outform.h"
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "outform.h"
|
||||
|
||||
#ifdef OF_AS86
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "outform.h"
|
||||
|
||||
#if defined(OF_COFF) || defined(OF_WIN32) || defined(OF_WIN64)
|
||||
|
@ -17,9 +17,10 @@
|
||||
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "stdscan.h"
|
||||
#include "outform.h"
|
||||
#include "saa.h"
|
||||
|
||||
#ifdef OF_ELF32
|
||||
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "stdscan.h"
|
||||
#include "outform.h"
|
||||
#include "saa.h"
|
||||
|
||||
/* Definitions in lieu of elf.h */
|
||||
#define SHT_NULL 0 /* Inactive section header */
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "saa.h"
|
||||
#include "raa.h"
|
||||
#include "outform.h"
|
||||
#include "compiler.h"
|
||||
|
||||
|
95
raa.c
Normal file
95
raa.c
Normal file
@ -0,0 +1,95 @@
|
||||
#include "nasmlib.h"
|
||||
#include "raa.h"
|
||||
|
||||
#define LEAFSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_LEAF))
|
||||
#define BRANCHSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_BRANCH))
|
||||
|
||||
#define LAYERSHIFT(r) ( (r)->layers==0 ? RAA_BLKSHIFT : RAA_LAYERSHIFT )
|
||||
|
||||
static struct RAA *real_raa_init(int layers)
|
||||
{
|
||||
struct RAA *r;
|
||||
int i;
|
||||
|
||||
if (layers == 0) {
|
||||
r = nasm_zalloc(LEAFSIZ);
|
||||
r->shift = 0;
|
||||
} else {
|
||||
r = nasm_malloc(BRANCHSIZ);
|
||||
r->layers = layers;
|
||||
for (i = 0; i < RAA_LAYERSIZE; i++)
|
||||
r->u.b.data[i] = NULL;
|
||||
r->shift = (RAA_BLKSHIFT-RAA_LAYERSHIFT) + layers*RAA_LAYERSHIFT;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
struct RAA *raa_init(void)
|
||||
{
|
||||
return real_raa_init(0);
|
||||
}
|
||||
|
||||
void raa_free(struct RAA *r)
|
||||
{
|
||||
if (r->layers) {
|
||||
struct RAA **p;
|
||||
for (p = r->u.b.data; p - r->u.b.data < RAA_LAYERSIZE; p++)
|
||||
if (*p)
|
||||
raa_free(*p);
|
||||
}
|
||||
nasm_free(r);
|
||||
}
|
||||
|
||||
int64_t raa_read(struct RAA *r, int32_t posn)
|
||||
{
|
||||
if ((uint32_t)posn >= (UINT32_C(1) << (r->shift + LAYERSHIFT(r))))
|
||||
return 0; /* Return 0 for undefined entries */
|
||||
while (r->layers > 0) {
|
||||
int32_t l = posn >> r->shift;
|
||||
posn &= (UINT32_C(1) << r->shift)-1;
|
||||
r = r->u.b.data[l];
|
||||
if (!r)
|
||||
return 0; /* Return 0 for undefined entries */
|
||||
}
|
||||
return r->u.l.data[posn];
|
||||
}
|
||||
|
||||
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value)
|
||||
{
|
||||
struct RAA *result;
|
||||
|
||||
if (posn < 0)
|
||||
nasm_malloc_error(ERR_PANIC, "negative position in raa_write");
|
||||
|
||||
while ((UINT32_C(1) << (r->shift+LAYERSHIFT(r))) <= (uint32_t)posn) {
|
||||
/*
|
||||
* Must add a layer.
|
||||
*/
|
||||
struct RAA *s;
|
||||
int i;
|
||||
|
||||
s = nasm_malloc(BRANCHSIZ);
|
||||
for (i = 0; i < RAA_LAYERSIZE; i++)
|
||||
s->u.b.data[i] = NULL;
|
||||
s->layers = r->layers + 1;
|
||||
s->shift = LAYERSHIFT(r) + r->shift;
|
||||
s->u.b.data[0] = r;
|
||||
r = s;
|
||||
}
|
||||
|
||||
result = r;
|
||||
|
||||
while (r->layers > 0) {
|
||||
struct RAA **s;
|
||||
int32_t l = posn >> r->shift;
|
||||
posn &= (UINT32_C(1) << r->shift)-1;
|
||||
s = &r->u.b.data[l];
|
||||
if (!*s)
|
||||
*s = real_raa_init(r->layers - 1);
|
||||
r = *s;
|
||||
}
|
||||
|
||||
r->u.l.data[posn] = value;
|
||||
|
||||
return result;
|
||||
}
|
56
raa.h
Normal file
56
raa.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef NASM_RAA_H
|
||||
#define NASM_RAA_H 1
|
||||
|
||||
#include "compiler.h"
|
||||
|
||||
/*
|
||||
* Routines to manage a dynamic random access array of int64_ts which
|
||||
* may grow in size to be more than the largest single malloc'able
|
||||
* chunk.
|
||||
*/
|
||||
|
||||
#define RAA_BLKSHIFT 15 /* 2**this many longs allocated at once */
|
||||
#define RAA_BLKSIZE (1 << RAA_BLKSHIFT)
|
||||
#define RAA_LAYERSHIFT 15 /* 2**this many _pointers_ allocated */
|
||||
#define RAA_LAYERSIZE (1 << RAA_LAYERSHIFT)
|
||||
|
||||
typedef struct RAA RAA;
|
||||
typedef union RAA_UNION RAA_UNION;
|
||||
typedef struct RAA_LEAF RAA_LEAF;
|
||||
typedef struct RAA_BRANCH RAA_BRANCH;
|
||||
|
||||
struct RAA {
|
||||
/*
|
||||
* Number of layers below this one to get to the real data. 0
|
||||
* means this structure is a leaf, holding RAA_BLKSIZE real
|
||||
* data items; 1 and above mean it's a branch, holding
|
||||
* RAA_LAYERSIZE pointers to the next level branch or leaf
|
||||
* structures.
|
||||
*/
|
||||
int layers;
|
||||
|
||||
/*
|
||||
* Number of real data items spanned by one position in the
|
||||
* `data' array at this level. This number is 0 trivially, for
|
||||
* a leaf (level 0): for a level 1 branch it should be
|
||||
* RAA_BLKSHIFT, and for a level 2 branch it's
|
||||
* RAA_LAYERSHIFT+RAA_BLKSHIFT.
|
||||
*/
|
||||
int shift;
|
||||
|
||||
union RAA_UNION {
|
||||
struct RAA_LEAF {
|
||||
int64_t data[RAA_BLKSIZE];
|
||||
} l;
|
||||
struct RAA_BRANCH {
|
||||
struct RAA *data[RAA_LAYERSIZE];
|
||||
} b;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct RAA *raa_init(void);
|
||||
void raa_free(struct RAA *);
|
||||
int64_t raa_read(struct RAA *, int32_t);
|
||||
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value);
|
||||
|
||||
#endif /* NASM_RAA_H */
|
Loading…
Reference in New Issue
Block a user