~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to asmcomp/power/emit.mlp

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-04-21 21:35:08 UTC
  • mfrom: (1.1.11 upstream) (12.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110421213508-kg34453aqmb0moha
* Fixes related to -output-obj with g++ (in debian/patches):
  - add Declare-primitive-name-table-as-const-char
  - add Avoid-multiple-declarations-in-generated-.c-files-in
  - fix Embed-bytecode-in-C-object-when-using-custom: the closing
    brace for extern "C" { ... } was missing in some cases

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
(*                                                                     *)
11
11
(***********************************************************************)
12
12
 
13
 
(* $Id: emit.mlp 9475 2009-12-16 10:04:38Z xleroy $ *)
 
13
(* $Id: emit.mlp 9547 2010-01-22 12:48:24Z doligez $ *)
14
14
 
15
15
(* Emission of PowerPC assembly code *)
16
16
 
116
116
    Reg r -> emit_string (register_name r)
117
117
  | _ -> fatal_error "Emit.emit_reg"
118
118
 
119
 
let use_full_regnames = 
 
119
let use_full_regnames =
120
120
  Config.system = "rhapsody"
121
121
 
122
122
let emit_gpr r =
607
607
    | Lop(Iintop_imm(Idiv, n)) ->       (* n is guaranteed to be a power of 2 *)
608
608
        let l = Misc.log2 n in
609
609
        `       {emit_string sragi}     {emit_reg i.res.(0)}, {emit_reg i.arg.(0)}, {emit_int l}\n`;
610
 
        `       addze   {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n` 
 
610
        `       addze   {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n`
611
611
    | Lop(Iintop_imm(Imod, n)) ->       (* n is guaranteed to be a power of 2 *)
612
612
        let l = Misc.log2 n in
613
613
        `       {emit_string sragi}     {emit_gpr 0}, {emit_reg i.arg.(0)}, {emit_int l}\n`;
614
614
        `       addze   {emit_gpr 0}, {emit_gpr 0}\n`;
615
615
        `       {emit_string slgi}      {emit_gpr 0}, {emit_gpr 0}, {emit_int l}\n`;
616
 
        `       subfc   {emit_reg i.res.(0)}, {emit_gpr 0}, {emit_reg i.arg.(0)}\n` 
 
616
        `       subfc   {emit_reg i.res.(0)}, {emit_gpr 0}, {emit_reg i.arg.(0)}\n`
617
617
    | Lop(Iintop_imm(Icomp cmp, n)) ->
618
618
        begin match cmp with
619
619
          Isigned c ->