llvm-project/llvm/test/MC/WebAssembly
Wouter van Oortmerssen 9647a6f719 [WebAssembly] Added initial type checker to MC Assembler
This to protect against non-sensical instruction sequences being assembled,
which would either cause asserts/crashes further down, or a Wasm module being output that doesn't validate.

Unlike a validator, this type checker is able to give type-errors as part of the parsing process, which makes the assembler much friendlier to be used by humans writing manual input.

Because the MC system is single pass (instructions aren't even stored in MC format, they are directly output) the type checker has to be single pass as well, which means that from now on .globaltype and .functype decls must come before their use. An extra pass is added to Codegen to collect information for this purpose, since AsmPrinter is normally single pass / streaming as well, and would otherwise generate this information on the fly.

A `-no-type-check` flag was added to llvm-mc (and any other tools that take asm input) that surpresses type errors, as a quick escape hatch for tests that were not intended to be type correct.

This is a first version of the type checker that ignores control flow, i.e. it checks that types are correct along the linear path, but not the branch path. This will still catch most errors. Branch checking could be added in the future.

Differential Revision: https://reviews.llvm.org/D104945
2021-07-09 14:07:25 -07:00
..
alias-offset.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
alias.s
annotations.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
array-fill.ll
assembler-binary.ll [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
atomics-encodings.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
bad-fixup-expr.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
basic-assembly-errors.s [WebAssembly] Update InstPrinter and AsmParser for new EH instructions 2021-02-06 08:54:56 -08:00
basic-assembly.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
blockaddress.ll
bss.ll
bulk-memory-encodings.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
call-indirect-relocs.s [WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC. 2021-03-24 09:10:11 +01:00
comdat-sections.ll [WebAssembly] Support COMDAT sections in assembly syntax 2020-12-10 16:43:59 -08:00
comdat-sections.s [WebAssembly] Support COMDAT sections in assembly syntax 2020-12-10 16:43:59 -08:00
comdat.ll [WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC. 2021-03-24 09:10:11 +01:00
compile-twice.ll
custom-code-section.ll
custom-sections.ll [MC][WebAssembly] Only emit indirect function table import if needed 2020-11-25 08:38:43 -08:00
data-section-combined.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
data-section.s [WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC. 2021-03-24 09:10:11 +01:00
data-symbol-in-text-section.ll
debug-byval-struct.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
debug-info.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
debug-info64.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
debug-localvar.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
dwarfdump.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
dwarfdump64.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
explicit-sections.ll
export-name.s
external-data.ll Reland "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32 types." (https://reviews.llvm.org/D90930). 2020-11-18 13:08:46 +03:00
external-func-address.ll [MC][WebAssembly] Only emit indirect function table import if needed 2020-11-25 08:38:43 -08:00
externref.s
file-headers.ll
func-address.ll
function-alias.ll [WebAssembly] call_indirect issues table number relocs 2021-03-01 16:49:00 +01:00
function-sections.ll
global-ctor-dtor.ll [WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC. 2021-03-24 09:10:11 +01:00
globals.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
import-module.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
libcall.ll Reland "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32 types." (https://reviews.llvm.org/D90930). 2020-11-18 13:08:46 +03:00
lit.local.cfg
missing-features.s
no-dead-strip.ll
null-output.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
objdump.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
offset.ll
reference-types.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
reloc-code.ll [WebAssembly] call_indirect issues table number relocs 2021-03-01 16:49:00 +01:00
reloc-data.ll
reloc-pic.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
reloc-pic64.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
reloc-relative.ll [WebAssembly] Add new relocation for location relative data 2021-03-08 11:34:10 -08:00
section-flags-changed.s Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
section-symbol.s [WebAssembly] Fix assert in lookup of section symbols 2021-02-18 11:50:14 -08:00
sections.ll
simd-encodings.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
stack-ptr.ll
tables.s [WebAssembly][MC] Record limit constraints for table sizes 2021-03-24 09:44:22 +01:00
tag-section-decoding.ll [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
tag-section.ll [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
tail-call-encodings.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
tls.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
type-index.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
types.ll [WebAssembly] Remove unimplemented-simd target feature 2021-03-18 10:23:12 -07:00
unnamed-data.ll Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
visibility.ll
wasm64.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
weak-alias.s [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
weak.s