aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-10-18 15:54:40 +0200
committerMagnus Lång <[email protected]>2016-10-18 15:54:40 +0200
commitc8f3ec52716064e0835e2e84329b2257be22acb2 (patch)
treef3212d2d789dca54386902d73463e6f3185e06d2 /lib/hipe
parentbce68cd6ecbdbf04ea6af367f0795d83826420d5 (diff)
downloadotp-c8f3ec52716064e0835e2e84329b2257be22acb2.tar.gz
otp-c8f3ec52716064e0835e2e84329b2257be22acb2.tar.bz2
otp-c8f3ec52716064e0835e2e84329b2257be22acb2.zip
hipe_llvm: Use different symbols for remote calls
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl3
-rw-r--r--lib/hipe/llvm/hipe_rtl_to_llvm.erl18
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/hipe/llvm/hipe_llvm_main.erl b/lib/hipe/llvm/hipe_llvm_main.erl
index 164ccf20ef..c8fc9cc856 100644
--- a/lib/hipe/llvm/hipe_llvm_main.erl
+++ b/lib/hipe/llvm/hipe_llvm_main.erl
@@ -276,8 +276,7 @@ fix_reloc(#elf_rel{symbol=#elf_sym{name=Name, section=#elf_shdr{name=?TEXT},
offset=Offset, type=?PCREL_T, addend=?PCREL_A},
RelocsDict, MFA) when Name =/= "" ->
case dict:fetch(Name, RelocsDict) of
- {call, not_remote, MFA} -> {?CALL_LOCAL, Offset, MFA};
- {call, remote, MFA} -> {?CALL_REMOTE, Offset, MFA}
+ {call, not_remote, MFA} -> {?CALL_LOCAL, Offset, MFA}
end;
fix_reloc(#elf_rel{symbol=#elf_sym{name=Name, section=#elf_shdr{name=?RODATA},
type=object},
diff --git a/lib/hipe/llvm/hipe_rtl_to_llvm.erl b/lib/hipe/llvm/hipe_rtl_to_llvm.erl
index 55ab6a3db1..f5ea6d676f 100644
--- a/lib/hipe/llvm/hipe_rtl_to_llvm.erl
+++ b/lib/hipe/llvm/hipe_rtl_to_llvm.erl
@@ -438,7 +438,7 @@ trans_call_name(RtlCallName, RtlCallType, Relocs, CallArgs, FinalArgs) ->
relocs_store(LlvmName, {call, not_remote, {bif, PrimOp, length(CallArgs)}}, Relocs),
{"@" ++ LlvmName, [], Relocs1};
{M, F, A} when is_atom(M), is_atom(F), is_integer(A) ->
- LlvmName = trans_mfa_name({M, F, A}),
+ LlvmName = trans_mfa_name({M, F, A}, RtlCallType),
ok = case RtlCallType of
not_remote -> ok;
remote -> ok
@@ -1039,8 +1039,12 @@ llvm_id(C) ->
io_lib:format("_~2.16.0B_",[C]).
%% @doc Create an acceptable LLVM identifier for an MFA.
-trans_mfa_name({M,F,A}) ->
- N = atom_to_list(M) ++ "." ++ atom_to_list(F) ++ "." ++ integer_to_list(A),
+trans_mfa_name({M,F,A}, Linkage) ->
+ N0 = atom_to_list(M) ++ "." ++ atom_to_list(F) ++ "." ++ integer_to_list(A),
+ N = case Linkage of
+ not_remote -> N0;
+ remote -> "rem." ++ N0
+ end,
make_llvm_id(N).
%%------------------------------------------------------------------------------
@@ -1342,7 +1346,7 @@ llvm_type_from_size(Size) ->
%% precoloured registers that are passed as arguments must be stored to
%% the corresonding stack slots.
create_function_definition(Fun, Params, Code, LocalVars) ->
- FunctionName = trans_mfa_name(Fun),
+ FunctionName = trans_mfa_name(Fun, not_remote),
FixedRegs = fixed_registers(),
%% Reverse parameters to match with the Erlang calling convention
ReversedParams =
@@ -1527,7 +1531,7 @@ load_closure({ClosureName, _})->
%% @doc Declaration of a local variable for a switch jump table.
declare_switches(JumpTableList, Fun) ->
- FunName = trans_mfa_name(Fun),
+ FunName = trans_mfa_name(Fun, not_remote),
[declare_switch_table(X, FunName) || X <- JumpTableList].
declare_switch_table({Name, {switch, {TableType, Labels, _, _}, _}}, FunName) ->
@@ -1543,7 +1547,7 @@ declare_switch_table({Name, {switch, {TableType, Labels, _, _}, _}}, FunName) ->
declare_closure_labels([], Relocs, _Fun) ->
{[], Relocs};
declare_closure_labels(ClosureLabels, Relocs, Fun) ->
- FunName = trans_mfa_name(Fun),
+ FunName = trans_mfa_name(Fun, not_remote),
{LabelList, ArityList} =
lists:unzip([{mk_jump_label(Label), A} ||
{_, {closure_label, Label, A}} <- ClosureLabels]),
@@ -1561,7 +1565,7 @@ declare_closure_labels(ClosureLabels, Relocs, Fun) ->
%% @doc A call is treated as non external only in a case of a local recursive
%% function.
-is_external_call({_, {call, _, MFA}}, MFA) -> false;
+is_external_call({_, {call, not_remote, MFA}}, MFA) -> false;
is_external_call(_, _) -> true.
%% @doc External declaration of a function.