* 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 -
This commit is contained in:
Jonas Maebe 2018-10-16 21:14:18 +00:00
parent 9ee1682955
commit 0b246f3dbd
39 changed files with 214 additions and 181 deletions

4
.gitattributes vendored
View File

@ -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

View File

@ -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

View File

@ -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(

View File

@ -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;

View File

@ -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,[

View File

@ -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;';

View File

@ -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 :

View File

@ -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,

View File

@ -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;
{ <dyn. array> + <dyn. array> 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 }

View File

@ -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);
lten:
t:=cordconstnode.create(ord(word(qword(lv))<=word(qword(rv))),pasbool8type,true);
t:=cordconstnode.create(ord(word(qword(lv))<=word(qword(rv))),pasbool1type,true);
gtn:
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;

View File

@ -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 }

View File

@ -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);

View File

@ -1497,7 +1497,7 @@ implementation
if node.nodetype=asn then
node.resultdef:=realtodef
else
node.resultdef:=pasbool8type;
node.resultdef:=pasbool1type;
end;

View File

@ -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

View File

@ -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 }

View File

@ -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,

View File

@ -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

View File

@ -619,17 +619,17 @@ implementation
else
t:=cordconstnode.create(lv and rv,resultdef,true);
ltn :
t:=cordconstnode.create(ord(lv<rv),pasbool8type,true);
t:=cordconstnode.create(ord(lv<rv),pasbool1type,true);
lten :
t:=cordconstnode.create(ord(lv<=rv),pasbool8type,true);
t:=cordconstnode.create(ord(lv<=rv),pasbool1type,true);
gtn :
t:=cordconstnode.create(ord(lv>rv),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(lvd<rvd),pasbool8type,true);
t:=cordconstnode.create(ord(lvd<rvd),pasbool1type,true);
lten :
t:=cordconstnode.create(ord(lvd<=rvd),pasbool8type,true);
t:=cordconstnode.create(ord(lvd<=rvd),pasbool1type,true);
gtn :
t:=cordconstnode.create(ord(lvd>rvd),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(

View File

@ -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

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -613,6 +613,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
begin
case def.ordtype of
pasbool1,
pasbool8,
bool8bit,
pasbool16,

View File

@ -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 :

View File

@ -1200,6 +1200,7 @@ implementation
v:=tordconstnode(left).value;
def:=left.resultdef;
case torddef(left.resultdef).ordtype of
pasbool1,
pasbool8,
pasbool16,
pasbool32,

View File

@ -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).value<int64(tsetdef(right.resultdef).setbase)) or
(Tordconstnode(left).value>int64(Tsetdef(right.resultdef).setmax)) then
begin
t:=cordconstnode.create(0, pasbool8type, true);
t:=cordconstnode.create(0, pasbool1type, true);
typecheckpass(t);
result:=t;
exit;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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
);

View File

@ -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');

View File

@ -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');

View File

@ -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;

View File

@ -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

View File

@ -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