about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir/constant.rs
AgeCommit message (Collapse)AuthorLines
2025-07-23Remove useless lifetime parameter.Camille GILLOT-1/+1
2025-03-15Stop relying on rustc_type_ir in non-type-system cratesMichael Goulet-1/+1
2025-01-30introduce `ty::Value`Lukas Markeffsky-1/+1
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-3/+3
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-10-29compiler: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-2/+2
The initial naming of "Abi" was an awful mistake, conveying wrong ideas about how psABIs worked and even more about what the enum meant. It was only meant to represent the way the value would be described to a codegen backend as it was lowered to that intermediate representation. It was never meant to mean anything about the actual psABI handling! The conflation is because LLVM typically will associate a certain form with a certain ABI, but even that does not hold when the special cases that actually exist arise, plus the IR annotations that modify the ABI. Reframe `rustc_abi::Abi` as the `BackendRepr` of the type, and rename `BackendRepr::Aggregate` as `BackendRepr::Memory`. Unfortunately, due to the persistent misunderstandings, this too is now incorrect: - Scattered ABI-relevant code is entangled with BackendRepr - We do not always pre-compute a correct BackendRepr that reflects how we "actually" want this value to be handled, so we leave the backend interface to also inject various special-cases here - In some cases `BackendRepr::Memory` is a "real" aggregate, but in others it is in fact using memory, and in some cases it is a scalar! Our rustc-to-backend lowering code handles this sort of thing right now. That will eventually be addressed by lifting duplicated lowering code to either rustc_codegen_ssa or rustc_target as appropriate.
2024-09-17Clean up formatting.Nicholas Nethercote-10/+11
Reflow overly long comments, plus some minor whitespace improvements.
2024-09-17Minimize visibilities.Nicholas Nethercote-2/+2
This makes it much clearer which things are used outside the crate.
2024-09-14simd_shuffle: require index argument to be a vectorRalf Jung-24/+11
2024-08-08const vector passed to codegenJames Barford-Evans-10/+29
2024-07-29Reformat `use` declarations.Nicholas Nethercote-5/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-18valtree construction: keep track of which type was valtree-incompatibleRalf Jung-2/+3
2024-06-05Add `Ty` to `mir::Const::Ty`Boxy-1/+1
2024-06-05Add `Ty` to `ConstKind::Value`Boxy-1/+1
2024-04-29Remove `extern crate rustc_middle` from numerous crates.Nicholas Nethercote-0/+1
2024-03-18Avoid various uses of `Option<Span>` in favor of using `DUMMY_SP` in the few ↵Oli Scherer-6/+2
cases that used `None`
2024-03-10add comments explaining where post-mono const eval errors abort compilationRalf Jung-3/+3
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-1/+1
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-10-06add some comments explaining how the required_consts stuff fits togetherRalf Jung-0/+2
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-10/+10
2023-09-19move ConstValue into mirRalf Jung-2/+2
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-23/+5
2023-09-13make the eval() functions on our const types return the resulting valueRalf Jung-32/+20
2023-07-20Monomorphize constants before inspecting themOli Scherer-1/+1
2023-07-18Permit pre-evaluated constants in simd_shuffleOli Scherer-0/+14
2023-06-26Move mir const to valtree conversion to its own method.Oli Scherer-7/+24
2023-06-26Make simd_shuffle_indices use valtreesOli Scherer-12/+11
2022-12-27ADD - create and emit Bug support for DiagnosticsJhonny Bill Mena-1/+5
UPDATE - migrate constant span_bug to translatable diagnostic.
2022-12-27UPDATE - migrate constant.rs to new diagnostics infrastructureJhonny Bill Mena-2/+3
2022-11-19deduplicate constant evaluation in cranelift backendRalf Jung-1/+8
also sync LLVM and cranelift structure a bit
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-18/+18
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-4/+4
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-2/+2
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-02-19Adopt let else in more placesest31-3/+2
2022-02-15Overhaul `Const`.Nicholas Nethercote-4/+4
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as this: ``` pub struct Const<'tcx>(&'tcx Interned<ConstS>); ``` This now matches `Ty` and `Predicate` more closely, including using pointer-based `eq` and `hash`. Notable changes: - `mk_const` now takes a `ConstS`. - `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a we need separate arena for it, because we can't use the `Dropless` one any more. - Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes - Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes. - Lots of tedious sigil fiddling.
2021-09-09Make `abi::Abi` `Copy` and remove a *lot* of refsAndreas Liljeqvist-1/+1
fix fix Remove more refs and clones fix more fix
2021-03-20update `const_eval_resolve`lcnr-2/+2
2021-03-20extract `ConstKind::Unevaluated` into a structlcnr-1/+1
2021-03-15s/ConstantSource/ConstantKind/Oli Scherer-2/+2
2021-03-12Prepare mir::Constant for ty::Const only supporting valtreesOli Scherer-1/+6
2021-03-12Add `ty` helper function for mir constantsOli Scherer-1/+1
This is in preparation of the `literal` field becoming an enum that distinguishes between type level constants and runtime constants
2021-01-24clean up some const error reporting around promotedsRalf Jung-6/+1
2020-12-06[mir-opt] Allow debuginfo to be generated for a constant or a PlaceWesley Wiser-2/+2
Prior to this commit, debuginfo was always generated by mapping a name to a Place. This has the side-effect that `SimplifyLocals` cannot remove locals that are only used for debuginfo because their other uses have been const-propagated. To allow these locals to be removed, we now allow debuginfo to point to a constant value. The `ConstProp` pass detects when debuginfo points to a local with a known constant value and replaces it with the value. This allows the later `SimplifyLocals` pass to remove the local.
2020-11-16compiler: fold by valueBastian Kauschke-3/+3
2020-08-30mv compiler to compiler/mark-0/+91