瀏覽代碼

support SP and FP alias in the assembler reader too

git-svn-id: trunk@27573 -
Károly Balogh 11 年之前
父節點
當前提交
5535df29d4
共有 1 個文件被更改,包括 17 次插入5 次删除
  1. 17 5
      compiler/m68k/ra68kmot.pas

+ 17 - 5
compiler/m68k/ra68kmot.pas

@@ -201,12 +201,26 @@ const
 
 
     function tm68kmotreader.is_register(const s:string):boolean;
     function tm68kmotreader.is_register(const s:string):boolean;
       begin
       begin
-        is_register:=false;
-        // FIX ME!!! Ugly, needs a proper fix (KB)
+        result:=false;
+        // FIX ME!!! '%'+ is ugly, needs a proper fix (KB)
         actasmregister:=gas_regnum_search('%'+lower(s));
         actasmregister:=gas_regnum_search('%'+lower(s));
         if actasmregister<>NR_NO then
         if actasmregister<>NR_NO then
           begin
           begin
-            is_register:=true;
+            result:=true;
+            actasmtoken:=AS_REGISTER;
+          end;
+        { reg found?
+          possible aliases are always 2 char
+        }
+        if result or (length(s)<>2) then
+          exit;
+        if lower(s)='sp' then
+          actasmregister:=NR_STACK_POINTER_REG;
+        if lower(s)='fp' then
+          actasmregister:=NR_STACK_POINTER_REG;
+        if actasmregister<>NR_NO then
+          begin
+            result:=true;
             actasmtoken:=AS_REGISTER;
             actasmtoken:=AS_REGISTER;
           end;
           end;
       end;
       end;
@@ -1410,7 +1424,6 @@ const
                               if expr = 'SELF' then
                               if expr = 'SELF' then
                                 oper.SetupSelf
                                 oper.SetupSelf
                               else begin
                               else begin
-                                writeln('unknown id: ',expr);
                                 Message1(sym_e_unknown_id,expr);
                                 Message1(sym_e_unknown_id,expr);
                               end;
                               end;
                               expr:='';
                               expr:='';
@@ -1459,7 +1472,6 @@ const
                   end;
                   end;
    { // Register, a variable reference or a constant reference // }
    { // Register, a variable reference or a constant reference // }
      AS_REGISTER: begin
      AS_REGISTER: begin
-//                   writeln('register! ',actasmpattern);
                    { save the type of register used. }
                    { save the type of register used. }
                    tempstr := actasmpattern;
                    tempstr := actasmpattern;
                    Consume(AS_REGISTER);
                    Consume(AS_REGISTER);