This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] tablegen: distinguish float/int immediate operands.
ClosedPublic

Authored by aardappel on Jul 1 2019, 2:36 PM.

Details

Summary

Before, they were one category of operands which could cause
crashes in non-sensical combinations, e.g. "f32.const symbol".
Now these are forced to be an error.

Diff Detail

Event Timeline

aardappel created this revision.Jul 1 2019, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2019, 2:36 PM

Wow, that was simple.
Is there a "bad" asm parser test we can add now to test this?

We don't have "error" tests for any other illegal operand possibilities, but sure, added a test.

aardappel updated this revision to Diff 207415.Jul 1 2019, 2:55 PM

added test

dschuff accepted this revision.Jul 1 2019, 2:58 PM
This revision is now accepted and ready to land.Jul 1 2019, 2:58 PM
aheejin added inline comments.Jul 1 2019, 5:03 PM
lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
92

Isn't this supposed to include both integer and float immediates? (It is an inherited one, so)

aardappel marked an inline comment as done.Jul 1 2019, 5:27 PM
aardappel added inline comments.
lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
92

That really depends on how you define it. "Imm" is a class name driven by the tablegen def, that we happened to use for both int and float, which was problematic, since our emitter assumed they were separate. With this change I force them to be separate in both the def and the code.

aheejin added inline comments.Jul 2 2019, 9:19 PM
lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
92

I see, thanks.

This revision was automatically updated to reflect the committed changes.