mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Add support for .ifnes psuedo-op.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232636 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b52cdda782
commit
b243a3a556
@ -339,8 +339,8 @@ private:
|
||||
DK_WEAK_DEF_CAN_BE_HIDDEN, DK_COMM, DK_COMMON, DK_LCOMM, DK_ABORT,
|
||||
DK_INCLUDE, DK_INCBIN, DK_CODE16, DK_CODE16GCC, DK_REPT, DK_IRP, DK_IRPC,
|
||||
DK_IF, DK_IFEQ, DK_IFGE, DK_IFGT, DK_IFLE, DK_IFLT, DK_IFNE, DK_IFB,
|
||||
DK_IFNB, DK_IFC, DK_IFEQS, DK_IFNC, DK_IFDEF, DK_IFNDEF, DK_IFNOTDEF,
|
||||
DK_ELSEIF, DK_ELSE, DK_ENDIF,
|
||||
DK_IFNB, DK_IFC, DK_IFEQS, DK_IFNC, DK_IFNES, DK_IFDEF, DK_IFNDEF,
|
||||
DK_IFNOTDEF, DK_ELSEIF, DK_ELSE, DK_ENDIF,
|
||||
DK_SPACE, DK_SKIP, DK_FILE, DK_LINE, DK_LOC, DK_STABS,
|
||||
DK_CFI_SECTIONS, DK_CFI_STARTPROC, DK_CFI_ENDPROC, DK_CFI_DEF_CFA,
|
||||
DK_CFI_DEF_CFA_OFFSET, DK_CFI_ADJUST_CFA_OFFSET, DK_CFI_DEF_CFA_REGISTER,
|
||||
@ -435,8 +435,8 @@ private:
|
||||
bool parseDirectiveIfb(SMLoc DirectiveLoc, bool ExpectBlank);
|
||||
// ".ifc" or ".ifnc", depending on ExpectEqual.
|
||||
bool parseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual);
|
||||
// ".ifeqs"
|
||||
bool parseDirectiveIfeqs(SMLoc DirectiveLoc);
|
||||
// ".ifeqs" or ".ifnes", depending on ExpectEqual.
|
||||
bool parseDirectiveIfeqs(SMLoc DirectiveLoc, bool ExpectEqual);
|
||||
// ".ifdef" or ".ifndef", depending on expect_defined
|
||||
bool parseDirectiveIfdef(SMLoc DirectiveLoc, bool expect_defined);
|
||||
bool parseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif"
|
||||
@ -1244,9 +1244,11 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
||||
case DK_IFC:
|
||||
return parseDirectiveIfc(IDLoc, true);
|
||||
case DK_IFEQS:
|
||||
return parseDirectiveIfeqs(IDLoc);
|
||||
return parseDirectiveIfeqs(IDLoc, true);
|
||||
case DK_IFNC:
|
||||
return parseDirectiveIfc(IDLoc, false);
|
||||
case DK_IFNES:
|
||||
return parseDirectiveIfeqs(IDLoc, false);
|
||||
case DK_IFDEF:
|
||||
return parseDirectiveIfdef(IDLoc, true);
|
||||
case DK_IFNDEF:
|
||||
@ -3943,9 +3945,12 @@ bool AsmParser::parseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual) {
|
||||
|
||||
/// parseDirectiveIfeqs
|
||||
/// ::= .ifeqs string1, string2
|
||||
bool AsmParser::parseDirectiveIfeqs(SMLoc DirectiveLoc) {
|
||||
bool AsmParser::parseDirectiveIfeqs(SMLoc DirectiveLoc, bool ExpectEqual) {
|
||||
if (Lexer.isNot(AsmToken::String)) {
|
||||
TokError("expected string parameter for '.ifeqs' directive");
|
||||
if (ExpectEqual)
|
||||
TokError("expected string parameter for '.ifeqs' directive");
|
||||
else
|
||||
TokError("expected string parameter for '.ifnes' directive");
|
||||
eatToEndOfStatement();
|
||||
return true;
|
||||
}
|
||||
@ -3954,7 +3959,10 @@ bool AsmParser::parseDirectiveIfeqs(SMLoc DirectiveLoc) {
|
||||
Lex();
|
||||
|
||||
if (Lexer.isNot(AsmToken::Comma)) {
|
||||
TokError("expected comma after first string for '.ifeqs' directive");
|
||||
if (ExpectEqual)
|
||||
TokError("expected comma after first string for '.ifeqs' directive");
|
||||
else
|
||||
TokError("expected comma after first string for '.ifnes' directive");
|
||||
eatToEndOfStatement();
|
||||
return true;
|
||||
}
|
||||
@ -3962,7 +3970,10 @@ bool AsmParser::parseDirectiveIfeqs(SMLoc DirectiveLoc) {
|
||||
Lex();
|
||||
|
||||
if (Lexer.isNot(AsmToken::String)) {
|
||||
TokError("expected string parameter for '.ifeqs' directive");
|
||||
if (ExpectEqual)
|
||||
TokError("expected string parameter for '.ifeqs' directive");
|
||||
else
|
||||
TokError("expected string parameter for '.ifnes' directive");
|
||||
eatToEndOfStatement();
|
||||
return true;
|
||||
}
|
||||
@ -3972,7 +3983,7 @@ bool AsmParser::parseDirectiveIfeqs(SMLoc DirectiveLoc) {
|
||||
|
||||
TheCondStack.push_back(TheCondState);
|
||||
TheCondState.TheCond = AsmCond::IfCond;
|
||||
TheCondState.CondMet = String1 == String2;
|
||||
TheCondState.CondMet = ExpectEqual == (String1 == String2);
|
||||
TheCondState.Ignore = !TheCondState.CondMet;
|
||||
|
||||
return false;
|
||||
@ -4219,6 +4230,7 @@ void AsmParser::initializeDirectiveKindMap() {
|
||||
DirectiveKindMap[".ifc"] = DK_IFC;
|
||||
DirectiveKindMap[".ifeqs"] = DK_IFEQS;
|
||||
DirectiveKindMap[".ifnc"] = DK_IFNC;
|
||||
DirectiveKindMap[".ifnes"] = DK_IFNES;
|
||||
DirectiveKindMap[".ifdef"] = DK_IFDEF;
|
||||
DirectiveKindMap[".ifndef"] = DK_IFNDEF;
|
||||
DirectiveKindMap[".ifnotdef"] = DK_IFNOTDEF;
|
||||
|
@ -20,3 +20,20 @@
|
||||
|
||||
// CHECK-NOT: error: unmatched .ifs or .elses
|
||||
|
||||
.ifnes
|
||||
|
||||
// CHECK: error: expected string parameter for '.ifnes' directive
|
||||
// CHECK: .ifnes
|
||||
// CHECK: ^
|
||||
|
||||
.ifnes "string1"
|
||||
|
||||
// CHECK: error: expected comma after first string for '.ifnes' directive
|
||||
// CHECK: .ifnes "string1"
|
||||
// CHECK: ^
|
||||
|
||||
.ifnes "string1",
|
||||
|
||||
// CHECK: error: expected string parameter for '.ifnes' directive
|
||||
// CHECK: .ifnes "string1",
|
||||
// CHECK: ^
|
||||
|
22
test/MC/AsmParser/ifnes.s
Normal file
22
test/MC/AsmParser/ifnes.s
Normal file
@ -0,0 +1,22 @@
|
||||
# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
|
||||
|
||||
# CHECK-NOT: .byte 0
|
||||
# CHECK: .byte 1
|
||||
.ifnes "foo space", "foo space"
|
||||
.byte 0
|
||||
.else
|
||||
.byte 1
|
||||
.endif
|
||||
|
||||
# CHECK-NOT: .byte 0
|
||||
# CHECK: .byte 1
|
||||
.ifnes "unequal", "unEqual"
|
||||
.byte 1
|
||||
.else
|
||||
.byte 0
|
||||
.endif
|
||||
|
||||
# CHECK-NOT: .byte 0
|
||||
# CHECK: .byte 1
|
||||
.ifnes "equal", "equal" ; .byte 0 ; .else ; .byte 1 ; .endif
|
||||
|
Loading…
Reference in New Issue
Block a user