Ver código fonte

+ non-functional 128 bit integer types (inaccessible from Pascal), for use
in the LLVM high level code generator to implement overflow checking

git-svn-id: trunk@32735 -

Jonas Maebe 9 anos atrás
pai
commit
9258b5d76b

+ 2 - 2
compiler/defcmp.pas

@@ -193,8 +193,8 @@ implementation
       const
         basedeftbl:array[tordtype] of tbasedef =
           (bvoid,
-           bint,bint,bint,bint,
-           bint,bint,bint,bint,
+           bint,bint,bint,bint,bint,
+           bint,bint,bint,bint,bint,
            bbool,bbool,bbool,bbool,
            bbool,bbool,bbool,bbool,
            bchar,bchar,bint);

+ 2 - 2
compiler/htypechk.pas

@@ -2999,8 +2999,8 @@ implementation
     function get_variantequaltype(def: tdef): tvariantequaltype;
       const
         variantorddef_cl: array[tordtype] of tvariantequaltype =
-          (tve_incompatible,tve_byte,tve_word,tve_cardinal,tve_chari64,
-           tve_shortint,tve_smallint,tve_longint,tve_chari64,
+          (tve_incompatible,tve_byte,tve_word,tve_cardinal,tve_chari64,tve_incompatible,
+           tve_shortint,tve_smallint,tve_longint,tve_chari64,tve_incompatible,
            tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal,
            tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal,
            tve_chari64,tve_chari64,tve_dblcurrency);

+ 2 - 2
compiler/ncgrtti.pas

@@ -612,8 +612,8 @@ implementation
           const
             trans : array[tordtype] of byte =
               (otUByte{otNone},
-               otUByte,otUWord,otULong,otUByte{otNone},
-               otSByte,otSWord,otSLong,otUByte{otNone},
+               otUByte,otUWord,otULong,otUByte{otNone},otUByte{otNone},
+               otSByte,otSWord,otSLong,otUByte{otNone},otUByte{otNone},
                otUByte,otUWord,otULong,otUByte,
                otSByte,otSWord,otSLong,otSByte,
                otUByte,otUWord,otUByte);

+ 1 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion = 180;
+  CurrentPPUVersion = 181;
 
 { buffer sizes }
   maxentrysize = 1024;

+ 10 - 0
compiler/psystem.pas

@@ -229,6 +229,12 @@ implementation
         s32inttype:=corddef.create(s32bit,int64(low(longint)),int64(high(longint)),true);
         u64inttype:=corddef.create(u64bit,low(qword),high(qword),true);
         s64inttype:=corddef.create(s64bit,low(int64),high(int64),true);
+        { upper/lower bound not yet properly set for 128 bit types, as we don't
+          support them yet at the Pascal level (nor for tconstexprint); they're
+          only used internally by the high level code generator for LLVM to
+          implement overflow checking }
+        u128inttype:=corddef.create(u128bit,0,0,true);
+        s128inttype:=corddef.create(s128bit,0,0,true);
         pasbool8type:=corddef.create(pasbool8,0,1,true);
         pasbool16type:=corddef.create(pasbool16,0,1,true);
         pasbool32type:=corddef.create(pasbool32,0,1,true);
@@ -435,6 +441,8 @@ implementation
         addtype('$longint',s32inttype);
         addtype('$qword',u64inttype);
         addtype('$int64',s64inttype);
+        addtype('$uint128',u128inttype);
+        addtype('$int128',s128inttype);
         addtype('$char',cansichartype);
         addtype('$widechar',cwidechartype);
         addtype('$shortstring',cshortstringtype);
@@ -559,6 +567,8 @@ implementation
         loadtype('longint',s32inttype);
         loadtype('qword',u64inttype);
         loadtype('int64',s64inttype);
+        loadtype('uint128',u128inttype);
+        loadtype('int128',s128inttype);
         loadtype('undefined',cundefinedtype);
         loadtype('formal',cformaltype);
         loadtype('typedformal',ctypedformaltype);

+ 5 - 7
compiler/symconst.pas

@@ -218,12 +218,10 @@ type
       it was used to set the type of a paraloc, since paralocs are reused
       across units) -- never stored to ppu, because in that case the def would
       be registered }
-    df_not_registered_no_free
-{$ifdef llvm}
-    { can't do this via symllvm because we have to access it in symtable }
-    ,
+    df_not_registered_no_free,
+    { don't pack this record at the llvm level -- can't do this via symllvm
+      because we have to access this information in the symtable unit }
     df_llvm_no_struct_packing
-{$endif llvm}
   );
   tdefoptions=set of tdefoption;
 
@@ -259,8 +257,8 @@ type
   { base types for orddef }
   tordtype = (
     uvoid,
-    u8bit,u16bit,u32bit,u64bit,
-    s8bit,s16bit,s32bit,s64bit,
+    u8bit,u16bit,u32bit,u64bit,u128bit,
+    s8bit,s16bit,s32bit,s64bit,s128bit,
     pasbool8,pasbool16,pasbool32,pasbool64,
     bool8bit,bool16bit,bool32bit,bool64bit,
     uchar,uwidechar,scurrency

+ 12 - 10
compiler/symdef.pas

@@ -1035,6 +1035,8 @@ interface
        s32inttype,                { 32-Bit signed integer }
        u64inttype,                { 64-bit unsigned integer }
        s64inttype,                { 64-bit signed integer }
+       u128inttype,               { 128-bit unsigned integer }
+       s128inttype,               { 128-bit signed integer }
        s32floattype,              { 32 bit floating point number }
        s64floattype,              { 64 bit floating point number }
        s80floattype,              { 80 bit floating point number }
@@ -2763,8 +2765,8 @@ implementation
       const
         sizetbl : array[tordtype] of longint = (
           0,
-          1,2,4,8,
-          1,2,4,8,
+          1,2,4,8,16,
+          1,2,4,8,16,
           1,2,4,8,
           1,2,4,8,
           1,2,8
@@ -2813,8 +2815,8 @@ implementation
       const
         basetype2vardef : array[tordtype] of longint = (
           varUndefined,
-          varbyte,varword,varlongword,varqword,
-          varshortint,varsmallint,varinteger,varint64,
+          varbyte,varword,varlongword,varqword,varUndefined,
+          varshortint,varsmallint,varinteger,varint64,varUndefined,
           varboolean,varboolean,varboolean,varboolean,
           varboolean,varboolean,varUndefined,varUndefined,
           varUndefined,varUndefined,varCurrency);
@@ -2843,8 +2845,8 @@ implementation
       const
         names : array[tordtype] of string[20] = (
           'untyped',
-          'Byte','Word','DWord','QWord',
-          'ShortInt','SmallInt','LongInt','Int64',
+          'Byte','Word','DWord','QWord','UInt128',
+          'ShortInt','SmallInt','LongInt','Int64','Int128',
           'Boolean','Boolean16','Boolean32','Boolean64',
           'ByteBool','WordBool','LongBool','QWordBool',
           'Char','WideChar','Currency');
@@ -5952,15 +5954,15 @@ implementation
 {$ifdef NAMEMANGLING_GCC2}
            ordtype2str : array[tordtype] of string[2] = (
              '',
-             'Uc','Us','Ui','Us',
-             'Sc','s','i','x',
+             'Uc','Us','Ui','Us','',
+             'Sc','s','i','x','',
              'b','b','b','b','b',
              'c','w','x');
 {$else NAMEMANGLING_GCC2}
            ordtype2str : array[tordtype] of string[1] = (
              'v',
-             'h','t','j','y',
-             'a','s','i','x',
+             'h','t','j','y','',
+             'a','s','i','x','',
              'b','b','b','b',
              'b','b','b','b',
              'c','w','x');

+ 2 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -1423,7 +1423,8 @@ const
      (mask:df_copied_def;     str:'Copied Typedef'),
      (mask:df_genconstraint;  str:'Generic Constraint'),
      { this should never happen for defs stored to a ppu file }
-     (mask:df_not_registered_no_free;  str:'Unregistered/No free (invalid)')
+     (mask:df_not_registered_no_free;  str:'Unregistered/No free (invalid)'),
+     (mask:df_llvm_no_struct_packing;  str:'LLVM unpacked struct')
   );
   defstate : array[1..ord(high(tdefstate))] of tdefstateinfo=(
      (mask:ds_vmt_written;           str:'VMT Written'),