about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back/symbol_export.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-446/+0
2020-08-16Use LocalDefId instead of HirId for reachable_set elements.Eduard-Mihai Burtescu-5/+3
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-1/+1
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-14LLVM IR coverage encoding aligns closer to Clang'sRich Kadel-12/+3
I found some areas for improvement while attempting to debug the SegFault issue when running rust programs compiled using MSVC, with coverage instrumentation. I discovered that LLVM's coverage writer was generating incomplete function name variable names (that's not a typo: the name of the variable that holds a function name). The existing implementation used one-up numbers to distinguish variables, and correcting the names did not fix the MSVC coverage bug, but the fix in this PR makes the names and resulting LLVM IR easier to follow and more consistent with Clang's implementation. I also changed the way the `-Zinstrument-coverage` option is supported in symbol_export.rs. The original implementation was incorrect, and the corrected version matches the handling for `-Zprofile-generate`, as it turns out. (An argument could be made that maybe `-Zinstrument-coverage` should automatically enable `-Cprofile-generate`. In fact, if `-Cprofile-generate` is analagous to Clang's `-fprofile-generate`, as some documentation implies, Clang always requires this flag for its implementation of source-based code coverage. This would require a little more validation, and if implemented, would probably require updating some of the user-facing messages related to `-Cprofile-generate` to not be so specific to the PGO use case.) None of these changes fixed the MSVC coverage problems, but they should still be welcome improvements. Lastly, I added some additional FIXME comments in instrument_coverage.rs describing issues I found with the generated LLVM IR that would be resolved if the coverage instrumentation is injected with a `Statement` instead of as a new `BasicBlock`. I describe seven advantages of this change, but it requires some discussion before making a change like this.
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-1/+1
2020-07-17Generating the coverage mapRich Kadel-0/+11
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-15Auto merge of #74113 - lcnr:type-dependent-consts-2, r=eddybbors-2/+2
Support const args in type dependent paths (Take 2) once more, except it is sound this time :smiling_face_with_three_hearts: previously #71154 ----- ```rust #![feature(const_generics)] struct A; impl A { fn foo<const N: usize>(&self) -> usize { N } } struct B; impl B { fn foo<const N: usize>(&self) -> usize { 42 } } fn main() { let a = A; a.foo::<7>(); } ``` When calling `type_of` for generic const arguments, we now use the `TypeckTables` of the surrounding body to get the expected type. This alone causes cycle errors though, as we now have `typeck_tables_of(main)` -> `...` -> `type_of(main_ANON0 := 7)` -> `typeck_tables_of(main)` :zap: (see https://github.com/rust-lang/rust/issues/68400#issuecomment-611760290) To prevent this we must not call `type_of(const_arg)` during `typeck_tables_of`. This is achieved by calling `type_of(param_def_id)` instead. We have to somehow remember the `DefId` of the param through all of typeck, which is done using the struct `ty::WithOptConstParam<DefId>`, which replaces `DefId` where needed and contains an `Option<DefId>` to be able to store the const parameter in case it exists. Queries which are currently cached on disk are split into two variants: `query_name`(cached) and `query_name_(of|for)_const_arg`(not cached), with `query_name_of_const_arg` taking a pair `(did, param_did): (LocalDefId, DefId)`. For some queries a method `query_name_of_opt_const_arg` is added to `TyCtxt` which takes a `ty::WithOptConstParam` and either calls `query_name` or `query_name_of_const_arg` depending on the value of `const_param_did`. r? @eddyb @varkor
2020-07-15InstanceDef::ItemBastian Kauschke-2/+2
2020-07-15Change `SymbolName::name` to a `&str`.Nicholas Nethercote-9/+8
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-07-15Add and use more static symbols.Nicholas Nethercote-8/+8
Note that the output of `unpretty-debug.stdout` has changed. In that test the hash values are normalized from a symbol numbers to small numbers like "0#0" and "0#1". The increase in the number of static symbols must have caused the original numbers to contain more digits, resulting in different pretty-printing prior to normalization.
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-4/+4
2020-06-19Rollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikicManish Goregaokar-2/+2
Diagnose use of incompatible sanitizers Emit an error when incompatible sanitizer are configured through command line options. Previously the last one configured prevailed and others were silently ignored. Additionally use a set to represent configured sanitizers, making it possible to enable multiple sanitizers at once. At least in principle, since currently all of them are considered to be incompatible with others.
2020-06-15Export all fns with extern indicatorNathan Corbyn-4/+5
2020-06-15Export `#[inline] #[no_mangle]` fns in cdylibs and staticlibsNathan Corbyn-4/+5
2020-06-14Diagnose use of incompatible sanitizersTomasz Miąsko-2/+2
Emit an error when incompatible sanitizer are configured through command line options. Previously the last one configured prevailed and others were silently ignored. Additionally use a set to represent configured sanitizers, making it possible to enable multiple sanitizers at once. At least in principle, since currently all of them are considered to be incompatible with others.
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-2/+2
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-9/+8
2020-04-28Use the query system to allocate.Camille GILLOT-8/+5
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-2/+2
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-5/+5
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-2/+4
2020-04-05Remove Arcs in queries.Camille GILLOT-4/+3
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-6/+8
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-8/+8
2020-03-19Refactorings to begin getting rid of rustc_codegen_utilsMark Mansi-12/+15
2020-03-18Rollup merge of #69920 - Centril:hir-cleanup, r=ZoxcMazdak Farrokhzad-1/+1
Remove some imports to the rustc crate - When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code). - Use `rustc_session::` imports instead of `rustc::{session, lint}`. r? @Zoxc
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-1/+1
2020-03-15More Method->Fn renamingMark Mansi-1/+1
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-1/+1
2020-01-23Add projection query for upstream drop-glue instances.Michael Woerister-15/+48
This reduces the amount of invalidated data when new types are add to upstream crates.
2020-01-23Make drop-glue take advantage of -Zshare-generics.Michael Woerister-8/+20
2020-01-23Make ExportedSymbols type more local because it's not supposed to beMichael Woerister-3/+1
used outside of the LLVM backend.
2020-01-21Mark __msan_keep_going as an exported symbol for LTOTomasz Miąsko-2/+6
2020-01-20Mark __msan_track_origins as an exported symbol for LTONikita Popov-1/+7
2020-01-20Make sure that all upstream generics get re-exported from Rust dylibs.Michael Woerister-0/+30
2020-01-07Always export static variables as SymbolExportLevel::C in wasmmaik-7/+2
2020-01-07Export scalar statics in wasmmaik-1/+6
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-3/+3
2020-01-04DefId{Map,Set} -> rustc::hir::def_idMazdak Farrokhzad-2/+1
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-1/+2
2020-01-04extract rustc::middle::codegen_fn_attrsMazdak Farrokhzad-1/+1
2019-12-29Move reachable_set query in librustc_passes.Camille GILLOT-2/+1
2019-12-22Format the worldMark Rousskov-77/+60
2019-12-06Rename to `then_some` and `then`varkor-1/+1
2019-12-06Use `to_option` in various placesvarkor-5/+1
2019-11-11Move allocator_kind to CrateStoreMark Rousskov-1/+1
Similarly to the previous commit, there's no need for this to be in Session and have a Once around it.
2019-11-02Simplify various `Symbol` use points.Nicholas Nethercote-3/+3
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch of unnecessary sigils.
2019-10-29Rollup merge of #65832 - tlively:emscripten-exception-handling, r=alexcrichtonTyler Mandry-2/+3
Re-enable Emscripten's exception handling support Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests. r? @alexcrichton
2019-10-27rustc, rustc_passes: don't depend on syntax_expand.Mazdak Farrokhzad-1/+1
This is done by moving some data definitions to syntax::expand.