about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-10-21Merge commit 'c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa' into ↵bjorn3-4/+4
sync_cg_clif-2023-10-21
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-0/+3
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-10-09Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into ↵bjorn3-22/+17
sync_cg_clif-2023-10-09
2023-08-09Merge commit '8f9ac9c22d6594cf059d8e6c71d414cc5ccd7975' into ↵bjorn3-0/+7
sync_cg_clif-2023-08-09
2023-07-22Merge commit '1eded3619d0e55d57521a259bf27a03906fdfad0' into ↵bjorn3-2/+0
sync_cg_clif-2023-07-22
2023-06-15Merge commit '8830dccd1d4c74f1f69b0d3bd982a3f1fcde5807' into ↵bjorn3-1/+1
sync_cg_clif-2023-06-15
2023-06-04Updated cranelift codegen to reflect modified trait signatureAndrew Xie-2/+2
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-5/+5
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-04-29Merge commit 'ef07e8e60f994ec014d049a95591426fb92ebb79' into ↵bjorn3-1/+1
sync_cg_clif-2023-04-29
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-03-28Move `mir::Field` → `abi::FieldIdx`Scott McMurray-1/+1
The first PR for https://github.com/rust-lang/compiler-team/issues/606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-1/+1
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-03-15Merge commit 'dec0daa8f6d0a0e1c702f169abb6bf3eee198c67' into ↵bjorn3-7/+8
sync_cg_clif-2023-03-15
2023-02-22Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obkbors-1/+1
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-22various: translation resources from cg backendDavid Wood-0/+5
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-01-25Vendor newer version of cranelift-nativebjorn3-0/+2
It fixes a bug that caused compilation on 32bit x86 to fail
2023-01-24Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into ↵bjorn3-2/+4
sync_cg_clif-2023-01-24
2022-10-23Merge commit '266e96785ab71834b917bf474f130a6d8fdecd4b' into ↵bjorn3-3/+11
sync_cg_clif-2022-10-23
2022-08-24Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into ↵bjorn3-24/+31
sync_cg_clif-2022-08-24
2022-07-28Introduce an ArchiveBuilderBuilderbjorn3-1/+1
This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend.
2022-07-25Merge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into ↵bjorn3-1/+6
sync_cg_clif-2022-07-25
2022-07-13Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwcoDylan DPC-1/+1
Keep unstable target features for asm feature checking Inline assembly uses the target features to determine which registers are available on the current target. However it needs to be able to access unstable target features for this. Fixes #99071
2022-07-11Keep unstable target features for asm feature checkingAmanieu d'Antras-1/+1
Inline assembly uses the target features to determine which registers are available on the current target. However it needs to be able to access unstable target features for this. Fixes #99071
2022-07-06Update TypeVisitor pathsAlan Egerton-1/+1
2022-04-22Merge commit 'f2cdd4a78d89c009342197cf5844a21f8aa813df' into ↵bjorn3-2/+0
sync_cg_clif-2022-04-22
2022-03-20Merge commit '370c397ec9169809e5ad270079712e0043514240' into ↵bjorn3-5/+7
sync_cg_clif-2022-03-20
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-3/+3
2021-12-30Merge commit '40b00f4200fbdeefd11815398cb46394b8cb0a5e' into ↵bjorn3-1/+1
sync_cg_clif-2021-12-30
2021-12-20Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into ↵bjorn3-16/+15
sync_cg_clif-2021-12-20
2021-12-13Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`Tomasz Miąsko-0/+1
The resulting profile will include the crate name and will be stored in the `--out-dir` directory. This implementation makes it convenient to use LLVM time trace together with cargo, in the contrast to the previous implementation which would overwrite profiles or store them in `.cargo/registry/..`.
2021-09-30Move EncodedMetadata to rustc_metadata.Camille GILLOT-1/+1
2021-09-19Merge commit '61667dedf55e3e5aa584f7ae2bd0471336b92ce9' into ↵bjorn3-2/+2
sync_cg_clif-2021-09-19
2021-09-07Move the dataflow framework to its own crate.Camille GILLOT-1/+0
2021-09-05Auto merge of #88499 - eddyb:layout-off, r=nagisabors-2/+2
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-02rustc_target: move `LayoutOf` to `ty::layout`.Eduard-Mihai Burtescu-2/+2
2021-08-27Path remapping: Make behavior of diagnostics output dependent on presence of ↵Michael Woerister-1/+1
--remap-path-prefix.
2021-08-06Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into ↵bjorn3-9/+17
sync_cg_clif-2021-08-06
2021-07-16Consider all fields when comparing DllImports, to remove nondetermininsm in ↵Richard Cobbe-3/+1
multiple-definitions test
2021-07-07Merge commit '3a31c6d8272c14388a34622193baf553636fe470' into ↵bjorn3-5/+9
sync_cg_clif-2021-07-07
2021-07-06Don't pass local_crate_name to link_binary separatelybjorn3-1/+0
It is already part of CodegenResults
2021-06-28Update other codegens to use tcx managed vtable allocations.Charles Lew-1/+1
2021-06-10Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011bors-0/+1
Drop metadata_encoding_version. Part of #85153 r? `@Aaron1011`
2021-06-04Move crate_name field from OngoingCodegen to CrateInfobjorn3-1/+1
2021-06-04Allow printing the version of the default codegen backend if it isn't llvmbjorn3-0/+4
2021-06-04Provide default MetadataLoaderbjorn3-5/+1
2021-06-04Provide a default provide* implementation for CodegenBackendbjorn3-4/+0
Both cg_llvm and cg_clif don't override it. cg_spirv does override it, so it needs to be preserved.
2021-06-01Drop metadata_encoding_version.Camille GILLOT-0/+1
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-1/+0