summaryrefslogtreecommitdiff
path: root/compiler/ncgmem.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-06-03 20:08:50 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-06-03 20:08:50 +0000
commit0e03b05608fb5490ab6e57997646686d79354c09 (patch)
treec1ef61f512354424e70d92514817977e012cfbf1 /compiler/ncgmem.pas
parent48040693122b988ffb710dd75147050d724d20ef (diff)
downloadfpc-0e03b05608fb5490ab6e57997646686d79354c09.tar.gz
* fixed ABI compliance for parameter passing and function returning on all
x86-64 platforms (except for win64, which uses another ABI and which already complied to it) + test * fixed returning records containing 1 single or double field on darwin/i386, these have to be returned via ST0 instead of as a regular record * added support for LOC_FPUREGISTER and LOC_MMREGISTER in several places where they can now occur due to the previous two changes * made a few internalerrors unique git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15368 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncgmem.pas')
-rw-r--r--compiler/ncgmem.pas17
1 files changed, 14 insertions, 3 deletions
diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas
index d8e0f7d65c..dd7c9c22e4 100644
--- a/compiler/ncgmem.pas
+++ b/compiler/ncgmem.pas
@@ -366,7 +366,9 @@ implementation
LOC_CREFERENCE:
;
LOC_REGISTER,
- LOC_CREGISTER:
+ LOC_CREGISTER,
+ LOC_MMREGISTER,
+ LOC_FPUREGISTER:
begin
// in case the result is not something that can be put
// into an integer register (e.g.
@@ -374,7 +376,8 @@ implementation
// a function returning a value > sizeof(intreg))
// -> force to memory
if not tstoreddef(left.resultdef).is_intregable or
- not tstoreddef(resultdef).is_intregable then
+ not tstoreddef(resultdef).is_intregable or
+ (location.loc in [LOC_MMREGISTER,LOC_FPUREGISTER]) then
location_force_mem(current_asmdata.CurrAsmList,location)
else
begin
@@ -804,7 +807,15 @@ implementation
location.reference.alignment:=sizeof(pint);
end
else
- location_copy(location,left.location);
+ begin
+ { may happen in case of function results }
+ case left.location.loc of
+ LOC_REGISTER,
+ LOC_MMREGISTER:
+ location_force_mem(current_asmdata.CurrAsmList,left.location);
+ end;
+ location_copy(location,left.location);
+ end;
{ location must be memory }
if not(location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then