Commit Graph

1633 Commits

Author SHA1 Message Date
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
bjorn3
943b81bb40 Extract remove_unused_stack_addr_and_stack_load 2019-12-31 15:56:28 +01:00
bjorn3
a8daa7115e Group by stack slot earlier 2019-12-31 15:56:28 +01:00
bjorn3
9d77cb95e1 Merge stack_{addr,load}_insts_users 2019-12-31 15:56:28 +01:00
bjorn3
5047856f00 Use BTreeSet and BTreeMap instead of SecondaryMap 2019-12-31 15:56:28 +01:00
bjorn3
c84b1fee09 Record users of stack_addr and stack_load return values 2019-12-31 15:56:28 +01:00
bjorn3
73961709d6 Outline combine_stack_addr_with_load_store and remove unused stack_load insts 2019-12-31 15:56:28 +01:00
bjorn3
b6642e5cd8 Re-order some code 2019-12-31 15:56:28 +01:00
bjorn3
8b82f4f989 [WIP] Add stack2reg optimization pass 2019-12-31 15:56:28 +01:00
bjorn3
7564a043d0 Fix some warnings 2019-12-31 15:53:18 +01:00
bjorn3
7e6d533af2 Rustup to rustc 1.42.0-nightly (a9dd56ff9 2019-12-30) 2019-12-31 15:47:58 +01:00
bjorn3
50d7497708 Write scalars separately for Abi::ScalarPair in write_cvalue
This makes it easier to perform store to load forwarding
2019-12-31 15:28:15 +01:00
bjorn3
958c58545f Only codegen a trap for functions with uninhabited arguments
Fixes #847
2019-12-28 11:10:21 +01:00
bjorn3
8bf5cd345e Rustup to rustc 1.42.0-nightly (74c4e6a98 2019-12-27) 2019-12-28 10:57:49 +01:00
bjorn3
30a760dda2 Make it possible it use value_field for SIMD values stored ByVal 2019-12-25 14:38:51 +01:00
bjorn3
0ebc14cc40 Remove unused macro args 2019-12-25 14:38:51 +01:00
bjorn3
9eb9436481 Fix indentation 2019-12-25 14:38:51 +01:00
bjorn3
b35a5da4ea Remove vector support from load_scalar 2019-12-25 14:38:51 +01:00
bjorn3
5e984a32d9 Use simd instructions for int and float simd intrinsics 2019-12-25 14:38:51 +01:00
bjorn3
f8e846dee0 Add load_vector function 2019-12-25 14:38:37 +01:00
bjorn3
dadfbeab6c Don't use stack_{load,store} for vectors 2019-12-25 14:38:37 +01:00
bjorn3
78cdcd62be Don't limit vector size 2019-12-25 14:38:37 +01:00
bjorn3
73fd311291 [WIP] Real simd support 2019-12-25 14:38:37 +01:00
bjorn3
c3daf6d220 Add clif ir comment for write_cvalue 2019-12-25 14:38:22 +01:00
bjorn3
2920cc48e6 Fix SSA analysis for value types with PassMode::ByRef 2019-12-25 14:35:16 +01:00
bjorn3
ca93bcba5d Improve lane_type_and_count 2019-12-25 14:34:59 +01:00
bjorn3
7ff01a4d59 Use mir::SourceInfo again in FunctionCx.source_info_set
Fixes #800
2019-12-24 12:44:07 +01:00
bjorn3
399cada762 Directly depend on cranelift_{codegen,frontend}
Fixes #838
2019-12-24 12:43:20 +01:00
bjorn3
d89f307ea2 Move simd intrinsics to intrinsics/simd.rs 2019-12-23 13:58:17 +01:00
bjorn3
67a0fdad19 Make llvm_intrinsics a submodule of intrinsics 2019-12-23 13:57:55 +01:00
bjorn3
82b52a8744 Rustup to rustc 1.42.0-nightly (9b98af84c 2019-12-22) 2019-12-23 13:25:22 +01:00
bjorn3
15a310345d Improve local ir comments 2019-12-22 17:04:33 +01:00
bjorn3
e63a94fca6 Rustup to rustc 1.42.0-nightly (fc5deca21 2019-12-21) 2019-12-22 16:53:06 +01:00
bjorn3
2485994803 Rustup to rustc 1.42.0-nightly (01a46509a 2019-12-20) 2019-12-21 11:22:12 +01:00
bjorn3
ad72afaad3 Remove CPlaceInner::Stack 2019-12-20 22:00:12 +01:00
bjorn3
fbbc910ddc [OPT] Emit stack_{load,store} where possible 2019-12-20 19:30:56 +01:00
bjorn3
8f5ef6172c Remove to_addr and to_addr_maybe_unsized 2019-12-20 19:10:08 +01:00
bjorn3
696053e69f Set memflags for vtable loads 2019-12-20 16:16:28 +01:00
bjorn3
967709f31a [OPT] Use load and store offsets instead of iadd_imm 2019-12-20 16:02:47 +01:00
bjorn3
76cfa333be Fix init and uninit intrinsics for u/i128 2019-12-20 12:24:48 +01:00
bjorn3
a125b62536 [OPT] Don't force return value of call to stack
Benchmark #1: ./simple_raytracer_before
  Time (mean ± σ):     14.420 s ±  0.568 s    [User: 14.376 s, System: 0.026 s]
  Range (min … max):   13.730 s … 15.170 s    10 runs

Benchmark #2: simple_raytracer_after
  Time (mean ± σ):     13.679 s ±  0.576 s    [User: 13.628 s, System: 0.020 s]
  Range (min … max):   12.761 s … 14.552 s    10 runs

Summary
  './simple_raytracer_after' ran
    1.05 ± 0.06 times faster than './simple_raytracer_before'
2019-12-20 12:13:07 +01:00
bjorn3
a528e37302 Fix codegen of ctlz and cttz intrinsics 2019-12-20 12:01:55 +01:00
bjorn3
8d2db1b75d Monomorphize type of promoted 2019-12-18 20:41:07 +01:00
bjorn3
79ec8948d8 Fix some warnings 2019-12-18 20:26:41 +01:00
bjorn3
bfff2a50fd Fix debug build 2019-12-18 20:25:05 +01:00
bjorn3
1c79cf4c0a [OPT] Use RETURN_PLACE instead of fn_sig.output() to get return layout 2019-12-17 18:41:13 +01:00
bjorn3
86cdd1909b [OPT] Use IndexVec instead of HashMap in ssa analysis 2019-12-17 17:49:12 +01:00
bjorn3
172522c2e7 [OPT] Push fx.monomorphize to the callers of fx.layout_of
This prevents some repeated monomorphizations
2019-12-17 16:58:34 +01:00
bjorn3
d502f8e652 [OPT] Avoid calling target_triple for every call to codegen 2019-12-17 16:34:48 +01:00
bjorn3
ad1f885002 [OPT] Don't call .to_string() on MonoItem's 2019-12-17 16:34:48 +01:00
bjorn3
3e50a831e5 Optimize line_program_add_file 2019-12-16 13:23:41 +01:00
bjorn3
beda104a2b Disable local debuginfo for now 2019-12-16 12:12:51 +01:00
bjorn3
74ca55d230 Rustup 2019-12-16 12:11:14 +01:00
bjorn3
7a4fe12d31 Rustup to rustc 1.41.0-nightly (e87a205c2 2019-11-27) 2019-12-16 12:07:31 +01:00
bjorn3
b86eb2e8ba Some optimizations
* Only format global _comments when debug_assertions are enabled
* Only call build_value_labels_ranges in base.rs when debug_assertions are enabled

Benchmark #1: CHANNEL='pre' ../cargo.sh build
  Time (mean ± σ):     17.657 s ±  1.050 s    [User: 31.871 s, System: 3.014 s]
  Range (min … max):   16.907 s … 20.394 s    10 runs

Benchmark #2: ../cargo.sh build
  Time (mean ± σ):     16.640 s ±  0.255 s    [User: 30.238 s, System: 2.965 s]
  Range (min … max):   16.413 s … 17.186 s    10 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  '../cargo.sh build' ran
    1.06 ± 0.07 times faster than 'CHANNEL='pre' ../cargo.sh build'
2019-12-16 12:07:31 +01:00
bjorn3
08217d1bde Emit DW_TAG_structure_type including fields for structs 2019-12-16 12:07:12 +01:00
bjorn3
ab7ad2caeb Use set_val_label before every def_var 2019-12-16 12:07:12 +01:00
bjorn3
0244d19ebb Fix translate_loc for ValueLoc::Stack 2019-12-16 12:07:12 +01:00
bjorn3
8edbbc45f7 Implement local reading for locals on stack 2019-12-16 12:04:34 +01:00
bjorn3
d8e9148c2e Rustfmt debuginfo 2019-12-16 12:04:34 +01:00
bjorn3
c5c6ce87d2 Small change 2019-12-16 12:04:34 +01:00
bjorn3
beda7870fb Split debuginfo/line_info.rs from debuginfo/mod.rs 2019-12-16 12:04:34 +01:00
bjorn3
ed758912d3 Split debuginfo/emit.rs part out of debuginfo/mod.rs 2019-12-16 12:04:34 +01:00
bjorn3
d07fe816af Move debuginfo.rs to debuginfo/mod.rs 2019-12-16 12:04:34 +01:00
bjorn3
62c3ca28e1 Extract local definition from FunctionDebugContext::define 2019-12-16 12:04:34 +01:00
bjorn3
50f7110cb6 Fix local value reading
LLDB doesn't understand base address entries
2019-12-16 12:04:34 +01:00
bjorn3
3fed880057 [WIP] Set local DW_AT_location 2019-12-16 12:04:34 +01:00
bjorn3
21f0dfd014 Monomorphize locals 2019-12-16 12:04:34 +01:00
bjorn3
a962835685 [WIP] debuginfo: Add types for locals 2019-12-16 12:04:34 +01:00
bjorn3
c0aedfef96 [WIP] debuginfo for locals 2019-12-16 12:04:34 +01:00
bjorn3
e1613a69d4 Rustup to rustc 1.41.0-nightly (a605441e0 2019-12-15) 2019-12-16 11:33:57 +01:00
bjorn3
88277f983a Remove some workarounds for missing inst legalizations 2019-12-08 11:52:04 +01:00
bjorn3
c6086a8fd7 Rustup to rustc 1.41.0-nightly (6d77e45f0 2019-12-04) 2019-12-05 21:00:57 +01:00
bjorn3
f0bb30f8a1 Rustup to rustc 1.41.0-nightly (25d8a9494 2019-11-29) 2019-12-01 12:54:57 +01:00
bjorn3
c3df8b185b Rustup to rustc 1.41.0-nightly (0c987c5c0 2019-11-23) 2019-11-24 16:30:15 +01:00
bjorn3
53e0833232 Implement log10f* intrinsics 2019-11-24 15:30:28 +01:00
bjorn3
4a8b0ca274 Correctly align returned addr for to_addr on NoPlace 2019-11-24 14:56:51 +01:00
bjorn3
cdab96d05c Rustup to rustc 1.41.0-nightly (53712f863 2019-11-21) 2019-11-22 15:56:49 +01:00
bjorn3
0219f218db Remove FIXME 2019-11-16 16:54:47 +01:00
bjorn3
b0bcb23eb4 Fix signed cast to 128bit integer 2019-11-16 16:44:26 +01:00
bjorn3
0c026853f5 Rustup to rustc 1.41.0-nightly (82cf3a448 2019-11-14) 2019-11-15 20:47:22 +01:00
bjorn3
177b0d2f57 Rustup to rustc 1.41.0-nightly (ded5ee001 2019-11-13) 2019-11-14 21:13:40 +01:00
bjorn3
c0ec688daf Rustup to rustc 1.40.0-nightly (3fc30d884 2019-11-10) 2019-11-11 20:34:42 +01:00
bjorn3
5407b51aa7 Rustup to rustc 1.40.0-nightly (9e346646e 2019-11-08) 2019-11-09 11:14:18 +01:00
bjorn3
0cad01f239 Rustup to rustc 1.40.0-nightly (aa4e57ca8 2019-10-31) 2019-11-01 20:22:59 +01:00
bjorn3
40178f6d3c Changes for gimli-rs/object#133 2019-10-25 22:01:31 +02:00
bjorn3
8536514308 Rustup to rustc 1.40.0-nightly (10a52c25c 2019-10-24) 2019-10-25 21:41:24 +02:00
bjorn3
dda5ea883a Fix debuginfo for machO
This only fixes it when using object::write as backend, and not when using faerie.

There were two problems:

* object::write doesn't replace .debug_info with __debug_info, unlike faerie
* machO requires section relative relocations, and not symbol relative
  relocations. When using symbol relative relocations, the linker
  interprets the relocations as section relative. Thus writing the wrong
  values to the debug sections.

Fixes #303
2019-10-19 15:37:07 +02:00
bjorn3
4d7f70318a Fix metadata symbol scope
It should be exported from the generated dylib
2019-10-19 11:08:16 +02:00
bjorn3
bb5cefe838 Test object::write backend on travis 2019-10-19 10:56:35 +02:00
bjorn3
ecd9c4f2e3 FIx review comments 2019-10-19 10:52:56 +02:00
bjorn3
0471ed2776 Add support for object::write 2019-10-18 18:31:38 +02:00
bjorn3
5873127ec2 Make debuginfo writing backend agnostic 2019-10-18 18:31:38 +02:00
bjorn3
f9ff604d96 Make dylib metadata write backend agnostic 2019-10-18 18:31:38 +02:00
bjorn3
8243a370d2 Rustup to rustc 1.40.0-nightly (fa0f7d008 2019-10-17) 2019-10-18 18:31:26 +02:00
bjorn3
f0c774e05d Rustup to rustc 1.40.0-nightly (237d54ff6 2019-10-15) 2019-10-16 18:43:52 +02:00
bjorn3
82fde5b622 Remove bitflags dependency 2019-10-06 17:52:23 +02:00
bjorn3
75db7cc49d Remove logfile support from unimpl.rs
I haven't used it in months
2019-10-06 17:36:15 +02:00
bjorn3
6129921529 More 128bit support
* UnOp::Neg
* ctpop
* bitreverse

Also replaces `if let Some(64u128) = ...` with `if ... = Some(u64u128)`
to be able to compile cg_clif using cg_clif, as cranelift_frontend::Switch
doesn't support i128 yet.
2019-10-06 15:51:43 +02:00
bjorn3
b5d29a8c58 Rustup to rustc 1.40.0-nightly (787005079 2019-10-04) 2019-10-06 10:41:15 +02:00
bjorn3
b0de88b741 Use DisplayFunctionAnnotations::default() 2019-10-04 14:57:07 +02:00
bjorn3
721fe3b43c Predefine all local functions before codegen
Otherwise only calls to previously codegened functions use relative
addressing instead of the GOT

Fixes #692
2019-10-04 14:45:53 +02:00
bjorn3
58a9b648e8 Update cranelift, faerie and target-lexicon 2019-10-03 18:55:01 +02:00
bjorn3
0f938f68a5 Rustup to rustc 1.40.0-nightly (2daa404e9 2019-10-02) 2019-10-03 17:22:01 +02:00
bjorn3
1b6706c924 Call cg_ssa::base::provide_both in provide{,_extern} 2019-09-28 17:01:17 +02:00
bjorn3
0db605040e Use CallConv::triple_default instead of hard coding SystemV
Fixes #718
2019-09-28 17:00:27 +02:00
bjorn3
44792f1089 Rustup to rustc 1.40.0-nightly (084beb83e 2019-09-27) 2019-09-28 14:06:12 +02:00
bjorn3
1e5cea09d5 Add profile code around metadata object generation
cc #719
2019-09-22 16:47:45 +02:00
bjorn3
a1bf96f630 Wrap linker invocation in time() 2019-09-22 16:21:00 +02:00
bjorn3
dbeca50901 Misc cleanup 2019-09-22 16:05:22 +02:00
bjorn3
3a7aa6c0fa Reduce time required to build from scratch in dev mode
* Disable wasm reading of object
* Use tempfile bundled with rustc
* Don't optimize and don't generate debuginfo for build scripts and some
  build deps

Before: 354s (5m 45s)
After: 207s (3m 27s)
2019-09-21 14:27:45 +02:00
bjorn3
fdfb1eda2c Rustup to rustc 1.39.0-nightly (97e58c0d3 2019-09-20) 2019-09-21 11:30:29 +02:00
bjorn3
77d33c1707 Fix trans_ptr_binop for fn() 2019-09-15 18:35:56 +02:00
bjorn3
c34ada7cca Fix foreign type handling 2019-09-14 17:53:36 +02:00
bjorn3
b267995f39 Cleanup 2019-09-14 15:15:06 +02:00
bjorn3
8f12b87542 Implement shl and shr overflow checks
cc #6
2019-09-14 12:13:23 +02:00
bjorn3
6ea4cbdf1b Rustup to rustc 1.39.0-nightly (a6946a817 2019-09-13) 2019-09-14 11:21:18 +02:00
bjorn3
af4009d8c8 Rustup to rustc 1.39.0-nightly (eb48d6bde 2019-09-12) 2019-09-13 21:03:26 +02:00
bjorn3
ce0be229d7 Use upstream cranelift 2019-09-08 19:18:17 +02:00
bjorn3
629f7ab4a3 Don't perform neg overflow checks when they are disabled 2019-09-07 11:00:49 +02:00
bjorn3
bfb49e7d19 Rustup to rustc 1.39.0-nightly (6e19f3f38 2019-09-06) 2019-09-07 10:51:00 +02:00
bjorn3
a2e905f22d Correctly align offset for dst field projections
Fixes #681
2019-09-02 20:09:37 +02:00
bjorn3
cd0e862282 Update ar
Fixes #672
2019-09-01 11:17:01 +02:00
Atul Bhosale
f481a4b685
Format code using 'cargo fmt' 2019-08-31 22:58:09 +05:30
bjorn3
15b9834d7d Don't copy ByRef passed types to local stack slot when not necessary
Eg when the local is immutable **and** the type is freeze.

This makes the simple raytracer runtime benchmark 1% faster than cg_llvm
without optimizations. Before it was 2% slower.

cc #691
cc #684
2019-08-30 15:42:07 +02:00
bjorn3
76d2e085db Improve abi ir comments a bit 2019-08-30 15:07:15 +02:00
bjorn3
d731c4a6a7 Move ir comments generation to abi/comments.rs
Also list locals stored in ssa vars in the comments
2019-08-30 14:21:24 +02:00
bjorn3
deeae2fce4 Small change 2019-08-30 12:42:24 +02:00
bjorn3
16593d264c Move return handling to abi/returning.rs 2019-08-30 12:30:57 +02:00
bjorn3
68dcfc1c78 Move pass mode handling to abi/pass_mode.rs 2019-08-30 11:58:52 +02:00
bjorn3
6427eaf68b Move abi.rs to abi/mod.rs 2019-08-30 11:51:33 +02:00
bjorn3
556d708f20 Rustup to rustc 1.39.0-nightly (72b2abfd6 2019-08-29) 2019-08-30 11:42:42 +02:00
bjorn3
d9d8c69af1 Split extract layout field of all CPlace variants into a sparate struct 2019-08-29 11:23:19 +02:00
bjorn3
1018a34662 Don't add stack_addr intructions to prelude
Speeds up simple-raytracer by 30% (cc #684)
Also reduces the size of the simple-raytracer binary from 9.2MB to 8.6MB
2019-08-28 17:59:48 +02:00
bjorn3
6127632c76 Use f{32,64}const insts instead of loading from a global value 2019-08-28 16:38:53 +02:00
bjorn3
40629999bc Don't force RETURN_PLACE to stack
Speeds up simple-raytracer by 7% (cc #684)
2019-08-28 15:29:10 +02:00
bjorn3
b9dc950a11 Rustup to rustc 1.39.0-nightly (9b91b9c10 2019-08-26) 2019-08-27 11:01:36 +02:00
bjorn3
e704eb5259 Sync discriminant getter and setter with upstream
Fixes #683
2019-08-26 11:03:06 +02:00
bjorn3
bb634f3c88 Always use Linkage::Import for relocations targeting a static 2019-08-21 14:57:12 +02:00
bjorn3
1f90b04cd6 Fix float -> u/i128 cast
The original test casts were optimized away by rustc,
so cg_clif never saw them.

cc #668
2019-08-21 14:35:48 +02:00
bjorn3
b2d6705fe2 Implement u/i128 <-> float casts
Fixes #668
2019-08-21 14:01:29 +02:00
bjorn3
3fcd54088c Implement saturating_{add,sub} intrinsics 2019-08-20 10:40:08 +02:00
bjorn3
f99d31dbfe Implement pow{f32,f64} intrinsics 2019-08-19 17:16:21 +02:00
bjorn3
95908f61a0 Add unimpl! for cast between 128bit int and float 2019-08-19 16:43:25 +02:00
bjorn3
ae428a2d70 Fix saturating_{add,sub} for 8bit and 16bit ints 2019-08-19 16:42:56 +02:00
bjorn3
0e35e4ea19 Set correct linkage for statics 2019-08-19 16:27:21 +02:00
bjorn3
edbb5730ea Implement copysign{f32,f64} intrinsics 2019-08-19 16:27:09 +02:00
bjorn3
ce860e5fde Fix cross crate static duplicate codegen 2019-08-19 16:26:20 +02:00
bjorn3
2a20cc0b94 Use anonymous lifetimes where possible 2019-08-18 16:52:07 +02:00
bjorn3
1bee110d95 Let codegen_get_discriminant accept CValue instead of CPlace 2019-08-18 16:19:33 +02:00
bjorn3
5b818e5e0f Use native ar to create archive files
Workaround for #672
2019-08-18 16:06:59 +02:00
bjorn3
43e68319fa Rustup to rustc 1.39.0-nightly (2111aed0a 2019-08-17) 2019-08-18 11:30:13 +02:00
bjorn3
21141eb235 Don't keep alloc_map locked while calling data_id_for_static
Fixes #670
2019-08-17 12:42:57 +02:00
bjorn3
480db7dd9e Implement system abi 2019-08-16 18:16:24 +02:00
bjorn3
2558bf2f6b Workaround for missing #[rustc_args_required_const(..)] support
cc #666
2019-08-16 16:04:50 +02:00
bjorn3
7c7a8e8367 Workaround for missing icmp{,_imm}.i128 legalizations
Fixes #667
2019-08-15 11:36:23 +02:00
bjorn3
9505d60a24 Cast rhs to lhs type for shl and shr 2019-08-14 15:18:05 +02:00
bjorn3
b4e55cdedd Refactor num.rs 2019-08-14 15:03:52 +02:00
bjorn3
db071db95a Calculate sign in trans{,_checked}_int_binop instead of caller 2019-08-14 13:01:55 +02:00
bjorn3
32cb5b8c8e Move discriminant get and set to discriminant.rs 2019-08-14 12:01:41 +02:00
bjorn3
883894a07a Move trans_*_binop to num.rs 2019-08-14 11:52:39 +02:00
bjorn3
581b6ea5be Misc changes 2019-08-14 11:36:24 +02:00
bjorn3
11b2b86b08 Fix some rustc tests
* Check for `#[rustc_error]` attribute.
* Use the same weak static type error message as cg_llvm
2019-08-13 19:42:16 +02:00
bjorn3
6f23a053e4 Fix a panic on type size overflow 2019-08-13 19:40:48 +02:00
bjorn3
70fbca287c Fix intrinsic::transmute::<_, <uninhabited>>(...) 2019-08-13 19:39:59 +02:00
bjorn3
f02d135057 Print error for #[rustc_def_path] like expected 2019-08-13 19:39:46 +02:00
bjorn3
9fdef69fe4 Fix uninit intrinsic for zst values 2019-08-13 19:37:51 +02:00
bjorn3
f9c20ce244 Rustup to rustc 1.38.0-nightly (534b42394 2019-08-09) 2019-08-13 12:18:35 +02:00
bjorn3
36184d286c Remove outdated FIXME and add some new FIXME 2019-08-13 11:46:59 +02:00
bjorn3
f93cd924ec Implement float -> small int cast
Also workaround small signed int eq/ne binop clif bug
2019-08-12 17:25:16 +02:00
bjorn3
314141392a Implement log2{f32,f64} intrinsics 2019-08-12 15:54:24 +02:00
bjorn3
57bc9d8daf Extract jit imported symbols loading functionAlso make the staticlib load error non fatal 2019-08-11 19:04:56 +02:00
bjorn3
bd19af37f4 Remove debugging println 2019-08-11 18:12:49 +02:00
bjorn3
05b7312db2 Misc changes 2019-08-11 17:33:52 +02:00
bjorn3
9041db962d Fix it 2019-08-11 17:06:18 +02:00
bjorn3
3000a3f63d [WIP] Implement dylib loading for the JIT 2019-08-10 16:50:23 +02:00
bjorn3
dbac219207 Libtest support 2019-08-09 12:46:24 +02:00
bjorn3
e7a507863c Implement real saturating behaviour for the saturating_* intrinsics with unsigned ints 2019-08-09 12:35:51 +02:00
bjorn3
6414f03644 Don't omit overflow checks for *_with_overflow intrinsics when compiling without debug assertions 2019-08-09 12:35:51 +02:00
bjorn3
19a3bfec3b Fix constant alignment on macOS 2019-08-07 15:26:29 +02:00
bjorn3
bd7c119e4b Rustup to rustc 1.38.0-nightly (6a91782b7 2019-08-06) 2019-08-07 12:35:49 +02:00
bjorn3
7602a46bb9 Implement simd_extract 2019-08-05 16:28:27 +02:00
bjorn3
a1dd460714 Rustup to rustc 1.38.0-nightly (6e0d27d93 2019-08-03) 2019-08-04 13:42:40 +02:00
bjorn3
fb3fa677fa Call assert_module_sources 2019-08-04 13:42:03 +02:00
bjorn3
c4af588f72 Correctly align all allocs
Fixes #348
2019-08-01 11:49:03 +02:00
bjorn3
62166ed9c8 Correctly implement atomic_nand_* intrinsics
Fixes #639
2019-08-01 10:59:17 +02:00
bjorn3
b806070a88 Fix simd_cast 2019-07-31 09:46:05 +02:00
bjorn3
1028fbb68c Fix release builds 2019-07-30 15:00:15 +02:00
bjorn3
69526d464f Implement some float simd intrinsics 2019-07-30 14:37:20 +02:00
bjorn3
ee4927e069 Fix _mm_movemask_epi8
The order of iteration was wrong
2019-07-29 18:59:17 +02:00
bjorn3
49b21f2730 Fix returning (u128, u128) 2019-07-29 13:18:21 +02:00
bjorn3
63646b1956 Implement llvm.x86.avx2.pmovmskb llvm intrinsic 2019-07-29 12:50:20 +02:00
bjorn3
48a6b581b5 Emulate llvm.x86.sse2.pmovmskb.128 llvm intrinsic 2019-07-29 12:43:24 +02:00
bjorn3
9cb787fe70 Implement and test simd_shuffle* 2019-07-29 11:23:53 +02:00
bjorn3
76b89476c3 [WIP] simd_shuffle* 2019-07-29 11:03:55 +02:00
bjorn3
78e0525366 [WIP] simd_shuffle support 2019-07-29 11:03:55 +02:00
bjorn3
1a26891170 Replace llvm intrinsics with runtime trap 2019-07-29 11:03:55 +02:00
bjorn3
90f2b12d47 Fix simd comparison 2019-07-29 11:03:55 +02:00
bjorn3
9e3f2391b8 Emulate compare simd intrinsics 2019-07-29 11:03:55 +02:00
bjorn3
7fdd058c60 Emulate some simd intrinsics 2019-07-29 11:03:55 +02:00
bjorn3
436a24a85d Implement many more float intrinsics 2019-07-27 16:52:00 +02:00