Commit Graph

1633 Commits

Author SHA1 Message Date
bjorn3
799e067912 Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20 2021-12-20 18:56:35 +01:00
bors
c3a9a9b424 Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
2021-12-19 09:31:37 +00:00
Nicholas Nethercote
93511d926f Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
Nicholas Nethercote
75f6118ad1 Remove SymbolStr.
By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-15 13:30:26 +11:00
Matthias Krüger
c57bcb8fcb Rollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk
Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.
2021-12-15 01:28:06 +01:00
Amanieu d'Antras
edeb3891e9 Remove invalid doc links. 2021-12-13 20:40:17 +00:00
Tomasz Miąsko
a4bf9fbdbf Use OutputFilenames to generate output file for -Zllvm-time-trace
The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.
2021-12-13 00:00:00 +00:00
cynecx
dd3cb0cd75 cg_cranelift: check may_unwind flag instead of cleanup 2021-12-03 23:51:49 +01:00
cynecx
5728c165fa LLVM codgen support for unwinding inline assembly 2021-12-03 23:51:49 +01:00
Petr Sumbera
948d0243de fix sparc64 ABI for aggregates with floating point members 2021-12-01 10:03:45 +01:00
Gary Guo
0ef11587b0 Remove NullOp::Box 2021-10-20 19:42:35 +01:00
Camille GILLOT
7879119e6a Make hash_result an Option. 2021-10-20 18:29:18 +02:00
Deadbeef
0134088cd2 Add const_eval_select intrinsic 2021-10-12 05:42:23 +00:00
bors
2228c49544 Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisa
Turn vtable_allocation() into a query

This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query.

The change is pretty straightforward and should be backportable without too much effort.

Fixes https://github.com/rust-lang/rust/issues/89598.
2021-10-08 09:04:06 +00:00
Michael Woerister
095064b996 Turn tcx.vtable_allocation() into a query. 2021-10-07 20:03:00 +02:00
Camille GILLOT
03c02be0a7 Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
Camille GILLOT
04f3839596 Move EncodedMetadata to rustc_metadata. 2021-09-30 19:41:32 +02:00
Camille GILLOT
745dee9d3e Move encode_metadata out of CrateStore. 2021-09-30 19:41:31 +02:00
bors
500e22e340 Auto merge of #89092 - bjorn3:sync_cg_clif-2021-09-19, r=bjorn3
Sync rustc_codegen_cranelift

Nothing exciting this time. Mostly internal refactorings.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2021-09-26 23:31:01 +00:00
Gary Guo
1b34e2d678 Introduce Rvalue::ShallowInitBox 2021-09-25 01:08:41 +01:00
Mark Rousskov
29e08971ce Adjust to SourceType::InTree in several places
These were left over in migrations to subtrees, which should generally be treated
as-if it was local.

Also fixes a warning caused by this change.
2021-09-20 08:45:39 -04:00
bjorn3
5d3b8e7c1b Merge commit '61667dedf55e3e5aa584f7ae2bd0471336b92ce9' into sync_cg_clif-2021-09-19 2021-09-19 13:56:58 +02:00
Eduard-Mihai Burtescu
e857fabac1 Querify fn_abi_of_{fn_ptr,instance}. 2021-09-18 04:41:33 +03:00
Eduard-Mihai Burtescu
849b4c4483 ty::layout: replicate layout_of setup for fn_abi_of_{fn_ptr,instance}. 2021-09-18 04:41:29 +03:00
Eduard-Mihai Burtescu
1b8e830f6d ty::layout: intern FnAbis as &'tcx. 2021-09-18 01:42:45 +03:00
bors
02d3c132ae Auto merge of #88839 - nbdd0121:alignof, r=nagisa
Introduce NullOp::AlignOf

This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`.

The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
2021-09-12 23:49:24 +00:00
Gary Guo
4ac4980b33 Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
Andreas Liljeqvist
a81217c12d Make abi::Abi Copy and remove a *lot* of refs
fix

fix

Remove more refs and clones

fix

more

fix
2021-09-09 10:41:19 +02:00
Camille GILLOT
9ad50a41fe Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
bors
0167838a18 Auto merge of #88499 - eddyb:layout-off, r=nagisa
Provide `layout_of` automatically (given tcx + param_env + error handling).

After #88337, there's no longer any uses of `LayoutOf` within `rustc_target` itself, so I realized I could move the trait to `rustc_middle::ty::layout` and redesign it a bit.

This is similar to #88338 (and supersedes it), but at no ergonomic loss, since there's no funky `C: LayoutOf<Ty = Ty>` -> `Ty: TyAbiInterface<C>` generic `impl` chain, and each `LayoutOf` still corresponds to one `impl` (of `LayoutOfHelpers`) for the specific context.

After this PR, this is what's needed to get `trait LayoutOf` (with the `layout_of` method) implemented on some context type:
* `TyCtxt`, via `HasTyCtxt`
* `ParamEnv`, via `HasParamEnv`
* a way to transform `LayoutError`s into the desired error type
  * an error type of `!` can be paired with having `cx.layout_of(...)` return `TyAndLayout` *without* `Result<...>` around it, such as used by codegen
  * this is done through a new `LayoutOfHelpers` trait (and so is specifying the type of `cx.layout_of(...)`)

When going through this path (and not bypassing it with a manual `impl` of `LayoutOf`), the end result is that only the error case can be customized, the query itself and the success paths are guaranteed to be uniform.

(**EDIT**: just noticed that because of the supertrait relationship, you cannot actually implement `LayoutOf` yourself, the blanket `impl` fully covers all possible context types that could ever implement it)

Part of the motivation for this shape of API is that I've been working on querifying `FnAbi::of_*`, and what I want/need to introduce for that looks a lot like the setup in this PR - in particular, it's harder to express the `FnAbi` methods in `rustc_target`, since they're much more tied to `rustc` concepts.

r? `@nagisa` cc `@oli-obk` `@bjorn3`
2021-09-05 16:14:41 +00:00
bors
771c2c6986 Auto merge of #88559 - bjorn3:archive_logic_dedup, r=cjgillot
Move add_rlib and add_native_library to cg_ssa

This deduplicates logic between codegen backends.

cc `@antoyo` and `@khyperia` for cg_gcc and rust-gpu.
2021-09-05 04:37:12 +00:00
bors
e7e930360c Auto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank
Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix.

This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting).

The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output.

In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix.

This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642.

Fixes https://github.com/rust-lang/rust/issues/87745.

cc `@cbeuw`
r? `@ghost`
2021-09-03 00:23:10 +00:00
bjorn3
e6049759d0 Use in_incr_comp_dir_sess in cg_clif 2021-09-02 12:29:12 +02:00
Eduard-Mihai Burtescu
dc6c4defdc ty::layout: split LayoutOf into required and (blanket) provided halves. 2021-09-02 01:17:14 +03:00
Eduard-Mihai Burtescu
6a9c9b0f18 ty::layout: implement layout_of automatically as a default method. 2021-09-02 01:17:14 +03:00
Eduard-Mihai Burtescu
b710c0d48c rustc_target: move LayoutOf to ty::layout. 2021-09-02 01:17:14 +03:00
bjorn3
677c786109 Move add_rlib and add_native_library to cg_ssa
This deduplicates logic between codegen backends
2021-09-01 14:43:27 +02:00
Eduard-Mihai Burtescu
39e16da529 rustc_target: TyAndLayout::field should never error. 2021-08-30 00:44:09 +03:00
Eduard-Mihai Burtescu
d9f0448815 rustc_target: add lifetime parameter to LayoutOf. 2021-08-27 13:09:32 +03:00
Michael Woerister
7753eda91a Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix. 2021-08-27 11:50:44 +02:00
lcnr
e0ea466661 make unevaluated const substs optional 2021-08-26 11:00:30 +02:00
Charles Lew
03ed8c8115 Fold vtable_trait_upcasting_coercion_new_vptr_slot logic into obligation processing. 2021-08-18 13:00:27 +08:00
Aaron Hill
1bfa59afe0 Update rustc_codegen_cratelift for working_dir change 2021-08-15 15:17:37 -05:00
Gary Guo
74b17685fe Implement black_box using intrinsic
The new implementation allows some `memcpy`s to be optimized away,
so the uninit value in ui/sanitize/memory.rs is constructed directly
onto the return place. Therefore the sanitizer now says that the
value is allocated by `main` rather than `random`.
2021-08-12 16:16:57 +01:00
bjorn3
d220159810 Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into sync_cg_clif-2021-08-06 2021-08-06 16:26:56 +02:00
Charles Lew
6f682236c9 Implement pointer casting. 2021-08-03 01:09:37 +08:00
Yuki Okushi
d7c3c45d68 Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, r=petrochenkov
Remove nondeterminism in multiple-definitions test

Compare all fields in `DllImport` when sorting to avoid nondeterminism in the error for multiple inconsistent definitions of an extern function.  Restore the multiple-definitions test.

Resolves #87084.
2021-07-18 14:21:56 +09:00
Richard Cobbe
b47198aaa1 Consider all fields when comparing DllImports, to remove nondetermininsm in multiple-definitions test 2021-07-16 11:10:31 -07:00
Ralf Jung
e643b8b561 fix cranelift 2021-07-14 18:17:49 +02:00
Scott McMurray
e3091d74d8 Use cranelift's Type::int instead of doing the match myself
<https://docs.rs/cranelift-codegen/0.74.0/cranelift_codegen/ir/types/struct.Type.html#method.int>
2021-07-08 14:55:58 -07:00
Scott McMurray
7a0574d826 PR Feedback: Don't put SSA-only types in CValues 2021-07-08 14:55:58 -07:00
Scott McMurray
ea8d9aefda Implement the raw_eq intrinsic in codegen_cranelift 2021-07-08 14:55:57 -07:00
bjorn3
fb92375755 Merge commit '3a31c6d8272c14388a34622193baf553636fe470' into sync_cg_clif-2021-07-07 2021-07-07 11:14:20 +02:00
bjorn3
4cfa1fcb5b Don't pass local_crate_name to link_binary separately
It is already part of CodegenResults
2021-07-06 17:49:23 +02:00
bjorn3
135edbf4ba Move LinkerInfo into CrateInfo 2021-07-06 15:31:38 +02:00
bjorn3
6b3a061e94 Remove LibSource
The information is stored in used_crate_source too anyway
2021-07-05 10:49:07 +02:00
Smitty
913c0bc01d Make vtable_allocation always succeed 2021-07-03 11:14:19 -04:00
Smitty
17373a9401 fix sess error
This passed x.py check locally, not sure why it wasn't rebased right...
2021-06-29 19:17:14 -04:00
Smitty
6048adc8b1 Support allocation failures when interperting MIR
Note that this breaks Miri.

Closes #79601
2021-06-29 19:08:26 -04:00
bors
b186f8605a Auto merge of #86475 - crlf0710:miri_vtable_refactor, r=bjorn3
Change vtable memory representation to use tcx allocated allocations.

This fixes https://github.com/rust-lang/rust/issues/86324. However i suspect there's more to change before it can land.

r? `@bjorn3`
cc `@rust-lang/miri`
2021-06-29 15:52:21 +00:00
Charles Lew
4d289dba2e Update other codegens to use tcx managed vtable allocations. 2021-06-28 19:39:48 +08:00
bors
e0af5f783c Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011
Make allocator_kind a query.

Part of #85153

r? `@Aaron1011`
2021-06-28 01:20:01 +00:00
bors
e475efb1ad Auto merge of #85640 - bjorn3:custom_ice_hook, r=jackh726
Allow changing the bug report url for the ice hook

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/1174
2021-06-25 04:06:32 +00:00
Camille GILLOT
b497c7d954 Make allocator_kind a query. 2021-06-20 11:52:51 +02:00
bors
9be7ca00f1 Auto merge of #86291 - crlf0710:trait_vtbl_refactor, r=bjorn3
Refactor vtable codegen

This refactor the codegen of vtables of miri interpreter, llvm, cranelift codegen backends.

This is preparation for the implementation of trait upcasting feature. cc #65991

Note that aside from code reorganization, there's an internal behavior change here that now InstanceDef::Virtual's index now include the three metadata slots, and now the first method is with index 3.

cc  `@RalfJung` `@bjorn3`
2021-06-16 07:20:27 +00:00
LeSeulArtichaut
8923e42a05 Use the now available implementation of IntoIterator for arrays 2021-06-14 23:40:09 +02:00
Charles Lew
d3e123fc4f Refactor to make interpreter and codegen backend neutral to vtable internal representation. 2021-06-15 01:59:00 +08:00
bors
fa7545e49b Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011
Drop metadata_encoding_version.

Part of #85153

r? `@Aaron1011`
2021-06-10 00:39:25 +00:00
Yuki Okushi
8224e72fbc Rollup merge of #86016 - luqmana:infer-linker-flavor, r=petrochenkov
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-07 15:21:03 +09:00
bors
ab73115be0 Auto merge of #85810 - bjorn3:further_driver_cleanup, r=varkor
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-07 02:30:24 +00:00
Luqman Aden
20beb55565 Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}. 2021-06-05 21:59:41 -07:00
bors
df47bce145 Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkov
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-06 03:59:17 +00:00
bors
d7db869e7d Auto merge of #79608 - alessandrod:bpf, r=nagisa
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-06 01:02:32 +00:00
Richard Cobbe
1248ff139d Add first cut of functionality for #58713: support for #[link(kind = "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-04 18:01:35 -07:00
bjorn3
dbdeafbc26 Move crate_name field from OngoingCodegen to CrateInfo 2021-06-04 13:20:05 +02:00
bjorn3
646c6043a7 Move windows_subsystem field from CodegenResults to CrateInfo 2021-06-04 13:20:04 +02:00
bjorn3
b6f0b46e20 Allow printing the version of the default codegen backend if it isn't llvm 2021-06-04 13:20:04 +02:00
bjorn3
20e9a1372b Provide default MetadataLoader 2021-06-04 13:20:04 +02:00
bjorn3
b10a442405 Provide a default provide* implementation for CodegenBackend
Both cg_llvm and cg_clif don't override it. cg_spirv does override it,
so it needs to be preserved.
2021-06-04 13:20:04 +02:00
Camille GILLOT
f4eb0170aa Drop metadata_encoding_version. 2021-06-01 21:12:27 +02:00
Camille Gillot
d8d6a5aee0 Revert "Reduce the amount of untracked state in TyCtxt" 2021-06-01 09:05:22 +02:00
Camille GILLOT
228f1c549d Drop metadata_encoding_version. 2021-05-30 20:05:46 +02:00
Camille GILLOT
4e62376059 Make allocator_kind a query. 2021-05-30 19:58:01 +02:00
bjorn3
d6b03451e6 Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into sync_cg_clif-2021-05-27 2021-05-27 13:08:14 +02:00
bjorn3
8b08cbd92f Change the ice hook for cg_clif to refer to cg_clif's issue tracker 2021-05-24 18:55:30 +02:00
Ralf Jung
9d41e8f90d (try to) fix cranelift 2021-05-23 12:44:05 +02:00
Alessandro Decina
64e08e6b82 Add BPF target
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-23 18:03:27 +10:00
Ralf Jung
5e52b61040 CTFE core engine allocation & memory API improvemenets
- 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-18 19:33:55 +02:00
bors
3c53005949 Auto merge of #85178 - cjgillot:local-crate, r=oli-obk
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-17 01:42:03 +00:00
bors
a5da29cf8f Auto merge of #83640 - bjorn3:shared_metadata_reader, r=nagisa
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-14 12:58:58 +00:00
Amanieu d'Antras
d342a3490b Add support for const operands and options to global_asm!
On x86, the default syntax is also switched to Intel to match asm!
2021-05-13 22:31:57 +01:00
Camille GILLOT
915d766307 Use () for codegen queries. 2021-05-12 13:58:46 +02:00
Camille GILLOT
3a869ca88c Use () for entry_fn. 2021-05-12 13:58:42 +02:00
Camille GILLOT
f22ab98d4c Use () in dependency_formats. 2021-05-12 13:58:41 +02:00
bors
40a62a998f Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister
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-12 11:05:56 +00:00
bors
809722dc13 Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillot
rustc_driver cleanup

Best reviewed one commit at a time.
2021-05-12 08:38:03 +00:00
bjorn3
62f64af430 Use the object crate for metadata reading 2021-05-07 18:48:58 +02:00
Luqman Aden
91dc6967fe Implement RFC 2951: Native link modifiers
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-05 16:04:25 -07:00
Andy Wang
e162eeb1f0 Use local and remapped paths where appropriate 2021-05-05 15:31:28 +01:00
Andy Wang
5de83e7bd1 Revamp RealFileName public methods 2021-05-05 15:31:03 +01:00
Andy Wang
ac5272b3c7 Use RealFileName for Session::working_dir as it may also be remapped 2021-05-05 15:10:57 +01:00
bjorn3
55dbf17bb5 Pass target_cpu to LinkerInfo::new instead of link_binary
This is one step towards separating the linking code from codegen backends
2021-05-02 18:00:20 +02:00
Erin Power
0a1b87c9ce Merge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebase 2021-04-30 18:46:59 +02:00
Erin Power
df68e5ac73 [cg_clif] Fix run_jit from sync 2021-04-30 15:37:19 +02:00
Erin Power
ee570b1302 Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795' 2021-04-30 14:49:58 +02:00
Charles Lew
fa559fb2df Implement RFC 1260 with feature_name imported_main. 2021-04-29 08:35:08 +08:00
Jubilee Young
ea3398ad98 Add more SIMD math.h intrinsics
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-14 15:25:06 -07:00
pierwill
a7c4c3ee71 Fix outdated crate names in compiler docs
Changes `librustc_X` to `rustc_X`, only in documentation comments.
Plain code comments are left unchanged.

Also fix incorrect file paths.
2021-04-08 11:12:14 -05:00
bjorn3
6e799438b7 Add an Mmap wrapper to rustc_data_structures
This wrapper implements StableAddress and falls back to directly reading
the file on wasm32
2021-03-30 18:57:03 +02:00
bjorn3
07968a001d Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into sync_cg_clif-2021-03-29 2021-03-29 10:45:09 +02:00
lcnr
500bcfcdb3 update const_eval_resolve 2021-03-20 17:22:24 +01:00
SparrowLii
e4a1092b9f Add simd_neg platform intrinsic 2021-03-19 02:16:21 +08:00
Oli Scherer
21a0c8e9e4 s/ConstantSource/ConstantKind/ 2021-03-15 12:06:52 +00:00
Oli Scherer
6b1dd82162 Prepare mir::Constant for ty::Const only supporting valtrees 2021-03-12 12:43:54 +00:00
bors
1b1f6ea468 Auto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieu
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-10 16:44:04 +00:00
katelyn a. martin
95182bb2cc rustc_target: add "unwind" payloads to Abi
### 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:
    fcf697f902

 ### 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-09 14:38:29 -05:00
kadmin
d674d3dad8 Clean up todos
Also add some span_bugs where it is unreachable
2021-03-09 19:31:31 +00:00
kadmin
d30c497de6 Build StKind::CopyOverlapping
This replaces where it was previously being constructed in intrinsics, with direct construction
of the Statement.
2021-03-09 16:54:14 +00:00
kadmin
83e6251f21 Update cranelift 2021-03-09 16:54:14 +00:00
bors
7f020206e8 Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`
2021-03-08 08:39:24 +00:00
bjorn3
27886cd6b6 Merge commit '9a0c32934ebe376128230aa8da3275697b2053e7' into sync_cg_clif-2021-03-05 2021-03-05 19:12:59 +01:00
Oli Scherer
b63df38a98 Shrink the size of Rvalue by 16 bytes 2021-03-05 09:33:01 +00:00
Guillaume Gomez
8b7d335c38 Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se
Stabilize str_split_once

Closes #74773
2021-02-26 15:52:29 +01:00
Camille GILLOT
702676bfff Use a QueryContext for try_mark_green. 2021-02-19 17:51:56 +01:00
Camille GILLOT
fe8d11bb99 Use an ItemId inside mir::GlobalAsm. 2021-02-15 19:24:58 +01:00
Jacob Pratt
260a5d4d64 Stabilize str_split_once 2021-02-09 23:17:11 -05:00
Hugues de Valon
5bdc56c00c Add a new ABI to support cmse_nonsecure_call
This commit adds a new ABI to be selected via `extern
"C-cmse-nonsecure-call"` on function pointers in order for the compiler to
apply the corresponding cmse_nonsecure_call callsite attribute.
For Armv8-M targets supporting TrustZone-M, this will perform a
non-secure function call by saving, clearing and calling a non-secure
function pointer using the BLXNS instruction.

See the page on the unstable book for details.

Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2021-02-02 13:04:31 +00:00
Jonas Schievink
02e1fd48d1 Rollup merge of #81618 - bjorn3:sync_cg_clif-2021-02-01, r=bjorn3
Sync rustc_codegen_cranelift

The highlight of this sync are abi compatibility with cg_llvm allowing mixing of cg_clif and cg_llvm compiled crates and switching to the x64 cranelift backend based on the new backend framework.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2021-02-01 14:29:47 +01:00
bjorn3
a75f9bc3be Merge commit 'd556c56f792756dd7cfec742b9f2e07612dc10f4' into sync_cg_clif-2021-02-01 2021-02-01 10:11:46 +01:00
Tyson Nottingham
2b8f2acd5f Indicate both start and end of pass RSS in time-passes output
Previously, only the end of pass RSS was indicated. This could easily
lead one to believe that the change in RSS from one pass to the next was
attributable to the second pass, when in fact it occurred between the
end of the first pass and the start of the second.

Also, improve alignment of columns.
2021-01-29 12:46:29 -08:00
Yuki Okushi
e67b72de2e Rollup merge of #81333 - RalfJung:const-err-simplify, r=oli-obk
clean up some const error reporting around promoteds

These are some error reporting simplifications enabled by https://github.com/rust-lang/rust/pull/80579.

Further simplifications are possible but could be blocked on making `const_err` a hard error.

r? ``````@oli-obk``````
2021-01-29 09:17:38 +09:00
Ralf Jung
d6eb4f571e clean up some const error reporting around promoteds 2021-01-24 13:34:34 +01:00
LeSeulArtichaut
c3d7dc93dc Use ty::{IntTy,UintTy,FloatTy} in rustc 2021-01-18 21:09:30 +01:00
Ömer Sinan Ağacan
ea73caa3b7 codegen_cranelift: Fix redundant semicolon warn 2021-01-16 07:17:13 +03:00
bjorn3
77f74ed070 Merge commit 'dbee13661efa269cb4cd57bb4c6b99a19732b484' into sync_cg_clif-2020-12-27 2020-12-27 10:30:38 +01:00
Jack Huey
6c1fc324b2 Make BoundRegion have a kind of BoungRegionKind 2020-12-18 15:27:28 -05:00
bors
a921a476c8 Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`
2020-12-17 18:21:20 +00:00
David Wood
5f6c32af15 cg_clif: fix build with split dwarf
This commit makes minor changes to the cranelift backend so that it can
build given changes in cg_ssa for Split DWARF.

Signed-off-by: David Wood <david@davidtw.co>
2020-12-16 10:33:48 +00:00
Jack Huey
42b267d221 Move binder for dyn to each list item 2020-12-11 15:02:46 -05:00
bors
aec0fc58ad Auto merge of #77611 - oli-obk:atomic_miri_leakage, r=nagisa
Directly use raw pointers in `AtomicPtr` store/load

I was unable to find any reason for this limitation in the latest source of LLVM or in the documentation [here](http://llvm.org/docs/Atomics.html#libcalls-atomic).

fixes https://github.com/rust-lang/miri/issues/1574
2020-12-09 19:53:23 +00:00
oli
7760894d3f Allow cranelift to handle atomic pointers 2020-11-29 14:56:19 +00:00
bjorn3
d404840788 Merge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into sync_cg_clif-2020-11-27 2020-11-27 20:48:53 +01:00
Bastian Kauschke
56e63805be update cg_clif 2020-11-16 22:42:09 +01:00
Nicholas-Baron
a5ec85758b Changed unwrap_or to unwrap_or_else in some places.
The discussion seems to have resolved that this lint is a bit "noisy" in
that applying it in all places would result in a reduction in
readability.

A few of the trivial functions (like `Path::new`) are fine to leave
outside of closures.

The general rule seems to be that anything that is obviously an
allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it
is a 0-sized allocation.
2020-11-10 20:07:47 -08:00
Jonas Schievink
65ae469f8d Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum
rustc_target: Further cleanup use of target options

Follow up to https://github.com/rust-lang/rust/pull/77729.

Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243.

The first commit collapses uses of `target.options.foo` into `target.foo`.

The second commit renames some target options to avoid tautology:
`target.target_endian` -> `target.endian`
`target.target_c_int_width` -> `target.c_int_width`
`target.target_os` -> `target.os`
`target.target_env` -> `target.env`
`target.target_vendor` -> `target.vendor`
`target.target_family` -> `target.os_family`
`target.target_mcount` -> `target.mcount`

r? `@Mark-Simulacrum`
2020-11-10 14:45:21 +01:00
Dylan DPC
806538fa78 Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk
inliner: Use substs_for_mir_body

Changes from 68965 extended the kind of instances that are being
inlined. For some of those, the `instance_mir` returns a MIR body that
is already expressed in terms of the types found in substitution array,
and doesn't need further substitution.

Use `substs_for_mir_body` to take that into account.

Resolves #78529.
Resolves #78560.
2020-11-09 01:13:42 +01:00
Vadim Petrochenkov
e9c34b3cf8 Collapse all uses of target.options.foo into target.foo
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-08 17:29:13 +03:00
Tomasz Miąsko
f7e11cba36 inliner: Use substs_for_mir_body
Changes from 68965 extended the kind of instances that are being
inlined. For some of those, the `instance_mir` returns a MIR body that
is already expressed in terms of the types found in substitution array,
and doesn't need further substitution.

Use `substs_for_mir_body` to take that into account.
2020-11-06 00:00:00 +00:00
Guillaume Gomez
d6f457d835 Fix even more URLs 2020-11-05 20:11:29 +01:00
oli
6e96e10f93 u64::try_from will now fail if ScalarInt isn't exactly 64 bits, thus we use to_bits with the correct size 2020-11-04 13:59:11 +00:00
oli
5fa1c8f91a u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
oli
0dcf78ba87 s/Scalar::Raw/Scalar::Int 2020-11-04 10:11:31 +00:00
oli
7e8b15e050 Fix cranelift build 2020-11-04 10:10:44 +00:00
bjorn3
285c7c66dc Merge commit '03f01bbe901d60b71cf2c5ec766aef5e532ab79d' into update_cg_clif-2020-11-01 2020-11-03 11:00:04 +01:00
bjorn3
8ec977e763 Replace write with write_all 2020-10-25 13:33:39 +01:00
bjorn3
d2b8406c20 Remove unused trap_unimplemented_ret_value 2020-10-22 12:44:59 +02:00
Kitsu
04091772bc
Use architecture pointer size for AddConstructor (#1094)
* Use architecture pointer size for AddConstructor

* Update src/backend.rs

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-10-16 16:19:22 +02:00
bjorn3
0416f122aa Error on non-constant simd_insert/simd_extract index 2020-10-16 14:03:29 +02:00
bjorn3
4971028775 Rustup to rustc 1.49.0-nightly (dd7fc54eb 2020-10-15) 2020-10-16 09:35:48 +02:00
bjorn3
1c7c591cb8 Fix compilation for non-unix systems 2020-10-15 18:51:49 +02:00
bjorn3
1c272b1224 Fix a compilation error in debug mode 2020-10-15 18:49:50 +02:00
bjorn3
7045b101cc Use MetadataRef in the metadata loader to fix parallel rustc 2020-10-15 16:15:04 +02:00
bjorn3
1c40840738 Fix warning 2020-10-15 15:39:06 +02:00
bjorn3
fed612c75a Output clif ir to output dir instead of hardcoded path
This is necessary for reproducable builds.
2020-10-15 10:57:56 +02:00
bjorn3
a233646dfc Rustup to rustc 1.49.0-nightly (e160e5cb8 2020-10-14) 2020-10-15 10:34:13 +02:00
bjorn3
6258b86c40 Rustup to rustc 1.49.0-nightly (c71248b70 2020-10-11) 2020-10-12 14:23:36 +02:00
bjorn3
2f2d3b2fd4 Avoid iadd for ptr const val with zero offset 2020-10-12 12:04:17 +02:00
bjorn3
cd2fc77b0e Make _rust_extern_with_linkage_* readonly 2020-10-12 12:04:17 +02:00
bjorn3
e0002c1892 Remove MIR dump on panic
I haven't used it for a long time and it adds a lot of noise to the
panic print.
2020-10-11 13:24:14 +02:00
bjorn3
6e8ea1c049 Abort earlier when an error happens in jit mode 2020-10-11 11:31:36 +02:00
bjorn3
faec12461f Use custom driver for sysroot building too
This required another custom driver to ensure that build scripts are
built using cg_llvm instead of cg_clif.

After this change only rustdoc still uses -Zcodegen-backend
2020-10-10 16:41:31 +02:00
bjorn3
c352f91b40 Rustfmt 2020-10-09 19:17:52 +02:00
bjorn3
0a5968dfd2 Use the new cranelift-module interface
This updates Cranelift to include bytecodealliance/wasmtime#2249
2020-10-08 19:00:21 +02:00
bjorn3
3fc673d0a9 Rustup to rustc 1.49.0-nightly (beb5ae474 2020-10-04) 2020-10-05 11:12:41 +02:00
bjorn3
426e55709c Replace CG_CLIF_JIT with --jit 2020-09-29 18:41:59 +02:00
bjorn3
838dd17a67 Don't read CG_CLIF_JIT from init_global_lock
In preparation to moving away from an env var
2020-09-29 18:12:23 +02:00
bjorn3
b8b5a824a6 Fix JIT 2020-09-29 15:28:48 +02:00
bjorn3
17a54ad62e Add custom driver 2020-09-29 15:16:29 +02:00
bjorn3
684c054e31 Rustup to rustc 1.48.0-nightly (fc2daaae6 2020-09-28) 2020-09-29 13:56:30 +02:00
bjorn3
c0507a63fb Invoke panic handler instead of trap for assert_* intrinsics 2020-09-29 13:22:01 +02:00
bjorn3
3ece9fa92a Remove dead code 2020-09-26 11:48:26 +02:00
bjorn3
c8699076f9 Document almost all modules
Fixes #1082
2020-09-23 15:13:49 +02:00
bjorn3
934d56a646 Also allow returning PassMode::ByValPair directly into an ssa var
Benchmark #1: ./raytracer_cg_clif_pre
  Time (mean ± σ):      8.251 s ±  0.021 s    [User: 8.245 s, System: 0.005 s]
  Range (min … max):    8.225 s …  8.292 s    10 runs

Benchmark #2: ./raytracer_cg_clif_post
  Time (mean ± σ):      8.206 s ±  0.043 s    [User: 8.199 s, System: 0.007 s]
  Range (min … max):    8.168 s …  8.279 s    10 runs
2020-09-23 14:29:18 +02:00
bjorn3
94f11cc3a8 Use pcrel pointers in .eh_frame
Fixes #1055
2020-09-23 13:44:32 +02:00
bjorn3
a0f8765251 Add option to use a single section for each function 2020-09-23 09:53:41 +02:00
bjorn3
829a51cae3 Shorten __alloc symbol names a bit 2020-09-23 09:53:41 +02:00
bjorn3
1add4323cf Update Cranelift 2020-09-21 19:23:39 +02:00
bjorn3
bac3464757 Fix debug build 2020-09-21 14:56:19 +02:00
bjorn3
552991e17e Replace FxHashMap with IndexVec for local_map
Fixes #745
2020-09-16 18:45:19 +02:00
bjorn3
51f816f2a7 Rustfmt 2020-09-16 16:58:58 +02:00
bjorn3
b8bbbe38d1 Remove cfg-if dependency 2020-09-16 16:57:52 +02:00
bjorn3
55d4afd2ba Remove byteorder dependency 2020-09-16 16:54:58 +02:00
bjorn3
044470a726 Remove hashbrown usage
drain_filter is now supported on nightly
2020-09-15 21:00:04 +02:00
bjorn3
2d250ffa97 Fix miscompilation in previous commit 2020-09-14 11:44:53 +02:00
bjorn3
bb59d616aa Use don't unroll loop in Rvalue::Repeat
Fixes #1081
2020-09-14 11:32:27 +02:00
bjorn3
9c6921b4b6 Fix typo 2020-09-14 10:32:37 +02:00
bjorn3
4bb25c3e4a Fix dylib metadata writing
Rustc switched from flate2 to snappy
2020-09-05 11:00:34 +02:00
bjorn3
217b3818b7 Rustup to rustc 1.48.0-nightly (c59199efc 2020-09-04) 2020-09-05 10:38:49 +02:00
Matt Brubeck
bd2313fc11 Update to hashbrown 0.9 2020-09-03 15:38:57 -07:00
bjorn3
3b0f3a0a1e Optimize SwitchInt for bools 2020-08-30 13:15:53 +02:00
bjorn3
a8e3f592c9 Set notrap flag on loads and stores 2020-08-30 13:15:08 +02:00
CohenArthur
fc9f16bf0e
fmt: Skip whole module with bang
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-08-28 12:28:55 +02:00
CohenArthur
365cebf779
optimize: Remove conditional compilation on instance
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-08-28 12:26:52 +02:00
CohenArthur
ed35bc8414 fmt: Skip src/target_features_whitelist.rs 2020-08-28 12:23:01 +02:00
CohenArthur
9c848e1905 fmt: Skip fn_sig_for_fn_abi() 2020-08-28 12:20:24 +02:00
CohenArthur
4e685a512e fmt: Run cargo fmt since it is available 2020-08-28 12:10:48 +02:00
bjorn3
5dec38e94c Avoid temporary stack slot in drop codegen
cc #322
2020-08-25 18:32:16 +02:00
CohenArthur
cb386896ee stack2reg: Switch to hashbrown::HashSet 2020-08-23 21:44:00 +02:00
CohenArthur
5c8c75b1d2 stack2reg: Drain instead of only iterating 2020-08-23 18:36:42 +02:00
CohenArthur
eb6df58cdd stack2reg: Remove clone() using filters 2020-08-23 18:16:36 +02:00
CohenArthur
b0ea85fb83 stack2reg: Remove self in remove_unused_stack_addr and()
remove_unused_load()
2020-08-23 17:55:35 +02:00
CohenArthur
80ee042a36 stack2reg: Re-add clone() to stop CI 2020-08-23 17:31:07 +02:00
CohenArthur
c62f433e46 remove_unused_stack_addr_and_stack_load: Remove clone() 2020-08-23 15:00:09 +02:00
bjorn3
18348b1aec Rustup to rustc 1.47.0-nightly (663d2f5cd 2020-08-22) 2020-08-23 11:50:51 +02:00
bjorn3
ec37225873
Merge pull request #1077 from CohenArthur/fix-linkage-export-hidden
Change linkage to hidden on non-exported symbols
2020-08-22 19:59:41 +02:00
bjorn3
a4e703af18
Merge pull request #1076 from CohenArthur/use-codegencx-in-functioncx
Use CodegenCx in FunctionCx
2020-08-22 19:24:46 +02:00
CohenArthur
7b994595da trans_fn: Cleanup code 2020-08-22 19:05:22 +02:00
CohenArthur
05797b2476 trans_fn: Use replace() instead of new() + swap() 2020-08-22 19:03:35 +02:00
CohenArthur
d65e500394 FunctionCx: Swap context.func and empty function correctly 2020-08-22 18:53:34 +02:00
CohenArthur
0d1f8c802e FunctionCx: Refactor fx.cx.tcx into fx.tcx 2020-08-22 16:47:31 +02:00
CohenArthur
5cf4577352 FunctionCx: Add tcx field for easier access 2020-08-22 16:45:50 +02:00
CohenArthur
ea29b1818f FunctionCx: Fix FunctionCx initialization in trans_fn() 2020-08-22 16:40:58 +02:00
CohenArthur
7b534d653d FunctionCx: Rename codegen_cx -> cx 2020-08-22 16:17:58 +02:00
CohenArthur
4cb2a2b793 FunctionCx: Fix field usage in inline_asm and vtable modules 2020-08-22 16:14:33 +02:00
CohenArthur
429e75fe40 FunctionCx: WIP: Remove more common fields from CodegenCx 2020-08-22 15:49:16 +02:00
CohenArthur
1a6365f95f FunctionCx: WIP: Fix overzealous sed usage 2020-08-22 15:25:36 +02:00
CohenArthur
ad4a7a1f0c FunctionCx: WIP: Fix syntax error on sed codegen_cx -> .codegen_cx 2020-08-22 15:21:38 +02:00
CohenArthur
d199b83b55 FunctionCx: WIP: Replace .constants with codegen_cx.constants 2020-08-22 15:19:48 +02:00
CohenArthur
cb69c7019c FunctionCx: Replace .module with .codegen_cx.module 2020-08-22 15:19:09 +02:00
CohenArthur
297d65c247 FunctionCx: WIP: Replace .tcx with .codegen_cx.tcx 2020-08-22 15:18:39 +02:00
CohenArthur
5a59c24eee FunctionCx: Store reference to CodegenCx instead 2020-08-22 15:18:10 +02:00
CohenArthur
a1fc2eb00d linkage: Change linkage to hidden on non-exported symbols 2020-08-22 13:43:47 +02:00
CohenArthur
2a14fb7bf2 jit: Add NULL as terminating argv 2020-08-22 11:24:02 +02:00
bjorn3
e64f523b27 Evaluate all mir.required_consts and report any errors
Fixes #981
2020-08-20 16:51:36 +02:00
bjorn3
ca9fc101c0 Fix weak linkage
This removes the last sysroot patch apart from the few patches that disable tests
2020-08-20 15:24:33 +02:00
bjorn3
7752718e5b Update target_feature_whitelist 2020-08-19 18:52:56 +02:00
bjorn3
f0069dac00 Fix panic in when debug assertions are enabled 2020-08-16 20:55:22 +02:00
bjorn3
4757371aba Fix ambiguity between object and cranelift_object::object 2020-08-16 11:48:46 +02:00
bjorn3
0703e98bf6 Remove cg_clif fake target feature 2020-08-15 21:04:33 +02:00
bjorn3
3d46a30469 Fix ppv-lite86 with simd enabled
This fixes older rand versions that enable the simd feature of ppv-lite86
2020-08-15 20:55:03 +02:00
bjorn3
c1a68b1386 Emulate the cpuid arch intrinsic 2020-08-15 19:08:19 +02:00
bjorn3
847cc7ab2a Disable the inline asm support using a feature flag 2020-08-15 14:19:23 +02:00
bjorn3
8664ccc27f Remove ArchiveConfig 2020-08-08 16:19:42 +02:00
bjorn3
240e178532 Don't panic on io errors
Fixes #920
2020-08-08 16:14:11 +02:00
bjorn3
3e4ddca409 Rustup to rustc 1.47.0-nightly (f9d422ea7 2020-08-04) 2020-08-05 13:55:27 +02:00
bjorn3
e02ffdf795 Use nehalem instead of haswell as target cpu 2020-07-25 16:15:42 +02:00
bjorn3
c1efc33941 Fix panic 2020-07-25 13:17:49 +02:00
bjorn3
e8f1c5c53a Don't forbid i64x2 as simd type 2020-07-25 12:29:55 +02:00
bjorn3
67028cee51 Use PassMode::ByVal for Abi::Vector 2020-07-25 12:29:55 +02:00
bjorn3
08fc673190 Handle SIMD vectors in CPlace::place_field 2020-07-25 12:28:24 +02:00
bjorn3
abc99c6259 Allow storing SIMD vectors in SSA values 2020-07-25 12:16:41 +02:00
bjorn3
1b8df386aa Fix -Zpolymorphize 2020-07-23 18:08:15 +02:00
bjorn3
95511cb3ee Add unaligned_volatile_{load,store} intrinsics 2020-07-23 12:37:27 +02:00
bjorn3
3f2589acd9 Fix multiple inline asm blocks in the same function 2020-07-23 12:37:03 +02:00
bjorn3
1ffc3079b0 Rustup to rustc 1.47.0-nightly (bbebe7351 2020-07-22) 2020-07-23 12:13:22 +02:00
bjorn3
edc0a3470b Implement simd_insert 2020-07-19 14:54:18 +02:00
bjorn3
0b211be054 Use SystemV abi for extern "sysv64" even on Windows 2020-07-19 14:45:58 +02:00
bjorn3
34823a7e4c Rustup to rustc 1.46.0-nightly (5c9e5df3a 2020-07-16) 2020-07-17 19:15:33 +02:00
bjorn3
942039b232 Pass ByRef values at fixed stack offset for extern "C"
This makes it possible to build proc macros using cg_clif
2020-07-17 12:41:01 +02:00
bjorn3
ccfd1b9334 Initialize the atomic mutex in a constructor for proc macros 2020-07-16 14:58:41 +02:00
bjorn3
748d516e0d Use builtin ranlib instead of running external ranlib
This makes it possible to create rlibs for any target without installing
a toolchain for the target

Fixes #763
2020-07-15 16:28:21 +02:00
bjorn3
3e67eb1b44 Update Cranelift
Fixes #757 (through bytecodealliance/wasmtime#1939)
2020-07-14 21:14:14 +02:00
bjorn3
a0580610b2 Use From::from instead of as where possible 2020-07-14 16:38:50 +02:00
bjorn3
4ec2831ebc No silent truncating of SwitchInt values 2020-07-13 19:45:46 +02:00
bjorn3
c9d5e7da58 Rustup to rustc 1.46.0-nightly (9d09331e0 2020-07-12) 2020-07-13 19:32:31 +02:00
bjorn3
726e329f46 Add basic inline asm support for x86_64 2020-07-10 21:34:26 +02:00
bjorn3
35701d8caa Move global_asm into CodegenCx 2020-07-09 19:24:53 +02:00
bjorn3
8cf38181ad Disable global_asm! on macOS for now 2020-07-09 18:56:17 +02:00
bjorn3
893497c93e Infer the path of toolchain binaries from the linker path 2020-07-09 18:55:46 +02:00
bjorn3
037d411bf4 Implement global_asm! using an external assembler
Fixes #1061
2020-07-09 17:02:09 +02:00
bjorn3
1987a3b6c0 Handle SysV64 abi 2020-07-09 15:25:37 +02:00
bjorn3
ac77371852 Add a feature flag for the JIT 2020-07-09 14:23:00 +02:00
bjorn3
6089a68718 Account for Rvalue::AddressOf in analyze 2020-07-03 18:28:26 +02:00
bjorn3
6345e4a1bc Implement variant_count intrinisic 2020-07-03 16:52:56 +02:00
bjorn3
699da394cc Validate simd and atomic intrinsic types 2020-07-03 16:52:37 +02:00
bjorn3
4ada18fd77 Add sess.abort_if_errors() to link 2020-07-03 16:43:59 +02:00
bjorn3
92dc61aba2 Only display codegen time when CG_CLIF_DISPLAY_CG_TIME=1 2020-07-03 16:43:26 +02:00
bjorn3
798fb85651 Fix assert_assignable 2020-07-03 16:40:57 +02:00
bjorn3
21edec4ea5 Fix core::hint::black_box support 2020-07-03 16:39:36 +02:00
bjorn3
d032c24476
Merge pull request #1057 from spastorino/store-pairs-in-ssa
Store pairs in ssa
2020-07-03 15:04:29 +02:00
Santiago Pastorino
ef01b4e3dd
Store fat pointers in ssa variables 2020-07-03 09:48:22 -03:00
Santiago Pastorino
9ec2be7d63
Extract transmute_value as a function to avoid code repetition 2020-07-03 09:43:02 -03:00
Santiago Pastorino
aa80ed0a2d
Store pairs in SSA 2020-07-02 19:23:21 -03:00
bjorn3
f3a91164a2 Rustup to rustc 1.46.0-nightly (f781babf8 2020-07-01) 2020-07-02 19:48:03 +02:00
bjorn3
a299d0e632 Don't panic on unevaluatable promoted constants 2020-07-01 14:15:23 +02:00
bjorn3
eb89a2c092 Implement float_to_int_unchecked intrinsic 2020-06-30 19:02:00 +02:00
bjorn3
c674a32ab8 Implement f*_fast intrinsics 2020-06-30 19:01:17 +02:00
bjorn3
f5f24c7a5c Implement a few volatile intrinsics 2020-06-30 19:00:52 +02:00
bjorn3
bf2ba15972 When casting enum to integer sign extend the discriminant if necessary 2020-06-30 18:59:58 +02:00
bjorn3
cc0268fa1a Mask shift amount 2020-06-30 18:56:53 +02:00
bjorn3
e2ab2885c2 Mark allocations as mutable when necessary 2020-06-30 18:55:33 +02:00
bjorn3
aa6a4acd78 Fix ptr_offset_from intrinsic 2020-06-30 18:53:47 +02:00
bjorn3
de336e17e4 Fix trap_unreachable_ret_value 2020-06-30 18:52:32 +02:00
bjorn3
3227203fe6 Don't use a 1-to-1 mapping between mir local and cranelift_frontend variable 2020-06-27 14:29:28 +02:00
bjorn3
48d4bc2fb6 Rustup to rustc 1.46.0-nightly (7750c3d46 2020-06-26) 2020-06-27 11:29:39 +02:00
bjorn3
a3cd293148 Don't perform a double substitution in some cases 2020-06-24 12:10:20 +02:00
bjorn3
98c83d21f5 Remove leftover of removed hack 2020-06-24 11:54:11 +02:00
bjorn3
1f3dd4f91c Prevent different vtables with the same name
Fixes #987
2020-06-23 11:41:35 +02:00
bjorn3
9c0d18c8db Simplify assert_assignable
Assignments are no longer used to implicitly cast between &mut T and &T
2020-06-21 10:35:45 +02:00
bjorn3
b79102c933 Disable "LTO is not supported" warning for sysroot build 2020-06-20 19:14:58 +02:00
bjorn3
fc5e583006 Warn on unsupported pass modes for extern "C"
cc #10
2020-06-20 19:03:54 +02:00
bjorn3
eb8fd197ab Prelude cleanup 2020-06-20 18:44:49 +02:00
bjorn3
431cebdca1 Introduce #[cfg(target_feature = "cg_clif")] 2020-06-20 16:22:03 +02:00
bjorn3
5f54cc7658 Implement checked_mul
Fixes #6
2020-06-20 15:15:28 +02:00
bjorn3
ef4186a85b Use Cranelift legalization for icmp.i128
The previous translation was wrong for signed 128bit comparisions

This fixes several libcore tests
2020-06-20 13:23:31 +02:00
bjorn3
5c6bf836fe Implement #[link_section]
Fixes #1047
2020-06-20 12:01:24 +02:00
bjorn3
266ca933f4 Rustup to rustc 1.46.0-nightly (2d8bd9b74 2020-06-19) 2020-06-20 11:10:27 +02:00
bjorn3
3086e44733 Only call build_value_labels_ranges when necessary 2020-06-16 13:27:24 +02:00
bjorn3
282e3055e1 Only run ranlib when necessary 2020-06-16 11:40:21 +02:00
bjorn3
daad966be7 Some changes necessary for Windows support
cc #977
2020-06-16 11:36:39 +02:00
bjorn3
d471c1b521 Update Cranelift 2020-06-16 10:38:12 +02:00
bjorn3
eb5ce4e92a Remove FunctionDebugContext 2020-06-13 17:03:34 +02:00
bjorn3
16b5dac463 Remove all non-tcx references from CodegenCx 2020-06-12 21:15:13 +02:00
bjorn3
ba7cdf21be Emit unwind info for main and alloc shim
Fixes #988
2020-06-12 19:31:35 +02:00
bjorn3
b84c9764db Rustup to rustc 1.46.0-nightly (a37c32e2d 2020-06-11) 2020-06-12 18:41:50 +02:00
bjorn3
cef9255c0e Rustup to rustc 1.46.0-nightly (449e8eaa2 2020-06-10) 2020-06-11 13:12:47 +02:00
bjorn3
bc555764bd Update Cranelift 2020-06-05 12:40:33 +02:00
bjorn3
6b54b7c9f4 Remove sign extension for ty::Int from CValue::const_val 2020-06-05 12:16:05 +02:00
bjorn3
648b634e21 Rustup to rustc 1.45.0-nightly (56daaf669 2020-06-03) 2020-06-04 19:57:12 +02:00
bjorn3
1e70c51f60
Merge pull request #1022 from osa1/clif_dump_in_release_mode
Dump clif with --emit llvm-ir in release mode
2020-05-29 11:12:02 +02:00
Ömer Sinan Ağacan
acbfa06ea2
Mark blocks that call cold funs as cold (#1021) 2020-05-29 11:06:29 +02:00
Ömer Sinan Ağacan
c0ad988a3a
Update src/pretty_clif.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-05-29 11:53:58 +03:00
Ömer Sinan Ağacan
6dd0246199 Dump clif with --emit llvm-ir in release mode
Currently it's not possible to dump llvm-ir in release build. With this
patch we allow it with `--emit llvm-ir`. In debug build we dump clif
always as before.

Fixes #1020
2020-05-29 11:43:05 +03:00
bjorn3
1c76bdc53a
Remove already fixed FIXME in driver/jit.rs 2020-05-27 11:08:41 +02:00
bjorn3
47f0256d56 Update Cranelift 2020-05-25 13:04:36 +02:00
bjorn3
bcd357a0ae Rustup to rustc 1.45.0-nightly (46e85b432 2020-05-24) 2020-05-25 12:41:33 +02:00
bjorn3
c7e0dde38a Rustup to rustc 1.45.0-nightly (7ebd87a7a 2020-05-08) 2020-05-09 14:14:45 +02:00
bjorn3
27cc90effa Improvements for latest Cranelift 2020-05-05 12:16:28 +02:00
bjorn3
020bcb31db Register frame table in JIT mode 2020-05-01 20:58:27 +02:00
bjorn3
4da6488d95 Always emit .eh_frame section 2020-05-01 19:21:29 +02:00
bjorn3
485e52e153 Rustup to rustc 1.45.0-nightly (7ced01a73 2020-04-30) 2020-05-01 17:51:51 +02:00
bjorn3
9fb167e711 Commit missing change for rustup 2020-04-30 16:12:33 +02:00
bjorn3
7031c96fb3 Call panic lang item on failed TerminatorKind::Assert
Fixes #164
2020-04-25 19:07:53 +02:00
bjorn3
e7661d49c3 Implement .eh_frame writing 2020-04-25 18:23:31 +02:00
bjorn3
9d6f65ea14 Implement line debuginfo for AArch64 2020-04-25 17:29:09 +02:00
bjorn3
6b8b4e54ba Rustup to rustc 1.44.0-nightly (3360cc3a0 2020-04-24) 2020-04-25 11:42:46 +02:00
bjorn3
c3180f3bd7 Fix function arguments for gdb 2020-04-24 21:13:23 +02:00
bjorn3
b69b72973a Generate simple debuginfo for arguments 2020-04-24 21:13:23 +02:00
bjorn3
27a46ff765 Rustup to rustc 1.44.0-nightly (45d050cde 2020-04-21)
Remove the `<Box<F> as FnOnce>::call_once` hack now that rust-lang/rust#71170 is merged.
2020-04-22 17:54:25 +02:00
bjorn3
5a6d9e1f1b
Merge pull request #972 from l4l/debug-file-hash
Support file hashes in .debug_line
2020-04-21 12:17:46 +02:00
bjorn3
c3c5c4b731
Use DWARF version 4 for now 2020-04-21 12:13:50 +02:00
Kitsu
8c7a457753
Use md5 dwarf hash, only if all files has it
Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
2020-04-20 23:27:54 +03:00
Serentty
080d17f4f5
Fix spelling error in comment (#974) 2020-04-19 10:55:07 +02:00
bjorn3
e64a7ebcb0 Implement check mode
Fixes #973
2020-04-18 21:13:09 +02:00
Kitsu
fb709ede02 Simplify with make_file_info 2020-04-18 17:43:00 +03:00
bjorn3
eab4c9063e Sync fn_sig_for_fn_abi with upstream for generator resume args
Fixes #970
2020-04-18 15:45:42 +02:00
Kitsu
0e837e3082 Simplify FileHash ctor 2020-04-18 16:33:01 +03:00
Kitsu
710da05af7 Dedup file hashing logic with type 2020-04-18 16:16:17 +03:00
Kitsu
1e472531c6 Use dwarf 3 for osx 2020-04-18 16:05:28 +03:00
Kitsu
5c0e34d7ab Don`t include timestamp as debug file info 2020-04-18 16:02:02 +03:00
Kitsu
077209e565 Support file hashes in .debug_line 2020-04-18 14:56:04 +03:00
bjorn3
a802c7f292 Disable line debuginfo for the AArch64 backend 2020-04-17 21:03:43 +02:00
bjorn3
51d07790df Use the correct return type for puts 2020-04-17 19:33:57 +02:00
bjorn3
cd684e39e0 Fix saturated_* intrinsics for 128bit ints
Fixes #968
2020-04-17 14:14:24 +02:00
bjorn3
9a378c3f3f Fix transmute of non-scalar to scalar
Fixes #967
2020-04-17 10:57:20 +02:00
Venkata Jaswanth U
78cdfc6c92 Fixes #958: Use session.fatal() instead of assert! 2020-04-14 21:36:28 +05:30
bjorn3
21aa9b29bc Pre-allocate local_map 2020-04-13 19:53:49 +02:00
bjorn3
af016640b6 Cleanup codegen_terminator_call a bit 2020-04-13 19:12:44 +02:00
bjorn3
4bbae74458 Merge codegen_call_inner into codegen_terminator_call 2020-04-13 17:38:17 +02:00
bjorn3
04af24d418 Don't use codegen_call_inner in codegen_drop 2020-04-13 17:31:35 +02:00
bjorn3
40cdcf0e5e Remove one usage of force_stack 2020-04-13 14:53:25 +02:00
bjorn3
8daca65e47 Rustup to rustc 1.44.0-nightly (3712e11a8 2020-04-12) 2020-04-13 13:30:39 +02:00
bjorn3
bbc0cd66b4 Update Cranelift 2020-04-13 12:54:55 +02:00
bjorn3
b6bbc0f751 Codegen goto return block as return terminator 2020-04-11 15:01:29 +02:00
bjorn3
ea1a99900e Remove unchecked_cast_to 2020-04-11 15:01:15 +02:00
bjorn3
3ef6170142 Remove CPlace::NoPlace 2020-04-11 15:01:04 +02:00
bjorn3
53307fd2e1 Introduce PointerBase::Dangling 2020-04-11 14:59:01 +02:00
bjorn3
dfb5d16fb3 Use bitcast to transmute where possible 2020-04-11 14:56:00 +02:00
bjorn3
016673b0c3 Fix rustc::internals lint warnings 2020-04-09 12:12:55 +02:00
bjorn3
291c75d10b Enable the rust_2018_idioms and unused_lifetimes lints and fix all warnings
They are set to deny by default in the rust-lang/rust repo
2020-04-09 12:12:55 +02:00
bjorn3
7d28ab8ba2 Remove the trans_const_place and TransPlaceInterpreter hack 2020-04-04 19:06:07 +02:00
bjorn3
ac1c5d6954 Rustup to rustc 1.44.0-nightly (537ccdf3a 2020-04-02) 2020-04-03 11:54:18 +02:00
bjorn3
17f99b4a96 Take Place by value instead of by reference 2020-04-02 17:23:15 +02:00
bjorn3
786c7d8d8c Rustup to rustc 1.44.0-nightly (76b11980a 2020-04-01) 2020-04-02 14:27:51 +02:00
bjorn3
e3396901c4 Update Cranelift 2020-04-01 14:19:25 +02:00
bjorn3
ab4328db43 Fix opt level names 2020-03-31 14:13:03 +02:00
bjorn3
13e3a3c8b0 Rustup to rustc 1.44.0-nightly (211365947 2020-03-30) 2020-03-31 13:20:19 +02:00
bjorn3
017a9b7641 Rustup to rustc 1.44.0-nightly (699f83f52 2020-03-29) 2020-03-30 19:00:24 +02:00
bjorn3
d2964f6a71 Rustup to rustc 1.44.0-nightly (75208942f 2020-03-27) 2020-03-28 14:20:24 +01:00
bjorn3
f6d12440aa Update Cranelift 2020-03-28 14:01:48 +01:00
bjorn3
33fd4c47aa Use 16bit simd indices 2020-03-27 16:42:28 +01:00
bjorn3
d2c5b4be68 Use vector icmp in simd_cmp! when possible 2020-03-27 16:41:05 +01:00
bjorn3
3f33fcbd30 Avoid using select in bool_to_zero_or_max_uint
It legalizes to a branch
2020-03-27 16:04:34 +01:00
bjorn3
f288959c00 Limit publicness to crate where possible and remove unused imports 2020-03-27 12:14:45 +01:00
bjorn3
b113e88ddb Fix warnings 2020-03-24 13:41:19 +01:00
bjorn3
5c9b9305b7 Update Cranelift and object 2020-03-24 13:17:03 +01:00
bjorn3
3c9ebdb194 Rustup to rustc 1.44.0-nightly (1edd389cc 2020-03-23) 2020-03-24 13:09:44 +01:00
bjorn3
6b30d508f7 Fix some FIXME's and add some new FIXME's 2020-03-21 16:52:02 +01:00
bjorn3
e9db3e7817 Avoid u/i*::{min.max}_value()
They will be deprecated in the future
2020-03-20 16:29:05 +01:00
bjorn3
a59479bd37 Add clif ir comments for stack2reg opt 2020-03-20 12:18:40 +01:00
bjorn3
52f90c6308 Update Cranelift 2020-03-19 12:09:21 +01:00
bjorn3
d464169beb Rustup to rustc 1.44.0-nightly (7ceebd98c 2020-03-17) 2020-03-18 20:12:19 +01:00
bjorn3
992fae08c4 Simplify handling of unimplemented stuff 2020-03-17 16:26:56 +01:00
bjorn3
b475199d1c [debuginfo] Fix map_reg 2020-03-17 15:30:32 +01:00
bjorn3
c7b2ffaebd Fix intrinsic name 2020-03-17 15:12:15 +01:00
bjorn3
d07c404bf4 Rename try intrinsic argument to match upstream 2020-03-17 14:53:32 +01:00
bjorn3
ebf13f1cce Rustup to rustc 1.43.0-nightly (dd6718796 2020-03-16) 2020-03-17 14:52:06 +01:00
bjorn3
643f0a1455 Remove unused import 2020-03-15 19:52:41 +01:00
bjorn3
0c1dcb0bbf Pre-allocate vec for rlib metadata reading
Reduces the time spent during the copy from ~9% to ~1% for helloworld

cc #878
2020-03-14 19:01:47 +01:00
bjorn3
5d516f9e11 Use Vec instead of HashSet for ccx.todo
This reduces runtime of ConstantCx::finalize for the coercions rustc
bench by ~65%

cc #878
2020-03-14 16:36:55 +01:00
bjorn3
efe3d84ce4 Don't lookup span position when the span hasn't changed
This improves performance of FunctionDebugContext::define by ~60%

Fixes #807
2020-03-14 15:18:04 +01:00
bjorn3
660b5c33e7 Use byte offsets instead of char offsets in debuginfo
cc #807
2020-03-14 15:10:22 +01:00
bjorn3
092cae12f9 Dont single step into macros
Fixes #782
2020-03-14 14:48:04 +01:00
bjorn3
ce4c514001 Error on allocation containing reference to TLS value
Fixes #868
2020-03-14 14:39:29 +01:00
bjorn3
10ee80c288 Write dummy return value on unimplemented simd_{insert,extract}
Fixes #919
2020-03-14 14:34:07 +01:00
bjorn3
98a073cf26 Shrink vtable symbol names a bit 2020-03-13 11:19:31 +01:00
bjorn3
4d226e8f17 Hash trap message symbol nameThis saves ~7% of disk space 2020-03-13 11:02:14 +01:00
bjorn3
1c02e6c368 Rustup to rustc 1.43.0-nightly (c20d7eecb 2020-03-11) 2020-03-12 21:04:00 +01:00
bjorn3
b469bf3b08 Refactor driver/aot.rs
Fixes #917
2020-03-12 11:58:59 +01:00
bjorn3
933ef94f63 Move aot code to driver/aot.rs 2020-03-12 11:48:17 +01:00
bjorn3
03240d89cc Move jit code to driver/jit.rs 2020-03-12 11:44:27 +01:00
bjorn3
1a0d1ed9df Move driver.rs 2020-03-12 11:42:01 +01:00
bjorn3
dfd365e060 Display crate name in the "codegen mono items" time message 2020-03-12 11:40:42 +01:00
bjorn3
1980371195 Better use of env vars 2020-03-12 11:19:26 +01:00
bjorn3
e4f1f3db27 Implement incremental caching of object files 2020-03-11 18:42:51 +01:00
bjorn3
dcc86d306c Emulate <Box<F> as FnOnce>::call_once without alloca
Fixes #884

cc #15
2020-03-10 20:48:58 +01:00
bjorn3
240d56c33c Support virtual calls with unsized self argument 2020-03-10 20:41:31 +01:00
bjorn3
11b1c8b5c6 Use multiple codegen units
Fixes #909
2020-03-09 11:29:26 +01:00
bjorn3
6a90b6844f Revert "Use multiple codegen units"
This reverts commit 03acf67a0e.
2020-03-08 13:27:43 +01:00
bjorn3
03acf67a0e Use multiple codegen units 2020-03-07 12:45:55 +01:00
bjorn3
36ea72c2bd Move emit_module call 2020-03-07 12:45:05 +01:00
bjorn3
97db112295 Move time "codegen mono items" out of codegen_mono_items 2020-03-07 12:16:32 +01:00
bjorn3
575836ebe3 Check for main in current module before codegen of entry wrapper 2020-03-07 12:13:54 +01:00
bjorn3
2ecffb6fc4 Inline codegen_cgus 2020-03-07 11:54:35 +01:00
bjorn3
152bde63fe Misc changes 2020-03-07 11:27:49 +01:00
bjorn3
5d2a1daf83 Remove unused inline asm whitelist 2020-03-07 11:10:33 +01:00
bjorn3
9ab2af56aa Rustup to rustc 1.43.0-nightly (4ad624882 2020-03-03) 2020-03-04 15:04:28 +01:00
bjorn3
900c04a423 Implement simd_fma 2020-02-26 16:35:13 +01:00
bjorn3
c8de552c01 Tls support 2020-02-26 14:41:05 +01:00
bjorn3
53ef00e68c Fix JIT on macOS
Fixes #671
2020-02-22 15:57:53 +01:00
bjorn3
cc30c20293 Silence some warnings 2020-02-22 15:18:03 +01:00
bjorn3
ad7e8ad2cc Update Cranelift 2020-02-22 14:25:22 +01:00
bjorn3
c1bf153049 Rustup to rustc 1.43.0-nightly (8aa9d2014 2020-02-21) 2020-02-22 14:20:37 +01:00
bjorn3
6156f48ffe Update Cranelift and use the new ineg instruction 2020-02-15 11:59:45 +01:00
bjorn3
a3f27a4428 Use archive_format for determining if gnu style archives should be emitted
Fixes #893
2020-02-14 19:12:43 +01:00
bjorn3
430f738392 Update Cranelift for basic blocks 2020-02-14 18:23:29 +01:00
bjorn3
b5b2ffab6a Rustup to rustc 1.43.0-nightly (5d04ce67f 2020-02-13) 2020-02-14 18:20:34 +01:00
bjorn3
e95a300630 Use TrapCode::UnreachableCodeReached in trap_unreachable 2020-02-07 21:38:30 +01:00
bjorn3
bae0d9bb72 [OPT] Don't call monomorphize from clif_type 2020-02-07 20:27:37 +01:00
bjorn3
01f6f40ac2 Rustup to rustc 1.43.0-nightly (442ae7f04 2020-02-06) 2020-02-07 13:49:48 +01:00
bjorn3
fbe36ad68a Revert "Use CachingSourceMapView::byte_pos_to_line_and_col instead of SourceMap::lookup_char_pos"
This reverts commit eb4fc45310.

It caused a panic while compiling simple-raytracer
2020-02-03 21:36:36 +01:00
bjorn3
eb4fc45310 Use CachingSourceMapView::byte_pos_to_line_and_col instead of SourceMap::lookup_char_pos
The former calculates byte offsets instead of char offsets. It is faster
to calculate byte offsets than char offsets. Also most DWARF producers
and consumers use byte offsets instead of char offsets.
2020-02-03 21:05:18 +01:00
bjorn3
33e73091f8 Don't mark unwind ebbs as cold
This fixes the code_layout optimization, as it would previously try to
move non-existing ebbs.

Fixes #877
2020-02-01 16:47:35 +01:00
bjorn3
d821f154c5 Disable the code_layout optimization
When compiling libcore, it causes ebb params to be dropped for a certain function
2020-01-25 17:55:48 +01:00
bjorn3
92d4356130 Add #[cfg(debug_assertions)] to write_clif_file
This silences a warning in release mode
2020-01-25 17:54:49 +01:00
bjorn3
8de317dd8f Update compiler_builtins 2020-01-25 17:24:45 +01:00
bjorn3
74c7a7b7c5 Replace unimplemented! with unreachable! when it will never be supported 2020-01-25 16:24:48 +01:00
bjorn3
242f2e3c75 Fix correctness of optimization 2020-01-25 16:24:15 +01:00
bjorn3
9cfb9470c5 Allow unsized types as function parameters 2020-01-25 16:23:54 +01:00
bjorn3
85ce626865 Improve PlaceElem::Subslice handling 2020-01-22 20:10:00 +01:00
bjorn3
ddd3d95a7e Make atomic instructions atomic using a global lock 2020-01-22 20:09:55 +01:00
bjorn3
a3f378754b Warn when using LTO 2020-01-22 20:06:05 +01:00
bjorn3
aa5c49cf2f Make unused stack slots zero sized in stack2reg 2020-01-22 18:57:36 +01:00
bjorn3
167c7f2201 Don't force static refs to const memory 2020-01-22 18:56:50 +01:00
bjorn3
c4acc78e4d Allow more types in CValue::const_val 2020-01-22 18:56:36 +01:00
bjorn3
e798f98bb4 Fix debug build 2020-01-15 13:18:54 +01:00
bjorn3
217beab62a Reduce the amount of calls to layout_of 2020-01-15 13:18:54 +01:00
bjorn3
09b44f5d25 Reduce visibility 2020-01-14 17:11:06 +01:00
bjorn3
29fafb44b1 Optimize .debug_line generation
This reduces the amount of time spent in .debug_line generation by about 50%

Fixes #807
2020-01-14 16:11:23 +01:00
bjorn3
b22b184969 Update Cranelift 2020-01-14 13:55:08 +01:00
bjorn3
b44d6311ca Rustup to rustc 1.42.0-nightly (3ebcfa145 2020-01-12) 2020-01-14 12:29:04 +01:00
bjorn3
c74b306037 Move all cold code to the end of the function
Fixes #836

Benchmark #1: simple-raytracer/raytracer_cg_clif
  Time (mean ± σ):      9.250 s ±  0.056 s    [User: 9.213 s, System: 0.015 s]
  Range (min … max):    9.151 s …  9.348 s    20 runs

Benchmark #2: simple-raytracer/raytracer_cg_clif_cold_separated
  Time (mean ± σ):      9.179 s ±  0.101 s    [User: 9.141 s, System: 0.016 s]
  Range (min … max):    9.070 s …  9.473 s    20 runs

Summary
  'simple-raytracer/raytracer_cg_clif_cold_separated' ran
    1.01 ± 0.01 times faster than 'simple-raytracer/raytracer_cg_clif'
2020-01-11 17:57:18 +01:00
bjorn3
38797f8bad Implement #[track_caller]
Fixes #848
2020-01-11 17:10:42 +01:00
bjorn3
fed3b26563 Don't panic on reported const eval errors 2020-01-11 14:28:18 +01:00
bjorn3
2a082209a6 Fix PlaceElem::Subslice length computation 2020-01-11 14:28:18 +01:00
bjorn3
0080f55df2 Fix build 2020-01-11 14:27:39 +01:00
bjorn3
70c9b3b35b Better self profiling integration 2020-01-10 14:16:27 +01:00
bjorn3
d65ba25ba7 Remove faerie support 2020-01-10 13:30:21 +01:00
bjorn3
2bd7dcd2c0 Update Cranelift 2020-01-10 13:28:31 +01:00
bjorn3
5424d7d55f Prepare for basic blocks 2020-01-10 12:14:28 +01:00
bjorn3
33ad67c124 Rustup to rustc 1.42.0-nightly (caa231d99 2020-01-08) 2020-01-09 17:43:10 +01:00
bjorn3
6652f466ef Rustup to rustc 1.42.0-nightly (bc1571cc3 2020-01-05) 2020-01-06 20:11:03 +01:00
bjorn3
a3b8619c1e Revert "Use simd instructions for int and float simd intrinsics"
This reverts commit 5e984a32d9.

It was causing issues with vectors bigger than 128bit
2020-01-04 18:27:00 +01:00
bjorn3
b4802b8054 Fix codegen of unimpl in simd_extract and unimpl simd_insert 2020-01-04 18:20:18 +01:00
bjorn3
1bb848d4ac Re-use cranelift_codegen::ir::Function for every function
Fixes #844
2020-01-04 17:58:38 +01:00
bjorn3
c5a7fca527 Use DUMMY_SP in less places
Fixes #845
2020-01-04 17:49:00 +01:00
bjorn3
ca92695a2c Use IndexVec for ebb_map
cc #745
2020-01-04 13:23:42 +01:00
bjorn3
ff1c62365e Remove faerie machO alignment workaround
Fixes #738
2020-01-04 13:12:13 +01:00
bjorn3
c9034e54e5 Add two FIXME's 2020-01-04 12:40:56 +01:00
bjorn3
87d6953719 Add documentation about the UB of the stack2reg optimization 2020-01-04 11:31:56 +01:00
bjorn3
196008bee3 Disable stack2reg opt when optimizations are disabled 2019-12-31 16:43:24 +01:00
bjorn3
4c7abd504c Revert some changes 2019-12-31 15:59:49 +01:00
bjorn3
dbb118a5bc Fix some warnings 2019-12-31 15:56:33 +01:00
bjorn3
0cb2b60559 Don't print debug messages in release mode 2019-12-31 15:56:28 +01:00
bjorn3
b47c89de0e Remove unnecessary check from temporal_order 2019-12-31 15:56:28 +01:00
bjorn3
790132523f Support store to load forwarding for different types of the same size 2019-12-31 15:56:28 +01:00
bjorn3
fd5efa0921 Fix potential_stores_for_load 2019-12-31 15:56:28 +01:00
bjorn3
d6c2db2aea Return use domtree.dominates in temporal_order 2019-12-31 15:56:28 +01:00
bjorn3
7c4debdb7c Add functions to remove loads stores etc 2019-12-31 15:56:28 +01:00
bjorn3
79148a3c1e Extract potential_stores_for_load and potential_loads_of_store functions 2019-12-31 15:56:28 +01:00
bjorn3
af5a2a8509 Let remove_unused_stack_addr_and_stack_load take OptimizeContext 2019-12-31 15:56:28 +01:00
bjorn3
0f3eab589e Add OptimizeContext 2019-12-31 15:56:28 +01:00
bjorn3
df7f68236c Remove stack_store without following stack_load 2019-12-31 15:56:28 +01:00
bjorn3
6320c65484 Fix temporal_order argument order for store to load forwarding 2019-12-31 15:56:28 +01:00
bjorn3
7579663199 Extract temporal_order function 2019-12-31 15:56:28 +01:00
bjorn3
9022e09a3e Fix compilation 2019-12-31 15:56:28 +01:00
bjorn3
b0814a3fd8 Check for cross-ebb temporal overlap between loads and stores 2019-12-31 15:56:28 +01:00
bjorn3
c5f42aef1d Run dead stack_store removal after stack_store to stack_load forwarding 2019-12-31 15:56:28 +01:00
bjorn3
7d35db5319 [WIP] Implement basic stack store to load forwarding 2019-12-31 15:56:28 +01:00
bjorn3
be6cdb28d0 Refactor stack_store removal 2019-12-31 15:56:28 +01:00