[llvm] r201986 - MCAsmParser: support .ifne
Saleem Abdulrasool
compnerd at compnerd.org
Sun Feb 23 07:53:41 PST 2014
Author: compnerd
Date: Sun Feb 23 09:53:41 2014
New Revision: 201986
URL: http://llvm.org/viewvc/llvm-project?rev=201986&view=rev
Log:
MCAsmParser: support .ifne
The .ifne directive assembles the following section of code if the argument
expression is non-zero. Effectively, it is equivalent to if.
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/test/MC/AsmParser/conditional_asm.s
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=201986&r1=201985&r2=201986&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Sun Feb 23 09:53:41 2014
@@ -350,8 +350,8 @@ private:
DK_REFERENCE, DK_WEAK_DEFINITION, DK_WEAK_REFERENCE,
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_IFB, DK_IFNB, DK_IFC, DK_IFNC, DK_IFDEF, DK_IFNDEF, DK_IFNOTDEF,
- DK_ELSEIF, DK_ELSE, DK_ENDIF,
+ DK_IF, DK_IFNE, DK_IFB, DK_IFNB, DK_IFC, DK_IFNC, 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,
@@ -438,7 +438,8 @@ private:
bool parseDirectiveInclude(); // ".include"
bool parseDirectiveIncbin(); // ".incbin"
- bool parseDirectiveIf(SMLoc DirectiveLoc); // ".if"
+ // ".if" or ".ifne"
+ bool parseDirectiveIf(SMLoc DirectiveLoc);
// ".ifb" or ".ifnb", depending on ExpectBlank.
bool parseDirectiveIfb(SMLoc DirectiveLoc, bool ExpectBlank);
// ".ifc" or ".ifnc", depending on ExpectEqual.
@@ -1230,6 +1231,7 @@ bool AsmParser::parseStatement(ParseStat
default:
break;
case DK_IF:
+ case DK_IFNE:
return parseDirectiveIf(IDLoc);
case DK_IFB:
return parseDirectiveIfb(IDLoc, true);
@@ -3766,6 +3768,7 @@ bool AsmParser::parseDirectiveIncbin() {
/// parseDirectiveIf
/// ::= .if expression
+/// ::= .ifne expression
bool AsmParser::parseDirectiveIf(SMLoc DirectiveLoc) {
TheCondStack.push_back(TheCondState);
TheCondState.TheCond = AsmCond::IfCond;
@@ -4025,6 +4028,7 @@ void AsmParser::initializeDirectiveKindM
DirectiveKindMap[".bundle_lock"] = DK_BUNDLE_LOCK;
DirectiveKindMap[".bundle_unlock"] = DK_BUNDLE_UNLOCK;
DirectiveKindMap[".if"] = DK_IF;
+ DirectiveKindMap[".ifne"] = DK_IFNE;
DirectiveKindMap[".ifb"] = DK_IFB;
DirectiveKindMap[".ifnb"] = DK_IFNB;
DirectiveKindMap[".ifc"] = DK_IFC;
Modified: llvm/trunk/test/MC/AsmParser/conditional_asm.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/conditional_asm.s?rev=201986&r1=201985&r2=201986&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/conditional_asm.s (original)
+++ llvm/trunk/test/MC/AsmParser/conditional_asm.s Sun Feb 23 09:53:41 2014
@@ -10,3 +10,12 @@
.byte 0
.endif
.endif
+
+# CHECK: .byte 1
+# CHECK-NOT: .byte 0
+.ifne 32 - 32
+ .byte 0
+.else
+ .byte 1
+.endif
+
More information about the llvm-commits
mailing list