Browse Source

+ introduced cgbase.topcg2str and topcmp2str for converting TOpCg and TOpCmp to strings (useful for debug logging, etc)

Nikolay Nikolov 1 year ago
parent
commit
2e65a5d458
1 changed files with 14 additions and 0 deletions
  1. 14 0
      compiler/cgbase.pas

+ 14 - 0
compiler/cgbase.pas

@@ -511,6 +511,8 @@ interface
     function double_array_cgsize(const a: tcgint): tcgsize;{$ifdef USEINLINE}inline;{$endif}
     function double_array_cgsize(const a: tcgint): tcgsize;{$ifdef USEINLINE}inline;{$endif}
 
 
     function tcgsize2str(cgsize: tcgsize):string;
     function tcgsize2str(cgsize: tcgsize):string;
+    function topcg2str(opcg: topcg):string;
+    function topcmp2str(opcmp: topcmp):string;
 
 
     { return the inverse condition of opcmp }
     { return the inverse condition of opcmp }
     function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif}
     function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif}
@@ -873,6 +875,18 @@ implementation
       end;
       end;
 
 
 
 
+    function topcg2str(opcg: topcg):string;
+      begin
+        Str(opcg, Result);
+      end;
+
+
+    function topcmp2str(opcmp: topcmp):string;
+      begin
+        Str(opcmp, Result);
+      end;
+
+
     function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif}
     function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif}
       const
       const
         list: array[TOpCmp] of TOpCmp =
         list: array[TOpCmp] of TOpCmp =