mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[ms] [llvm-ml] Fix macro case-insensitivity
We previously had issues identifying macros not registered with a lowercase name. Reviewed By: mstorsjo, thakis Differential Revision: https://reviews.llvm.org/D106453
This commit is contained in:
parent
001cdeb281
commit
fa28271fe9
@ -5957,7 +5957,7 @@ bool MasmParser::parseDirectiveMacro(StringRef Name, SMLoc NameLoc) {
|
|||||||
IsMacroFunction);
|
IsMacroFunction);
|
||||||
DEBUG_WITH_TYPE("asm-macros", dbgs() << "Defining new macro:\n";
|
DEBUG_WITH_TYPE("asm-macros", dbgs() << "Defining new macro:\n";
|
||||||
Macro.dump());
|
Macro.dump());
|
||||||
getContext().defineMacro(Name, std::move(Macro));
|
getContext().defineMacro(Name.lower(), std::move(Macro));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ xa1 DWORD ?
|
|||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
substitution_macro macro a1:req, a2:=<7>
|
SubstitutionMacro macro a1:req, a2:=<7>
|
||||||
mov eax, a1
|
mov eax, a1
|
||||||
mov eax, a1&
|
mov eax, a1&
|
||||||
mov eax, &a1
|
mov eax, &a1
|
||||||
@ -27,7 +27,7 @@ endm
|
|||||||
substitution_test_with_default PROC
|
substitution_test_with_default PROC
|
||||||
; CHECK-LABEL: substitution_test_with_default:
|
; CHECK-LABEL: substitution_test_with_default:
|
||||||
|
|
||||||
substitution_macro 1
|
SubstitutionMacro 1
|
||||||
; CHECK: mov eax, 1
|
; CHECK: mov eax, 1
|
||||||
; CHECK-NEXT: mov eax, 1
|
; CHECK-NEXT: mov eax, 1
|
||||||
; CHECK-NEXT: mov eax, 1
|
; CHECK-NEXT: mov eax, 1
|
||||||
@ -46,7 +46,7 @@ substitution_test_with_default ENDP
|
|||||||
substitution_test_with_value PROC
|
substitution_test_with_value PROC
|
||||||
; CHECK-LABEL: substitution_test_with_value:
|
; CHECK-LABEL: substitution_test_with_value:
|
||||||
|
|
||||||
substitution_macro 2, 8
|
SubstitutionMacro 2, 8
|
||||||
; CHECK: mov eax, 2
|
; CHECK: mov eax, 2
|
||||||
; CHECK-NEXT: mov eax, 2
|
; CHECK-NEXT: mov eax, 2
|
||||||
; CHECK-NEXT: mov eax, 2
|
; CHECK-NEXT: mov eax, 2
|
||||||
@ -62,7 +62,45 @@ substitution_test_with_value PROC
|
|||||||
ret
|
ret
|
||||||
substitution_test_with_value ENDP
|
substitution_test_with_value ENDP
|
||||||
|
|
||||||
ambiguous_substitution_macro MACRO x, y
|
substitution_test_lowercase PROC
|
||||||
|
; CHECK-LABEL: substitution_test_lowercase:
|
||||||
|
|
||||||
|
substitutionmacro 2, 8
|
||||||
|
; CHECK: mov eax, 2
|
||||||
|
; CHECK-NEXT: mov eax, 2
|
||||||
|
; CHECK-NEXT: mov eax, 2
|
||||||
|
; CHECK-NEXT: mov eax, 2
|
||||||
|
; CHECK: mov eax, dword ptr [rip + xa1]
|
||||||
|
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
|
||||||
|
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
|
||||||
|
; CHECK: mov eax, 8
|
||||||
|
; CHECK-NEXT: mov eax, 8
|
||||||
|
; CHECK-NEXT: mov eax, 8
|
||||||
|
; CHECK-NEXT: mov eax, 8
|
||||||
|
|
||||||
|
ret
|
||||||
|
substitution_test_lowercase ENDP
|
||||||
|
|
||||||
|
substitution_test_uppercase PROC
|
||||||
|
; CHECK-LABEL: substitution_test_uppercase:
|
||||||
|
|
||||||
|
SUBSTITUTIONMACRO 2, 8
|
||||||
|
; CHECK: mov eax, 2
|
||||||
|
; CHECK-NEXT: mov eax, 2
|
||||||
|
; CHECK-NEXT: mov eax, 2
|
||||||
|
; CHECK-NEXT: mov eax, 2
|
||||||
|
; CHECK: mov eax, dword ptr [rip + xa1]
|
||||||
|
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
|
||||||
|
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
|
||||||
|
; CHECK: mov eax, 8
|
||||||
|
; CHECK-NEXT: mov eax, 8
|
||||||
|
; CHECK-NEXT: mov eax, 8
|
||||||
|
; CHECK-NEXT: mov eax, 8
|
||||||
|
|
||||||
|
ret
|
||||||
|
substitution_test_uppercase ENDP
|
||||||
|
|
||||||
|
AmbiguousSubstitutionMacro MACRO x, y
|
||||||
x&y BYTE 0
|
x&y BYTE 0
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
@ -70,7 +108,7 @@ ambiguous_substitution_test PROC
|
|||||||
; CHECK-LABEL: ambiguous_substitution_test:
|
; CHECK-LABEL: ambiguous_substitution_test:
|
||||||
|
|
||||||
; should expand to ab BYTE 0
|
; should expand to ab BYTE 0
|
||||||
ambiguous_substitution_macro a, b
|
AmbiguousSubstitutionMacro a, b
|
||||||
|
|
||||||
; CHECK: ab:
|
; CHECK: ab:
|
||||||
; CHECK-NOT: ay:
|
; CHECK-NOT: ay:
|
||||||
@ -78,7 +116,7 @@ ambiguous_substitution_test PROC
|
|||||||
; CHECK-NOT: xy:
|
; CHECK-NOT: xy:
|
||||||
ambiguous_substitution_test ENDP
|
ambiguous_substitution_test ENDP
|
||||||
|
|
||||||
ambiguous_substitution_in_string_macro MACRO x, y
|
AmbiguousSubstitutionInStringMacro MACRO x, y
|
||||||
BYTE "x&y"
|
BYTE "x&y"
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
@ -86,14 +124,14 @@ ambiguous_substitution_in_string_test PROC
|
|||||||
; CHECK-LABEL: ambiguous_substitution_in_string_test:
|
; CHECK-LABEL: ambiguous_substitution_in_string_test:
|
||||||
|
|
||||||
; should expand to BYTE "5y"
|
; should expand to BYTE "5y"
|
||||||
ambiguous_substitution_in_string_macro 5, 7
|
AmbiguousSubstitutionInStringMacro 5, 7
|
||||||
|
|
||||||
; CHECK: .byte 53
|
; CHECK: .byte 53
|
||||||
; CHECK-NEXT: .byte 121
|
; CHECK-NEXT: .byte 121
|
||||||
; CHECK-NOT: .byte
|
; CHECK-NOT: .byte
|
||||||
ambiguous_substitution_in_string_test ENDP
|
ambiguous_substitution_in_string_test ENDP
|
||||||
|
|
||||||
optional_parameter_macro MACRO a1:req, a2
|
OptionalParameterMacro MACRO a1:req, a2
|
||||||
mov eax, a1
|
mov eax, a1
|
||||||
IFNB <a2>
|
IFNB <a2>
|
||||||
mov eax, a2
|
mov eax, a2
|
||||||
@ -104,17 +142,17 @@ ENDM
|
|||||||
optional_parameter_test PROC
|
optional_parameter_test PROC
|
||||||
; CHECK-LABEL: optional_parameter_test:
|
; CHECK-LABEL: optional_parameter_test:
|
||||||
|
|
||||||
optional_parameter_macro 4
|
OptionalParameterMacro 4
|
||||||
; CHECK: mov eax, 4
|
; CHECK: mov eax, 4
|
||||||
; CHECK: ret
|
; CHECK: ret
|
||||||
|
|
||||||
optional_parameter_macro 5, 9
|
OptionalParameterMacro 5, 9
|
||||||
; CHECK: mov eax, 5
|
; CHECK: mov eax, 5
|
||||||
; CHECK: mov eax, 9
|
; CHECK: mov eax, 9
|
||||||
; CHECK: ret
|
; CHECK: ret
|
||||||
optional_parameter_test ENDP
|
optional_parameter_test ENDP
|
||||||
|
|
||||||
local_symbol_macro MACRO
|
LocalSymbolMacro MACRO
|
||||||
LOCAL a
|
LOCAL a
|
||||||
a: ret
|
a: ret
|
||||||
jmp a
|
jmp a
|
||||||
@ -123,22 +161,22 @@ ENDM
|
|||||||
local_symbol_test PROC
|
local_symbol_test PROC
|
||||||
; CHECK-LABEL: local_symbol_test:
|
; CHECK-LABEL: local_symbol_test:
|
||||||
|
|
||||||
local_symbol_macro
|
LocalSymbolMacro
|
||||||
; CHECK: "??0000":
|
; CHECK: "??0000":
|
||||||
; CHECK-NEXT: ret
|
; CHECK-NEXT: ret
|
||||||
; CHECK-NEXT: jmp "??0000"
|
; CHECK-NEXT: jmp "??0000"
|
||||||
|
|
||||||
local_symbol_macro
|
LocalSymbolMacro
|
||||||
; CHECK: "??0001":
|
; CHECK: "??0001":
|
||||||
; CHECK-NEXT: ret
|
; CHECK-NEXT: ret
|
||||||
; CHECK-NEXT: jmp "??0001"
|
; CHECK-NEXT: jmp "??0001"
|
||||||
local_symbol_test ENDP
|
local_symbol_test ENDP
|
||||||
|
|
||||||
PURGE ambiguous_substitution_macro, local_symbol_macro,
|
PURGE AmbiguousSubstitutionMacro, LocalSymbolMacro,
|
||||||
optional_parameter_macro
|
OptionalParameterMacro
|
||||||
|
|
||||||
; Redefinition
|
; Redefinition
|
||||||
local_symbol_macro MACRO
|
LocalSymbolMacro MACRO
|
||||||
LOCAL b
|
LOCAL b
|
||||||
b: xor eax, eax
|
b: xor eax, eax
|
||||||
jmp b
|
jmp b
|
||||||
@ -147,7 +185,7 @@ ENDM
|
|||||||
purge_test PROC
|
purge_test PROC
|
||||||
; CHECK-LABEL: purge_test:
|
; CHECK-LABEL: purge_test:
|
||||||
|
|
||||||
local_symbol_macro
|
LocalSymbolMacro
|
||||||
; CHECK: "??0002":
|
; CHECK: "??0002":
|
||||||
; CHECK-NEXT: xor eax, eax
|
; CHECK-NEXT: xor eax, eax
|
||||||
; CHECK-NEXT: jmp "??0002"
|
; CHECK-NEXT: jmp "??0002"
|
||||||
|
Loading…
Reference in New Issue
Block a user