From 6033a9e20c3f580ca9b20d8a85c24692f2702e5a Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 15 Jul 2023 12:12:26 +0200 Subject: [PATCH] remove optfloatx option --- codeCore/src/prog8/code/core/CompilationOptions.kt | 1 - codeOptimizers/src/prog8/optimizer/BinExprSplitter.kt | 4 ---- compiler/src/prog8/CompilerMain.kt | 3 --- compiler/src/prog8/compiler/Compiler.kt | 4 ---- .../src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt | 3 --- compiler/test/TestCompilerOnExamples.kt | 1 - compiler/test/TestCompilerOptionLibdirs.kt | 1 - compiler/test/helpers/compileXyz.kt | 5 +---- httpCompilerService/src/prog8/http/TestHttp.kt | 1 - 9 files changed, 1 insertion(+), 22 deletions(-) diff --git a/codeCore/src/prog8/code/core/CompilationOptions.kt b/codeCore/src/prog8/code/core/CompilationOptions.kt index c53d3da27..7d1719922 100644 --- a/codeCore/src/prog8/code/core/CompilationOptions.kt +++ b/codeCore/src/prog8/code/core/CompilationOptions.kt @@ -14,7 +14,6 @@ class CompilationOptions(val output: OutputType, // these are set later, based on command line arguments or options in the source code: var loadAddress: UInt, var optimize: Boolean = false, - var optimizeFloatExpressions: Boolean = false, var asmQuiet: Boolean = false, var asmListfile: Boolean = false, var experimentalCodegen: Boolean = false, diff --git a/codeOptimizers/src/prog8/optimizer/BinExprSplitter.kt b/codeOptimizers/src/prog8/optimizer/BinExprSplitter.kt index de5f0dae2..9b9618b10 100644 --- a/codeOptimizers/src/prog8/optimizer/BinExprSplitter.kt +++ b/codeOptimizers/src/prog8/optimizer/BinExprSplitter.kt @@ -11,7 +11,6 @@ import prog8.ast.walk.AstWalker import prog8.ast.walk.IAstModification import prog8.code.core.AugmentAssignmentOperators import prog8.code.core.CompilationOptions -import prog8.code.core.DataType import prog8.code.target.VMTarget @@ -22,9 +21,6 @@ class BinExprSplitter(private val program: Program, private val options: Compila if(options.compTarget.name == VMTarget.NAME) return noModifications // don't split expressions when targeting the vm codegen, it handles nested expressions well - if(assignment.value.inferType(program) istype DataType.FLOAT && !options.optimizeFloatExpressions) - return noModifications - val binExpr = assignment.value as? BinaryExpression if (binExpr != null) { diff --git a/compiler/src/prog8/CompilerMain.kt b/compiler/src/prog8/CompilerMain.kt index 2f78db50f..396ff4496 100644 --- a/compiler/src/prog8/CompilerMain.kt +++ b/compiler/src/prog8/CompilerMain.kt @@ -44,7 +44,6 @@ private fun compileMain(args: Array): Boolean { val dontWriteAssembly by cli.option(ArgType.Boolean, fullName = "noasm", description="don't create assembly code") val dontOptimize by cli.option(ArgType.Boolean, fullName = "noopt", description = "don't perform any optimizations") val outputDir by cli.option(ArgType.String, fullName = "out", description = "directory for output files instead of current directory").default(".") - val optimizeFloatExpressions by cli.option(ArgType.Boolean, fullName = "optfloatx", description = "optimize float expressions (warning: can increase program size)") val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results") val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator) val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}', '${VMTarget.NAME}') (required)") @@ -112,7 +111,6 @@ private fun compileMain(args: Array): Boolean { val compilerArgs = CompilerArguments( filepath, dontOptimize != true, - optimizeFloatExpressions == true, dontWriteAssembly != true, quietAssembler == true, asmListfile == true, @@ -179,7 +177,6 @@ private fun compileMain(args: Array): Boolean { val compilerArgs = CompilerArguments( filepath, dontOptimize != true, - optimizeFloatExpressions == true, dontWriteAssembly != true, quietAssembler == true, asmListfile == true, diff --git a/compiler/src/prog8/compiler/Compiler.kt b/compiler/src/prog8/compiler/Compiler.kt index b76b454e8..5e65e4fff 100644 --- a/compiler/src/prog8/compiler/Compiler.kt +++ b/compiler/src/prog8/compiler/Compiler.kt @@ -29,7 +29,6 @@ class CompilationResult(val compilerAst: Program, // deprecated, use codegenAs class CompilerArguments(val filepath: Path, val optimize: Boolean, - val optimizeFloatExpressions: Boolean, val writeAssembly: Boolean, val quietAssembler: Boolean, val asmListfile: Boolean, @@ -47,8 +46,6 @@ fun compileProgram(args: CompilerArguments): CompilationResult? { lateinit var program: Program lateinit var importedFiles: List - val optimizeFloatExpr = if(args.optimize) args.optimizeFloatExpressions else false - val compTarget = when(args.compilationTarget) { C64Target.NAME -> C64Target() @@ -69,7 +66,6 @@ fun compileProgram(args: CompilerArguments): CompilationResult? { with(compilationOptions) { optimize = args.optimize - optimizeFloatExpressions = optimizeFloatExpr asmQuiet = args.quietAssembler asmListfile = args.asmListfile experimentalCodegen = args.experimentalCodegen diff --git a/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt b/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt index e2a06d0d3..82b862fb7 100644 --- a/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt +++ b/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt @@ -56,9 +56,6 @@ internal class BeforeAsmAstChanger(val program: Program, && !assignment.target.isIOAddress(options.compTarget.machine)) { val binExpr = assignment.value as? BinaryExpression - if(binExpr!=null && binExpr.inferType(program) istype DataType.FLOAT && !options.optimizeFloatExpressions) - return noModifications - if (binExpr != null && binExpr.operator !in ComparisonOperators) { if (binExpr.left !is BinaryExpression) { if (binExpr.right.referencesIdentifier(assignment.target.identifier!!.nameInSource)) { diff --git a/compiler/test/TestCompilerOnExamples.kt b/compiler/test/TestCompilerOnExamples.kt index c9a3c43ac..09a3f8b0a 100644 --- a/compiler/test/TestCompilerOnExamples.kt +++ b/compiler/test/TestCompilerOnExamples.kt @@ -26,7 +26,6 @@ private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilat val args = CompilerArguments( filepath, optimize, - optimizeFloatExpressions = true, writeAssembly = true, quietAssembler = true, asmListfile = false, diff --git a/compiler/test/TestCompilerOptionLibdirs.kt b/compiler/test/TestCompilerOptionLibdirs.kt index d8b306333..020323237 100644 --- a/compiler/test/TestCompilerOptionLibdirs.kt +++ b/compiler/test/TestCompilerOptionLibdirs.kt @@ -43,7 +43,6 @@ class TestCompilerOptionSourcedirs: FunSpec({ val args = CompilerArguments( filepath = filePath, optimize = false, - optimizeFloatExpressions = false, writeAssembly = true, quietAssembler = true, asmListfile = false, diff --git a/compiler/test/helpers/compileXyz.kt b/compiler/test/helpers/compileXyz.kt index 2552f8b43..16010c595 100644 --- a/compiler/test/helpers/compileXyz.kt +++ b/compiler/test/helpers/compileXyz.kt @@ -17,14 +17,12 @@ internal fun compileFile( outputDir: Path = prog8tests.helpers.outputDir, errors: IErrorReporter? = null, writeAssembly: Boolean = true, - optFloatExpr: Boolean = true, ) : CompilationResult? { val filepath = fileDir.resolve(fileName) assumeReadableFile(filepath) val args = CompilerArguments( filepath, optimize, - optimizeFloatExpressions = optFloatExpr, writeAssembly = writeAssembly, quietAssembler = true, asmListfile = false, @@ -50,11 +48,10 @@ internal fun compileText( sourceText: String, errors: IErrorReporter? = null, writeAssembly: Boolean = true, - optFloatExpr: Boolean = true, ) : CompilationResult? { val filePath = outputDir.resolve("on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16) + ".p8") // we don't assumeNotExists(filePath) - should be ok to just overwrite it filePath.toFile().writeText(sourceText) return compileFile(platform, optimize, filePath.parent, filePath.name, - errors=errors, writeAssembly=writeAssembly, optFloatExpr = optFloatExpr) + errors=errors, writeAssembly=writeAssembly) } diff --git a/httpCompilerService/src/prog8/http/TestHttp.kt b/httpCompilerService/src/prog8/http/TestHttp.kt index 1e0c01425..15265fd1c 100644 --- a/httpCompilerService/src/prog8/http/TestHttp.kt +++ b/httpCompilerService/src/prog8/http/TestHttp.kt @@ -33,7 +33,6 @@ class RequestParser : Take { val args = CompilerArguments( Path(a), optimize = true, - optimizeFloatExpressions = false, writeAssembly = true, compilationTarget = "c64", symbolDefs = emptyMap(),