mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-05 15:58:28 +02:00
* fixed tcgstringconstnode.pass_generate_code for i8086 far data memory models
by using the high level code generator git-svn-id: trunk@27325 -
This commit is contained in:
parent
0aab7fcc9c
commit
8b2cde4a99
@ -76,7 +76,7 @@ implementation
|
|||||||
symconst,symdef,aasmtai,aasmdata,aasmcpu,defutil,
|
symconst,symdef,aasmtai,aasmdata,aasmcpu,defutil,
|
||||||
cpuinfo,cpubase,
|
cpuinfo,cpubase,
|
||||||
cgbase,cgobj,cgutils,
|
cgbase,cgobj,cgutils,
|
||||||
ncgutil, cclasses,asmutils,tgobj
|
ncgutil,hlcgobj,symtype,cclasses,asmutils,tgobj
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -264,6 +264,8 @@ implementation
|
|||||||
pool: THashSet;
|
pool: THashSet;
|
||||||
entry: PHashSetItem;
|
entry: PHashSetItem;
|
||||||
winlikewidestring: boolean;
|
winlikewidestring: boolean;
|
||||||
|
elementdef: tdef;
|
||||||
|
strpointerdef: tdef;
|
||||||
|
|
||||||
const
|
const
|
||||||
PoolMap: array[tconststringtype] of TConstPoolType = (
|
PoolMap: array[tconststringtype] of TConstPoolType = (
|
||||||
@ -275,10 +277,27 @@ implementation
|
|||||||
sp_unicodestr
|
sp_unicodestr
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
|
case cst_type of
|
||||||
|
cst_shortstring,
|
||||||
|
cst_conststring,
|
||||||
|
cst_ansistring:
|
||||||
|
begin
|
||||||
|
elementdef:=cansichartype;
|
||||||
|
strpointerdef:=charpointertype;
|
||||||
|
end;
|
||||||
|
cst_widestring,
|
||||||
|
cst_unicodestring:
|
||||||
|
begin
|
||||||
|
elementdef:=cwidechartype;
|
||||||
|
strpointerdef:=widecharpointertype;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2014032803);
|
||||||
|
end;
|
||||||
{ for empty ansistrings we could return a constant 0 }
|
{ for empty ansistrings we could return a constant 0 }
|
||||||
if (cst_type in [cst_ansistring,cst_widestring,cst_unicodestring]) and (len=0) then
|
if (cst_type in [cst_ansistring,cst_widestring,cst_unicodestring]) and (len=0) then
|
||||||
begin
|
begin
|
||||||
location_reset(location,LOC_CONSTANT,OS_ADDR);
|
location_reset(location,LOC_CONSTANT,def_cgsize(strpointerdef));
|
||||||
location.value:=0;
|
location.value:=0;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -373,16 +392,16 @@ implementation
|
|||||||
end;
|
end;
|
||||||
if cst_type in [cst_ansistring, cst_widestring, cst_unicodestring] then
|
if cst_type in [cst_ansistring, cst_widestring, cst_unicodestring] then
|
||||||
begin
|
begin
|
||||||
location_reset(location, LOC_REGISTER, OS_ADDR);
|
location_reset(location, LOC_REGISTER, def_cgsize(strpointerdef));
|
||||||
reference_reset_symbol(href, lab_str,
|
reference_reset_symbol(href, lab_str,
|
||||||
get_string_symofs(tstringdef(resultdef).stringtype,winlikewidestring),
|
get_string_symofs(tstringdef(resultdef).stringtype,winlikewidestring),
|
||||||
const_align(sizeof(pint)));
|
const_align(strpointerdef.size));
|
||||||
location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
|
location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,strpointerdef);
|
||||||
cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
|
hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,elementdef,strpointerdef,href,location.register)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
location_reset_ref(location, LOC_CREFERENCE, def_cgsize(resultdef), const_align(sizeof(pint)));
|
location_reset_ref(location, LOC_CREFERENCE, def_cgsize(resultdef), const_align(strpointerdef.size));
|
||||||
location.reference.symbol:=lab_str;
|
location.reference.symbol:=lab_str;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user