This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add support for data sections in the assembler.
ClosedPublic

Authored by aardappel on Feb 25 2019, 5:43 PM.

Details

Summary

This is quite minimal so far, introduce them with .section,
fill them with .int8 or .asciz, end with .size

Diff Detail

Event Timeline

aardappel created this revision.Feb 25 2019, 5:43 PM

Note to reviewers: this is a pretty minimal set of directives so far, if you have any opinions which others are vital to add in this patch, let me know :)

Great!

lib/MC/MCParser/WasmAsmParser.cpp
139

How about .data ?

lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
667

What will happen now if we hit this case? Should we assert/unreachable?

test/MC/WebAssembly/basic-assembly.s
87

Indentation inconsistent with above

173

To these end up as two different fragments with in the data section? Just curious how this is preserved through mc.

test/MC/WebAssembly/data-section.s
3

Command is wrong. We do check!

12

Consistent indention with directives below?

aardappel marked 8 inline comments as done.Feb 28 2019, 2:35 PM
aardappel added inline comments.
lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
667

Forgot I needed to fill that in. Now errors if not in a data section.

test/MC/WebAssembly/basic-assembly.s
173

I'm not entirely sure, as I am still foggy on how fragments work. It does end up adjacent in the binary, which is what matters?

aardappel updated this revision to Diff 188823.Feb 28 2019, 5:33 PM
aardappel marked 2 inline comments as done.

Addressed code review.

sbc100 accepted this revision.Feb 28 2019, 5:36 PM
This revision is now accepted and ready to land.Feb 28 2019, 5:36 PM
This revision was automatically updated to reflect the committed changes.