Bläddra i källkod

+ first part of qwordbool implementation

git-svn-id: trunk@4462 -
florian 19 år sedan
förälder
incheckning
9e66674ff9

+ 10 - 1
compiler/dbgdwarf.pas

@@ -769,6 +769,15 @@ implementation
                   ]);
                 finish_entry;
               end;
+            bool64bit :
+              begin
+                append_entry(DW_TAG_base_type,false,[
+                  DW_AT_name,DW_FORM_string,'QWordBool'#0,
+                  DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean,
+                  DW_AT_byte_size,DW_FORM_data1,8
+                  ]);
+                finish_entry;
+              end;
             u64bit :
               begin
                 append_entry(DW_TAG_base_type,false,[
@@ -893,7 +902,7 @@ implementation
             size:=def.elesize
           else
             size:=def.size;
-          
+
           if not is_packed_array(def) then
             elesize := def.elesize*8
           else

+ 5 - 1
compiler/dbgstabs.pas

@@ -525,7 +525,8 @@ implementation
                     result:=strpnew(def_stab_number(def));
                   bool8bit,
                   bool16bit,
-                  bool32bit :
+                  bool32bit,
+                  bool64bit :
                     result:=def_stabstr_evaluate(def,'r${numberstring};0;255;',[]);
                   u32bit,
                   s64bit,
@@ -550,6 +551,9 @@ implementation
                     result:=strpnew('-22;');
                   bool32bit :
                     result:=strpnew('-23;');
+                  bool64bit :
+                    { no clue if this is correct (FK) }
+                    result:=strpnew('-23;');
                   u64bit :
                     result:=strpnew('-32;');
                   s64bit :

+ 5 - 5
compiler/defcmp.pas

@@ -135,7 +135,7 @@ implementation
            uvoid,
            u8bit,u16bit,u32bit,u64bit,
            s8bit,s16bit,s32bit,s64bit,
-           bool8bit,bool16bit,bool32bit,
+           bool8bit,bool16bit,bool32bit,bool64bit,
            uchar,uwidechar }
 
       type
@@ -145,7 +145,7 @@ implementation
           (bvoid,
            bint,bint,bint,bint,
            bint,bint,bint,bint,
-           bbool,bbool,bbool,
+           bbool,bbool,bbool,bbool,
            bchar,bchar,bint);
 
         basedefconvertsimplicit : array[tbasedef,tbasedef] of tconverttype =
@@ -229,7 +229,7 @@ implementation
                                 end;
                             end;
                           uvoid,
-                          bool8bit,bool16bit,bool32bit:
+                          bool8bit,bool16bit,bool32bit,bool64bit:
                             eq:=te_equal;
                           else
                             internalerror(200210061);
@@ -1330,8 +1330,8 @@ implementation
                 u8bit,u16bit,u32bit,u64bit,
                 s8bit,s16bit,s32bit,s64bit :
                   is_subequal:=(torddef(def2).typ in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
-                bool8bit,bool16bit,bool32bit :
-                  is_subequal:=(torddef(def2).typ in [bool8bit,bool16bit,bool32bit]);
+                bool8bit,bool16bit,bool32bit,bool64bit :
+                  is_subequal:=(torddef(def2).typ in [bool8bit,bool16bit,bool32bit,bool64bit]);
                 uchar :
                   is_subequal:=(torddef(def2).typ=uchar);
                 uwidechar :

+ 2 - 2
compiler/defutil.pas

@@ -333,7 +333,7 @@ implementation
                is_ordinal:=dt in [uchar,uwidechar,
                                   u8bit,u16bit,u32bit,u64bit,
                                   s8bit,s16bit,s32bit,s64bit,
-                                  bool8bit,bool16bit,bool32bit];
+                                  bool8bit,bool16bit,bool32bit,bool64bit];
              end;
            enumdef :
              is_ordinal:=true;
@@ -384,7 +384,7 @@ implementation
     function is_boolean(def : tdef) : boolean;
       begin
         is_boolean:=(def.deftype=orddef) and
-                    (torddef(def).typ in [bool8bit,bool16bit,bool32bit]);
+                    (torddef(def).typ in [bool8bit,bool16bit,bool32bit,bool64bit]);
       end;
 
 

+ 12 - 4
compiler/ninl.pas

@@ -661,7 +661,8 @@ implementation
 {$endif cpu64bit}
                         bool8bit,
                         bool16bit,
-                        bool32bit :
+                        bool32bit,
+                        bool64bit:
                           begin
                             if do_read then
                               begin
@@ -1238,7 +1239,7 @@ implementation
           tempindex: TConstExprInt;
         begin
           resulttype:=voidtype;
-          
+
           unpackedarraydef := nil;
           packedarraydef := nil;
           source := tcallparanode(left);
@@ -1281,7 +1282,7 @@ implementation
             begin
               { index must be compatible with the unpacked array's indextype }
               inserttypeconv(index.left,unpackedarraydef.rangetype);
-              
+
               { range check at compile time if possible }
               if assigned(packedarraydef) and
                  (index.left.nodetype = ordconstn) and
@@ -1301,7 +1302,7 @@ implementation
           { index in the unpacked array is read and must be valid }
           set_varstate(index.left,vs_read,[vsf_must_be_valid]);
         end;
-      
+
 
 
       var
@@ -1513,6 +1514,13 @@ implementation
                                left:=nil;
                                result:=hp;
                              end;
+                           bool64bit :
+                             begin
+                               { change to qword() }
+                               hp:=ctypeconvnode.create_internal(left,u64inttype);
+                               left:=nil;
+                               result:=hp;
+                             end;
                            uvoid :
                              CGMessage1(type_e_ordinal_expr_expected,left.resulttype.def.typename);
                            else

+ 2 - 1
compiler/nmat.pas

@@ -803,7 +803,8 @@ implementation
              case torddef(left.resulttype.def).typ of
                bool8bit,
                bool16bit,
-               bool32bit :
+               bool32bit,
+               bool64bit:
                  begin
                    { here we do a boolean(byte(..)) type cast because }
                    { boolean(<int64>) is buggy in 1.00                }

+ 2 - 2
compiler/powerpc/cgcpu.pas

@@ -547,7 +547,7 @@ const
            end
          else
            instr := taicpu.op_reg_reg(A_MR,reg2,reg1);
-           
+
          list.concat(instr);
          rg[R_INTREGISTER].add_move_instruction(instr);
        end;
@@ -1993,7 +1993,7 @@ const
          if not ((def.deftype=pointerdef) or
                 ((def.deftype=orddef) and
                  (torddef(def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
-                                                  bool8bit,bool16bit,bool32bit]))) then
+                                                  bool8bit,bool16bit,bool32bit,bool64bit]))) then
            begin
              list.concat(taicpu.op_reg(A_MCRXR,NR_CR7));
              a_jmp(list,A_BC,C_NO,7,hl)

+ 4 - 0
compiler/psystem.pas

@@ -138,6 +138,7 @@ implementation
         booltype.setdef(torddef.create(bool8bit,0,1));
         bool16type.setdef(torddef.create(bool16bit,0,1));
         bool32type.setdef(torddef.create(bool32bit,0,1));
+        bool64type.setdef(torddef.create(bool64bit,0,1));
         cchartype.setdef(torddef.create(uchar,0,255));
         cwidechartype.setdef(torddef.create(uwidechar,0,65535));
         cshortstringtype.setdef(tstringdef.createshort(255));
@@ -253,6 +254,7 @@ implementation
         addtype('ByteBool',booltype);
         addtype('WordBool',bool16type);
         addtype('LongBool',bool32type);
+        addtype('QWordBool',bool64type);
         addtype('Byte',u8inttype);
         addtype('ShortInt',s8inttype);
         addtype('Word',u16inttype);
@@ -289,6 +291,7 @@ implementation
         addtype('$boolean',booltype);
         addtype('$boolean16',bool16type);
         addtype('$boolean32',bool32type);
+        addtype('$boolean64',bool32type);
         addtype('$void_pointer',voidpointertype);
         addtype('$char_pointer',charpointertype);
         addtype('$widechar_pointer',widecharpointertype);
@@ -373,6 +376,7 @@ implementation
         loadtype('boolean',booltype);
         loadtype('boolean16',bool16type);
         loadtype('boolean32',bool32type);
+        loadtype('boolean64',bool32type);
         loadtype('void_pointer',voidpointertype);
         loadtype('char_pointer',charpointertype);
         loadtype('widechar_pointer',widecharpointertype);

+ 7 - 0
compiler/ptconst.pas

@@ -130,6 +130,13 @@ implementation
                          else
                            Message(parser_e_illegal_expression);
                       end;
+                    bool64bit :
+                      begin
+                         if is_constboolnode(p) then
+                           datalist.concat(Tai_const.Create_64bit(int64(tordconstnode(p).value)))
+                         else
+                           Message(parser_e_illegal_expression);
+                      end;
                     uchar :
                       begin
                          if is_constcharnode(p) then

+ 1 - 1
compiler/ptype.pas

@@ -479,7 +479,7 @@ implementation
 {$ifdef cpu64bit}
                     u32bit,s64bit,
 {$endif cpu64bit}
-                    bool8bit,bool16bit,bool32bit,
+                    bool8bit,bool16bit,bool32bit,bool64bit,
                     uwidechar] then
                     begin
                        lowval:=torddef(t.def).low;

+ 1 - 1
compiler/symconst.pas

@@ -175,7 +175,7 @@ type
     uvoid,
     u8bit,u16bit,u32bit,u64bit,
     s8bit,s16bit,s32bit,s64bit,
-    bool8bit,bool16bit,bool32bit,
+    bool8bit,bool16bit,bool32bit,bool64bit,
     uchar,uwidechar,scurrency
   );
 

+ 5 - 5
compiler/symdef.pas

@@ -1675,7 +1675,7 @@ implementation
           0,
           1,2,4,8,
           1,2,4,8,
-          1,2,4,
+          1,2,4,8,
           1,2,8
         );
       begin
@@ -1714,7 +1714,7 @@ implementation
           varUndefined,
           varbyte,varqword,varlongword,varqword,
           varshortint,varsmallint,varinteger,varint64,
-          varboolean,varUndefined,varUndefined,
+          varboolean,varUndefined,varUndefined,varUndefined,
           varUndefined,varUndefined,varCurrency);
       begin
         result:=basetype2vartype[typ];
@@ -1747,7 +1747,7 @@ implementation
             (otUByte{otNone},
              otUByte,otUWord,otULong,otUByte{otNone},
              otSByte,otSWord,otSLong,otUByte{otNone},
-             otUByte,otUWord,otULong,
+             otUByte,otUWord,otULong,otUByte,
              otUByte,otUWord,otUByte);
         begin
           write_rtti_name;
@@ -1825,7 +1825,7 @@ implementation
           'untyped',
           'Byte','Word','DWord','QWord',
           'ShortInt','SmallInt','LongInt','Int64',
-          'Boolean','WordBool','LongBool',
+          'Boolean','WordBool','LongBool','QWordBool',
           'Char','WideChar','Currency');
 
       begin
@@ -3962,7 +3962,7 @@ implementation
              '',
              'Uc','Us','Ui','Us',
              'Sc','s','i','x',
-             'b','b','b',
+             'b','b','b','b',
              'c','w','x');
 
         var

+ 1 - 1
compiler/x86/cgx86.pas

@@ -1898,7 +1898,7 @@ unit cgx86;
          if not ((def.deftype=pointerdef) or
                 ((def.deftype=orddef) and
                  (torddef(def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
-                                       bool8bit,bool16bit,bool32bit]))) then
+                                       bool8bit,bool16bit,bool32bit,bool64bit]))) then
            cond:=C_NO
          else
            cond:=C_NB;