+ support for Delphi's {$w-/+} switch (force stackframe generation for

assembler routines or not) (mantis #6687)

git-svn-id: trunk@6151 -
This commit is contained in:
Jonas Maebe 2007-01-23 19:07:56 +00:00
parent ed13c7f60e
commit ddd071b2e4
3 changed files with 44 additions and 0 deletions

1
.gitattributes vendored
View File

@ -7921,6 +7921,7 @@ tests/webtbs/tw6624.pp svneol=native#text/plain
tests/webtbs/tw6641.pp svneol=native#text/plain
tests/webtbs/tw6684.pp svneol=native#text/plain
tests/webtbs/tw6686.pp svneol=native#text/plain
tests/webtbs/tw6687.pp svneol=native#text/plain
tests/webtbs/tw6700.pp svneol=native#text/plain
tests/webtbs/tw6735.pp svneol=native#text/plain
tests/webtbs/tw6742.pp svneol=native#text/plain

View File

@ -776,6 +776,7 @@ implementation
or
- Delphi mode
- assembler directive
- no cs_generate_stackframes in localswitches
- no pushes are used/esp modifications, could be:
* outgoing parameters on the stack
* incoming parameters on the stack
@ -783,6 +784,7 @@ implementation
- no local variables
}
if ((po_assembler in procdef.procoptions) and
not(cs_generate_stackframes in current_settings.localswitches) and
(m_delphi in current_settings.modeswitches) and
(tabstractlocalsymtable(procdef.localst).count_locals = 0)) or
((cs_opt_stackframe in current_settings.optimizerswitches) and

41
tests/webtbs/tw6687.pp Normal file
View File

@ -0,0 +1,41 @@
{ %cpu=i386 }
{ %target=win32,linux,freebsd }
{$w+}
{$ifdef fpc}
{$mode delphi}
{$endif}
{ should generate a stack frame because of w+ above }
function testje(l1,l2,l3: longint): longint;
asm
mov eax, 30000
leave
ret
end;
function test: longint;
var
l1,l2,l3,l4,l5: cardinal;
begin
test := 12345;
l1 := $f00beef;
l2 := $cafebabe;
l3 := $c001d00d;
l4 := $12345678;
l5 := $90abcdef;
if testje(1,2,3) <> 30000 then
halt(1);
if (l1 <> $f00beef) or
(l2 <> $cafebabe) or
(l3 <> $c001d00d) or
(l4 <> $12345678) or
(l5 <> $90abcdef) then
halt(2);
end;
begin
if test <> 12345 then
halt(3);
end.