about summary refs log tree commit diff
path: root/compiler/rustc_target/src/abi
AgeCommit message (Collapse)AuthorLines
2023-07-18support for mips32r6 as a target_arch valuechenx97-1/+1
2023-07-18merge patternschenx97-2/+1
2023-07-18support for mips64r6 as a target_arch valuechenx97-0/+1
2023-07-14i686-windows: make requested alignment > 4 special case apply transitivelyErik Desjardins-4/+4
2023-07-10aarch64-linux: properly handle 128bit aligned aggregatesErik Desjardins-36/+44
2023-07-10repr(align) <= 4 should still be byvalErik Desjardins-2/+6
2023-07-10move has_repr to layout, handle repr(transparent) properlyErik Desjardins-15/+2
2023-07-10i686-windows: pass arguments with requested alignment > 4 indirectlyErik Desjardins-4/+33
2023-07-10implement vector-containing aggregate alignment for x86 darwinErik Desjardins-31/+51
2023-07-10rustc_target: Add alignment to indirectly-passed by-value types, correcting thePatrick Walton-13/+47
alignment of `byval` on x86 in the process. Commit 88e4d2c2918428d55e34cd57c11279ea839c8822 from five years ago removed support for alignment on indirectly-passed arguments because of problems with the `i686-pc-windows-msvc` target. Unfortunately, the `memcpy` optimizations I recently added to LLVM 16 depend on this to forward `memcpy`s. This commit attempts to fix the problems with `byval` parameters on that target and now correctly adds the `align` attribute. The problem is summarized in [this comment] by @eddyb. Briefly, 32-bit x86 has special alignment rules for `byval` parameters: for the most part, their alignment is forced to 4. This is not well-documented anywhere but in the Clang source. I looked at the logic in Clang `TargetInfo.cpp` and tried to replicate it here. The relevant methods in that file are `X86_32ABIInfo::getIndirectResult()` and `X86_32ABIInfo::getTypeStackAlignInBytes()`. The `align` parameter attribute for `byval` parameters in LLVM must match the platform ABI, or miscompilations will occur. Note that this doesn't use the approach suggested by eddyb, because I felt it was overkill to store the alignment in `on_stack` when special handling is really only needed for 32-bit x86. As a side effect, this should fix #80127, because it will make the `align` parameter attribute for `byval` parameters match the platform ABI on LLVM x86-64. [this comment]: https://github.com/rust-lang/rust/pull/80822#issuecomment-829985417
2023-07-03abi: avoid ice for non-ffi-safe fn ptrsDavid Wood-4/+6
Remove an `unwrap` that assumed FFI-safe types in foreign fn-ptr types. Signed-off-by: David Wood <david.wood@huawei.com>
2023-06-02Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errorsbors-1/+1
Rollup of 7 pull requests Successful merges: - #111670 (Require that const param tys implement `ConstParamTy`) - #111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - #112030 (Migrate `item_trait_alias` to Askama) - #112150 (Support 128-bit atomics on all x86_64 Apple targets) - #112174 (Fix broken link) - #112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - #112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - #112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-02Fix broken linkcui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-11/+0
2023-05-11Rollup merge of #111375 - rcvalle:rust-cfi-fix-106547, r=bjorn3Michael Goulet-4/+4
CFI: Fix SIGILL reached via trait objects Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.
2023-05-09CFI: Fix SIGILL reached via trait objectsRamon de C Valle-4/+4
Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.
2023-05-07Use smaller ints for bitflagsNilstrieb-1/+1
2023-04-21offset_ofDrMeepster-0/+15
2023-04-17Spelling - compilerJosh Soref-1/+1
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-02-15Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8KiDylan DPC-46/+2
Remove some superfluous type parameters from layout.rs. Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-5/+5
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-22rustc_abi: remove Primitive::{is_float,is_int}Erik Desjardins-3/+3
there were fixmes for this already i am about to remove is_ptr (since callers need to properly distinguish between pointers in different address spaces), so might as well do this at the same time
2023-01-21Remove some superfluous type parameters from layout.rs.Michael Benfield-46/+2
Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-01-06Auto merge of #106474 - erikdesjardins:noalias, r=bjorn3bors-6/+1
cleanup: handle -Zmutable-noalias like -Zbox-noalias r? `@bjorn3` cc `@RalfJung` this will conflict with #106180
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-4/+4
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-04cleanup: handle -Zmutable-noalias like -Zbox-noaliasErik Desjardins-6/+1
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-4/+4
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-2/+1
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Use `#[derive]` instead of custom syntax in all `newtype_index`Nilstrieb-1/+1
2022-12-01Remove useless borrows and derefsMaybe Waffle-2/+2
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-2469/+12
2022-11-24move some layout logic to rustc_target::abi::layouthkalbasi-7/+1087
2022-11-24make rustc_target usable outside of rustchkalbasi-34/+93
2022-11-19Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3Dylan DPC-0/+28
Improve generating Custom entry function This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-13add is_sized method on Abi and Layout, and use itRalf Jung-0/+10
2022-11-11Improve generating Custom entry functionAyush Singh-0/+28
This commit is aimed at making compiler generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-10Rollup merge of #101939 - zhaixiaojuan:loongarch64-abi, r=oli-obkManish Goregaokar-0/+344
Add loongarch64 abi support
2022-10-14more dupe word typosRageking8-1/+1
2022-10-12Use `tidy-alphabetical` in the compilerNilstrieb-1/+2
2022-10-05change might_permit_raw_init to fully detect LLVM UB, but not more than thatRalf Jung-69/+1
2022-09-17Add loongarch64 abi supportzhaixiaojuan-0/+344
2022-09-16Auto merge of #97800 - ↵bors-8/+42
pnkfelix:issue-97463-fix-aarch64-call-abi-does-not-zeroext, r=wesleywiser Aarch64 call abi does not zeroext (and one cannot assume it does so) Fix #97463
2022-09-08translations(rustc_session): migrate TargetDataLayout::parseLuis Cardoso-26/+37
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-2/+2
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-22/+15
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-8/+8
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Change `FnAbi::args` to a boxed slice.Nicholas Nethercote-25/+25
2022-08-26Change `FnAbi::fixed_count` to a `u32`.Nicholas Nethercote-3/+3
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-5/+5
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.