Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/CodeGen/x86/x86CG.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/CodeGen/x86/x86CG.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 732, Mon Nov 13 21:59:12 2000 UTC revision 733, Fri Nov 17 05:13:45 2000 UTC
# Line 94  Line 94 
94    
95        (* For dead code elimination *)        (* For dead code elimination *)
96        exception X86DeadCode        exception X86DeadCode
97        val affectedBlocks = Intmap.new(32,X86DeadCode) : bool Intmap.intmap        val affectedBlocks =
98        val deadRegs       = Intmap.new(32,X86DeadCode) : bool Intmap.intmap            IntHashTable.mkTable(32,X86DeadCode) : bool IntHashTable.hash_table
99          val deadRegs       =
100              IntHashTable.mkTable(32,X86DeadCode) : bool IntHashTable.hash_table
101        fun removeDeadCode(F.CLUSTER{blocks, ...}) =        fun removeDeadCode(F.CLUSTER{blocks, ...}) =
102        let val isDead = Intmap.mapWithDefault(deadRegs, false)        let fun isDead i = getOpt (IntHashTable.find deadRegs i, false)
103            val isAffected = Intmap.mapWithDefault(affectedBlocks, false)            fun isAffected i = getOpt (IntHashTable.find affectedBlocks i, false)
104            fun isDeadInstr(I.ANNOTATION{i, ...}) = isDeadInstr i            fun isDeadInstr(I.ANNOTATION{i, ...}) = isDeadInstr i
105              | isDeadInstr(I.MOVE{dst=I.Direct rd, ...}) = isDead rd              | isDeadInstr(I.MOVE{dst=I.Direct rd, ...}) = isDead rd
106              | isDeadInstr(I.MOVE{dst=I.MemReg rd, ...}) = isDead rd              | isDeadInstr(I.MOVE{dst=I.MemReg rd, ...}) = isDead rd
# Line 117  Line 119 
119              if isDeadInstr i then              if isDeadInstr i then
120                 ((* deadcode := !deadcode + 1; *) elim(instrs, code))                 ((* deadcode := !deadcode + 1; *) elim(instrs, code))
121              else elim(instrs, i::code)              else elim(instrs, i::code)
122        in if Intmap.elems affectedBlocks > 0 then        in if IntHashTable.numItems affectedBlocks > 0 then
123              (scan blocks; Intmap.clear deadRegs; Intmap.clear affectedBlocks)              (scan blocks;
124                 IntHashTable.clear deadRegs;
125                 IntHashTable.clear affectedBlocks)
126           else ()           else ()
127        end        end
128    
# Line 134  Line 138 
138           val firstFPSpill = ref true           val firstFPSpill = ref true
139           fun spillInit(GRAPH{nodes, ...}, I.C.GP) =           fun spillInit(GRAPH{nodes, ...}, I.C.GP) =
140               if !firstSpill then (* only do this once! *)               if !firstSpill then (* only do this once! *)
141               let val lookup = Intmap.map nodes               let val lookup = IntHashTable.lookup nodes
142                   fun find(r, free) =                   fun find(r, free) =
143                       if r >= 10 then (* note, %8 and %9 are reserved! *)                       if r >= 10 then (* note, %8 and %9 are reserved! *)
144                          let val free =                          let val free =
# Line 152  Line 156 
156                else ()                else ()
157              | spillInit(GRAPH{nodes, ...}, I.C.FP) =              | spillInit(GRAPH{nodes, ...}, I.C.FP) =
158                if !firstFPSpill andalso !fast_floating_point then                if !firstFPSpill andalso !fast_floating_point then
159                let val lookup = Intmap.map nodes                let val lookup = IntHashTable.lookup nodes
160                   fun find(r, free) =                   fun find(r, free) =
161                       if r >= 32+8 then                       if r >= 32+8 then
162                          let val free =                          let val free =
# Line 363  Line 367 
367        fun spillInit () =        fun spillInit () =
368          (firstSpill := true;          (firstSpill := true;
369           firstFPSpill := true;           firstFPSpill := true;
370           Intmap.clear affectedBlocks;           IntHashTable.clear affectedBlocks;
371           Intmap.clear deadRegs;           IntHashTable.clear deadRegs;
372           X86StackSpills.init();           X86StackSpills.init();
373           if !fast_floating_point then FR8.reset() else FR32.reset();           if !fast_floating_point then FR8.reset() else FR32.reset();
374           GR8.reset())           GR8.reset())

Legend:
Removed from v.732  
changed lines
  Added in v.733

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0