summaryrefslogtreecommitdiff
path: root/asmcomp
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2014-11-28 15:44:02 +0000
committerAlain Frisch <alain@frisch.fr>2014-11-28 15:44:02 +0000
commit0f510081940b0722528e5989287c8ef34d4d8dcd (patch)
tree0e66f34ce5a83ae03475d6811e6eeb002af652c8 /asmcomp
parent145a0533104f722de283f1b668764ba93fcdf2be (diff)
downloadocaml-0f510081940b0722528e5989287c8ef34d4d8dcd.tar.gz
Support for the byte directive under solaris 32-bit.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/abstract_intel_emit@15616 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp')
-rw-r--r--asmcomp/x86_gas.ml2
-rw-r--r--asmcomp/x86_masm.ml16
-rw-r--r--asmcomp/x86_proc.ml15
-rw-r--r--asmcomp/x86_proc.mli2
4 files changed, 18 insertions, 17 deletions
diff --git a/asmcomp/x86_gas.ml b/asmcomp/x86_gas.ml
index 9813746def..058562493b 100644
--- a/asmcomp/x86_gas.ml
+++ b/asmcomp/x86_gas.ml
@@ -240,7 +240,7 @@ let print_line b = function
bprintf b "\t.align\t%d" n
| Byte n -> bprintf b "\t.byte\t%a" cst n
| Bytes s ->
- if system = S_solaris then assert false (* TODO *)
+ if system = S_solaris then buf_bytes_directive b ".byte" s
else bprintf b "\t.ascii\t\"%s\"" (string_of_string_literal s)
| Comment s -> bprintf b "\t\t\t\t/* %s */" s
| Global s -> bprintf b "\t.globl\t%s" s;
diff --git a/asmcomp/x86_masm.ml b/asmcomp/x86_masm.ml
index 1fc0632879..9fbd5a65bd 100644
--- a/asmcomp/x86_masm.ml
+++ b/asmcomp/x86_masm.ml
@@ -100,22 +100,6 @@ and scst b = function
| ConstAdd (c1, c2) -> bprintf b "(%a + %a)" scst c1 scst c2
| ConstSub (c1, c2) -> bprintf b "(%a - %a)" scst c1 scst c2
-let buf_bytes_directive b directive s =
- let pos = ref 0 in
- for i = 0 to String.length s - 1 do
- if !pos = 0
- then begin
- if i > 0 then Buffer.add_char b '\n';
- Buffer.add_char b '\t';
- Buffer.add_string b directive;
- Buffer.add_char b '\t';
- end
- else Buffer.add_char b ',';
- bprintf b "%d" (Char.code s.[i]);
- incr pos;
- if !pos >= 16 then begin pos := 0 end
- done
-
let i0 b s = bprintf b "\t%s" s
let i1 b s x = bprintf b "\t%s\t%a" s arg x
let i2 b s x y = bprintf b "\t%s\t%a, %a" s arg y arg x
diff --git a/asmcomp/x86_proc.ml b/asmcomp/x86_proc.ml
index e898723cde..4eec23b2db 100644
--- a/asmcomp/x86_proc.ml
+++ b/asmcomp/x86_proc.ml
@@ -88,6 +88,21 @@ let string_of_symbol prefix s =
s;
Buffer.contents b
+let buf_bytes_directive b directive s =
+ let pos = ref 0 in
+ for i = 0 to String.length s - 1 do
+ if !pos = 0
+ then begin
+ if i > 0 then Buffer.add_char b '\n';
+ Buffer.add_char b '\t';
+ Buffer.add_string b directive;
+ Buffer.add_char b '\t';
+ end
+ else Buffer.add_char b ',';
+ Printf.bprintf b "%d" (Char.code s.[i]);
+ incr pos;
+ if !pos >= 16 then begin pos := 0 end
+ done
let string_of_reg64 = function
| RAX -> "rax"
diff --git a/asmcomp/x86_proc.mli b/asmcomp/x86_proc.mli
index 2748bc4809..22506e2727 100644
--- a/asmcomp/x86_proc.mli
+++ b/asmcomp/x86_proc.mli
@@ -27,6 +27,8 @@ val string_of_string_literal: string -> string
val string_of_condition: condition -> string
val string_of_symbol: (*prefix*) string -> string -> string
val string_of_rounding: rounding -> string
+val buf_bytes_directive: Buffer.t -> (*directive*) string -> (*data*)string -> unit
+
(** Buffer of assembly code *)