[llvm-objcopy] [COFF] Use Error/Expected returns instead of calling reportError....
[llvm-core.git] / docs / DeveloperPolicy.rst
blob9125197a73a86a16a20036d5882ae915971a3690
1 =====================
2 LLVM Developer Policy
3 =====================
5 .. contents::
6    :local:
8 Introduction
9 ============
11 This document contains the LLVM Developer Policy which defines the project's
12 policy towards developers and their contributions. The intent of this policy is
13 to eliminate miscommunication, rework, and confusion that might arise from the
14 distributed nature of LLVM's development.  By stating the policy in clear terms,
15 we hope each developer can know ahead of time what to expect when making LLVM
16 contributions.  This policy covers all llvm.org subprojects, including Clang,
17 LLDB, libc++, etc.
19 This policy is also designed to accomplish the following objectives:
21 #. Attract both users and developers to the LLVM project.
23 #. Make life as simple and easy for contributors as possible.
25 #. Keep the top of Subversion trees as stable as possible.
27 #. Establish awareness of the project's :ref:`copyright, license, and patent
28    policies <copyright-license-patents>` with contributors to the project.
30 This policy is aimed at frequent contributors to LLVM. People interested in
31 contributing one-off patches can do so in an informal way by sending them to the
32 `llvm-commits mailing list
33 <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_ and engaging another
34 developer to see it through the process.
36 Developer Policies
37 ==================
39 This section contains policies that pertain to frequent LLVM developers.  We
40 always welcome `one-off patches`_ from people who do not routinely contribute to
41 LLVM, but we expect more from frequent contributors to keep the system as
42 efficient as possible for everyone.  Frequent LLVM contributors are expected to
43 meet the following requirements in order for LLVM to maintain a high standard of
44 quality.
46 Stay Informed
47 -------------
49 Developers should stay informed by reading at least the "dev" mailing list for
50 the projects you are interested in, such as `llvm-dev
51 <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ for LLVM, `cfe-dev
52 <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_ for Clang, or `lldb-dev
53 <http://lists.llvm.org/mailman/listinfo/lldb-dev>`_ for LLDB.  If you are
54 doing anything more than just casual work on LLVM, it is suggested that you also
55 subscribe to the "commits" mailing list for the subproject you're interested in,
56 such as `llvm-commits
57 <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_, `cfe-commits
58 <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_, or `lldb-commits
59 <http://lists.llvm.org/mailman/listinfo/lldb-commits>`_.  Reading the
60 "commits" list and paying attention to changes being made by others is a good
61 way to see what other people are interested in and watching the flow of the
62 project as a whole.
64 We recommend that active developers register an email account with `LLVM
65 Bugzilla <https://bugs.llvm.org/>`_ and preferably subscribe to the `llvm-bugs
66 <http://lists.llvm.org/mailman/listinfo/llvm-bugs>`_ email list to keep track
67 of bugs and enhancements occurring in LLVM.  We really appreciate people who are
68 proactive at catching incoming bugs in their components and dealing with them
69 promptly.
71 Please be aware that all public LLVM mailing lists are public and archived, and
72 that notices of confidentiality or non-disclosure cannot be respected.
74 .. _patch:
75 .. _one-off patches:
77 Making and Submitting a Patch
78 -----------------------------
80 When making a patch for review, the goal is to make it as easy for the reviewer
81 to read it as possible.  As such, we recommend that you:
83 #. Make your patch against the Subversion trunk, not a branch, and not an old
84    version of LLVM.  This makes it easy to apply the patch.  For information on
85    how to check out SVN trunk, please see the `Getting Started
86    Guide <GettingStarted.html#checkout>`_.
88 #. Similarly, patches should be submitted soon after they are generated.  Old
89    patches may not apply correctly if the underlying code changes between the
90    time the patch was created and the time it is applied.
92 #. Patches should be made with ``svn diff``, or similar. If you use a
93    different tool, make sure it uses the ``diff -u`` format and that it
94    doesn't contain clutter which makes it hard to read.
96 #. If you are modifying generated files, such as the top-level ``configure``
97    script, please separate out those changes into a separate patch from the rest
98    of your changes.
100 Once your patch is ready, submit it by emailing it to the appropriate project's
101 commit mailing list (or commit it directly if applicable). Alternatively, some
102 patches get sent to the project's development list or component of the LLVM bug
103 tracker, but the commit list is the primary place for reviews and should
104 generally be preferred.
106 When sending a patch to a mailing list, it is a good idea to send it as an
107 *attachment* to the message, not embedded into the text of the message.  This
108 ensures that your mailer will not mangle the patch when it sends it (e.g. by
109 making whitespace changes or by wrapping lines).
111 *For Thunderbird users:* Before submitting a patch, please open *Preferences >
112 Advanced > General > Config Editor*, find the key
113 ``mail.content_disposition_type``, and set its value to ``1``. Without this
114 setting, Thunderbird sends your attachment using ``Content-Disposition: inline``
115 rather than ``Content-Disposition: attachment``. Apple Mail gamely displays such
116 a file inline, making it difficult to work with for reviewers using that
117 program.
119 When submitting patches, please do not add confidentiality or non-disclosure
120 notices to the patches themselves.  These notices conflict with the `LLVM
121 License`_ and may result in your contribution being excluded.
123 .. _code review:
125 Code Reviews
126 ------------
128 LLVM has a code review policy. Code review is one way to increase the quality of
129 software. We generally follow these policies:
131 #. All developers are required to have significant changes reviewed before they
132    are committed to the repository.
134 #. Code reviews are conducted by email on the relevant project's commit mailing
135    list, or alternatively on the project's development list or bug tracker.
137 #. Code can be reviewed either before it is committed or after.  We expect major
138    changes to be reviewed before being committed, but smaller changes (or
139    changes where the developer owns the component) can be reviewed after commit.
141 #. The developer responsible for a code change is also responsible for making
142    all necessary review-related changes.
144 #. Code review can be an iterative process, which continues until the patch is
145    ready to be committed. Specifically, once a patch is sent out for review, it
146    needs an explicit "looks good" before it is submitted. Do not assume silent
147    approval, or request active objections to the patch with a deadline.
149 Sometimes code reviews will take longer than you would hope for, especially for
150 larger features. Accepted ways to speed up review times for your patches are:
152 * Review other people's patches. If you help out, everybody will be more
153   willing to do the same for you; goodwill is our currency.
154 * Ping the patch. If it is urgent, provide reasons why it is important to you to
155   get this patch landed and ping it every couple of days. If it is
156   not urgent, the common courtesy ping rate is one week. Remember that you're
157   asking for valuable time from other professional developers.
158 * Ask for help on IRC. Developers on IRC will be able to either help you
159   directly, or tell you who might be a good reviewer.
160 * Split your patch into multiple smaller patches that build on each other. The
161   smaller your patch, the higher the probability that somebody will take a quick
162   look at it.
164 Developers should participate in code reviews as both reviewers and
165 reviewees. If someone is kind enough to review your code, you should return the
166 favor for someone else.  Note that anyone is welcome to review and give feedback
167 on a patch, but only people with Subversion write access can approve it.
169 There is a web based code review tool that can optionally be used
170 for code reviews. See :doc:`Phabricator`.
172 .. _code owners:
174 Code Owners
175 -----------
177 The LLVM Project relies on two features of its process to maintain rapid
178 development in addition to the high quality of its source base: the combination
179 of code review plus post-commit review for trusted maintainers.  Having both is
180 a great way for the project to take advantage of the fact that most people do
181 the right thing most of the time, and only commit patches without pre-commit
182 review when they are confident they are right.
184 The trick to this is that the project has to guarantee that all patches that are
185 committed are reviewed after they go in: you don't want everyone to assume
186 someone else will review it, allowing the patch to go unreviewed.  To solve this
187 problem, we have a notion of an 'owner' for a piece of the code.  The sole
188 responsibility of a code owner is to ensure that a commit to their area of the
189 code is appropriately reviewed, either by themself or by someone else.  The list
190 of current code owners can be found in the file
191 `CODE_OWNERS.TXT <http://git.llvm.org/klaus/llvm/blob/master/CODE_OWNERS.TXT>`_
192 in the root of the LLVM source tree.
194 Note that code ownership is completely different than reviewers: anyone can
195 review a piece of code, and we welcome code review from anyone who is
196 interested.  Code owners are the "last line of defense" to guarantee that all
197 patches that are committed are actually reviewed.
199 Being a code owner is a somewhat unglamorous position, but it is incredibly
200 important for the ongoing success of the project.  Because people get busy,
201 interests change, and unexpected things happen, code ownership is purely opt-in,
202 and anyone can choose to resign their "title" at any time. For now, we do not
203 have an official policy on how one gets elected to be a code owner.
205 .. _include a testcase:
207 Test Cases
208 ----------
210 Developers are required to create test cases for any bugs fixed and any new
211 features added.  Some tips for getting your testcase approved:
213 * All feature and regression test cases are added to the ``llvm/test``
214   directory. The appropriate sub-directory should be selected (see the
215   :doc:`Testing Guide <TestingGuide>` for details).
217 * Test cases should be written in :doc:`LLVM assembly language <LangRef>`.
219 * Test cases, especially for regressions, should be reduced as much as possible,
220   by :doc:`bugpoint <Bugpoint>` or manually. It is unacceptable to place an
221   entire failing program into ``llvm/test`` as this creates a *time-to-test*
222   burden on all developers. Please keep them short.
224 Note that llvm/test and clang/test are designed for regression and small feature
225 tests only. More extensive test cases (e.g., entire applications, benchmarks,
226 etc) should be added to the ``llvm-test`` test suite.  The llvm-test suite is
227 for coverage (correctness, performance, etc) testing, not feature or regression
228 testing.
230 Quality
231 -------
233 The minimum quality standards that any change must satisfy before being
234 committed to the main development branch are:
236 #. Code must adhere to the `LLVM Coding Standards <CodingStandards.html>`_.
238 #. Code must compile cleanly (no errors, no warnings) on at least one platform.
240 #. Bug fixes and new features should `include a testcase`_ so we know if the
241    fix/feature ever regresses in the future.
243 #. Code must pass the ``llvm/test`` test suite.
245 #. The code must not cause regressions on a reasonable subset of llvm-test,
246    where "reasonable" depends on the contributor's judgement and the scope of
247    the change (more invasive changes require more testing). A reasonable subset
248    might be something like "``llvm-test/MultiSource/Benchmarks``".
250 Additionally, the committer is responsible for addressing any problems found in
251 the future that the change is responsible for.  For example:
253 * The code should compile cleanly on all supported platforms.
255 * The changes should not cause any correctness regressions in the ``llvm-test``
256   suite and must not cause any major performance regressions.
258 * The change set should not cause performance or correctness regressions for the
259   LLVM tools.
261 * The changes should not cause performance or correctness regressions in code
262   compiled by LLVM on all applicable targets.
264 * You are expected to address any `Bugzilla bugs <https://bugs.llvm.org/>`_ that
265   result from your change.
267 We prefer for this to be handled before submission but understand that it isn't
268 possible to test all of this for every submission.  Our build bots and nightly
269 testing infrastructure normally finds these problems.  A good rule of thumb is
270 to check the nightly testers for regressions the day after your change.  Build
271 bots will directly email you if a group of commits that included yours caused a
272 failure.  You are expected to check the build bot messages to see if they are
273 your fault and, if so, fix the breakage.
275 Commits that violate these quality standards (e.g. are very broken) may be
276 reverted. This is necessary when the change blocks other developers from making
277 progress. The developer is welcome to re-commit the change after the problem has
278 been fixed.
280 .. _commit messages:
282 Commit messages
283 ---------------
285 Although we don't enforce the format of commit messages, we prefer that
286 you follow these guidelines to help review, search in logs, email formatting
287 and so on. These guidelines are very similar to rules used by other open source
288 projects.
290 Most importantly, the contents of the message should be carefully written to
291 convey the rationale of the change (without delving too much in detail). It
292 also should avoid being vague or overly specific. For example, "bits were not
293 set right" will leave the reviewer wondering about which bits, and why they
294 weren't right, while "Correctly set overflow bits in TargetInfo" conveys almost
295 all there is to the change.
297 Below are some guidelines about the format of the message itself:
299 * Separate the commit message into title, body and, if you're not the original
300   author, a "Patch by" attribution line (see below).
302 * The title should be concise. Because all commits are emailed to the list with
303   the first line as the subject, long titles are frowned upon.  Short titles
304   also look better in `git log`.
306 * When the changes are restricted to a specific part of the code (e.g. a
307   back-end or optimization pass), it is customary to add a tag to the
308   beginning of the line in square brackets.  For example, "[SCEV] ..."
309   or "[OpenMP] ...". This helps email filters and searches for post-commit
310   reviews.
312 * The body, if it exists, should be separated from the title by an empty line.
314 * The body should be concise, but explanatory, including a complete
315   reasoning.  Unless it is required to understand the change, examples,
316   code snippets and gory details should be left to bug comments, web
317   review or the mailing list.
319 * If the patch fixes a bug in bugzilla, please include the PR# in the message.
321 * `Attribution of Changes`_ should be in a separate line, after the end of
322   the body, as simple as "Patch by John Doe.". This is how we officially
323   handle attribution, and there are automated processes that rely on this
324   format.
326 * Text formatting and spelling should follow the same rules as documentation
327   and in-code comments, ex. capitalization, full stop, etc.
329 * If the commit is a bug fix on top of another recently committed patch, or a
330   revert or reapply of a patch, include the svn revision number of the prior
331   related commit. This could be as simple as "Revert rNNNN because it caused
332   PR#".
334 For minor violations of these recommendations, the community normally favors
335 reminding the contributor of this policy over reverting. Minor corrections and
336 omissions can be handled by sending a reply to the commits mailing list.
338 Obtaining Commit Access
339 -----------------------
341 We grant commit access to contributors with a track record of submitting high
342 quality patches.  If you would like commit access, please send an email to
343 `Chris <mailto:clattner@llvm.org>`_ with the following information:
345 #. The user name you want to commit with, e.g. "hacker".
347 #. The full name and email address you want message to llvm-commits to come
348    from, e.g. "J. Random Hacker <hacker@yoyodyne.com>".
350 #. A "password hash" of the password you want to use, e.g. "``2ACR96qjUqsyM``".
351    Note that you don't ever tell us what your password is; you just give it to
352    us in an encrypted form.  To get this, run "``htpasswd``" (a utility that
353    comes with apache) in *crypt* mode (often enabled with "``-d``"), or find a web
354    page that will do it for you.  Note that our system does not work with MD5
355    hashes.  These are significantly longer than a crypt hash - e.g.
356    "``$apr1$vea6bBV2$Z8IFx.AfeD8LhqlZFqJer0``", we only accept the shorter crypt hash.
358 Once you've been granted commit access, you should be able to check out an LLVM
359 tree with an SVN URL of "https://username@llvm.org/..." instead of the normal
360 anonymous URL of "http://llvm.org/...".  The first time you commit you'll have
361 to type in your password.  Note that you may get a warning from SVN about an
362 untrusted key; you can ignore this.  To verify that your commit access works,
363 please do a test commit (e.g. change a comment or add a blank line).  Your first
364 commit to a repository may require the autogenerated email to be approved by a
365 moderator of the mailing list.
366 This is normal and will be done when the mailing list owner has time.
368 If you have recently been granted commit access, these policies apply:
370 #. You are granted *commit-after-approval* to all parts of LLVM.  To get
371    approval, submit a `patch`_ to `llvm-commits
372    <http://lists.llvm.org/mailman/listinfo/llvm-commits>`_. When approved,
373    you may commit it yourself.
375 #. You are allowed to commit patches without approval which you think are
376    obvious. This is clearly a subjective decision --- we simply expect you to
377    use good judgement.  Examples include: fixing build breakage, reverting
378    obviously broken patches, documentation/comment changes, any other minor
379    changes. Avoid committing formatting- or whitespace-only changes outside of
380    code you plan to make subsequent changes to. Also, try to separate
381    formatting or whitespace changes from functional changes, either by
382    correcting the format first (ideally) or afterward. Such changes should be
383    highly localized and the commit message should clearly state that the commit
384    is not intended to change functionality, usually by stating it is
385    :ref:`NFC <nfc>`.
387 #. You are allowed to commit patches without approval to those portions of LLVM
388    that you have contributed or maintain (i.e., have been assigned
389    responsibility for), with the proviso that such commits must not break the
390    build.  This is a "trust but verify" policy, and commits of this nature are
391    reviewed after they are committed.
393 #. Multiple violations of these policies or a single egregious violation may
394    cause commit access to be revoked.
396 In any case, your changes are still subject to `code review`_ (either before or
397 after they are committed, depending on the nature of the change).  You are
398 encouraged to review other peoples' patches as well, but you aren't required
399 to do so.
401 .. _discuss the change/gather consensus:
403 Making a Major Change
404 ---------------------
406 When a developer begins a major new project with the aim of contributing it back
407 to LLVM, they should inform the community with an email to the `llvm-dev
408 <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ email list, to the extent
409 possible. The reason for this is to:
411 #. keep the community informed about future changes to LLVM,
413 #. avoid duplication of effort by preventing multiple parties working on the
414    same thing and not knowing about it, and
416 #. ensure that any technical issues around the proposed work are discussed and
417    resolved before any significant work is done.
419 The design of LLVM is carefully controlled to ensure that all the pieces fit
420 together well and are as consistent as possible. If you plan to make a major
421 change to the way LLVM works or want to add a major new extension, it is a good
422 idea to get consensus with the development community before you start working on
425 Once the design of the new feature is finalized, the work itself should be done
426 as a series of `incremental changes`_, not as a long-term development branch.
428 .. _incremental changes:
430 Incremental Development
431 -----------------------
433 In the LLVM project, we do all significant changes as a series of incremental
434 patches.  We have a strong dislike for huge changes or long-term development
435 branches.  Long-term development branches have a number of drawbacks:
437 #. Branches must have mainline merged into them periodically.  If the branch
438    development and mainline development occur in the same pieces of code,
439    resolving merge conflicts can take a lot of time.
441 #. Other people in the community tend to ignore work on branches.
443 #. Huge changes (produced when a branch is merged back onto mainline) are
444    extremely difficult to `code review`_.
446 #. Branches are not routinely tested by our nightly tester infrastructure.
448 #. Changes developed as monolithic large changes often don't work until the
449    entire set of changes is done.  Breaking it down into a set of smaller
450    changes increases the odds that any of the work will be committed to the main
451    repository.
453 To address these problems, LLVM uses an incremental development style and we
454 require contributors to follow this practice when making a large/invasive
455 change.  Some tips:
457 * Large/invasive changes usually have a number of secondary changes that are
458   required before the big change can be made (e.g. API cleanup, etc).  These
459   sorts of changes can often be done before the major change is done,
460   independently of that work.
462 * The remaining inter-related work should be decomposed into unrelated sets of
463   changes if possible.  Once this is done, define the first increment and get
464   consensus on what the end goal of the change is.
466 * Each change in the set can be stand alone (e.g. to fix a bug), or part of a
467   planned series of changes that works towards the development goal.
469 * Each change should be kept as small as possible. This simplifies your work
470   (into a logical progression), simplifies code review and reduces the chance
471   that you will get negative feedback on the change. Small increments also
472   facilitate the maintenance of a high quality code base.
474 * Often, an independent precursor to a big change is to add a new API and slowly
475   migrate clients to use the new API.  Each change to use the new API is often
476   "obvious" and can be committed without review.  Once the new API is in place
477   and used, it is much easier to replace the underlying implementation of the
478   API.  This implementation change is logically separate from the API
479   change.
481 If you are interested in making a large change, and this scares you, please make
482 sure to first `discuss the change/gather consensus`_ then ask about the best way
483 to go about making the change.
485 Attribution of Changes
486 ----------------------
488 When contributors submit a patch to an LLVM project, other developers with
489 commit access may commit it for the author once appropriate (based on the
490 progression of code review, etc.). When doing so, it is important to retain
491 correct attribution of contributions to their contributors. However, we do not
492 want the source code to be littered with random attributions "this code written
493 by J. Random Hacker" (this is noisy and distracting). In practice, the revision
494 control system keeps a perfect history of who changed what, and the CREDITS.txt
495 file describes higher-level contributions. If you commit a patch for someone
496 else, please follow the attribution of changes in the simple manner as outlined
497 by the `commit messages`_ section. Overall, please do not add contributor names
498 to the source code.
500 Also, don't commit patches authored by others unless they have submitted the
501 patch to the project or you have been authorized to submit them on their behalf
502 (you work together and your company authorized you to contribute the patches,
503 etc.). The author should first submit them to the relevant project's commit
504 list, development list, or LLVM bug tracker component. If someone sends you
505 a patch privately, encourage them to submit it to the appropriate list first.
508 .. _IR backwards compatibility:
510 IR Backwards Compatibility
511 --------------------------
513 When the IR format has to be changed, keep in mind that we try to maintain some
514 backwards compatibility. The rules are intended as a balance between convenience
515 for llvm users and not imposing a big burden on llvm developers:
517 * The textual format is not backwards compatible. We don't change it too often,
518   but there are no specific promises.
520 * Additions and changes to the IR should be reflected in
521   ``test/Bitcode/compatibility.ll``.
523 * The current LLVM version supports loading any bitcode since version 3.0.
525 * After each X.Y release, ``compatibility.ll`` must be copied to
526   ``compatibility-X.Y.ll``. The corresponding bitcode file should be assembled
527   using the X.Y build and committed as ``compatibility-X.Y.ll.bc``.
529 * Newer releases can ignore features from older releases, but they cannot
530   miscompile them. For example, if nsw is ever replaced with something else,
531   dropping it would be a valid way to upgrade the IR.
533 * Debug metadata is special in that it is currently dropped during upgrades.
535 * Non-debug metadata is defined to be safe to drop, so a valid way to upgrade
536   it is to drop it. That is not very user friendly and a bit more effort is
537   expected, but no promises are made.
539 C API Changes
540 ----------------
542 * Stability Guarantees: The C API is, in general, a "best effort" for stability.
543   This means that we make every attempt to keep the C API stable, but that
544   stability will be limited by the abstractness of the interface and the
545   stability of the C++ API that it wraps. In practice, this means that things
546   like "create debug info" or "create this type of instruction" are likely to be
547   less stable than "take this IR file and JIT it for my current machine".
549 * Release stability: We won't break the C API on the release branch with patches
550   that go on that branch, with the exception that we will fix an unintentional
551   C API break that will keep the release consistent with both the previous and
552   next release.
554 * Testing: Patches to the C API are expected to come with tests just like any
555   other patch.
557 * Including new things into the API: If an LLVM subcomponent has a C API already
558   included, then expanding that C API is acceptable. Adding C API for
559   subcomponents that don't currently have one needs to be discussed on the
560   mailing list for design and maintainability feedback prior to implementation.
562 * Documentation: Any changes to the C API are required to be documented in the
563   release notes so that it's clear to external users who do not follow the
564   project how the C API is changing and evolving.
566 New Targets
567 -----------
569 LLVM is very receptive to new targets, even experimental ones, but a number of
570 problems can appear when adding new large portions of code, and back-ends are
571 normally added in bulk.  We have found that landing large pieces of new code 
572 and then trying to fix emergent problems in-tree is problematic for a variety 
573 of reasons.
575 For these reasons, new targets are *always* added as *experimental* until
576 they can be proven stable, and later moved to non-experimental. The difference
577 between both classes is that experimental targets are not built by default
578 (need to be added to -DLLVM_TARGETS_TO_BUILD at CMake time).
580 The basic rules for a back-end to be upstreamed in **experimental** mode are:
582 * Every target must have a :ref:`code owner<code owners>`. The `CODE_OWNERS.TXT`
583   file has to be updated as part of the first merge. The code owner makes sure
584   that changes to the target get reviewed and steers the overall effort.
586 * There must be an active community behind the target. This community
587   will help maintain the target by providing buildbots, fixing
588   bugs, answering the LLVM community's questions and making sure the new
589   target doesn't break any of the other targets, or generic code. This
590   behavior is expected to continue throughout the lifetime of the
591   target's code.
593 * The code must be free of contentious issues, for example, large
594   changes in how the IR behaves or should be formed by the front-ends,
595   unless agreed by the majority of the community via refactoring of the
596   (:doc:`IR standard<LangRef>`) **before** the merge of the new target changes,
597   following the :ref:`IR backwards compatibility`.
599 * The code conforms to all of the policies laid out in this developer policy
600   document, including license, patent, and coding standards.
602 * The target should have either reasonable documentation on how it
603   works (ISA, ABI, etc.) or a publicly available simulator/hardware
604   (either free or cheap enough) - preferably both.  This allows
605   developers to validate assumptions, understand constraints and review code 
606   that can affect the target. 
608 In addition, the rules for a back-end to be promoted to **official** are:
610 * The target must have addressed every other minimum requirement and
611   have been stable in tree for at least 3 months. This cool down
612   period is to make sure that the back-end and the target community can
613   endure continuous upstream development for the foreseeable future.
615 * The target's code must have been completely adapted to this policy
616   as well as the :doc:`coding standards<CodingStandards>`. Any exceptions that
617   were made to move into experimental mode must have been fixed **before**
618   becoming official.
620 * The test coverage needs to be broad and well written (small tests,
621   well documented). The build target ``check-all`` must pass with the
622   new target built, and where applicable, the ``test-suite`` must also
623   pass without errors, in at least one configuration (publicly
624   demonstrated, for example, via buildbots).
626 * Public buildbots need to be created and actively maintained, unless
627   the target requires no additional buildbots (ex. ``check-all`` covers
628   all tests). The more relevant and public the new target's CI infrastructure
629   is, the more the LLVM community will embrace it.
631 To **continue** as a supported and official target:
633 * The maintainer(s) must continue following these rules throughout the lifetime
634   of the target. Continuous violations of aforementioned rules and policies
635   could lead to complete removal of the target from the code base.
637 * Degradation in support, documentation or test coverage will make the target as
638   nuisance to other targets and be considered a candidate for deprecation and
639   ultimately removed.
641 In essences, these rules are necessary for targets to gain and retain their
642 status, but also markers to define bit-rot, and will be used to clean up the
643 tree from unmaintained targets.
645 .. _copyright-license-patents:
647 Copyright, License, and Patents
648 ===============================
650 .. note::
652    This section deals with legal matters but does not provide legal advice.  We
653    are not lawyers --- please seek legal counsel from an attorney.
655 This section addresses the issues of copyright, license and patents for the LLVM
656 project.  The copyright for the code is held by the individual contributors of
657 the code and the terms of its license to LLVM users and developers is the
658 `University of Illinois/NCSA Open Source License
659 <http://www.opensource.org/licenses/UoI-NCSA.php>`_ (with portions dual licensed
660 under the `MIT License <http://www.opensource.org/licenses/mit-license.php>`_,
661 see below).  As contributor to the LLVM project, you agree to allow any
662 contributions to the project to licensed under these terms.
664 Copyright
665 ---------
667 The LLVM project does not require copyright assignments, which means that the
668 copyright for the code in the project is held by its respective contributors who
669 have each agreed to release their contributed code under the terms of the `LLVM
670 License`_.
672 An implication of this is that the LLVM license is unlikely to ever change:
673 changing it would require tracking down all the contributors to LLVM and getting
674 them to agree that a license change is acceptable for their contribution.  Since
675 there are no plans to change the license, this is not a cause for concern.
677 As a contributor to the project, this means that you (or your company) retain
678 ownership of the code you contribute, that it cannot be used in a way that
679 contradicts the license (which is a liberal BSD-style license), and that the
680 license for your contributions won't change without your approval in the
681 future.
683 .. _LLVM License:
685 License
686 -------
688 We intend to keep LLVM perpetually open source and to use a liberal open source
689 license. **As a contributor to the project, you agree that any contributions be
690 licensed under the terms of the corresponding subproject.** All of the code in
691 LLVM is available under the `University of Illinois/NCSA Open Source License
692 <http://www.opensource.org/licenses/UoI-NCSA.php>`_, which boils down to
693 this:
695 * You can freely distribute LLVM.
696 * You must retain the copyright notice if you redistribute LLVM.
697 * Binaries derived from LLVM must reproduce the copyright notice (e.g. in an
698   included readme file).
699 * You can't use our names to promote your LLVM derived products.
700 * There's no warranty on LLVM at all.
702 We believe this fosters the widest adoption of LLVM because it **allows
703 commercial products to be derived from LLVM** with few restrictions and without
704 a requirement for making any derived works also open source (i.e.  LLVM's
705 license is not a "copyleft" license like the GPL). We suggest that you read the
706 `License <http://www.opensource.org/licenses/UoI-NCSA.php>`_ if further
707 clarification is needed.
709 In addition to the UIUC license, the runtime library components of LLVM
710 (**compiler_rt, libc++, and libclc**) are also licensed under the `MIT License
711 <http://www.opensource.org/licenses/mit-license.php>`_, which does not contain
712 the binary redistribution clause.  As a user of these runtime libraries, it
713 means that you can choose to use the code under either license (and thus don't
714 need the binary redistribution clause), and as a contributor to the code that
715 you agree that any contributions to these libraries be licensed under both
716 licenses.  We feel that this is important for runtime libraries, because they
717 are implicitly linked into applications and therefore should not subject those
718 applications to the binary redistribution clause. This also means that it is ok
719 to move code from (e.g.)  libc++ to the LLVM core without concern, but that code
720 cannot be moved from the LLVM core to libc++ without the copyright owner's
721 permission.
723 Note that the LLVM Project does distribute dragonegg, **which is
724 GPL.** This means that anything "linked" into dragonegg must itself be compatible
725 with the GPL, and must be releasable under the terms of the GPL.  This implies
726 that **any code linked into dragonegg and distributed to others may be subject to
727 the viral aspects of the GPL** (for example, a proprietary code generator linked
728 into dragonegg must be made available under the GPL).  This is not a problem for
729 code already distributed under a more liberal license (like the UIUC license),
730 and GPL-containing subprojects are kept in separate SVN repositories whose
731 LICENSE.txt files specifically indicate that they contain GPL code.
733 Patents
734 -------
736 To the best of our knowledge, LLVM does not infringe on any patents (we have
737 actually removed code from LLVM in the past that was found to infringe).  Having
738 code in LLVM that infringes on patents would violate an important goal of the
739 project by making it hard or impossible to reuse the code for arbitrary purposes
740 (including commercial use).
742 When contributing code, we expect contributors to notify us of any potential for
743 patent-related trouble with their changes (including from third parties).  If
744 you or your employer own the rights to a patent and would like to contribute
745 code to LLVM that relies on it, we require that the copyright owner sign an
746 agreement that allows any other user of LLVM to freely use your patent.  Please
747 contact the `LLVM Foundation Board of Directors <mailto:board@llvm.org>`_ for more
748 details.