about summary refs log tree commit diff
path: root/compiler/rustc_target
AgeCommit message (Collapse)AuthorLines
2021-09-09Add methods for checking for full ranges to `Scalar` and `WrappingRange`Andreas Liljeqvist-21/+15
Move *_max methods back to util change to inline instead of inline(always) Remove valid_range_exclusive from scalar Use WrappingRange instead implement always_valid_for in a safer way Fix accidental edit
2021-09-05Auto merge of #88499 - eddyb:layout-off, r=nagisabors-41/+0
Provide `layout_of` automatically (given tcx + param_env + error handling). After #88337, there's no longer any uses of `LayoutOf` within `rustc_target` itself, so I realized I could move the trait to `rustc_middle::ty::layout` and redesign it a bit. This is similar to #88338 (and supersedes it), but at no ergonomic loss, since there's no funky `C: LayoutOf<Ty = Ty>` -> `Ty: TyAbiInterface<C>` generic `impl` chain, and each `LayoutOf` still corresponds to one `impl` (of `LayoutOfHelpers`) for the specific context. After this PR, this is what's needed to get `trait LayoutOf` (with the `layout_of` method) implemented on some context type: * `TyCtxt`, via `HasTyCtxt` * `ParamEnv`, via `HasParamEnv` * a way to transform `LayoutError`s into the desired error type * an error type of `!` can be paired with having `cx.layout_of(...)` return `TyAndLayout` *without* `Result<...>` around it, such as used by codegen * this is done through a new `LayoutOfHelpers` trait (and so is specifying the type of `cx.layout_of(...)`) When going through this path (and not bypassing it with a manual `impl` of `LayoutOf`), the end result is that only the error case can be customized, the query itself and the success paths are guaranteed to be uniform. (**EDIT**: just noticed that because of the supertrait relationship, you cannot actually implement `LayoutOf` yourself, the blanket `impl` fully covers all possible context types that could ever implement it) Part of the motivation for this shape of API is that I've been working on querifying `FnAbi::of_*`, and what I want/need to introduce for that looks a lot like the setup in this PR - in particular, it's harder to express the `FnAbi` methods in `rustc_target`, since they're much more tied to `rustc` concepts. r? `@nagisa` cc `@oli-obk` `@bjorn3`
2021-09-03Auto merge of #88454 - devnexen:sunos_asan, r=wesleywiserbors-2/+4
sunos systems add sanitizer supported.
2021-09-02Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, ↵bors-1/+1
r=jyn514,GuillaumeGomez some low hanging clippy::perf fixes
2021-09-02Auto merge of #87114 - cjgillot:abilint, r=estebankbors-0/+3
Lint missing Abi in ast validation instead of lowering.
2021-09-02rustc_target: move `LayoutOf` to `ty::layout`.Eduard-Mihai Burtescu-41/+0
2021-09-01Rollup merge of #88350 - programmerjake:add-ppc-cr-xer-clobbers, r=AmanieuMara Bos-10/+61
add support for clobbering xer, cr, and cr[0-7] for asm! on OpenPower/PowerPC Fixes #88315
2021-08-31Lint Abi in ast validation.Camille GILLOT-0/+3
2021-08-31some low hanging clippy::perf fixesMatthias Krüger-1/+1
2021-08-31ARMv6K Nintendo 3DS Tier 3 target addedMeziu-0/+47
2021-08-30sunos systems add sanitizer supported.David Carlier-2/+4
2021-08-30Disallow the aapcs CC on Aarch64Simonas Kazlauskas-1/+2
This never really worked and makes LLVM assert.
2021-08-29Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisabors-153/+133
rustc_target: `TyAndLayout::field` should never error. This refactor (making `TyAndLayout::field` return `TyAndLayout` without any `Result` around it) is based on a simple observation, regarding `TyAndLayout::field`: If `cx.layout_of(ty)` succeeds (for some `cx` and `ty`), then `.field(cx, i)` on the resulting `TyAndLayout` should *always* succeed in computing `cx.layout_of(field_ty)` (where `field_ty` is the type of the `i`th field of `ty`). The reason for this is that no matter which field is chosen, `cx.layout_of(field_ty)` *will have already been computed*, as part of computing `cx.layout_of(ty)`, as we cannot determine the layout of *any* type without considering the layouts of *all* of its fields. And so it should be fine to turn any errors into ICEs, since they likely indicate a `cx` mismatch, or some other edge case that is due to a compiler bug (as opposed to ever being an user-facing error). <hr/> Each commit should probably be reviewed separately, though note that there's some `where` clauses (in `rustc_target::abi::call::*`) that change in most commits. cc `@nagisa` `@oli-obk`
2021-08-30rustc_target: remove `LayoutOf` bound from `TyAbiInterface`.Eduard-Mihai Burtescu-61/+51
2021-08-30rustc_target: `TyAndLayout::field` should never error.Eduard-Mihai Burtescu-9/+8
2021-08-29Auto merge of #88250 - rusticstuff:macos-lld, r=nagisabors-1/+2
Make `-Z gcc-ld=lld` work for Apple targets `-Z gcc-ld=lld` was introduced in #85961. It does not work on Macos because lld needs be either named `ld64` or passed `-flavor darwin` as the first two arguments in order to select the Mach-O flavor. Rust invokes cc (=clang) on Macos for linking which calls `ld` as linker binary and not `ld64`, so just creating an `ld64` binary and modifying the search path with `-B` does not work. In order to solve this patch does: * Set the `lld_flavor` for all Apple-derived targets to `LldFlavor::Ld64`. As far as I can see this actually works towards fixing `-Xlinker=rust-lld` as all those targets use the Mach-O object format. * Copy/hardlink rust-lld to the gcc-ld subdirectory as ld64 next to ld. * If `-Z gcc-ld=lld` is used and the target lld flavor is Ld64 add `-fuse-ld=/path/to/ld64` to the linker invocation. Fixes #86945.
2021-08-28Auto merge of #88245 - Sl1mb0:s390-asm, r=Amanieubors-0/+131
S390x inline asm This adds register definitions and constraint codes for the s390x general and floating point registers necessary for fixing #85931; as well as a few tests. Further testing is needed, but I am a little unsure of what specific tests should be added to `src/test/assembly/asm/s390x.rs` to address this.
2021-08-27rustc_target: require `TyAbiInterface` in `LayoutOf`.Eduard-Mihai Burtescu-2/+2
2021-08-27rustc_target: rename `TyAndLayoutMethods` to `TyAbiInterface`.Eduard-Mihai Burtescu-65/+71
2021-08-27rustc_target: add lifetime parameter to `LayoutOf`.Eduard-Mihai Burtescu-79/+64
2021-08-26`#[inline]` non-generic `pub fn`s in `rustc_target::abi` and `ty::layout`.Eduard-Mihai Burtescu-0/+21
2021-08-26Auto merge of #88308 - eddyb:cooked-layouts, r=nagisabors-1/+1
Morph `layout_raw` query into `layout_of`. Before this PR, `LayoutCx::layout_of` wrapped the `layout_raw` query, to: * normalize the type, before attempting to compute the layout * pass the layout to `record_layout_for_printing`, for `-Zprint-type-sizes` Moving those two responsibilities into the query may reduce overhead (due to cached calls skipping those steps), but I want to do a perf run to know. One of the changes I had to make was changing the return type of the query, to be able to both get out the type produced by normalizing inside the query *and* to match the signature of the old `TyCtxt::layout_of`. This change may be worse, perf-wise, so that's another reason I want to check. r? `@nagisa` cc `@oli-obk`
2021-08-25add support for clobbering xer, cr, and cr[0-7] for asm! on OpenPower/PowerPCJacob Lifshay-10/+61
Fixes #88315
2021-08-25use undef for uninitialized bytes in constantsErik Desjardins-0/+40
2021-08-25Auto merge of #88242 - bonega:allocation_range, r=oli-obkbors-34/+71
Use custom wrap-around type instead of RangeInclusive Two reasons: 1. More memory is allocated than necessary for `valid_range` in `Scalar`. The range is not used as an iterator and `exhausted` is never used. 2. `contains`, `count` etc. methods in `RangeInclusive` are doing very unhelpful(and dangerous!) things when used as a wrap-around range. - In general this PR wants to limit potentially confusing methods, that have a low probability of working. Doing a local perf run, every metric shows improvement except for instructions. Max-rss seem to have a very consistent improvement. Sorry - newbie here, probably doing something wrong.
2021-08-24Morph `layout_raw` query into `layout_of`.Eduard-Mihai Burtescu-1/+1
2021-08-24use convention for with_* methodsAndreas Liljeqvist-7/+9
2021-08-24Auto merge of #87699 - ubamrein:use-iphone-deployment-target-for-llvm, ↵bors-3/+9
r=petrochenkov Allow specifying an deployment target version for all iOS llvm targets Closes: https://github.com/rust-lang/rust/issues/79408 This pull requests adds the same procedure to define the iOS-version for the LLVM-target as was used for the simulator target and the desktop target. This then closes the original problem mentioned in the above issue. The problem with incompatible bitcode remains, but is probably not easy fixable. I realised that something is still not right. Try to fix that. r? `@petrochenkov`
2021-08-24Force inline: small functions and single call-siteAndreas Liljeqvist-2/+4
2021-08-24allow specifying an ios version for the llvm targetPatrick Amrein-3/+9
2021-08-23Fix: made suggested changelinux1-1/+1
2021-08-23Refactor: disabled frame pointer; consolidated unsupported register errors; ↵linux1-68/+18
added register prefix
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-1/+1
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-23Simplify zero checkAndreas Liljeqvist-1/+1
2021-08-23add `with_start` and `with_end`Andreas Liljeqvist-1/+11
2021-08-23implement debug in similar way to RangeInclusiveAndreas Liljeqvist-1/+8
2021-08-23Rename to WrappingRangeAndreas Liljeqvist-5/+5
2021-08-23implement contains_zero methodAndreas Liljeqvist-3/+9
2021-08-23Use refAndreas Liljeqvist-2/+2
2021-08-23Removed fixed fixmeAndreas Liljeqvist-3/+0
2021-08-23Mach-O (Macos/ios/...) LLD flavor is always LD64.Hans Kratz-1/+2
2021-08-22Fix: appeased x.py test tidy --blesslinux1-6/+6
2021-08-22Feat: further testing & support for i64 general register uselinux1-1/+1
2021-08-22Feat: added s390x reg-definitions, constraint codes, and testslinux1-26/+26
2021-08-22Feat: added inline asm support for s390xlinux1-0/+181
2021-08-22Use custom wrap-around type instead of RangeAndreas Liljeqvist-30/+43
2021-08-22Rollup merge of #88077 - kit-981:feature/fix-minimum-os-version-in-header, ↵Guillaume Gomez-1/+13
r=petrochenkov Generate an iOS LLVM target with a specific version This commit adds the `LC_VERSION_MIN_IPHONEOS` load command to the Mach-O header generated for `aarch64-apple-ios` binaries. The operating system will look for this load command to determine the minimum supported operating system version and will not allow the binary to run if it's absent. This logic already exists for the simulator toolchain. I've been using `otool` from a [cctools](https://github.com/tpoechtrager/cctools-port) toolchain to parse the header and validate that this change adds the required load command. This change appears to be enough to build Rust binaries that can run on a jailbroken iPhone.
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-21Auto merge of #87570 - nikic:llvm-13, r=nagisabors-9/+9
Upgrade to LLVM 13 Work in progress update to LLVM 13. Main changes: * InlineAsm diagnostics reported using SrcMgr diagnostic kind are now handled. Previously these used a separate diag handler. * Codegen tests are updated for additional attributes. * Some data layouts have changed. * Switch `#[used]` attribute from `llvm.used` to `llvm.compiler.used` to avoid SHF_GNU_RETAIN flag introduced in https://reviews.llvm.org/D97448, which appears to trigger a bug in older versions of gold. * Set `LLVM_INCLUDE_TESTS=OFF` to avoid Python 3.6 requirement. Upstream issues: * ~~https://bugs.llvm.org/show_bug.cgi?id=51210 (InlineAsm diagnostic reporting for module asm)~~ Fixed by https://github.com/llvm/llvm-project/commit/1558bb80c01b695ce12642527cbfccf16cf54ece. * ~~https://bugs.llvm.org/show_bug.cgi?id=51476 (Miscompile on AArch64 due to incorrect comparison elimination)~~ Fixed by https://github.com/llvm/llvm-project/commit/81b106584f2baf33e09be2362c35c1bf2f6bfe94. * https://bugs.llvm.org/show_bug.cgi?id=51207 (Can't set custom section flags anymore). Problematic change reverted in our fork, https://reviews.llvm.org/D107216 posted for upstream revert. * https://bugs.llvm.org/show_bug.cgi?id=51211 (Regression in codegen for #83623). This is an optimization regression that we may likely have to eat for this release. The fix for #83623 was based on an incorrect premise, and this needs to be properly addressed in the MergeICmps pass. The [compile-time impact](https://perf.rust-lang.org/compare.html?start=ef9549b6c0efb7525c9b012148689c8d070f9bc0&end=0983094463497eec22d550dad25576a894687002) is mixed, but quite positive as LLVM upgrades go. The LLVM 13 final release is scheduled for Sep 21st. The current nightly is scheduled for stable release on Oct 21st. r? `@ghost`
2021-08-19Auto merge of #88023 - devnexen:fbsd_arm64, r=nagisabors-2/+8
freebsd arm64 add supported sanitizers.