summaryrefslogtreecommitdiff
path: root/lib/Target/X86/AsmParser/X86AsmParser.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-10-23 23:31:33 +0000
committerChad Rosier <mcrosier@apple.com>2012-10-23 23:31:33 +0000
commit2a784131fed4bc99c0ae96b5252a3fe0079a3079 (patch)
treef7a5c4d7745b1012ffe0ea90f3b98b2e825ad00d /lib/Target/X86/AsmParser/X86AsmParser.cpp
parentfac14ab1795cfce21e4e5e51c711a11f6181074b (diff)
downloadllvm-2a784131fed4bc99c0ae96b5252a3fe0079a3079.tar.gz
llvm-2a784131fed4bc99c0ae96b5252a3fe0079a3079.tar.bz2
llvm-2a784131fed4bc99c0ae96b5252a3fe0079a3079.tar.xz
[ms-inline asm] When parsing inline assembly we set the base register to a
non-zero value as we don't know the actual value at this point. This is necessary to get the matching correct in some cases. However, the actual value set as the base register doesn't matter, since we're just matching not emitting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmParser/X86AsmParser.cpp')
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index ab3bdfa03a..31a96721f1 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -808,8 +808,15 @@ X86Operand *X86AsmParser::ParseIntelMemOperand(unsigned SegReg, SMLoc Start) {
NeedSizeDir = Size > 0;
}
}
- return X86Operand::CreateMem(Disp, Start, End, OffsetOfLoc, Size, OffsetOf,
- NeedSizeDir);
+ if (!isParsingInlineAsm())
+ return X86Operand::CreateMem(Disp, Start, End, OffsetOfLoc, Size);
+ else
+ // When parsing inline assembly we set the basereg to a non-zero value as we
+ // don't know the actualy value at this time. This is necessary to get the
+ // matching correct in some cases.
+ return X86Operand::CreateMem(/*SegReg*/0, Disp, /*BaseReg*/1, /*IndexReg*/0,
+ /*Scale*/1, Start, End, OffsetOfLoc, Size,
+ OffsetOf, NeedSizeDir);
}
X86Operand *X86AsmParser::ParseIntelOperand() {