mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[ms] [llvm-ml] Allow use of locally-defined variables in expressions
MASM allows variables defined by equate statements to be used in expressions. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D86946
This commit is contained in:
parent
7ae8eb3e82
commit
ffbe9ff668
@ -3076,6 +3076,11 @@ bool MasmParser::parseDirectiveEquate(StringRef IDVal, StringRef Name,
|
||||
SMLoc EndLoc, StartLoc = Lexer.getLoc();
|
||||
if (parseExpression(Expr, EndLoc))
|
||||
return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Var.Name);
|
||||
Sym->setRedefinable(Var.Redefinable);
|
||||
Sym->setVariableValue(Expr);
|
||||
Sym->setExternal(false);
|
||||
|
||||
if (Expr->evaluateAsAbsolute(Var.NumericValue,
|
||||
getStreamer().getAssemblerPtr()))
|
||||
return false;
|
||||
|
13
test/tools/llvm-ml/variable.test
Normal file
13
test/tools/llvm-ml/variable.test
Normal file
@ -0,0 +1,13 @@
|
||||
# RUN: llvm-ml -filetype=asm %s | FileCheck %s
|
||||
|
||||
.data
|
||||
t1_value equ 1 or 2
|
||||
|
||||
t1 BYTE t1_value DUP (0)
|
||||
; CHECK: t1:
|
||||
; CHECK-NEXT: .byte 0
|
||||
; CHECK-NEXT: .byte 0
|
||||
; CHECK-NEXT: .byte 0
|
||||
; CHECK-NOT: .byte 0
|
||||
|
||||
END
|
Loading…
Reference in New Issue
Block a user