about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2019-04-02Rollup merge of #59446 - Aaron1011:fix/debuginfo-overflow, r=oli-obkMazdak Farrokhzad-17/+111
Fix stack overflow when generating debuginfo for 'recursive' type By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-04-01Fix typoAaron Hill-1/+1
2019-04-01Rollup merge of #58507 - Zoxc:time-extended, r=michaelwoeristerMazdak Farrokhzad-2/+2
Add a -Z time option which prints only passes which runs once This ensures `-Z time-passes` fits on my screen =P r? @michaelwoerister
2019-03-31Only track 'visited' state for function typesAaron Hill-18/+31
2019-03-31Fix typosAaron Hill-4/+2
2019-03-31Fix inverted panic checkAaron Hill-1/+1
2019-03-31Fix stack overflow when generating debuginfo for 'recursive' typeAaron Hill-17/+100
By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-03-31Rollup merge of #59519 - eddyb:layout-variants-refactor, r=oli-obkMazdak Farrokhzad-21/+55
rustc_target: factor out common fields of non-Single Variants. @tmandry and I were discussing ways to generalize the current variants/discriminant layout to allow more fields in the "`enum`" (or another multi-variant types, such as potentially generator state, in the future), shared by all variants, than just the tag/niche discriminant. This refactor should make it easier to extend multi-variant layouts, as nothing is duplicating anymore between "tagged enums" and "niche-filling enums". r? @oli-obk
2019-03-31Rollup merge of #59506 - JohnTitor:improve-mcount, r=nagisaMazdak Farrokhzad-1/+7
Use platform dependent mcount function close #59097 This pull-request is based on #57244 and [here](https://github.com/llvm-mirror/clang/search?q=MCountName&unscoped_MCountName). r? @nagisa
2019-03-30Remove redundant importsFabian Drinck-1/+0
2019-03-30Rollup merge of #59380 - philipc:thinlto-variant, r=michaelwoeristerMazdak Farrokhzad-1/+17
Fix invalid DWARF for enums when using ThinLTO We were setting the same identifier for both the DW_TAG_structure_type and the DW_TAG_variant_part. This becomes a problem when using ThinLTO becauses it uses the identifier as a key for a map of types that is used to delete duplicates based on the ODR, so one of them is deleted as a duplicate, resulting in invalid DWARF. The DW_TAG_variant_part isn't a standalone type, so it doesn't need an identifier. Fix by omitting its identifier. ODR uniquing is [enabled here](https://github.com/rust-lang/rust/blob/f21dee2c6179276321a88a63300dce74ff707e92/src/rustllvm/PassWrapper.cpp#L1101).
2019-03-30Use CStringYuki OKUSHI-5/+3
2019-03-30Use target_mcountYuki OKUSHI-24/+4
2019-03-29Use ExactSizeIterator + TrustedLen instead of num_cases arg for switchbjorn3-3/+4
2019-03-29Add a method for emiting a switch.bjorn3-8/+9
2019-03-29Remove inline_asm_call from cg_ssabjorn3-43/+47
`count_insn` is no longer called for inline asm, because it is private to builder.rs
2019-03-29Remove type_variadic_func and typ_array from cg_ssabjorn3-39/+68
2019-03-29Remove a lot of methods from *TypeMethodsbjorn3-36/+84
2019-03-29Remove scalar_lltypes from cg_ssabjorn3-6/+0
2019-03-29Move get_param and set_value_namebjorn3-26/+34
2019-03-29Remove a lot of methods from BuilderMethodsbjorn3-213/+213
2019-03-29[WIP] Make some debug info methods take &mut FunctionDebugContextbjorn3-2/+2
declare_local still takes &FunctionDebugContext, because of borrowck errors
2019-03-29Remove internal mutability from source_locations_enabledbjorn3-4/+4
2019-03-29Remove const_{cstr,str_slice,get_elt,get_real} and is_const_real methods ↵bjorn3-66/+97
from cg_ssa This introduces the static_panic_msg trait method to StaticBuilderMethods.
2019-03-29Remove const_{fat_ptr,array,vector,bytes} from cg_ssabjorn3-26/+28
2019-03-29Miscbjorn3-1/+1
2019-03-29Add a commentbjorn3-0/+1
2019-03-29Use Builder instead of CodegenCx for OperandRef and LocalRefbjorn3-1/+1
2019-03-29Don't use c_uint in cg_ssabjorn3-2/+2
2019-03-29rustc_target: factor out common fields of non-Single Variants.Eduard-Mihai Burtescu-21/+55
2019-03-29Auto merge of #58605 - nagisa:fix-the-metadata, r=michaelwoeristerbors-17/+28
Use informational target machine for metadata Since there is nothing to optimise there... Should fix #58323 but haven’t tested locally. r? @michaelwoerister
2019-03-29Use platform dependent mcount functionYuki OKUSHI-1/+29
2019-03-28Rollup merge of #58717 - hellow554:nonzero_parse, r=oli-obkMazdak Farrokhzad-1/+2
Add FromStr impl for NonZero types This is a WIP implementation because I do have some questions regarding the solution. Somebody should ping the lang team on this I guess. Please see the annotations on the code for more details. Closes #58604
2019-03-28fixed shift overflowMarcel Hellwig-1/+2
Fix according to oli-obk (https://github.com/rust-lang/rust/pull/58717#issuecomment-477494457)
2019-03-28Rollup merge of #57987 - parched:va-args, r=joshtriplettMazdak Farrokhzad-2/+2
Fix some AArch64 typos cc @dlrobertson
2019-03-27Give variant parts their own unique idPhilip Craig-14/+25
and bump llvm version in test
2019-03-27Use informational target machine for metadataSimonas Kazlauskas-17/+28
Since there is nothing to optimise there...
2019-03-25Auto merge of #59242 - euclio:asm-ice, r=nagisabors-2/+2
make asm diagnostic instruction optional `DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so the instruction shouldn't be blindly unwrapped. Reopening from #55193. I was unable to trigger the assertion on Windows after rebasing. Fixes #23458. Fixes #55216.
2019-03-24make asm diagnostic instruction optionalAndy Russell-2/+2
`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so the instruction shouldn't be blindly unwrapped.
2019-03-24Rollup merge of #59377 - smaeul:patch/system-llvm, r=nikickennytm-3/+5
Correct minimum system LLVM version in tests Since commit 9452a8dfa3ba, the new debug info format is only generated for LLVM 8 and newer versions. However, the tests still assume that LLVM 7 will use the new debug info format. Fix the tests (and a comment in the code) to match the actual version check.
2019-03-23Fix invalid DWARF for enums when using thinltoPhilip Craig-9/+14
We were setting the same identifier for both the DW_TAG_structure_type and the DW_TAG_variant_part. This becomes a problem when using thinlto becauses it uses the identifier as a key for a map of types that is used to delete duplicates based on the ODR, so one of them is deleted as a duplicate, resulting in invalid DWARF. The DW_TAG_variant_part isn't a standalone type, so it doesn't need an identifier. Fix by omitting its identifier.
2019-03-22Correct minimum system LLVM version in testsSamuel Holland-3/+5
Since commit 9452a8dfa3ba, the new debug info format is only generated for LLVM 8 and newer versions. However, the tests still assume that LLVM 7 will use the new debug info format. Fix the tests (and a comment in the code) to match the actual version check.
2019-03-20Add a -Z time option which prints only passes which runs onceJohn Kåre Alsaker-2/+2
2019-03-19Fix AArch64 typo in commentsJames Duley-2/+2
2019-03-16Rollup merge of #59152 - smmalis37:range_contains, r=SimonSapinkennytm-1/+0
Stabilize Range*::contains. Closes https://github.com/rust-lang/rust/issues/32311. There's also a bit of rustfmt on range.rs thrown in for good measure (I forgot to turn off format-on-save in VSCode).
2019-03-15rustc: tie the 'tcx between Print and PrintCx in ty::print.Eduard-Mihai Burtescu-2/+2
2019-03-15rustc: remove fmt::{Debug,Display} from ty::TyKind.Eduard-Mihai Burtescu-12/+11
2019-03-14Auto merge of #58488 - wesleywiser:llvm_prof, r=michaelwoeristerbors-71/+52
Replace TimeLine LLVM profiling with the self profiler
2019-03-12Stabilize Range*::contains.Steven Malis-1/+0
2019-03-11Fix incorrect links in librustc_codegen_llvm documentationNikita Baksalyar-3/+3