Browse Source

* LLVM/AArch64: don't perform the parameter location extension workarounds
for LLVM, as that results in LLVM assuming exactly the opposite of
what's intended (namely that the extended locations contain valid
rather than invalid bits)

git-svn-id: trunk@43886 -

Jonas Maebe 5 years ago
parent
commit
3abdec9c95
1 changed files with 34 additions and 33 deletions
  1. 34 33
      compiler/aarch64/cpupara.pas

+ 34 - 33
compiler/aarch64/cpupara.pas

@@ -292,6 +292,7 @@ unit cpupara;
          if not assigned(result.location) or
          if not assigned(result.location) or
             not(result.location^.loc in [LOC_REGISTER,LOC_MMREGISTER,LOC_VOID]) then
             not(result.location^.loc in [LOC_REGISTER,LOC_MMREGISTER,LOC_VOID]) then
            internalerror(2014113001);
            internalerror(2014113001);
+{$ifndef llvm}
          {
          {
            According to ARM64 ABI: "If the size of the argument is less than 8 bytes then
            According to ARM64 ABI: "If the size of the argument is less than 8 bytes then
            the size of the argument is set to 8 bytes. The effect is as if the argument
            the size of the argument is set to 8 bytes. The effect is as if the argument
@@ -310,6 +311,7 @@ unit cpupara;
              result.location^.size:=OS_64;
              result.location^.size:=OS_64;
              result.location^.def:=u64inttype;
              result.location^.def:=u64inttype;
            end;
            end;
+{$endif}
       end;
       end;
 
 
 
 
@@ -486,48 +488,45 @@ unit cpupara;
              end
              end
            else
            else
              begin
              begin
-{$ifndef llvm}
                paraloc^.size:=locsize;
                paraloc^.size:=locsize;
                paraloc^.def:=locdef;
                paraloc^.def:=locdef;
-{$else llvm}
-               case locsize of
-                 OS_8,OS_16,OS_32:
-                   begin
-                     paraloc^.size:=OS_64;
-                     paraloc^.def:=u64inttype;
-                   end;
-                 OS_S8,OS_S16,OS_S32:
-                   begin
-                     paraloc^.size:=OS_S64;
-                     paraloc^.def:=s64inttype;
-                   end;
-                 OS_F32:
-                   begin
-                     paraloc^.size:=OS_F32;
-                     paraloc^.def:=s32floattype;
-                   end;
-                 OS_F64:
-                   begin
-                     paraloc^.size:=OS_F64;
-                     paraloc^.def:=s64floattype;
-                   end;
-                 else
-                   begin
-                     if is_record(locdef) or
-                        is_set(locdef) or
-                        ((locdef.typ=arraydef) and
-                         not is_special_array(locdef)) then
+{$ifdef llvm}
+               if not is_ordinal(paradef) then
+                 begin
+                   case locsize of
+                     OS_8,OS_16,OS_32:
                        begin
                        begin
                          paraloc^.size:=OS_64;
                          paraloc^.size:=OS_64;
                          paraloc^.def:=u64inttype;
                          paraloc^.def:=u64inttype;
-                       end
+                       end;
+                     OS_S8,OS_S16,OS_S32:
+                       begin
+                         paraloc^.size:=OS_S64;
+                         paraloc^.def:=s64inttype;
+                       end;
+                     OS_F32:
+                       begin
+                         paraloc^.size:=OS_F32;
+                         paraloc^.def:=s32floattype;
+                       end;
+                     OS_F64:
+                       begin
+                         paraloc^.size:=OS_F64;
+                         paraloc^.def:=s64floattype;
+                       end;
                      else
                      else
                        begin
                        begin
-                         paraloc^.size:=locsize;
-                         paraloc^.def:=locdef;
+                         if is_record(locdef) or
+                            is_set(locdef) or
+                            ((locdef.typ=arraydef) and
+                             not is_special_array(locdef)) then
+                           begin
+                             paraloc^.size:=OS_64;
+                             paraloc^.def:=u64inttype;
+                           end
                        end;
                        end;
                    end;
                    end;
-               end;
+                 end;
 {$endif llvm}
 {$endif llvm}
              end;
              end;
 
 
@@ -560,6 +559,7 @@ unit cpupara;
                              paraloc^.def:=u32inttype;
                              paraloc^.def:=u32inttype;
                            end;
                            end;
                        end
                        end
+{$ifndef llvm}
                      else
                      else
                        begin
                        begin
                          if side=calleeside then
                          if side=calleeside then
@@ -568,6 +568,7 @@ unit cpupara;
                              paraloc^.def:=u32inttype;
                              paraloc^.def:=u32inttype;
                            end;
                            end;
                        end;
                        end;
+{$endif llvm}
                    end;
                    end;
 
 
                  { in case it's a composite, "The argument is passed as though
                  { in case it's a composite, "The argument is passed as though