|
1 | 1 | # ClangIR (CIR)
|
2 | 2 |
|
3 |
| -For more information see https://clangir.org. The rest of this document |
4 |
| -fallbacks to llvm-project's default `README.md`. |
5 |
| - |
6 |
| ---- |
7 |
| - |
8 |
| -# The LLVM Compiler Infrastructure |
9 |
| - |
10 |
| -This directory and its sub-directories contain the source code for LLVM, |
11 |
| -a toolkit for the construction of highly optimized compilers, |
12 |
| -optimizers, and run-time environments. |
13 |
| - |
14 |
| -The README briefly describes how to get started with building LLVM. |
15 |
| -For more information on how to contribute to the LLVM project, please |
16 |
| -take a look at the |
17 |
| -[Contributing to LLVM](https://llvm.org/docs/Contributing.html) guide. |
18 |
| - |
19 |
| -## Getting Started with the LLVM System |
20 |
| - |
21 |
| -Taken from [here](https://llvm.org/docs/GettingStarted.html). |
22 |
| - |
23 |
| -### Overview |
24 |
| - |
25 |
| -Welcome to the LLVM project! |
26 |
| - |
27 |
| -The LLVM project has multiple components. The core of the project is |
28 |
| -itself called "LLVM". This contains all of the tools, libraries, and header |
29 |
| -files needed to process intermediate representations and convert them into |
30 |
| -object files. Tools include an assembler, disassembler, bitcode analyzer, and |
31 |
| -bitcode optimizer. It also contains basic regression tests. |
32 |
| - |
33 |
| -C-like languages use the [Clang](http://clang.llvm.org/) frontend. This |
34 |
| -component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode |
35 |
| --- and from there into object files, using LLVM. |
36 |
| - |
37 |
| -Other components include: |
38 |
| -the [libc++ C++ standard library](https://libcxx.llvm.org), |
39 |
| -the [LLD linker](https://lld.llvm.org), and more. |
40 |
| - |
41 |
| -### Getting the Source Code and Building LLVM |
42 |
| - |
43 |
| -The LLVM Getting Started documentation may be out of date. The [Clang |
44 |
| -Getting Started](http://clang.llvm.org/get_started.html) page might have more |
45 |
| -accurate information. |
46 |
| - |
47 |
| -This is an example work-flow and configuration to get and build the LLVM source: |
48 |
| - |
49 |
| -1. Checkout LLVM (including related sub-projects like Clang): |
50 |
| - |
51 |
| - * ``git clone https://github.com/llvm/llvm-project.git`` |
52 |
| - |
53 |
| - * Or, on windows, ``git clone --config core.autocrlf=false |
54 |
| - https://github.com/llvm/llvm-project.git`` |
55 |
| - |
56 |
| -2. Configure and build LLVM and Clang: |
57 |
| - |
58 |
| - * ``cd llvm-project`` |
59 |
| - |
60 |
| - * ``cmake -S llvm -B build -G <generator> [options]`` |
61 |
| - |
62 |
| - Some common build system generators are: |
63 |
| - |
64 |
| - * ``Ninja`` --- for generating [Ninja](https://ninja-build.org) |
65 |
| - build files. Most llvm developers use Ninja. |
66 |
| - * ``Unix Makefiles`` --- for generating make-compatible parallel makefiles. |
67 |
| - * ``Visual Studio`` --- for generating Visual Studio projects and |
68 |
| - solutions. |
69 |
| - * ``Xcode`` --- for generating Xcode projects. |
70 |
| - |
71 |
| - Some common options: |
72 |
| - |
73 |
| - * ``-DLLVM_ENABLE_PROJECTS='...'`` and ``-DLLVM_ENABLE_RUNTIMES='...'`` --- |
74 |
| - semicolon-separated list of the LLVM sub-projects and runtimes you'd like to |
75 |
| - additionally build. ``LLVM_ENABLE_PROJECTS`` can include any of: clang, |
76 |
| - clang-tools-extra, cross-project-tests, flang, libc, libclc, lld, lldb, |
77 |
| - mlir, openmp, polly, or pstl. ``LLVM_ENABLE_RUNTIMES`` can include any of |
78 |
| - libcxx, libcxxabi, libunwind, compiler-rt, libc or openmp. Some runtime |
79 |
| - projects can be specified either in ``LLVM_ENABLE_PROJECTS`` or in |
80 |
| - ``LLVM_ENABLE_RUNTIMES``. |
81 |
| - |
82 |
| - For example, to build LLVM, Clang, libcxx, and libcxxabi, use |
83 |
| - ``-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"``. |
84 |
| - |
85 |
| - * ``-DCMAKE_INSTALL_PREFIX=directory`` --- Specify for *directory* the full |
86 |
| - path name of where you want the LLVM tools and libraries to be installed |
87 |
| - (default ``/usr/local``). Be careful if you install runtime libraries: if |
88 |
| - your system uses those provided by LLVM (like libc++ or libc++abi), you |
89 |
| - must not overwrite your system's copy of those libraries, since that |
90 |
| - could render your system unusable. In general, using something like |
91 |
| - ``/usr`` is not advised, but ``/usr/local`` is fine. |
92 |
| - |
93 |
| - * ``-DCMAKE_BUILD_TYPE=type`` --- Valid options for *type* are Debug, |
94 |
| - Release, RelWithDebInfo, and MinSizeRel. Default is Debug. |
95 |
| - |
96 |
| - * ``-DLLVM_ENABLE_ASSERTIONS=On`` --- Compile with assertion checks enabled |
97 |
| - (default is Yes for Debug builds, No for all other build types). |
98 |
| - |
99 |
| - * ``cmake --build build [-- [options] <target>]`` or your build system specified above |
100 |
| - directly. |
101 |
| - |
102 |
| - * The default target (i.e. ``ninja`` or ``make``) will build all of LLVM. |
103 |
| - |
104 |
| - * The ``check-all`` target (i.e. ``ninja check-all``) will run the |
105 |
| - regression tests to ensure everything is in working order. |
106 |
| - |
107 |
| - * CMake will generate targets for each tool and library, and most |
108 |
| - LLVM sub-projects generate their own ``check-<project>`` target. |
109 |
| - |
110 |
| - * Running a serial build will be **slow**. To improve speed, try running a |
111 |
| - parallel build. That's done by default in Ninja; for ``make``, use the option |
112 |
| - ``-j NNN``, where ``NNN`` is the number of parallel jobs to run. |
113 |
| - In most cases, you get the best performance if you specify the number of CPU threads you have. |
114 |
| - On some Unix systems, you can specify this with ``-j$(nproc)``. |
115 |
| - |
116 |
| - * For more information see [CMake](https://llvm.org/docs/CMake.html). |
117 |
| - |
118 |
| -Consult the |
119 |
| -[Getting Started with LLVM](https://llvm.org/docs/GettingStarted.html#getting-started-with-llvm) |
120 |
| -page for detailed information on configuring and compiling LLVM. You can visit |
121 |
| -[Directory Layout](https://llvm.org/docs/GettingStarted.html#directory-layout) |
122 |
| -to learn about the layout of the source code tree. |
123 |
| - |
124 |
| -## Getting in touch |
125 |
| - |
126 |
| -Join [LLVM Discourse forums](https://discourse.llvm.org/), [discord chat](https://discord.gg/xS7Z362) or #llvm IRC channel on [OFTC](https://oftc.net/). |
127 |
| - |
128 |
| -The LLVM project has adopted a [code of conduct](https://llvm.org/docs/CodeOfConduct.html) for |
129 |
| -participants to all modes of communication within the project. |
130 |
| - |
131 |
| -### License |
132 |
| - |
133 |
| -ClangIR is based off https://github.com/llvm/llvm-project and uses the same |
134 |
| -license. This ClangIR project is under the Apache License v2.0 with LLVM |
135 |
| -Exceptions. Please see the `LICENSE.TXT` for the full details. |
136 |
| - |
137 |
| -## Contributing |
138 |
| - |
139 |
| -Check our [contributing guide](CONTRIBUTING.md) to learn about how to |
140 |
| -contribute to the project. |
141 |
| - |
142 |
| -## Code Of Confuct |
143 |
| - |
144 |
| -Check our [Code Of Conduct](CODE_OF_CONDUCT.md) to learn more about our |
145 |
| -contributor standards and expectations. |
146 |
| - |
| 3 | +Check https://clangir.org for general information, build instructions and documentation. |
0 commit comments