|
@@ -616,6 +616,8 @@ unit cgcpu;
|
|
not(is_pc(ref.base)) and
|
|
not(is_pc(ref.base)) and
|
|
not(is_pc(ref.index))
|
|
not(is_pc(ref.index))
|
|
) or
|
|
) or
|
|
|
|
+ { [#xxx] isn't a valid address operand }
|
|
|
|
+ ((ref.base=NR_NO) and (ref.index=NR_NO)) or
|
|
(ref.offset<-4095) or
|
|
(ref.offset<-4095) or
|
|
(ref.offset>4095) or
|
|
(ref.offset>4095) or
|
|
((oppostfix in [PF_SB,PF_H,PF_SH]) and
|
|
((oppostfix in [PF_SB,PF_H,PF_SH]) and
|
|
@@ -630,21 +632,24 @@ unit cgcpu;
|
|
) then
|
|
) then
|
|
begin
|
|
begin
|
|
reference_reset(tmpref);
|
|
reference_reset(tmpref);
|
|
- { create consts entry }
|
|
|
|
- objectlibrary.getlabel(l);
|
|
|
|
- cg.a_label(current_procinfo.aktlocaldata,l);
|
|
|
|
- tmpref.symboldata:=current_procinfo.aktlocaldata.last;
|
|
|
|
|
|
|
|
|
|
+ { load symbol }
|
|
|
|
+ tmpreg:=getintregister(list,OS_INT);
|
|
if assigned(ref.symbol) then
|
|
if assigned(ref.symbol) then
|
|
- current_procinfo.aktlocaldata.concat(tai_const.create_sym_offset(ref.symbol,ref.offset))
|
|
|
|
- else
|
|
|
|
- current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
|
|
|
|
|
|
+ begin
|
|
|
|
+ objectlibrary.getlabel(l);
|
|
|
|
+ cg.a_label(current_procinfo.aktlocaldata,l);
|
|
|
|
+ tmpref.symboldata:=current_procinfo.aktlocaldata.last;
|
|
|
|
|
|
- { load consts entry }
|
|
|
|
- tmpreg:=getintregister(list,OS_INT);
|
|
|
|
- tmpref.symbol:=l;
|
|
|
|
- tmpref.base:=NR_R15;
|
|
|
|
- list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
|
|
|
|
|
|
+ current_procinfo.aktlocaldata.concat(tai_const.create_sym_offset(ref.symbol,ref.offset));
|
|
|
|
+
|
|
|
|
+ { load consts entry }
|
|
|
|
+ tmpref.symbol:=l;
|
|
|
|
+ tmpref.base:=NR_R15;
|
|
|
|
+ list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ a_load_const_reg(list,OS_ADDR,ref.offset,tmpreg);
|
|
|
|
|
|
if (ref.base<>NR_NO) then
|
|
if (ref.base<>NR_NO) then
|
|
begin
|
|
begin
|
|
@@ -1085,8 +1090,8 @@ unit cgcpu;
|
|
) then
|
|
) then
|
|
fixref(list,tmpref);
|
|
fixref(list,tmpref);
|
|
|
|
|
|
- { expect a base here }
|
|
|
|
- if tmpref.base=NR_NO then
|
|
|
|
|
|
+ { expect a base here if there is an index }
|
|
|
|
+ if (tmpref.base=NR_NO) and (tmpref.index<>NR_NO) then
|
|
internalerror(200312022);
|
|
internalerror(200312022);
|
|
|
|
|
|
if tmpref.index<>NR_NO then
|
|
if tmpref.index<>NR_NO then
|
|
@@ -1103,7 +1108,12 @@ unit cgcpu;
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
if tmpref.offset<>0 then
|
|
if tmpref.offset<>0 then
|
|
- a_op_const_reg_reg(list,OP_ADD,OS_ADDR,tmpref.offset,tmpref.base,r)
|
|
|
|
|
|
+ begin
|
|
|
|
+ if tmpref.base<>NR_NO then
|
|
|
|
+ a_op_const_reg_reg(list,OP_ADD,OS_ADDR,tmpref.offset,tmpref.base,r)
|
|
|
|
+ else
|
|
|
|
+ a_load_const_reg(list,OS_ADDR,tmpref.offset,r);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
instr:=taicpu.op_reg_reg(A_MOV,r,tmpref.base);
|
|
instr:=taicpu.op_reg_reg(A_MOV,r,tmpref.base);
|