[llvm] r310528 - [X86][Asm] Allow negative immediate to appear before bracketed expression
Coby Tayree via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 14:49:17 PDT 2017
Author: coby
Date: Wed Aug 9 14:49:17 2017
New Revision: 310528
URL: http://llvm.org/viewvc/llvm-project?rev=310528&view=rev
Log:
[X86][Asm] Allow negative immediate to appear before bracketed expression
Currently, only non-negative immediate is allowed prior to a brac expression (memory reference).
MASM / GAS does not have any problem cope with the left side of the real line, so we should be able to as well.
Differntial Revision: https://reviews.llvm.org/D36229
Modified:
llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h?rev=310528&r1=310527&r2=310528&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h Wed Aug 9 14:49:17 2017
@@ -66,11 +66,11 @@ struct AsmRewrite {
AsmRewriteKind Kind;
SMLoc Loc;
unsigned Len;
- unsigned Val;
+ int64_t Val;
StringRef Label;
public:
- AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len = 0, unsigned val = 0)
+ AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len = 0, int64_t val = 0)
: Kind(kind), Loc(loc), Len(len), Val(val) {}
AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len, StringRef label)
: Kind(kind), Loc(loc), Len(len), Val(0), Label(label) {}
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=310528&r1=310527&r2=310528&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Aug 9 14:49:17 2017
@@ -1962,11 +1962,6 @@ std::unique_ptr<X86Operand> X86AsmParser
return X86Operand::CreateImm(ImmExpr, Start, End);
}
- // Only positive immediates are valid.
- if (Imm < 0)
- return ErrorOperand(Start, "expected a positive immediate displacement "
- "before bracketed expr.");
-
return ParseIntelBracExpression(/*SegReg=*/0, Start, Imm, isSymbol, Size);
}
More information about the llvm-commits
mailing list