From 0b246f3dbdb52eed561e978643974b1fc1ff60cc Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 16 Oct 2018 21:14:18 +0000 Subject: [PATCH] * converted Boolean8 to an internal type, and mapped Boolean to the new internal pasbool1(type) (part of mantis #34411) o apply the _Bool x86-64 parameter passing rules only to pasbool1 git-svn-id: trunk@39949 - --- .gitattributes | 4 +- compiler/arm/cgcpu.pas | 2 +- compiler/arm/narmadd.pas | 2 +- compiler/avr/cgcpu.pas | 2 +- compiler/dbgdwarf.pas | 11 ++- compiler/dbgstabs.pas | 2 + compiler/defcmp.pas | 8 +- compiler/defutil.pas | 11 ++- compiler/htypechk.pas | 132 ++++++++++++++--------------- compiler/i8086/n8086add.pas | 12 +-- compiler/jvm/hlcgcpu.pas | 6 +- compiler/jvm/jvmdef.pas | 3 + compiler/jvm/njvmcnv.pas | 2 +- compiler/jvm/njvminl.pas | 2 +- compiler/llvm/hlcgllvm.pas | 2 +- compiler/llvm/llvmdef.pas | 3 +- compiler/m68k/cgcpu.pas | 2 +- compiler/nadd.pas | 76 ++++++++--------- compiler/ncal.pas | 4 +- compiler/ncgrtti.pas | 3 +- compiler/ncnv.pas | 10 +-- compiler/nflw.pas | 8 +- compiler/ngtcon.pas | 1 + compiler/ninl.pas | 12 +-- compiler/nmat.pas | 1 + compiler/nset.pas | 14 +-- compiler/pdecvar.pas | 2 +- compiler/ppcgen/cgppc.pas | 2 +- compiler/ppcgen/ngppcadd.pas | 4 +- compiler/psystem.pas | 16 ++-- compiler/ptype.pas | 4 +- compiler/scanner.pas | 2 +- compiler/sparcgen/cgsparc.pas | 2 +- compiler/symconst.pas | 2 +- compiler/symdef.pas | 15 ++-- compiler/utils/ppuutils/ppudump.pp | 6 ++ compiler/x86/cgx86.pas | 2 +- compiler/x86_64/cpupara.pas | 2 +- rtl/inc/systemh.inc | 1 - 39 files changed, 214 insertions(+), 181 deletions(-) diff --git a/.gitattributes b/.gitattributes index eb81fe1a94..e7b89e97a6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -192,7 +192,7 @@ compiler/hlcg2ll.pas svneol=native#text/plain compiler/hlcgobj.pas svneol=native#text/plain compiler/html/i386/readme.txt svneol=native#text/plain compiler/html/powerpc/readme.txt svneol=native#text/plain -compiler/htypechk.pas -text svneol=native#text/plain +compiler/htypechk.pas svneol=native#text/plain compiler/i386/aoptcpu.pas svneol=native#text/plain compiler/i386/aoptcpub.pas svneol=native#text/plain compiler/i386/aoptcpud.pas svneol=native#text/plain @@ -498,7 +498,7 @@ compiler/nobj.pas svneol=native#text/plain compiler/nobjc.pas svneol=native#text/plain compiler/node.pas svneol=native#text/plain compiler/nopt.pas svneol=native#text/plain -compiler/nset.pas -text svneol=native#text/plain +compiler/nset.pas svneol=native#text/plain compiler/nutils.pas svneol=native#text/plain compiler/objcasm.pas svneol=native#text/plain compiler/objcdef.pas svneol=native#text/plain diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index 61bb4db1a9..fe0b91b6be 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -2942,7 +2942,7 @@ unit cgcpu; if not((def.typ=pointerdef) or ((def.typ=orddef) and (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then ai.SetCondition(C_VC) else if TAiCpu(List.Last).opcode in [A_RSB,A_RSC,A_SBC,A_SUB] then diff --git a/compiler/arm/narmadd.pas b/compiler/arm/narmadd.pas index 83902ba394..4594ef14af 100644 --- a/compiler/arm/narmadd.pas +++ b/compiler/arm/narmadd.pas @@ -634,7 +634,7 @@ interface end; if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then - resultdef:=pasbool8type; + resultdef:=pasbool1type; result:=ctypeconvnode.create_internal(ccallnode.createintern(procname,ccallparanode.create( ctypeconvnode.create_internal(right,fdef), ccallparanode.create( diff --git a/compiler/avr/cgcpu.pas b/compiler/avr/cgcpu.pas index 2e3260aac5..5d98d962a6 100644 --- a/compiler/avr/cgcpu.pas +++ b/compiler/avr/cgcpu.pas @@ -2317,7 +2317,7 @@ unit cgcpu; if not ((def.typ=pointerdef) or ((def.typ=orddef) and (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then cond:=C_VC else cond:=C_CC; diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 375502dc81..b26be9dd6b 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -1596,7 +1596,7 @@ implementation ]); finish_entry; end; - pasbool8 : + pasbool1 : begin append_entry(DW_TAG_base_type,false,[ DW_AT_name,DW_FORM_string,'Boolean'#0, @@ -1605,6 +1605,15 @@ implementation ]); finish_entry; end; + pasbool8 : + begin + append_entry(DW_TAG_base_type,false,[ + DW_AT_name,DW_FORM_string,'Boolean8'#0, + DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean, + DW_AT_byte_size,DW_FORM_data1,1 + ]); + finish_entry; + end; bool8bit : begin append_entry(DW_TAG_base_type,false,[ diff --git a/compiler/dbgstabs.pas b/compiler/dbgstabs.pas index cc96264c26..45ea3e678d 100644 --- a/compiler/dbgstabs.pas +++ b/compiler/dbgstabs.pas @@ -696,6 +696,7 @@ implementation case def.ordtype of uvoid : ss:=def_stab_number(def); + pasbool1, pasbool8, pasbool16, pasbool32, @@ -724,6 +725,7 @@ implementation ss:='-20;'; uwidechar : ss:='-30;'; + pasbool1, pasbool8, bool8bit : ss:='-21;'; diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index af4b40d931..40b9129003 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -196,7 +196,7 @@ implementation (bvoid, bint,bint,bint,bint,bint, bint,bint,bint,bint,bint, - bbool,bbool,bbool,bbool, + bbool,bbool,bbool,bbool,bbool, bbool,bbool,bbool,bbool, bchar,bchar,bint); @@ -416,7 +416,7 @@ implementation end; end; uvoid, - pasbool8,pasbool16,pasbool32,pasbool64, + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64, bool8bit,bool16bit,bool32bit,bool64bit: eq:=te_equal; else @@ -1963,9 +1963,9 @@ implementation u8bit,u16bit,u32bit,u64bit, s8bit,s16bit,s32bit,s64bit : is_subequal:=(torddef(def2).ordtype in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]); - pasbool8,pasbool16,pasbool32,pasbool64, + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64, bool8bit,bool16bit,bool32bit,bool64bit : - is_subequal:=(torddef(def2).ordtype in [pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit]); + is_subequal:=(torddef(def2).ordtype in [pasbool1,pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit]); uchar : is_subequal:=(torddef(def2).ordtype=uchar); uwidechar : diff --git a/compiler/defutil.pas b/compiler/defutil.pas index 043f747379..51808787ac 100644 --- a/compiler/defutil.pas +++ b/compiler/defutil.pas @@ -478,7 +478,7 @@ implementation is_ordinal:=dt in [uchar,uwidechar, u8bit,u16bit,u32bit,u64bit, s8bit,s16bit,s32bit,s64bit, - pasbool8,pasbool16,pasbool32,pasbool64, + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64, bool8bit,bool16bit,bool32bit,bool64bit]; end; enumdef : @@ -558,14 +558,14 @@ implementation function is_boolean(def : tdef) : boolean; begin result:=(def.typ=orddef) and - (torddef(def).ordtype in [pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit]); + (torddef(def).ordtype in [pasbool1,pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit]); end; function is_pasbool(def : tdef) : boolean; begin result:=(def.typ=orddef) and - (torddef(def).ordtype in [pasbool8,pasbool16,pasbool32,pasbool64]); + (torddef(def).ordtype in [pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]); end; { true if def is a C-style boolean (non-zero value = true, zero = false) } @@ -902,7 +902,7 @@ implementation { true, if def is a 8 bit ordinal type } function is_8bit(def : tdef) : boolean; begin - result:=(def.typ=orddef) and (torddef(def).ordtype in [u8bit,s8bit,pasbool8,bool8bit,uchar]) + result:=(def.typ=orddef) and (torddef(def).ordtype in [u8bit,s8bit,pasbool1,pasbool8,bool8bit,uchar]) end; { true, if def is a 16 bit int type } @@ -1146,6 +1146,8 @@ implementation range_to_type(torddef(def).low,torddef(def).high,result); end else case torddef(def).ordtype of + pasbool1: + result:=pasbool1type; pasbool8: result:=pasbool8type; pasbool16: @@ -1601,6 +1603,7 @@ implementation result:=tkQWord; s64bit: result:=tkInt64; + pasbool1, pasbool8, pasbool16, pasbool32, diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 07c035dc26..0280a1430d 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -152,22 +152,22 @@ interface function token2managementoperator(optoken:ttoken):tmanagementoperator; { check operator args and result type } - - type - toverload_check_flag = ( - ocf_check_non_overloadable, { also check operators that are (currently) considered as - not overloadable (e.g. the "+" operator for dynamic arrays - if modeswitch arrayoperators is active) } - ocf_check_only { only check whether the operator is overloaded, but don't - modify the passed in node (return true if the operator is - overloaded, false otherwise) } - ); - toverload_check_flags = set of toverload_check_flag; - + + type + toverload_check_flag = ( + ocf_check_non_overloadable, { also check operators that are (currently) considered as + not overloadable (e.g. the "+" operator for dynamic arrays + if modeswitch arrayoperators is active) } + ocf_check_only { only check whether the operator is overloaded, but don't + modify the passed in node (return true if the operator is + overloaded, false otherwise) } + ); + toverload_check_flags = set of toverload_check_flag; + function isbinaryoperatoroverloadable(treetyp:tnodetype;ld:tdef;lt:tnodetype;rd:tdef;rt:tnodetype) : boolean; function isoperatoracceptable(pf : tprocdef; optoken : ttoken) : boolean; - function isunaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; - function isbinaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; + function isunaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; + function isbinaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; { Register Allocation } procedure make_not_regable(p : tnode; how: tregableinfoflags); @@ -515,9 +515,9 @@ implementation end; { + is handled by the compiler } - if (m_array_operators in current_settings.modeswitches) and - (treetyp=addn) and - (is_dynamic_array(ld) or is_dynamic_array(rd)) then + if (m_array_operators in current_settings.modeswitches) and + (treetyp=addn) and + (is_dynamic_array(ld) or is_dynamic_array(rd)) then begin allowed:=false; exit; @@ -720,7 +720,7 @@ implementation end; - function isunaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; + function isunaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; var ld : tdef; optoken : ttoken; @@ -742,11 +742,11 @@ implementation else inlinenumber:=in_none; - if not (ocf_check_non_overloadable in ocf) and not isunaryoperatoroverloadable(t.nodetype,inlinenumber,ld) then + if not (ocf_check_non_overloadable in ocf) and not isunaryoperatoroverloadable(t.nodetype,inlinenumber,ld) then exit; { operator overload is possible } - result:=not (ocf_check_only in ocf); + result:=not (ocf_check_only in ocf); optoken:=NOTOKEN; case t.nodetype of @@ -766,11 +766,11 @@ implementation end; if (optoken=NOTOKEN) then begin - if not (ocf_check_only in ocf) then - begin - CGMessage(parser_e_operator_not_overloaded); - t:=cnothingnode.create; - end; + if not (ocf_check_only in ocf) then + begin + CGMessage(parser_e_operator_not_overloaded); + t:=cnothingnode.create; + end; exit; end; @@ -790,11 +790,11 @@ implementation begin candidates.free; ppn.free; - if not (ocf_check_only in ocf) then - begin - CGMessage2(parser_e_operator_not_overloaded_2,ld.typename,arraytokeninfo[optoken].str); - t:=cnothingnode.create; - end; + if not (ocf_check_only in ocf) then + begin + CGMessage2(parser_e_operator_not_overloaded_2,ld.typename,arraytokeninfo[optoken].str); + t:=cnothingnode.create; + end; exit; end; @@ -811,16 +811,16 @@ implementation begin candidates.free; ppn.free; - if not (ocf_check_only in ocf) then - begin - CGMessage2(parser_e_operator_not_overloaded_2,ld.typename,arraytokeninfo[optoken].str); - t:=cnothingnode.create; - end; + if not (ocf_check_only in ocf) then + begin + CGMessage2(parser_e_operator_not_overloaded_2,ld.typename,arraytokeninfo[optoken].str); + t:=cnothingnode.create; + end; exit; end; { Multiple candidates left? } - if (cand_cnt>1) and not (ocf_check_only in ocf) then + if (cand_cnt>1) and not (ocf_check_only in ocf) then begin CGMessage(type_e_cant_choose_overload_function); {$ifdef EXTDEBUG} @@ -833,13 +833,13 @@ implementation end; candidates.free; - if ocf_check_only in ocf then - begin - ppn.free; - result:=true; - exit; - end; - + if ocf_check_only in ocf then + begin + ppn.free; + result:=true; + exit; + end; + addsymref(operpd.procsym); { the nil as symtable signs firstcalln that this is @@ -852,7 +852,7 @@ implementation end; - function isbinaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; + function isbinaryoverloaded(var t : tnode;ocf:toverload_check_flags) : boolean; var rd,ld : tdef; optoken : ttoken; @@ -945,14 +945,14 @@ implementation { load easier access variables } ld:=tbinarynode(t).left.resultdef; rd:=tbinarynode(t).right.resultdef; - if not (ocf_check_non_overloadable in ocf) and - not isbinaryoperatoroverloadable(t.nodetype,ld,tbinarynode(t).left.nodetype,rd,tbinarynode(t).right.nodetype) then + if not (ocf_check_non_overloadable in ocf) and + not isbinaryoperatoroverloadable(t.nodetype,ld,tbinarynode(t).left.nodetype,rd,tbinarynode(t).right.nodetype) then exit; { operator overload is possible } - { if we only check for the existance of the overload, then we assume that - it is not overloaded } - result:=not (ocf_check_only in ocf); + { if we only check for the existance of the overload, then we assume that + it is not overloaded } + result:=not (ocf_check_only in ocf); case t.nodetype of equaln: @@ -997,19 +997,19 @@ implementation optoken:=_OP_IN; else begin - if not (ocf_check_only in ocf) then - begin - CGMessage(parser_e_operator_not_overloaded); - t:=cnothingnode.create; - end; + if not (ocf_check_only in ocf) then + begin + CGMessage(parser_e_operator_not_overloaded); + t:=cnothingnode.create; + end; exit; end; end; - cand_cnt:=search_operator(optoken,(optoken<>_NE) and not (ocf_check_only in ocf)); + cand_cnt:=search_operator(optoken,(optoken<>_NE) and not (ocf_check_only in ocf)); { no operator found for "<>" then search for "=" operator } - if (cand_cnt=0) and (optoken=_NE) and not (ocf_check_only in ocf) then + if (cand_cnt=0) and (optoken=_NE) and not (ocf_check_only in ocf) then begin ppn.free; ppn:=nil; @@ -1021,15 +1021,15 @@ implementation if (cand_cnt=0) then begin ppn.free; - if not (ocf_check_only in ocf) then - t:=cnothingnode.create; - exit; - end; - - if ocf_check_only in ocf then - begin - ppn.free; - result:=true; + if not (ocf_check_only in ocf) then + t:=cnothingnode.create; + exit; + end; + + if ocf_check_only in ocf then + begin + ppn.free; + result:=true; exit; end; @@ -3122,7 +3122,7 @@ implementation variantorddef_cl: array[tordtype] of tvariantequaltype = (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_boolformal, tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal, tve_chari64,tve_chari64,tve_dblcurrency); { TODO: fixme for 128 bit floats } diff --git a/compiler/i8086/n8086add.pas b/compiler/i8086/n8086add.pas index ec5c26d164..47cf4833d5 100644 --- a/compiler/i8086/n8086add.pas +++ b/compiler/i8086/n8086add.pas @@ -149,17 +149,17 @@ interface internalerror(2014040606); end; ltn: - t:=cordconstnode.create(ord(word(qword(lv))word(qword(rv))),pasbool8type,true); + t:=cordconstnode.create(ord(word(qword(lv))>word(qword(rv))),pasbool1type,true); gten: - t:=cordconstnode.create(ord(word(qword(lv))>=word(qword(rv))),pasbool8type,true); + t:=cordconstnode.create(ord(word(qword(lv))>=word(qword(rv))),pasbool1type,true); equaln: - t:=cordconstnode.create(ord(lv=rv),pasbool8type,true); + t:=cordconstnode.create(ord(lv=rv),pasbool1type,true); unequaln: - t:=cordconstnode.create(ord(lv<>rv),pasbool8type,true); + t:=cordconstnode.create(ord(lv<>rv),pasbool1type,true); else internalerror(2014040605); end; diff --git a/compiler/jvm/hlcgcpu.pas b/compiler/jvm/hlcgcpu.pas index 46e9ab8dd7..487588d92b 100644 --- a/compiler/jvm/hlcgcpu.pas +++ b/compiler/jvm/hlcgcpu.pas @@ -1241,7 +1241,7 @@ implementation if not ((size.typ=pointerdef) or ((size.typ=orddef) and (torddef(size).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then begin a_load_reg_stack(list,size,src1); if op in [OP_SUB,OP_IMUL] then @@ -1346,7 +1346,7 @@ implementation orddef: begin case torddef(eledef).ordtype of - pasbool8,s8bit,u8bit,bool8bit,uchar, + pasbool1,pasbool8,s8bit,u8bit,bool8bit,uchar, s16bit,u16bit,bool16bit,pasbool16, uwidechar, s32bit,u32bit,bool32bit,pasbool32, @@ -1371,7 +1371,7 @@ implementation else begin { deepcopy=true } - a_load_const_stack(list,pasbool8type,1,R_INTREGISTER); + a_load_const_stack(list,pasbool1type,1,R_INTREGISTER); { ndim } a_load_const_stack(list,s32inttype,ndim,R_INTREGISTER); { eletype } diff --git a/compiler/jvm/jvmdef.pas b/compiler/jvm/jvmdef.pas index 0c30fcf8cf..fc4b1ff874 100644 --- a/compiler/jvm/jvmdef.pas +++ b/compiler/jvm/jvmdef.pas @@ -539,6 +539,7 @@ implementation orddef: begin case torddef(def).ordtype of + pasbool1, pasbool8: begin objdef:=tobjectdef(search_system_type('JLBOOLEAN').typedef); @@ -622,6 +623,7 @@ implementation orddef: begin case torddef(def).ordtype of + pasbool1, pasbool8: result:='BOOLEANVALUE'; s8bit, @@ -784,6 +786,7 @@ implementation orddef: begin case torddef(def).ordtype of + pasbool1, pasbool8: begin result:=tobjectdef(search_system_type('FPCBOOLEANTHREADVAR').typedef); diff --git a/compiler/jvm/njvmcnv.pas b/compiler/jvm/njvmcnv.pas index d760e82753..9044ceb538 100644 --- a/compiler/jvm/njvmcnv.pas +++ b/compiler/jvm/njvmcnv.pas @@ -1497,7 +1497,7 @@ implementation if node.nodetype=asn then node.resultdef:=realtodef else - node.resultdef:=pasbool8type; + node.resultdef:=pasbool1type; end; diff --git a/compiler/jvm/njvminl.pas b/compiler/jvm/njvminl.pas index 006d7f750a..f73c5bff8a 100644 --- a/compiler/jvm/njvminl.pas +++ b/compiler/jvm/njvminl.pas @@ -487,7 +487,7 @@ implementation { prepend new } newparas:=ccallparanode.create(newnode,newparas); { prepend deepcopy } - newparas:=ccallparanode.create(cordconstnode.create(0,pasbool8type,false),newparas); + newparas:=ccallparanode.create(cordconstnode.create(0,pasbool1type,false),newparas); { call the right setlenght helper } if ndims>1 then begin diff --git a/compiler/llvm/hlcgllvm.pas b/compiler/llvm/hlcgllvm.pas index 80ae2f550b..e66f15d76f 100644 --- a/compiler/llvm/hlcgllvm.pas +++ b/compiler/llvm/hlcgllvm.pas @@ -1037,7 +1037,7 @@ implementation begin { since all comparisons return their results in a register, we'll often get comparisons against true/false -> optimise } - if (size=pasbool8type) and + if (size=pasbool1type) and (cmp_op in [OC_EQ,OC_NE]) then begin { convert to an llvmbool1type and use directly } diff --git a/compiler/llvm/llvmdef.pas b/compiler/llvm/llvmdef.pas index 120fb8e720..47b5b37cc3 100644 --- a/compiler/llvm/llvmdef.pas +++ b/compiler/llvm/llvmdef.pas @@ -347,7 +347,7 @@ implementation encodedstr:=encodedstr+'void' { mainly required because comparison operations return i1, and we need a way to represent the i1 type in Pascal. We don't - reuse pasbool8type, because putting an i1 in a record or + reuse pasbool1type, because putting an i1 in a record or passing it as a parameter may result in unexpected behaviour } else if def=llvmbool1type then encodedstr:=encodedstr+'i1' @@ -824,6 +824,7 @@ implementation case torddef(hdef).ordtype of s8bit, u8bit, + pasbool1, pasbool8: typename:=typename+'i8'; s16bit, diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas index 15f791d4e3..e67efce121 100644 --- a/compiler/m68k/cgcpu.pas +++ b/compiler/m68k/cgcpu.pas @@ -1826,7 +1826,7 @@ unit cgcpu; if not ((def.typ=pointerdef) or ((def.typ=orddef) and (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then cond:=C_VC else begin diff --git a/compiler/nadd.pas b/compiler/nadd.pas index 677553ac1f..cd227d273b 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -619,17 +619,17 @@ implementation else t:=cordconstnode.create(lv and rv,resultdef,true); ltn : - t:=cordconstnode.create(ord(lvrv),pasbool8type,true); + t:=cordconstnode.create(ord(lv>rv),pasbool1type,true); gten : - t:=cordconstnode.create(ord(lv>=rv),pasbool8type,true); + t:=cordconstnode.create(ord(lv>=rv),pasbool1type,true); equaln : - t:=cordconstnode.create(ord(lv=rv),pasbool8type,true); + t:=cordconstnode.create(ord(lv=rv),pasbool1type,true); unequaln : - t:=cordconstnode.create(ord(lv<>rv),pasbool8type,true); + t:=cordconstnode.create(ord(lv<>rv),pasbool1type,true); slashn : begin { int/int becomes a real } @@ -647,9 +647,9 @@ implementation else if cmp_of_disjunct_ranges(res) then begin if res then - t:=Cordconstnode.create(1,pasbool8type,true) + t:=Cordconstnode.create(1,pasbool1type,true) else - t:=Cordconstnode.create(0,pasbool8type,true); + t:=Cordconstnode.create(0,pasbool1type,true); { don't do this optimization, if the variable expression might have a side effect } if (is_constintnode(left) and might_have_sideeffects(right)) or @@ -755,17 +755,17 @@ implementation slashn : t:=crealconstnode.create(lvd/rvd,resultrealdef); ltn : - t:=cordconstnode.create(ord(lvdrvd),pasbool8type,true); + t:=cordconstnode.create(ord(lvd>rvd),pasbool1type,true); gten : - t:=cordconstnode.create(ord(lvd>=rvd),pasbool8type,true); + t:=cordconstnode.create(ord(lvd>=rvd),pasbool1type,true); equaln : - t:=cordconstnode.create(ord(lvd=rvd),pasbool8type,true); + t:=cordconstnode.create(ord(lvd=rvd),pasbool1type,true); unequaln : - t:=cordconstnode.create(ord(lvd<>rvd),pasbool8type,true); + t:=cordconstnode.create(ord(lvd<>rvd),pasbool1type,true); else internalerror(2008022102); end; @@ -842,17 +842,17 @@ implementation t:=cstringconstnode.createunistr(ws1); end; ltn : - t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<0),pasbool8type,true); + t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<0),pasbool1type,true); lten : - t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<=0),pasbool8type,true); + t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<=0),pasbool1type,true); gtn : - t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>0),pasbool8type,true); + t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>0),pasbool1type,true); gten : - t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>=0),pasbool8type,true); + t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>=0),pasbool1type,true); equaln : - t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)=0),pasbool8type,true); + t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)=0),pasbool1type,true); unequaln : - t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<>0),pasbool8type,true); + t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<>0),pasbool1type,true); else internalerror(2008022103); end; @@ -920,17 +920,17 @@ implementation tstringconstnode(t).changestringtype(getansistringdef) end; ltn : - t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),pasbool8type,true); + t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),pasbool1type,true); lten : - t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),pasbool8type,true); + t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),pasbool1type,true); gtn : - t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),pasbool8type,true); + t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),pasbool1type,true); gten : - t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),pasbool8type,true); + t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),pasbool1type,true); equaln : - t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),pasbool8type,true); + t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),pasbool1type,true); unequaln : - t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),pasbool8type,true); + t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),pasbool1type,true); else internalerror(2008022104); end; @@ -968,22 +968,22 @@ implementation unequaln : begin b:=tsetconstnode(right).value_set^ <> tsetconstnode(left).value_set^; - t:=cordconstnode.create(byte(b),pasbool8type,true); + t:=cordconstnode.create(byte(b),pasbool1type,true); end; equaln : begin b:=tsetconstnode(right).value_set^ = tsetconstnode(left).value_set^; - t:=cordconstnode.create(byte(b),pasbool8type,true); + t:=cordconstnode.create(byte(b),pasbool1type,true); end; lten : begin b:=tsetconstnode(left).value_set^ <= tsetconstnode(right).value_set^; - t:=cordconstnode.create(byte(b),pasbool8type,true); + t:=cordconstnode.create(byte(b),pasbool1type,true); end; gten : begin b:=tsetconstnode(left).value_set^ >= tsetconstnode(right).value_set^; - t:=cordconstnode.create(byte(b),pasbool8type,true); + t:=cordconstnode.create(byte(b),pasbool1type,true); end; else internalerror(2008022105); @@ -1602,12 +1602,12 @@ implementation begin if not is_boolean(ld) then begin - inserttypeconv(left,pasbool8type); + inserttypeconv(left,pasbool1type); ld := left.resultdef; end; if not is_boolean(rd) then begin - inserttypeconv(right,pasbool8type); + inserttypeconv(right,pasbool1type); rd := right.resultdef; end; end; @@ -1644,8 +1644,8 @@ implementation { convert both to pasbool to perform the comparison (so that longbool(4) = longbool(2), since both represent "true" } - inserttypeconv(left,pasbool8type); - inserttypeconv(right,pasbool8type); + inserttypeconv(left,pasbool1type); + inserttypeconv(right,pasbool1type); end; unequaln, equaln: @@ -1689,8 +1689,8 @@ implementation end; { Delphi-compatibility: convert both to pasbool to perform the equality comparison } - inserttypeconv(left,pasbool8type); - inserttypeconv(right,pasbool8type); + inserttypeconv(left,pasbool1type); + inserttypeconv(right,pasbool1type); end; else begin @@ -2500,7 +2500,7 @@ implementation begin case nodetype of ltn,lten,gtn,gten,equaln,unequaln : - resultdef:=pasbool8type; + resultdef:=pasbool1type; slashn : resultdef:=resultrealdef; addn: @@ -3489,7 +3489,7 @@ implementation if not(target_info.system in systems_wince) then begin if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then - resultdef:=pasbool8type; + resultdef:=pasbool1type; result:=ctypeconvnode.create_internal(ccallnode.createintern(procname,ccallparanode.create( ctypeconvnode.create_internal(right,fdef), ccallparanode.create( diff --git a/compiler/ncal.pas b/compiler/ncal.pas index e87272a467..89dd038b6f 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -3178,12 +3178,12 @@ implementation else if vo_is_range_check in para.parasym.varoptions then begin - para.left:=cordconstnode.create(Ord(cs_check_range in current_settings.localswitches),pasbool8type,false); + para.left:=cordconstnode.create(Ord(cs_check_range in current_settings.localswitches),pasbool1type,false); end else if vo_is_overflow_check in para.parasym.varoptions then begin - para.left:=cordconstnode.create(Ord(cs_check_overflow in current_settings.localswitches),pasbool8type,false); + para.left:=cordconstnode.create(Ord(cs_check_overflow in current_settings.localswitches),pasbool1type,false); end else if vo_is_msgsel in para.parasym.varoptions then diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index 040fe42080..ed32c39d72 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -1020,7 +1020,7 @@ implementation (otUByte{otNone}, otUByte,otUWord,otULong,otUQWord,otUByte{otNone}, otSByte,otSWord,otSLong,otSQWord,otUByte{otNone}, - otUByte,otUWord,otULong,otUQWord, + otUByte,otUByte,otUWord,otULong,otUQWord, otSByte,otSWord,otSLong,otSQWord, otUByte,otUWord,otUByte); var @@ -1078,6 +1078,7 @@ implementation dointeger(tkInt64); u64bit : dointeger(tkQWord); + pasbool1, pasbool8, pasbool16, pasbool32, diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 31135872da..514d52829e 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -1097,7 +1097,7 @@ implementation addstatement(newstat,restemp); addstatement(newstat,ccallnode.createintern('fpc_'+chartype+'array_to_shortstr', ccallparanode.create(cordconstnode.create( - ord(tarraydef(left.resultdef).lowrange=0),pasbool8type,false), + ord(tarraydef(left.resultdef).lowrange=0),pasbool1type,false), ccallparanode.create(left,ccallparanode.create( ctemprefnode.create(restemp),nil))))); addstatement(newstat,ctempdeletenode.create_normal_temp(restemp)); @@ -1111,7 +1111,7 @@ implementation ccallparanode.create( cordconstnode.create( ord(tarraydef(left.resultdef).lowrange=0), - pasbool8type, + pasbool1type, false ), ccallparanode.create( @@ -1130,7 +1130,7 @@ implementation result:=ccallnode.createinternres( 'fpc_'+chartype+'array_to_'+tstringdef(resultdef).stringtypname, ccallparanode.create(cordconstnode.create( - ord(tarraydef(left.resultdef).lowrange=0),pasbool8type,false), + ord(tarraydef(left.resultdef).lowrange=0),pasbool1type,false), ccallparanode.create(left,nil)),resultdef); left:=nil; end; @@ -4238,7 +4238,7 @@ implementation CGMessage1(type_e_class_or_cominterface_type_expected,left.resultdef.typename); case nodetype of isn: - resultdef:=pasbool8type; + resultdef:=pasbool1type; asn: resultdef:=tclassrefdef(right.resultdef).pointeddef; end; @@ -4249,7 +4249,7 @@ implementation begin case nodetype of isn: - resultdef:=pasbool8type; + resultdef:=pasbool1type; asn: resultdef:=right.resultdef; end; diff --git a/compiler/nflw.pas b/compiler/nflw.pas index 7fb4008e06..8394f3f8cd 100644 --- a/compiler/nflw.pas +++ b/compiler/nflw.pas @@ -472,7 +472,7 @@ implementation one } hp:=cwhilerepeatnode.create( { repeat .. until false } - cordconstnode.create(0,pasbool8type,false),innerloop,false,true); + cordconstnode.create(0,pasbool1type,false),innerloop,false,true); addstatement(outerloopbodystatement,hp); { create the outer repeat/until and add it to the the main body } @@ -1105,7 +1105,7 @@ implementation if not(is_boolean(left.resultdef)) and not(is_typeparam(left.resultdef)) then - inserttypeconv(left,pasbool8type); + inserttypeconv(left,pasbool1type); { Give warnings for code that will never be executed for while false do } @@ -1339,7 +1339,7 @@ implementation end; if not is_constboolnode(condition) then aktstate.store_fact(condition, - cordconstnode.create(byte(checknegate),pasbool8type,true)) + cordconstnode.create(byte(checknegate),pasbool1type,true)) else condition.destroy; end; @@ -1420,7 +1420,7 @@ implementation if not(is_boolean(left.resultdef)) and not(is_typeparam(left.resultdef)) then - inserttypeconv(left,pasbool8type); + inserttypeconv(left,pasbool1type); result:=internalsimplify(not(nf_internal in flags)); end; diff --git a/compiler/ngtcon.pas b/compiler/ngtcon.pas index a4084bfa7c..c687f7ceb1 100644 --- a/compiler/ngtcon.pas +++ b/compiler/ngtcon.pas @@ -613,6 +613,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis begin case def.ordtype of + pasbool1, pasbool8, bool8bit, pasbool16, diff --git a/compiler/ninl.pas b/compiler/ninl.pas index c4e4126717..6367291277 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -392,7 +392,7 @@ implementation procname:=procname+'enum' else case torddef(source.resultdef).ordtype of - pasbool8,pasbool16,pasbool32,pasbool64, + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64, bool8bit,bool16bit,bool32bit,bool64bit: procname := procname + 'bool'; else @@ -806,6 +806,7 @@ implementation readfunctype:=s64currencytype; is_real:=true; end; + pasbool1, pasbool8, pasbool16, pasbool32, @@ -822,7 +823,7 @@ implementation else begin name := procprefixes[do_read]+'boolean'; - readfunctype:=pasbool8type; + readfunctype:=pasbool1type; end else begin @@ -1043,7 +1044,7 @@ implementation { in case of writing a chararray, add whether it's zero-based } if para.left.resultdef.typ=arraydef then para := ccallparanode.create(cordconstnode.create( - ord(tarraydef(para.left.resultdef).lowrange=0),pasbool8type,false),para) + ord(tarraydef(para.left.resultdef).lowrange=0),pasbool1type,false),para) else { in case of reading an ansistring pass a codepage argument } if do_read and is_ansistring(para.left.resultdef) then @@ -2274,7 +2275,7 @@ implementation else hp:=create_simplified_ord_const(sqr(vl.uvalue),resultdef,forinline); in_const_odd : - hp:=cordconstnode.create(qword(odd(int64(vl))),pasbool8type,true); + hp:=cordconstnode.create(qword(odd(int64(vl))),pasbool1type,true); in_const_swap_word : hp:=cordconstnode.create((vl and $ff) shl 8+(vl shr 8),left.resultdef,true); in_const_swap_long : @@ -2336,6 +2337,7 @@ implementation orddef : begin case torddef(left.resultdef).ordtype of + pasbool1, pasbool8, uchar: begin @@ -3126,7 +3128,7 @@ implementation { Postpone conversion into addnode until firstpass, so targets may override first_assigned and insert specific code. } set_varstate(tcallparanode(left).left,vs_read,[vsf_must_be_valid]); - resultdef:=pasbool8type; + resultdef:=pasbool1type; end; in_ofs_x : diff --git a/compiler/nmat.pas b/compiler/nmat.pas index 355b493da4..a7b6da258f 100644 --- a/compiler/nmat.pas +++ b/compiler/nmat.pas @@ -1200,6 +1200,7 @@ implementation v:=tordconstnode(left).value; def:=left.resultdef; case torddef(left.resultdef).ordtype of + pasbool1, pasbool8, pasbool16, pasbool32, diff --git a/compiler/nset.pas b/compiler/nset.pas index 6270ec582e..59b6d9d362 100644 --- a/compiler/nset.pas +++ b/compiler/nset.pas @@ -215,7 +215,7 @@ implementation begin result:=nil; - resultdef:=pasbool8type; + resultdef:=pasbool1type; typecheckpass(right); set_varstate(right,vs_read,[vsf_must_be_valid]); if codegenerror then @@ -239,7 +239,7 @@ implementation internalerror(20021126); t:=self; - if isbinaryoverloaded(t,[]) then + if isbinaryoverloaded(t,[]) then begin result:=t; exit; @@ -258,7 +258,7 @@ implementation } if ( (left.resultdef.typ = orddef) and not - (torddef(left.resultdef).ordtype in [s8bit,u8bit,uchar,pasbool8,bool8bit]) + (torddef(left.resultdef).ordtype in [s8bit,u8bit,uchar,pasbool1,pasbool8,bool8bit]) ) or ( @@ -296,7 +296,7 @@ implementation ((right.nodetype = setconstn) and (tnormalset(tsetconstnode(right).value_set^) = [])) then begin - t:=cordconstnode.create(0,pasbool8type,false); + t:=cordconstnode.create(0,pasbool1type,false); typecheckpass(t); result:=t; exit; @@ -323,10 +323,10 @@ implementation { into account } if Tordconstnode(left).value.signed then t:=cordconstnode.create(byte(tordconstnode(left).value.svalue in Tsetconstnode(right).value_set^), - pasbool8type,true) + pasbool1type,true) else t:=cordconstnode.create(byte(tordconstnode(left).value.uvalue in Tsetconstnode(right).value_set^), - pasbool8type,true); + pasbool1type,true); typecheckpass(t); result:=t; exit; @@ -336,7 +336,7 @@ implementation if (Tordconstnode(left).valueint64(Tsetdef(right.resultdef).setmax)) then begin - t:=cordconstnode.create(0, pasbool8type, true); + t:=cordconstnode.create(0, pasbool1type, true); typecheckpass(t); result:=t; exit; diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 4d39397e46..746e2ee327 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -637,7 +637,7 @@ implementation storedprocdef:=cprocvardef.create(normal_function_level); include(storedprocdef.procoptions,po_methodpointer); { Return type must be boolean } - storedprocdef.returndef:=pasbool8type; + storedprocdef.returndef:=pasbool1type; { Add index parameter if needed } if ppo_indexed in p.propoptions then begin diff --git a/compiler/ppcgen/cgppc.pas b/compiler/ppcgen/cgppc.pas index e63bd90f57..09997682f3 100644 --- a/compiler/ppcgen/cgppc.pas +++ b/compiler/ppcgen/cgppc.pas @@ -673,7 +673,7 @@ unit cgppc; if not ((def.typ=pointerdef) or ((def.typ=orddef) and (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then begin if (current_settings.optimizecputype >= cpu_ppc970) or (current_settings.cputype >= cpu_ppc970) then diff --git a/compiler/ppcgen/ngppcadd.pas b/compiler/ppcgen/ngppcadd.pas index 562018759b..c83b51cffe 100644 --- a/compiler/ppcgen/ngppcadd.pas +++ b/compiler/ppcgen/ngppcadd.pas @@ -199,8 +199,8 @@ implementation firstcomplex(self); cmpop:=false; - if (torddef(left.resultdef).ordtype in [pasbool8,bool8bit]) or - (torddef(right.resultdef).ordtype in [pasbool8,bool8bit]) then + if (torddef(left.resultdef).ordtype in [pasbool1,pasbool8,bool8bit]) or + (torddef(right.resultdef).ordtype in [pasbool1,pasbool8,bool8bit]) then cgsize:=OS_8 else if (torddef(left.resultdef).ordtype in [pasbool16,bool16bit]) or (torddef(right.resultdef).ordtype in [pasbool16,bool16bit]) then diff --git a/compiler/psystem.pas b/compiler/psystem.pas index ac1b9c86da..650bb7121d 100644 --- a/compiler/psystem.pas +++ b/compiler/psystem.pas @@ -110,8 +110,8 @@ implementation systemunit.insert(csyssym.create('Insert',in_insert_x_y_z)); systemunit.insert(csyssym.create('Delete',in_delete_x_y_z)); systemunit.insert(csyssym.create('GetTypeKind',in_gettypekind_x)); - systemunit.insert(cconstsym.create_ord('False',constord,0,pasbool8type)); - systemunit.insert(cconstsym.create_ord('True',constord,1,pasbool8type)); + systemunit.insert(cconstsym.create_ord('False',constord,0,pasbool1type)); + systemunit.insert(cconstsym.create_ord('True',constord,1,pasbool1type)); end; @@ -271,6 +271,7 @@ implementation implement overflow checking } u128inttype:=corddef.create(u128bit,0,0,true); s128inttype:=corddef.create(s128bit,0,0,true); + pasbool1type:=corddef.create(pasbool1,0,1,true); pasbool8type:=corddef.create(pasbool8,0,1,true); pasbool16type:=corddef.create(pasbool16,0,1,true); pasbool32type:=corddef.create(pasbool32,0,1,true); @@ -280,7 +281,7 @@ implementation bool32type:=corddef.create(bool32bit,low(int64),high(int64),true); bool64type:=corddef.create(bool64bit,low(int64),high(int64),true); {$ifdef llvm} - llvmbool1type:=corddef.create(pasbool8,0,1,true); + llvmbool1type:=corddef.create(pasbool1,0,1,true); {$endif llvm} cansichartype:=corddef.create(uchar,0,255,true); cwidechartype:=corddef.create(uwidechar,0,65535,true); @@ -459,7 +460,8 @@ implementation addtype('UnicodeString',cunicodestringtype); addtype('OpenString',openshortstringtype); - addtype('Boolean',pasbool8type); + addtype('Boolean',pasbool1type); + addtype('Boolean8',pasbool8type); addtype('Boolean16',pasbool16type); addtype('Boolean32',pasbool32type); addtype('Boolean64',pasbool64type); @@ -511,7 +513,8 @@ implementation addtype('$widestring',cwidestringtype); addtype('$unicodestring',cunicodestringtype); addtype('$openshortstring',openshortstringtype); - addtype('$boolean',pasbool8type); + addtype('$boolean',pasbool1type); + addtype('$boolean8',pasbool8type); addtype('$boolean16',pasbool16type); addtype('$boolean32',pasbool32type); addtype('$boolean64',pasbool64type); @@ -657,7 +660,8 @@ implementation loadtype('sc80real',sc80floattype); end; loadtype('s64currency',s64currencytype); - loadtype('boolean',pasbool8type); + loadtype('boolean',pasbool1type); + loadtype('boolean8',pasbool8type); loadtype('boolean16',pasbool16type); loadtype('boolean32',pasbool32type); loadtype('boolean64',pasbool64type); diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 38e2526e9f..91b2860b85 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -1129,7 +1129,7 @@ implementation def:=corddef.create(uchar,lv,hv,true) else if is_boolean(pt1.resultdef) then - def:=corddef.create(pasbool8,lv,hv,true) + def:=corddef.create(pasbool1,lv,hv,true) else if is_signed(pt1.resultdef) then def:=corddef.create(range_to_basetype(lv,hv),lv,hv,true) else @@ -1335,7 +1335,7 @@ implementation {$ifdef cpu64bitaddr} u32bit,s64bit, {$endif cpu64bitaddr} - pasbool8,pasbool16,pasbool32,pasbool64, + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64, bool8bit,bool16bit,bool32bit,bool64bit, uwidechar] then begin diff --git a/compiler/scanner.pas b/compiler/scanner.pas index f5d196d338..ec426aba89 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -925,7 +925,7 @@ type that we use the base types instead of the cpu-specific ones. } sintdef:=torddef.create(s64bit,low(int64),high(int64),false); uintdef:=torddef.create(u64bit,low(qword),high(qword),false); - booldef:=torddef.create(pasbool8,0,1,false); + booldef:=torddef.create(pasbool1,0,1,false); strdef:=tstringdef.createansi(0,false); setdef:=tsetdef.create(sintdef,0,255,false); realdef:=tfloatdef.create(s80real,false); diff --git a/compiler/sparcgen/cgsparc.pas b/compiler/sparcgen/cgsparc.pas index 02d5a61f29..3487ead03f 100644 --- a/compiler/sparcgen/cgsparc.pas +++ b/compiler/sparcgen/cgsparc.pas @@ -960,7 +960,7 @@ implementation if not((def.typ=pointerdef) or ((def.typ=orddef) and (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then begin ai:=TAiCpu.Op_sym(A_Bxx,hl); ai.SetCondition(C_VC); diff --git a/compiler/symconst.pas b/compiler/symconst.pas index 9aa7c41f38..1b662a8616 100644 --- a/compiler/symconst.pas +++ b/compiler/symconst.pas @@ -269,7 +269,7 @@ type uvoid, u8bit,u16bit,u32bit,u64bit,u128bit, s8bit,s16bit,s32bit,s64bit,s128bit, - pasbool8,pasbool16,pasbool32,pasbool64, + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64, bool8bit,bool16bit,bool32bit,bool64bit, uchar,uwidechar,scurrency ); diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 51d9fd66df..1f1239053f 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -1039,7 +1039,8 @@ interface voidtype, { Void (procedure) } cansichartype, { Char } cwidechartype, { WideChar } - pasbool8type, { boolean type } + pasbool1type, { boolean type } + pasbool8type, pasbool16type, pasbool32type, pasbool64type, @@ -2886,7 +2887,7 @@ implementation 0, 1,2,4,8,16, 1,2,4,8,16, - 1,2,4,8, + 1,1,2,4,8, 1,2,4,8, 1,2,8 ); @@ -2917,7 +2918,7 @@ implementation (low >= 0) and (high <= 1) ) or ( - ordtype in [pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit] + ordtype in [pasbool1,pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit] ) then result := 1 else @@ -2940,7 +2941,7 @@ implementation varUndefined, varbyte,varword,varlongword,varqword,varUndefined, varshortint,varsmallint,varinteger,varint64,varUndefined, - varboolean,varboolean,varboolean,varboolean, + varboolean,varboolean,varboolean,varboolean,varboolean, varboolean,varboolean,varUndefined,varUndefined, varUndefined,varUndefined,varCurrency); begin @@ -2970,7 +2971,7 @@ implementation 'untyped', 'Byte','Word','DWord','QWord','UInt128', 'ShortInt','SmallInt','LongInt','Int64','Int128', - 'Boolean','Boolean16','Boolean32','Boolean64', + 'Boolean','Boolean8','Boolean16','Boolean32','Boolean64', 'ByteBool','WordBool','LongBool','QWordBool', 'Char','WideChar','Currency'); @@ -6231,14 +6232,14 @@ implementation '', 'Uc','Us','Ui','Us','', 'Sc','s','i','x','', - 'b','b','b','b','b', + 'b','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','', - 'b','b','b','b', + 'b','b','b','b','b', 'b','b','b','b', 'c','w','x'); diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp index e11cd40574..d49435f65b 100644 --- a/compiler/utils/ppuutils/ppudump.pp +++ b/compiler/utils/ppuutils/ppudump.pp @@ -3067,6 +3067,12 @@ begin orddef.OrdType:=otSInt; orddef.Size:=16; end; + pasbool1: + begin + writeln('pasbool1'); + orddef.OrdType:=otPasBool; + orddef.Size:=1; + end; pasbool8: begin writeln('pasbool8'); diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 4e5b8278a5..e1d6497758 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -3629,7 +3629,7 @@ unit cgx86; if not ((def.typ=pointerdef) or ((def.typ=orddef) and (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar, - pasbool8,pasbool16,pasbool32,pasbool64]))) then + pasbool1,pasbool8,pasbool16,pasbool32,pasbool64]))) then cond:=C_NO else cond:=C_NB; diff --git a/compiler/x86_64/cpupara.pas b/compiler/x86_64/cpupara.pas index c268072c61..dcbfb74b07 100644 --- a/compiler/x86_64/cpupara.pas +++ b/compiler/x86_64/cpupara.pas @@ -181,7 +181,7 @@ unit cpupara; as per the x86-64 ABI -> do the same } if not assigned(cl.def) or not is_pasbool(cl.def) or - (size>1) then + (torddef(cl.def).ordtype<>pasbool1) then cl.def:=u32inttype; end else diff --git a/rtl/inc/systemh.inc b/rtl/inc/systemh.inc index eaa7916d14..460b355493 100644 --- a/rtl/inc/systemh.inc +++ b/rtl/inc/systemh.inc @@ -109,7 +109,6 @@ Type Cardinal = LongWord; Integer = SmallInt; UInt64 = QWord; - Boolean8 = Boolean; { moved here from psystem.pas Delphi allows chose of overloaded procedure depending