Browse Source

--- Merging r14402 into '.':
A tests/webtbs/tw6851.pp
U compiler/x86/rax86int.pas
--- Merging r14449 into '.':
G compiler/x86/rax86int.pas
--- Merging r14843 into '.':
G compiler/x86/rax86int.pas

git-svn-id: branches/fixes_2_4@15188 -

Jonas Maebe 15 years ago
parent
commit
6b4fa38dd3
3 changed files with 56 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 15 0
      compiler/x86/rax86int.pas
  3. 40 0
      tests/webtbs/tw6851.pp

+ 1 - 0
.gitattributes

@@ -10110,6 +10110,7 @@ tests/webtbs/tw6769.pp svneol=native#text/plain
 tests/webtbs/tw6822a.pp svneol=native#text/plain
 tests/webtbs/tw6822b.pp svneol=native#text/plain
 tests/webtbs/tw6822c.pp svneol=native#text/plain
+tests/webtbs/tw6851.pp svneol=native#text/plain
 tests/webtbs/tw6865.pp svneol=native#text/plain
 tests/webtbs/tw6868.pp svneol=native#text/plain
 tests/webtbs/tw6960.pp svneol=native#text/plain

+ 15 - 0
compiler/x86/rax86int.pas

@@ -225,9 +225,22 @@ Unit Rax86int;
 
 
     function tx86intreader.is_register(const s:string):boolean;
+      var
+        entry: TSymEntry;
       begin
         is_register:=false;
         actasmregister:=masm_regnum_search(lower(s));
+        if (actasmregister=NR_NO) and
+           (current_procinfo.procdef.proccalloption=pocall_register) and
+           (po_assembler in current_procinfo.procdef.procoptions) then
+          begin
+            entry:=current_procinfo.procdef.parast.Find(s);
+            if assigned(entry) and
+               (entry.typ=paravarsym) and
+               assigned(tparavarsym(entry).paraloc[calleeside].Location) and
+               (tparavarsym(entry).paraloc[calleeside].Location^.Loc=LOC_REGISTER) then
+              actasmregister:=tparavarsym(entry).paraloc[calleeside].Location^.register;
+          end;
         if actasmregister<>NR_NO then
           begin
             is_register:=true;
@@ -2081,6 +2094,8 @@ Unit Rax86int;
       curlist:=TAsmList.Create;
       { setup label linked list }
       LocalLabelList:=TLocalLabelList.Create;
+      { we might need to know which parameters are passed in registers }
+      current_procinfo.generate_parameter_info;
       { start tokenizer }
       c:=current_scanner.asmgetcharstart;
       gettoken;

+ 40 - 0
tests/webtbs/tw6851.pp

@@ -0,0 +1,40 @@
+{ %norun }
+{ %cpu=i386 }
+{ %opt=-Cg- }
+
+{$mode delphi}
+
+program test;
+
+const
+
+  BitMaskTable: Array[0..31] of LongWord =
+    ($00000001, $00000002, $00000004, $00000008,
+     $00000010, $00000020, $00000040, $00000080,
+     $00000100, $00000200, $00000400, $00000800,
+     $00001000, $00002000, $00004000, $00008000,
+     $00010000, $00020000, $00040000, $00080000,
+     $00100000, $00200000, $00400000, $00800000,
+     $01000000, $02000000, $04000000, $08000000,
+     $10000000, $20000000, $40000000, $80000000);
+
+  BitsPerByte      = 8;
+  BitsPerWord      = 16;
+  BitsPerLongWord  = 32;
+  BytesPerCardinal = Sizeof(Cardinal);
+  BitsPerCardinal  = BytesPerCardinal * 8;
+
+
+function SetBit(const Value, BitIndex: LongWord): LongWord;
+asm
+     {$IFOPT R+}
+      CMP     BitIndex, BitsPerLongWord
+      JAE     @Fin
+     {$ENDIF}
+      OR      EAX, DWORD PTR [BitIndex * 4 + BitMaskTable]
+    @Fin:
+end;
+
+begin
+
+end.