[ms] [llvm-ml] Add initial MASM STRUCT/UNION support
authorEric Astor <epastor@google.com>
Tue, 7 Jul 2020 21:01:10 +0000 (17:01 -0400)
committerEric Astor <epastor@google.com>
Tue, 7 Jul 2020 21:02:10 +0000 (17:02 -0400)
commitbc8e262afe833fce2bff46c73d9e77ed23fd720f
treead2a6bcf78ae0e16bf096f74cf7b2eddc354225b
parent24ed3a9403fa0494275212765026a1bb4169ac76
[ms] [llvm-ml] Add initial MASM STRUCT/UNION support

Summary:
Add support for user-defined types to MasmParser, including initialization and field access.

Known issues:
- Omitted entry initializers (e.g., <,0>) do not work consistently for nested structs/arrays.
- Size checking/inference for values with known types is not yet implemented.
- Some ml64.exe syntaxes for accessing STRUCT fields are not recognized.
  - `[<register>.<struct name>].<field>`
  - `[<register>[<struct name>.<field>]]`
  - `(<struct name> PTR [<register>]).<field>`
  - `[<variable>.<struct name>].<field>`
  - `(<struct name> PTR <variable>).<field>`

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D75306
llvm/include/llvm/MC/MCParser/MCAsmParser.h
llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/test/tools/llvm-ml/struct.test [new file with mode: 0644]
llvm/test/tools/llvm-ml/struct_errors.test [new file with mode: 0644]