aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/Target/ARM
Commit message (Collapse)AuthorAgeFilesLines
* Move all sources from the llvm project into contrib/llvm-project.Dimitry Andric2019-12-20122-138825/+0
| | | | | | | | | | | | | This uses the new layout of the upstream repository, which was recently migrated to GitHub, and converted into a "monorepo". That is, most of the earlier separate sub-projects with their own branches and tags were consolidated into one top-level directory, and are now branched and tagged together. Updating the vendor area to match this layout is next. Notes: svn path=/head/; revision=355940
* Pull in r372186 from upstream llvm trunk (by Eli Friedman):Dimitry Andric2019-10-255-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ARM] VFPv2 only supports 16 D registers. r361845 changed the way we handle "D16" vs. "D32" targets; there used to be a negative "d16" which removed instructions from the instruction set, and now there's a "d32" feature which adds instructions to the instruction set. This is good, but there was an oversight in the implementation: the behavior of VFPv2 was changed. In particular, the "vfp2" feature was changed to imply "d32". This is wrong: VFPv2 only supports 16 D registers. In practice, this means if you specify -mfpu=vfpv2, the compiler will generate illegal instructions. This patch gets rid of "vfp2d16" and "vfp2d16sp", and fixes "vfp2" and "vfp2sp" so they don't imply "d32". Differential Revision: https://reviews.llvm.org/D67375 Pull in r372187 from upstream clang trunk (by Eli Friedman): [ARM] Update clang for removal of vfp2d16 and vfp2d16sp Matching fix for https://reviews.llvm.org/D67375 (r372186). Differential Revision: https://reviews.llvm.org/D67467 This should fix clang generating invalid opcodes for floating point operations on armv6. Requested by: mmel MFC after: 3 days Notes: svn path=/head/; revision=354097
* Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmpDimitry Andric2019-09-022-6/+8
| | | | | | | release_90 branch r369369, and update version numbers. Notes: svn path=/projects/clang900-import/; revision=351708
* Merge llvm trunk r366426, resolve conflicts, and update FREEBSD-Xlist.Dimitry Andric2019-08-21125-3999/+15635
| | | | Notes: svn path=/projects/clang900-import/; revision=351344
* Pull in r360099 from upstream llvm trunk (by Eli Friedman):Dimitry Andric2019-05-081-26/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ARM] Glue register copies to tail calls. This generally follows what other targets do. I don't completely understand why the special case for tail calls existed in the first place; even when the code was committed in r105413, call lowering didn't work in the way described in the comments. Stack protector lowering breaks if the register copies are not glued to a tail call: we have to insert the stack protector check before the tail call, and we choose the location based on the assumption that all physical register dependencies of a tail call are adjacent to the tail call. (See FindSplitPointForStackProtector.) This is sort of fragile, but I don't see any reason to break that assumption. I'm guessing nobody has seen this before just because it's hard to convince the scheduler to actually schedule the code in a way that breaks; even without the glue, the only computation that could actually be scheduled after the register copies is the computation of the call address, and the scheduler usually prefers to schedule that before the copies anyway. Fixes https://bugs.llvm.org/show_bug.cgi?id=41417 Differential Revision: https://reviews.llvm.org/D60427 This should fix several instances of "Bad machine code: Using an undefined physical register", when compiling ports such as multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with -fstack-protector-strong. Reported by: jbeich PR: 237074, 237783, 237784 MFC after: 3 days Notes: svn path=/head/; revision=347243
* Pull in r356809 from upstream llvm trunk (by Eli Friedman):Dimitry Andric2019-03-231-1/+9
| | | | | | | | | | | | | | | | | | | | | | | [ARM] Don't form "ands" when it isn't scheduled correctly. In r322972/r323136, the iteration here was changed to catch cases at the beginning of a basic block... but we accidentally deleted an important safety check. Restore that check to the way it was. Fixes https://bugs.llvm.org/show_bug.cgi?id=41116 Differential Revision: https://reviews.llvm.org/D59680 This should fix "Assertion failed: (LiveCPSR && "CPSR liveness tracking is wrong!"), function UpdateCPSRUse" errors when building the devel/xwpe port for armv7. PR: 236062, 236568 MFC after: 1 month X-MFC-With: r344779 Notes: svn path=/head/; revision=345449
* Merge llvm trunk r351319, resolve conflicts, and update FREEBSD-Xlist.Dimitry Andric2019-01-2052-1264/+2587
| | | | Notes: svn path=/projects/clang800-import/; revision=343210
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branchDimitry Andric2018-09-115-3/+12
| | | | | | | | | r341916, resolve conflicts, and bump version numbers. PR: 230240, 230355 Notes: svn path=/projects/clang700-import/; revision=338597
* Merge llvm trunk r338150 (just before the 7.0.0 branch point), andDimitry Andric2018-08-0222-64/+113
| | | | | | | resolve conflicts. Notes: svn path=/projects/clang700-import/; revision=337149
* Merge llvm trunk r338150, and resolve conflicts.Dimitry Andric2018-07-3075-1349/+4863
| | | | Notes: svn path=/projects/clang700-import/; revision=336916
* Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ toDimitry Andric2018-06-292-4/+11
| | | | | | | | | | 6.0.1 release (upstream r335540). Relnotes: yes MFC after: 2 weeks Notes: svn path=/head/; revision=335799
* Pull in r326882 from upstream llvm trunk (by Sjoerd Meijer):Dimitry Andric2018-03-091-8/+17
| | | | | | | | | | | | | | | | | | | | | | | [ARM] Fix for PR36577 Don't PerformSHLSimplify if the given node is used by a node that also uses a constant because we may get stuck in an infinite combine loop. bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36577 Patch by Sam Parker. Differential Revision: https://reviews.llvm.org/D44097 This fixes a hang when compiling one particular file in java/openjdk8 for armv6 and armv7. Reported by: swills PR: 226388 Notes: svn path=/head/; revision=330686
* Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ toDimitry Andric2018-02-022-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6.0.0 (branches/release_60 r324090). This introduces retpoline support, with the -mretpoline flag. The upstream initial commit message (r323155 by Chandler Carruth) contains quite a bit of explanation. Quoting: Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre. Summary: First, we need to explain the core of the vulnerability. Note that this is a very incomplete description, please see the Project Zero blog post for details: https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html The basis for branch target injection is to direct speculative execution of the processor to some "gadget" of executable code by poisoning the prediction of indirect branches with the address of that gadget. The gadget in turn contains an operation that provides a side channel for reading data. Most commonly, this will look like a load of secret data followed by a branch on the loaded value and then a load of some predictable cache line. The attacker then uses timing of the processors cache to determine which direction the branch took *in the speculative execution*, and in turn what one bit of the loaded value was. Due to the nature of these timing side channels and the branch predictor on Intel processors, this allows an attacker to leak data only accessible to a privileged domain (like the kernel) back into an unprivileged domain. The goal is simple: avoid generating code which contains an indirect branch that could have its prediction poisoned by an attacker. In many cases, the compiler can simply use directed conditional branches and a small search tree. LLVM already has support for lowering switches in this way and the first step of this patch is to disable jump-table lowering of switches and introduce a pass to rewrite explicit indirectbr sequences into a switch over integers. However, there is no fully general alternative to indirect calls. We introduce a new construct we call a "retpoline" to implement indirect calls in a non-speculatable way. It can be thought of loosely as a trampoline for indirect calls which uses the RET instruction on x86. Further, we arrange for a specific call->ret sequence which ensures the processor predicts the return to go to a controlled, known location. The retpoline then "smashes" the return address pushed onto the stack by the call with the desired target of the original indirect call. The result is a predicted return to the next instruction after a call (which can be used to trap speculative execution within an infinite loop) and an actual indirect branch to an arbitrary address. On 64-bit x86 ABIs, this is especially easily done in the compiler by using a guaranteed scratch register to pass the target into this device. For 32-bit ABIs there isn't a guaranteed scratch register and so several different retpoline variants are introduced to use a scratch register if one is available in the calling convention and to otherwise use direct stack push/pop sequences to pass the target address. This "retpoline" mitigation is fully described in the following blog post: https://support.google.com/faqs/answer/7625886 We also support a target feature that disables emission of the retpoline thunk by the compiler to allow for custom thunks if users want them. These are particularly useful in environments like kernels that routinely do hot-patching on boot and want to hot-patch their thunk to different code sequences. They can write this custom thunk and use `-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this case, on x86-64 thu thunk names must be: ``` __llvm_external_retpoline_r11 ``` or on 32-bit: ``` __llvm_external_retpoline_eax __llvm_external_retpoline_ecx __llvm_external_retpoline_edx __llvm_external_retpoline_push ``` And the target of the retpoline is passed in the named register, or in the case of the `push` suffix on the top of the stack via a `pushl` instruction. There is one other important source of indirect branches in x86 ELF binaries: the PLT. These patches also include support for LLD to generate PLT entries that perform a retpoline-style indirection. The only other indirect branches remaining that we are aware of are from precompiled runtimes (such as crt0.o and similar). The ones we have found are not really attackable, and so we have not focused on them here, but eventually these runtimes should also be replicated for retpoline-ed configurations for completeness. For kernels or other freestanding or fully static executables, the compiler switch `-mretpoline` is sufficient to fully mitigate this particular attack. For dynamic executables, you must compile *all* libraries with `-mretpoline` and additionally link the dynamic executable and all shared libraries with LLD and pass `-z retpolineplt` (or use similar functionality from some other linker). We strongly recommend also using `-z now` as non-lazy binding allows the retpoline-mitigated PLT to be substantially smaller. When manually apply similar transformations to `-mretpoline` to the Linux kernel we observed very small performance hits to applications running typic al workloads, and relatively minor hits (approximately 2%) even for extremely syscall-heavy applications. This is largely due to the small number of indirect branches that occur in performance sensitive paths of the kernel. When using these patches on statically linked applications, especially C++ applications, you should expect to see a much more dramatic performance hit. For microbenchmarks that are switch, indirect-, or virtual-call heavy we have seen overheads ranging from 10% to 50%. However, real-world workloads exhibit substantially lower performance impact. Notably, techniques such as PGO and ThinLTO dramatically reduce the impact of hot indirect calls (by speculatively promoting them to direct calls) and allow optimized search trees to be used to lower switches. If you need to deploy these techniques in C++ applications, we *strongly* recommend that you ensure all hot call targets are statically linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well tuned servers using all of these techniques saw 5% - 10% overhead from the use of retpoline. We will add detailed documentation covering these components in subsequent patches, but wanted to make the core functionality available as soon as possible. Happy for more code review, but we'd really like to get these patches landed and backported ASAP for obvious reasons. We're planning to backport this to both 6.0 and 5.0 release streams and get a 5.0 release with just this cherry picked ASAP for distros and vendors. This patch is the work of a number of people over the past month: Eric, Reid, Rui, and myself. I'm mailing it out as a single commit due to the time sensitive nature of landing this and the need to backport it. Huge thanks to everyone who helped out here, and everyone at Intel who helped out in discussions about how to craft this. Also, credit goes to Paul Turner (at Google, but not an LLVM contributor) for much of the underlying retpoline design. Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D41723 MFC after: 3 months X-MFC-With: r327952 PR: 224669 Notes: svn path=/head/; revision=328817
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_60 r321788,Dimitry Andric2018-01-066-42/+41
| | | | | | | update build glue and version numbers. Notes: svn path=/projects/clang600-import/; revision=327657
* Merge llvm trunk r321414 to contrib/llvm.Dimitry Andric2017-12-2419-73/+236
| | | | Notes: svn path=/projects/clang600-import/; revision=327134
* Merge llvm trunk r321017 to contrib/llvm.Dimitry Andric2017-12-2081-2546/+3818
| | | | Notes: svn path=/projects/clang600-import/; revision=327023
* Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from theDimitry Andric2017-12-039-11/+36
| | | | | | | | | upstream release_50 branch. This corresponds to 5.0.1 rc2. MFC after: 2 weeks Notes: svn path=/head/; revision=326496
* Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 fromDimitry Andric2017-08-241-4/+20
| | | | | | | | | | | | | | the upstream release_50 branch. As of this version, lib/msun's trig test should also work correctly again (see bug 220989 for more information). PR: 220989 MFC after: 2 months X-MFC-with: r321369 Notes: svn path=/head/; revision=322855
* Upgrade our copies of clang, llvm, lld and libc++ to r311219 from theDimitry Andric2017-08-212-32/+16
| | | | | | | | | | upstream release_50 branch. MFC after: 2 months X-MFC-with: r321369 Notes: svn path=/head/; revision=322740
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and updateDimitry Andric2017-07-199-216/+328
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=321238
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r307894, and updateDimitry Andric2017-07-1317-128/+596
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=320970
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306956, and updateDimitry Andric2017-07-0220-264/+335
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=320572
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and updateDimitry Andric2017-06-2717-91/+356
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=320397
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305575, and updateDimitry Andric2017-06-174-38/+82
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=320041
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305145, and updateDimitry Andric2017-06-1033-124/+210
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=319799
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304659, and updateDimitry Andric2017-06-038-14/+1925
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=319547
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304460, and updateDimitry Andric2017-06-018-69/+100
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=319479
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304222, and updateDimitry Andric2017-05-301-4/+0
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=319250
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304149, and updateDimitry Andric2017-05-2914-482/+416
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=319164
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303571, and updateDimitry Andric2017-05-221-2/+2
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=318681
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303291, and updateDimitry Andric2017-05-182-17/+1
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=318477
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303197, and updateDimitry Andric2017-05-1612-79/+43
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=318384
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302418, and updateDimitry Andric2017-05-089-179/+387
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=317969
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302069, and updateDimitry Andric2017-05-0311-103/+132
| | | | | | | build glue (preliminary, not all option combinations work yet). Notes: svn path=/projects/clang500-import/; revision=317778
* Merge llvm, clang, lld, lldb, compiler-rt and libc++ r301441, and updateDimitry Andric2017-04-2620-38/+154
| | | | | | | build glue. Notes: svn path=/projects/clang500-import/; revision=317472
* Merge llvm, clang, lld and lldb trunk r300890, and update build glue.Dimitry Andric2017-04-2021-364/+426
| | | | Notes: svn path=/projects/clang500-import/; revision=317230
* Merge llvm trunk r300422 and resolve conflicts.Dimitry Andric2017-04-1675-3193/+5421
| | | | Notes: svn path=/projects/clang500-import/; revision=317029
* Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branchDimitry Andric2017-02-232-12/+35
| | | | | | | r296002, and update build glue. Notes: svn path=/projects/clang400-import/; revision=314177
* Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branchDimitry Andric2017-02-172-15/+16
| | | | | | | r295380, and update build glue. Notes: svn path=/projects/clang400-import/; revision=313894
* Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branchDimitry Andric2017-01-292-2/+5
| | | | | | | r293443, and update build glue. Notes: svn path=/projects/clang400-import/; revision=312967
* Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branchDimitry Andric2017-01-242-168/+16
| | | | | | | r292951, and update build glue. Notes: svn path=/projects/clang400-import/; revision=312719
* Merge llvm, clang, lld and lldb release_40 branch r292009. Also updateDimitry Andric2017-01-145-54/+226
| | | | | | | build glue. Notes: svn path=/projects/clang400-import/; revision=312197
* Merge llvm, clang, lld and lldb trunk r291274, and resolve conflicts.Dimitry Andric2017-01-062-3/+7
| | | | Notes: svn path=/projects/clang400-import/; revision=311544
* Merge llvm, clang, lld and lldb trunk r291012, and resolve conflicts.Dimitry Andric2017-01-043-44/+0
| | | | Notes: svn path=/projects/clang400-import/; revision=311327
* Update llvm to trunk r290819 and resolve conflicts.Dimitry Andric2017-01-0269-1980/+5669
| | | | Notes: svn path=/projects/clang400-import/; revision=311142
* Update llvm, clang, lld, lldb, compiler-rt and libc++ to release_39Dimitry Andric2016-12-101-7/+4
| | | | | | | branch r288847. Notes: svn path=/projects/clang391-import/; revision=309816
* Update llvm, clang, lld and lldb to release_39 branch r287912.Dimitry Andric2016-11-262-0/+7
| | | | Notes: svn path=/projects/clang391-import/; revision=309175
* Update llvm to release_39 branch r278877.Dimitry Andric2016-08-173-9/+16
| | | | Notes: svn path=/projects/clang390-import/; revision=304310
* Update llvm to release_39 branch r276489, and resolve conflicts.Dimitry Andric2016-08-1678-3073/+6133
| | | | Notes: svn path=/projects/clang390-import/; revision=304240
* Update llvm, clang and lldb to release_38 branch r260756.Dimitry Andric2016-02-131-2/+2
| | | | Notes: svn path=/projects/clang380-import/; revision=295600