about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2022-12-05Move linkage type check to HIR analysis and fix semantics issues.Peter Collingbourne-28/+6
This ensures that the error is printed even for unused variables, as well as unifying the handling between the LLVM and GCC backends. This also fixes unusual behavior around exported Rust-defined variables with linkage attributes. With the previous behavior, it appears to be impossible to define such a variable such that it can actually be imported and used by another crate. This is because on the importing side, the variable is required to be a pointer, but on the exporting side, the type checker rejects static variables of pointer type because they do not implement `Sync`. Even if it were possible to import such a type, it appears that code generation on the importing side would add an unexpected additional level of pointer indirection, which would break type safety. This highlighted that the semantics of linkage on Rust-defined variables is different to linkage on foreign items. As such, we now model the difference with two different codegen attributes: linkage for Rust-defined variables, and import_linkage for foreign items. This change gives semantics to the test src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was previously expected to fail to compile. Therefore, convert it into a test that is expected to successfully compile. The update to the GCC backend is speculative and untested.
2022-12-03Destruct landing_pad return value before passing it to cg_ssabjorn3-7/+7
2022-12-03Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiserbors-203/+8
Rewrite LLVM's archive writer in Rust This allows it to be used by other codegen backends. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-2/+2
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-2/+2
2022-11-26Rewrite LLVM's archive writer in Rustbjorn3-203/+8
This allows it to be used by other codegen backends
2022-11-26Remove more redundant `all`sChris Denton-4/+4
2022-11-19Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3Dylan DPC-4/+5
Improve generating Custom entry function This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-17Auto merge of #103138 - nnethercote:merge-BBs, r=bjorn3bors-5/+4
Merge basic blocks where possible when generating LLVM IR. r? `@ghost`
2022-11-16Rollup merge of #103750 - calebzulawski:master, r=workingjubileeMatthias Krüger-4/+4
Fix some misleading target feature aliases This is the first half of a fix for #100752. It looks like these aliases were added in #78361 and slipped under the radar, as these features are not AVX512. These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions. A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features). This PR allows using the names as defined by LLVM, which matches Intel documentation. A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc. r? ```@workingjubilee``` cc ```@Amanieu```
2022-11-16Use `&mut Bx` more.Nicholas Nethercote-5/+4
For the next commit, `FunctionCx::codegen_*_terminator` need to take a `&mut Bx` instead of consuming a `Bx`. This triggers a cascade of similar changes across multiple functions. The resulting code is more concise and replaces many `&mut bx` expressions with `bx`.
2022-11-15Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obkbors-8/+49
Perform simple scalar replacement of aggregates (SROA) MIR opt This is a re-open of https://github.com/rust-lang/rust/pull/85796 I copied the debuginfo implementation (first commit) from `@eddyb's` own SROA PR. This pass replaces plain field accesses by simple locals when possible. To be eligible, the replaced locals: - must not be enums or unions; - must not be used whole; - must not have their address taken. The storage and deinit statements are duplicated on each created local. cc `@tmiasko` who reviewed the former version of this PR.
2022-11-15Introduce composite debuginfo.Camille GILLOT-8/+49
2022-11-15Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obkbors-2/+2
interpret: support for per-byte provenance Also factors the provenance map into its own module. The third commit does the same for the init mask. I can move it in a separate PR if you prefer. Fixes https://github.com/rust-lang/miri/issues/2181 r? `@oli-obk`
2022-11-15Use custom entry name in gccAyush Singh-4/+5
This is a continuation of 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 for gcc. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-13add is_sized method on Abi and Layout, and use itRalf Jung-1/+1
2022-11-12Allow actual AVX512-related feature names in the case of some misleading aliasesCaleb Zulawski-4/+4
2022-11-06fix cranelift and gccRalf Jung-2/+2
2022-11-06Add type_array to BaseTypeMethodsAyush Singh-21/+21
Moved type_array function to rustc_codegen_ssa::BaseTypeMethods trait. This allows using normal alloca function to create arrays as suggested in https://github.com/rust-lang/rust/pull/104022. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-11/+4
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-24Support raw-dylib functions being used inside inlined functionsDaniel Paoliello-0/+1
2022-10-23Migrate all diagnosticsNilstrieb-23/+23
2022-10-17Stabilize asm_symAmanieu d'Antras-3/+6
2022-10-02Remove type argument of array_alloca and rename to byte_array_allocabjorn3-1/+1
2022-10-02Remove dynamic_alloca from BuilderMethodsbjorn3-4/+0
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-13/+32
Some codegen backends are not able to apply callsite attrs after the fact.
2022-10-01Remove unused target_cpu and tune_cpu methods from ExtraBackendMethodsbjorn3-9/+0
2022-10-01Remove several unused methods from MiscMethodsbjorn3-16/+0
2022-10-01Remove unused Context assoc type from WriteBackendMethodsbjorn3-1/+0
2022-09-30Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwcoMatthias Krüger-163/+322
Migrate rustc_codegen_gcc to SessionDiagnostics As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate. ``@rustbot`` label +A-translation
2022-09-28print <signal> when ranlib failed without an exit codeEllis Hoag-1/+1
2022-09-27Stabilize bench_black_boxUrgau-1/+1
2022-09-26lint and remove unused diagnosticEllis Hoag-6/+4
2022-09-24remove commentEllis Hoag-1/+0
2022-09-24fix lifetime errorEllis Hoag-29/+3
2022-09-24rebase and update trait namesEllis Hoag-25/+25
2022-09-24impl SessionDiagnostic for LayoutError and Spanned<T>Ellis Hoag-1/+18
2022-09-24Add monomorphization errorsEllis Hoag-153/+261
2022-09-24lint typeEllis Hoag-1/+1
2022-09-24Add wrapper type for ExitCode for use in RanlibFailureEllis Hoag-2/+24
2022-09-24remove IntoDiagnosticArg impl for OptionEllis Hoag-2/+2
2022-09-24Lint against untranslatable diagnostics in rustc_codegen_gccEllis Hoag-0/+2
2022-09-24Add LayoutSizeOverflowEllis Hoag-2/+11
2022-09-24Add LTONotSupportedEllis Hoag-1/+6
2022-09-24Add UnwindingInlineAsmEllis Hoag-1/+9
2022-09-24Add LinkageConstOrMutTypeEllis Hoag-4/+10
2022-09-24Add RanlibFailureEllis Hoag-1/+12
2022-09-06Remove dead broken code from const zst handling in backendsOli Scherer-4/+0
2022-08-30Rollup merge of #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyoDylan DPC-5/+170
Move the cast_float_to_int fallback code to GCC Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-6/+6
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``