From 3e9878ca0777b79a414e0bd27746ea4dc89921fc Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Mon, 22 Oct 2012 19:50:35 +0000 Subject: [PATCH] [ms-inline asm] Add the isOffsetOf() function. Part of rdar://12470317 llvm-svn: 166436 --- include/llvm/MC/MCParser/MCParsedAsmOperand.h | 5 +++++ lib/Target/X86/AsmParser/X86AsmParser.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/include/llvm/MC/MCParser/MCParsedAsmOperand.h index 7d0914ebb49..35f47c0b9c8 100644 --- a/include/llvm/MC/MCParser/MCParsedAsmOperand.h +++ b/include/llvm/MC/MCParser/MCParsedAsmOperand.h @@ -64,6 +64,11 @@ public: /// getEndLoc - Get the location of the last token of this operand. virtual SMLoc getEndLoc() const = 0; + /// isOffsetOf - Do we need to emit code to get the offset of the variable, + /// rather then the value of the variable? Only valid when parsing MS-style + /// inline assembly. + virtual bool isOffsetOf() const { return false; } + /// needSizeDirective - Do we need to emit a sizing directive for this /// operand? Only valid when parsing MS-style inline assembly. virtual bool needSizeDirective() const { return false; } diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 63cce6cbc86..9689180afdb 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -320,6 +320,11 @@ struct X86Operand : public MCParsedAsmOperand { return Mem.Size; } + bool isOffsetOf() const { + assert(Kind == Memory && "Invalid access!"); + return Mem.OffsetOf; + } + bool needSizeDirective() const { assert(Kind == Memory && "Invalid access!"); return Mem.NeedSizeDir;