summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src
AgeCommit message (Collapse)AuthorLines
2025-02-06Revert "Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthewjasper"Rémy Rakic-0/+6
This reverts commit e108481f74ff123ad98a63bd107a18d13035b275, reversing changes made to 303e8bd768526a5812bb1776e798e829ddb7d3ca. (cherry picked from commit ca1c17c88d1f625763859396ba7a50f36ac45cc0)
2024-12-22Delete `Rvalue::Len`Scott McMurray-6/+0
Everything's moved to `PtrMetadata` instead.
2024-12-19Make DependencyList an IndexVecbjorn3-1/+1
2024-12-19Rollup merge of #133702 - RalfJung:single-variant, r=oli-obk许杰友 Jieyou Xu (Joe)-0/+2
Variants::Single: do not use invalid VariantIdx for uninhabited enums ~~Stacked on top of https://github.com/rust-lang/rust/pull/133681, only the last commit is new.~~ Currently, `Variants::Single` for an empty enum contains a `VariantIdx` of 0; looking that up in the enum variant list will ICE. That's quite confusing. So let's fix that by adding a new `Variants::Empty` case for types that have 0 variants. try-job: i686-msvc
2024-12-18chore: fix some typosacceptacross-1/+1
Signed-off-by: acceptacross <csqcqs@gmail.com>
2024-12-18make no-variant types a dedicated Variants variantRalf Jung-3/+4
2024-12-18Variants::Single: do not use invalid VariantIdx for uninhabited enumsRalf Jung-2/+3
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-3/+2
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-14Rollup merge of #134251 - bjorn3:various_cleanups2, r=oli-obkMatthias Krüger-15/+7
A bunch of cleanups (part 2) Just like https://github.com/rust-lang/rust/pull/133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
2024-12-13Make dependency_formats an FxIndexMap rather than a list of tuplesbjorn3-6/+1
It is treated as a map already. This is using FxIndexMap rather than UnordMap because the latter doesn't provide an api to pick a single value iff all values are equal, which each_linked_rlib depends on.
2024-12-13Remove jobserver from Sessionbjorn3-9/+6
It is effectively a global resource and the jobserver::Client in Session was a clone of GLOBAL_CLIENT anyway.
2024-12-11generalize 'forbidden feature' concept so that even (un)stable feature can ↵Ralf Jung-1/+5
be invalid to toggle Also rename some things for extra clarity
2024-12-09Rollup merge of #133567 - bjorn3:various_cleanups, r=cjgillotMatthias Krüger-2/+0
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: https://github.com/rust-lang/rust/pull/132410
2024-12-06Remove polymorphizationBen Kimock-19/+10
2024-12-06Move some timers aroundbjorn3-2/+0
2024-12-06Merge commit '57845a397ec15e4e6a561ed2c4bfa3dcf49144fb' into ↵bjorn3-291/+263
sync_cg_clif-2024-12-06
2024-12-03Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxuMatthias Krüger-14/+4
Lint against Symbol::intern on a string literal Disabled in tests where this doesn't make much sense
2024-12-03Rollup merge of #133395 - calebzulawski:simd_relaxed_fma, r=workingjubileeMatthias Krüger-1/+2
Add simd_relaxed_fma intrinsic Adds compiler support for https://github.com/rust-lang/portable-simd/issues/387#issuecomment-2337169786 r? `@workingjubilee` cc `@RalfJung` is this kind of nondeterminism a problem for miri/opsem?
2024-11-28Replace `Symbol::intern` calls with preinterned symbolsclubby789-14/+4
2024-11-28Rollup merge of #133422 - taiki-e:riscv-e-clobber-abi, r=AmanieuGuillaume Gomez-3/+8
Fix clobber_abi in RV32E and RV64E inline assembly Currently clobber_abi in RV32E and RV64E inline assembly is implemented using InlineAsmClobberAbi::RiscV, but broken since x16-x31 cannot be used in RV32E and RV64E. ``` error: cannot use register `x16`: register can't be used with the `e` target feature --> <source>:42:14 | 42 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); | ^^^^^^^^^^^^^^^^ error: cannot use register `x17`: register can't be used with the `e` target feature --> <source>:42:14 | 42 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); | ^^^^^^^^^^^^^^^^ error: cannot use register `x28`: register can't be used with the `e` target feature --> <source>:42:14 | 42 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); | ^^^^^^^^^^^^^^^^ error: cannot use register `x29`: register can't be used with the `e` target feature --> <source>:42:14 | 42 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); | ^^^^^^^^^^^^^^^^ error: cannot use register `x30`: register can't be used with the `e` target feature --> <source>:42:14 | 42 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); | ^^^^^^^^^^^^^^^^ error: cannot use register `x31`: register can't be used with the `e` target feature --> <source>:42:14 | 42 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); | ^^^^^^^^^^^^^^^^ ``` r? `@Amanieu` `@rustbot` label O-riscv +A-inline-assembly
2024-11-25Rollup merge of #131664 - taiki-e:s390x-asm-vreg-inout, r=AmanieuMatthias Krüger-2/+6
Support input/output in vector registers of s390x inline assembly (under asm_experimental_reg feature) This extends currently clobber-only vector registers (`vreg`) support to allow passing `#[repr(simd)]` types, floats (f32/f64/f128), and integers (i32/i64/i128) as input/output. This is unstable and gated under new `#![feature(asm_experimental_reg)]` (tracking issue: https://github.com/rust-lang/rust/issues/133416). If the feature is not enabled, only clober is supported as before. | Architecture | Register class | Target feature | Allowed types | | ------------ | -------------- | -------------- | -------------- | | s390x | `vreg` | `vector` | `i32`, `f32`, `i64`, `f64`, `i128`, `f128`, `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` | This matches the list of types that are supported by the vector registers in LLVM: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.td#L301-L313 In addition to `core::simd` types and floats listed above, custom `#[repr(simd)]` types of the same size and type are also allowed. All allowed types other than i32/f32/i64/f64/i128, and relevant target features are currently unstable. Currently there is no SIMD type for s390x in `core::arch`, but this is tracked in https://github.com/rust-lang/rust/issues/130869. cc https://github.com/rust-lang/rust/issues/130869 about vector facility support in s390x cc https://github.com/rust-lang/rust/issues/125398 & https://github.com/rust-lang/rust/issues/116909 about f128 support in asm `@rustbot` label +O-SystemZ +A-inline-assembly
2024-11-25Fix clobber_abi in RV32E and RV64E inline assemblyTaiki Endo-3/+8
2024-11-24Make s390x non-clobber-only vector register support unstableTaiki Endo-2/+6
2024-11-23Add simd_relaxed_fma intrinsicCaleb Zulawski-1/+2
2024-11-23remove remaining references to `Reveal`lcnr-26/+32
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-0/+2
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-1/+5
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-3/+3
2024-11-18Auto merge of #132460 - lcnr:questionable-uwu, r=compiler-errorsbors-42/+55
Use `TypingMode` throughout the compiler instead of `ParamEnv` Hopefully the biggest single PR as part of https://github.com/rust-lang/types-team/issues/128. ## `infcx.typing_env` while defining opaque types I don't know how'll be able to correctly handle opaque types when using something taking a `TypingEnv` while defining opaque types. To correctly handle the opaques we need to be able to pass in the current `opaque_type_storage` and return constraints, i.e. we need to use a proper canonical query. We should migrate all the queries used during HIR typeck and borrowck where this matters to proper canonical queries. This is ## `layout_of` and `Reveal::All` We convert the `ParamEnv` to `Reveal::All` right at the start of the `layout_of` query, so I've changed callers of `layout_of` to already use a post analysis `TypingEnv` when encountering it. https://github.com/rust-lang/rust/blob/ca87b535a05097df6abbe2a031b057de2cefac5b/compiler/rustc_ty_utils/src/layout.rs#L51 ## `Ty::is_[unpin|sized|whatever]` I haven't migrated `fn is_item_raw` to use `TypingEnv`, will do so in a followup PR, this should significantly reduce the amount of `typing_env.param_env`. At some point there will probably be zero such uses as using the type system while ignoring the `typing_mode` is incorrect. ## `MirPhase` and phase-transitions When inside of a MIR-body, we can mostly use its `MirPhase` to figure out the right `typing_mode`. This does not work during phase transitions, most notably when transitioning from `Analysis` to `Runtime`: https://github.com/rust-lang/rust/blob/dae7ac133b9eda152784c075facb31a6688c92b1/compiler/rustc_mir_transform/src/lib.rs#L606-L625 All these passes still run with `MirPhase::Analysis`, but we should only use `Reveal::All` once we're run the `RevealAll` pass. This required me to manually construct the right `TypingEnv` in all these passes. Given that it feels somewhat easy to accidentally miss this going forward, I would maybe like to change `Body::phase` to an `Option` and replace it at the start of phase transitions. This then makes it clear that the MIR is currently in a weird state. r? `@ghost`
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-42/+55
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-18remove pointless cold_path impl in interpreterRalf Jung-0/+1
2024-11-17Likely unlikely fixJiri Bobek-5/+4
2024-11-09Add a default implementation for CodegenBackend::linkbjorn3-25/+0
As a side effect this should add raw-dylib support to cg_gcc as the default ArchiveBuilderBuilder that is used implements create_dll_import_lib. I haven't tested if the raw-dylib support actually works however.
2024-11-09Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into ↵bjorn3-23/+32
sync_cg_clif-2024-11-09
2024-11-07 remove 'platform-intrinsic' ABI leftoversRalf Jung-2/+2
2024-11-03Auto merge of #132526 - bjorn3:sync_cg_clif-2024-11-02, r=bjorn3bors-32/+50
Subtree sync for rustc_codegen_cranelift The highlight this time is an update to Cranelift 0.113, r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-11-02Rename target triple to target tuple in many places in the compilerNoratrieb-2/+2
This changes the naming to the new naming, used by `--print target-tuple`. It does not change all locations, but many.
2024-11-02Merge commit '5b1246bb4bed72fd0bb8fa497d8e5ed2c7f3515c' into ↵bjorn3-32/+50
sync_cg_clif-2024-11-02
2024-11-01Move versioned LLVM target creation to rustc_codegen_ssaMads Marquart-1/+4
The OS version depends on the deployment target environment variables, the access of which we want to move to later in the compilation pipeline that has access to more information, for example `env_depinfo`.
2024-10-29cg_clif: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-53/+62
2024-10-27cg_clif: Rename LayoutS to LayoutDataJubilee Young-1/+1
2024-10-26Effects cleanupDeadbeef-1/+0
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-19Fix testsMichael Goulet-4/+9
2024-10-17Allow dropping dyn principalMichael Goulet-1/+3
2024-10-11intrinsics.fmuladdf{16,32,64,128}: expose llvm.fmuladd.* semanticsJed Brown-1/+4
Add intrinsics `fmuladd{f16,f32,f64,f128}`. This computes `(a * b) + c`, to be fused if the code generator determines that (i) the target instruction set has support for a fused operation, and (ii) that the fused operation is more efficient than the equivalent, separate pair of `mul` and `add` instructions. https://llvm.org/docs/LangRef.html#llvm-fmuladd-intrinsic MIRI support is included for f32 and f64. The codegen_cranelift uses the `fma` function from libc, which is a correct implementation, but without the desired performance semantic. I think this requires an update to cranelift to expose a suitable instruction in its IR. I have not tested with codegen_gcc, but it should behave the same way (using `fma` from libc).
2024-10-08cg_clif: Factor out rustc_target::abiJubilee Young-1/+3
2024-10-06various fixes for `naked_asm!` implementationFolkert de Vries-0/+3
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
2024-10-04Use wide pointers consistenly across the compilerUrgau-7/+7
2024-09-30Relax a debug assertion in codegenMichael Goulet-14/+3
2024-09-25Add a debug assertion in codegen that unsize casts of the same principal ↵Michael Goulet-1/+16
trait def id are truly NOPs