aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-06-07 12:10:47 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2021-07-09 14:07:25 -0700
commit9647a6f719ee4b1c23eea7aef368c1dcd5317949 (patch)
treef15372eabce245d57476b25aae81af6714bf9ea3 /llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
parent0562d17864831f25e10691ee1bb60d7abd4dcf97 (diff)
downloadllvm-9647a6f719ee4b1c23eea7aef368c1dcd5317949.zip
llvm-9647a6f719ee4b1c23eea7aef368c1dcd5317949.tar.gz
llvm-9647a6f719ee4b1c23eea7aef368c1dcd5317949.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfoImpls.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfoImpls.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp b/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
index 16d2488..9c3b319 100644
--- a/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
@@ -25,6 +25,7 @@ using namespace llvm;
void MachineModuleInfoMachO::anchor() {}
void MachineModuleInfoELF::anchor() {}
void MachineModuleInfoCOFF::anchor() {}
+void MachineModuleInfoWasm::anchor() {}
using PairTy = std::pair<MCSymbol *, MachineModuleInfoImpl::StubValueTy>;
static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS) {