Skip to content

Commit bc8e262

Browse files
committed
[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
1 parent 24ed3a9 commit bc8e262

File tree

6 files changed

+1646
-233
lines changed

6 files changed

+1646
-233
lines changed

llvm/include/llvm/MC/MCParser/MCAsmParser.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ class MCAsmParser {
170170

171171
virtual bool isParsingMasm() const { return false; }
172172

173+
virtual bool LookUpFieldOffset(StringRef Base, StringRef Member,
174+
unsigned &Offset) {
175+
return true;
176+
}
177+
173178
/// Parse MS-style inline assembly.
174179
virtual bool parseMSInlineAsm(
175180
void *AsmLoc, std::string &AsmString, unsigned &NumOutputs,

llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class MCTargetAsmParser : public MCAsmParserExtension {
334334

335335
/// SemaCallback - The Sema callback implementation. Must be set when parsing
336336
/// ms-style inline assembly.
337-
MCAsmParserSemaCallback *SemaCallback;
337+
MCAsmParserSemaCallback *SemaCallback = nullptr;
338338

339339
/// Set of options which affects instrumentation of inline assembly.
340340
MCTargetOptions MCOptions;

0 commit comments

Comments
 (0)