Commit Graph

104 Commits

Author SHA1 Message Date
bishtpawan
fdfbd89946 Incorporate tracing crate 2020-08-06 16:56:56 +05:30
Bastian Kauschke
6a9c5fb4cc polymorphize GlobalAlloc::Function 2020-07-22 17:02:58 +02:00
Dylan McKay
8ae5eadb22 [AVR] Correctly set the pointer address space when constructing pointers to functions
This patch extends the existing `type_i8p` method so that it requires an
explicit address space to be specified. Before this patch, the
`type_i8p` method implcitily assumed the default address space, which is
not a safe transformation on all targets, namely AVR.

The Rust compiler already has support for tracking the "instruction
address space" on a per-target basis. This patch extends the code
generation routines so that an address space must always be specified.

In my estimation, around 15% of the callers of `type_i8p` produced
invalid code on AVR due to the loss of address space prior to LLVM final
code generation. This would lead to unavoidable assertion errors
relating to invalid bitcasts.

With this patch, the address space is always either 1) explicitly set to
the instruction address space because the logic is dealing with functions
which must be placed there, or 2) explicitly set to the default address
space 0 because the logic can only operate on data space pointers and thus
we keep the existing semantics of assuming the default, "data" address space.
2020-07-22 05:16:22 +12:00
Manish Goregaokar
218b90f643
Rollup merge of #72689 - lcnr:common_str, r=estebank
add str to common types

I already expected this to be the case and it may slightly improve perf.

Afaict if we ever want to change str into a lang item this would have to get reverted.
As that would be fairly simple I don't believe this to cause any problems in the future.
2020-06-19 19:42:47 -07:00
Oliver Scherer
0aa7f4d2f2 Make TLS accesses explicit in MIR 2020-05-30 12:59:05 +02:00
Bastian Kauschke
b3aa5e3810 add str to common types 2020-05-28 13:02:02 +02:00
Oliver Scherer
43fcd7d55e Create a convenience wrapper for get_global_alloc(id).unwrap() 2020-05-08 10:59:09 +02:00
Oliver Scherer
38ae8f3286 Simplify the tcx.alloc_map API 2020-05-08 10:59:08 +02:00
Mazdak Farrokhzad
124144704f nix rustc_target::abi::* reexport in ty::layout 2020-04-02 13:40:43 +02:00
Mazdak Farrokhzad
0cb9e36090 rustc -> rustc_middle part 2 2020-03-30 07:16:56 +02:00
Ana-Maria Mihalache
50d2c3abd5 Rename TyLayout to TyAndLayout. 2020-03-27 17:14:53 +00:00
Matthias Krüger
ad00e91887 remove redundant returns (clippy::needless_return) 2020-03-20 20:23:03 +01:00
bors
1572c433ee Auto merge of #69986 - JohnTitor:rollup-h0809mf, r=JohnTitor
Rollup of 12 pull requests

Successful merges:

 - #69403 (Implement `Copy` for `IoSlice`)
 - #69460 (Move some `build-pass` tests to `check-pass`)
 - #69723 (Added doc on keyword Pub.)
 - #69802 (fix more clippy findings)
 - #69809 (remove lifetimes that can be elided (clippy::needless_lifetimes))
 - #69947 (Clean up E0423 explanation)
 - #69949 (triagebot.toml: add ping aliases)
 - #69954 (rename panic_if_ intrinsics to assert_)
 - #69960 (miri engine: fix treatment of abort intrinsic)
 - #69966 (Add more regression tests)
 - #69973 (Update stable-since version for const_int_conversion)
 - #69974 (Clean up E0434 explanation)

Failed merges:

r? @ghost
2020-03-13 19:16:03 +00:00
bors
d6072319a9 Auto merge of #69155 - chrissimpkins:llvm-globals, r=eddyb
Add support for LLVM globals corresponding to miri allocations should be named alloc123

Adds support for this request from @eddyb in #69134:

> That is, if -Zfewer-names is false (usually only because of --emit=llvm-ir), we should use the same name for LLVM globals we generate out of miri allocs as #67133 does in MIR output (allocN).
>
>This way, we can easily see the mapping between MIR and LLVM IR (and it shouldn't be any costlier for regular compilation, which would continue to use unnamed globals).

r? @eddyb
cc @oli-obk
2020-03-13 16:10:20 +00:00
Matthias Krüger
7b1b08cfee remove lifetimes that can be elided (clippy::needless_lifetimes) 2020-03-12 20:03:09 +01:00
Chris Simpkins
cf929f77bf support LLVM globals corresponding to miri allocations 2020-03-12 09:57:05 -04:00
Vadim Petrochenkov
e08c279eac Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
Eduard-Mihai Burtescu
0b633c82f0 rustc_codegen_ssa: split declare_local into create_dbg_var and dbg_var_addr. 2020-02-03 12:14:21 +02:00
Mazdak Farrokhzad
4ff12ce4c1 Normalize syntax::symbol imports. 2020-01-02 13:57:04 +01:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Mazdak Farrokhzad
a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01: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
varkor
9f1269f23c Rename to then_some and then 2019-12-06 12:24:54 +00:00
varkor
e3a8ea4e18 Use to_option in various places 2019-12-06 12:23:23 +00: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
f0e2fc7623 Improve type safety 2019-10-13 14:43:58 +02:00
bjorn3
bcb01bca86 Remove MiscMethods::instances 2019-10-13 14:43:57 +02:00
bjorn3
f1ed3a8786 s/FuncId/Function 2019-10-13 14:35:14 +02:00
bjorn3
cf858a8ac0 Remove is_const_integral method from ConstMethods 2019-10-13 14:35:14 +02:00
bjorn3
4d1a5ade9b Introduce FuncId backend type 2019-10-13 14:35:14 +02: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
Oliver Scherer
ab949fdd64 Cast only where necessary 2019-08-17 11:29:17 +02:00
Oliver Scherer
1fb854a0f5 Do not generate allocations for zero sized allocations 2019-08-16 16:05:36 +02:00
Ralf Jung
30c63aa2b8 assert consistency 2019-08-02 23:02:53 +02:00
Ralf Jung
e590b849b8 CTFE: simplify Value type by not checking for alignment 2019-08-02 23:02:53 +02: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
Nikita Popov
5c95f5fa6b Fix float add/mul reduction codegen
The accumulator is now respected for unordered reductions.
2019-07-09 21:55:29 +02:00
Lzu Tao
7646d4935b Remove use of mem::uninitialized in code_gen crate 2019-07-06 03:27:05 +00:00
Mark Rousskov
007d87f171 Permit use of mem::uninitialized via allow(deprecated) 2019-07-04 21:01:35 -04:00
Oliver Scherer
fb37bf0037 Weave the alignment through ByRef 2019-06-19 09:53:32 +02:00
Ralf Jung
41c36fabef light refactoring of global AllocMap
* rename AllocKind -> GlobalAlloc. This stores the allocation itself, not just its kind.
* rename the methods that allocate stuff to have consistent names.
2019-05-30 13:05:05 +02:00
Ralf Jung
082da0c698 rename Scalar::Bits to Scalar::Raw and bits field to data 2019-05-26 11:08:03 +02:00
Vadim Petrochenkov
6c187cc0c6 Change return type of TyCtxt::is_static to bool
Add `TyCtxt::is_mutable_static`
2019-04-21 14:41:51 +03: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
a3fa1161d2 Remove const_{fat_ptr,array,vector,bytes} from cg_ssa 2019-03-29 17:17:12 +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