summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src
AgeCommit message (Collapse)AuthorLines
2021-06-10Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011bors-1/+2
Drop metadata_encoding_version. Part of #85153 r? `@Aaron1011`
2021-06-07Rollup merge of #86016 - luqmana:infer-linker-flavor, r=petrochenkovYuki Okushi-89/+1
Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}. The two methods were exactly the same so this removes the cranelift copy. This will help make sure both they don't get out of sync.
2021-06-07Auto merge of #85810 - bjorn3:further_driver_cleanup, r=varkorbors-27/+6
Driver improvements This PR contains a couple of cleanups for the driver and a few small improvements for the custom codegen backend interface. It also implements `--version` and `-Cpasses=list` support for custom codegen backends.
2021-06-05Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}.Luqman Aden-89/+1
2021-06-06Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkovbors-0/+9
Partial support for raw-dylib linkage First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files. Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps. It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR. This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-06Auto merge of #79608 - alessandrod:bpf, r=nagisabors-0/+1
BPF target support This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker. I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-04Add first cut of functionality for #58713: support for #[link(kind = ↵Richard Cobbe-0/+9
"raw-dylib")]. This does not yet support #[link_name] attributes on functions, the #[link_ordinal] attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or stdcall functions on 32-bit x86.
2021-06-04Move crate_name field from OngoingCodegen to CrateInfobjorn3-2/+1
2021-06-04Move windows_subsystem field from CodegenResults to CrateInfobjorn3-16/+0
2021-06-04Allow printing the version of the default codegen backend if it isn't llvmbjorn3-0/+4
2021-06-04Provide default MetadataLoaderbjorn3-5/+1
2021-06-04Provide a default provide* implementation for CodegenBackendbjorn3-4/+0
Both cg_llvm and cg_clif don't override it. cg_spirv does override it, so it needs to be preserved.
2021-06-01Drop metadata_encoding_version.Camille GILLOT-1/+2
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-3/+2
2021-05-30Drop metadata_encoding_version.Camille GILLOT-1/+2
2021-05-30Make allocator_kind a query.Camille GILLOT-1/+1
2021-05-27Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into ↵bjorn3-49/+170
sync_cg_clif-2021-05-27
2021-05-23(try to) fix craneliftRalf Jung-0/+2
2021-05-23Add BPF targetAlessandro Decina-0/+1
This change adds the bpfel-unknown-none and bpfeb-unknown-none targets which can be used to generate little endian and big endian BPF
2021-05-18CTFE core engine allocation & memory API improvemenetsRalf Jung-5/+3
- make Allocation API offset-based (no more Pointer) - make Memory API higher-level (combine checking for access and getting access into one operation)
2021-05-17Auto merge of #85178 - cjgillot:local-crate, r=oli-obkbors-11/+10
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-14Auto merge of #83640 - bjorn3:shared_metadata_reader, r=nagisabors-66/+2
Use the object crate for metadata reading This allows sharing the metadata reader between cg_llvm, cg_clif and other codegen backends. This is not currently useful for rlib reading with cg_spirv ([rust-gpu](https://github.com/EmbarkStudios/rust-gpu/)) as it uses tar rather than ar as .rlib format, but it is useful for dylib reading required for loading proc macros. (cc `@eddyb)` The object crate is already trusted as dependency of libstd through backtrace. As far as I know it supports reading all object file formats used by targets for which we support rust dylibs with crate metadata, but I am not certain. If this happens to not be the case, I could keep using LLVM for reading dylib metadata. Marked as WIP for a perf run and as it is based on #83637.
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-3/+14
On x86, the default syntax is also switched to Intel to match asm!
2021-05-12Use () for codegen queries.Camille GILLOT-8/+7
2021-05-12Use () for entry_fn.Camille GILLOT-1/+1
2021-05-12Use () in dependency_formats.Camille GILLOT-2/+2
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-4/+6
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillotbors-3/+1
rustc_driver cleanup Best reviewed one commit at a time.
2021-05-07Use the object crate for metadata readingbjorn3-66/+2
2021-05-05Implement RFC 2951: Native link modifiersLuqman Aden-2/+2
This commit implements both the native linking modifiers infrastructure as well as an initial attempt at the individual modifiers from the RFC. It also introduces a feature flag for the general syntax along with individual feature flags for each modifier.
2021-05-05Use local and remapped paths where appropriateAndy Wang-2/+4
2021-05-05Revamp RealFileName public methodsAndy Wang-2/+2
2021-05-05Use RealFileName for Session::working_dir as it may also be remappedAndy Wang-1/+1
2021-05-02Pass target_cpu to LinkerInfo::new instead of link_binarybjorn3-3/+1
This is one step towards separating the linking code from codegen backends
2021-04-30Merge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebaseErin Power-1/+4
2021-04-30[cg_clif] Fix run_jit from syncErin Power-51/+5
2021-04-30Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795'Erin Power-1172/+691
2021-04-29Implement RFC 1260 with feature_name `imported_main`.Charles Lew-2/+2
2021-04-14Add more SIMD math.h intrinsicsJubilee Young-0/+2
LLVM supports many functions from math.h in its IR. Many of these have single-instruction variants on various platforms. So, let's add them so std::arch can use them. Yes, exact comparison is intentional: rounding must always return a valid integer-equal value, except for inf/NAN.
2021-04-08Fix outdated crate names in compiler docspierwill-1/+1
Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged. Also fix incorrect file paths.
2021-03-30Add an Mmap wrapper to rustc_data_structuresbjorn3-17/+4
This wrapper implements StableAddress and falls back to directly reading the file on wasm32
2021-03-29Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into ↵bjorn3-266/+433
sync_cg_clif-2021-03-29
2021-03-20update `const_eval_resolve`lcnr-5/+5
2021-03-19Add simd_neg platform intrinsicSparrowLii-0/+1
2021-03-15s/ConstantSource/ConstantKind/Oli Scherer-6/+6
2021-03-12Prepare mir::Constant for ty::Const only supporting valtreesOli Scherer-20/+24
2021-03-10Auto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieubors-2/+5
Implement RFC 2945: "C-unwind" ABI ## Implement RFC 2945: "C-unwind" ABI This branch implements [RFC 2945]. The tracking issue for this RFC is #74990. The feature gate for the issue is `#![feature(c_unwind)]`. This RFC was created as part of the ffi-unwind project group tracked at rust-lang/lang-team#19. ### Changes Further details will be provided in commit messages, but a high-level overview of the changes follows: * A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`, and `Thiscall` variants, marking whether unwinding across FFI boundaries is acceptable. The cases where each of these variants' `unwind` member is true correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings introduced in RFC 2945 [3]. * This commit adds a `c_unwind` feature gate for the new ABI strings. Tests for this feature gate are included in `src/test/ui/c-unwind/`, which ensure that this feature gate works correctly for each of the new ABIs. A new language features entry in the unstable book is added as well. * We adjust the `rustc_middle::ty::layout::fn_can_unwind` function, used to compute whether or not a `FnAbi` object represents a function that should be able to unwind when `panic=unwind` is in use. * Changes are also made to `rustc_mir_build::build::should_abort_on_panic` so that the function ABI is used to determind whether it should abort, assuming that the `panic=unwind` strategy is being used, and no explicit unwind attribute was provided. [RFC 2945]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
2021-03-09rustc_target: add "unwind" payloads to `Abi`katelyn a. martin-2/+5
### Overview This commit begins the implementation work for RFC 2945. For more information, see the rendered RFC [1] and tracking issue [2]. A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`, and `Thiscall` variants, marking whether unwinding across FFI boundaries is acceptable. The cases where each of these variants' `unwind` member is true correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings introduced in RFC 2945 [3]. ### Feature Gate and Unstable Book This commit adds a `c_unwind` feature gate for the new ABI strings. Tests for this feature gate are included in `src/test/ui/c-unwind/`, which ensure that this feature gate works correctly for each of the new ABIs. A new language features entry in the unstable book is added as well. ### Further Work To Be Done This commit does not proceed to implement the new unwinding ABIs, and is intentionally scoped specifically to *defining* the ABIs and their feature flag. ### One Note on Test Churn This will lead to some test churn, in re-blessing hash tests, as the deleted comment in `src/librustc_target/spec/abi.rs` mentioned, because we can no longer guarantee the ordering of the `Abi` variants. While this is a downside, this decision was made bearing in mind that RFC 2945 states the following, in the "Other `unwind` Strings" section [3]: > More unwind variants of existing ABI strings may be introduced, > with the same semantics, without an additional RFC. Adding a new variant for each of these cases, rather than specifying a payload for a given ABI, would quickly become untenable, and make working with the `Abi` enum prone to mistakes. This approach encodes the unwinding information *into* a given ABI, to account for the future possibility of other `-unwind` ABI strings. ### Ignore Directives `ignore-*` directives are used in two of our `*-unwind` ABI test cases. Specifically, the `stdcall-unwind` and `thiscall-unwind` test cases ignore architectures that do not support `stdcall` and `thiscall`, respectively. These directives are cribbed from `src/test/ui/c-variadic/variadic-ffi-1.rs` for `stdcall`, and `src/test/ui/extern/extern-thiscall.rs` for `thiscall`. This would otherwise fail on some targets, see: https://github.com/rust-lang-ci/rust/commit/fcf697f90206e9c87b39d494f94ab35d976bfc60 ### Footnotes [1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md [2]: https://github.com/rust-lang/rust/issues/74990 [3]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#other-unwind-abi-strings
2021-03-09Clean up todoskadmin-1/+0
Also add some span_bugs where it is unreachable
2021-03-09Build StKind::CopyOverlappingkadmin-2/+13
This replaces where it was previously being constructed in intrinsics, with direct construction of the Statement.