about summary refs log tree commit diff
path: root/src/librustc_target/abi
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-3676/+0
2020-08-14Rework `rustc_serialize`Matthew Jasper-3/+3
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-07-22[AVR] Ensure that function pointers stored within aggregates are annotated ↵Dylan McKay-2/+3
with the correct space Before this patch, a function pointer stored within an aggregate like a struct or an enum would always have the default address space `0`. This patch removes this assumption and instead, introspects the inner type being pointed at, storing the target address space in the PointeeInfo struct so that downstream users may query it.
2020-07-22[AVR] Correctly set the pointer address space when constructing pointers to ↵Dylan McKay-3/+14
functions This patch extends the existing `type_i8p` method so that it requires an explicit address space to be specified. Before this patch, the `type_i8p` method implcitily assumed the default address space, which is not a safe transformation on all targets, namely AVR. The Rust compiler already has support for tracking the "instruction address space" on a per-target basis. This patch extends the code generation routines so that an address space must always be specified. In my estimation, around 15% of the callers of `type_i8p` produced invalid code on AVR due to the loss of address space prior to LLVM final code generation. This would lead to unavoidable assertion errors relating to invalid bitcasts. With this patch, the address space is always either 1) explicitly set to the instruction address space because the logic is dealing with functions which must be placed there, or 2) explicitly set to the default address space 0 because the logic can only operate on data space pointers and thus we keep the existing semantics of assuming the default, "data" address space.
2020-06-19Rollup merge of #72497 - RalfJung:tag-term, r=oli-obkRalf Jung-11/+16
tag/niche terminology cleanup The term "discriminant" was used in two ways throughout the compiler: * every enum variant has a corresponding discriminant, that can be given explicitly with `Variant = N`. * that discriminant is then encoded in memory to store which variant is active -- but this encoded form of the discriminant was also often called "discriminant", even though it is conceptually quite different (e.g., it can be smaller in size, or even use niche-filling). After discussion with @eddyb, this renames the second term to "tag". The way the tag is encoded can be either `TagEncoding::Direct` (formerly `DiscriminantKind::Tag`) or `TagEncoding::Niche` (formerly `DiscrimianntKind::Niche`). This finally resolves some long-standing confusion I had about the handling of variant indices and discriminants, which surfaced in https://github.com/rust-lang/rust/pull/72419. (There is also a `DiscriminantKind` type in libcore, it remains unaffected. I think this corresponds to the discriminant, not the tag, so that seems all right.) r? @eddyb
2020-06-09[AVR] Update ABI type classification logic to match the the AVR-Clang ABIDylan McKay-5/+31
This patch brings the AVR calling convention argument classification logic in line with AVR Clang's behaviour. AVR-Clang currently uses the `clang::DefaultABIInfo` ABI implementation. This calling convention promotes all aggregates to indirect, no matter their size. It is also unnecessary to perform any integer width extension for AVR as the minimum argument size matches the minimum describable size of abi::Primitive::Int - 8 bits. At some point in the future, an AVR-GCC compatible argument classification implementation should be adopted in both Clang and Rust.
2020-06-09[AVR] Add AVR platform supportJake Goulding-0/+37
2020-05-30tag/niche terminology cleanupRalf Jung-11/+16
2020-04-16rustc_target::abi: add Primitive variant to FieldsShape.Ana-Maria Mihalache-9/+29
2020-04-03Replace max/min_value() with MAX/MIN assoc constsLinus Färnstrand-1/+1
2020-04-01Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obkDylan DPC-27/+27
rustc_target::abi: rename FieldPlacement to FieldsShape. Originally suggested by @eddyb.
2020-03-31rustc_target::abi: rename FieldPlacement to FieldsShape.Ana-Maria Mihalache-27/+27
2020-03-30Add `can_unwind` field to `FnAbi`Wesley Wiser-0/+2
This is a pure refactoring with no behavior changes.
2020-03-30Use if let instead of match when only matching a single variant ↵Matthias Krüger-13/+8
(clippy::single_match) Makes code more compact and reduces nestig.
2020-03-27Rename TyLayout to TyAndLayout.Ana-Maria Mihalache-134/+133
2020-03-25Rollup merge of #69700 - anyska:layout-details-rename, r=oli-obkDylan DPC-12/+13
Rename LayoutDetails to just Layout.
2020-03-25Rename LayoutDetails to just Layout.Ana-Maria Mihalache-12/+13
2020-03-25add usize methods for Size gettersRalf Jung-0/+10
2020-03-25make Size::from* methods generic in the integer type they acceptRalf Jung-5/+6
2020-03-25miri: avoid a bunch of casts by offering usized-based field indexingRalf Jung-1/+2
2020-03-21Rollup merge of #70189 - RalfJung:is_signed, r=eddybMazdak Farrokhzad-1/+1
Abi::is_signed: assert that we are a Scalar A bit more sanity checking, suggested by @eddyb. This makes this method actually "safer" than `TyS::is_signed`, so I made sure Miri consistently uses the `Abi` version. Though I am not sure if this would have caught the mistake where the layout of a zero-sized enum was asked for its sign. r? @eddyb
2020-03-20Abi::is_signed: assert that we are a ScalarRalf Jung-1/+1
2020-03-11Rustfmt and adjust capitalizationOliver Scherer-3/+2
2020-03-11Compute the correct layout for variants of uninhabited enums and readd a ↵Oliver Scherer-1/+5
long lost assertion This reverts part of commit 9712fa405944cb8d5416556ac4b1f26365a10658.
2020-03-11Rollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddybMazdak Farrokhzad-0/+85
mem::zeroed/uninit: panic on types that do not permit zero-initialization r? @eddyb @oli-obk Cc https://github.com/rust-lang/rust/issues/62825 Also see [this summary comment](https://github.com/rust-lang/rust/pull/66059#issuecomment-586734747)
2020-03-08Rollup merge of #69646 - RalfJung:layout-visitor, r=eddybMazdak Farrokhzad-1/+1
Miri visitor: detect primitive types based on type, not layout (also, more tests) I also converted the union-based transmutes to use `mem::transmute` for increased readability. r? @eddyb @oli-obk
2020-03-06'fieldless enums' is not what I meant -- it's empty/uninhabited enums, reallyRalf Jung-1/+1
2020-03-06fix various typosMatthias Krüger-4/+4
2020-03-02Auto merge of #69257 - RalfJung:layout-visitor, r=eddybbors-1/+19
Adjust Miri value visitor, and doc-comment layout components I realized that I still didn't have quite the right intuition for how our `LayoutDetails` work, so I had to adjust the Miri value visitor to the things I understood better now. I also added some doc-comments to `LayoutDetails` as a hopefully canonical place to note such things. The main visitor change is that we *first* look at all the fields (according to `FieldPlacement`), and *then* check the variants and handle `Multiple` appropriately. I did not quite realize how orthogonal "fields" and "variants" are. I also moved the check for the scalar ABI to *after* checking all the fields; this leads to better (more type-driven) error messages. And it looks like we can finally remove that magic hack for `ty::Generator`. :D r? @oli-obk for the Miri/visitor changes and @eddyb for the layout docs The Miri PR is at: https://github.com/rust-lang/miri/pull/1178
2020-02-29move pattern to fn argumentRalf Jung-2/+1
2020-02-29we cannot short-circuit just becuase the Abi seems harmlessRalf Jung-50/+13
also add tests for ScalarPair enums
2020-02-29fmtRalf Jung-19/+15
2020-02-29make it even more conservative, and note some FIXMEsRalf Jung-5/+13
2020-02-29use valid_range_exclusive for correct overflow handlingRalf Jung-4/+7
2020-02-29reference tracking issueRalf Jung-3/+4
2020-02-29mem::zeroed/uninit: panic on types that do not permit zero-initializationRalf Jung-0/+115
2020-02-27use char instead of &str for single char patternsMatthias Krüger-3/+3
2020-02-26adjust LayoutDetails commentsRalf Jung-7/+7
2020-02-18doc comments for layout componentsRalf Jung-1/+19
2020-02-08Auto merge of #68452 - msizanoen1:riscv-abi, r=nagisa,eddybbors-15/+330
Implement proper C ABI lowering for RISC-V This is necessary for full RISC-V psABI compliance when passing argument across C FFI boundary. cc @lenary
2020-02-08rustc_target: treat enum variants like union members, in call ABIs.Eduard-Mihai Burtescu-9/+43
2020-02-08rustc_target: switch homogeneous_aggregate to returning Result.Eduard-Mihai Burtescu-67/+86
2020-02-04Implement proper C ABI lowering for RISC-Vmsizanoen1-15/+330
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-25tidy: change msdn links to newer locationsLzu Tao-1/+1
see accouncement at https://docs.microsoft.com/welcome-to-docs
2019-12-22Format the worldMark Rousskov-469/+414
2019-12-11Rollup merge of #67015 - osa1:issue66971, r=wesleywiserMazdak Farrokhzad-0/+8
Fix constant propagation for scalar pairs We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later. Fixes #66971 Fixes #66339 Fixes #67019
2019-12-06const-prop: Restrict scalar pair propagationÖmer Sinan Ağacan-0/+8
We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later. Fixes #66971 Fixes #66339 Fixes #67019
2019-12-06Rename to `then_some` and `then`varkor-5/+5
2019-12-06Use `to_option` in various placesvarkor-37/+5