Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
27 changed files
with
5,365 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) ). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.