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    srcs: [
27        "compiled_method.cc",
28        "debug/elf_debug_writer.cc",
29        "dex/inline_method_analyser.cc",
30        "dex/verified_method.cc",
31        "dex/verification_results.cc",
32        "driver/compiled_method_storage.cc",
33        "driver/compiler_options.cc",
34        "driver/dex_compilation_unit.cc",
35        "jit/jit_compiler.cc",
36        "jit/jit_logger.cc",
37        "jni/quick/calling_convention.cc",
38        "jni/quick/jni_compiler.cc",
39        "optimizing/block_builder.cc",
40        "optimizing/bounds_check_elimination.cc",
41        "optimizing/builder.cc",
42        "optimizing/cha_guard_optimization.cc",
43        "optimizing/code_generator.cc",
44        "optimizing/code_generator_utils.cc",
45        "optimizing/code_sinking.cc",
46        "optimizing/constant_folding.cc",
47        "optimizing/constructor_fence_redundancy_elimination.cc",
48        "optimizing/data_type.cc",
49        "optimizing/dead_code_elimination.cc",
50        "optimizing/escape.cc",
51        "optimizing/graph_checker.cc",
52        "optimizing/graph_visualizer.cc",
53        "optimizing/gvn.cc",
54        "optimizing/induction_var_analysis.cc",
55        "optimizing/induction_var_range.cc",
56        "optimizing/inliner.cc",
57        "optimizing/instruction_builder.cc",
58        "optimizing/instruction_simplifier.cc",
59        "optimizing/intrinsic_objects.cc",
60        "optimizing/intrinsics.cc",
61        "optimizing/licm.cc",
62        "optimizing/linear_order.cc",
63        "optimizing/load_store_analysis.cc",
64        "optimizing/load_store_elimination.cc",
65        "optimizing/locations.cc",
66        "optimizing/loop_analysis.cc",
67        "optimizing/loop_optimization.cc",
68        "optimizing/nodes.cc",
69        "optimizing/optimization.cc",
70        "optimizing/optimizing_compiler.cc",
71        "optimizing/parallel_move_resolver.cc",
72        "optimizing/prepare_for_register_allocation.cc",
73        "optimizing/reference_type_propagation.cc",
74        "optimizing/register_allocation_resolver.cc",
75        "optimizing/register_allocator.cc",
76        "optimizing/register_allocator_graph_color.cc",
77        "optimizing/register_allocator_linear_scan.cc",
78        "optimizing/select_generator.cc",
79        "optimizing/scheduler.cc",
80        "optimizing/sharpening.cc",
81        "optimizing/side_effects_analysis.cc",
82        "optimizing/ssa_builder.cc",
83        "optimizing/ssa_liveness_analysis.cc",
84        "optimizing/ssa_phi_elimination.cc",
85        "optimizing/stack_map_stream.cc",
86        "optimizing/superblock_cloner.cc",
87        "trampolines/trampoline_compiler.cc",
88        "utils/assembler.cc",
89        "utils/jni_macro_assembler.cc",
90        "utils/swap_space.cc",
91        "compiler.cc",
92    ],
93
94    codegen: {
95        arm: {
96            srcs: [
97                "jni/quick/arm/calling_convention_arm.cc",
98                "optimizing/code_generator_arm_vixl.cc",
99                "optimizing/code_generator_vector_arm_vixl.cc",
100                "optimizing/instruction_simplifier_arm.cc",
101                "optimizing/instruction_simplifier_shared.cc",
102                "optimizing/intrinsics_arm_vixl.cc",
103                "optimizing/nodes_shared.cc",
104                "optimizing/scheduler_arm.cc",
105                "utils/arm/assembler_arm_vixl.cc",
106                "utils/arm/constants_arm.cc",
107                "utils/arm/jni_macro_assembler_arm_vixl.cc",
108                "utils/arm/managed_register_arm.cc",
109            ],
110        },
111        arm64: {
112            srcs: [
113                "jni/quick/arm64/calling_convention_arm64.cc",
114                "optimizing/code_generator_arm64.cc",
115                "optimizing/code_generator_vector_arm64.cc",
116                "optimizing/scheduler_arm64.cc",
117                "optimizing/instruction_simplifier_arm64.cc",
118                "optimizing/intrinsics_arm64.cc",
119                "utils/arm64/assembler_arm64.cc",
120                "utils/arm64/jni_macro_assembler_arm64.cc",
121                "utils/arm64/managed_register_arm64.cc",
122            ],
123        },
124        x86: {
125            srcs: [
126                "jni/quick/x86/calling_convention_x86.cc",
127                "optimizing/code_generator_x86.cc",
128                "optimizing/code_generator_vector_x86.cc",
129                "optimizing/intrinsics_x86.cc",
130                "optimizing/instruction_simplifier_x86_shared.cc",
131                "optimizing/instruction_simplifier_x86.cc",
132                "optimizing/pc_relative_fixups_x86.cc",
133                "optimizing/x86_memory_gen.cc",
134                "utils/x86/assembler_x86.cc",
135                "utils/x86/jni_macro_assembler_x86.cc",
136                "utils/x86/managed_register_x86.cc",
137            ],
138        },
139        x86_64: {
140            srcs: [
141                "jni/quick/x86_64/calling_convention_x86_64.cc",
142                "optimizing/intrinsics_x86_64.cc",
143                "optimizing/instruction_simplifier_x86_64.cc",
144                "optimizing/code_generator_x86_64.cc",
145                "optimizing/code_generator_vector_x86_64.cc",
146                "utils/x86_64/assembler_x86_64.cc",
147                "utils/x86_64/jni_macro_assembler_x86_64.cc",
148                "utils/x86_64/managed_register_x86_64.cc",
149            ],
150        },
151    },
152    generated_sources: ["art_compiler_operator_srcs"],
153    shared_libs: [
154        "libbase",
155    ],
156    header_libs: [
157        "art_cmdlineparser_headers", // For compiler_options.
158        "art_disassembler_headers",
159        "libnativehelper_header_only",
160    ],
161
162    export_include_dirs: ["."],
163}
164
165cc_defaults {
166    name: "libart-compiler_static_base_defaults",
167    static_libs: [
168        "libbase",
169    ],
170}
171
172gensrcs {
173    name: "art_compiler_operator_srcs",
174    cmd: "$(location generate_operator_out) art/compiler $(in) > $(out)",
175    tools: ["generate_operator_out"],
176    srcs: [
177        "driver/compiler_options.h",
178        "linker/linker_patch.h",
179        "optimizing/locations.h",
180        "optimizing/optimizing_compiler_stats.h",
181
182        "utils/arm/constants_arm.h",
183    ],
184    output_extension: "operator_out.cc",
185}
186
187art_cc_library {
188    name: "libart-compiler",
189    defaults: [
190        "libart-compiler-defaults",
191        "dex2oat-pgo-defaults",
192    ],
193    codegen: {
194        arm: {
195            // VIXL assembly support for ARM targets.
196            static: {
197                whole_static_libs: [
198                    "libvixl",
199                ],
200            },
201            shared: {
202                shared_libs: [
203                    "libvixl",
204                ],
205                // Export vixl headers as they are included in this library's exported headers.
206                export_shared_lib_headers: [
207                    "libvixl",
208                ],
209            },
210        },
211        arm64: {
212            // VIXL assembly support for ARM64 targets.
213            static: {
214                whole_static_libs: [
215                    "libvixl",
216                ],
217            },
218            shared: {
219                shared_libs: [
220                    "libvixl",
221                ],
222                // Export vixl headers as they are included in this library's exported headers.
223                export_shared_lib_headers: [
224                    "libvixl",
225                ],
226            },
227        },
228    },
229    shared_libs: [
230        "libart",
231        "libartbase",
232        "libartpalette",
233        "libprofile",
234        "libdexfile",
235    ],
236    whole_static_libs: ["libelffile"],
237    runtime_libs: [
238        // `art::HGraphVisualizerDisassembler::HGraphVisualizerDisassembler` may dynamically load
239        // `libart-disassembler.so`.
240        "libart-disassembler",
241    ],
242
243    target: {
244        android: {
245            lto: {
246                thin: true,
247            },
248        },
249    },
250    apex_available: [
251        "com.android.art.release",
252        "com.android.art.debug",
253    ],
254}
255
256cc_defaults {
257    name: "libart-compiler_static_defaults",
258    defaults: [
259        "libart-compiler_static_base_defaults",
260        "libart_static_defaults",
261        "libartbase_static_defaults",
262        "libdexfile_static_defaults",
263        "libprofile_static_defaults",
264    ],
265    static_libs: ["libart-compiler"],
266}
267
268art_cc_library {
269    name: "libartd-compiler",
270    defaults: [
271        "art_debug_defaults",
272        "libart-compiler-defaults",
273    ],
274    codegen: {
275        arm: {
276            // VIXL assembly support for ARM targets.
277            static: {
278                whole_static_libs: [
279                    "libvixld",
280                ],
281            },
282            shared: {
283                shared_libs: [
284                    "libvixld",
285                ],
286                // Export vixl headers as they are included in this library's exported headers.
287                export_shared_lib_headers: [
288                    "libvixld",
289                ],
290            },
291        },
292        arm64: {
293            // VIXL assembly support for ARM64 targets.
294            static: {
295                whole_static_libs: [
296                    "libvixld",
297                ],
298            },
299            shared: {
300                shared_libs: [
301                    "libvixld",
302                ],
303                // Export vixl headers as they are included in this library's exported headers.
304                export_shared_lib_headers: [
305                    "libvixld",
306                ],
307            },
308        },
309    },
310    shared_libs: [
311        "libartbased",
312        "libartd",
313        "libartpalette",
314        "libprofiled",
315        "libdexfiled",
316    ],
317    whole_static_libs: ["libelffiled"],
318    runtime_libs: [
319        // `art::HGraphVisualizerDisassembler::HGraphVisualizerDisassembler` may dynamically load
320        // `libartd-disassembler.so`.
321        "libartd-disassembler",
322    ],
323
324    apex_available: [
325        "com.android.art.debug",
326    ],
327}
328
329cc_defaults {
330    name: "libartd-compiler_static_defaults",
331    defaults: [
332        "libart-compiler_static_base_defaults",
333        "libartd_static_defaults",
334        "libartbased_static_defaults",
335        "libdexfiled_static_defaults",
336        "libprofiled_static_defaults",
337    ],
338    static_libs: ["libartd-compiler"],
339}
340
341art_cc_library {
342    name: "libart-compiler-gtest",
343    defaults: ["libart-gtest-defaults"],
344    srcs: [
345        "common_compiler_test.cc",
346    ],
347    shared_libs: [
348        "libartd-compiler",
349        "libartd-disassembler",
350        "libartbase-art-gtest",
351        "libart-runtime-gtest",
352        "libbase",
353    ],
354}
355
356art_cc_test {
357    name: "art_compiler_tests",
358    defaults: [
359        "art_gtest_defaults",
360    ],
361    srcs: [
362        "debug/dwarf/dwarf_test.cc",
363        "debug/src_map_elem_test.cc",
364        "driver/compiled_method_storage_test.cc",
365        "exception_test.cc",
366        "jni/jni_compiler_test.cc",
367        "linker/linker_patch_test.cc",
368        "linker/output_stream_test.cc",
369        "optimizing/bounds_check_elimination_test.cc",
370        "optimizing/superblock_cloner_test.cc",
371        "optimizing/data_type_test.cc",
372        "optimizing/dominator_test.cc",
373        "optimizing/find_loops_test.cc",
374        "optimizing/graph_checker_test.cc",
375        "optimizing/graph_test.cc",
376        "optimizing/gvn_test.cc",
377        "optimizing/induction_var_analysis_test.cc",
378        "optimizing/induction_var_range_test.cc",
379        "optimizing/licm_test.cc",
380        "optimizing/live_interval_test.cc",
381        "optimizing/loop_optimization_test.cc",
382        "optimizing/nodes_test.cc",
383        "optimizing/nodes_vector_test.cc",
384        "optimizing/parallel_move_test.cc",
385        "optimizing/pretty_printer_test.cc",
386        "optimizing/reference_type_propagation_test.cc",
387        "optimizing/select_generator_test.cc",
388        "optimizing/side_effects_test.cc",
389        "optimizing/ssa_liveness_analysis_test.cc",
390        "optimizing/ssa_test.cc",
391        "optimizing/stack_map_test.cc",
392        "optimizing/suspend_check_test.cc",
393        "utils/atomic_dex_ref_map_test.cc",
394        "utils/dedupe_set_test.cc",
395        "utils/swap_space_test.cc",
396
397        "jni/jni_cfi_test.cc",
398        "optimizing/codegen_test.cc",
399        "optimizing/load_store_analysis_test.cc",
400        "optimizing/load_store_elimination_test.cc",
401        "optimizing/optimizing_cfi_test.cc",
402        "optimizing/scheduler_test.cc",
403    ],
404
405    codegen: {
406        arm: {
407            srcs: [
408                "utils/arm/managed_register_arm_test.cc",
409            ],
410        },
411        arm64: {
412            srcs: [
413                "utils/arm64/managed_register_arm64_test.cc",
414            ],
415        },
416        x86: {
417            srcs: [
418                "utils/x86/managed_register_x86_test.cc",
419
420                // These tests are testing architecture-independent
421                // functionality, but happen to use x86 codegen as part of the
422                // test.
423                "optimizing/constant_folding_test.cc",
424                "optimizing/dead_code_elimination_test.cc",
425                "optimizing/linearize_test.cc",
426                "optimizing/live_ranges_test.cc",
427                "optimizing/liveness_test.cc",
428                "optimizing/register_allocator_test.cc",
429            ],
430        },
431        x86_64: {
432            srcs: [
433                // Is this test a bit-rotten copy of the x86 test? b/77951326
434                // "utils/x86_64/managed_register_x86_64_test.cc",
435            ],
436        },
437    },
438
439    header_libs: [
440        "libart_simulator_headers",
441        "libnativehelper_header_only",
442    ],
443
444    shared_libs: [
445        "libprofiled",
446        "libartd-compiler",
447        "libartd-simulator-container",
448        "libvixld",
449
450        "libbacktrace",
451        "libnativeloader",
452    ],
453
454    target: {
455        host: {
456            shared_libs: [
457                "libartd-simulator",
458            ],
459        },
460    },
461}
462
463art_cc_test {
464    name: "art_compiler_host_tests",
465    device_supported: false,
466    defaults: [
467        "art_gtest_defaults",
468    ],
469    codegen: {
470        arm: {
471            srcs: [
472                "utils/assembler_thumb_test.cc",
473            ],
474        },
475        x86: {
476            srcs: [
477                "utils/x86/assembler_x86_test.cc",
478            ],
479        },
480        x86_64: {
481            srcs: [
482                "utils/x86_64/assembler_x86_64_test.cc",
483            ],
484        },
485    },
486    shared_libs: [
487        "libartd-compiler",
488        "libvixld",
489    ],
490}
491