@@ -1853,19 +1853,29 @@ private Opcode spaceShipOpcode(SpaceshipExpr expr) {
1853
1853
/**
1854
1854
* IR translation of a simple binary operation.
1855
1855
*/
1856
- class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
1856
+ class TranslatedBinaryOperation extends TranslatedNonConstantExpr {
1857
1857
TranslatedBinaryOperation ( ) {
1858
1858
expr instanceof BinaryArithmeticOperation or
1859
1859
expr instanceof BinaryBitwiseOperation or
1860
1860
expr instanceof ComparisonOperation
1861
1861
}
1862
1862
1863
+ final override Instruction getResult ( ) {
1864
+ result = this .getInstruction ( BinaryOperationOperationTag ( ) )
1865
+ }
1866
+
1867
+ final override predicate hasInstruction ( Opcode opcode , InstructionTag tag , CppType resultType ) {
1868
+ opcode = this .getOpcode ( ) and
1869
+ tag = BinaryOperationOperationTag ( ) and
1870
+ resultType = this .getResultType ( )
1871
+ }
1872
+
1863
1873
override Instruction getFirstInstruction ( EdgeKind kind ) {
1864
1874
result = this .getLeftOperand ( ) .getFirstInstruction ( kind )
1865
1875
}
1866
1876
1867
1877
override Instruction getALastInstructionInternal ( ) {
1868
- result = this .getInstruction ( OnlyInstructionTag ( ) )
1878
+ result = this .getInstruction ( BinaryOperationOperationTag ( ) )
1869
1879
}
1870
1880
1871
1881
final override TranslatedElement getChildInternal ( int id ) {
@@ -1875,7 +1885,7 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
1875
1885
}
1876
1886
1877
1887
final override Instruction getInstructionRegisterOperand ( InstructionTag tag , OperandTag operandTag ) {
1878
- tag = OnlyInstructionTag ( ) and
1888
+ tag = BinaryOperationOperationTag ( ) and
1879
1889
if this .swapOperandsOnOp ( )
1880
1890
then (
1881
1891
operandTag instanceof RightOperandTag and
@@ -1893,7 +1903,7 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
1893
1903
}
1894
1904
1895
1905
override Instruction getInstructionSuccessorInternal ( InstructionTag tag , EdgeKind kind ) {
1896
- tag = OnlyInstructionTag ( ) and
1906
+ tag = BinaryOperationOperationTag ( ) and
1897
1907
result = this .getParent ( ) .getChildSuccessor ( this , kind )
1898
1908
}
1899
1909
@@ -1903,10 +1913,10 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
1903
1913
or
1904
1914
kind instanceof GotoEdge and
1905
1915
child = this .getRightOperand ( ) and
1906
- result = this .getInstruction ( OnlyInstructionTag ( ) )
1916
+ result = this .getInstruction ( BinaryOperationOperationTag ( ) )
1907
1917
}
1908
1918
1909
- override Opcode getOpcode ( ) {
1919
+ Opcode getOpcode ( ) {
1910
1920
result = binaryArithmeticOpcode ( expr ) or
1911
1921
result = binaryBitwiseOpcode ( expr ) or
1912
1922
result = comparisonOpcode ( expr ) or
@@ -1920,7 +1930,7 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
1920
1930
}
1921
1931
1922
1932
override int getInstructionElementSize ( InstructionTag tag ) {
1923
- tag = OnlyInstructionTag ( ) and
1933
+ tag = BinaryOperationOperationTag ( ) and
1924
1934
exists ( Opcode opcode |
1925
1935
opcode = this .getOpcode ( ) and
1926
1936
(
0 commit comments