remove optfloatx option

This commit is contained in:
Irmen de Jong 2023-07-15 12:12:26 +02:00
parent 9e8c8973d8
commit 6033a9e20c
9 changed files with 1 additions and 22 deletions

View File

@ -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,

View File

@ -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) {

View File

@ -44,7 +44,6 @@ private fun compileMain(args: Array<String>): 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<String>): Boolean {
val compilerArgs = CompilerArguments(
filepath,
dontOptimize != true,
optimizeFloatExpressions == true,
dontWriteAssembly != true,
quietAssembler == true,
asmListfile == true,
@ -179,7 +177,6 @@ private fun compileMain(args: Array<String>): Boolean {
val compilerArgs = CompilerArguments(
filepath,
dontOptimize != true,
optimizeFloatExpressions == true,
dontWriteAssembly != true,
quietAssembler == true,
asmListfile == true,

View File

@ -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<Path>
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

View File

@ -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)) {

View File

@ -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,

View File

@ -43,7 +43,6 @@ class TestCompilerOptionSourcedirs: FunSpec({
val args = CompilerArguments(
filepath = filePath,
optimize = false,
optimizeFloatExpressions = false,
writeAssembly = true,
quietAssembler = true,
asmListfile = false,

View File

@ -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)
}

View File

@ -33,7 +33,6 @@ class RequestParser : Take {
val args = CompilerArguments(
Path(a),
optimize = true,
optimizeFloatExpressions = false,
writeAssembly = true,
compilationTarget = "c64",
symbolDefs = emptyMap(),