mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-28 01:29:32 +00:00
Optimize generated code for some indexing ops in large memory model.
This generates slightly better code for indexing a global/static char array with a signed 16-bit index and a positive offset, e.g. a[i+1]. Here is an example that is affected: #pragma memorymodel 1 #pragma optimize -1 char a[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int main(int argc, char *argv[]) { return a[argc+2]; }
This commit is contained in:
parent
995885540b
commit
60b472a99e
12
Gen.pas
12
Gen.pas
@ -3617,11 +3617,17 @@ else begin
|
||||
else begin
|
||||
if op^.left^.opcode = pc_lao then begin
|
||||
GenTree(op^.right);
|
||||
if signed then
|
||||
GenImplied(m_tay);
|
||||
GenNative(m_ldx_imm, immediate, op^.left^.q, op^.left^.lab, shift16);
|
||||
if signed then begin
|
||||
GenImpliedForFlags(m_tay);
|
||||
lab2 := GenLabel;
|
||||
GenNative(m_bpl, relative, lab2, nil, 0);
|
||||
GenImplied(m_dex);
|
||||
GenLab(lab2);
|
||||
signed := false;
|
||||
end; {if}
|
||||
GenImplied(m_clc);
|
||||
GenNative(m_adc_imm, immediate, op^.left^.q, op^.left^.lab, 0);
|
||||
GenNative(m_ldx_imm, immediate, op^.left^.q, op^.left^.lab, shift16);
|
||||
end {if}
|
||||
else begin
|
||||
gLong.preference := onStack;
|
||||
|
Loading…
Reference in New Issue
Block a user