Commit Graph

1690 Commits

Author SHA1 Message Date
Daniel Paoliello
2756bd6ff7 Add support for raw-dylib 2024-08-08 13:51:58 -07:00
bjorn3
82605c4b5c Sync from rust 8b3870784f 2024-08-08 14:55:59 +00:00
bjorn3
14d020f88d Remove no longer used vendor intrinsic implementations 2024-08-07 10:00:13 +00:00
bjorn3
c48b010845 Implement x86 _mm_sqrt_ss vendor intrinsic 2024-08-02 16:24:08 +02:00
bjorn3
e47c930f08 Sync from rust 8e86c95671 2024-08-02 11:24:34 +00:00
bjorn3
f340c81caa Statically enable a couple of target features always enabled on arm64 macOS
Ring fails to compile when they are not statically enabled when
compiling for macOS.

Fixes rust-lang/rustc_codegen_cranelift#1522
2024-07-31 15:33:58 +02:00
bjorn3
37da264107 Move computation of decorated names out of the create_dll_import_lib method 2024-07-30 10:32:32 +00:00
bjorn3
161d2476d5 Move temp file name generation out of the create_dll_import_lib method 2024-07-30 10:10:41 +00:00
Nicholas Nethercote
ea9f491696 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
bjorn3
aaffce98e2 Sync from rust 7c2012d0ec 2024-07-27 17:16:14 +00:00
bjorn3
f73c411ec2 Sync from rust c1a6199e9d 2024-07-25 15:08:19 +00:00
GnomedDev
486f5b5059 Use Cow<'static, str> for InlineAsmTemplatePiece::String 2024-07-24 21:11:55 +01:00
beetrees
4fb3c4bf86
Fix handling of large alignments in write_cvalue_maybe_transmute (#1521) 2024-07-21 13:13:58 +02:00
beetrees
b70ad2defd
Remove unneeded libcalls from codegen_i128.rs 2024-07-20 21:18:30 +01:00
Matthias Krüger
0c9ba01011 Rollup merge of #127779 - momvart:should_codegen_hook, r=cjgillot
Add a hook for `should_codegen_locally`

This PR lifts the module-local function `should_codegen_locally` to `TyCtxt` as a hook.
In addition to monomorphization, this function is used for checking the dependency of `compiler_builtins` on other libraries. Moving this function to the hooks also makes overriding it possible for the tools that use the rustc interface.
2024-07-20 13:24:52 +02:00
Yuri Astrakhan
c1c13bd07c Avoid ref when using format! in compiler
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing).  Inlining format args prevents accidental `&` misuse.
2024-07-19 14:52:07 -04:00
Trevor Gross
25dce8f92b Rollup merge of #124033 - bjorn3:ar_archive_writer_0_3_0, r=davidtwco
Sync ar_archive_writer to LLVM 18.1.3

From LLVM 15.0.0-rc3. This adds support for COFF archives containing Arm64EC object files and has various fixes for AIX big archive files.
2024-07-16 16:15:13 -05:00
Mohammad Omidvar
c01fe3ceac Move compiler_builtin check to the use case 2024-07-15 23:43:52 +00:00
bjorn3
d0d2e60886 Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into sync_cg_clif-2024-07-13 2024-07-13 18:39:03 +00:00
bjorn3
f5c3195e92 Nicer error message when using raw-dylib
cc rust-lang/rustc_codegen_cranelift#1510
2024-07-13 13:53:14 +00:00
bjorn3
29bc1a5cc0 Sync from rust 35b658fb10 2024-07-09 10:08:02 +00:00
bors
776ab988c1 Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJung
Support tail calls in mir via `TerminatorKind::TailCall`

This is one of the interesting bits in tail call implementation — MIR support.

This adds a new `TerminatorKind` which represents a tail call:
```rust
    TailCall {
        func: Operand<'tcx>,
        args: Vec<Operand<'tcx>>,
        fn_span: Span,
    },
```

*Structurally* this is very similar to a normal `Call` but is missing a few fields:
- `destination` — tail calls don't write to destination, instead they pass caller's destination to the callee (such that eventual `return` will write to the caller of the function that used tail call)
- `target` — similarly to `destination` tail calls pass the caller's return address to the callee, so there is nothing to do
- `unwind` — I _think_ this is applicable too, although it's a bit confusing
- `call_source` — `become` forbids operators and is not created as a lowering of something else; tail calls always come from HIR (at least for now)

It might be helpful to read the interpreter implementation to understand what `TailCall` means exactly, although I've tried documenting it too.

-----

There are a few `FIXME`-questions still left, ideally we'd be able to answer them during review ':)

-----

r? `@oli-obk`
cc `@scottmcm` `@DrMeepster` `@JakobDegen`
2024-07-08 04:35:04 +00:00
bjorn3
322c2f6b13 Sync ar_archive_writer to LLVM 18.1.3
From LLVM 15.0.0-rc3. This adds support for COFF archives containing
Arm64EC object files and has various fixes for AIX big archive files.
2024-07-07 16:56:35 +00:00
Maybe Waffle
9978261a6e Support tail calls in mir via TerminatorKind::TailCall 2024-07-07 17:11:04 +02:00
bors
8620e85a1c Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obk
Miri function identity hack: account for possible inlining

Having a non-lifetime generic is not the only reason a function can be duplicated. Another possibility is that the function may be eligible for cross-crate inlining. So also take into account the inlining attribute in this Miri hack for function pointer identity.

That said, `cross_crate_inlinable` will still sometimes return true even for `inline(never)` functions:
- when they are `DefKind::Ctor(..) | DefKind::Closure` -- I assume those cannot be `InlineAttr::Never` anyway?
- when `cross_crate_inline_threshold == InliningThreshold::Always`

so maybe this is still not quite the right criterion to use for function pointer identity.
2024-07-04 23:45:56 +00:00
bjorn3
253436c04c Better parsing of #[section_name] on Mach-O
This is required by the objc2 crate

Fixes rust-lang/rustc_codegen_cranelift#1504
2024-07-04 21:52:25 +02:00
Michael Goulet
c6b883bb2e Fix spans 2024-07-02 15:48:48 -04:00
Michael Goulet
e4bde05ed6 Give Instance::expect_resolve a span 2024-07-02 15:48:48 -04:00
Ralf Jung
a6056bce92 Miri function identity hack: account for possible inlining 2024-07-02 21:05:30 +02:00
bjorn3
f35bd40d18 Remove unused generic_args arguments from intrinsic codegen functions 2024-07-01 15:56:14 +00:00
bjorn3
126fd7c31d Also mark .debug_line_str as mergeable strings 2024-07-01 08:18:34 +00:00
bjorn3
7a1601553d Mark .debug_str as mergeable strings
Fixes rust-lang/rustc_codegen_cranelift#1496
2024-06-30 12:01:15 +00:00
bjorn3
5adaed06a0 Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
bjorn3
e97cebb2b1 Use dyn Module instead of impl Module where possible 2024-06-28 11:51:17 +00:00
bjorn3
cc05efe29e Introduce UnwindModule wrapper around a Module and UnwindContext
This way all UnwindContext::add_function calls can be done automatically
in a single place.
2024-06-28 11:51:00 +00:00
bjorn3
8d11939589 Sync from rust fda509e817 2024-06-26 09:11:55 +00:00
Jubilee Young
f1052eb253 cg_clif: Define build opts from FramePointer 2024-06-23 00:36:33 -07:00
bjorn3
2a378251fb Update to Cranelift 0.109 2024-06-20 17:05:08 +00:00
beetrees
8556604bc6
Fix varargs support on aarch64-apple-darwin 2024-06-20 00:08:08 +01:00
Scott McMurray
e79dc7656a bug! more uses of these in runtime stuff 2024-06-19 10:44:01 -07:00
bjorn3
88a5f32ed5 Sync from rust 59e2c01c22 2024-06-18 16:04:56 +00:00
Oli Scherer
afef64c1bd Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
bjorn3
0d1d00478c Sync from rust d7f6ebacee 2024-06-17 07:50:36 +00:00
Michael Goulet
54aa510c32 Rename InstanceDef -> InstanceKind 2024-06-16 21:35:21 -04:00
bors
5c6849b1df Auto merge of #126505 - compiler-errors:no-vtable, r=lcnr
Only compute vtable information during codegen

This PR removes vtable information from the `Object` and `TraitUpcasting` candidate sources in the trait solvers, and defers the computation of relevant information to `Instance::resolve`. This is because vtables really aren't a thing in the trait world -- they're an implementation detail in codegen.

Previously it was just easiest to tangle this information together since we were already doing the work of looking at all the supertraits in the trait solver, and specifically because we use traits to represent when it's possible to call a method via a vtable (`Object` candidate) and do upcasting (`Unsize` candidate). but I am somewhat suspicious we're doing a *lot* of extra work, especially in polymorphic contexts, so let's see what perf says.
2024-06-16 05:33:49 +00:00
Michael Goulet
5ccfa787fd Only compute vtable information during codegen 2024-06-14 20:35:45 -04:00
Michael Goulet
c867677971 Use is_lang_item more aggressively 2024-06-14 16:54:29 -04:00
Nicholas Nethercote
0b7375f2a0 Use tidy to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.

For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
  `allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
  sometimes the order is alphabetical, and sometimes there is no
  particular order.
- Sometimes the attributes of a particular kind aren't even grouped
  all together, e.g. there might be a `feature`, then an `allow`, then
  another `feature`.

This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.

Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
  because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
  ignored in `rustfmt.toml`).
2024-06-12 15:49:10 +10:00
bjorn3
c0477a1231 Sync from rust b5b13568fb 2024-06-11 11:54:36 +00:00
Ralf Jung
0eb782ba13 ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00