about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2019-09-04Remove `LocalInternedString` uses from `librustc/ty/`.Nicholas Nethercote-4/+4
This is not a compelling change in isolation, but it is a necessary step.
2019-09-02Auto merge of #63561 - HeroicKatora:alloc-private-bytes, r=oli-obkbors-9/+50
Make Allocation::bytes private Fixes #62931. Direct immutable access to the bytes is still possible but redirected through the new method `raw_bytes_with_undef_and_ptr`, similar to `get_bytes_with_undef_and_ptr` but without requiring an interpretation context and not doing *any* relocation or bounds checks. The `size` of the allocation is stored separately which makes access as `Size` and `usize` more ergonomic. cc: @RalfJung
2019-08-30Fixup remaining direct relocation field referencesAndreas Molzer-4/+4
2019-08-29`new_sized` is mostly used without alignDante-Broggi-3/+3
so rename it `new_sized_aligned`. 6/11 use `align` = `layout.align.abi`. `from_const_alloc` uses `alloc.align`, but that is `assert_eq!` to `layout.align.abi`. only 4/11 use something interesting for `align`.
2019-08-29Rollup merge of #63956 - alexcrichton:fix-lto-all-cached, r=michaelwoeristerMazdak Farrokhzad-48/+45
rustc: Handle modules in "fat" LTO more robustly When performing a "fat" LTO the compiler has a whole mess of codegen units that it links together. To do this it needs to select one module as a "base" module and then link everything else into this module. Previously LTO passes assume that there's at least one module in-memory to link into, but nowadays that's not always true! With incremental compilation modules may actually largely be cached and it may be possible that there's no in-memory modules to work with. This commit updates the logic of the LTO backend to handle modules a bit more uniformly during a fat LTO. This commit immediately splits them into two lists, one serialized and one in-memory. The in-memory list is then searched for the largest module and failing that we simply deserialize the first serialized module and link into that. This refactoring avoids juggling three lists, two of which are serialized modules and one of which is half serialized and half in-memory. Closes #63349
2019-08-28Address naming and comments from reviewsAndreas Molzer-3/+3
2019-08-27rustc: Handle modules in "fat" LTO more robustlyAlex Crichton-48/+45
When performing a "fat" LTO the compiler has a whole mess of codegen units that it links together. To do this it needs to select one module as a "base" module and then link everything else into this module. Previously LTO passes assume that there's at least one module in-memory to link into, but nowadays that's not always true! With incremental compilation modules may actually largely be cached and it may be possible that there's no in-memory modules to work with. This commit updates the logic of the LTO backend to handle modules a bit more uniformly during a fat LTO. This commit immediately splits them into two lists, one serialized and one in-memory. The in-memory list is then searched for the largest module and failing that we simply deserialize the first serialized module and link into that. This refactoring avoids juggling three lists, two of which are serialized modules and one of which is half serialized and half in-memory. Closes #63349
2019-08-25debuginfo: give unique names to closure and generator typesPhilip Craig-3/+7
Closure types have been moved to the namespace where they are defined, and both closure and generator type names now include the disambiguator. This fixes an exception when lldb prints nested closures. Fixes #57822
2019-08-21Fix codegen with explicit allocation byte accessAndreas Molzer-7/+48
2019-08-18Auto merge of #63635 - oli-obk:default-slice-dangles, r=eddybbors-9/+15
Do not generate allocations for zero sized allocations Alternative to https://github.com/rust-lang/rust/issues/62487 r? @eddyb There are other places where we could do this, too, but that would cause `static FOO: () = ();` to not have a unique address
2019-08-17Cast only where necessaryOliver Scherer-4/+5
2019-08-17Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}Matthew Jasper-3/+4
We now store it in the `Span` of the expression or item.
2019-08-16Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.Eduard-Mihai Burtescu-4/+4
2019-08-16Do not generate allocations for zero sized allocationsOliver Scherer-8/+13
2019-08-11Auto merge of #63343 - ishitatsuyuki:revert-62150, r=RalfJungbors-1/+1
Back out #62150 Ref: #62825 cc @RalfJung
2019-08-10Revert "Rollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung"Tatsuyuki Ishi-1/+1
This reverts commit 1d45156866b54c3fc36edfdfcdd8149ad9cb5711, reversing changes made to 0f92eb8a4a7d8715381f5b5d748d22315f6ff9c7.
2019-08-08Explain why we're sorting the modules.Joel Galenson-0/+1
2019-08-08Sort fat LTO modules later and add a test.Joel Galenson-2/+4
2019-08-07Auto merge of #61919 - alexreg:fix-atb-1, r=nikomatsakisbors-7/+7
Fix for "ambiguous associated type" issue with ATBs Fixes #61752. r? @nikomatsakis CC @Centril
2019-08-07Auto merge of #63152 - estebank:big-array, r=oli-obkbors-1/+6
Always error on `SizeOverflow` during mir evaluation Fix #55878, fix #25116. r? @oli-obk
2019-08-06Rollup merge of #63296 - alexcrichton:deduplicate-demangle, r=Mark-SimulacrumMazdak Farrokhzad-1/+1
Deduplicate rustc_demangle in librustc_codegen_llvm This commit removes the crates.io dependency of `rustc-demangle` from `rustc_codegen_llvm`. This crate is actually already pulled in to part of the `librustc_driver` build and with the upcoming pipelining implementation in Cargo it causes build issues if `rustc-demangle` is left to its own devices. This is not currently required, but once pipelining is enabled for rustc's own build it will be required to build correctly.
2019-08-05Fiddle param env through to `try_eval_bits` in most placesOliver Scherer-1/+1
2019-08-05Don't abort on unevaluated constants without at least tryting to eval themOliver Scherer-1/+1
2019-08-05A few cosmetic improvements.Alexander Regueiro-7/+7
2019-08-04tweak output and testsEsteban Küber-4/+1
2019-08-04review comments: clean upEsteban Küber-3/+3
2019-08-03Simplify change to layout_ofEsteban Küber-4/+0
2019-08-03Point to local place span on "type too big" errorEsteban Küber-1/+13
2019-08-02assert consistencyRalf Jung-3/+3
2019-08-02CTFE: simplify Value type by not checking for alignmentRalf Jung-4/+4
2019-08-01Use Rust integer types instead of libc's fixed-width typesgnzlbg-2/+2
2019-07-31Deduplicate rustc_demangle in librustc_codegen_llvmAlex Crichton-1/+1
This commit removes the crates.io dependency of `rustc-demangle` from `rustc_codegen_llvm`. This crate is actually already pulled in to part of the `librustc_driver` build and with the upcoming pipelining implementation in Cargo it causes build issues if `rustc-demangle` is left to its own devices. This is not currently required, but once pipelining is enabled for rustc's own build it will be required to build correctly.
2019-07-29Rollup merge of #62809 - alexcrichton:wasm-llvm-9, r=nikicMazdak Farrokhzad-2/+20
rustc: Update wasm32 support for LLVM 9 This commit brings in a number of minor updates for rustc's support for the wasm target which has changed in the LLVM 9 update. Notable updates include: * The compiler now no longer manually inserts the `producers` section, instead relying on LLVM to do so. LLVM uses the `llvm.ident` metadata for the `processed-by` directive (which is now emitted on the wasm target in this PR) and it uses debuginfo to figure out what `language` to put in the `producers` section. * Threaded WebAssembly code now requires different flags to be passed with LLD. In LLD we now pass: * `--shared-memory` - required since objects are compiled with atomics. This also means that the generated memory will be marked as `shared`. * `--max-memory=1GB` - required with the `--shared-memory` argument since shared memories in WebAssembly must have a maximum size. The 1GB number is intended to be a conservative estimate for rustc, but it should be overridable with `-C link-arg` if necessary. * `--passive-segments` - this has become the default for multithreaded memory, but when compiling a threaded module all data segments need to be marked as passive to ensure they don't re-initialize memory for each thread. This will also cause LLD to emit a synthetic function to initialize memory which users will have to arrange to call. * The `__heap_base` and `__data_end` globals are explicitly exported since they're now hidden by default due to the `--export` flags we pass to LLD.
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-1/+0
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-11/+3
rustbuild Remove some random unnecessary lint `allow`s
2019-07-26Rollup merge of #62828 - nikic:fadd-mul-reductions, r=eddybMazdak Farrokhzad-50/+11
Remove vector fadd/fmul reduction workarounds The bugs that this was working around have been fixed in LLVM 9. r? @gnzlbg
2019-07-25Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichtonMazdak Farrokhzad-4/+2
Turn `#[global_allocator]` into a regular attribute macro It was a 99% macro with exception of some diagnostic details. As a result of the change, `#[global_allocator]` now works in nested modules and even in nameless blocks. Fixes https://github.com/rust-lang/rust/issues/44113 Fixes https://github.com/rust-lang/rust/issues/58072
2019-07-25rustc: Update wasm32 support for LLVM 9Alex Crichton-2/+20
This commit brings in a number of minor updates for rustc's support for the wasm target which has changed in the LLVM 9 update. Notable updates include: * The compiler now no longer manually inserts the `producers` section, instead relying on LLVM to do so. LLVM uses the `llvm.ident` metadata for the `processed-by` directive (which is now emitted on the wasm target in this PR) and it uses debuginfo to figure out what `language` to put in the `producers` section. * Threaded WebAssembly code now requires different flags to be passed with LLD. In LLD we now pass: * `--shared-memory` - required since objects are compiled with atomics. This also means that the generated memory will be marked as `shared`. * `--max-memory=1GB` - required with the `--shared-memory` argument since shared memories in WebAssembly must have a maximum size. The 1GB number is intended to be a conservative estimate for rustc, but it should be overridable with `-C link-arg` if necessary. * `--passive-segments` - this has become the default for multithreaded memory, but when compiling a threaded module all data segments need to be marked as passive to ensure they don't re-initialize memory for each thread. This will also cause LLD to emit a synthetic function to initialize memory which users will have to arrange to call. * The `__heap_base` and `__data_end` globals are explicitly exported since they're now hidden by default due to the `--export` flags we pass to LLD.
2019-07-25Rollup merge of #62814 - androm3da:hexagon_19jul_2019, r=alexcrichtonMazdak Farrokhzad-1/+1
add support for hexagon-unknown-linux-musl
2019-07-24Merge `rustc_allocator` into `libsyntax_ext`Vadim Petrochenkov-4/+2
2019-07-22add support for hexagon-unknown-linux-muslBrian Cain-1/+1
2019-07-20Remove vector fadd/fmul reduction workaroundsNikita Popov-50/+11
The bugs that this was working around have been fixed in LLVM 9.
2019-07-19hygiene: Tweak naming some moreVadim Petrochenkov-1/+1
2019-07-15Don't add extra passes into the function pass managerNikita Popov-39/+52
Exception for specific cases like linting, additional passes should be going into the module pass manager (even if they are function passes). The separate function pass manager is only used for very early optimization passes. Rather than apparending passes to the MPM, use the OptimizerLast and EnabledOnOptLevel0 pass manager builder extension hooks, which allow adding passes directly before finalization (alias canonicalization and name-anon-globals). The main effect and purpose of this change is to add sanitizer passes at the end of the pipeline, which is where they belong. In LLVM 9 the address sanitizer can't be used as a pass in the early function pass manager, because it has a dependence on a module-level analysis pass.
2019-07-10Rollup merge of #62474 - nikic:update-llvm, r=alexcrichtonMazdak Farrokhzad-38/+87
Prepare for LLVM 9 update Main changes: * In preparation for opaque pointer types, the `byval` attribute now takes a type. As such, the argument type needs to be threaded through to the function/callsite attribute application logic. * On ARM the `+fp-only-sp` and `+d16` features have become `-fp64` and `-d32`. I've switched the target definitions to use the new names, but also added bidirectional emulation so either can be used on any LLVM version for backwards compatibility. * The datalayout can now specify function pointer alignment. In particular on ARM `Fi8` is specified, which means that function pointer alignment is independent of function alignment. I've added this to our datalayouts to match LLVM (which is something we check) and strip the fnptr alignment for older LLVM versions. * The fmul/fadd reductions now always respect the accumulator (including for unordered reductions), so we should pass the identity instead of undef. Open issues: * https://reviews.llvm.org/D62106 causes linker errors with ld.bdf due to https://sourceware.org/bugzilla/show_bug.cgi?id=24784. To avoid this I've enabled `RelaxELFRelocations`, which results in a GOTPCRELX relocation for `__tls_get_addr` and avoids the issue. However, this is likely not acceptable because relax relocations are not supported by older linker versions. We may need an LLVM option to keep using PLT for `__tls_get_addr` despite `RtLibUseGOT`. The corresponding llvm-project PR is https://github.com/rust-lang/llvm-project/pull/19. r? @ghost
2019-07-09Fix float add/mul reduction codegenNikita Popov-2/+8
The accumulator is now respected for unordered reductions.
2019-07-09Strip function pointer alignment for older LLVM versionsNikita Popov-6/+17
2019-07-09Translate target features for LLVM 9Nikita Popov-0/+24
2019-07-09Pass type to byval attributesNikita Popov-30/+38
2019-07-09Auto merge of #62460 - RalfJung:llvm-null, r=eddybbors-5/+12
Handle null from LLVMRustGetSectionName As part of https://github.com/rust-lang/rust/pull/58783 and https://github.com/rust-lang/rust/pull/62103, this incorrect use of a NULL pointer was found in the interface to LLVM. That PR is stuck with some linker issues, but there is no reason the soundness fix should have to wait for that.