diff options
author | Magnus Lång <[email protected]> | 2016-05-11 13:39:53 +0200 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-05-11 13:39:53 +0200 |
commit | 7814ec18b095d40af95f362ff668a68915982e45 (patch) | |
tree | 50f16b9f246275c12843bbc8270cb0529aa86bd6 /lib/hipe/misc/hipe_consttab.erl | |
parent | 0f489445070cf65d96db7938f80ad118921c1f6a (diff) | |
download | otp-7814ec18b095d40af95f362ff668a68915982e45.tar.gz otp-7814ec18b095d40af95f362ff668a68915982e45.tar.bz2 otp-7814ec18b095d40af95f362ff668a68915982e45.zip |
hipe_llvm: Allow LLVM-generated constants
Since 3.7, LLVM sometimes generates SSE constants in a special constant
section with the requisite alignment (".rodata.cst16"). This broke
hipe_llvm since it assumed that all constants that were linked from the
text section were constants generated by hipe_llvm.
As this is the first time alignments larger than 8 have been required,
some small changes were required to hipe_consttab and
hipe_bifs:alloc_data/2. Note that hipe_bifs:alloc_data/2 still assumes
that erl_alloc will provide the requisite alignment.
Diffstat (limited to 'lib/hipe/misc/hipe_consttab.erl')
-rw-r--r-- | lib/hipe/misc/hipe_consttab.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/hipe/misc/hipe_consttab.erl b/lib/hipe/misc/hipe_consttab.erl index f361edc79c..226b20fa46 100644 --- a/lib/hipe/misc/hipe_consttab.erl +++ b/lib/hipe/misc/hipe_consttab.erl @@ -87,7 +87,8 @@ % {NewTab, Lbl} insert_sorted_block/4, insert_block/3, - %% insert_global_word/2, + insert_binary_const/3, + %% insert_global_word/2, %% insert_global_block/4, %% update_word/3, % update_word(ConstTab, Value) -> {NewTab, Lbl} %% update_block/5, @@ -196,6 +197,16 @@ insert_block({ConstTab, RefToLabels, NextLabel}, ElementType, InitList) -> {ElementType,InitList}), {insert_backrefs(NewTa, Id, ReferredLabels), Id}. +%% @doc Inserts a binary constant literal into the const table. +-spec insert_binary_const(hipe_consttab(), ct_alignment(), binary()) -> + {hipe_consttab(), hipe_constlbl()}. +insert_binary_const(ConstTab, Alignment, Binary) + when (Alignment =:= 4 orelse Alignment =:= 8 orelse Alignment =:= 16 + orelse Alignment =:= 32), is_binary(Binary), + size(Binary) rem Alignment =:= 0 -> + insert_const(ConstTab, block, Alignment, false, + {byte, binary_to_list(Binary)}). + %% @spec (ConstTab::hipe_consttab(), ElementType::element_type(), %% InitList::block(), SortOrder) -> {hipe_consttab(), hipe_constlbl()} |