浏览代码

+ added extra data to the debug comments, generated by a_load_XX_YY

Nikolay Nikolov 1 年之前
父节点
当前提交
4198924fba
共有 2 个文件被更改,包括 27 次插入4 次删除
  1. 11 4
      compiler/mos6502/cgcpu.pas
  2. 16 0
      rtl/mos6502/set.inc

+ 11 - 4
compiler/mos6502/cgcpu.pas

@@ -142,6 +142,13 @@ unit cgcpu;
        procinfo,cpupi,
        procinfo,cpupi,
        paramgr;
        paramgr;
 
 
+    function ref2string(const ref : treference) : string;
+      begin
+        result:='[base:'+std_regname(ref.base)+' index:'+std_regname(ref.index)+' refaddr:' + tostr(ord(ref.refaddr)) + ' offset:' + tostr(ref.offset) + ' symbol:';
+        if (assigned(ref.symbol)) then
+          result := result + ref.symbol.name;
+        result:=result+']';
+      end;
 
 
     function use_push(const cgpara:tcgpara):boolean;
     function use_push(const cgpara:tcgpara):boolean;
       begin
       begin
@@ -1313,7 +1320,7 @@ unit cgcpu;
          href: treference;
          href: treference;
          i: Integer;
          i: Integer;
        begin
        begin
-         list.Concat(tai_comment.Create(strpnew('TODO: a_load_const_ref '+tcgsize2str(size) + ' '+tostr(a))));
+         list.Concat(tai_comment.Create(strpnew('TODO: a_load_const_ref '+tcgsize2str(size) + ' '+tostr(a)+' '+ref2string(ref))));
          mask:=$ff;
          mask:=$ff;
          shift:=0;
          shift:=0;
          href:=ref;
          href:=ref;
@@ -1518,7 +1525,7 @@ unit cgcpu;
        //  i : integer;
        //  i : integer;
        //  regsused: tregisterlist;
        //  regsused: tregisterlist;
        begin
        begin
-         list.Concat(tai_comment.Create(strpnew('TODO: a_load_reg_ref')));
+         list.Concat(tai_comment.Create(strpnew('TODO: a_load_reg_ref '+tcgsize2str(fromsize)+' '+tcgsize2str(tosize)+' '+std_regname(reg)+' '+ref2string(ref))));
          //if (tcgsize2size[fromsize]>32) or (tcgsize2size[tosize]>32) or (fromsize=OS_NO) or (tosize=OS_NO) then
          //if (tcgsize2size[fromsize]>32) or (tcgsize2size[tosize]>32) or (fromsize=OS_NO) or (tosize=OS_NO) then
          //  internalerror(2011021307);
          //  internalerror(2011021307);
          //if tcgsize2size[fromsize]>tcgsize2size[tosize] then
          //if tcgsize2size[fromsize]>tcgsize2size[tosize] then
@@ -1586,7 +1593,7 @@ unit cgcpu;
        //  i : integer;
        //  i : integer;
        //  regsused: tregisterlist;
        //  regsused: tregisterlist;
        begin
        begin
-         list.Concat(tai_comment.Create(strpnew('TODO: a_load_ref_reg')));
+         list.Concat(tai_comment.Create(strpnew('TODO: a_load_ref_reg '+tcgsize2str(fromsize)+' '+tcgsize2str(tosize)+' '+ref2string(Ref)+' '+std_regname(reg))));
          //if (tcgsize2size[fromsize]>32) or (tcgsize2size[tosize]>32) or (fromsize=OS_NO) or (tosize=OS_NO) then
          //if (tcgsize2size[fromsize]>32) or (tcgsize2size[tosize]>32) or (fromsize=OS_NO) or (tosize=OS_NO) then
          //  internalerror(2011021301);
          //  internalerror(2011021301);
          //if tcgsize2size[fromsize]>=tcgsize2size[tosize] then
          //if tcgsize2size[fromsize]>=tcgsize2size[tosize] then
@@ -1648,7 +1655,7 @@ unit cgcpu;
        //  tmpreg : tregister;
        //  tmpreg : tregister;
        //  i : integer;
        //  i : integer;
        begin
        begin
-         list.Concat(tai_comment.Create(strpnew('TODO: a_load_reg_reg')));
+         list.Concat(tai_comment.Create(strpnew('TODO: a_load_reg_reg '+tcgsize2str(fromsize)+' '+tcgsize2str(tosize)+' '+std_regname(reg1)+' '+std_regname(reg2))));
          //if (tcgsize2size[fromsize]>32) or (tcgsize2size[tosize]>32) or (fromsize=OS_NO) or (tosize=OS_NO) then
          //if (tcgsize2size[fromsize]>32) or (tcgsize2size[tosize]>32) or (fromsize=OS_NO) or (tosize=OS_NO) then
          //  internalerror(2011021310);
          //  internalerror(2011021310);
          //if tcgsize2size[fromsize]>tcgsize2size[tosize] then
          //if tcgsize2size[fromsize]>tcgsize2size[tosize] then

+ 16 - 0
rtl/mos6502/set.inc

@@ -12,3 +12,19 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+
+var
+  globala: byte;
+  globalw: word;
+  globaldw: longword;
+  globalqw: qword;
+  ga, gb, gc: byte;
+
+procedure Test6502;
+begin
+  globala := 5;
+  globalw := $1234;
+  globaldw := $12345678;
+  globalqw := $123456789ABCDEF0;
+  ga := gb + gc;
+end;