[MLton-commit] r6750
Matthew Fluet
fluet at mlton.org
Tue Aug 19 15:14:32 PDT 2008
Labels introduced by _symbol or _address don't have blocks,
and instructions using them can't be eliminated.
----------------------------------------------------------------------
U mlton/trunk/mlton/codegen/amd64-codegen/amd64-simplify.fun
U mlton/trunk/mlton/codegen/x86-codegen/x86-simplify.fun
----------------------------------------------------------------------
Modified: mlton/trunk/mlton/codegen/amd64-codegen/amd64-simplify.fun
===================================================================
--- mlton/trunk/mlton/codegen/amd64-codegen/amd64-simplify.fun 2008-08-19 22:14:21 UTC (rev 6749)
+++ mlton/trunk/mlton/codegen/amd64-codegen/amd64-simplify.fun 2008-08-19 22:14:29 UTC (rev 6750)
@@ -1,4 +1,4 @@
-(* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
+(* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -1989,6 +1989,12 @@
fun elimBlocks {chunk = Chunk.T {data, blocks, ...},
jumpInfo : amd64JumpInfo.t}
= let
+ val {get = getIsBlock,
+ set = setIsBlock,
+ destroy = destroyIsBlock}
+ = Property.destGetSetOnce
+ (Label.plist, Property.initConst false)
+
val {get: Label.t -> {block: Block.t,
reach: bool ref},
set,
@@ -2003,6 +2009,7 @@
=> let
val label = Entry.label entry
in
+ setIsBlock(label, true);
set(label, {block = block,
reach = ref false}) ;
case entry
@@ -2025,9 +2032,13 @@
= case (Operand.deImmediate oper, Operand.deLabel oper)
of (SOME immediate, _)
=> (case Immediate.deLabel immediate
- of SOME label => ! (#reach (get label))
+ of SOME label => if getIsBlock label
+ then ! (#reach (get label))
+ else true
| NONE => true)
- | (_, SOME label) => ! (#reach (get label))
+ | (_, SOME label) => if getIsBlock label
+ then ! (#reach (get label))
+ else true
| _ => true
val changed = ref false
@@ -2065,6 +2076,7 @@
end)
val _ = destroy ()
+ val _ = destroyIsBlock ()
in
{chunk = Chunk.T {data = data, blocks = blocks},
changed = !changed}
Modified: mlton/trunk/mlton/codegen/x86-codegen/x86-simplify.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86-simplify.fun 2008-08-19 22:14:21 UTC (rev 6749)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86-simplify.fun 2008-08-19 22:14:29 UTC (rev 6750)
@@ -1,4 +1,4 @@
-(* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
+(* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -2083,6 +2083,12 @@
fun elimBlocks {chunk = Chunk.T {data, blocks, ...},
jumpInfo : x86JumpInfo.t}
= let
+ val {get = getIsBlock,
+ set = setIsBlock,
+ destroy = destroyIsBlock}
+ = Property.destGetSetOnce
+ (Label.plist, Property.initConst false)
+
val {get: Label.t -> {block: Block.t,
reach: bool ref},
set,
@@ -2097,6 +2103,7 @@
=> let
val label = Entry.label entry
in
+ setIsBlock(label, true);
set(label, {block = block,
reach = ref false}) ;
case entry
@@ -2119,9 +2126,13 @@
= case (Operand.deImmediate oper, Operand.deLabel oper)
of (SOME immediate, _)
=> (case Immediate.deLabel immediate
- of SOME label => ! (#reach (get label))
+ of SOME label => if getIsBlock label
+ then ! (#reach (get label))
+ else true
| NONE => true)
- | (_, SOME label) => ! (#reach (get label))
+ | (_, SOME label) => if getIsBlock label
+ then ! (#reach (get label))
+ else true
| _ => true
val changed = ref false
@@ -2159,6 +2170,7 @@
end)
val _ = destroy ()
+ val _ = destroyIsBlock ()
in
{chunk = Chunk.T {data = data, blocks = blocks},
changed = !changed}
More information about the MLton-commit
mailing list