Commit Graph

602 Commits

Author SHA1 Message Date
nickysn
c24446c037 * copy all wasm parameters to the local stack, so that their address can be taken
git-svn-id: branches/wasm@47947 -
2021-01-02 06:36:20 +00:00
nickysn
40e4dadcdf - removed wrong comment from tcpuparamanager.create_paraloc_info_intern
git-svn-id: branches/wasm@47946 -
2021-01-02 06:23:41 +00:00
nickysn
c470e851ba + generic implementation of thlcgwasm.a_loadaddr_ref_reg that should handle all possible combinations of base, index
and scalefactor

git-svn-id: branches/wasm@47945 -
2021-01-02 06:08:38 +00:00
nickysn
e4f4f25c44 + handle any base and no index in the second if case in thlcgwasm.a_loadaddr_ref_reg
git-svn-id: branches/wasm@47944 -
2021-01-02 05:52:19 +00:00
nickysn
2084fede95 + handle all constant address (regardless of whether they are relative to a symbol or not) in thlcgwasm.a_loadaddr_ref_reg
git-svn-id: branches/wasm@47943 -
2021-01-02 05:48:40 +00:00
nickysn
ded9afb787 + check and generate an internal error if you attempt to take the address of a reference that exists in the local
stack in thlcgwasm.a_loadaddr_ref_reg

git-svn-id: branches/wasm@47942 -
2021-01-02 05:44:19 +00:00
nickysn
a1f5b57070 + also check for ref.index and ref.symbol in the NR_LOCAL_FRAME_POINTER_REG base case in thlcgwasm.a_loadaddr_ref_reg
git-svn-id: branches/wasm@47941 -
2021-01-02 05:40:17 +00:00
nickysn
46bf123fcd + also ensure that ref.base and ref.index are not set for symbols in thlcgwasm.a_loadaddr_ref_reg
git-svn-id: branches/wasm@47940 -
2021-01-02 05:35:31 +00:00
nickysn
15387514b4 * changed the formatting in thlcgwasm.a_loadaddr_ref_reg to fit the style of the other compiler code
git-svn-id: branches/wasm@47939 -
2021-01-02 05:30:22 +00:00
nickysn
88d42344db - removed comment thlcgwasm.a_loadaddr_ref_reg that is not true for wasm
git-svn-id: branches/wasm@47938 -
2021-01-02 05:25:32 +00:00
nickysn
acb13602ea * fixed getting the address of local variables
git-svn-id: branches/wasm@47929 -
2020-12-31 18:36:45 +00:00
nickysn
31bc357c1b * fixed internal error 2019083002 with e.g. inc(local)
git-svn-id: branches/wasm@47927 -
2020-12-31 18:23:49 +00:00
nickysn
46a09bd8e4 * fixed thlcgwasm.a_load_ref_ref for NR_EVAL_STACK_BASE source references
git-svn-id: branches/wasm@47921 -
2020-12-31 08:11:55 +00:00
nickysn
253e64f66b + allocate 'noreuse' locals in allocbasepointer and allocframepointer
git-svn-id: branches/wasm@47898 -
2020-12-30 04:02:43 +00:00
nickysn
158da03691 + introduced TWasmLocal.allocnoreuse
git-svn-id: branches/wasm@47897 -
2020-12-30 03:46:32 +00:00
nickysn
08580ed628 + introduced ttgwasm(tg).allocframepointer and .allocbasepointer
git-svn-id: branches/wasm@47888 -
2020-12-29 06:08:40 +00:00
nickysn
dc151465c5 * replace NR_LOCAL_FRAME_POINTER_REG with tcpuprocdef(current_procinfo.procdef).frame_pointer_ref in tcpuprocinfo.postprocess_code instead of inside the register allocator
git-svn-id: branches/wasm@47887 -
2020-12-29 05:52:36 +00:00
nickysn
4d0909d4d3 * replace NR_LOCAL_FRAME_POINTER_REG with tcpuprocdef(current_procinfo.procdef).frame_pointer_ref in the wasm32 register allocator
git-svn-id: branches/wasm@47884 -
2020-12-29 04:48:03 +00:00
nickysn
4a1c295955 - removed the ttgwasm.getlocal override, so that local variables are allocated on the linear stack
git-svn-id: branches/wasm@47883 -
2020-12-29 03:20:55 +00:00
nickysn
90251d7050 * allocate the base and frame pointer correctly as locals after the previous commit
git-svn-id: branches/wasm@47876 -
2020-12-28 18:44:26 +00:00
nickysn
c3ac9eb559 * only allocate a local for tt_regallocator temps in ttgwasm.gethltemp
git-svn-id: branches/wasm@47875 -
2020-12-28 18:43:50 +00:00
nickysn
f138d66a2a * switch NR_FRAME_POINTER_REG to NR_LOCAL_FRAME_POINTER_REG
git-svn-id: branches/wasm@47874 -
2020-12-28 18:38:43 +00:00
nickysn
170fab85ff + introduced RS_EVAL_STACK_BASE and RS_LOCAL_STACK_POINTER_REG
git-svn-id: branches/wasm@47873 -
2020-12-28 18:32:16 +00:00
nickysn
59c9bff744 * updated first_int/fpu/mm_imreg, so it doesn't clash with the non-imaginary registers
git-svn-id: branches/wasm@47828 -
2020-12-21 00:32:36 +00:00
nickysn
40eb696d8e + defined RS_LOCAL_FRAME_POINTER_REG
git-svn-id: branches/wasm@47827 -
2020-12-21 00:31:24 +00:00
nickysn
4bac65be86 * set the wasm tempgen direction in the parent constructor, together with the other targets
git-svn-id: branches/wasm@47801 -
2020-12-17 15:37:08 +00:00
nickysn
2f889f3244 - removed the ttgwasm.alloctemp override, because it does nothing
git-svn-id: branches/wasm@47793 -
2020-12-16 16:16:07 +00:00
nickysn
577e39e57f - removed commented out methods (copied from the jvm code generator) from ttgwasm
git-svn-id: branches/wasm@47792 -
2020-12-16 16:14:36 +00:00
nickysn
a104c3d7a0 - removed ttgwasm.deallocLocalVar, as it is no longer used
git-svn-id: branches/wasm@47791 -
2020-12-16 16:13:06 +00:00
nickysn
58d361049f * some optimizations in TWasmLocalVars.dealloc(index: integer)
git-svn-id: branches/wasm@47790 -
2020-12-16 16:09:10 +00:00
nickysn
949d5e61f8 * several public methods of ttgwasm made private
git-svn-id: branches/wasm@47787 -
2020-12-16 13:33:03 +00:00
nickysn
ae60449699 * funnel all the wasm local var allocation, done by the register allocator, through the temp generator
git-svn-id: branches/wasm@47786 -
2020-12-16 13:26:27 +00:00
nickysn
f572bcf8f3 + introduced the NR_LOCAL_FRAME_POINTER_REG constant (alias for NR_R3)
git-svn-id: branches/wasm@47780 -
2020-12-15 15:08:24 +00:00
nickysn
bfb13fb848 - get rid of treference.islocal. Instead, use checks whether treference.base
is equal to NR_LOCAL_STACK_POINTER_REG

git-svn-id: branches/wasm@47779 -
2020-12-14 23:27:27 +00:00
nickysn
fd690e8ba1 * use NR_LOCAL_STACK_POINTER_REG in ttgwasm.localVarToRef
git-svn-id: branches/wasm@47777 -
2020-12-14 23:07:17 +00:00
nickysn
ce8439fb36 + introduced NR_LOCAL_STACK_POINTER_REG
git-svn-id: branches/wasm@47776 -
2020-12-14 23:06:55 +00:00
nickysn
91e9558f5b * synchronized with trunk
git-svn-id: branches/wasm@47766 -
2020-12-12 23:20:33 +00:00
nickysn
2b8ab731c8 * also raise internal errors in trgcpu.do_all_register_allocation for unexpected subregister types
git-svn-id: branches/wasm@47718 -
2020-12-08 08:06:17 +00:00
nickysn
1a6f6f6054 * raise an internal error for unexpected subregister types in rgcpu.registertobasictype
git-svn-id: branches/wasm@47717 -
2020-12-08 07:26:08 +00:00
nickysn
12aa8f0f1f + added another wasm fake register to represent local variable on the linear stack
git-svn-id: branches/wasm@47270 -
2020-11-01 17:06:29 +00:00
nickysn
762fdf593e + added comment, documenting the purpose of the STACK_POINTER_SYM constant
git-svn-id: branches/wasm@47252 -
2020-10-29 16:14:03 +00:00
nickysn
2c56514135 - removed thlcgwasm.a_load_const_stack_intern - it comes from the JVM code
generator and serves no purpose in WebAssembly

git-svn-id: branches/wasm@47195 -
2020-10-25 13:17:54 +00:00
nickysn
c0bbe6d8c0 * 64-bit constants take a single stack slot in WebAssembly. Don't incstack a
second time for 64-bit consts in thlcgwasm.a_load_const_stack

git-svn-id: branches/wasm@47194 -
2020-10-25 12:37:51 +00:00
nickysn
da87a9e48d + write proctype of procedures in other units as well
git-svn-id: branches/wasm@47184 -
2020-10-24 20:23:51 +00:00
nickysn
99482051a8 * write the unsupported parameter type in thlcgwam.g_procdef, when compiler is compiled with EXTDEBUG
git-svn-id: branches/wasm@47183 -
2020-10-24 20:04:40 +00:00
nickysn
fbe9e975e5 + support dup in some more cases in thlcgwasm.prepare_stack_for_ref
git-svn-id: branches/wasm@47181 -
2020-10-24 18:52:31 +00:00
nickysn
d2a4e3b441 - removed debug writeln from thlcgwasm.prepare_stack_for_ref
git-svn-id: branches/wasm@47180 -
2020-10-24 18:48:07 +00:00
nickysn
3c3a8ce111 * fixed bug in thlcgwasm.a_cmp_const_ref_label
git-svn-id: branches/wasm@47179 -
2020-10-24 18:47:29 +00:00
nickysn
c46f308749 + support dup for symbols in prepare_stack_for_ref
git-svn-id: branches/wasm@47178 -
2020-10-24 18:41:01 +00:00
nickysn
64b2d8ef85 * wasm base and index reference access fixes
git-svn-id: branches/wasm@47177 -
2020-10-24 17:28:43 +00:00
nickysn
d15e9717e3 * treference parameter of prepare_stack_for_ref changed to var
git-svn-id: branches/wasm@47176 -
2020-10-24 17:12:48 +00:00
nickysn
0bb255709f * formatting
git-svn-id: branches/wasm@47175 -
2020-10-24 16:51:48 +00:00
nickysn
1d8c5edbcc + write references with registers for debugging purposes (to support asm output with -sr) in the LLVM-MC asm writer
git-svn-id: branches/wasm@47173 -
2020-10-24 15:41:41 +00:00
nickysn
9972d0e7d9 + internal error in thlcgwasm.prepare_stack_for_ref for symbol with registers
git-svn-id: branches/wasm@47170 -
2020-10-24 14:53:46 +00:00
nickysn
5128c07e68 * fixed writing to global variables
git-svn-id: branches/wasm@47169 -
2020-10-24 14:10:04 +00:00
nickysn
8211bcbd4c * fixed getting the address of a global variable
git-svn-id: branches/wasm@47168 -
2020-10-24 12:24:15 +00:00
nickysn
bbe5e3d0e7 - removed spurious load of global symbols in thlcgwasm.prepare_stack_for_ref
git-svn-id: branches/wasm@47167 -
2020-10-24 12:09:02 +00:00
nickysn
19519eb3d2 + support global references with offset in the LLVM-MC asm writer
git-svn-id: branches/wasm@47166 -
2020-10-24 12:03:55 +00:00
nickysn
8494283925 * fixed load/store LLVM-MC asm output for global variables
git-svn-id: branches/wasm@47165 -
2020-10-24 11:56:20 +00:00
nickysn
da5c9a978e + write procdef for imports
git-svn-id: branches/wasm@47001 -
2020-09-29 00:16:10 +00:00
nickysn
fe4f041436 * procdef directive code generation moved to a separate method
git-svn-id: branches/wasm@47000 -
2020-09-29 00:11:11 +00:00
nickysn
8fee0f6130 + partial implementation of imports
git-svn-id: branches/wasm@46999 -
2020-09-29 00:05:14 +00:00
nickysn
0a5655955c + declare the stack pointer global type
git-svn-id: branches/wasm@46997 -
2020-09-28 23:23:42 +00:00
nickysn
e5b0d9cf32 * __stack_top renamed __stack_pointer (which seems to follow the C ABI correctly)
git-svn-id: branches/wasm@46996 -
2020-09-28 23:20:33 +00:00
nickysn
5ee6e9d593 * declare end_function as an instruction, instead of a directive
git-svn-id: branches/wasm@46849 -
2020-09-11 16:25:44 +00:00
nickysn
5c27030faf * emit sec_fpc as sec_data, because custom section names aren't supported
git-svn-id: branches/wasm@46848 -
2020-09-11 16:19:32 +00:00
nickysn
e1b6f0bd85 + introduced end_block, end_if, end_loop
git-svn-id: branches/wasm@46842 -
2020-09-11 15:20:00 +00:00
nickysn
c69dce34c4 + add a .text section directive before each procedure
git-svn-id: branches/wasm@46840 -
2020-09-11 15:05:45 +00:00
nickysn
fc96ad5afd + write the end_function directive
git-svn-id: branches/wasm@46838 -
2020-09-11 14:47:27 +00:00
nickysn
4a5e2dbd23 * refactored the handling of the frame pointer and base pointer to use local temps instead
git-svn-id: branches/wasm@46837 -
2020-09-11 14:35:51 +00:00
nickysn
9f4f432fc6 + introduced the STACK_POINTER_SYM constant
git-svn-id: branches/wasm@46800 -
2020-09-08 08:41:58 +00:00
nickysn
76f269811f + introduced constants FRAME_POINTER_SYM and BASE_POINTER_SYM
git-svn-id: branches/wasm@46799 -
2020-09-08 08:32:10 +00:00
nickysn
35e83d5524 * group tai_local directives, so that they are output as a single directive with comma separated types
git-svn-id: branches/wasm@46714 -
2020-08-26 23:36:28 +00:00
nickysn
b3a4f160bc + insert tai_locals as a continuous block, next to each other
git-svn-id: branches/wasm@46713 -
2020-08-26 23:19:11 +00:00
nickysn
76f1b8cf60 + generate the .functype directive for the llvm-mc wasm assembler
git-svn-id: branches/wasm@46711 -
2020-08-26 23:00:25 +00:00
nickysn
f95d35340c + first attempt at writing the .local WASM directive
git-svn-id: branches/wasm@46709 -
2020-08-26 21:07:11 +00:00
nickysn
e3da45de37 * fixed the global.get, global.set, local.set, local.get and local.tee instructions in the llvm-mc instruction writer
git-svn-id: branches/wasm@46701 -
2020-08-26 17:14:43 +00:00
nickysn
0e3754e24d * copied the gas_op2str table, because it will require changes from the wat2wasm table
git-svn-id: branches/wasm@46700 -
2020-08-26 17:11:01 +00:00
nickysn
5157ea0524 * llvm-mc instruction writing, copied from the wat2wasm writer
git-svn-id: branches/wasm@46699 -
2020-08-26 17:09:36 +00:00
nickysn
2d39ddf85e + write the global procedures/functions in the llvm-mc assembler writer
git-svn-id: branches/wasm@46698 -
2020-08-26 16:58:17 +00:00
nickysn
0c366b33fd + added TWASM32InstrWriter (not yet implemented)
git-svn-id: branches/wasm@46671 -
2020-08-23 17:18:08 +00:00
nickysn
aea75c7caf - removed commented out class name
git-svn-id: branches/wasm@46669 -
2020-08-23 17:02:33 +00:00
nickysn
539fde196d * rebase the llvm-mc asm writer on the GAS assembler writer - seems to be pretty
close in syntax

git-svn-id: branches/wasm@46668 -
2020-08-23 17:01:55 +00:00
nickysn
bd72084939 * changed op2strtype to have a large enough string to hold the instruction and
use that type for wasm_op2str in itcpuwasm

git-svn-id: branches/wasm@46667 -
2020-08-23 16:37:20 +00:00
nickysn
5f33623bb6 * changed JVM reference in comment to WebAssembly
git-svn-id: branches/wasm@46666 -
2020-08-23 16:31:59 +00:00
nickysn
faf8ac4d2e * commented out the actual ait_symbol asm output in the LLVM-MC asm writer, because it produces errors
git-svn-id: branches/wasm@46525 -
2020-08-20 21:15:57 +00:00
nickysn
bccdf2a22a + also log ait_symbol_end in the LLVM-MC asm writer
git-svn-id: branches/wasm@46524 -
2020-08-20 21:02:06 +00:00
nickysn
c3b971e0dd + log the properties of ait_symbol for debugging purposes in the LLVM-MC asm writer
git-svn-id: branches/wasm@46523 -
2020-08-20 20:48:11 +00:00
nickysn
05235a1066 * synchronized with trunk
git-svn-id: branches/wasm@46500 -
2020-08-19 21:23:36 +00:00
nickysn
0eb518955f + a very early and incomplete implementation of WriteTree for LLVM-MC
git-svn-id: branches/wasm@46498 -
2020-08-19 16:42:52 +00:00
nickysn
77dea11cdd + override and implement WriteAsmList
git-svn-id: branches/wasm@46497 -
2020-08-19 16:25:17 +00:00
nickysn
6a89e2c1fa + register a LLVM-MC assembler writer (not implemented yet)
git-svn-id: branches/wasm@46496 -
2020-08-19 16:18:55 +00:00
nickysn
f04c43f58c + created unit (empty for now) for the llvm-mc assembler writer
git-svn-id: branches/wasm@46495 -
2020-08-19 16:02:45 +00:00
nickysn
fa9eef27ef * use upper case asm id strings, so assemblers can be selected via the -A option
git-svn-id: branches/wasm@46267 -
2020-08-05 16:31:44 +00:00
nickysn
fe01706f1f + added WASI as the list of supported systems for the WASM asm writers
git-svn-id: branches/wasm@46265 -
2020-08-05 16:15:57 +00:00
nickysn
914ee08cd9 * renamed as_wasm_binaryen -> as_wasm32_binaryen and as_wasm_wabt -> as_wasm32_wabt
git-svn-id: branches/wasm@46264 -
2020-08-05 16:13:56 +00:00
nickysn
080aa1ca74 + added target WASI, clone of the 'WASM' target
git-svn-id: branches/wasm@46259 -
2020-08-05 15:36:08 +00:00
nickysn
4a74238a0d * system_wasm_wasm32 renamed system_wasm32_wasm
git-svn-id: branches/wasm@46256 -
2020-08-05 14:32:41 +00:00
nickysn
a00110f6e0 * cpu_wasm renamed cpu_wasm32
git-svn-id: branches/wasm@46255 -
2020-08-05 14:28:24 +00:00
nickysn
208473b859 * cputypestr renamed wasm32
git-svn-id: branches/wasm@46254 -
2020-08-05 14:27:33 +00:00
nickysn
6dd85ad80c * wasm cpu string renamed wasm32
git-svn-id: branches/wasm@46253 -
2020-08-05 14:25:39 +00:00
nickysn
c9ee72b05a * the compiler/wasm directory renamed compiler/wasm32
git-svn-id: branches/wasm@46251 -
2020-08-05 14:19:18 +00:00