Skip to content

Commit

Permalink
Initial commit of the hipe directory from the standard OTP repository
Browse files Browse the repository at this point in the history
  • Loading branch information
sedrik committed Feb 3, 2010
0 parents commit 69d8f8a
Show file tree
Hide file tree
Showing 266 changed files with 102,828 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2001-2010. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%
#
SHELL=/bin/sh

include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk

ifdef HIPE_ENABLED
HIPE_SUBDIRS = regalloc sparc ppc x86 amd64 arm opt tools
else
HIPE_SUBDIRS =
endif

ALWAYS_SUBDIRS = misc main cerl icode flow util

ifdef HIPE_ENABLED
# "rtl" below must be the first directory so that file rtl/hipe_literals.hrl
# which is needed by many other HiPE files is built first
SUB_DIRECTORIES = rtl $(ALWAYS_SUBDIRS) $(HIPE_SUBDIRS)
else
SUB_DIRECTORIES = $(ALWAYS_SUBDIRS)
endif

#
# Default Subdir Targets
#
include $(ERL_TOP)/make/otp_subdir.mk

# The overriding docs target have been removed so the default make rules work properly.

edocs:
@if [ -d $(ERL_TOP)/lib/edoc/ebin ]; then \
erl -noshell -pa $(ERL_TOP)/lib/edoc/ebin $(ERL_TOP)/lib/syntax_tools/ebin $(ERL_TOP)/lib/xmerl/ebin -run edoc_run application 'hipe' '"."' '[new,no_packages]' -s init stop ; \
fi

all-subdirs:
-for dir in $(SUB_DIRECTORIES); do \
(cd $$dir; $(MAKE) $(MAKETARGET) EBIN=../ebin; cd ..); \
done

distclean:
$(MAKE) MAKETARGET="distclean" all-subdirs
realclean:
$(MAKE) MAKETARGET="realclean" all-subdirs

130 changes: 130 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
Bugfix
======
P->current (Fix observable behaviour?)
New calling convention for guard bifs (Recognize at load time).
Long branches:
timer:tc(hipe,c,[megaco_text_parser,[{timeout,infinity}]]).
{4801210531,
{error,[{problem,too_long_branch},{address,3381732},{length,-828622}]}}

Performance
===========

Better handling of multimove in regalloc.
Faster closure creation. (Can static fields be preallocated?)
Expand pseudo-ops before scheduler (SPARC)
Stack maps for SPARC + Make frames in Sparc not in RTL.
Coalesce spill locations.

Feature
=======

Stack traces from stack maps.

Cleanup
=======

Speedup renaming and other bottlenecks in the compiler.
Only calls with fail label should end basic blocks.
Remove fail-entry-points from RTL (sparc/x86).
Cleanup hipe_*_registers.erl and interface/rules with regalloc.
HiPE in bootstrap.
Cleanup and merge loaders. (Better handling of data.)
Re-examine switching code.

Extensions
==========

Design strategy for finding all processes holding a certain closure.
Design strategy for native code unloading.
mbufs: In guards -> throw away, in bifs -> trigger special GC. (fix for native.)
Unified heap + process optimization (+ PE).
Incremental GC.


Old list compiled by Thomas Lindgren (needs cleaning up)
========================================================

<h1>Experimental implementations</h1>
<h2>RTL</h2>
<UL>
<LI> Algebraiska f�renklingar av uttryck (ex. reducera integer multiply,
ta bort addition med 0, etc)
<LI> Partial redundancy elimination
</UL>

<h1>Unimplemented optimizations</h1>

<H2>Erlang/Core source-level-optimizations</H2>
<UL>
<LI> "Context compilation"
<LI> CDR-kodning
<LI> List reuse
<LI> Compilation by transformation
</UL>

<H2>Icode-optimizations</H2>
<UL>
<LI> Convertion to loops from recursive programs
<LI> Dominatorer
(<a href="./thomasl/icode/dominators.erl">l�ngsamma</a>, snabba)
</UL>

<H2>RTL-optimizations</H2>
<UL>
<LI> Common subexpression elimination
<LI> Ta bort redundanta tester globalt (ex. upprepade typtester)
<LI> Ordna om hopp (ex. byt ordning p� nil/cons-tester)
<LI> Goto eliminering (= expandera uncond. jumps m. k�nd m�ltavla)
<LI> Save/restore-placering: datafl�desanalys, interaktion m. catch-frames
<LI> Loop optimeringar
<UL>
<LI> Dominatorer (se dominatorer f�r icode)
<LI> Unrolling
<LI> Invariant expression removal
</UL>
<LI> Partial redundancy elimination by lazy code motion
<LI> Partially dead code
</UL>

<H2>Sparc-optimizations</H2>
<UL>
<LI> Global register allocation
<UL>
<LI> <a href="./thomasl/regalloc/regalloc.erl">
Pessimistisk f�rgning</a>
<LI> Optimistisk f�rgning (kan sl�s p� i samma fil som pessimistisk
f�rgning ovan).
<LI> B�ttre ber�kning av spillkostnader
<LI> Renaming
<LI> Callee-saves register
<LI> Live-range splitting
</UL>
<LI> Instruktionsschedulering
<UL>
<LI> Branch delay slot scheduling
<LI> Load delay slot scheduling
<LI> Spekulativa loads med lduwa
<LI> Kollapsa serier av tester med bpr
<LI> Begr�nsad predicated execution med movcc
</UL>
<LI> Kodlayout: statiska f�ruts�gelser om riktning av hopp,
layout, s�tta branch prediction bits i hopp, etc.
<LI> Prefetching av kod med SparcV9:s bpn.
</UL>

<H2>Other optimizations</H2>

Profile driven optimizations.
<UL>
<LI> Utplacering av r�knare i CFG:er (per block, per b�ge)
<LI> Statiska metoder att uppskatta exekveringstid (inom och mellan proc.)
<LI> Feedback till program, annotering av CFG:er med profileringsinfo.
<LI> Kodlayout med profileringsinfo.
<LI> Skapa superblock
<LI> Skapa hyperblock
<LI> Plocka fram heta block, skapa en 'het' sub-CFG som hoppar
till den kalla huvud-CFG:n vid behov.
<LI> Optimering av het CFG, kodf�rflyttning fr�n het till kall CFG.
<LI> Spawn-time specialization
</UL>
130 changes: 130 additions & 0 deletions amd64/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2004-2010. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%
#

ifndef EBIN
EBIN = ../ebin
endif

ifndef DOCS
DOCS = ../doc
endif

include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk

# ----------------------------------------------------
# Application version
# ----------------------------------------------------
include ../vsn.mk
VSN=$(HIPE_VSN)

# ----------------------------------------------------
# Release directory specification
# ----------------------------------------------------
RELSYSDIR = $(RELEASE_PATH)/lib/hipe-$(VSN)

# ----------------------------------------------------
# Target Specs
# ----------------------------------------------------
# Please keep this list sorted.
MODULES=hipe_amd64_assemble \
hipe_amd64_defuse \
hipe_amd64_encode \
hipe_amd64_frame \
hipe_amd64_liveness \
hipe_amd64_main \
hipe_amd64_pp \
hipe_amd64_ra \
hipe_amd64_ra_finalise \
hipe_amd64_ra_ls \
hipe_amd64_ra_naive \
hipe_amd64_ra_postconditions \
hipe_amd64_ra_sse2_postconditions \
hipe_amd64_ra_x87_ls \
hipe_amd64_registers \
hipe_amd64_spill_restore \
hipe_amd64_x87 \
hipe_rtl_to_amd64

ERL_FILES=$(MODULES:%=%.erl)
TARGET_FILES=$(MODULES:%=$(EBIN)/%.$(EMULATOR))
DOC_FILES= $(MODULES:%=$(DOCS)/%.html)

# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------

include ../native.mk

ERL_COMPILE_FLAGS += -DHIPE_AMD64 +warn_exported_vars

# ----------------------------------------------------
# Targets
# ----------------------------------------------------

debug opt: $(TARGET_FILES)

docs:

# Moved docs target to edocs so the standard docs rule work properly.
edocs: $(DOC_FILES)

clean:
rm -f $(TARGET_FILES)
rm -f core

$(DOCS)/%.html:%.erl
erl -noshell -run edoc_run file '"$<"' '[{dir, "$(DOCS)"}]' -s init stop

# ----------------------------------------------------
# Special Build Targets
# ----------------------------------------------------

# ----------------------------------------------------
# Release Target
# ----------------------------------------------------
include $(ERL_TOP)/make/otp_release_targets.mk

release_spec: opt
$(INSTALL_DIR) $(RELSYSDIR)/ebin
$(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin

release_docs_spec:

# Please keep this list sorted.
$(EBIN)/hipe_amd64_assemble.beam: ../main/hipe.hrl ../rtl/hipe_literals.hrl ../x86/hipe_x86.hrl ../../kernel/src/hipe_ext_format.hrl ../misc/hipe_sdi.hrl ../x86/hipe_x86_assemble.erl
$(EBIN)/hipe_amd64_defuse.beam: ../x86/hipe_x86.hrl ../x86/hipe_x86_defuse.erl
$(EBIN)/hipe_amd64_frame.beam: ../main/hipe.hrl ../x86/hipe_x86.hrl ../x86/hipe_x86_frame.erl ../rtl/hipe_literals.hrl
$(EBIN)/hipe_amd64_liveness.beam: ../flow/liveness.inc ../x86/hipe_x86_liveness.erl
$(EBIN)/hipe_amd64_main.beam: ../main/hipe.hrl ../x86/hipe_x86_main.erl
$(EBIN)/hipe_amd64_pp.beam: ../x86/hipe_x86.hrl ../x86/hipe_x86_pp.erl
$(EBIN)/hipe_amd64_ra.beam: ../main/hipe.hrl ../x86/hipe_x86_ra.erl
$(EBIN)/hipe_amd64_ra_dummy.beam: ../main/hipe.hrl ../x86/hipe_x86.hrl
$(EBIN)/hipe_amd64_ra_finalise.beam: ../x86/hipe_x86.hrl ../x86/hipe_x86_ra_finalise.erl
$(EBIN)/hipe_amd64_ra_ls.beam: ../main/hipe.hrl ../x86/hipe_x86_ra_ls.erl
$(EBIN)/hipe_amd64_ra_naive.beam: ../main/hipe.hrl ../x86/hipe_x86.hrl ../x86/hipe_x86_ra_naive.erl
$(EBIN)/hipe_amd64_ra_postconditions.beam: ../main/hipe.hrl ../x86/hipe_x86.hrl ../x86/hipe_x86_ra_postconditions.erl
$(EBIN)/hipe_amd64_ra_sse2_postconditions.beam: ../main/hipe.hrl
$(EBIN)/hipe_amd64_ra_x87_ls.beam: ../main/hipe.hrl ../x86/hipe_x86_ra_x87_ls.erl
$(EBIN)/hipe_amd64_registers.beam: ../rtl/hipe_literals.hrl
$(EBIN)/hipe_amd64_spill_restore.beam: ../main/hipe.hrl ../x86/hipe_x86.hrl ../flow/cfg.hrl ../x86/hipe_x86_spill_restore.erl
$(EBIN)/hipe_amd64_x87.beam: ../x86/hipe_x86_x87.erl
$(EBIN)/hipe_rtl_to_amd64.beam: ../x86/hipe_rtl_to_x86.erl ../rtl/hipe_rtl.hrl

$(TARGET_FILES): ../x86/hipe_x86.hrl ../misc/hipe_consttab.hrl
19 changes: 19 additions & 0 deletions amd64/hipe_amd64_assemble.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%%
-include("../x86/hipe_x86_assemble.erl").
20 changes: 20 additions & 0 deletions amd64/hipe_amd64_defuse.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%%

-include("../x86/hipe_x86_defuse.erl").
Loading

0 comments on commit 69d8f8a

Please sign in to comment.