Commit graph

109 commits

Author SHA1 Message Date
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Alex Crichton
7f23e6e8d7
rustc: Link LLVM directly into rustc again
This commit builds on #65501 continue to simplify the build system and
compiler now that we no longer have multiple LLVM backends to ship by
default. Here this switches the compiler back to what it once was long
long ago, which is linking LLVM directly to the compiler rather than
dynamically loading it at runtime. The `codegen-backends` directory of
the sysroot no longer exists and all relevant support in the build
system is removed. Note that `rustc` still supports a dynamically loaded
codegen backend as it did previously, it just no longer supports
dynamically loaded codegen backends in its own sysroot.

Additionally as part of this the `librustc_codegen_llvm` crate now once
again explicitly depends on all of its crates instead of implicitly
loading them through the sysroot. This involved filling out its
`Cargo.toml` and deleting all the now-unnecessary `extern crate`
annotations in the header of the crate. (this in turn required adding a
number of imports for names of macros too).

The end results of this change are:

* Rustbuild's build process for the compiler as all the "oh don't forget
  the codegen backend" checks can be easily removed.
* Building `rustc_codegen_llvm` is much simpler since it's simply
  another compiler crate.
* Managing the dependencies of `rustc_codegen_llvm` is much simpler since
  it's "just another `Cargo.toml` to edit"
* The build process should be a smidge faster because there's more
  parallelism in the main rustc build step rather than splitting
  `librustc_codegen_llvm` out to its own step.
* The compiler is expected to be slightly faster by default because the
  codegen backend does not need to be dynamically loaded.
* Disabling LLVM as part of rustbuild is still supported, supporting
  multiple codegen backends is still supported, and dynamic loading of a
  codegen backend is still supported.
2019-12-11 09:50:11 -05:00
Eduard-Mihai Burtescu
902433b5bf rustc: take a PolyFnSig instead of an FnSig in FnAbi::of_fn_ptr. 2019-12-03 15:55:14 +02:00
Eduard-Mihai Burtescu
2b921d51d7 rustc: rename FnAbi::new to FnAbi::of_fn_ptr. 2019-12-03 15:41:56 +02:00
Eduard-Mihai Burtescu
95b944210f rustc_codegen_ssa: take a FnAbi instead of a FnSig in declare_fn. 2019-12-03 15:28:18 +02:00
Samuel Holland
1943079361 Configure LLVM module PIC level
As of LLVM 9, this is required for 32-bit PowerPC to properly generate
PLT references. Previously, only BigPIC was supported; now LLVM supports
both BigPIC and SmallPIC, and there is no default value provided.
2019-11-03 10:52:00 -06:00
bjorn3
bcb01bca86 Remove MiscMethods::instances 2019-10-13 14:43:57 +02:00
bjorn3
dad8ddbfdd Inline functions from cg_ssa::callee and remove the mod
Fixes #65271
2019-10-13 14:42:59 +02:00
bors
58b54911fa Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisa
Add llvm.sideeffect to potential infinite loops and recursions

LLVM assumes that a thread will eventually cause side effect. This is
not true in Rust if a loop or recursion does nothing in its body,
causing undefined behavior even in common cases like `loop {}`.
Inserting llvm.sideeffect fixes the undefined behavior.

As a micro-optimization, only insert llvm.sideeffect when jumping back
in blocks or calling a function.

A patch for LLVM is expected to allow empty non-terminate code by
default and fix this issue from LLVM side.

https://github.com/rust-lang/rust/issues/28728

**UPDATE:** [Mentoring instructions here](https://github.com/rust-lang/rust/pull/59546#issuecomment-515072429) to unstall this PR
2019-10-10 15:40:39 +00:00
memoryruins
173958ac80 Replaces some instances of as *[const | mut] _ with .cast() 2019-10-05 03:48:14 -04:00
Xiang Fan
f71e0daa29 Add llvm.sideeffect to potential infinite loops and recursions
LLVM assumes that a thread will eventually cause side effect. This is
not true in Rust if a loop or recursion does nothing in its body,
causing undefined behavior even in common cases like `loop {}`.
Inserting llvm.sideeffect fixes the undefined behavior.

As a micro-optimization, only insert llvm.sideeffect when jumping back
in blocks or calling a function.

A patch for LLVM is expected to allow empty non-terminate code by
default and fix this issue from LLVM side.

https://github.com/rust-lang/rust/issues/28728
2019-09-28 04:45:08 +08:00
Nicholas Nethercote
d78b33a807 Remove LocalInternedString uses from librustc_codegen_llvm. 2019-09-04 14:23:45 +10:00
Esteban Küber
bdd79b849e tweak output and tests 2019-08-04 12:23:05 -07:00
Esteban Küber
387dcff796 review comments: clean up 2019-08-04 10:42:46 -07:00
Esteban Küber
db099fb491 Point to local place span on "type too big" error 2019-08-03 21:59:51 -07:00
Nikita Popov
8789c9e595 Strip function pointer alignment for older LLVM versions 2019-07-09 21:55:29 +02:00
Eduard-Mihai Burtescu
b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Shotaro Yamada
6a0abd6048 Remove unnecessary .clone() 2019-06-15 20:46:00 +09:00
Eduard-Mihai Burtescu
f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
fff08cb043 Run rustfmt --file-lines ... for changes from previous commits. 2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu
21ac960334 rustc: remove some unnecessary lifetimes in -> TyCtxt methods. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
17cdd356da rustc: replace TyCtxt<'tcx, 'gcx, 'tcx> with TyCtxt<'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552 rustc: replace TyCtxt<'a, 'gcx, 'tcx> with TyCtxt<'tcx, 'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
varkor
0e5edc9f16 Add intrinsics for floating-point min and max 2019-06-06 21:27:23 +01:00
Mark Mansi
3287ddf937 remove reexports of mir::mono::{MonoItem,CodegenUnit} 2019-06-02 22:50:03 -05:00
Mark Mansi
8af151b30a remove reexport of rustc::ty::Instance 2019-06-02 22:32:42 -05:00
Eduard-Mihai Burtescu
29b7c0687e rustc_codegen_llvm: remove LLVM instruction count stats. 2019-05-29 01:43:57 +03:00
Saleem Jaffer
80d5478649 removing param_env from pointee_info_at 2019-05-04 18:06:40 +05:30
Saleem Jaffer
18679cdc54 adding HasParamEnv trait 2019-05-04 15:19:59 +05:30
Saleem Jaffer
199ff02dac resolving conflicts 2019-05-04 15:17:26 +05:30
Daan de Graaf
f1f9343c3d Remove old pointee_info_at body. 2019-05-04 15:17:26 +05:30
Fabian Drinck
541c4999a9 Remove redundant imports 2019-03-30 22:37:02 +01:00
bjorn3
7de0b1de19 Move get_param and set_value_name 2019-03-29 17:17:13 +01:00
bjorn3
2b688a959d Don't use c_uint in cg_ssa 2019-03-29 17:06:27 +01:00
Simonas Kazlauskas
8d4afbe413 Use informational target machine for metadata
Since there is nothing to optimise there...
2019-03-27 04:03:42 +02:00
Mazdak Farrokhzad
9661a81968 librustc_codegen_llvm: deny(elided_lifetimes_in_paths) 2019-02-25 08:40:18 +01:00
bors
7cb3ee453b Auto merge of #58304 - gnzlbg:simd_saturated, r=nagisa
Add generic simd saturated add/sub intrinsics

r? @eddyb
2019-02-24 04:16:12 +00:00
Taiki Endo
1b7ca961d9 librustc_codegen_llvm => 2018 2019-02-18 03:58:58 +09:00
Mazdak Farrokhzad
a0767d6096
Rollup merge of #58308 - gnzlbg:context_insert_intr, r=eddyb
Extract block to insert an intrinsic into its own function

r? @eddyb
2019-02-14 02:41:24 +01:00
Alexander Regueiro
c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
gnzlbg
94defa9364 Add simd_saturating_{add,sub} intrinsics 2019-02-08 16:53:53 +01:00
gnzlbg
7d6bfc53c8 Extract block to insert an intrinsic into its own function 2019-02-08 16:41:37 +01:00
Nikita Popov
4a4186e4d1 Use LLVM intrinsics for saturating add/sub 2019-01-29 22:32:13 +01:00
Simonas Kazlauskas
f38d0da893 Implement optimize(size) and optimize(speed) 2019-01-24 20:13:50 +02:00
Ariel Ben-Yehuda
3aa1503a61 add support for principal-less trait object types
should be a pure refactoring.
2019-01-04 00:34:52 +02:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors
63f8e6e12b Auto merge of #56642 - nikic:llvm-6, r=alexcrichton
Bump minimum required LLVM version to 6.0

Based on the discussion in #55842, while the overall position of Rust wrt LLVM continues to be contentious, there does seem to be a consensus that there is no need for continued support of LLVM 5. This PR bumps our version requirement to LLVM 6.0 and makes Travis run against that.

I hope that this is going to unblock #52694. If I understand correctly, while this issue still exists in LLVM 6, Ubuntu has backported the relevant patch.

r? @alexcrichton
2018-12-17 04:18:14 +00:00
Alex Crichton
1091eee65b rustc: Switch extern functions to abort by default on panic
This was intended to land way back in 1.24, but it was backed out due to
breakage which has long since been fixed. An unstable `#[unwind]`
attribute can be used to tweak the behavior here, but this is currently
simply switching rustc's internal default to abort-by-default if an
`extern` function panics, making our codegen sound primarily (as
currently you can produce UB with safe code)

Closes #52652
2018-12-12 08:07:28 -08:00
Nikita Popov
6c2d704950 Remove env_alloca hack
This is no longer necessary for LLVM >= 6.
2018-12-11 10:34:02 +01:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00