Commit Graph

132 Commits

Author SHA1 Message Date
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
Mark Rousskov 66dce1114d Store ptr_width as u32 on Config
This removes the dependency on IntTy, UintTy from Session.
2019-11-24 16:32:07 -05:00
Adam Perry 86e55b1882 Always use consteval to codegen caller_location. 2019-10-27 12:51:55 -07:00
Adam Perry aec97e050e Panicking infra uses &core::panic::Location.
This allows us to remove `static_panic_msg` from the SSA<->LLVM
boundary, along with its fat pointer representation for &str.

Also changes the signature of PanicInfo::internal_contructor to
avoid copying.

Closes #65856.
2019-10-27 12:50:58 -07:00
Adam Perry 743964ad3f Implement core::intrinsics::caller_location.
Returns a `&core::panic::Location` corresponding to where it was
called, also making `Location` a lang item.
2019-10-27 12:50:52 -07:00
bjorn3 f1ed3a8786 s/FuncId/Function 2019-10-13 14:35:14 +02:00
bjorn3 4d1a5ade9b Introduce FuncId backend type 2019-10-13 14:35:14 +02:00
varkor e3fb05dc3c Rename some `_sty` variables to `_kind` 2019-09-26 12:10:43 +01:00
varkor e2e0f9af85 Rename `sty` to `kind` 2019-09-25 15:50:04 +01:00
Eduard-Mihai Burtescu e9214a147b codegen: be more explicit about setting giving names to allocas. 2019-09-12 19:04:30 +03:00
Mazdak Farrokhzad 085c9e691e
Rollup merge of #64003 - Dante-Broggi:place-align-in-layout, r=matthewjasper
place: Passing `align` = `layout.align.abi`, when also passing `layout`

Of the calls changed:
7/12 use `align` = `layout.align.abi`.
`from_const_alloc` uses `alloc.align`, but that is `assert_eq!` to `layout.align.abi`.
only 4/11 use something interesting for `align`.
2019-09-05 12:11:08 +02:00
Nicholas Nethercote d78b33a807 Remove `LocalInternedString` uses from `librustc_codegen_llvm`. 2019-09-04 14:23:45 +10:00
Dante-Broggi 8657fb1140 `new_sized` is mostly used without align
so rename it `new_sized_aligned`.
6/11 use `align` = `layout.align.abi`.
`from_const_alloc` uses `alloc.align`, but that is `assert_eq!` to `layout.align.abi`.
only 4/11 use something interesting for `align`.
2019-08-29 14:24:50 -04:00
Nikita Popov 6fae7db65d Remove vector fadd/fmul reduction workarounds
The bugs that this was working around have been fixed in LLVM 9.
2019-07-20 18:49:50 +02:00
Samy Kacimi 8aa9f18eb5
normalize use of backticks for compiler messages in librustc_codegen
https://github.com/rust-lang/rust/issues/60532
2019-07-08 00:54:38 +02:00
Jeremy Stucki ec711767a7
Remove needless lifetimes 2019-07-03 10:01:02 +02:00
Julien Cretin b8106b59d2 Fix meta-variable binding errors in macros
The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.
2019-06-23 01:30:41 +02:00
Eduard-Mihai Burtescu b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Eduard-Mihai Burtescu f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu 87b6b86468 rustc_codegen_llvm: `deny(unused_lifetimes)`. 2019-06-12 16:02:03 +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
Eduard-Mihai Burtescu 8ee1814062 rustc_codegen_*: deny(unused_lifetimes). 2019-06-11 14:11:58 +03:00
lcnr/Bastian Kauschke d6266a7666 add support for unchecked math 2019-06-03 12:59:17 +02:00
Eduard-Mihai Burtescu 25d6834493 rustc_codegen_llvm: replace `fn noname()` with `const UNNAMED`. 2019-06-01 21:13:08 +03:00
Eduard-Mihai Burtescu 268e64641f rustc_codegen_llvm: pretty up a few builder methods with a macro. 2019-06-01 21:12:42 +03:00
Eduard-Mihai Burtescu 7fa97c0850 rustc_codegen_llvm: rename away the last occurrence of `insn`. 2019-05-29 01:43:58 +03:00
Eduard-Mihai Burtescu 29b7c0687e rustc_codegen_llvm: remove LLVM instruction count stats. 2019-05-29 01:43:57 +03:00
Saleem Jaffer 44eb607d76 removes `AbiMethods` 2019-05-14 21:23:01 +05:30
Saleem Jaffer 18679cdc54 adding HasParamEnv trait 2019-05-04 15:19:59 +05:30
bjorn3 35705dee7e Use ExactSizeIterator + TrustedLen instead of num_cases arg for switch 2019-03-29 17:23:52 +01:00
bjorn3 56842b2154 Add a method for emiting a switch. 2019-03-29 17:17:14 +01:00
bjorn3 b2e61946fa Remove inline_asm_call from cg_ssa
`count_insn` is no longer called for inline asm, because it is private to builder.rs
2019-03-29 17:17:13 +01:00
bjorn3 b71c429007 Remove type_variadic_func and typ_array from cg_ssa 2019-03-29 17:17:13 +01:00
bjorn3 7de0b1de19 Move get_param and set_value_name 2019-03-29 17:17:13 +01:00
bjorn3 bcab49720e Remove a lot of methods from BuilderMethods 2019-03-29 17:17:12 +01:00
bjorn3 7b94195c22 Remove const_{cstr,str_slice,get_elt,get_real} and is_const_real methods from cg_ssa
This introduces the static_panic_msg trait method to StaticBuilderMethods.
2019-03-29 17:17:12 +01:00
bjorn3 a0056333f1 Misc 2019-03-29 17:17:12 +01:00
bjorn3 fe88440bd2 Add a comment 2019-03-29 17:17:12 +01:00
bjorn3 83e80a7443 Use Builder instead of CodegenCx for OperandRef and LocalRef 2019-03-29 17:17:12 +01:00
Mazdak Farrokhzad 9661a81968 librustc_codegen_llvm: deny(elided_lifetimes_in_paths) 2019-02-25 08:40:18 +01:00
Taiki Endo 1b7ca961d9 librustc_codegen_llvm => 2018 2019-02-18 03:58:58 +09:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Nikita Popov 706e67b0a0 Bump minimum required LLVM version to 6.0 2018-12-09 12:05:40 +01:00
bjorn3 d108a913c7 Move get_static from CodegenCx to Builder 2018-11-29 18:19:44 +01:00
bjorn3 ceb29e2ac4 Use implicit deref instead of BuilderMethods::cx() 2018-11-29 18:19:44 +01:00
bjorn3 e45733048e Require Deref to CodegenCx for HasCodegen 2018-11-29 18:19:44 +01:00
bjorn3 2d4c96d1b1 Move IntrinsicCallMethods::call_overflow_intrinsics to BuilderMethods::checked_binop 2018-11-29 18:19:42 +01:00
bjorn3 9a9045573f Remove call_lifetime_intrinsic from cg_ssa 2018-11-29 18:19:42 +01:00