[PATCH] D14717: [Assembler] Make fatal assembler errors non-fatal

Jim Grosbach via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 13:43:55 PST 2015


grosbach added a subscriber: grosbach.
grosbach added a comment.

This is totally reasonable.

Longer term, I'd love to see a more holistic plan for diagnostics in the assembler. Right now they're in broadly two categories "(mostly) syntax related problems we detect directly in the parser" and "everything else, thrown in wherever we would otherwise have crashed." The former case could use a bit of cleanup but is generally fine. The latter is completely haphazard, however.

I'd love to have a moral equivalent to a Sema pass or two that we could run over the collected state of things for the assembler. I'm (totally hand waving) thinking one right after parsing that just wants a more global view of the whole file so it can find things like unresolved forward references to local labels. Then one after layout which can find things like out of range fix-ups, "there's not legal relocations for this thing," et. al..

With something like that, the post-parser diagnostics all move into there. All the places we current do error checking in the AsmBackend and related can now assume good input, as they've had the input validated earlier, so the diagnostics there become assert() calls. The Sema passes get used by the assembler, but not the compiler (unless there's inline assembler, in which case we still need them). That way we split out the currently merged functionality of catching compiler backend bugs and catching user error in assembly files. By doing so, we get both a cleaner layering and a faster compiler backend as it will be able to do a bit less work.


Repository:
  rL LLVM

http://reviews.llvm.org/D14717





More information about the llvm-commits mailing list