summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-02-03 14:41:42 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-02-03 14:41:42 +0000
commitd03774a5a047d89d8f793cc70862065eaebb7849 (patch)
tree909ef4fc84db1032825c038c0f80034cf7f99493
parent7dace816eaa732379db5b93c62f31a648c2a70fd (diff)
Suite protage IRIX
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1255 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/arch_mips.ml6
-rw-r--r--asmcomp/emit_mips.mlp36
-rw-r--r--asmrun/mips.S37
-rwxr-xr-xconfigure30
-rw-r--r--test/Moretest/Makefile2
5 files changed, 63 insertions, 48 deletions
diff --git a/asmcomp/arch_mips.ml b/asmcomp/arch_mips.ml
index 7bfe7f2f8..eebcf9170 100644
--- a/asmcomp/arch_mips.ml
+++ b/asmcomp/arch_mips.ml
@@ -28,7 +28,11 @@ type specific_operation = unit (* none *)
(* Sizes, endianness *)
-let big_endian = false
+let big_endian =
+ match Config.system with
+ "ultrix" -> false
+ | "irix" -> true
+ | _ -> fatal_error "Arch_mips.big_endian"
let size_addr = 4
let size_int = 4
diff --git a/asmcomp/emit_mips.mlp b/asmcomp/emit_mips.mlp
index c2b2e4ea3..b35e77920 100644
--- a/asmcomp/emit_mips.mlp
+++ b/asmcomp/emit_mips.mlp
@@ -31,14 +31,6 @@ let pic =
| "irix" -> true
| _ -> fatal_error "Emit_mips.pic"
-(* Determine the endianness in which the procesor is running *)
-
-let big_endian =
- match Config.system with
- "ultrix" -> false
- | "irix" -> true
- | _ -> fatal_error "Emit_mips.big_endian"
-
(* Tradeoff between code size and code speed *)
let fastcode_flag = ref true
@@ -177,7 +169,7 @@ let record_frame live =
`{emit_label lbl}:`
let emit_frame fd =
- ` .word {emit_label fd.fd_lbl} + 8\n`;
+ ` .word {emit_label fd.fd_lbl}\n`;
` .half {emit_int fd.fd_frame_size}\n`;
` .half {emit_int (List.length fd.fd_live_offset)}\n`;
List.iter
@@ -304,11 +296,13 @@ let emit_instr i =
liveregs i 0;
if pic then
` move $25, {emit_reg i.arg.(0)}\n`;
- `{record_frame i.live} jal {emit_reg i.arg.(0)}\n`;
+ ` jal {emit_reg i.arg.(0)}\n`;
+ `{record_frame i.live}\n`;
reload_gp()
| Lop(Icall_imm s) ->
liveregs i 0;
- `{record_frame i.live} jal {emit_symbol s}\n`;
+ ` jal {emit_symbol s}\n`;
+ `{record_frame i.live}\n`;
reload_gp()
| Lop(Itailcall_ind) ->
let n = frame_size() in
@@ -336,7 +330,8 @@ let emit_instr i =
if alloc then begin
` la $24, {emit_symbol s}\n`;
liveregs i live_24;
- `{record_frame i.live} jal caml_c_call\n`
+ ` jal caml_c_call\n`;
+ `{record_frame i.live}\n`
end else begin
` jal {emit_symbol s}\n`
end;
@@ -383,21 +378,23 @@ let emit_instr i =
` .set noreorder\n`;
` subu $22, $22, {emit_int n}\n`;
` subu $24, $22, $23\n`;
- `{record_frame i.live} bltzal $24, {emit_label !call_gc_label}\n`;
+ ` bltzal $24, {emit_label !call_gc_label}\n`;
` addu {emit_reg i.res.(0)}, $22, 4\n`;
+ `{record_frame i.live}\n`;
` .set reorder\n`
end else begin
begin match n with
8 -> liveregs i 0;
- `{record_frame i.live} jal caml_alloc1\n`
+ ` jal caml_alloc1\n`
| 12 -> liveregs i 0;
- `{record_frame i.live} jal caml_alloc2\n`
+ ` jal caml_alloc2\n`
| 16 -> liveregs i 0;
- `{record_frame i.live} jal caml_alloc3\n`
+ ` jal caml_alloc3\n`
| _ -> ` li $24, {emit_int n}\n`;
liveregs i live_24;
- `{record_frame i.live} jal caml_alloc\n`
+ ` jal caml_alloc\n`
end;
+ `{record_frame i.live}\n`;
` addu {emit_reg i.res.(0)}, $22, 4\n`
end
| Lop(Iintop(Icheckbound)) ->
@@ -513,7 +510,7 @@ let emit_instr i =
` lw $30, 0($sp)\n`;
` addu $sp, $sp, 8\n`;
liveregs i 0;
- ` j $25\n`
+ ` jal $25\n` (* Keep retaddr in $31 for debugging *)
let rec emit_all i =
match i.desc with Lend -> () | _ -> emit_instr i; emit_all i.next
@@ -607,6 +604,9 @@ let begin_assembly() =
` .noalias $16,$sp; .noalias $16,$30; .noalias $17,$sp; .noalias $17,$30\n`;
` .noalias $18,$sp; .noalias $18,$30; .noalias $19,$sp; .noalias $19,$30\n`;
` .noalias $20,$sp; .noalias $20,$30; .noalias $21,$sp; .noalias $21,$30\n\n`;
+ (* The following .file directive is intended to prevent the generation
+ of line numbers for the debugger, since they make .o files larger. *)
+ ` .file 1 \"{emit_string !Location.input_name}\"\n\n`;
let lbl_begin = Compilenv.current_unit_name() ^ "_begin" in
` .data\n`;
` .globl {emit_symbol lbl_begin}\n`;
diff --git a/asmrun/mips.S b/asmrun/mips.S
index 28eb52e7a..08c231b5d 100644
--- a/asmrun/mips.S
+++ b/asmrun/mips.S
@@ -241,11 +241,7 @@ $110:
caml_c_call:
/* Function to call is in $24 */
-#ifdef _PIC
- .set noreorder
- .cpload $25
- .set reorder
-#endif
+#ifndef _PIC
/* Record lowest stack address and return address */
sw $31, caml_last_return_address
sw $sp, caml_bottom_of_stack
@@ -253,16 +249,7 @@ caml_c_call:
sw $22, young_ptr
sw $30, caml_exception_pointer
/* Call the function */
-#ifdef _PIC
- move $25, $24
-#endif
jal $24
-#ifdef _PIC
- /* Reload $gp based on return address */
- .set noreorder
- .cpload $31
- .set reorder
-#endif
/* Reload alloc ptr and alloc limit */
lw $22, young_ptr
lw $23, young_limit
@@ -272,7 +259,27 @@ caml_c_call:
sw $0, caml_last_return_address
/* Return */
j $31
-
+#else
+ /* Slightly optimized form of the above when referencing
+ global variables is expensive */
+ .set noreorder
+ .cpload $25
+ .set reorder
+ la $16, caml_last_return_address
+ la $17, young_ptr
+ la $18, young_limit
+ sw $31, 0($16) /* caml_last_return_address */
+ sw $sp, caml_bottom_of_stack
+ sw $22, 0($17) /* young_ptr */
+ sw $30, caml_exception_pointer
+ move $25, $24
+ jal $24
+ lw $31, 0($16) /* caml_last_return_address */
+ lw $22, 0($17) /* young_ptr */
+ lw $23, 0($18) /* young_limit */
+ sw $0, 0($16) /* caml_last_return_address */
+ j $31
+#endif
.end caml_c_call
/* Start the Caml program */
diff --git a/configure b/configure
index 456532596..191de4284 100755
--- a/configure
+++ b/configure
@@ -156,15 +156,18 @@ esac
bytecc="$cc"
bytecccompopts=""
bytecclinkopts=""
-if test $gcc = yes; then
- bytecccompopts="-fno-defer-pop -Wall"
- case "$host" in
- *-*-nextstep*)
- bytecccompopts="$bytecccompopts -U__GNUC__ -D_POSIX_SOURCE";;
- alpha-*-osf*)
- bytecclinkopts="-Xlinker -taso";;
- esac
-fi
+
+case "$bytecc,$host" in
+ gcc,*-*-nextstep*)
+ bytecccompopts="-fno-defer-pop -Wall -U__GNUC__ -D_POSIX_SOURCE";;
+ gcc,alpha-*-osf*)
+ bytecccompopts="-fno-defer-pop -Wall"
+ bytecclinkopts="-Xlinker -taso";;
+ gcc*)
+ bytecccompopts="-fno-defer-pop -Wall";;
+ cc*,mips-*-irix*)
+ bytecclinkopts="-Wl,-woff,84";;
+esac
echo "BYTECC=$bytecc" >> Makefile
echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile
@@ -202,17 +205,18 @@ case "$arch" in
*) nativecc="$bytecc";;
esac
+nativecccompopts=''
+nativecclinkopts=''
+
case "$arch,$nativecc,$system" in
alpha,cc,*) nativecccompopts=-std1;;
- mips,cc,irix) nativecccompopts=-32; nativecclinkopts=-32;;
+ mips,cc,irix) nativecccompopts=-32
+ nativecclinkopts="-32 -Wl,-woff,84";;
mips,cc,ultrix) nativecccompopts=-std;;
*,*,nextstep) nativecccompopts="-Wall -D_POSIX_SOURCE";;
*,gcc,*) nativecccompopts=-Wall;;
- *) nativecccompopts='';;
esac
-nativecclinkopts=''
-
asflags=''
aspp='$(AS)'
asppflags=''
diff --git a/test/Moretest/Makefile b/test/Moretest/Makefile
index 4e4b23b90..854abff7b 100644
--- a/test/Moretest/Makefile
+++ b/test/Moretest/Makefile
@@ -62,7 +62,7 @@ cm.out:
$(CAMLOPT) $(OPTFLAGS) -c $<
.c.o:
- $(NATIVECC) -I../../byterun -c $<
+ $(NATIVECC) $(NATIVECCCOMPOPTS) -I../../byterun -c $<
clean::
rm -f *.byt *.out