Changeset 91 for trunk/UBFTarget.pas


Ignore:
Timestamp:
Jul 20, 2018, 9:41:37 AM (6 years ago)
Author:
chronos
Message:
  • Added: Allow to enable individual code optimization from settings dialog.
  • Added: Actions to format or shrink target BF code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UBFTarget.pas

    r90 r91  
    1717    Parameter: Integer;
    1818    RelIndex: Integer;
     19  end;
     20
     21  TOptimizations = record
     22    AddSub: Boolean;
     23    Merge: Boolean;
     24    RelativeIndexes: Boolean;
     25    CopyMultiply: Boolean;
    1926  end;
    2027
     
    3946    MemoryMaxUsed: Integer;
    4047    CellSize: Integer;
     48    Optimizations: TOptimizations;
    4149    constructor Create; override;
    4250    procedure OptimizeSource; override;
     
    259267procedure TBFTarget.OptimizeZeroInitMemory;
    260268begin
    261   // Here optimization related to assumption that initial memory is filled with zeroes
     269  // Here Optimizations related to assumption that initial memory is filled with zeroes
    262270  // Then code for constants preparation can be translated to cmSet commands
    263271  // To eliminate also loops for building constants code need to be somehow interpretted partialy
     
    516524begin
    517525  inherited;
    518   OptimizeAddSub;
     526  if Optimizations.AddSub then OptimizeAddSub;
     527  if Optimizations.Merge then
    519528  repeat
    520529    OldLength := Length(FProgram);
     
    522531  until Length(FProgram) = OldLength;
    523532  OptimizeZeroInitMemory;
    524   OptimizeRelativeIndexes;
    525   OptimizeCopyMultiply;
     533  if Optimizations.RelativeIndexes then OptimizeRelativeIndexes;
     534  if Optimizations.CopyMultiply then OptimizeCopyMultiply;
    526535end;
    527536
Note: See TracChangeset for help on using the changeset viewer.