diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index 1e709be0c5..0503d6fe07 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -220,6 +220,8 @@ interface { cut type, required for alphanumeric ordering of the assembler filenames } TCutPlace=(cut_normal,cut_begin,cut_end); + TRegAllocType = (ra_alloc,ra_dealloc,ra_resize); + TMarker = (NoPropInfoStart,NoPropInfoEnd, AsmBlockStart,AsmBlockEnd, InlineStart,InlineEnd,marker_blockstart, @@ -466,10 +468,11 @@ interface end; tai_regalloc = class(tai) - allocation : boolean; - reg : tregister; + reg : tregister; + ratype : TRegAllocType; constructor alloc(r : tregister); constructor dealloc(r : tregister); + constructor resize(r : tregister); constructor ppuload(t:taitype;ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override; end; @@ -1567,7 +1570,7 @@ implementation begin inherited create; typ:=ait_regalloc; - allocation:=true; + ratype:=ra_alloc; reg:=r; end; @@ -1576,7 +1579,16 @@ implementation begin inherited create; typ:=ait_regalloc; - allocation:=false; + ratype:=ra_dealloc; + reg:=r; + end; + + + constructor tai_regalloc.resize(r : tregister); + begin + inherited create; + typ:=ait_regalloc; + ratype:=ra_resize; reg:=r; end; @@ -1585,7 +1597,7 @@ implementation begin inherited ppuload(t,ppufile); ppufile.getdata(reg,sizeof(Tregister)); - allocation:=boolean(ppufile.getbyte); + ratype:=tregalloctype(ppufile.getbyte); end; @@ -1593,7 +1605,7 @@ implementation begin inherited ppuwrite(ppufile); ppufile.putdata(reg,sizeof(Tregister)); - ppufile.putbyte(byte(allocation)); + ppufile.putbyte(byte(ratype)); end; @@ -2009,7 +2021,10 @@ implementation end. { $Log$ - Revision 1.82 2004-04-12 18:59:32 florian + Revision 1.83 2004-05-22 23:34:27 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.82 2004/04/12 18:59:32 florian * small x86_64 fixes Revision 1.81 2004/03/16 22:12:10 florian diff --git a/compiler/aggas.pas b/compiler/aggas.pas index b7f349a883..8b54d1e1b8 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -31,7 +31,7 @@ interface uses dos, cclasses, - globals, + globals, aasmbase,aasmtai,aasmcpu, assemble; @@ -287,7 +287,8 @@ var procedure TGNUAssembler.WriteTree(p:TAAsmoutput); const - allocstr : array[boolean] of string[10]=(' released',' allocated'); + regallocstr : array[tregalloctype] of string[10]=(' released',' allocated','resized'); + tempallocstr : array[boolean] of string[10]=(' released',' allocated'); var ch : char; hp : tai; @@ -386,7 +387,7 @@ var begin if (cs_asm_regalloc in aktglobalswitches) then AsmWriteLn(#9+target_asm.comment+'Register '+gas_regname(Tai_regalloc(hp).reg)+ - allocstr[tai_regalloc(hp).allocation]); + regallocstr[tai_regalloc(hp).ratype]); end; ait_tempalloc : @@ -400,7 +401,7 @@ var else {$endif EXTDEBUG} AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+ - tostr(tai_tempalloc(hp).tempsize)+allocstr[tai_tempalloc(hp).allocation]); + tostr(tai_tempalloc(hp).tempsize)+tempallocstr[tai_tempalloc(hp).allocation]); end; end; @@ -878,7 +879,10 @@ var end. { $Log$ - Revision 1.51 2004-04-27 13:38:24 florian + Revision 1.52 2004-05-22 23:34:27 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.51 2004/04/27 13:38:24 florian * fixed wrong commit from yesterday Revision 1.50 2004/04/25 21:26:16 florian diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index f84b2f56ec..38382816dd 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -104,7 +104,7 @@ unit cgobj; procedure do_register_allocation(list:Taasmoutput;headertai:tai);virtual; - function makeregsize(reg:Tregister;size:Tcgsize):Tregister; + function makeregsize(list:Taasmoutput;reg:Tregister;size:Tcgsize):Tregister; {# Returns the tcgsize corresponding with the size of reg.} class function reg_cgsize(const reg: tregister) : tcgsize; virtual; @@ -547,16 +547,6 @@ implementation end; - function Tcg.makeregsize(reg:Tregister;size:Tcgsize):Tregister; - var - subreg:Tsubregister; - begin - subreg:=cgsize2subreg(size); - result:=reg; - setsubreg(result,subreg); - end; - - {***************************************************************************** register allocation ******************************************************************************} @@ -626,6 +616,19 @@ implementation end; + function Tcg.makeregsize(list:Taasmoutput;reg:Tregister;size:Tcgsize):Tregister; + var + subreg:Tsubregister; + begin + subreg:=cgsize2subreg(size); + result:=reg; + setsubreg(result,subreg); + { notify RA } + if result<>reg then + list.concat(tai_regalloc.resize(result)); + end; + + procedure tcg.getexplicitregister(list:Taasmoutput;r:Tregister); begin if not assigned(rg[getregtype(r)]) then @@ -2137,7 +2140,10 @@ finalization end. { $Log$ - Revision 1.163 2004-04-29 19:56:36 daniel + Revision 1.164 2004-05-22 23:34:27 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.163 2004/04/29 19:56:36 daniel * Prepare compiler infrastructure for multiple ansistring types Revision 1.162 2004/04/18 07:52:43 florian diff --git a/compiler/i386/ag386int.pas b/compiler/i386/ag386int.pas index b0f551408a..7db82e3fa1 100644 --- a/compiler/i386/ag386int.pas +++ b/compiler/i386/ag386int.pas @@ -335,7 +335,8 @@ implementation procedure T386IntelAssembler.WriteTree(p:TAAsmoutput); const - allocstr : array[boolean] of string[10]=(' released',' allocated'); + regallocstr : array[tregalloctype] of string[10]=(' released',' allocated','resized'); + tempallocstr : array[boolean] of string[10]=(' released',' allocated'); var s, prefix, @@ -419,7 +420,7 @@ implementation begin if (cs_asm_regalloc in aktglobalswitches) then AsmWriteLn(target_asm.comment+'Register '+masm_regname(tai_regalloc(hp).reg)+ - allocstr[tai_regalloc(hp).allocation]); + regallocstr[tai_regalloc(hp).ratype]); end; ait_tempalloc : @@ -433,7 +434,7 @@ implementation else {$endif EXTDEBUG} AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+ - tostr(tai_tempalloc(hp).tempsize)+allocstr[tai_tempalloc(hp).allocation]); + tostr(tai_tempalloc(hp).tempsize)+tempallocstr[tai_tempalloc(hp).allocation]); end; end; @@ -883,7 +884,10 @@ initialization end. { $Log$ - Revision 1.47 2004-03-17 12:03:00 olle + Revision 1.48 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.47 2004/03/17 12:03:00 olle * bugfix for multiline string constants Revision 1.46 2004/02/27 10:21:05 florian diff --git a/compiler/i386/ag386nsm.pas b/compiler/i386/ag386nsm.pas index ed833abb6c..2dea0ce08c 100644 --- a/compiler/i386/ag386nsm.pas +++ b/compiler/i386/ag386nsm.pas @@ -354,7 +354,8 @@ interface procedure T386NasmAssembler.WriteTree(p:taasmoutput); const - allocstr : array[boolean] of string[10]=(' released',' allocated'); + regallocstr : array[tregalloctype] of string[10]=(' released',' allocated','resized'); + tempallocstr : array[boolean] of string[10]=(' released',' allocated'); var s : string; hp : tai; @@ -439,7 +440,7 @@ interface begin if (cs_asm_regalloc in aktglobalswitches) then AsmWriteLn(#9#9+target_asm.comment+'Register '+nasm_regname(tai_regalloc(hp).reg)+ - allocstr[tai_regalloc(hp).allocation]); + regallocstr[tai_regalloc(hp).ratype]); end; ait_tempalloc : @@ -453,7 +454,7 @@ interface else {$endif EXTDEBUG} AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+ - tostr(tai_tempalloc(hp).tempsize)+allocstr[tai_tempalloc(hp).allocation]); + tostr(tai_tempalloc(hp).tempsize)+tempallocstr[tai_tempalloc(hp).allocation]); end; end; @@ -924,7 +925,10 @@ initialization end. { $Log$ - Revision 1.44 2004-02-27 10:21:05 florian + Revision 1.45 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.44 2004/02/27 10:21:05 florian * top_symbol killed + refaddr to treference added + refsymbol to treference added diff --git a/compiler/i386/daopt386.pas b/compiler/i386/daopt386.pas index 3e1baa8039..1548112861 100644 --- a/compiler/i386/daopt386.pas +++ b/compiler/i386/daopt386.pas @@ -322,10 +322,12 @@ begin while assigned(p) and (p.typ=ait_RegAlloc) Do begin - if tai_regalloc(p).allocation then - UsedRegs := UsedRegs + [tai_regalloc(p).reg] - else - UsedRegs := UsedRegs - [tai_regalloc(p).reg]; + case tai_regalloc(p).ratype of + ra_alloc : + UsedRegs := UsedRegs + [tai_regalloc(p).reg]; + ra_dealloc : + UsedRegs := UsedRegs - [tai_regalloc(p).reg]; + end; p := tai(p.next); end; until not(assigned(p)) or @@ -338,7 +340,7 @@ end; {************************ Create the Label table ************************} -function findregalloc(reg: tregister; starttai: tai; alloc: boolean): boolean; +function findregalloc(reg: tregister; starttai: tai; ratyp: tregalloctype): boolean; { Returns true if a ait_alloc object for reg is found in the block of tai's } { starting with Starttai and ending with the next "real" instruction } var @@ -355,7 +357,7 @@ begin if assigned(starttai) and (starttai.typ = ait_regalloc) then begin - if (tai_regalloc(Starttai).allocation = alloc) and + if (tai_regalloc(Starttai).ratype = ratyp) and (getsupreg(tai_regalloc(Starttai).reg) = supreg) then begin findregalloc:=true; @@ -379,7 +381,7 @@ procedure RemoveLastDeallocForFuncRes(asml: taasmoutput; p: tai); hp2 := tai(hp2.previous); if assigned(hp2) and (hp2.typ = ait_regalloc) and - not(tai_regalloc(hp2).allocation) and + (tai_regalloc(hp2).ratype=ra_dealloc) and (getregtype(tai_regalloc(hp2).reg) = R_INTREGISTER) and (getsupreg(tai_regalloc(hp2).reg) = supreg) then begin @@ -1087,10 +1089,14 @@ begin (p.typ=ait_RegAlloc) Do begin if (getregtype(tai_regalloc(p).reg) = R_INTREGISTER) then - if tai_regalloc(p).allocation then - UsedRegs := UsedRegs + [getsupreg(tai_regalloc(p).reg)] - else - UsedRegs := UsedRegs - [getsupreg(tai_regalloc(p).reg)]; + begin + case tai_regalloc(p).ratype of + ra_alloc : + UsedRegs := UsedRegs + [getsupreg(tai_regalloc(p).reg)]; + ra_dealloc : + UsedRegs := UsedRegs - [getsupreg(tai_regalloc(p).reg)]; + end; + end; p := tai(p.next); end; until not(assigned(p)) or @@ -1146,10 +1152,10 @@ begin begin if first then begin - firstRemovedWasAlloc := tai_regalloc(p1).allocation; + firstRemovedWasAlloc := (tai_regalloc(p1).ratype=ra_alloc); first := false; end; - lastRemovedWasDealloc := not tai_regalloc(p1).allocation; + lastRemovedWasDealloc := (tai_regalloc(p1).ratype=ra_dealloc); hp := tai(p1.Next); asml.Remove(p1); p1.free; @@ -1193,7 +1199,7 @@ begin p := tai(p.previous); if (p.typ = ait_regalloc) and (getsupreg(tai_regalloc(p).reg) = supreg) then - if not(tai_regalloc(p).allocation) then + if (tai_regalloc(p).ratype=ra_dealloc) then if first then begin findregdealloc := true; @@ -2010,30 +2016,32 @@ begin ait_regalloc: begin supreg:=getsupreg(tai_regalloc(p).reg); - if tai_regalloc(p).allocation then - begin - if not(supreg in usedregs) then - include(usedregs, supreg) - else - addregdeallocfor(list, tai_regalloc(p).reg, p); - end - else - begin - exclude(usedregs, supreg); - hp1 := p; - hp2 := nil; - while not(findregalloc(tai_regalloc(p).reg, tai(hp1.next),true)) and - getnextinstruction(hp1, hp1) and - regininstruction(getsupreg(tai_regalloc(p).reg), hp1) Do - hp2 := hp1; - if hp2 <> nil then - begin - hp1 := tai(p.previous); - list.remove(p); - insertllitem(list, hp2, tai(hp2.next), p); - p := hp1; - end; - end; + case tai_regalloc(p).ratype of + ra_alloc : + begin + if not(supreg in usedregs) then + include(usedregs, supreg) + else + addregdeallocfor(list, tai_regalloc(p).reg, p); + end; + ra_dealloc : + begin + exclude(usedregs, supreg); + hp1 := p; + hp2 := nil; + while not(findregalloc(tai_regalloc(p).reg, tai(hp1.next),ra_alloc)) and + getnextinstruction(hp1, hp1) and + regininstruction(getsupreg(tai_regalloc(p).reg), hp1) Do + hp2 := hp1; + if hp2 <> nil then + begin + hp1 := tai(p.previous); + list.remove(p); + insertllitem(list, hp2, tai(hp2.next), p); + p := hp1; + end; + end; + end; end; {$endif i386} end; @@ -2711,7 +2719,10 @@ end. { $Log$ - Revision 1.66 2004-02-27 19:55:23 jonas + Revision 1.67 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.66 2004/02/27 19:55:23 jonas * fixed optimizer for new treference fields Revision 1.65 2004/02/27 10:21:05 florian diff --git a/compiler/i386/n386set.pas b/compiler/i386/n386set.pas index 2b369ce5fe..aadf540e5e 100644 --- a/compiler/i386/n386set.pas +++ b/compiler/i386/n386set.pas @@ -114,7 +114,7 @@ implementation end; objectlibrary.getlabel(table); { make it a 32bit register } - indexreg:=cg.makeregsize(hregister,OS_INT); + indexreg:=cg.makeregsize(exprasmlist,hregister,OS_INT); cg.a_load_reg_reg(exprasmlist,opsize,OS_INT,hregister,indexreg); { create reference } reference_reset_symbol(href,table,0); @@ -224,7 +224,10 @@ begin end. { $Log$ - Revision 1.73 2004-02-27 10:21:05 florian + Revision 1.74 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.73 2004/02/27 10:21:05 florian * top_symbol killed + refaddr to treference added + refsymbol to treference added diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index 706ae771d8..67a31a57c7 100644 --- a/compiler/ncgcal.pas +++ b/compiler/ncgcal.pas @@ -594,7 +594,7 @@ implementation { change register size after the unget because the getregister was done for the full register } location.register:=cg.getintregister(exprasmlist,cgsize); - cg.a_load_reg_reg(exprasmlist,cgsize,cgsize,cg.makeregsize(NR_FUNCTION_RESULT_REG,cgsize),location.register); + cg.a_load_reg_reg(exprasmlist,cgsize,cgsize,cg.makeregsize(exprasmlist,NR_FUNCTION_RESULT_REG,cgsize),location.register); end; end else @@ -1272,7 +1272,10 @@ begin end. { $Log$ - Revision 1.165 2004-04-28 15:19:03 florian + Revision 1.166 2004-05-22 23:34:27 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.165 2004/04/28 15:19:03 florian + syscall directive support for MorphOS added Revision 1.164 2004/03/14 20:10:56 peter diff --git a/compiler/ncginl.pas b/compiler/ncginl.pas index a31d3af211..fdd135d2d4 100644 --- a/compiler/ncginl.pas +++ b/compiler/ncginl.pas @@ -332,7 +332,7 @@ implementation objectlibrary.getlabel(lengthlab); cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,left.location.register,lengthlab); reference_reset_base(href,left.location.register,-8); - hregister:=cg.makeregsize(left.location.register,OS_32); + hregister:=cg.makeregsize(exprasmlist,left.location.register,OS_32); cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,hregister); cg.a_label(exprasmlist,lengthlab); location_reset(location,LOC_REGISTER,OS_32); @@ -678,7 +678,10 @@ end. { $Log$ - Revision 1.56 2004-03-02 00:36:33 olle + Revision 1.57 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.56 2004/03/02 00:36:33 olle * big transformation of Tai_[const_]Symbol.Create[data]name* Revision 1.55 2004/02/27 10:21:05 florian diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index 81feaf1727..9764765795 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -533,7 +533,7 @@ implementation LOC_REGISTER, LOC_CREGISTER : begin - r:=cg.makeregsize(right.location.register,OS_8); + r:=cg.makeregsize(exprasmlist,right.location.register,OS_8); cg.a_load_reg_ref(exprasmlist,OS_8,OS_8,r,href); end; LOC_REFERENCE, @@ -942,7 +942,10 @@ begin end. { $Log$ - Revision 1.115 2004-04-29 19:56:37 daniel + Revision 1.116 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.115 2004/04/29 19:56:37 daniel * Prepare compiler infrastructure for multiple ansistring types Revision 1.114 2004/03/02 17:32:12 florian diff --git a/compiler/ncgopt.pas b/compiler/ncgopt.pas index 80b4274748..867bd08fc3 100644 --- a/compiler/ncgopt.pas +++ b/compiler/ncgopt.pas @@ -185,7 +185,7 @@ begin end else cg.a_load_const_ref(exprasmlist,OS_8,tordconstnode(right).value,href2); - lengthreg:=cg.makeregsize(lengthreg,OS_8); + lengthreg:=cg.makeregsize(exprasmlist,lengthreg,OS_8); { increase the string length } cg.a_op_const_reg(exprasmlist,OP_ADD,OS_8,1,lengthreg); cg.a_load_reg_ref(exprasmlist,OS_8,OS_8,lengthreg,left.location.reference); @@ -201,7 +201,10 @@ end. { $Log$ - Revision 1.12 2004-01-31 17:45:17 peter + Revision 1.13 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.12 2004/01/31 17:45:17 peter * Change several $ifdef i386 to x86 * Change several OS_32 to OS_INT/OS_ADDR diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 51e610eea9..6feef961e9 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -324,7 +324,7 @@ implementation cg.deallocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default)); cg.g_exception_reason_save(list, t.reasonbuf); - cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,cg.makeregsize(NR_FUNCTION_RESULT_REG,OS_S32),exceptlabel); + cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,cg.makeregsize(list,NR_FUNCTION_RESULT_REG,OS_S32),exceptlabel); end; @@ -367,7 +367,7 @@ implementation { load a smaller size to OS_64 } if l.loc=LOC_REGISTER then begin - hregister:=cg.makeregsize(l.registerlow,OS_32); + hregister:=cg.makeregsize(list,l.registerlow,OS_32); cg.a_load_reg_reg(list,l.size,OS_32,l.registerlow,hregister); end else @@ -470,7 +470,7 @@ implementation if (TCGSize2Size[dst_size]<TCGSize2Size[l.size]) then begin if (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then - l.register:=cg.makeregsize(l.register,dst_size); + l.register:=cg.makeregsize(list,l.register,dst_size); { for big endian systems, the reference's offset must } { be increased in this case, since they have the } { MSB first in memory and e.g. byte(word_var) should } @@ -538,7 +538,7 @@ implementation if (TCGSize2Size[dst_size]<TCGSize2Size[l.size]) then begin if (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then - l.register:=cg.makeregsize(l.register,dst_size); + l.register:=cg.makeregsize(list,l.register,dst_size); { for big endian systems, the reference's offset must } { be increased in this case, since they have the } { MSB first in memory and e.g. byte(word_var) should } @@ -1053,7 +1053,7 @@ implementation {$endif cpu64bit} begin cg.getexplicitregister(list,NR_FUNCTION_RETURN_REG); - hreg:=cg.makeregsize(NR_FUNCTION_RETURN_REG,resloc.size); + hreg:=cg.makeregsize(list,NR_FUNCTION_RETURN_REG,resloc.size); cg.ungetregister(list,hreg); // for the optimizer cg.a_reg_alloc(list,NR_FUNCTION_RETURN_REG); @@ -1094,7 +1094,7 @@ implementation {$endif cpu64bit} begin cg.getexplicitregister(list,NR_FUNCTION_RETURN_REG); - hreg:=cg.makeregsize(NR_FUNCTION_RETURN_REG,resloc.size); + hreg:=cg.makeregsize(list,NR_FUNCTION_RETURN_REG,resloc.size); cg.ungetregister(list,hreg); // for the optimizer cg.a_reg_alloc(list,NR_FUNCTION_RETURN_REG); @@ -2139,7 +2139,10 @@ implementation end. { $Log$ - Revision 1.199 2004-05-19 21:16:12 peter + Revision 1.200 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.199 2004/05/19 21:16:12 peter * add DEBUGINFO symbol to reference the .o file that includes the stabs info for types and global/static variables * debuginfo flag added to ppu to indicate whether debuginfo is diff --git a/compiler/rgobj.pas b/compiler/rgobj.pas index 246b09d856..30a0dc6a85 100644 --- a/compiler/rgobj.pas +++ b/compiler/rgobj.pas @@ -1504,7 +1504,7 @@ implementation while assigned(p) and assigned(p.previous) and (tai(p.previous).typ=ait_regalloc) and - tai_regalloc(p.previous).allocation and + (tai_regalloc(p.previous).ratype=ra_alloc) and (tai_regalloc(p.previous).reg<>r) do p:=tai(p.previous); list.insertbefore(Tai_regalloc.dealloc(r),p); @@ -1542,11 +1542,19 @@ implementation if (getregtype(reg)=regtype) then begin supreg:=getsupreg(reg); - if allocation then - live_registers.add(supreg) - else - live_registers.delete(supreg); - add_edges_used(supreg); + case ratype of + ra_alloc : + begin + live_registers.add(supreg); + add_edges_used(supreg); + end; + ra_dealloc : + begin + live_registers.delete(supreg); + add_edges_used(supreg); + end; + end; + { constraints needs always to be updated } add_constraints(reg); end; end; @@ -1604,7 +1612,7 @@ implementation { deallocation,allocation } { note: do not remove allocation,deallocation, those } { do have a real meaning } - (not(Tai_regalloc(previous).allocation) and allocation) then + (not(Tai_regalloc(previous).ratype=ra_alloc) and (ratype=ra_alloc)) then begin q:=Tai(next); hp:=tai(previous); @@ -1674,7 +1682,7 @@ implementation begin supreg:=getsupreg(Tai_regalloc(p).reg); {Rewind the register allocation.} - if Tai_regalloc(p).allocation then + if (Tai_regalloc(p).ratype=ra_alloc) then live_registers.delete(supreg) else begin @@ -1715,10 +1723,12 @@ implementation begin if p.typ<>ait_regalloc then internalerror(200305311); - if Tai_regalloc(p).allocation then - live_registers.add(getsupreg(Tai_regalloc(p).reg)) - else - live_registers.delete(getsupreg(Tai_regalloc(p).reg)); + case Tai_regalloc(p).ratype of + ra_alloc : + live_registers.add(getsupreg(Tai_regalloc(p).reg)); + ra_dealloc : + live_registers.delete(getsupreg(Tai_regalloc(p).reg)); + end; p:=Tai(p.next); end; end; @@ -1779,10 +1789,14 @@ implementation continue; end else - if allocation then - live_registers.add(supreg) - else - live_registers.delete(supreg); + begin + case ratype of + ra_alloc : + live_registers.add(supreg); + ra_dealloc : + live_registers.delete(supreg); + end; + end; end; end; ait_instruction: @@ -2023,7 +2037,10 @@ implementation end. { $Log$ - Revision 1.125 2004-04-26 19:57:50 jonas + Revision 1.126 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.125 2004/04/26 19:57:50 jonas * do not remove "allocation,deallocation" pairs, as those are important for the optimizer diff --git a/compiler/symtable.pas b/compiler/symtable.pas index c228742576..499733b902 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -1030,7 +1030,7 @@ implementation else begin { packrecords is set explicit, ignore recordalignmax limit } - varalignrecord:=used_align(varalign,aktalignment.recordalignmin,varalign); + varalignrecord:=used_align(varalign,aktalignment.recordalignmin,usefieldalignment); end; recordalignment:=max(recordalignment,varalignrecord); end; @@ -2308,7 +2308,10 @@ implementation end. { $Log$ - Revision 1.145 2004-04-29 19:56:37 daniel + Revision 1.146 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.145 2004/04/29 19:56:37 daniel * Prepare compiler infrastructure for multiple ansistring types Revision 1.144 2004/03/14 20:08:37 peter diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 7f8a71d31b..66661a4c83 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -451,7 +451,7 @@ unit cgx86; (reference.index=NR_STACK_POINTER_REG) then begin pushsize:=int_cgsize(alignment); - list.concat(taicpu.op_reg(A_PUSH,tcgsize2opsize[pushsize],makeregsize(r,pushsize))); + list.concat(taicpu.op_reg(A_PUSH,tcgsize2opsize[pushsize],makeregsize(list,r,pushsize))); end else inherited a_param_reg(list,size,r,locpara); @@ -591,7 +591,7 @@ unit cgx86; which clears the upper 64 bit too, so it could be that s is S_L while the reg is 64 bit (FK) } if s in [S_BL,S_WL,S_L] then - tmpreg:=makeregsize(tmpreg,OS_32); + tmpreg:=makeregsize(list,tmpreg,OS_32); {$endif x86_64} list.concat(taicpu.op_reg_reg(op,s,reg,tmpreg)); a_load_reg_ref(list,tosize,tosize,tmpreg,ref); @@ -615,7 +615,7 @@ unit cgx86; which clears the upper 64 bit too, so it could be that s is S_L while the reg is 64 bit (FK) } if s in [S_BL,S_WL,S_L] then - reg:=makeregsize(reg,OS_32); + reg:=makeregsize(list,reg,OS_32); {$endif x86_64} list.concat(taicpu.op_ref_reg(op,s,ref,reg)); end; @@ -631,7 +631,7 @@ unit cgx86; check_register_size(tosize,reg2); if tcgsize2size[fromsize]>tcgsize2size[tosize] then begin - reg1:=makeregsize(reg1,tosize); + reg1:=makeregsize(list,reg1,tosize); s:=tcgsize2opsize[tosize]; op:=A_MOV; end @@ -642,7 +642,7 @@ unit cgx86; which clears the upper 64 bit too, so it could be that s is S_L while the reg is 64 bit (FK) } if s in [S_BL,S_WL,S_L] then - reg2:=makeregsize(reg2,OS_32); + reg2:=makeregsize(list,reg2,OS_32); {$endif x86_64} instr:=taicpu.op_reg_reg(op,s,reg1,reg2); { Notify the register allocator that we have written a move instruction so @@ -1053,7 +1053,7 @@ unit cgx86; OP_SHR,OP_SHL,OP_SAR: begin getexplicitregister(list,NR_CL); - a_load_reg_reg(list,OS_8,OS_8,makeregsize(src,OS_8),NR_CL); + a_load_reg_reg(list,OS_8,OS_8,makeregsize(list,src,OS_8),NR_CL); list.concat(taicpu.op_reg_reg(Topcg2asmop[op],tcgsize2opsize[size],NR_CL,src)); ungetregister(list,NR_CL); end; @@ -1082,7 +1082,7 @@ unit cgx86; internalerror(200109239); else begin - reg := makeregsize(reg,size); + reg := makeregsize(list,reg,size); list.concat(taicpu.op_ref_reg(TOpCG2AsmOp[op],tcgsize2opsize[size],ref,reg)); end; end; @@ -1268,7 +1268,7 @@ unit cgx86; ai : taicpu; hreg : tregister; begin - hreg:=makeregsize(reg,OS_8); + hreg:=makeregsize(list,reg,OS_8); ai:=Taicpu.op_reg(A_SETcc,S_B,hreg); ai.setcondition(flags_to_cond(f)); list.concat(ai); @@ -1790,7 +1790,10 @@ unit cgx86; end. { $Log$ - Revision 1.121 2004-04-28 15:19:03 florian + Revision 1.122 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.121 2004/04/28 15:19:03 florian + syscall directive support for MorphOS added Revision 1.120 2004/04/09 14:36:05 peter diff --git a/compiler/x86/nx86inl.pas b/compiler/x86/nx86inl.pas index 0def1fc0a9..7f2ff94b92 100644 --- a/compiler/x86/nx86inl.pas +++ b/compiler/x86/nx86inl.pas @@ -332,7 +332,7 @@ implementation { need a cmp and jmp, but this should be done by the } { type cast code which does range checking if necessary (FK) } begin - hregister:=cg.makeregsize(Tcallparanode(Tcallparanode(left).right).left.location.register,OS_INT); + hregister:=cg.makeregsize(exprasmlist,Tcallparanode(Tcallparanode(left).right).left.location.register,OS_INT); end else begin @@ -353,7 +353,10 @@ implementation end. { $Log$ - Revision 1.2 2004-02-27 10:21:06 florian + Revision 1.3 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.2 2004/02/27 10:21:06 florian * top_symbol killed + refaddr to treference added + refsymbol to treference added diff --git a/compiler/x86/nx86set.pas b/compiler/x86/nx86set.pas index c28a7f6edd..8e22e66763 100644 --- a/compiler/x86/nx86set.pas +++ b/compiler/x86/nx86set.pas @@ -206,7 +206,7 @@ implementation { use the register as base in a reference (JM) } if ranges then begin - pleftreg:=cg.makeregsize(left.location.register,OS_ADDR); + pleftreg:=cg.makeregsize(exprasmlist,left.location.register,OS_ADDR); cg.a_load_reg_reg(exprasmlist,left.location.size,OS_ADDR,left.location.register,pleftreg); if opsize<>OS_ADDR then cg.a_op_const_reg(exprasmlist,OP_AND,OS_ADDR,255,pleftreg); @@ -216,7 +216,7 @@ implementation { otherwise simply use the lower 8 bits (no "and" } { necessary this way) (JM) } begin - pleftreg:=cg.makeregsize(left.location.register,OS_8); + pleftreg:=cg.makeregsize(exprasmlist,left.location.register,OS_8); opsize := OS_8; end; end @@ -353,7 +353,7 @@ implementation LOC_REGISTER, LOC_CREGISTER: begin - hr:=cg.makeregsize(left.location.register,OS_32); + hr:=cg.makeregsize(exprasmlist,left.location.register,OS_32); cg.a_load_reg_reg(exprasmlist,left.location.size,OS_32,left.location.register,hr); end; else @@ -414,7 +414,7 @@ implementation LOC_REGISTER, LOC_CREGISTER: begin - hr:=cg.makeregsize(left.location.register,OS_32); + hr:=cg.makeregsize(exprasmlist,left.location.register,OS_32); cg.a_load_reg_reg(exprasmlist,left.location.size,OS_32,left.location.register,hr); cg.a_cmp_const_reg_label(exprasmlist,OS_32,OC_BE,31,hr,l); { reset carry flag } @@ -472,7 +472,7 @@ implementation else begin if (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - pleftreg:=cg.makeregsize(left.location.register,OS_32) + pleftreg:=cg.makeregsize(exprasmlist,left.location.register,OS_32) else pleftreg:=cg.getintregister(exprasmlist,OS_32); cg.a_load_loc_reg(exprasmlist,OS_32,left.location,pleftreg); @@ -495,7 +495,10 @@ begin end. { $Log$ - Revision 1.2 2004-02-27 10:21:06 florian + Revision 1.3 2004-05-22 23:34:28 peter + tai_regalloc.allocation changed to ratype to notify rgobj of register size changes + + Revision 1.2 2004/02/27 10:21:06 florian * top_symbol killed + refaddr to treference added + refsymbol to treference added