about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/consts.rs
AgeCommit message (Collapse)AuthorLines
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-3/+3
2022-04-15Add codegen for global_asm! sym operandsAmanieu d'Antras-0/+7
2022-04-05Use WrappingRange::full instead of hand-rolling itOli Scherer-1/+1
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-1/+4
initialized scalars can special case them.
2022-03-14debuginfo: Refactor debuginfo generation for typesMichael Woerister-1/+1
This commit - changes names to use di_node instead of metadata - uniformly names all functions that build new debuginfo nodes build_xyz_di_node - renames CrateDebugContext to CodegenUnitDebugContext (which is more accurate) - moves TypeMap and functions that work directly work with it to a new type_map module - moves and reimplements enum related builder functions to a new enums module - splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate - uses SmallVec instead of Vec in many places - removes the old infrastructure for dealing with recursion cycles (create_and_register_recursive_type_forward_declaration(), RecursiveTypeDescription, set_members_of_composite_type(), MemberDescription, MemberDescriptionFactory, prepare_xyz_metadata(), etc) - adds type_map::build_type_with_children() as a replacement for dealing with recursion cycles - adds many (doc-)comments explaining what's going on - changes cpp-like naming for C-Style enums so they don't get a enum$<...> name (because the NatVis visualizer does not apply to them) - fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields - changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it
2022-03-07Introduce `ConstAllocation`.Nicholas Nethercote-3/+5
Currently some `Allocation`s are interned, some are not, and it's very hard to tell at a use point which is which. This commit introduces `ConstAllocation` for the known-interned ones, which makes the division much clearer. `ConstAllocation::inner()` is used to get the underlying `Allocation`. In some places it's natural to use an `Allocation`, in some it's natural to use a `ConstAllocation`, and in some places there's no clear choice. I've tried to make things look as nice as possible, while generally favouring `ConstAllocation`, which is the type that embodies more information. This does require quite a few calls to `inner()`. The commit also tweaks how `PartialOrd` works for `Interned`. The previous code was too clever by half, building on `T: Ord` to make the code shorter. That caused problems with deriving `PartialOrd` and `Ord` for `ConstAllocation`, so I changed it to build on `T: PartialOrd`, which is slightly more verbose but much more standard and avoided the problems.
2022-02-25Auto merge of #94130 - erikdesjardins:partially, r=nikicbors-22/+19
Use undef for (some) partially-uninit constants There needs to be some limit to avoid perf regressions on large arrays with undef in each element (see comment in the code). Fixes: #84565 Original PR: #83698 Depends on LLVM 14: #93577
2022-02-20add check for llvm 14Erik Desjardins-1/+8
2022-02-19Adopt let else in more placesest31-3/+2
2022-02-19switch to limiting the number of init/uninit chunksErik Desjardins-21/+9
2022-02-18Use undef for partially-uninit constants up to 1024 bytesErik Desjardins-2/+4
There needs to be some limit to avoid perf regressions on large arrays with undef in each element (see comment in the code).
2022-02-06`#[used(linker)]` attribute (https://github.com/dtolnay/linkme/issues/41)cynecx-0/+9
2021-12-16Remove `in_band_lifetimes` from `rustc_codegen_llvm`LegionMammal978-7/+7
See #91867 for more information.
2021-12-09Remove redundant [..]sest31-1/+1
2021-11-10Use more robust checks in rustc for wasmAlex Crichton-1/+1
2021-11-10Update more rustc/libtest things for wasm64Alex Crichton-1/+1
* Add wasm64 variants for inline assembly along the same lines as wasm32 * Update a few directives in libtest to check for `target_family` instead of `target_arch` * Update some rustc codegen and typechecks specialized for wasm32 to also work for wasm64.
2021-10-01Fix clippy lintsGuillaume Gomez-9/+9
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-09-02rustc_target: move `LayoutOf` to `ty::layout`.Eduard-Mihai Burtescu-1/+2
2021-08-25improve commentErik Desjardins-1/+1
2021-08-25don't generate partially-undef constsErik Desjardins-9/+13
2021-08-25use undef for uninitialized bytes in constantsErik Desjardins-13/+54
2021-08-23Rename to WrappingRangeAndreas Liljeqvist-5/+2
2021-08-22Use custom wrap-around type instead of RangeAndreas Liljeqvist-2/+7
2021-08-21Always use llvm.used for coverage symbolsNikita Popov-2/+15
This follows what clang does in CoverageMappingGen. Using just llvm.compiler.used is insufficient at least for MSVC targets.
2021-08-16Use llvm.compiler.used insetad of llvm.usedNikita Popov-1/+1
The #[used] attribute explicitly only requires symbols to be retained in object files, but allows the linker to drop them if dead. This corresponds to llvm.compiler.used semantics. The motivation to change this *now* is that https://reviews.llvm.org/D97448 starts emitting #[used] symbols into unique sections with SHF_GNU_RETAIN flag. This triggers a bug in some version of gold, resulting in the ARGV_INIT_ARRAY symbol part of the .init_array section to be incorrectly placed.
2021-07-14consistently treat None-tagged pointers as ints; get rid of some deprecated ↵Ralf Jung-2/+5
Scalar methods
2021-07-14CTFE/Miri engine Pointer type overhaul: make Scalar-to-Pointer conversion ↵Ralf Jung-1/+1
infallible This resolves all the problems we had around "normalizing" the representation of a Scalar in case it carries a Pointer value: we can just use Pointer if we want to have a value taht we are sure is already normalized.
2021-05-28Fix static relocation model for PowerPC64Boris-Chengbiao Zhou-6/+3
We now also use `should_assume_dso_local()` for declarations and port two additional cases from clang: - Exclude PPC64 [1] - Exclude thread-local variables [2] [1]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1038-L1040 [2]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1048-L1050
2021-05-18Set dso_local for more itemsBoris-Chengbiao Zhou-0/+13
2021-02-14Replace const_cstr with cstr crateXidorn Quan-3/+3
2021-02-04Use is_local instead of as_localbjorn3-2/+2
2021-02-02Avoid a hir access inside get_staticbjorn3-56/+24
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-3/+3
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-04Auto merge of #78280 - bugadani:span, r=lcnrbors-14/+14
Codegen: Query span as late as possible
2020-10-30Fix even more clippy warningsJoshua Nelson-4/+2
2020-10-27Query span as late as possibleDániel Buga-14/+14
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-3/+3
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-09-21Rollup merge of #76962 - est31:const_cstr, r=oli-obkRalf Jung-4/+3
Use const_cstr macro in consts.rs
2020-09-20Use const_cstr macro in consts.rsest31-4/+3
2020-09-19Stop using the `const_eval` query for initializers of staticsOliver Scherer-5/+2
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-04Change ty.kind to a methodLeSeulArtichaut-1/+1
2020-08-30mv compiler to compiler/mark-0/+512