Permalink
Please sign in to comment.
Browse files
Merge branch 'yiannist/hipe-llvm-backend'
* yiannist/hipe-llvm-backend: Support the LLVM backend in HiPE Implement the LLVM backend Extend RTL API to support the LLVM backend Add support for llvm unique symbols in hipe_gensym Add a BIF that only returns the atom ok Move some common code in hipe_pack_constants Add better specs in hipe_pack_constants and cleanup OTP-11801
- Loading branch information...
Showing
with
5,365 additions
and 232 deletions.
- +7 −0 erts/emulator/hipe/hipe_bif2.c
- +1 −0 erts/emulator/hipe/hipe_bif2.tab
- +1 −1 lib/hipe/Makefile
- +3 −45 lib/hipe/arm/hipe_arm_assemble.erl
- +109 −0 lib/hipe/llvm/Makefile
- +59 −0 lib/hipe/llvm/elf32_format.hrl
- +58 −0 lib/hipe/llvm/elf64_format.hrl
- +790 −0 lib/hipe/llvm/elf_format.erl
- +488 −0 lib/hipe/llvm/elf_format.hrl
- +1,131 −0 lib/hipe/llvm/hipe_llvm.erl
- +11 −0 lib/hipe/llvm/hipe_llvm_arch.hrl
- +112 −0 lib/hipe/llvm/hipe_llvm_liveness.erl
- +514 −0 lib/hipe/llvm/hipe_llvm_main.erl
- +114 −0 lib/hipe/llvm/hipe_llvm_merge.erl
- +1,612 −0 lib/hipe/llvm/hipe_rtl_to_llvm.erl
- +6 −0 lib/hipe/main/hipe.app.src
- +37 −16 lib/hipe/main/hipe.erl
- +35 −7 lib/hipe/main/hipe_main.erl
- +1 −1 lib/hipe/misc/hipe_gensym.erl
- +87 −13 lib/hipe/misc/hipe_pack_constants.erl
- +3 −45 lib/hipe/ppc/hipe_ppc_assemble.erl
- +166 −8 lib/hipe/rtl/hipe_rtl.erl
- +2 −1 lib/hipe/rtl/hipe_rtl.hrl
- +2 −1 lib/hipe/rtl/hipe_rtl_liveness.erl
- +3 −45 lib/hipe/sparc/hipe_sparc_assemble.erl
- +4 −47 lib/hipe/x86/hipe_x86_assemble.erl
- +9 −2 lib/kernel/src/hipe_unified_loader.erl
| @@ -0,0 +1,109 @@ | ||
| # | ||
| # %CopyrightBegin% | ||
| # | ||
| # Copyright Ericsson AB 2001-2014. 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 | ||
| 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 | ||
| # ---------------------------------------------------- | ||
| ifdef HIPE_ENABLED | ||
| HIPE_MODULES = hipe_rtl_to_llvm \ | ||
| hipe_llvm \ | ||
| elf_format \ | ||
| hipe_llvm_main \ | ||
| hipe_llvm_merge \ | ||
| hipe_llvm_liveness | ||
| else | ||
| HIPE_MODULES = | ||
| endif | ||
| MODULES = $(HIPE_MODULES) | ||
| HRL_FILES= elf_format.hrl elf32_format.hrl elf64_format.hrl \ | ||
| hipe_llvm_arch.hrl | ||
| ERL_FILES= $(MODULES:%=%.erl) | ||
| TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) | ||
| # APP_FILE= | ||
| # App_SRC= $(APP_FILE).src | ||
| # APP_TARGET= $(EBIN)/$(APP_FILE) | ||
| # | ||
| # APPUP_FILE= | ||
| # APPUP_SRC= $(APPUP_FILE).src | ||
| # APPUP_TARGET= $(EBIN)/$(APPUP_FILE) | ||
| # ---------------------------------------------------- | ||
| # FLAGS: Please keep +inline below | ||
| # ---------------------------------------------------- | ||
| include ../native.mk | ||
| ERL_COMPILE_FLAGS += +inline #+warn_missing_spec | ||
| # if in 32 bit backend define BIT32 symbol | ||
| ARCH = $(shell echo $(TARGET) | sed 's/^\(x86_64\)-.*/64bit/') | ||
| ifneq ($(ARCH), 64bit) | ||
| ERL_COMPILE_FLAGS += -DBIT32 | ||
| endif | ||
| # ---------------------------------------------------- | ||
| # Targets | ||
| # ---------------------------------------------------- | ||
| debug opt: $(TARGET_FILES) | ||
| docs: | ||
| clean: | ||
| rm -f $(TARGET_FILES) | ||
| rm -f core erl_crash.dump | ||
| # ---------------------------------------------------- | ||
| # Special Build Targets | ||
| # ---------------------------------------------------- | ||
| # ---------------------------------------------------- | ||
| # Release Target | ||
| # ---------------------------------------------------- | ||
| include $(ERL_TOP)/make/otp_release_targets.mk | ||
| release_spec: opt | ||
| $(INSTALL_DIR) $(RELSYSDIR)/llvm | ||
| $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR)/llvm | ||
| $(INSTALL_DIR) $(RELSYSDIR)/ebin | ||
| $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin | ||
| release_docs_spec: |
| @@ -0,0 +1,59 @@ | ||
| %% -*- erlang-indent-level: 2 -*- | ||
| %%% @copyright 2011-2014 Yiannis Tsiouris <gtsiour@softlab.ntua.gr>, | ||
| %%% Chris Stavrakakis <hydralisk.r@gmail.com> | ||
| %%% @author Yiannis Tsiouris <gtsiour@softlab.ntua.gr> | ||
| %%% [http://www.softlab.ntua.gr/~gtsiour/] | ||
| %%% @doc This header file contains very very useful macros for handling | ||
| %%% various segments of an ELF-32 formated object file, such as sizes, | ||
| %%% offsets and predefined constants. For further information about | ||
| %%% each field take a quick look at | ||
| %%% "[http://www.sco.com/developers/gabi/latest/contents.html]" | ||
| %%% that contain the current HP/Intel definition of the ELF object | ||
| %%% file format. | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-32 Data Types (in bytes) | ||
| %%------------------------------------------------------------------------------ | ||
| -define(ELF_ADDR_SIZE, 4). | ||
| -define(ELF_OFF_SIZE, 4). | ||
| -define(ELF_HALF_SIZE, 2). | ||
| -define(ELF_WORD_SIZE, 4). | ||
| -define(ELF_SWORD_SIZE, 4). | ||
| -define(ELF_XWORD_SIZE, ?ELF_WORD_SIZE). % for compatibility | ||
| -define(ELF_SXWORD_SIZE, ?ELF_WORD_SIZE). | ||
| -define(ELF_UNSIGNED_CHAR_SIZE, 1). | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-32 Symbol Table Entries | ||
| %%------------------------------------------------------------------------------ | ||
| %% Precomputed offset for Symbol Table entries in SymTab binary (needed because | ||
| %% of the different offsets in 32 and 64 bit formats). | ||
| -define(ST_NAME_OFFSET, 0). | ||
| -define(ST_VALUE_OFFSET, (?ST_NAME_OFFSET + ?ST_NAME_SIZE) ). | ||
| -define(ST_SIZE_OFFSET, (?ST_VALUE_OFFSET + ?ST_VALUE_SIZE) ). | ||
| -define(ST_INFO_OFFSET, (?ST_SIZE_OFFSET + ?ST_SIZE_SIZE) ). | ||
| -define(ST_OTHER_OFFSET, (?ST_INFO_OFFSET + ?ST_INFO_SIZE) ). | ||
| -define(ST_SHNDX_OFFSET, (?ST_OTHER_OFFSET + ?ST_OTHER_SIZE) ). | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-64 Relocation Entries | ||
| %%------------------------------------------------------------------------------ | ||
| %% Useful macros to extract information from r_info field | ||
| -define(ELF_R_SYM(I), (I bsr 8) ). | ||
| -define(ELF_R_TYPE(I), (I band 16#ff) ). | ||
| -define(ELF_R_INFO(S, T), ((S bsl 8) + (T band 16#ff)) ). | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-64 Program Header Table | ||
| %%------------------------------------------------------------------------------ | ||
| %% Offsets of various fields in a Program Header Table entry binary. | ||
| -define(P_TYPE_OFFSET, 0). | ||
| -define(P_OFFSET_OFFSET, (?P_FLAGS_OFFSET + ?P_FLAGS_SIZE) ). | ||
| -define(P_VADDR_OFFSET, (?P_OFFSET_OFFSET + ?P_OFFSET_SIZE) ). | ||
| -define(P_PADDR_OFFSET, (?P_VADDR_OFFSET + ?P_VADDR_SIZE) ). | ||
| -define(P_FILESZ_OFFSET, (?P_PVADDR_OFFSET + ?P_PVADDR_SIZE) ). | ||
| -define(P_MEMSZ_OFFSET, (?P_FILESZ_OFFSET + ?P_FILESZ_SIZE) ). | ||
| -define(P_FLAGS_OFFSET, (?P_TYPE_OFFSET + ?P_TYPE_SIZE) ). | ||
| -define(P_ALIGN_OFFSET, (?P_MEMSZ_OFFSET + ?P_MEMSZ_SIZE) ). |
| @@ -0,0 +1,58 @@ | ||
| %% -*- erlang-indent-level: 2 -*- | ||
| %%% @copyright 2011-2014 Yiannis Tsiouris <gtsiour@softlab.ntua.gr>, | ||
| %%% Chris Stavrakakis <hydralisk.r@gmail.com> | ||
| %%% @author Yiannis Tsiouris <gtsiour@softlab.ntua.gr> | ||
| %%% [http://www.softlab.ntua.gr/~gtsiour/] | ||
| %%% @doc This header file contains very very useful macros for handling | ||
| %%% various segments of an ELF-64 formated object file, such as sizes, | ||
| %%% offsets and predefined constants. For further information about | ||
| %%% each field take a quick look at | ||
| %%% "[http://downloads.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf]" | ||
| %%% that contain the current HP/Intel definition of the ELF object | ||
| %%% file format. | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-64 Data Types (in bytes) | ||
| %%------------------------------------------------------------------------------ | ||
| -define(ELF_ADDR_SIZE, 8). | ||
| -define(ELF_OFF_SIZE, 8). | ||
| -define(ELF_HALF_SIZE, 2). | ||
| -define(ELF_WORD_SIZE, 4). | ||
| -define(ELF_SWORD_SIZE, 4). | ||
| -define(ELF_XWORD_SIZE, 8). | ||
| -define(ELF_SXWORD_SIZE, 8). | ||
| -define(ELF_UNSIGNED_CHAR_SIZE, 1). | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-64 Symbol Table Entries | ||
| %%------------------------------------------------------------------------------ | ||
| %% Precomputed offset for Symbol Table entries in SymTab binary | ||
| -define(ST_NAME_OFFSET, 0). | ||
| -define(ST_INFO_OFFSET, (?ST_NAME_OFFSET + ?ST_NAME_SIZE) ). | ||
| -define(ST_OTHER_OFFSET, (?ST_INFO_OFFSET + ?ST_INFO_SIZE) ). | ||
| -define(ST_SHNDX_OFFSET, (?ST_OTHER_OFFSET + ?ST_OTHER_SIZE) ). | ||
| -define(ST_VALUE_OFFSET, (?ST_SHNDX_OFFSET + ?ST_SHNDX_SIZE) ). | ||
| -define(ST_SIZE_OFFSET, (?ST_VALUE_OFFSET + ?ST_VALUE_SIZE) ). | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-64 Relocation Entries | ||
| %%------------------------------------------------------------------------------ | ||
| %% Useful macros to extract information from r_info field | ||
| -define(ELF_R_SYM(I), (I bsr 32) ). | ||
| -define(ELF_R_TYPE(I), (I band 16#ffffffff) ). | ||
| -define(ELF_R_INFO(S, T), ((S bsl 32) + (T band 16#ffffffff)) ). | ||
| %%------------------------------------------------------------------------------ | ||
| %% ELF-64 Program Header Table | ||
| %%------------------------------------------------------------------------------ | ||
| %% Offsets of various fields in a Program Header Table entry binary. | ||
| -define(P_TYPE_OFFSET, 0). | ||
| -define(P_FLAGS_OFFSET, (?P_TYPE_OFFSET + ?P_TYPE_SIZE) ). | ||
| -define(P_OFFSET_OFFSET, (?P_FLAGS_OFFSET + ?P_FLAGS_SIZE) ). | ||
| -define(P_VADDR_OFFSET, (?P_OFFSET_OFFSET + ?P_OFFSET_SIZE) ). | ||
| -define(P_PADDR_OFFSET, (?P_VADDR_OFFSET + ?P_VADDR_SIZE) ). | ||
| -define(P_FILESZ_OFFSET, (?P_PVADDR_OFFSET + ?P_PVADDR_SIZE) ). | ||
| -define(P_MEMSZ_OFFSET, (?P_FILESZ_OFFSET + ?P_FILESZ_SIZE) ). | ||
| -define(P_ALIGN_OFFSET, (?P_MEMSZ_OFFSET + ?P_MEMSZ_SIZE) ). |
Oops, something went wrong.
0 comments on commit
9d46875