author | erikj |
Tue, 12 Sep 2017 19:03:56 +0200 | |
changeset 47217 | 72e3ae9a25eb |
parent 47216 | 71c04702a3d5 |
child 47314 | 743814386712 |
permissions | -rw-r--r-- |
37437 | 1 |
# |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
42664
diff
changeset
|
2 |
# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. |
37437 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
47217 | 26 |
$(eval $(call IncludeCustomExtension, , hotspot/gensrc/GensrcAdlc.gmk)) |
37437 | 27 |
|
28 |
ifeq ($(call check-jvm-feature, compiler2), true) |
|
29 |
||
30 |
ADLC_SUPPORT_DIR := $(JVM_SUPPORT_DIR)/adlc |
|
31 |
||
32 |
############################################################################## |
|
33 |
# Build the ad compiler (the adlc build tool) |
|
34 |
||
35 |
# Flags depending on the build platform/tool chain |
|
36 |
# NOTE: No optimization or debug flags set here |
|
37 |
ifeq ($(OPENJDK_BUILD_OS), linux) |
|
38 |
ADLC_CFLAGS := -fno-exceptions -DLINUX |
|
39 |
else ifeq ($(OPENJDK_BUILD_OS), solaris) |
|
40 |
ADLC_LDFLAGS := -m64 |
|
41 |
ADLC_CFLAGS := -m64 |
|
42 |
ADLC_CFLAGS_WARNINGS := +w |
|
43 |
else ifeq ($(OPENJDK_BUILD_OS), aix) |
|
37469
ac811846846c
8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents:
37437
diff
changeset
|
44 |
ADLC_LDFLAGS := -q64 |
ac811846846c
8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents:
37437
diff
changeset
|
45 |
ADLC_CFLAGS := -qnortti -qeh -q64 -DAIX |
37437 | 46 |
else ifeq ($(OPENJDK_BUILD_OS), windows) |
47 |
ADLC_LDFLAGS := -nologo |
|
48 |
ADLC_CFLAGS := -nologo -EHsc |
|
49 |
# NOTE: The old build also have -D_CRT_SECURE_NO_DEPRECATE but it doesn't |
|
50 |
# seem needed any more. |
|
51 |
ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS |
|
52 |
endif |
|
53 |
||
39963
5921b7f27d63
8156980: Hotspot build doesn't have -std=gnu++98 gcc option
andrew
parents:
38097
diff
changeset
|
54 |
# Set the C++ standard if supported |
5921b7f27d63
8156980: Hotspot build doesn't have -std=gnu++98 gcc option
andrew
parents:
38097
diff
changeset
|
55 |
ADLC_CFLAGS += $(CXXSTD_CXXFLAG) |
5921b7f27d63
8156980: Hotspot build doesn't have -std=gnu++98 gcc option
andrew
parents:
38097
diff
changeset
|
56 |
|
37437 | 57 |
# NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to |
58 |
# hurt. |
|
59 |
ADLC_CFLAGS += -DASSERT |
|
60 |
||
61 |
ADLC_CFLAGS += -D$(HOTSPOT_TARGET_CPU_DEFINE) |
|
62 |
||
47217 | 63 |
ADLC_CFLAGS += -I$(TOPDIR)/src/hotspot/share |
37437 | 64 |
|
65 |
$(eval $(call SetupNativeCompilation, BUILD_ADLC, \ |
|
66 |
TOOLCHAIN := TOOLCHAIN_BUILD_LINK_CXX, \ |
|
47217 | 67 |
SRC := $(TOPDIR)/src/hotspot/share/adlc, \ |
68 |
EXTRA_FILES := $(TOPDIR)/src/hotspot/share/opto/opcodes.cpp, \ |
|
37437 | 69 |
CFLAGS := $(ADLC_CFLAGS) $(ADLC_CFLAGS_WARNINGS), \ |
70 |
LDFLAGS := $(ADLC_LDFLAGS), \ |
|
71 |
LIBS := $(ADLC_LIBS), \ |
|
72 |
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc/objs, \ |
|
73 |
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc, \ |
|
74 |
PROGRAM := adlc, \ |
|
75 |
DEBUG_SYMBOLS := false, \ |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
42664
diff
changeset
|
76 |
DISABLED_WARNINGS_clang := tautological-compare, \ |
37437 | 77 |
DISABLED_WARNINGS_solstudio := notemsource, \ |
78 |
)) |
|
79 |
||
80 |
ADLC_TOOL := $(BUILD_ADLC_TARGET) |
|
81 |
||
82 |
############################################################################## |
|
83 |
# Transform the ad source files into C++ source files using adlc |
|
84 |
||
85 |
# Setup flags for the adlc build tool (ADLCFLAGS). |
|
86 |
ADLCFLAGS += -q -T |
|
87 |
||
88 |
# ADLC flags depending on target OS |
|
89 |
ifeq ($(OPENJDK_TARGET_OS), linux) |
|
90 |
ADLCFLAGS += -DLINUX=1 -D_GNU_SOURCE=1 |
|
91 |
else ifeq ($(OPENJDK_TARGET_OS), solaris) |
|
92 |
ADLCFLAGS += -DSOLARIS=1 -DSPARC_WORKS=1 |
|
93 |
else ifeq ($(OPENJDK_TARGET_OS), aix) |
|
37469
ac811846846c
8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents:
37437
diff
changeset
|
94 |
ADLCFLAGS += -DAIX=1 |
37437 | 95 |
else ifeq ($(OPENJDK_TARGET_OS), macosx) |
96 |
ADLCFLAGS += -D_ALLBSD_SOURCE=1 -D_GNU_SOURCE=1 |
|
97 |
endif |
|
98 |
||
99 |
ifneq ($(OPENJDK_TARGET_OS), windows) |
|
100 |
# NOTE: Windows adlc flags was different in the old build. Is this really |
|
101 |
# correct? |
|
102 |
||
103 |
# -g makes #line directives in the generated C++ files. |
|
104 |
ADLCFLAGS += -g |
|
105 |
||
106 |
ADLCFLAGS += -D$(HOTSPOT_TARGET_CPU_DEFINE)=1 |
|
107 |
endif |
|
108 |
||
109 |
# This generates checks in the generated C++ files that _LP64 is correctly |
|
110 |
# (un)defined when compiling them. |
|
111 |
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64) |
|
112 |
ADLCFLAGS += -D_LP64=1 |
|
113 |
else |
|
114 |
ADLCFLAGS += -U_LP64 |
|
115 |
endif |
|
116 |
||
42664 | 117 |
ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) |
118 |
ADLCFLAGS += -DARM=1 |
|
119 |
endif |
|
120 |
||
37437 | 121 |
############################################################################## |
122 |
# Concatenate all ad source files into a single file, which will be fed to |
|
123 |
# adlc. Also include a #line directive at the start of every included file |
|
124 |
# (after the initial header block), stating the original source file name. |
|
125 |
# |
|
126 |
# Normally, debugging is done directly on the ad_<arch>*.cpp files, but the |
|
127 |
# #line directives in those files will be pointing back to <arch>.ad. |
|
128 |
||
129 |
# AD_SRC_ROOTS might have been added to by a custom extension |
|
47217 | 130 |
AD_SRC_ROOTS += $(TOPDIR)/src/hotspot |
37437 | 131 |
|
132 |
AD_SRC_FILES := $(call uniq, $(wildcard $(foreach d, $(AD_SRC_ROOTS), \ |
|
47217 | 133 |
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/$(HOTSPOT_TARGET_CPU).ad \ |
134 |
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/$(HOTSPOT_TARGET_CPU_ARCH).ad \ |
|
135 |
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH)/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH).ad \ |
|
37437 | 136 |
))) |
137 |
||
138 |
SINGLE_AD_SRCFILE := $(ADLC_SUPPORT_DIR)/all-ad-src.ad |
|
139 |
||
140 |
INSERT_FILENAME_AWK_SCRIPT := \ |
|
141 |
'{ \ |
|
142 |
if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ |
|
143 |
if (need_lineno && $$0 !~ /\/\//) \ |
|
144 |
{ print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ |
|
145 |
print \ |
|
146 |
}' |
|
147 |
||
148 |
$(SINGLE_AD_SRCFILE): $(AD_SRC_FILES) |
|
149 |
$(call LogInfo, Preprocessing adlc files $(^F)) |
|
150 |
$(call MakeDir, $(@D)) |
|
151 |
$(NAWK) $(INSERT_FILENAME_AWK_SCRIPT) $^ > $@ |
|
152 |
||
153 |
############################################################################## |
|
154 |
# Run the adlc tool on the single concatenated ad source file, and store the |
|
155 |
# output in support/adlc for further processing. |
|
156 |
ADLC_RUN_MARKER := $(ADLC_SUPPORT_DIR)/_adlc_run.marker |
|
157 |
||
158 |
$(ADLC_RUN_MARKER): $(BUILD_ADLC) $(SINGLE_AD_SRCFILE) |
|
159 |
$(call LogInfo, Generating adlc files) |
|
160 |
$(call MakeDir, $(@D)) |
|
161 |
$(call ExecuteWithLog, $(ADLC_SUPPORT_DIR)/adlc_run, \ |
|
162 |
$(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \ |
|
40010 | 163 |
-c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ |
164 |
-h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \ |
|
165 |
-a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ |
|
166 |
-v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp) |
|
37437 | 167 |
$(TOUCH) $@ |
168 |
||
169 |
############################################################################## |
|
170 |
# Finally copy the generated files from support/adlc into gensrc/adfiles, |
|
171 |
# and postprocess them by fixing dummy #line directives. |
|
172 |
||
173 |
ADLC_GENERATED_FILES := $(addprefix $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/, \ |
|
40010 | 174 |
ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ |
175 |
ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \ |
|
176 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_clone.cpp \ |
|
177 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_expand.cpp \ |
|
178 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_format.cpp \ |
|
179 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_gen.cpp \ |
|
180 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_misc.cpp \ |
|
181 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_peephole.cpp \ |
|
182 |
ad_$(HOTSPOT_TARGET_CPU_ARCH)_pipeline.cpp \ |
|
183 |
adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp \ |
|
184 |
dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ |
|
37437 | 185 |
) |
186 |
||
187 |
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(ADLC_RUN_MARKER) |
|
188 |
$(call LogInfo, Postprocessing adlc file $*) |
|
189 |
$(call MakeDir, $(@D)) |
|
190 |
$(NAWK) \ |
|
191 |
'BEGIN { print "#line 1 \"$*\""; } \ |
|
192 |
/^#line 999999$$/ {print "#line " (NR+1) " \"$*\""; next} \ |
|
193 |
{print}' \ |
|
194 |
< $(ADLC_SUPPORT_DIR)/$* > $@ |
|
195 |
||
196 |
TARGETS := $(ADLC_GENERATED_FILES) |
|
197 |
||
198 |
endif |