From 60ab550a952c3d9719b2a91ec90c9b58769f6717 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Wed, 14 Oct 2015 15:07:48 +0200 Subject: bug 17392: remove trailing whitespace in source files --- powerpc/AsmToJSON.ml | 32 +++++++++++----------- powerpc/CBuiltins.ml | 12 ++++----- powerpc/TargetPrinter.ml | 70 ++++++++++++++++++++++++------------------------ 3 files changed, 57 insertions(+), 57 deletions(-) (limited to 'powerpc') diff --git a/powerpc/AsmToJSON.ml b/powerpc/AsmToJSON.ml index 7c52bb40..bc99be7a 100644 --- a/powerpc/AsmToJSON.ml +++ b/powerpc/AsmToJSON.ml @@ -106,17 +106,17 @@ let p_z oc z = fprintf oc "%s" (Z.to_string z) let p_int_constant oc i = fprintf oc "{\"Integer\":%a}" p_int i let p_float64_constant oc f = fprintf oc "{\"Float\":%a}" p_float64 f let p_float32_constant oc f = fprintf oc "{\"Float\":%a}" p_float32 f -let p_z_constant oc z = fprintf oc "{\"Integer\":%s}" (Z.to_string z) +let p_z_constant oc z = fprintf oc "{\"Integer\":%s}" (Z.to_string z) let p_constant oc = function | Cint i -> p_int_constant oc i | Csymbol_low (i,c) -> fprintf oc "{\"Symbol_low\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c - | Csymbol_high (i,c) -> fprintf oc "{\"Symbol_high\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c - | Csymbol_sda (i,c) -> fprintf oc "{\"Symbol_sda\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c - | Csymbol_rel_low (i,c) -> fprintf oc "{\"Symbol_rel_low\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c - | Csymbol_rel_high (i,c) -> fprintf oc "{\"Symbol_rel_high\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c + | Csymbol_high (i,c) -> fprintf oc "{\"Symbol_high\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c + | Csymbol_sda (i,c) -> fprintf oc "{\"Symbol_sda\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c + | Csymbol_rel_low (i,c) -> fprintf oc "{\"Symbol_rel_low\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c + | Csymbol_rel_high (i,c) -> fprintf oc "{\"Symbol_rel_high\":{\"Name\":%a,\"Offset\":%a}}" p_atom i p_int c -let p_crbit oc c = +let p_crbit oc c = let number = match c with | CRbit_0 -> 0 | CRbit_1 -> 1 @@ -160,7 +160,7 @@ let p_instruction oc ic = | Pb l -> fprintf oc "{\"Instruction Name\":\"Pb\",\"Args\":[%a]}" p_label l | Pbctr s -> fprintf oc "{\"Instruction Name\":\"Pbctr\",\"Args\":[]}" | Pbctrl s -> fprintf oc "{\"Instruction Name\":\"Pbctrl\",\"Args\":[]}" - | Pbdnz l -> fprintf oc "{\"Instruction Name\":\"Pbdnz\",\"Args\":[%a]}" p_label l + | Pbdnz l -> fprintf oc "{\"Instruction Name\":\"Pbdnz\",\"Args\":[%a]}" p_label l | Pbf (c,l) -> fprintf oc "{\"Instruction Name\":\"Pbf\",\"Args\":[%a,%a]}" p_crbit c p_label l | Pbl (i,s) -> fprintf oc "{\"Instruction Name\":\"Pbl\",\"Args\":[%a]}" p_atom_constant i | Pbs (i,s) -> fprintf oc "{\"Instruction Name\":\"Pbs\",\"Args\":[%a]}" p_atom_constant i @@ -171,7 +171,7 @@ let p_instruction oc ic = | Pcmplw (ir1,ir2) -> fprintf oc "{\"Instruction Name\":\"Pcmplw\",\"Args\":[%a,%a]}" p_ireg ir1 p_ireg ir2 | Pcmplwi (ir,c) -> fprintf oc "{\"Instruction Name\":\"Pcmplwi\",\"Args\":[%a,%a]}" p_ireg ir p_constant c | Pcmpw (ir1,ir2) -> fprintf oc "{\"Instruction Name\":\"Pcmpw\",\"Args\":[%a,%a]}" p_ireg ir1 p_ireg ir2 - | Pcmpwi (ir,c) -> fprintf oc "{\"Instruction Name\":\"Pcmpwi\",\"Args\":[%a,%a]}" p_ireg ir p_constant c + | Pcmpwi (ir,c) -> fprintf oc "{\"Instruction Name\":\"Pcmpwi\",\"Args\":[%a,%a]}" p_ireg ir p_constant c | Pcntlzw (ir1,ir2) -> fprintf oc "{\"Instruction Name\":\"Pcntlzw\",\"Args\":[%a,%a]}" p_ireg ir1 p_ireg ir2 | Pcreqv (cr1,cr2,cr3) -> fprintf oc "{\"Instruction Name\":\"Pcreqv\",\"Args\":[%a,%a,%a]}" p_crbit cr1 p_crbit cr2 p_crbit cr3 | Pcror (cr1,cr2,cr3) -> fprintf oc "{\"Instruction Name\":\"Pcror\",\"Args\":[%a,%a,%a]}" p_crbit cr1 p_crbit cr2 p_crbit cr3 @@ -190,7 +190,7 @@ let p_instruction oc ic = | Pextsh (ir1,ir2) -> fprintf oc "{\"Instruction Name\":\"Pextsh\",\"Args\":[%a,%a]}" p_ireg ir1 p_ireg ir2 | Pextsw (ir1,ir2) -> fprintf oc "{\"Instruction Name\":\"Pextsw\",\"Args\":[%a,%a]}" p_ireg ir1 p_ireg ir2 | Pfreeframe (c,i) -> assert false (* Should not occur *) - | Pfabs (fr1,fr2) + | Pfabs (fr1,fr2) | Pfabss (fr1,fr2) -> fprintf oc "{\"Instruction Name\":\"Pfabs\",\"Args\":[%a,%a]}" p_freg fr1 p_freg fr2 | Pfadd (fr1,fr2,fr3) -> fprintf oc "{\"Instruction Name\":\"Pfadd\",\"Args\":[%a,%a,%a]}" p_freg fr1 p_freg fr2 p_freg fr3 | Pfadds (fr1,fr2,fr3) -> fprintf oc "{\"Instruction Name\":\"Pfadds\",\"Args\":[%a,%a,%a]}" p_freg fr1 p_freg fr2 p_freg fr3 @@ -246,7 +246,7 @@ let p_instruction oc ic = | Plwz (ir1,ic,ir2) -> fprintf oc "{\"Instruction Name\":\"Plwz\",\"Args\":[%a,%a,%a]}" p_ireg ir1 p_constant ic p_ireg ir2 | Plwz_a (ir1,c,ir2) -> fprintf oc "{\"Instruction Name\":\"Plwz\",\"Args\":[%a,%a,%a]}" p_ireg ir1 p_constant c p_ireg ir2 | Plwzu (ir1,c,ir2) -> fprintf oc "{\"Instruction Name\":\"Plwzu\",\"Args\":[%a,%a,%a]}" p_ireg ir1 p_constant c p_ireg ir2 - | Plwzx (ir1,ir2,ir3) + | Plwzx (ir1,ir2,ir3) | Plwzx_a (ir1,ir2,ir3) -> fprintf oc "{\"Instruction Name\":\"Plwzx\",\"Args\":[%a,%a,%a]}" p_ireg ir1 p_ireg ir2 p_ireg ir3 | Plwarx (ir1,ir2,ir3) -> fprintf oc "{\"Instruction Name\":\"Plwarx\",\"Args\":[%a,%a,%a]}" p_ireg ir1 p_ireg ir2 p_ireg ir3 | Plwbrx (ir1,ir2,ir3) -> fprintf oc "{\"Instruction Name\":\"Plwbrx\",\"Args\":[%a,%a,%a]}" p_ireg ir1 p_ireg ir2 p_ireg ir3 @@ -339,7 +339,7 @@ let p_section oc = function | Section_jumptable -> fprintf oc "{\"Section Name\":\"Jumptable\"}" | Section_user (s,w,e) -> fprintf oc "{\"Section Name\":\"%s\",\"Writable\":%B,\"Executable\":%B}" s w e | Section_debug_info _ - | Section_debug_abbrev + | Section_debug_abbrev | Section_debug_line _ | Section_debug_loc | Section_debug_str -> () (* There should be no info in the debug sections *) @@ -349,17 +349,17 @@ let p_int_opt oc = function | Some i -> fprintf oc "%d" i -let p_fundef oc (name,f) = +let p_fundef oc (name,f) = let alignment = atom_alignof name and inline = atom_is_inline name and static = atom_is_static name and instr = List.filter (function Pbuiltin _| Pcfi_adjust _ | Pcfi_rel_offset _ -> false | _ -> true) f.fn_code in let c_section,l_section,j_section = match (atom_sections name) with [a;b;c] -> a,b,c | _ -> assert false in fprintf oc "{\"Fun Name\":%a,\n\"Fun Storage Class\":%a,\n\"Fun Alignment\":%a,\n\"Fun Section Code\":%a,\"Fun Section Literals\":%a,\"Fun Section Jumptable\":%a,\n\"Fun Inline\":%B,\n\"Fun Code\":%a}\n" - p_atom name p_storage static p_int_opt alignment + p_atom name p_storage static p_int_opt alignment p_section c_section p_section l_section p_section j_section inline (p_list p_instruction) instr - + let p_init_data oc = function | Init_int8 ic -> fprintf oc "{\"Init_int8\":%a}" p_int ic | Init_int16 ic -> fprintf oc "{\"Init_int16\":%a}" p_int ic @@ -372,10 +372,10 @@ let p_init_data oc = function let p_vardef oc (name,v) = let alignment = atom_alignof name - and static = atom_is_static name + and static = atom_is_static name and section = match (atom_sections name) with [s] -> s | _ -> assert false (* Should only have one section *) in fprintf oc "{\"Var Name\":%a,\"Var Readonly\":%B,\"Var Volatile\":%B,\n\"Var Storage Class\":%a,\n\"Var Alignment\":%a,\n\"Var Section\":%a,\n\"Var Init\":%a}\n" - p_atom name v.gvar_readonly v.gvar_volatile + p_atom name v.gvar_readonly v.gvar_volatile p_storage static p_int_opt alignment p_section section (p_list p_init_data) v.gvar_init diff --git a/powerpc/CBuiltins.ml b/powerpc/CBuiltins.ml index a9e4f5e3..106ba4d0 100644 --- a/powerpc/CBuiltins.ml +++ b/powerpc/CBuiltins.ml @@ -19,7 +19,7 @@ open C let builtins = { Builtins.typedefs = [ - "__builtin_va_list", + "__builtin_va_list", TArray(TInt(IUInt, []), Some 3L, []) ]; Builtins.functions = [ @@ -40,19 +40,19 @@ let builtins = { (TInt (IUInt, []), [TInt(IUInt, []);TInt(IUInt, [])], false); (* Float arithmetic *) "__builtin_fmadd", - (TFloat(FDouble, []), + (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])], false); "__builtin_fmsub", - (TFloat(FDouble, []), + (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])], false); "__builtin_fnmadd", - (TFloat(FDouble, []), + (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])], false); "__builtin_fnmsub", - (TFloat(FDouble, []), + (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])], false); "__builtin_fsqrt", @@ -62,7 +62,7 @@ let builtins = { "__builtin_fres", (TFloat(FFloat, []), [TFloat(FFloat, [])], false); "__builtin_fsel", - (TFloat(FDouble, []), + (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])], false); "__builtin_fcti", diff --git a/powerpc/TargetPrinter.ml b/powerpc/TargetPrinter.ml index a596e587..10d89d54 100644 --- a/powerpc/TargetPrinter.ml +++ b/powerpc/TargetPrinter.ml @@ -103,15 +103,15 @@ module Linux_System : SYSTEM = let freg oc r = output_string oc (float_reg_name r) - - let creg oc r = + + let creg oc r = fprintf oc "%d" r - + let name_of_section = function | Section_text -> ".text" | Section_data i -> if i then ".data" else "COMM" - | Section_small_data i -> + | Section_small_data i -> if i then ".section .sdata,\"aw\",@progbits" else "COMM" | Section_const i -> if i then ".rodata" else "COMM" @@ -138,17 +138,17 @@ module Linux_System : SYSTEM = let print_file_line oc file line = print_file_line oc comment file line - - (* Emit .cfi directives *) + + (* Emit .cfi directives *) let cfi_startproc = cfi_startproc let cfi_endproc = cfi_endproc - + let cfi_adjust = cfi_adjust - + let cfi_rel_offset = cfi_rel_offset - let print_prologue oc = + let print_prologue oc = if !Clflags.option_g then begin section oc Section_text; let low_pc = new_label () in @@ -169,7 +169,7 @@ module Linux_System : SYSTEM = let debug_section _ _ = () end - + module Diab_System : SYSTEM = struct @@ -189,7 +189,7 @@ module Diab_System : SYSTEM = symbol_fragment oc s n "@sdax@l" | Csymbol_rel_high(s, n) -> symbol_fragment oc s n "@sdarx@ha" - + let ireg oc r = output_char oc 'r'; output_string oc (int_reg_name r) @@ -197,10 +197,10 @@ module Diab_System : SYSTEM = let freg oc r = output_char oc 'f'; output_string oc (float_reg_name r) - + let creg oc r = fprintf oc "cr%d" r - + let name_of_section = function | Section_text -> ".text" | Section_data i -> if i then ".data" else "COMM" @@ -254,20 +254,20 @@ module Diab_System : SYSTEM = let debug_section oc sec = match sec with - | Section_debug_abbrev + | Section_debug_abbrev | Section_debug_info _ | Section_debug_loc -> () | sec -> let name = match sec with | Section_user (name,_,_) -> name | _ -> name_of_section sec in - if not (Debug.exists_section name) then + if not (Debug.exists_section name) then let line_start = new_label () and low_pc = new_label () and debug_info = new_label () in Debug.add_diab_info name (line_start,debug_info,name_of_section sec); Debug.add_compilation_section_start name low_pc; - let line_name = ".debug_line" ^(if name <> ".text" then name else "") in + let line_name = ".debug_line" ^(if name <> ".text" then name else "") in section oc (Section_debug_line (if name <> ".text" then Some name else None)); fprintf oc " .section %s,,n\n" line_name; if name <> ".text" then @@ -279,18 +279,18 @@ module Diab_System : SYSTEM = fprintf oc " .d2_line_start %s\n" line_name else () - + let print_prologue oc = fprintf oc " .xopt align-fill-text=0x60000000\n"; debug_section oc Section_text let print_epilogue oc = - let end_label sec = + let end_label sec = fprintf oc "\n"; fprintf oc " %s\n" sec; let label_end = new_label () in fprintf oc "%a:\n" label label_end; - label_end + label_end and entry_label f = let label = new_label () in fprintf oc ".L%d: .d2filenum \"%s\"\n" label f; @@ -306,7 +306,7 @@ module Target (System : SYSTEM):TARGET = (* Basic printing functions *) let symbol = symbol - + let raw_symbol oc s = fprintf oc "%s" s @@ -371,7 +371,7 @@ module Target (System : SYSTEM):TARGET = let short_cond_branch tbl pc lbl_dest = match PTree.get lbl_dest tbl with | None -> assert false - | Some pc_dest -> + | Some pc_dest -> let disp = pc_dest - pc in -0x2000 <= disp && disp < 0x2000 (* Printing of instructions *) @@ -551,11 +551,11 @@ module Target (System : SYSTEM):TARGET = | Pfnmsub(r1, r2, r3, r4) -> fprintf oc " fnmsub %a, %a, %a, %a\n" freg r1 freg r2 freg r3 freg r4 | Pfsqrt(r1, r2) -> - fprintf oc " fsqrt %a, %a\n" freg r1 freg r2 + fprintf oc " fsqrt %a, %a\n" freg r1 freg r2 | Pfrsqrte(r1, r2) -> - fprintf oc " frsqrte %a, %a\n" freg r1 freg r2 + fprintf oc " frsqrte %a, %a\n" freg r1 freg r2 | Pfres(r1, r2) -> - fprintf oc " fres %a, %a\n" freg r1 freg r2 + fprintf oc " fres %a, %a\n" freg r1 freg r2 | Pfsel(r1, r2, r3, r4) -> fprintf oc " fsel %a, %a, %a, %a\n" freg r1 freg r2 freg r3 freg r4 | Pisel (r1,r2,r3,cr) -> @@ -793,7 +793,7 @@ module Target (System : SYSTEM):TARGET = let nlo = Int64.to_int32 n and nhi = Int64.to_int32(Int64.shift_right_logical n 32) in fprintf oc "%a: .long 0x%lx, 0x%lx\n" label lbl nhi nlo - + let print_literal32 oc (lbl, n) = fprintf oc "%a: .long 0x%lx\n" label lbl n @@ -823,10 +823,10 @@ module Target (System : SYSTEM):TARGET = if Z.gt n Z.zero then fprintf oc " .space %s\n" (Z.to_string n) | Init_addrof(symb, ofs) -> - fprintf oc " .long %a\n" + fprintf oc " .long %a\n" symbol_offset (symb, ofs) - + let print_fun_info = elf_print_fun_info let emit_constants oc lit = @@ -840,26 +840,26 @@ module Target (System : SYSTEM):TARGET = let print_optional_fun_info _ = () - let get_section_names name = + let get_section_names name = match C2C.atom_sections name with | [t;l;j] -> (t, l, j) | _ -> (Section_text, Section_literal, Section_jumptable) - + let reset_constants = reset_constants - + let print_var_info = elf_print_var_info - let print_comm_symb oc sz name align = + let print_comm_symb oc sz name align = fprintf oc " %s %a, %s, %d\n" (if C2C.atom_is_static name then ".lcomm" else ".comm") symbol name (Z.to_string sz) align - + let print_align oc align = fprintf oc " .balign %d\n" align - let print_jumptable oc jmptbl = + let print_jumptable oc jmptbl = let print_jumptable oc (lbl, tbl) = fprintf oc "%a:" label lbl; List.iter @@ -874,7 +874,7 @@ module Target (System : SYSTEM):TARGET = let default_falignment = 4 - let new_label = new_label + let new_label = new_label let section oc sec = section oc sec; @@ -882,7 +882,7 @@ module Target (System : SYSTEM):TARGET = end let sel_target () = - let module S = (val + let module S = (val (match Configuration.system with | "linux" -> (module Linux_System:SYSTEM) | "diab" -> (module Diab_System:SYSTEM) -- cgit