فهرست منبع

* support of dq in Intel assembler on 64 bit CPUs, resolves #11425

git-svn-id: trunk@11211 -
florian 17 سال پیش
والد
کامیت
58757d0630
3فایلهای تغییر یافته به همراه34 افزوده شده و 11 حذف شده
  1. 1 0
      .gitattributes
  2. 23 11
      compiler/x86/rax86int.pas
  3. 10 0
      tests/tbs/tb0551.pp

+ 1 - 0
.gitattributes

@@ -6974,6 +6974,7 @@ tests/tbs/tb0549.pp svneol=native#text/plain
 tests/tbs/tb0550.pp svneol=native#text/plain
 tests/tbs/tb0550a.pp svneol=native#text/plain
 tests/tbs/tb0550b.pp svneol=native#text/plain
+tests/tbs/tb0551.pp svneol=native#text/plain
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain

+ 23 - 11
compiler/x86/rax86int.pas

@@ -40,7 +40,7 @@ Unit Rax86int;
       AS_RPAREN,AS_COLON,AS_DOT,AS_PLUS,AS_MINUS,AS_STAR,
       AS_SEPARATOR,AS_ID,AS_REGISTER,AS_OPCODE,AS_SLASH,
        {------------------ Assembler directives --------------------}
-      AS_ALIGN,AS_DB,AS_DW,AS_DD,AS_END,
+      AS_ALIGN,AS_DB,AS_DW,AS_DD,AS_DQ,AS_END,
        {------------------ Assembler Operators  --------------------}
       AS_BYTE,AS_WORD,AS_DWORD,AS_QWORD,AS_TBYTE,AS_DQWORD,AS_NEAR,AS_FAR,
       AS_HIGH,AS_LOW,AS_OFFSET,AS_SIZEOF,AS_VMTOFFSET,AS_SEG,AS_TYPE,AS_PTR,AS_MOD,AS_SHL,AS_SHR,AS_NOT,
@@ -109,7 +109,7 @@ Unit Rax86int;
        _count_asmoperators  = longint(lastoperator)-longint(firstoperator);
 
        _asmdirectives : array[0.._count_asmdirectives] of tasmkeyword =
-       ('ALIGN','DB','DW','DD','END');
+       ('ALIGN','DB','DW','DD','DQ','END');
 
        { problems with shl,shr,not,and,or and xor, they are }
        { context sensitive.                                 }
@@ -123,7 +123,7 @@ Unit Rax86int;
         ',','[',']','(',
         ')',':','.','+','-','*',
         ';','identifier','register','opcode','/',
-        '','','','','END',
+        '','','','','','END',
         '','','','','','','','','',
         '','','sizeof','vmtoffset','','type','ptr','mod','shl','shr','not',
         'and','or','xor'
@@ -877,7 +877,7 @@ Unit Rax86int;
                        if mangledname<>'' then
                          { procsym }
                          Message(asmr_e_wrong_sym_type);
-                     end                         
+                     end
                    else
                     begin
                       searchsym(tempstr,sym,srsymtable);
@@ -1069,6 +1069,7 @@ Unit Rax86int;
             AS_DB,
             AS_DW,
             AS_DD,
+            AS_DQ,
             AS_END,
             AS_RBRACKET,
             AS_SEPARATOR,
@@ -1148,7 +1149,7 @@ Unit Rax86int;
 
           Case actasmtoken of
             AS_ID, { Constant reference expression OR variable reference expression }
-            AS_VMTOFFSET: 
+            AS_VMTOFFSET:
               Begin
                 if not GotPlus then
                   Message(asmr_e_invalid_reference_syntax);
@@ -2039,6 +2040,7 @@ Unit Rax86int;
             AS_DB,
             AS_DW,
             AS_DD,
+            AS_DQ,
             AS_OPCODE,
             AS_END,
             AS_SEPARATOR:
@@ -2118,13 +2120,23 @@ Unit Rax86int;
               inexpression:=false;
             end;
 
-           AS_ALIGN:
-             Begin
-               Consume(AS_ALIGN);
-               ConcatAlign(curlist,BuildConstExpression);
-               if actasmtoken<>AS_SEPARATOR then
+{$ifdef cpu64bitaddr}
+          AS_DQ:
+            Begin
+              inexpression:=true;
+              Consume(AS_DQ);
+              BuildConstant(8);
+              inexpression:=false;
+            end;
+{$endif cpu64bitaddr}
+
+          AS_ALIGN:
+            Begin
+              Consume(AS_ALIGN);
+              ConcatAlign(curlist,BuildConstExpression);
+              if actasmtoken<>AS_SEPARATOR then
                 Consume(AS_SEPARATOR);
-             end;
+            end;
 
           AS_OPCODE :
             Begin

+ 10 - 0
tests/tbs/tb0551.pp

@@ -0,0 +1,10 @@
+{ %cpu=x86_64 }
+{ %norun }
+
+{$asmmode intel}
+begin
+  asm
+    dq 123456789101213
+  end;
+end.
+