mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-02 19:29:21 +00:00
When doing arithmetic/indexing on pointers to one-byte types, don't generate code to multiply by one.
This could already be optimized out by the peephole optimizer, but it's bad enough code that it really shouldn't be generated even when not using that optimization.
This commit is contained in:
parent
8d31481182
commit
e780043007
@ -2176,29 +2176,37 @@ case tp of
|
|||||||
cgByte,cgUByte,cgWord,cgUWord: begin
|
cgByte,cgUByte,cgWord,cgUWord: begin
|
||||||
if (size = long(size).lsw) and (op = pc_adl)
|
if (size = long(size).lsw) and (op = pc_adl)
|
||||||
and smallMemoryModel and (tp in [cgUByte,cgUWord]) then begin
|
and smallMemoryModel and (tp in [cgUByte,cgUWord]) then begin
|
||||||
Gen1t(pc_ldc, long(size).lsw, cgWord);
|
if size <> 1 then begin
|
||||||
Gen0(pc_umi);
|
Gen1t(pc_ldc, long(size).lsw, cgWord);
|
||||||
|
Gen0(pc_umi);
|
||||||
|
end; {if}
|
||||||
Gen0t(pc_ixa, cgUWord);
|
Gen0t(pc_ixa, cgUWord);
|
||||||
end {if}
|
end {if}
|
||||||
else if smallMemoryModel and (size = long(size).lsw) then begin
|
else if smallMemoryModel and (size = long(size).lsw) then begin
|
||||||
Gen1t(pc_ldc, long(size).lsw, cgWord);
|
if size <> 1 then begin
|
||||||
Gen0(pc_mpi);
|
Gen1t(pc_ldc, long(size).lsw, cgWord);
|
||||||
|
Gen0(pc_mpi);
|
||||||
|
end; {if}
|
||||||
Gen2(pc_cnv, ord(tp), ord(cgLong));
|
Gen2(pc_cnv, ord(tp), ord(cgLong));
|
||||||
Gen0(op);
|
Gen0(op);
|
||||||
end {else if}
|
end {else if}
|
||||||
else begin
|
else begin
|
||||||
Gen2(pc_cnv, ord(tp), ord(cgLong));
|
Gen2(pc_cnv, ord(tp), ord(cgLong));
|
||||||
GenLdcLong(size);
|
if size <> 1 then begin
|
||||||
Gen0(pc_mpl);
|
GenLdcLong(size);
|
||||||
|
Gen0(pc_mpl);
|
||||||
|
end; {if}
|
||||||
Gen0(op);
|
Gen0(op);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
cgLong,cgULong: begin
|
cgLong,cgULong: begin
|
||||||
GenLdcLong(size);
|
if size <> 1 then begin
|
||||||
if tp = cgLong then
|
GenLdcLong(size);
|
||||||
Gen0(pc_mpl)
|
if tp = cgLong then
|
||||||
else
|
Gen0(pc_mpl)
|
||||||
Gen0(pc_uml);
|
else
|
||||||
|
Gen0(pc_uml);
|
||||||
|
end; {if}
|
||||||
Gen0(op);
|
Gen0(op);
|
||||||
end;
|
end;
|
||||||
otherwise:
|
otherwise:
|
||||||
|
Loading…
Reference in New Issue
Block a user