* optimized ofs(proc) on i8086, so it only loads the offset in all memory models

git-svn-id: trunk@38682 -
This commit is contained in:
nickysn 2018-04-04 15:26:47 +00:00
parent c7503ca291
commit 58ead31f49
2 changed files with 21 additions and 4 deletions

View File

@ -69,14 +69,28 @@ implementation
not is_proc_far(tabstractprocdef(left.resultdef)) then
CGMessage1(type_e_procedure_must_be_far,left.resultdef.GetTypeName);
Result:=inherited typecheck_proc_to_procvar;
if tcnf_proc_2_procvar_get_offset_only in convnodeflags then
begin
if resultdef.typ<>procvardef then
internalerror(2018040401);
exclude(tprocvardef(resultdef).procoptions,po_far);
end;
end;
procedure t8086typeconvnode.second_proc_to_procvar;
begin
if is_proc_far(tabstractprocdef(resultdef))<>
(current_settings.x86memorymodel in x86_far_code_models) then
internalerror(2014041302);
if tcnf_proc_2_procvar_get_offset_only in convnodeflags then
begin
if is_proc_far(tabstractprocdef(resultdef)) then
internalerror(2018040402);
end
else
begin
if is_proc_far(tabstractprocdef(resultdef))<>
(current_settings.x86memorymodel in x86_far_code_models) then
internalerror(2014041302);
end;
if is_proc_far(tabstractprocdef(left.resultdef))<>
(current_settings.x86memorymodel in x86_far_code_models) then
internalerror(2014041303);

View File

@ -579,7 +579,10 @@ implementation
begin
if tabstractprocdef(left.resultdef).is_addressonly then
begin
result:=ctypeconvnode.create_internal(left,tabstractprocdef(left.resultdef).address_type);
if anf_ofs in addrnodeflags then
result:=ctypeconvnode.create_internal(left,tabstractprocdef(left.resultdef).ofs_address_type)
else
result:=ctypeconvnode.create_internal(left,tabstractprocdef(left.resultdef).address_type);
include(result.flags,nf_load_procvar);
left:=nil;
end