diff --git a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/FpFunctionsToExprsPass.kt b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/FpFunctionsToExprsPass.kt index 3df05d6475..6ea24362ca 100644 --- a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/FpFunctionsToExprsPass.kt +++ b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/FpFunctionsToExprsPass.kt @@ -125,7 +125,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, FpRoundToIntegralExpr.of(FpRoundingMode.RTZ, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr)) + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -138,7 +139,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, FpRoundToIntegralExpr.of(FpRoundingMode.RTP, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr)) + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -153,8 +155,7 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { val assign: AssignStmt<*> = Stmts.Assign( TypeUtils.cast((expr as RefExpr<*>).decl as VarDecl<*>, type.smtType), TypeUtils.cast(AbstractExprs.Ite( - FpIsInfiniteExpr.of( - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr), + FpIsInfiniteExpr.of(callStmt.params[1] as Expr), type.unitValue, type.nullValue), type.smtType)) parseContext.metadata.create(assign.expr, "cType", type) @@ -170,8 +171,7 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { val assign: AssignStmt<*> = Stmts.Assign( TypeUtils.cast((expr as RefExpr<*>).decl as VarDecl<*>, type.smtType), TypeUtils.cast(AbstractExprs.Ite( - FpIsInfiniteExpr.of( - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr), + FpIsInfiniteExpr.of(callStmt.params[1] as Expr), type.nullValue, type.unitValue), type.smtType)) parseContext.metadata.create(assign.expr, "cType", type) @@ -197,8 +197,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { val assign: AssignStmt<*> = Stmts.Assign( TypeUtils.cast((expr as RefExpr<*>).decl as VarDecl<*>, type.smtType), TypeUtils.cast( - AbstractExprs.Ite(FpIsNanExpr.of( - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr), + AbstractExprs.Ite( + FpIsNanExpr.of(callStmt.params[1] as Expr), type.unitValue, type.nullValue), type.smtType)) parseContext.getMetadata().create(assign.expr, "cType", type) return StmtLabel(assign, metadata = callStmt.metadata) @@ -213,7 +213,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, FpRoundToIntegralExpr.of(FpRoundingMode.RNA, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr)) + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -226,7 +227,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, FpSqrtExpr.of(FpRoundingMode.RNE, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr)) + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -243,8 +245,10 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { val expr = callStmt.params[0] Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, - FpMinExpr.of(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[2]) as Expr)) + FpMinExpr.of(TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr, + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[2]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -257,8 +261,10 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { val expr = callStmt.params[0] Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, - FpMaxExpr.of(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[2]) as Expr)) + FpMaxExpr.of(TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr, + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[2]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -271,7 +277,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, FpRoundToIntegralExpr.of(FpRoundingMode.RTN, - CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr)) + TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) } @@ -283,7 +290,8 @@ class FpFunctionsToExprsPass(val parseContext: ParseContext) : ProcedurePass { val expr = callStmt.params[0] Preconditions.checkState(expr is RefExpr<*>) val assign = Stmts.Assign((expr as RefExpr<*>).decl as VarDecl, - FpAbsExpr.of(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]) as Expr)) + FpAbsExpr.of(TypeUtils.cast(CComplexType.getType(expr, parseContext).castTo(callStmt.params[1]), + CComplexType.getType(expr, parseContext).smtType) as Expr)) if (parseContext.getMetadata().getMetadataValue(expr, "cType").isPresent) { parseContext.getMetadata().create(assign.expr, "cType", CComplexType.getType(expr, parseContext)) }