aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_ssa_opt.hrl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-01-10 17:06:31 +0100
committerJohn Högberg <[email protected]>2019-01-24 08:25:28 +0100
commit1c73a313e72909d054f55e321c1929d2be55ff11 (patch)
tree7e3a45c2ee9b62ba2a889d4984576b9cee5de438 /lib/compiler/src/beam_ssa_opt.hrl
parentb7db13e2f3ef6990367fb2cc08263da8a57e7414 (diff)
downloadotp-1c73a313e72909d054f55e321c1929d2be55ff11.tar.gz
otp-1c73a313e72909d054f55e321c1929d2be55ff11.tar.bz2
otp-1c73a313e72909d054f55e321c1929d2be55ff11.zip
beam_ssa_opt: Add a scaffold for module-level optimizations
This serves as a base for the upcoming module-level type optimization, but may come in handy for other passes like beam_ssa_funs and beam_ssa_bsm that have their own ad-hoc implementations.
Diffstat (limited to 'lib/compiler/src/beam_ssa_opt.hrl')
-rw-r--r--lib/compiler/src/beam_ssa_opt.hrl37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_opt.hrl b/lib/compiler/src/beam_ssa_opt.hrl
new file mode 100644
index 0000000000..21a45f562a
--- /dev/null
+++ b/lib/compiler/src/beam_ssa_opt.hrl
@@ -0,0 +1,37 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2019. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-include("beam_ssa.hrl").
+
+-record(func_info,
+ {%% Local calls going in/out of this function.
+ in = ordsets:new() :: ordsets:ordset(func_id()),
+ out = ordsets:new() :: ordsets:ordset(func_id()),
+
+ %% Whether the function is exported or not; some optimizations may
+ %% need to be suppressed if it is.
+ exported = true :: boolean()}).
+
+%% Per-function metadata used by various optimization passes to perform
+%% module-level optimization. If a function is absent it means that
+%% module-level optimization has been turned off for said function.
+
+-type func_id() :: beam_ssa:b_local().
+-type func_info_db() :: #{ func_id() => #func_info{} }.