+ support ugly constructs like 'DD BYTE PTR 5' in the x86 intel syntax inline

assembler; these are TP7 and Delphi compatible

git-svn-id: trunk@39143 -
This commit is contained in:
nickysn 2018-05-29 15:43:08 +00:00
parent 54a8d8de58
commit 49b414ffee
3 changed files with 90 additions and 1 deletions

View File

@ -1064,6 +1064,13 @@ Unit Rax86int;
{ Support ugly delphi constructs like: [ECX].1+2[EDX] }
if (cseif_isref in in_flags) and (actasmtoken=AS_LBRACKET) then
break;
if (cseif_referencelike in in_flags) and
(actasmtoken in [AS_BYTE,AS_WORD,AS_DWORD,AS_QWORD,AS_TBYTE,AS_DQWORD,AS_OWORD,AS_XMMWORD,AS_YWORD,AS_YMMWORD]) then
begin
{ Support ugly tp7 and delphi constructs like 'DD DWORD PTR 5' }
Consume(actasmtoken);
Consume(AS_PTR);
end;
if (cseif_referencelike in in_flags) and
(actasmtoken in [AS_LBRACKET,AS_RBRACKET]) then
case actasmtoken of
@ -2767,6 +2774,16 @@ Unit Rax86int;
end;
ConcatString(curlist,expr);
end;
AS_BYTE,
AS_WORD,
AS_DWORD,
AS_TBYTE,
AS_DQWORD,
AS_QWORD,
AS_OWORD,
AS_XMMWORD,
AS_YWORD,
AS_YMMWORD,
AS_PLUS,
AS_MINUS,
AS_LPAREN,

View File

@ -24,6 +24,24 @@ asm
dd 5+[7] { dd 12 }
dd 5-[7] { dd -2 }
dd [5] { dd 5 }
dd byte ptr Rec.Str { dd Rec.Str }
dd byte ptr Rec.Str[0] { dd Rec.Str }
dd byte ptr Rec.Arr { dd Rec.Arr }
dd byte ptr Rec.Arr[2] { dd Rec.Arr+2 }
dd byte ptr 5[7] { dd 12 }
dd byte ptr 5+[7] { dd 12 }
dd byte ptr 5-[7] { dd -2 }
dd byte ptr [5] { dd 5 }
dd word ptr Rec.Str { dd Rec.Str }
dd word ptr Rec.Str[0] { dd Rec.Str }
dd word ptr Rec.Arr { dd Rec.Arr }
dd word ptr Rec.Arr[2] { dd Rec.Arr+2 }
dd word ptr 5[7] { dd 12 }
dd word ptr 5+[7] { dd 12 }
dd word ptr 5-[7] { dd -2 }
dd word ptr [5] { dd 5 }
end;
begin

View File

@ -23,7 +23,7 @@ var
Rec: TRec;
const
x_size = 8*4+1;
x_size = 4*8*4+1;
procedure x; assembler;
asm
dd Rec.Str { dd Rec.Str }
@ -34,6 +34,33 @@ asm
dd 5+[7] { dd 12 }
dd 5-[7] { dd -2 }
dd [5] { dd 5 }
dd byte ptr Rec.Str { dd Rec.Str }
dd byte ptr Rec.Str[0] { dd Rec.Str }
dd byte ptr Rec.Arr { dd Rec.Arr }
dd byte ptr Rec.Arr[2] { dd Rec.Arr+2 }
dd byte ptr 5[7] { dd 12 }
dd byte ptr 5+[7] { dd 12 }
dd byte ptr 5-[7] { dd -2 }
dd byte ptr [5] { dd 5 }
dd word ptr Rec.Str { dd Rec.Str }
dd word ptr Rec.Str[0] { dd Rec.Str }
dd word ptr Rec.Arr { dd Rec.Arr }
dd word ptr Rec.Arr[2] { dd Rec.Arr+2 }
dd word ptr 5[7] { dd 12 }
dd word ptr 5+[7] { dd 12 }
dd word ptr 5-[7] { dd -2 }
dd word ptr [5] { dd 5 }
dd dword ptr Rec.Str { dd Rec.Str }
dd dword ptr Rec.Str[0] { dd Rec.Str }
dd dword ptr Rec.Arr { dd Rec.Arr }
dd dword ptr Rec.Arr[2] { dd Rec.Arr+2 }
dd dword ptr 5[7] { dd 12 }
dd dword ptr 5+[7] { dd 12 }
dd dword ptr 5-[7] { dd -2 }
dd dword ptr [5] { dd 5 }
end;
procedure x_verify; assembler;
asm
@ -45,6 +72,33 @@ asm
dd 12 { dd 5+[7] }
dd -2 { dd 5-[7] }
dd 5 { dd [5] }
dd Rec.Str { dd byte ptr Rec.Str }
dd Rec.Str { dd byte ptr Rec.Str[0] }
dd Rec.Arr { dd byte ptr Rec.Arr }
dd Rec.Arr+2 { dd byte ptr Rec.Arr[2] }
dd 12 { dd byte ptr 5[7] }
dd 12 { dd byte ptr 5+[7] }
dd -2 { dd byte ptr 5-[7] }
dd 5 { dd byte ptr [5] }
dd Rec.Str { dd word ptr Rec.Str }
dd Rec.Str { dd word ptr Rec.Str[0] }
dd Rec.Arr { dd word ptr Rec.Arr }
dd Rec.Arr+2 { dd word ptr Rec.Arr[2] }
dd 12 { dd word ptr 5[7] }
dd 12 { dd word ptr 5+[7] }
dd -2 { dd word ptr 5-[7] }
dd 5 { dd word ptr [5] }
dd Rec.Str { dd dword ptr Rec.Str }
dd Rec.Str { dd dword ptr Rec.Str[0] }
dd Rec.Arr { dd dword ptr Rec.Arr }
dd Rec.Arr+2 { dd dword ptr Rec.Arr[2] }
dd 12 { dd dword ptr 5[7] }
dd 12 { dd dword ptr 5+[7] }
dd -2 { dd dword ptr 5-[7] }
dd 5 { dd dword ptr [5] }
end;
function CompareCode(cp, cp2: CodePointer; sz: Integer): Boolean;