@@ -465,75 +465,81 @@ object (self)
465465
466466 method add_register_spill
467467 ~(offset : int ) (reg : register_t ) (iaddr :ctxt_iaddress_t ) =
468- let spill = RegisterSpill (offset, reg) in
469- begin
470- (if H. mem stackslots offset then
471- if (H. find stackslots offset)#is_spill then
472- ()
473- else
474- let sslot = H. find stackslots offset in
475- raise
476- (BCH_failure
477- (LBLOCK [
478- STR " Add register spill at address " ;
479- STR iaddr;
480- STR " for register " ;
481- STR (register_to_string reg);
482- STR " at offset " ;
483- INT offset;
484- STR " cannot be completed, because another stackslot " ;
485- STR " at this offset, with name: " ;
486- STR sslot#name;
487- STR " already exists" ]))
488- else
489- let ssrec = {
490- sslot_name = (register_to_string reg) ^ " _spill" ;
491- sslot_offset = offset;
492- sslot_btype = t_unknown;
493- sslot_spill = Some reg;
494- sslot_size = Some 4 ;
495- sslot_desc = Some " register spill"
496- } in
497- let sslot = new stackslot_t ssrec in
498- H. add stackslots offset sslot);
468+ if BCHCPURegisters. is_temporary_register reg then
469+ ()
470+ else
471+ let spill = RegisterSpill (offset, reg) in
472+ begin
473+ (if H. mem stackslots offset then
474+ if (H. find stackslots offset)#is_spill then
475+ ()
476+ else
477+ let sslot = H. find stackslots offset in
478+ raise
479+ (BCH_failure
480+ (LBLOCK [
481+ STR " Add register spill at address " ;
482+ STR iaddr;
483+ STR " for register " ;
484+ STR (register_to_string reg);
485+ STR " at offset " ;
486+ INT offset;
487+ STR " cannot be completed, because another stackslot " ;
488+ STR " at this offset, with name: " ;
489+ STR sslot#name;
490+ STR " already exists" ]))
491+ else
492+ let ssrec = {
493+ sslot_name = (register_to_string reg) ^ " _spill" ;
494+ sslot_offset = offset;
495+ sslot_btype = t_unknown;
496+ sslot_spill = Some reg;
497+ sslot_size = Some 4 ;
498+ sslot_desc = Some " register spill"
499+ } in
500+ let sslot = new stackslot_t ssrec in
501+ H. add stackslots offset sslot);
499502 self#add_access offset iaddr spill
500- end
503+ end
501504
502505 method add_register_restore
503506 ~(offset : int ) (reg : register_t ) (iaddr : ctxt_iaddress_t ) =
504- let restore = RegisterRestore (offset, reg) in
505- begin
506- (if H. mem stackslots offset then
507- if (H. find stackslots offset)#is_spill then
508- ()
509- else
510- let sslot = H. find stackslots offset in
511- raise
512- (BCH_failure
513- (LBLOCK [
514- STR " Add register restore at address " ;
515- STR iaddr;
516- STR " for register " ;
517- STR (register_to_string reg);
518- STR " at offset " ;
519- INT offset;
520- STR " cannot be completed, because another stackslot " ;
521- STR " at this offset, with name: " ;
522- STR sslot#name;
523- STR " already exists" ]))
524- else
525- let ssrec = {
526- sslot_name = (register_to_string reg) ^ " _spill" ;
527- sslot_offset = offset;
528- sslot_btype = t_unknown;
529- sslot_spill = Some reg;
530- sslot_size = Some 4 ;
531- sslot_desc = Some " register_spill"
532- } in
533- let sslot = new stackslot_t ssrec in
534- H. add stackslots offset sslot);
535- self#add_access offset iaddr restore
536- end
507+ if BCHCPURegisters. is_temporary_register reg then
508+ ()
509+ else
510+ let restore = RegisterRestore (offset, reg) in
511+ begin
512+ (if H. mem stackslots offset then
513+ if (H. find stackslots offset)#is_spill then
514+ ()
515+ else
516+ let sslot = H. find stackslots offset in
517+ raise
518+ (BCH_failure
519+ (LBLOCK [
520+ STR " Add register restore at address " ;
521+ STR iaddr;
522+ STR " for register " ;
523+ STR (register_to_string reg);
524+ STR " at offset " ;
525+ INT offset;
526+ STR " cannot be completed, because another stackslot " ;
527+ STR " at this offset, with name: " ;
528+ STR sslot#name;
529+ STR " already exists" ]))
530+ else
531+ let ssrec = {
532+ sslot_name = (register_to_string reg) ^ " _spill" ;
533+ sslot_offset = offset;
534+ sslot_btype = t_unknown;
535+ sslot_spill = Some reg;
536+ sslot_size = Some 4 ;
537+ sslot_desc = Some " register_spill"
538+ } in
539+ let sslot = new stackslot_t ssrec in
540+ H. add stackslots offset sslot);
541+ self#add_access offset iaddr restore
542+ end
537543
538544 method add_load
539545 ~(baseoffset :int )
0 commit comments