[MLton-commit] r6687

Wesley Terpstra wesley at mlton.org
Tue Aug 5 17:09:49 PDT 2008


The MLton pseudoOp global might not always be hidden. This patch adds a new
pseudoOp for the hidden assembler directive. Furthermore, this directive does
not exist on windows and should not be emitted.


----------------------------------------------------------------------

U   mlton/trunk/mlton/codegen/amd64-codegen/amd64-codegen.fun
U   mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun
U   mlton/trunk/mlton/codegen/amd64-codegen/amd64.fun
U   mlton/trunk/mlton/codegen/amd64-codegen/amd64.sig
U   mlton/trunk/mlton/codegen/x86-codegen/x86-codegen.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86.sig

----------------------------------------------------------------------

Modified: mlton/trunk/mlton/codegen/amd64-codegen/amd64-codegen.fun
===================================================================
--- mlton/trunk/mlton/codegen/amd64-codegen/amd64-codegen.fun	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/amd64-codegen/amd64-codegen.fun	2008-08-06 00:09:45 UTC (rev 6687)
@@ -187,6 +187,7 @@
                   amd64.Assembly.pseudoop_p2align 
                   (amd64.Immediate.int 4, NONE, NONE),
                   amd64.Assembly.pseudoop_global jumpToSML,
+                  amd64.Assembly.pseudoop_hidden jumpToSML,
                   amd64.Assembly.label jumpToSML,
                   amd64.Assembly.instruction_binal
                   {oper = amd64.Instruction.SUB,
@@ -280,6 +281,7 @@
                   amd64.Assembly.pseudoop_p2align 
                   (amd64.Immediate.int 4, NONE, NONE),
                   amd64.Assembly.pseudoop_global returnToC,
+                  amd64.Assembly.pseudoop_hidden returnToC,
                   amd64.Assembly.label returnToC,
                   amd64.Assembly.instruction_mov
                   {src = (amd64.Operand.address o amd64.Address.T)

Modified: mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun
===================================================================
--- mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun	2008-08-06 00:09:45 UTC (rev 6687)
@@ -710,6 +710,7 @@
                                 [Assembly.pseudoop_p2align 
                                  (Immediate.int 4, NONE, NONE),
                                  Assembly.pseudoop_global label,
+                                 Assembly.pseudoop_hidden label,
                                  Assembly.label label],
                                 AppendList.fromList
                                 (ProfileLabel.toAssemblyOpt profileLabel),

Modified: mlton/trunk/mlton/codegen/amd64-codegen/amd64.fun
===================================================================
--- mlton/trunk/mlton/codegen/amd64-codegen/amd64.fun	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/amd64-codegen/amd64.fun	2008-08-06 00:09:45 UTC (rev 6687)
@@ -3084,6 +3084,7 @@
         | Quad of Immediate.t list
         | String of string list
         | Global of Label.t
+        | Hidden of Label.t
         | IndirectSymbol of Label.t
         | Local of Label.t
         | Comm of Label.t * Immediate.t * Immediate.t option
@@ -3149,9 +3150,10 @@
                                    ","))]
              | Global l 
              => seq [str ".globl ",
-                     Label.layout l,
-                     str "\n.hidden ",
                      Label.layout l]
+             | Hidden l
+             => seq [str ".hidden ",
+                     Label.layout l]
              | IndirectSymbol l 
              => seq [str ".indirect_symbol ",
                      Label.layout l]
@@ -3201,6 +3203,7 @@
              | Quad ls => Quad (List.map(ls, replacerImmediate))
              | String ss => String ss
              | Global l => Global (replacerLabel l)
+             | Hidden l => Hidden (replacerLabel l)
              | IndirectSymbol l => IndirectSymbol (replacerLabel l)
              | Local l => Local (replacerLabel l)
              | Comm (l, i, a) => Comm (replacerLabel l, 
@@ -3220,6 +3223,7 @@
       val quad = Quad
       val string = String
       val global = Global
+      val hidden = Hidden
       val indirect_symbol = IndirectSymbol
       val locall = Local
       val comm = Comm
@@ -3301,6 +3305,11 @@
       val pseudoop_quad = PseudoOp o PseudoOp.quad
       val pseudoop_string = PseudoOp o PseudoOp.string
       val pseudoop_global = PseudoOp o PseudoOp.global
+      fun pseudoop_hidden l = 
+         case !Control.Target.os of (* Windows doesn't use .hidden *)
+            MLton.Platform.OS.Cygwin => Comment (Label.toString l ^ " is hidden")
+          | MLton.Platform.OS.MinGW => Comment (Label.toString l ^ " is hidden")
+          | _ => PseudoOp (PseudoOp.hidden l)
       val pseudoop_indirect_symbol = PseudoOp o PseudoOp.indirect_symbol
       val pseudoop_local = PseudoOp o PseudoOp.locall
       val pseudoop_comm = PseudoOp o PseudoOp.comm
@@ -3721,6 +3730,7 @@
           val label = Label.fromString (toString pl)
         in
           [Assembly.pseudoop_global label,
+           Assembly.pseudoop_hidden label,
            Assembly.label label]
         end
       fun toAssemblyOpt pl =

Modified: mlton/trunk/mlton/codegen/amd64-codegen/amd64.sig
===================================================================
--- mlton/trunk/mlton/codegen/amd64-codegen/amd64.sig	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/amd64-codegen/amd64.sig	2008-08-06 00:09:45 UTC (rev 6687)
@@ -777,6 +777,7 @@
           | Quad of Immediate.t list
           | String of string list
           | Global of Label.t
+          | Hidden of Label.t
           | IndirectSymbol of Label.t
           | Local of Label.t
           | Comm of Label.t * Immediate.t * Immediate.t option
@@ -795,6 +796,7 @@
         val quad : Immediate.t list -> t
         val string : string list -> t
         val global : Label.t -> t
+        val hidden : Label.t -> t
         val indirect_symbol : Label.t -> t
         val locall : Label.t -> t
         val comm : Label.t * Immediate.t * Immediate.t option -> t
@@ -867,6 +869,7 @@
         val pseudoop_quad : Immediate.t list -> t
         val pseudoop_string : string list -> t
         val pseudoop_global : Label.t -> t
+        val pseudoop_hidden : Label.t -> t
         val pseudoop_indirect_symbol : Label.t -> t
         val pseudoop_local : Label.t -> t
         val pseudoop_comm : Label.t * Immediate.t * Immediate.t option -> t

Modified: mlton/trunk/mlton/codegen/x86-codegen/x86-codegen.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86-codegen.fun	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86-codegen.fun	2008-08-06 00:09:45 UTC (rev 6687)
@@ -190,6 +190,7 @@
                   x86.Assembly.pseudoop_p2align 
                   (x86.Immediate.int 4, NONE, NONE),
                   x86.Assembly.pseudoop_global jumpToSML,
+                  x86.Assembly.pseudoop_hidden jumpToSML,
                   x86.Assembly.label jumpToSML,
                   x86.Assembly.instruction_binal
                   {oper = x86.Instruction.SUB,
@@ -276,6 +277,7 @@
                   x86.Assembly.pseudoop_p2align 
                   (x86.Immediate.int 4, NONE, NONE),
                   x86.Assembly.pseudoop_global returnToC,
+                  x86.Assembly.pseudoop_hidden returnToC,
                   x86.Assembly.label returnToC,
                   x86.Assembly.instruction_mov
                   {src = (x86.Operand.address o x86.Address.T)

Modified: mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun	2008-08-06 00:09:45 UTC (rev 6687)
@@ -627,6 +627,7 @@
                                 [Assembly.pseudoop_p2align 
                                  (Immediate.int 4, NONE, NONE),
                                  Assembly.pseudoop_global label,
+                                 Assembly.pseudoop_hidden label,
                                  Assembly.label label],
                                 AppendList.fromList
                                 (ProfileLabel.toAssemblyOpt profileLabel),

Modified: mlton/trunk/mlton/codegen/x86-codegen/x86.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86.fun	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86.fun	2008-08-06 00:09:45 UTC (rev 6687)
@@ -3288,6 +3288,7 @@
         | Long of Immediate.t list
         | String of string list
         | Global of Label.t
+        | Hidden of Label.t
         | IndirectSymbol of Label.t
         | Local of Label.t
         | Comm of Label.t * Immediate.t * Immediate.t option
@@ -3349,12 +3350,11 @@
                                                  str "\""]),
                                    ","))]
              | Global l 
-             => seq (List.concat 
-                [ [str ".globl ", Label.layout l],
-                  case !Control.Target.os of
-                     Control.Target.MinGW => []
-                   | Control.Target.Cygwin => []
-                   | _ => [str "\n.hidden ", Label.layout l]])
+             => seq [str ".globl ", 
+                     Label.layout l]
+             | Hidden l
+             => seq [str ".hidden ",
+                     Label.layout l]
              | IndirectSymbol l 
              => seq [str ".indirect_symbol ",
                      Label.layout l]
@@ -3403,6 +3403,7 @@
              | Long ls => Long (List.map(ls, replacerImmediate))
              | String ss => String ss
              | Global l => Global (replacerLabel l)
+             | Hidden l => Hidden (replacerLabel l)
              | IndirectSymbol l => IndirectSymbol (replacerLabel l)
              | Local l => Local (replacerLabel l)
              | Comm (l, i, a) => Comm (replacerLabel l, 
@@ -3421,6 +3422,7 @@
       val long = Long
       val string = String
       val global = Global
+      val hidden = Hidden
       val indirect_symbol = IndirectSymbol
       val locall = Local
       val comm = Comm
@@ -3500,6 +3502,11 @@
       val pseudoop_long = PseudoOp o PseudoOp.long
       val pseudoop_string = PseudoOp o PseudoOp.string
       val pseudoop_global = PseudoOp o PseudoOp.global
+      fun pseudoop_hidden l =
+         case !Control.Target.os of (* Windows doesn't use .hidden *)
+            MLton.Platform.OS.Cygwin => Comment (Label.toString l ^ " is hidden")
+          | MLton.Platform.OS.MinGW => Comment (Label.toString l ^ " is hidden")
+          | _ => PseudoOp (PseudoOp.hidden l)
       val pseudoop_indirect_symbol = PseudoOp o PseudoOp.indirect_symbol
       val pseudoop_local = PseudoOp o PseudoOp.locall
       val pseudoop_comm = PseudoOp o PseudoOp.comm
@@ -3939,6 +3946,7 @@
           val label = Label.fromString (toString pl)
         in
           [Assembly.pseudoop_global label,
+           Assembly.pseudoop_hidden label,
            Assembly.label label]
         end
       fun toAssemblyOpt pl =

Modified: mlton/trunk/mlton/codegen/x86-codegen/x86.sig
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86.sig	2008-08-05 05:27:05 UTC (rev 6686)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86.sig	2008-08-06 00:09:45 UTC (rev 6687)
@@ -801,6 +801,7 @@
           | Long of Immediate.t list
           | String of string list
           | Global of Label.t
+          | Hidden of Label.t
           | IndirectSymbol of Label.t
           | Local of Label.t
           | Comm of Label.t * Immediate.t * Immediate.t option
@@ -818,6 +819,7 @@
         val long : Immediate.t list -> t
         val string : string list -> t
         val global : Label.t -> t
+        val hidden : Label.t -> t
         val indirect_symbol : Label.t -> t
         val locall : Label.t -> t
         val comm : Label.t * Immediate.t * Immediate.t option -> t
@@ -884,6 +886,7 @@
         val pseudoop_long : Immediate.t list -> t
         val pseudoop_string : string list -> t
         val pseudoop_global : Label.t -> t
+        val pseudoop_hidden : Label.t -> t
         val pseudoop_indirect_symbol : Label.t -> t
         val pseudoop_local : Label.t -> t
         val pseudoop_comm : Label.t * Immediate.t * Immediate.t option -> t




More information about the MLton-commit mailing list