[llvm] BPF: Emit an error for illegal LD_imm64 insn when LLVM_ENABLE_ASSERTI… (PR #74035)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 05:52:45 PST 2023


eddyz87 wrote:

Also I'm not sure if simply asserting is good in this context. I think a better approach is to:
- create a custom visitor for `MCExpr` values that collects unsupported expressions (using `MCStreamer::visitUsedExpr()` from `lib/MC/MCStreamer.cpp` as an example, there are only 5 different kinds of expressions);
- call this visitor in `Match_Success` branch of `BPFAsmParser::MatchAndEmitInstruction()` and report unsupported expressions using `MCAsmParserExtension::Error` function to get user friendly output.

https://github.com/llvm/llvm-project/pull/74035


More information about the llvm-commits mailing list