diff options
author | Magnus Lång <[email protected]> | 2016-05-18 18:59:24 +0200 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-05-18 19:08:01 +0200 |
commit | 8914b835d26cc3b513eaef0a19cd9b39d1d2ccae (patch) | |
tree | ddb97b78dd773e3dbfcc137ef950fe849145000e /lib/hipe/llvm/hipe_llvm.erl | |
parent | ea308bc26d4664705895ff3be31687dc5235cc79 (diff) | |
download | otp-8914b835d26cc3b513eaef0a19cd9b39d1d2ccae.tar.gz otp-8914b835d26cc3b513eaef0a19cd9b39d1d2ccae.tar.bz2 otp-8914b835d26cc3b513eaef0a19cd9b39d1d2ccae.zip |
hipe_llvm: Move elf_format.hrl types to module
Named types, except those for the records in the header files, have been
moved from elf*_format.hrl to elf_format.erl.
Also:
* Use lists instead of element/2-indexed tuples for ELF section and
symbol tables.
* Enable +warn_export_vars for hipe/llvm/ subdirectory and fix warning.
* Extract duplicated code in hipe_llvm module into help function
pp_dereference_type/3.
Diffstat (limited to 'lib/hipe/llvm/hipe_llvm.erl')
-rw-r--r-- | lib/hipe/llvm/hipe_llvm.erl | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/hipe/llvm/hipe_llvm.erl b/lib/hipe/llvm/hipe_llvm.erl index b2997f2d92..c2547dd89e 100644 --- a/lib/hipe/llvm/hipe_llvm.erl +++ b/lib/hipe/llvm/hipe_llvm.erl @@ -865,11 +865,7 @@ pp_ins(Dev, Ver, I) -> true -> write(Dev, "volatile "); false -> ok end, - case Ver >= {3,7} of false -> ok; true -> - pp_type(Dev, pointer_type(load_p_type(I))), - write(Dev, ", ") - end, - pp_type(Dev, load_p_type(I)), + pp_dereference_type(Dev, Ver, load_p_type(I)), write(Dev, [" ", load_pointer(I), " "]), case load_alignment(I) of [] -> ok; @@ -905,11 +901,7 @@ pp_ins(Dev, Ver, I) -> true -> write(Dev, "inbounds "); false -> ok end, - case Ver >= {3,7} of false -> ok; true -> - pp_type(Dev, pointer_type(getelementptr_p_type(I))), - write(Dev, ", ") - end, - pp_type(Dev, getelementptr_p_type(I)), + pp_dereference_type(Dev, Ver, getelementptr_p_type(I)), write(Dev, [" ", getelementptr_value(I)]), pp_typed_idxs(Dev, getelementptr_typed_idxs(I)), write(Dev, "\n"); @@ -1032,6 +1024,17 @@ pp_ins(Dev, Ver, I) -> exit({?MODULE, pp_ins, {"Unknown LLVM instruction", Other}}) end. +%% @doc Print the type of a dereference in an LLVM instruction using syntax +%% parsable by the specified LLVM version. +pp_dereference_type(Dev, Ver, Type) -> + case Ver >= {3,7} of + false -> ok; + true -> + pp_type(Dev, pointer_type(Type)), + write(Dev, ", ") + end, + pp_type(Dev, Type). + %% @doc Pretty-print a list of types pp_type_list(_Dev, []) -> ok; pp_type_list(Dev, [T]) -> |