about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/consts.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-512/+0
2020-08-17Auto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obkbors-1/+1
Incorporated Tracing Crate in some libraries Issue #74747
2020-08-15Merge branch 'master' into feature/incorporate-tracingpawanbisht62-5/+5
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-1/+1
2020-08-10Merge branch 'master' into feature/incorporate-tracingpawanbisht62-1/+1
2020-08-08Miri: Renamed "undef" to "uninit"Philippe Nadon-5/+5
Renamed remaining references to "undef" to "uninit" when referring to Miri. Impacted directories are: - src/librustc_codegen_llvm/consts.rs - src/librustc_middle/mir/interpret/ - src/librustc_middle/ty/print/pretty.rs - src/librustc_mir/ - src/tools/clippy/clippy_lints/src/consts.rs Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project. Related issue #71193
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-1/+1
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-06Incorporate tracing cratebishtpawan-1/+1
2020-07-29Auto merge of #72049 - mati865:mingw-lld, r=petrochenkovbors-1/+1
MinGW: enable dllexport/dllimport Fixes (only when using LLD) https://github.com/rust-lang/rust/issues/50176 Fixes https://github.com/rust-lang/rust/issues/72319 This makes `windows-gnu` on pair with `windows-msvc` when it comes to symbol exporting. For MinGW it means both good things like correctly working dllimport/dllexport, ability to link with LLD and bad things like https://github.com/rust-lang/rust/issues/27438. Not sure but maybe this should land behind unstable compiler option (`-Z`) or environment variable?
2020-07-29MinGW: emit dllexport/dllimport by rustcMateusz Mikuła-1/+1
This fixes various cases where LD could not guess dllexport correctly and greatly improves compatibility with LLD which is not going to support linker scripts anytime soon
2020-07-22[AVR] Correctly set the pointer address space when constructing pointers to ↵Dylan McKay-3/+9
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-20mir: `unused_generic_params` queryDavid Wood-2/+2
This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17Generating the coverage mapRich Kadel-3/+7
rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example: $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main 1| 1|pub fn will_be_called() { 2| 1| println!("called"); 3| 1|} 4| | 5| 0|pub fn will_not_be_called() { 6| 0| println!("should not have been called"); 7| 0|} 8| | 9| 1|fn main() { 10| 1| let less = 1; 11| 1| let more = 100; 12| 1| 13| 1| if less < more { 14| 1| will_be_called(); 15| 1| } else { 16| 1| will_not_be_called(); 17| 1| } 18| 1|}
2020-07-15Change `SymbolName::name` to a `&str`.Nicholas Nethercote-6/+4
This eliminates a bunch of `Symbol::intern()` and `Symbol::as_str()` calls, which is good, because they require locking the interner. Note that the unsafety in `from_cycle_error()` is identical to the unsafety on other adjacent impls.
2020-04-30Add a convenience function for testing whether a static is `#[thread_local]`Oliver Scherer-0/+1
2020-04-23Address comments from reviewmarmeladema-3/+2
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-1/+1
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-1/+3
2020-04-03Rollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obkMazdak Farrokhzad-16/+13
Place TLS initializers with relocations in .tdata Should fix #70673, although I'm not sure how to test this. Perhaps @joshlf could find a MCVE? Also adds more context to the FIXME. r? @oli-obk
2020-04-02Place TLS initializers with relocations in .tdataDylan MacKenzie-16/+13
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-3/+2
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-5/+7
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-6/+6
2020-03-11librustc_codegen_llvm: Replace deprecated API usageTomasz Miąsko-2/+2
2020-02-15Change const eval to return `ConstValue`, instead of `Const` as the type ↵Ben Lewis-5/+3
inside it shouldn't be used.
2020-01-06Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisabors-2/+3
Nix `rustc_hir` reexports in rustc::hir r? @Zoxc cc @Mark-Simulacrum
2020-01-05Rename Instance.ty to Instance.monomorphic_tyAaron Hill-2/+2
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-2/+3
2020-01-04extract rustc::middle::codegen_fn_attrsMazdak Farrokhzad-5/+3
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-24x.py fmt after previous deignoreMark Rousskov-73/+59
2019-12-22Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obkMazdak Farrokhzad-8/+2
Add simpler entry points to const eval for common usages. I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways: - Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc. - Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants. - Evaluates a promoted constant. This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval` is normally used.
2019-12-21Handle Attributes in arena.Camille GILLOT-2/+2
2019-12-22Add simpler entry points to const eval for common usages.Ben Lewis-8/+2
2019-12-11Remove unused importAaron Hill-1/+0
2019-12-11rustc: Link LLVM directly into rustc againAlex Crichton-0/+3
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-04Migrate to LLVM{Get,Set}ValueName2Josh Stone-6/+4
The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated strings, but the `2` variants use explicit lengths, which fits better with Rust strings and slices. We now use these in new helper functions `llvm::{get,set}_value_name` that convert to/from `&[u8]`.
2019-11-18Allow different global references to the same nameStephen Crane-3/+5
Combining CGUs can result in code that references a static variable through both an Item and a ForeignItem with the same name. We don't care that the global was already created by a ForeignItem reference when we see the Item reference, as long as the LLVM types of the ForeignItem and Item match. Fixes #66464
2019-11-12Rename in librustc_codegen_llvm.Camille GILLOT-2/+2
2019-10-21Change `SymbolName::name` from `InternedString` to `Symbol`.Nicholas Nethercote-1/+1
This requires changing the `PartialOrd`/`Ord` implementations to look at the chars rather than the symbol index.
2019-10-05Replaces some instances of `as *[const | mut] _` with `.cast()`memoryruins-3/+3
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-1/+1
2019-09-26Rename `Item.node` to `Item.kind`varkor-1/+1
2019-09-25Rename `sty` to `kind`varkor-1/+1
2019-09-05Rollup merge of #64141 - nnethercote:minimize-LocalInternedString, ↵Mazdak Farrokhzad-7/+8
r=petrochenkov Minimize uses of `LocalInternedString` `LocalInternedString` is described as "An alternative to `Symbol` and `InternedString`, useful when the chars within the symbol need to be accessed. It is best used for temporary values." This PR makes the code match that comment, by removing all non-local uses of `LocalInternedString`. This allows the removal of a number of operations on `LocalInternedString` and a couple of uses of `unsafe`.
2019-09-04Remove `LocalInternedString` uses from `librustc_codegen_llvm/consts.rs`.Nicholas Nethercote-7/+8
2019-09-04Remove `LocalInternedString` uses from `librustc/ty/`.Nicholas Nethercote-1/+1
This is not a compelling change in isolation, but it is a necessary step.
2019-08-30Fixup remaining direct relocation field referencesAndreas Molzer-4/+4
2019-08-28Address naming and comments from reviewsAndreas Molzer-3/+3