1//
2// Copyright (C) 2012 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17// TODO We should really separate out those files that are actually needed for both variants of an
18// architecture into its own category. Currently we just include all of the 32bit variant in the
19// 64bit variant. It also might be good to allow one to compile only the 64bit variant without the
20// 32bit one.
21
22art_cc_defaults {
23    name: "libart-compiler-defaults",
24    defaults: ["art_defaults"],
25    host_supported: true,
26    clang: true,
27    srcs: [
28        "compiled_method.cc",
29        "debug/elf_debug_writer.cc",
30        "dex/dex_to_dex_compiler.cc",
31        "dex/inline_method_analyser.cc",
32        "dex/verified_method.cc",
33        "dex/verification_results.cc",
34        "dex/quick_compiler_callbacks.cc",
35        "driver/compiled_method_storage.cc",
36        "driver/compiler_driver.cc",
37        "driver/compiler_options.cc",
38        "driver/dex_compilation_unit.cc",
39        "linker/buffered_output_stream.cc",
40        "linker/file_output_stream.cc",
41        "linker/multi_oat_relative_patcher.cc",
42        "linker/output_stream.cc",
43        "linker/vector_output_stream.cc",
44        "linker/relative_patcher.cc",
45        "jit/jit_compiler.cc",
46        "jit/jit_logger.cc",
47        "jni/quick/calling_convention.cc",
48        "jni/quick/jni_compiler.cc",
49        "optimizing/block_builder.cc",
50        "optimizing/bounds_check_elimination.cc",
51        "optimizing/builder.cc",
52        "optimizing/cha_guard_optimization.cc",
53        "optimizing/code_generator.cc",
54        "optimizing/code_generator_utils.cc",
55        "optimizing/code_sinking.cc",
56        "optimizing/constant_folding.cc",
57        "optimizing/dead_code_elimination.cc",
58        "optimizing/escape.cc",
59        "optimizing/graph_checker.cc",
60        "optimizing/graph_visualizer.cc",
61        "optimizing/gvn.cc",
62        "optimizing/induction_var_analysis.cc",
63        "optimizing/induction_var_range.cc",
64        "optimizing/inliner.cc",
65        "optimizing/instruction_builder.cc",
66        "optimizing/instruction_simplifier.cc",
67        "optimizing/intrinsics.cc",
68        "optimizing/licm.cc",
69        "optimizing/linear_order.cc",
70        "optimizing/load_store_elimination.cc",
71        "optimizing/locations.cc",
72        "optimizing/loop_optimization.cc",
73        "optimizing/nodes.cc",
74        "optimizing/optimization.cc",
75        "optimizing/optimizing_compiler.cc",
76        "optimizing/parallel_move_resolver.cc",
77        "optimizing/prepare_for_register_allocation.cc",
78        "optimizing/reference_type_propagation.cc",
79        "optimizing/register_allocation_resolver.cc",
80        "optimizing/register_allocator.cc",
81        "optimizing/register_allocator_graph_color.cc",
82        "optimizing/register_allocator_linear_scan.cc",
83        "optimizing/select_generator.cc",
84        "optimizing/scheduler.cc",
85        "optimizing/sharpening.cc",
86        "optimizing/side_effects_analysis.cc",
87        "optimizing/ssa_builder.cc",
88        "optimizing/ssa_liveness_analysis.cc",
89        "optimizing/ssa_phi_elimination.cc",
90        "optimizing/stack_map_stream.cc",
91        "trampolines/trampoline_compiler.cc",
92        "utils/assembler.cc",
93        "utils/jni_macro_assembler.cc",
94        "utils/swap_space.cc",
95        "compiler.cc",
96        "elf_writer.cc",
97        "elf_writer_quick.cc",
98        "image_writer.cc",
99        "oat_writer.cc",
100    ],
101
102    codegen: {
103        arm: {
104            srcs: [
105                "jni/quick/arm/calling_convention_arm.cc",
106                "linker/arm/relative_patcher_arm_base.cc",
107                "linker/arm/relative_patcher_thumb2.cc",
108                "optimizing/code_generator_arm.cc",
109                "optimizing/code_generator_vector_arm.cc",
110                "optimizing/code_generator_arm_vixl.cc",
111                "optimizing/code_generator_vector_arm_vixl.cc",
112                "optimizing/dex_cache_array_fixups_arm.cc",
113                "optimizing/instruction_simplifier_arm.cc",
114                "optimizing/instruction_simplifier_shared.cc",
115                "optimizing/intrinsics_arm.cc",
116                "optimizing/intrinsics_arm_vixl.cc",
117                "optimizing/nodes_shared.cc",
118                "utils/arm/assembler_arm.cc",
119                "utils/arm/assembler_arm_vixl.cc",
120                "utils/arm/assembler_thumb2.cc",
121                "utils/arm/jni_macro_assembler_arm.cc",
122                "utils/arm/jni_macro_assembler_arm_vixl.cc",
123                "utils/arm/managed_register_arm.cc",
124            ],
125        },
126        arm64: {
127            srcs: [
128                "jni/quick/arm64/calling_convention_arm64.cc",
129                "linker/arm64/relative_patcher_arm64.cc",
130                "optimizing/code_generator_arm64.cc",
131                "optimizing/code_generator_vector_arm64.cc",
132                "optimizing/scheduler_arm64.cc",
133                "optimizing/instruction_simplifier_arm64.cc",
134                "optimizing/intrinsics_arm64.cc",
135                "utils/arm64/assembler_arm64.cc",
136                "utils/arm64/jni_macro_assembler_arm64.cc",
137                "utils/arm64/managed_register_arm64.cc",
138            ],
139        },
140        mips: {
141            srcs: [
142                "jni/quick/mips/calling_convention_mips.cc",
143                "linker/mips/relative_patcher_mips.cc",
144                "optimizing/code_generator_mips.cc",
145                "optimizing/code_generator_vector_mips.cc",
146                "optimizing/dex_cache_array_fixups_mips.cc",
147                "optimizing/intrinsics_mips.cc",
148                "optimizing/pc_relative_fixups_mips.cc",
149                "utils/mips/assembler_mips.cc",
150                "utils/mips/managed_register_mips.cc",
151            ],
152        },
153        mips64: {
154            srcs: [
155                "jni/quick/mips64/calling_convention_mips64.cc",
156                "linker/mips64/relative_patcher_mips64.cc",
157                "optimizing/code_generator_mips64.cc",
158                "optimizing/code_generator_vector_mips64.cc",
159                "optimizing/intrinsics_mips64.cc",
160                "utils/mips64/assembler_mips64.cc",
161                "utils/mips64/managed_register_mips64.cc",
162            ],
163        },
164        x86: {
165            srcs: [
166                "jni/quick/x86/calling_convention_x86.cc",
167                "linker/x86/relative_patcher_x86.cc",
168                "linker/x86/relative_patcher_x86_base.cc",
169                "optimizing/code_generator_x86.cc",
170                "optimizing/code_generator_vector_x86.cc",
171                "optimizing/intrinsics_x86.cc",
172                "optimizing/pc_relative_fixups_x86.cc",
173                "optimizing/x86_memory_gen.cc",
174                "utils/x86/assembler_x86.cc",
175                "utils/x86/jni_macro_assembler_x86.cc",
176                "utils/x86/managed_register_x86.cc",
177            ],
178        },
179        x86_64: {
180            srcs: [
181                "jni/quick/x86_64/calling_convention_x86_64.cc",
182                "linker/x86_64/relative_patcher_x86_64.cc",
183                "optimizing/intrinsics_x86_64.cc",
184                "optimizing/code_generator_x86_64.cc",
185                "optimizing/code_generator_vector_x86_64.cc",
186                "utils/x86_64/assembler_x86_64.cc",
187                "utils/x86_64/jni_macro_assembler_x86_64.cc",
188                "utils/x86_64/managed_register_x86_64.cc",
189            ],
190        },
191    },
192    target: {
193        host: {
194            // For compiler driver TLS.
195            host_ldlibs: ["-lpthread"],
196        },
197        android: {
198            // For atrace.
199            shared_libs: ["libcutils"],
200        },
201    },
202    generated_sources: ["art_compiler_operator_srcs"],
203    shared_libs: [
204        "libbase",
205        "liblz4",
206        "liblzma",
207    ],
208    include_dirs: ["art/disassembler"],
209    export_include_dirs: ["."],
210
211    // For SHA-1 checksumming of build ID
212    static: {
213        whole_static_libs: ["libcrypto"],
214    },
215    shared: {
216        shared_libs: ["libcrypto"],
217    },
218}
219
220gensrcs {
221    name: "art_compiler_operator_srcs",
222    cmd: "$(location generate-operator-out.py) art/compiler $(in) > $(out)",
223    tool_files: ["generate-operator-out.py"],
224    srcs: [
225        "compiled_method.h",
226        "dex/dex_to_dex_compiler.h",
227        "driver/compiler_driver.h",
228        "driver/compiler_options.h",
229        "image_writer.h",
230        "optimizing/locations.h",
231
232        "utils/arm/constants_arm.h",
233        "utils/mips/assembler_mips.h",
234        "utils/mips64/assembler_mips64.h",
235    ],
236    output_extension: "operator_out.cc",
237}
238
239art_cc_library {
240    name: "libart-compiler",
241    defaults: ["libart-compiler-defaults"],
242    codegen: {
243        arm: {
244            // VIXL assembly support for ARM targets.
245            static: {
246                whole_static_libs: [
247                    "libvixl-arm",
248                ],
249            },
250            shared: {
251                shared_libs: [
252                    "libvixl-arm",
253                ],
254            },
255        },
256        arm64: {
257            // VIXL assembly support for ARM64 targets.
258            static: {
259                whole_static_libs: [
260                    "libvixl-arm64",
261                ],
262            },
263            shared: {
264                shared_libs: [
265                    "libvixl-arm64",
266                ],
267            },
268        },
269    },
270    shared_libs: [
271        "libart",
272        "libart-dexlayout",
273    ],
274}
275
276art_cc_library {
277    name: "libartd-compiler",
278    defaults: [
279        "art_debug_defaults",
280        "libart-compiler-defaults",
281    ],
282    codegen: {
283        arm: {
284            // VIXL assembly support for ARM targets.
285            static: {
286                whole_static_libs: [
287                    "libvixld-arm",
288                ],
289            },
290            shared: {
291                shared_libs: [
292                    "libvixld-arm",
293                ],
294            },
295        },
296        arm64: {
297            // VIXL assembly support for ARM64 targets.
298            static: {
299                whole_static_libs: [
300                    "libvixld-arm64",
301                ],
302            },
303            shared: {
304                shared_libs: [
305                    "libvixld-arm64",
306                ],
307            },
308        },
309    },
310    shared_libs: [
311        "libartd",
312        "libartd-dexlayout"
313    ],
314}
315
316art_cc_library {
317    name: "libart-compiler-gtest",
318    defaults: ["libart-gtest-defaults"],
319    srcs: ["common_compiler_test.cc"],
320    shared_libs: [
321        "libartd-compiler",
322        "libart-runtime-gtest",
323        "libbase",
324    ],
325}
326
327art_cc_test {
328    name: "art_compiler_tests",
329    defaults: [
330        "art_gtest_defaults",
331    ],
332    srcs: [
333        "compiled_method_test.cc",
334        "debug/dwarf/dwarf_test.cc",
335        "dex/dex_to_dex_decompiler_test.cc",
336        "driver/compiled_method_storage_test.cc",
337        "driver/compiler_driver_test.cc",
338        "elf_writer_test.cc",
339        "exception_test.cc",
340        "image_test.cc",
341        "jni/jni_compiler_test.cc",
342        "linker/multi_oat_relative_patcher_test.cc",
343        "linker/output_stream_test.cc",
344        "oat_test.cc",
345        "optimizing/bounds_check_elimination_test.cc",
346        "optimizing/dominator_test.cc",
347        "optimizing/find_loops_test.cc",
348        "optimizing/graph_checker_test.cc",
349        "optimizing/graph_test.cc",
350        "optimizing/gvn_test.cc",
351        "optimizing/induction_var_analysis_test.cc",
352        "optimizing/induction_var_range_test.cc",
353        "optimizing/licm_test.cc",
354        "optimizing/live_interval_test.cc",
355        "optimizing/loop_optimization_test.cc",
356        "optimizing/nodes_test.cc",
357        "optimizing/parallel_move_test.cc",
358        "optimizing/pretty_printer_test.cc",
359        "optimizing/reference_type_propagation_test.cc",
360        "optimizing/side_effects_test.cc",
361        "optimizing/ssa_liveness_analysis_test.cc",
362        "optimizing/ssa_test.cc",
363        "optimizing/stack_map_test.cc",
364        "optimizing/suspend_check_test.cc",
365        "utils/atomic_method_ref_map_test.cc",
366        "utils/dedupe_set_test.cc",
367        "utils/intrusive_forward_list_test.cc",
368        "utils/string_reference_test.cc",
369        "utils/swap_space_test.cc",
370        "utils/test_dex_file_builder_test.cc",
371        "verifier_deps_test.cc",
372
373        "jni/jni_cfi_test.cc",
374        "optimizing/codegen_test.cc",
375        "optimizing/optimizing_cfi_test.cc",
376        "optimizing/scheduler_test.cc",
377    ],
378
379    codegen: {
380        arm: {
381            srcs: [
382                "linker/arm/relative_patcher_thumb2_test.cc",
383                "utils/arm/managed_register_arm_test.cc",
384            ],
385        },
386        arm64: {
387            srcs: [
388                "linker/arm64/relative_patcher_arm64_test.cc",
389                "utils/arm64/managed_register_arm64_test.cc",
390            ],
391        },
392        mips: {
393            srcs: [
394                "linker/mips/relative_patcher_mips_test.cc",
395                "linker/mips/relative_patcher_mips32r6_test.cc",
396            ],
397        },
398        mips64: {
399            srcs: [
400                "linker/mips64/relative_patcher_mips64_test.cc",
401                "utils/mips64/managed_register_mips64_test.cc",
402            ],
403        },
404        x86: {
405            srcs: [
406                "linker/x86/relative_patcher_x86_test.cc",
407                "utils/x86/managed_register_x86_test.cc",
408
409                // These tests are testing architecture-independent
410                // functionality, but happen to use x86 codegen as part of the
411                // test.
412                "optimizing/constant_folding_test.cc",
413                "optimizing/dead_code_elimination_test.cc",
414                "optimizing/linearize_test.cc",
415                "optimizing/live_ranges_test.cc",
416                "optimizing/liveness_test.cc",
417                "optimizing/register_allocator_test.cc",
418            ],
419        },
420        x86_64: {
421            srcs: [
422                "linker/x86_64/relative_patcher_x86_64_test.cc",
423            ],
424        },
425    },
426
427    shared_libs: [
428        "libartd-compiler",
429        "libartd-simulator",
430        "libvixld-arm",
431        "libvixld-arm64",
432
433        "libbacktrace",
434        "libnativeloader",
435    ],
436}
437
438art_cc_test {
439    name: "art_compiler_host_tests",
440    device_supported: false,
441    defaults: [
442        "art_gtest_defaults",
443    ],
444    codegen: {
445        arm: {
446            srcs: [
447                "utils/arm/assembler_thumb2_test.cc",
448                "utils/assembler_thumb_test.cc",
449            ],
450        },
451        mips: {
452            srcs: [
453                "optimizing/emit_swap_mips_test.cc",
454                "utils/mips/assembler_mips_test.cc",
455                "utils/mips/assembler_mips32r6_test.cc",
456            ],
457        },
458        mips64: {
459            srcs: [
460                "utils/mips64/assembler_mips64_test.cc",
461            ],
462        },
463        x86: {
464            srcs: [
465                "utils/x86/assembler_x86_test.cc",
466            ],
467        },
468        x86_64: {
469            srcs: [
470                "utils/x86_64/assembler_x86_64_test.cc",
471            ],
472        },
473    },
474    shared_libs: [
475        "libartd-compiler",
476        "libvixld-arm",
477        "libvixld-arm64",
478    ],
479}
480