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.
Location:
trunk/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms

    • Property svn:ignore set to
      *.lrj
  • trunk/Forms/UFormMain.pas

    r90 r91  
    77uses
    88  Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs,
    9   Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry, URegistry, Process,
     9  Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry, URegistry,
    1010  LazFileUtils;
    1111
     
    305305    if not Assigned(Core.CurrentTarget) then
    306306      Core.CurrentTarget := TTarget(Core.Targets[0]);
     307    Core.Optimizations.AddSub := ReadBoolWithDefault('OptimizationAddSubEnabled', True);
     308    Core.Optimizations.Merge := ReadBoolWithDefault('OptimizationMerge', True);
     309    Core.Optimizations.CopyMultiply := ReadBoolWithDefault('OptimizationCopyMultiplyEnabled', True);
     310    Core.Optimizations.RelativeIndexes := ReadBoolWithDefault('OptimizationRelativeIndexesEnabled', True);
    307311  finally
    308312    Free;
     
    317321    OpenKey(Key, True);
    318322    WriteString('TargetName', Core.CurrentTarget.Name);
     323    WriteBool('OptimizationAddSubEnabled', Core.Optimizations.AddSub);
     324    WriteBool('OptimizationMerge', Core.Optimizations.Merge);
     325    WriteBool('OptimizationCopyMultiplyEnabled', Core.Optimizations.CopyMultiply);
     326    WriteBool('OptimizationRelativeIndexesEnabled', Core.Optimizations.RelativeIndexes);
    319327  finally
    320328    Free;
     
    458466procedure TFormMain.AOptionsExecute(Sender: TObject);
    459467begin
    460   OptionsForm.Load;
    461   if OptionsForm.ShowModal = mrOK then begin
    462     OptionsForm.Save;
    463     if Assigned(Core.CurrentTarget) then begin
    464       Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
    465       if Core.CurrentTarget is TBFTarget then begin
    466         TBFTarget(Core.CurrentTarget).CellSize := Core.CellSize;
    467         TBFTarget(Core.CurrentTarget).MemorySize := Core.MemorySize;
     468  FormOptions := TFormOptions.Create(nil);
     469  try
     470    FormOptions.Load;
     471    if FormOptions.ShowModal = mrOK then begin
     472      FormOptions.Save;
     473      if Assigned(Core.CurrentTarget) then begin
     474        Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
     475        if Core.CurrentTarget is TBFTarget then begin
     476          TBFTarget(Core.CurrentTarget).CellSize := Core.CellSize;
     477          TBFTarget(Core.CurrentTarget).MemorySize := Core.MemorySize;
     478        end;
    468479      end;
    469480    end;
     481  finally
     482    FormOptions.Free;
    470483  end;
    471484end;
     
    479492    ProjectFileName := Core.Project.FileName;
    480493    ProgramName := ExtractFileNameOnly(Core.Project.FileName);
     494    if Core.CurrentTarget is TBFTarget then
     495      TBFTarget(Core.CurrentTarget).Optimizations := Core.Optimizations;
    481496    Core.CurrentTarget.Messages.AddMessage(SCompileStart);
    482497    Application.ProcessMessages;
Note: See TracChangeset for help on using the changeset viewer.