================
@@ -470,25 +493,95 @@ class WebAssemblyAsmParser final : public 
MCTargetAsmParser {
     Parser.Lex();
   }
 
-  bool parseSingleFloat(bool IsNegative, OperandVector &Operands) {
+  // Parses a global's initial value, spelled like the matching const
+  // instruction's immediate: `i32.const 42`, `f32.const 0x1p1`.
+  bool parseGlobalInit(wasm::ValType Type,
----------------
kateinoigakukun wrote:

I don't think a dedicated parser for the init expression is a good direction. 
It implements another text instruction parser.

The extended-const proposal adds `i32.add`/`sub`/`mul`, `global.get` etc. with 
a stack discipline, and we already have the instruction parser/matcher for 
function bodies that knows all of these. Can we parse the const expr through 
the normal `parseInstruction` -> `MCInst` path and convert the resulting 
`MCInst`s to a `WasmInitExpr`? Otherwise this will need to grow into a second 
mini assembler.

https://github.com/llvm/llvm-project/pull/212007
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to