about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/common.rs
AgeCommit message (Collapse)AuthorLines
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-2/+2
is immutable
2023-11-15Ensure strings created with `const_str` get the `unnamed_addr` attributeThom Chiovoloni-0/+1
2023-08-01Auto merge of #105545 - erikdesjardins:ptrclean, r=bjorn3bors-14/+4
cleanup: remove pointee types This can't be merged until the oldest LLVM version we support uses opaque pointers, which will be the case after #114148. (Also note `-Cllvm-args="-opaque-pointers=0"` can technically be used in LLVM 15, though I don't think we should support that configuration.) I initially hoped this would provide some minor perf win, but in https://github.com/rust-lang/rust/pull/105412#issuecomment-1341224450 it had very little impact, so this is only valuable as a cleanup. As a followup, this will enable #96242 to be resolved. r? `@ghost` `@rustbot` label S-blocked
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-2/+2
2023-07-29cg_ssa: remove pointee types and pointercast/bitcast-of-ptrErik Desjardins-5/+1
2023-07-29cg_llvm: remove pointee types and pointercast/bitcast-of-ptrErik Desjardins-9/+3
2023-07-10Reuse LLVMConstInBoundsGEP2Jubilee Young-2/+2
We have had LLVM 14 as our minimum for a bit now.
2023-06-10Support 128-bit enum variant in debuginfo codegenDonoughLiu-0/+4
2023-05-26Stop creating intermediate places just to immediate convert them to operandsOli Scherer-32/+17
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-2/+2
2023-04-01use and_then/flat_map for map().flatten()Matthias Krüger-2/+1
2023-03-16Use poison instead of undefNikita Popov-0/+4
In cases where it is legal, we should prefer poison values over undef values. This replaces undef with poison for aggregate construction and for uninhabited types. There are more places where we can likely use poison, but I wanted to stay conservative to start with. In particular the aggregate case is important for newer LLVM versions, which are not able to handle an undef base value during early optimization due to poison-propagation concerns.
2023-02-25Name LLVM anonymous constants by a hash of their contentsJohn Kåre Alsaker-2/+8
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-2/+2
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2022-09-09Introduce a fallible variant of LLVMConstIntGetZExtValueTomasz Miąsko-1/+5
which verifies that a constant bit width is within 64 bits or fails.
2022-09-06Remove dead broken code from const zst handling in backendsOli Scherer-4/+0
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-26Implementation of import_name_typeDaniel Paoliello-0/+76
2022-07-20slightly cleaner, if more verbose, vtable handling in codegen backendsRalf Jung-8/+9
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-2/+2
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-0/+8
2022-07-09don't allow ZST in ScalarIntRalf Jung-5/+4
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
2022-07-08Auto merge of #98638 - bjorn3:less_string_interning, r=tmiaskobors-17/+21
Use less string interning This removes string interning in a couple of places where doing so won't result in perf improvements. I also switched one place to use pre-interned symbols.
2022-06-30llvm-wrapper: adapt for LLVMConstExtractValue removalKrasimir Georgiev-2/+1
2022-06-28Avoid unnecessary string interning for const_strbjorn3-17/+21
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-5/+5
initialized scalars can special case them.
2022-04-02make memcmp return a value of c_int_width instead of i32David Morrison-0/+4
2022-03-07Auto merge of #94638 - erikdesjardins:noextranull, r=nagisabors-28/+16
cleanup: remove unused ability to have LLVM null-terminate const strings (and the copied function in rustc_codegen_gcc) Noticed this while writing https://github.com/rust-lang/rust/pull/94450#issuecomment-1059687348. r? `@nagisa`
2022-03-07Introduce `ConstAllocation`.Nicholas Nethercote-6/+8
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-03-06cleanup: remove unused ability to have LLVM null-terminate const stringsErik Desjardins-28/+16
2021-12-16Remove `in_band_lifetimes` from `rustc_codegen_llvm`LegionMammal978-6/+10
See #91867 for more information.
2021-12-09Remove redundant [..]sest31-1/+1
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-2/+3
2021-08-04Replace LLVMConstInBoundsGEP with LLVMConstInBoundsGEP2*Tomasz Miąsko-2/+4
A custom reimplementation of LLVMConstInBoundsGEP2 is used, since the LLVM contains a declaration of LLVMConstInBoundsGEP2 but not the implementation.
2021-07-14consistently treat None-tagged pointers as ints; get rid of some deprecated ↵Ralf Jung-1/+1
Scalar methods
2021-07-14CTFE/Miri engine Pointer type overhaul: make Scalar-to-Pointer conversion ↵Ralf Jung-3/+4
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-06-28Update other codegens to use tcx managed vtable allocations.Charles Lew-0/+4
2020-12-22Update and improve `rustc_codegen_{llvm,ssa}` docsCamelid-0/+1
These docs were very out of date and misleading. They even said that they codegen'd the *AST*! For some reason, the `rustc_codegen_ssa::base` docs were exactly identical to the `rustc_codegen_llvm::base` docs. They didn't really make sense, because they had LLVM-specific information even though `rustc_codegen_ssa` is supposed to be somewhat generic. So I removed them as they were misleading.
2020-11-04s/Scalar::Raw/Scalar::Intoli-2/+2
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-4/+4
2020-10-21rustc_codegen_llvm: expose DILocation to rustc_codegen_ssa.Eduard-Mihai Burtescu-0/+1
2020-10-21rustc_codegen_llvm: move DISubprogram creation to a dbg_scope_fn method.Eduard-Mihai Burtescu-0/+1
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-2/+0
2020-08-30mv compiler to compiler/mark-0/+341