Commit Graph

1486 Commits

Author SHA1 Message Date
bjorn3
bccf0a1f8d Merge codegen of a couple more simd intrinsics 2022-01-30 19:44:15 +01:00
bjorn3
5a3cfb24d8 Merge codegen of several simd intrinsics
This reduces code duplication
2022-01-30 19:37:01 +01:00
bjorn3
c1d699d37b Remove the remaining simd intrinsic macros 2022-01-30 19:31:18 +01:00
bjorn3
1ae27ea6aa Remove simd_cmp macro
This reduces duplication in the codegened source file
2022-01-30 19:19:54 +01:00
bjorn3
037aafbbaf Fix simd type validation 2022-01-30 18:35:08 +01:00
bjorn3
bb1b5cdde2 Remove validate_atomic_type
By expanding it in place. Also extract a common
report_atomic_type_validation_error function to reduce code duplication.
2022-01-30 18:23:01 +01:00
bjorn3
5efd7782b3 Don't generate unnecessary let $arg=$arg for intrinsics 2022-01-30 18:00:36 +01:00
bjorn3
246998f5ec Remove some unused lint allows 2022-01-30 17:43:09 +01:00
bjorn3
1b8ea0705e Add const_allocate and const_deallocate intrinsics 2022-01-30 17:35:33 +01:00
bjorn3
cc24cea101 Rustfmt 2022-01-19 16:38:58 +01:00
bjorn3
c6e607a947 Implement unchecked_mul intrinsic 2022-01-19 15:45:04 +01:00
bjorn3
400f122709 Sync from rust 2f004d2d40 2022-01-19 15:26:05 +01:00
lcnr
513d72d007 remove is_noop 2022-01-19 13:58:29 +01:00
bjorn3
78b65718bc Split compile_fn out of codegen_fn 2022-01-18 19:07:26 +01:00
bjorn3
5f6c59e63f Pass only the Function to write_clif_file 2022-01-18 18:58:37 +01:00
bjorn3
f3b2d37e77 Record object file artifact size in self profile data 2022-01-18 15:24:11 +01:00
bjorn3
489bff5543 Sync from rust 7531d2fdd4 2022-01-18 12:49:50 +01:00
bjorn3
e59b024e02 Pass target_features set instead of has_feature closure
This avoids unnecessary monomorphizations in codegen backends
2022-01-17 18:06:30 +01:00
bjorn3
48abe3c6fa Use Symbol for target features in asm handling
This saves a couple of Symbol::intern calls
2022-01-17 18:06:27 +01:00
bors
0b58e52786 Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu
Remove deprecated LLVM-style inline assembly

The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove
it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it
is time to remove `llvm_asm!` to avoid continued maintenance cost.

Closes #70173.
Closes #92794.
Closes #87612.
Closes #82065.

cc `@rust-lang/wg-inline-asm`

r? `@Amanieu`
2022-01-17 09:40:29 +00:00
Ellen
eef35308ef initial revert 2022-01-15 01:16:55 +00:00
Tomasz Miąsko
7ec4de3ab8 Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Aaron Hill
409276cf55 Store a Symbol instead of an Ident in VariantDef/FieldDef
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
2022-01-11 10:16:22 -05:00
bjorn3
b7cda373d5 Pass Ty instead of TyAndLayout to the closure of various simd helpers
This reduces the total amount of llvm ir lines for simd related
functions from 9604 to 9467.
2022-01-09 19:07:15 +01:00
bjorn3
2633024850 Don't monomorphize the simd helpers for each closure
This halves the total amount of llvm ir lines for simd related functions
from 18227 to 9604.
2022-01-09 18:55:57 +01:00
bjorn3
b60eced405 Return Value instead of CValue from the simd_for_each_lane closure 2022-01-09 18:43:08 +01:00
bjorn3
57d25ef60e Use simplified version of bool_to_zero_or_max_uint in simd_cmp 2022-01-09 18:32:27 +01:00
bjorn3
d4d2b24d55 Slightly simplify some macros by removing an extra case for when signedness doesn't matter
This is slightly more verbose when invoking the macro.
2022-01-09 17:44:55 +01:00
bjorn3
78e2d4a275 Remove support for vector icmp for now
Real simd support will need an overhaul in the future anyway. For now it
only complicates the code.
2022-01-09 17:39:00 +01:00
bjorn3
8ace43e650 Move a couple of macros to intrinsics::simd 2022-01-09 17:34:55 +01:00
bjorn3
4e3a8d5fb9 Move validate_simd_type from intrinsics to intrinsics::simd 2022-01-09 17:30:01 +01:00
bjorn3
9295b086f6 Turn validate_simd_type into a function
This effectively outlines it, significantly reducing the size of
the codegen_simd_intrinsic_call llvm ir from 10419 lines to 6378 lines.
2022-01-09 17:29:16 +01:00
bjorn3
9e6d8c1b24 Remove the call_intrinsic_match macro 2022-01-09 17:22:23 +01:00
bjorn3
baad993dae Dedup codegen_operand calls in codegen_float_intrinsic_call
This reduces the amount of llvm ir lines for this function by a little
over half from 1662 to 781.
2022-01-09 17:19:11 +01:00
bjorn3
300974714c Dedup write_cvalue calls in codegen_float_intrinsic_call
Also directly use an array instead of going through a tuple. This
reduces the amount of llvm ir lines for this function by almost half
from 3086 to 1662.
2022-01-09 17:11:28 +01:00
bjorn3
a1a164083e Move call_intrinsic_match macro into codegen_float_intrinsic_call 2022-01-09 16:44:54 +01:00
bjorn3
046e094842 Only use a single bug!() invocation in call_intrinsic_match
This reduces code size
2022-01-09 15:40:40 +01:00
bjorn3
409e3eb2cb Remove unnecessary argument 2022-01-09 15:40:39 +01:00
bjorn3
70cc242545 Remove a couple of duplicate calls 2022-01-09 15:38:45 +01:00
bjorn3
c5b969583f Split codegen_intrinsic_call function
This should reduce compile times of cg_clif
2022-01-09 15:36:05 +01:00
bjorn3
9913630158 Reduce usage of subst types in the intrinsic code
Using the arguments often saves a layout_of call
2022-01-09 14:54:43 +01:00
Matthias Krüger
1da0071338 Rollup merge of #90102 - nbdd0121:box3, r=jonas-schievink
Remove `NullOp::Box`

Follow up of #89030 and MCP rust-lang/compiler-team#460.

~1 month later nothing seems to be broken, apart from a small regression that #89332 (1aac85bb716c09304b313d69d30d74fe7e8e1a8e) shows could be regained by remvoing the diverging path, so it shall be safe to continue and remove `NullOp::Box` completely.

r? `@jonas-schievink`
`@rustbot` label T-compiler
2022-01-03 14:44:15 +01:00
bjorn3
a5a14258e5 Merge commit '40b00f4200fbdeefd11815398cb46394b8cb0a5e' into sync_cg_clif-2021-12-30 2021-12-30 14:53:41 +01:00
bjorn3
f6d0e14b79 Fix dead code warning on windows 2021-12-30 12:56:45 +01:00
bjorn3
9bcdb53053 Rustfmt 2021-12-30 12:10:59 +01:00
bjorn3
9089c305da Remove TyCtxt dependency from UnwindContext 2021-12-27 17:54:06 +01:00
bjorn3
799e067912 Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20 2021-12-20 18:56:35 +01:00
bjorn3
97e5045493 Fix taking address of truly unsized type field of unsized adt 2021-12-20 18:49:43 +01:00
bjorn3
bb6d83dac9 Sync from rust 84f962a89b 2021-12-20 18:12:18 +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
bjorn3
a795a0384b Remove triple method from FunctionCx
Instead use the default_call_conv field on TargetFrontendConfig to get
the default CallConv.
2021-12-18 15:46:30 +01:00
bjorn3
fdd0f8a3b5 Slightly reduce the amount of fx.module references 2021-12-18 15:33:31 +01:00
bjorn3
d0f97fc039 Rustup to rustc 1.59.0-nightly (c5ecc1570 2021-12-15) 2021-12-16 14:11:04 +01:00
bjorn3
d084fca557 Sync from rust a090c8659c 2021-12-16 13:52:12 +01:00
bjorn3
2cb4fe711e Fix unused crate warning 2021-12-16 13:51:18 +01:00
bjorn3
f74cf39a74 Fix crash when struct argument size is not a multiple of the pointer size
Fixes #1200
2021-12-15 16:53:35 +01: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
bjorn3
057635b9da Rustfmt 2021-12-09 13:43:32 +01:00
bjorn3
47962076a1 Use cg_ssa for creating the dylib metadata file
The new api was introduced in rust-lang/rust#91604
2021-12-09 13:36:33 +01:00
bjorn3
aaf508cab3 Use const thread_local! 2021-12-07 18:25:27 +01:00
bjorn3
7d34d3ad78 Sync from rust c5c9494509 2021-12-07 17:57:58 +01:00
bjorn3
df7f02072b Remove black box inline asm fallback
It isn't used anymore since the introduction of the black_box intrinsic
2021-12-04 15:03:50 +01: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
bjorn3
dd288d27de Fix vector types containing an array field with mir opts enabled 2021-12-03 12:13:41 +01:00
Petr Sumbera
948d0243de fix sparc64 ABI for aggregates with floating point members 2021-12-01 10:03:45 +01:00
bjorn3
c989324672 Fix warning 2021-11-26 16:21:19 +01:00
bjorn3
efdbd88a74 Ensure inline asm wrapper name never starts with a digit
This could previously happen if the cgu name starts with a digit
2021-11-25 11:43:18 +01:00
bjorn3
8714be0ad3 Include NOTYPE symbols in the archive symbol table
This is necessary for blog os
2021-11-24 20:35:57 +01:00
bjorn3
1222192374 Use cgu name instead of function name as base for inline asm wrapper name
This fixes using #[inline] functions containing inline assembly from multiple cgus
2021-11-24 19:18:22 +01:00
Gary Guo
5f0c6e5539 Fix allocated reg in AT&T style asm 2021-11-22 17:01:43 +00:00
Gary Guo
f9534a9bc9 Add RISC-V inline asm support 2021-11-22 16:28:14 +00:00
Gary Guo
31e7fa54a0 Dispatch inline asm to the correct arch 2021-11-22 16:28:14 +00:00
Gary Guo
cfdf10b259 x86 inline asm support 2021-11-22 16:28:14 +00:00
Gary Guo
eaf88c5b52 Skeleton for multiple arch support 2021-11-22 13:45:18 +00:00
Gary Guo
fe3ba31860 Overlap input and output stack slots 2021-11-22 13:45:18 +00:00
Gary Guo
14aa039d30 Skip registers saved by calling convention 2021-11-22 13:45:17 +00:00
Gary Guo
703027f0fc Code cleanup as a follow up to the previous commit 2021-11-22 03:15:12 +00:00
Gary Guo
894468a537 Move stack slot allocation to a new fn 2021-11-22 03:15:12 +00:00
Gary Guo
f16d27aca4 Remove expect_reg 2021-11-22 01:48:22 +00:00
Gary Guo
042eb37837 Implement register allocation for inline assembly 2021-11-22 01:45:58 +00:00
bjorn3
d288c6924d Implement simd_reduce_{min,max} for floats 2021-11-18 19:27:49 +01:00
bjorn3
a8be7ea503 Implement new simd_shuffle signature 2021-11-18 19:27:32 +01:00
bjorn3
bf907a3de1 Sync from rust 47aeac648e 2021-10-27 14:05:12 +02:00
bjorn3
1ceda5bb7e Remove unncesessary TryFrom and TryInto impls 2021-10-21 20:18:01 +02: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
bjorn3
8ed0d0d980 Remove unnecessary Lazy
Found by m-ou-se in https://github.com/bjorn3/rustc_codegen_cranelift/pull/1166#discussion_r730468919
2021-10-17 22:44:08 +02:00
bjorn3
b2fed29e1a Update Cranelift 2021-10-12 14:47:57 +02:00
Deadbeef
0134088cd2 Add const_eval_select intrinsic 2021-10-12 05:42:23 +00:00
bjorn3
376dd765d4 Sync from rust bb918d0a5b 2021-10-09 15:02:14 +02: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
bjorn3
dbeafcc254 Rustfmt 2021-10-02 14:51:08 +02:00
bjorn3
d76afa705b Sync from rust a8387aef8c 2021-10-02 14:42:18 +02:00
bjorn3
eded369086 Update Cranelift
This version no longer has the old x86 backend
2021-10-01 15:37:48 +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
bjorn3
adc2793e7d Fix unused import warning
TryInto is part of the 2021 edition prelude
2021-09-27 11:20:04 +02:00
bjorn3
89fedb1e4d Sync from rust 04006d8e3b 2021-09-27 11:11:18 +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
bjorn3
f12c51f149 Sync from rust 7a3d1a5f3d 2021-09-19 13:43:54 +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
bjorn3
94ad37cd3d Sync from rust c7dbe7a830 2021-09-12 19:25:17 +02: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
bjorn3
7736e0afb8 Avoid unnecessary duplicate metadata encoding 2021-09-08 18:54:48 +02:00
bjorn3
95f06887ea Sync from rust 73641cd23b 2021-09-07 20:45:09 +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
bjorn3
0ff530eac8 Sync from rust 3ed6c1d23f 2021-09-01 14:00:09 +02:00
Eduard-Mihai Burtescu
39e16da529 rustc_target: TyAndLayout::field should never error. 2021-08-30 00:44:09 +03:00
bjorn3
e9eac6bd93 Remove unnecessary feature gates
One wasn't necessary anymore at all. Others are only necessary when jit mode is enabled.
2021-08-27 15:17:17 +02:00
bjorn3
6f5c9b97dc Enable some warnings 2021-08-27 14:04:00 +02: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
bjorn3
f865bbbecf Sync from rust 9863bf51a5 2021-08-25 13:05:20 +02:00
bjorn3
47e4a62ac5 Move all code out of backend.rs 2021-08-20 21:43:53 +02:00
bjorn3
14617516f8 Make {Debug,Unwind}Context::emit non-generic 2021-08-20 21:38:50 +02:00
bjorn3
d8308ece36 Move Object creation into metadata.rs 2021-08-20 21:38:17 +02:00
bjorn3
a929c952d4 Add more architectures to with_object 2021-08-20 21:32:04 +02:00
bjorn3
d29e0484cf Revert "Remove unnecessary bailout in clif_pair_type_from_ty"
This reverts commit 3b22c3a8ec.

Seems to be necessary after all. At least when compiling regex.
2021-08-20 19:58:38 +02:00
bjorn3
3b22c3a8ec Remove unnecessary bailout in clif_pair_type_from_ty 2021-08-20 19:30:16 +02:00
bjorn3
7a781a53f0 Sync from rust 9ccf661694 2021-08-20 15:06:07 +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
d498e6d697 Avoid an unnecessary allocation 2021-08-10 13:19:22 +02:00
bjorn3
6681694cb5 Avoid converting filenames into strings where possible 2021-08-10 13:19:22 +02:00
bjorn3
1da50543dd Use the object crate for archive reading during archive building 2021-08-10 13:19:22 +02:00
bjorn3
d220159810 Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into sync_cg_clif-2021-08-06 2021-08-06 16:26:56 +02:00
bjorn3
05677b6bd6 Rustup to rustc 1.56.0-nightly (25b764849 2021-08-04) 2021-08-05 15:32:02 +02:00
bjorn3
20491379c2 Sync from rust 2ddb65c322 2021-08-05 14:39:37 +02:00
Charles Lew
6f682236c9 Implement pointer casting. 2021-08-03 01:09:37 +08:00
bjorn3
c6564f814e Fix float min and max operations in presence of NaN
Cranelift's fmin and fmax instructions propagate NaN, while Rust's min
and max don't.

Fixes #1049
2021-07-29 15:21:14 +02:00
bjorn3
e0b9f3b3cc Support storing return values in register places for all pass modes 2021-07-28 18:54:21 +02:00
bjorn3
b7881bb08d Remove CPlace::no_place
It is never the right function
2021-07-28 18:31:27 +02:00
bjorn3
8704a66922 Allow returning PassMode::Cast directly to an ssa var 2021-07-28 18:27:06 +02:00
bjorn3
bab224d254 Remove outdated FIXME 2021-07-28 18:26:03 +02:00
bjorn3
2e62516496 Remove workarounds for things unimplemented in Cranelift
Many are now implemented, so it is much nicer to directly use the
respective Cranelift instructions
2021-07-28 17:30:39 +02:00
bjorn3
8a6ff90a3a Use __muloti4 instead of __rust_i128_mulo
Fixes #1126
2021-07-28 14:54:31 +02:00
bjorn3
641e13e021 Replace pointer_ty() with fx.pointer_type where possible 2021-07-26 19:21:45 +02:00
bjorn3
e387ec9cbf Fix ABI for Indirect arguments
In case of PassMode::Indirect, the ownership of the backing storage is
transfered to the callee. This means that the caller must copy the
argument if it wants to use it again later.

Fixes #691
2021-07-26 18:57:48 +02:00
bjorn3
405642b853 Handle the extra argument for #[track_caller] earlier 2021-07-26 15:01:50 +02:00
bjorn3
3361e349fa Don't return anything from codegen_with_call_return_arg 2021-07-26 14:55:13 +02:00
bjorn3
83da1e0d5a Simplify logic around first_arg 2021-07-26 14:49:17 +02:00
bjorn3
050b417a74 Introduce the CallTarget enum 2021-07-26 14:40:27 +02:00
bjorn3
424a8c3a56 Implement "default_alloc_error_handler" feature
Fixes #1182
2021-07-26 14:11:19 +02:00
bjorn3
581e38b97c Add fixme 2021-07-25 19:12:31 +02:00
bjorn3
6d2221d1bb Fix simd_round implementation 2021-07-25 18:44:42 +02:00
bjorn3
90e4493b98 Implement more simd intrinsics 2021-07-24 15:25:32 +02:00
bjorn3
344cbac150 Fix simd_reduce_* intrinsics 2021-07-24 15:24:06 +02:00
bjorn3
a7b06e81fc Fix two type mismatch bugs 2021-07-23 18:29:47 +02:00
bjorn3
c42be7975f Support repr(simd) on ADTs containing a single array field
This is the cg_clif half of rust PR 78863
2021-07-23 18:28:33 +02:00
bjorn3
356360836e Avoid call to pointer_ty 2021-07-19 15:34:33 +02:00
bjorn3
0ebb4839f6 Rustup to rustc 1.55.0-nightly (59216858a 2021-07-18) 2021-07-19 15:32:22 +02:00
bjorn3
c151bb4ac5 Sync from rust 8df945c471 2021-07-19 15:23:20 +02: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
bjorn3
80b9e36709 Put all cg_clif specific options behind -Zunstable-features 2021-07-17 16:32:55 +02:00
bjorn3
60340d44d8 Don't panic when the target is not supported by Cranelift 2021-07-17 16:07:27 +02:00
bjorn3
6dc386e192 Don't truncate the shift amount
It isn't actually necessary
2021-07-17 14:34:58 +02:00
bjorn3
f7cfb9d6d5 Remove shl/shr special handling for 128bit ints
Cranelift now natively supports 128bit int shifting
2021-07-17 14:34:58 +02: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
7167f4c9a4 Sync from rust 0deb536ff9 2021-07-08 18:03:33 +02:00
bjorn3
fb92375755 Merge commit '3a31c6d8272c14388a34622193baf553636fe470' into sync_cg_clif-2021-07-07 2021-07-07 11:14:20 +02:00
bjorn3
73d2e22969 Sync from rust b09dad3edd 2021-07-06 18:59:42 +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
fed71e3448 Pass CrateInfo instead of TyCtxt to load_imported_symbols_for_jit 2021-07-05 18:46:13 +02:00
bjorn3
a0cdbd1aa6 Rustfmt 2021-07-05 18:44:37 +02:00
bjorn3
6b3a061e94 Remove LibSource
The information is stored in used_crate_source too anyway
2021-07-05 10:49:07 +02:00
bjorn3
83cca1b03c Write better clif ir header 2021-07-04 12:39:22 +02:00
Smitty
913c0bc01d Make vtable_allocation always succeed 2021-07-03 11:14:19 -04:00
bjorn3
751ae51044 Update Cranelift 2021-07-03 14:41:33 +02:00
bjorn3
6a31385363 Misc target related improvements 2021-07-03 14:28:53 +02:00
bjorn3
cda811173e Fix compilation for AArch64 2021-07-02 12:39:48 +02:00
bjorn3
ae98d5a78d Don't use data object for non-primitive scalars
Fixes #1041
2021-07-02 12:07:08 +02:00