@@ -1325,46 +1325,85 @@ class TranslatedNotExpr extends TranslatedNonConstantExpr {
1325
1325
1326
1326
override Type getExprType ( ) { result instanceof BoolType }
1327
1327
1328
+ private Type getOperandType ( ) { result = this .getOperand ( ) .getExprType ( ) }
1329
+
1328
1330
final override Instruction getFirstInstruction ( EdgeKind kind ) {
1329
1331
result = this .getOperand ( ) .getFirstInstruction ( kind )
1330
1332
}
1331
1333
1332
1334
override Instruction getALastInstructionInternal ( ) {
1333
- result = this .getInstruction ( OnlyInstructionTag ( ) )
1335
+ result = this .getInstruction ( NotExprNotTag ( ) )
1334
1336
}
1335
1337
1336
1338
final override TranslatedElement getChildInternal ( int id ) {
1337
1339
id = 0 and result = this .getOperand ( )
1338
1340
}
1339
1341
1340
1342
override predicate hasInstruction ( Opcode opcode , InstructionTag tag , CppType resultType ) {
1341
- tag = OnlyInstructionTag ( ) and
1343
+ not this .getOperandType ( ) instanceof BoolType and
1344
+ (
1345
+ tag = NotExprConstantTag ( ) and
1346
+ opcode instanceof Opcode:: Constant and
1347
+ resultType = getIntType ( )
1348
+ or
1349
+ tag = NotExprCompareTag ( ) and
1350
+ opcode instanceof Opcode:: CompareNE and
1351
+ resultType = getBoolType ( )
1352
+ )
1353
+ or
1354
+ tag = NotExprNotTag ( ) and
1342
1355
opcode instanceof Opcode:: LogicalNot and
1343
1356
resultType = getBoolType ( )
1344
1357
}
1345
1358
1346
1359
final override Instruction getInstructionSuccessorInternal ( InstructionTag tag , EdgeKind kind ) {
1347
- tag = OnlyInstructionTag ( ) and
1360
+ tag = NotExprConstantTag ( ) and
1361
+ result = this .getInstruction ( NotExprCompareTag ( ) ) and
1362
+ kind instanceof GotoEdge
1363
+ or
1364
+ tag = NotExprCompareTag ( ) and
1365
+ result = this .getInstruction ( NotExprNotTag ( ) ) and
1366
+ kind instanceof GotoEdge
1367
+ or
1368
+ tag = NotExprNotTag ( ) and
1348
1369
result = this .getParent ( ) .getChildSuccessor ( this , kind )
1349
1370
}
1350
1371
1351
1372
final override Instruction getChildSuccessorInternal ( TranslatedElement child , EdgeKind kind ) {
1352
1373
child = this .getOperand ( ) and
1353
1374
kind instanceof GotoEdge and
1354
- result = this .getInstruction ( OnlyInstructionTag ( ) )
1375
+ if this .getOperandType ( ) instanceof BoolType
1376
+ then result = this .getInstruction ( NotExprNotTag ( ) )
1377
+ else result = this .getInstruction ( NotExprConstantTag ( ) )
1355
1378
}
1356
1379
1357
1380
final override Instruction getInstructionRegisterOperand ( InstructionTag tag , OperandTag operandTag ) {
1358
- tag = OnlyInstructionTag ( ) and
1381
+ tag = NotExprNotTag ( ) and
1359
1382
operandTag instanceof UnaryOperandTag and
1360
- result = this .getOperand ( ) .getResult ( )
1383
+ if this .getOperandType ( ) instanceof BoolType
1384
+ then result = this .getOperand ( ) .getResult ( )
1385
+ else result = this .getInstruction ( NotExprCompareTag ( ) )
1386
+ or
1387
+ tag = NotExprCompareTag ( ) and
1388
+ (
1389
+ result = this .getOperand ( ) .getResult ( ) and
1390
+ operandTag instanceof LeftOperandTag
1391
+ or
1392
+ result = this .getInstruction ( NotExprConstantTag ( ) ) and
1393
+ operandTag instanceof RightOperandTag
1394
+ )
1361
1395
}
1362
1396
1363
1397
private TranslatedExpr getOperand ( ) {
1364
1398
result = getTranslatedExpr ( expr .getOperand ( ) .getFullyConverted ( ) )
1365
1399
}
1366
1400
1367
- final override Instruction getResult ( ) { result = this .getInstruction ( OnlyInstructionTag ( ) ) }
1401
+ final override Instruction getResult ( ) { result = this .getInstruction ( NotExprNotTag ( ) ) }
1402
+
1403
+ override string getInstructionConstantValue ( InstructionTag tag ) {
1404
+ tag = NotExprConstantTag ( ) and
1405
+ result = "0"
1406
+ }
1368
1407
}
1369
1408
1370
1409
/**
0 commit comments