@@ -1497,8 +1497,6 @@ static unsigned getDarwinBinOpPrecedence(AsmToken::TokenKind K,
1497
1497
return 1 ;
1498
1498
1499
1499
// Low Precedence: |, &, ^
1500
- //
1501
- // FIXME: gas seems to support '!' as an infix operator?
1502
1500
case AsmToken::Pipe:
1503
1501
Kind = MCBinaryExpr::Or;
1504
1502
return 2 ;
@@ -1559,7 +1557,8 @@ static unsigned getDarwinBinOpPrecedence(AsmToken::TokenKind K,
1559
1557
}
1560
1558
}
1561
1559
1562
- static unsigned getGNUBinOpPrecedence (AsmToken::TokenKind K,
1560
+ static unsigned getGNUBinOpPrecedence (const MCAsmInfo &MAI,
1561
+ AsmToken::TokenKind K,
1563
1562
MCBinaryExpr::Opcode &Kind,
1564
1563
bool ShouldUseLogicalShr) {
1565
1564
switch (K) {
@@ -1603,12 +1602,18 @@ static unsigned getGNUBinOpPrecedence(AsmToken::TokenKind K,
1603
1602
Kind = MCBinaryExpr::Sub;
1604
1603
return 4 ;
1605
1604
1606
- // High Intermediate Precedence: |, &, ^
1605
+ // High Intermediate Precedence: |, !, &, ^
1607
1606
//
1608
- // FIXME: gas seems to support '!' as an infix operator?
1609
1607
case AsmToken::Pipe:
1610
1608
Kind = MCBinaryExpr::Or;
1611
1609
return 5 ;
1610
+ case AsmToken::Exclaim:
1611
+ // Hack to support ARM compatible aliases (implied 'sp' operand in 'srs*'
1612
+ // instructions like 'srsda #31!') and not parse ! as an infix operator.
1613
+ if (MAI.getCommentString () == " @" )
1614
+ return 0 ;
1615
+ Kind = MCBinaryExpr::OrNot;
1616
+ return 5 ;
1612
1617
case AsmToken::Caret:
1613
1618
Kind = MCBinaryExpr::Xor;
1614
1619
return 5 ;
@@ -1639,7 +1644,7 @@ unsigned AsmParser::getBinOpPrecedence(AsmToken::TokenKind K,
1639
1644
MCBinaryExpr::Opcode &Kind) {
1640
1645
bool ShouldUseLogicalShr = MAI.shouldUseLogicalShr ();
1641
1646
return IsDarwin ? getDarwinBinOpPrecedence (K, Kind, ShouldUseLogicalShr)
1642
- : getGNUBinOpPrecedence (K, Kind, ShouldUseLogicalShr);
1647
+ : getGNUBinOpPrecedence (MAI, K, Kind, ShouldUseLogicalShr);
1643
1648
}
1644
1649
1645
1650
// / Parse all binary operators with precedence >= 'Precedence'.
0 commit comments