Commit Graph

3016 Commits

Author SHA1 Message Date
bors
1239a022ca Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
Shrink `FnAbi`

Because they can take up a lot of memory in debug and release builds.

r? `@bjorn3`
2022-08-27 14:00:53 +00:00
Tomasz Miąsko
1071c4c10b Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
Nicholas Nethercote
2d2a3be651 Move ArgAbi::pad_i32 into PassMode::Cast.
Because it's only needed for that variant. This shrinks the types and
clarifies the logic.
2022-08-26 11:12:36 +10:00
Nicholas Nethercote
1c989472e4 Box CastTarget within PassMode.
Because `PassMode::Cast` is by far the largest variant, but is
relatively rare.

This requires making `PassMode` not impl `Copy`, and `Clone` is no
longer necessary. This causes lots of sigil adjusting, but nothing very
notable.
2022-08-26 09:35:28 +10:00
Nathan Stocks
8c93170965 adjust to new error value 2022-08-25 11:06:45 -06:00
bjorn3
53f4bb9352 Sync from rust 4d45b0745a 2022-08-25 16:34:28 +02:00
bjorn3
d9bbac069b Rustfmt 2022-08-24 17:06:47 +00:00
bjorn3
cfef0a4f8d Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24 2022-08-24 18:40:58 +02:00
bjorn3
e9d1a0a7b0 Rustup to rustc 1.65.0-nightly (060e47f74 2022-08-23) 2022-08-24 18:37:37 +02:00
bjorn3
ad1d993249 Sync from rust 4a24f08ba4 2022-08-24 18:29:45 +02:00
bjorn3
ee8f8bfacd
Merge pull request #1271 from bjorn3/parallel_comp_support
Support compiling codegen units in parallel
2022-08-24 17:22:30 +02:00
bjorn3
072fd2b0b1 Add fixme 2022-08-24 14:28:40 +00:00
bjorn3
293223d0cf Tune drop_excess_capacity 2022-08-24 12:22:01 +02:00
bjorn3
f71c545746 Make sure to count reused cgus towards the count of jobs done 2022-08-23 16:51:06 +00:00
bjorn3
5b4195669e Add some self profiler calls 2022-08-23 16:32:38 +00:00
bjorn3
d081c20273 Compile functions from clif ir to object code in parallel 2022-08-23 16:32:38 +00:00
bjorn3
1a6323313b Use correct CguReuse variant 2022-08-23 16:32:20 +00:00
bjorn3
f9d60cf551 Do asm compilation and object file emission in parallel 2022-08-23 16:05:29 +00:00
bjorn3
1a0dfb399c Add a jobserver based concurrency limiter 2022-08-23 15:44:39 +00:00
bjorn3
5896e5cdfa Store symbol name as owned string 2022-08-23 15:23:56 +00:00
bjorn3
b1e9d2e1a2 Revert "Avoid masking shift amounts (#1268)"
This reverts commit 156bda8bc7.

This breaks the mir_overflow_off rustc test:
https://github.com/bjorn3/rustc_codegen_cranelift/runs/7971362755?check_suite_focus=true#step:7:2904
2022-08-23 11:10:44 +00:00
Afonso Bordado
48c45c481c
Use native scalar fma instruction (#1267)
Cranelift 0.87 now supports lowering `fma` as a libcall on x86 [0].
With 0.88 enabling the native x86 instruction under the `has_fma` flag.

aarch64 and s390x already support this as a native instruction, so it's
nice that we emit it for those.

We can't lower the SIMD version using the `fma` instruction since the
lowering can fail if the x86 `has_fma` flag is not enabled. Cranelift
doesn't yet know how to fallback for these cases

[0]: 709716bb8e
2022-08-23 12:42:35 +02:00
Afonso Bordado
156bda8bc7
Avoid masking shift amounts (#1268)
Cranelift 0.87 now follows its own documentation regarding
shift amounts, and implicitly masks them if the arch requires it. [0]

[0]: 0508932174
2022-08-23 12:42:24 +02:00
bjorn3
b14c7337db Update to Cranelift 0.87.0 2022-08-22 18:53:10 +00:00
Matthias Krüger
5a9b11648f Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_
2022-08-21 16:54:07 +02:00
Waffle Maybe
5f357c2c51 fix cg cranelift
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-08-21 05:27:14 +04:00
Waffle Maybe
63a137605f use shorter ptr_mask impl in cg cranelift
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2022-08-21 05:27:14 +04:00
Maybe Waffle
5b32aa0747 Add pointer masking convenience functions
This commit adds the following functions all of which have a signature
`pointer, usize -> pointer`:
- `<*mut T>::mask`
- `<*const T>::mask`
- `intrinsics::ptr_mask`

These functions are equivalent to `.map_addr(|a| a & mask)` but they
utilize `llvm.ptrmask` llvm intrinsic.

*masks your pointers*
2022-08-21 05:27:14 +04:00
Maybe Waffle
bd1ab72406 Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
bjorn3
7dc8f38956
Merge pull request #1266 from bjorn3/parallel_comp_refactor2
Refactorings for enabling parallel compilation (part 2)
2022-08-19 12:03:43 +02:00
Dylan DPC
ee65a1018f Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkov
make NOP dyn casts not require anything about the vtable

As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-19 12:26:41 +05:30
bjorn3
535c6ddc8b Small cleanup 2022-08-18 19:03:28 +00:00
bjorn3
6421427b74 Move Span lowering from debuginfo finalization to codegen
This removes the dependency on TyCtxt from the debuginfo finalization
code.
2022-08-18 18:19:40 +00:00
bjorn3
0534a555cc Make line_program_add_file a DebugContext method 2022-08-18 17:48:22 +00:00
bjorn3
1e57774011 Move set_function_span earlier 2022-08-18 17:23:36 +00:00
bjorn3
01be0ddacf Move FunctionDebugContext creation to codegen_fn 2022-08-18 17:17:33 +00:00
bjorn3
dbf5457308 Introduce FunctionDebugContext
This will make it easier to move TyCtxt requiring operations before clif
ir compilation.
2022-08-18 17:11:41 +00:00
bjorn3
312563f3c4 Use walk_chain for function span too
This is a correctness fix
2022-08-18 15:58:22 +00:00
bjorn3
259b21fd46 Remove TyCtxt from DebugContext
And explicitly thread it through everwhere it is needed.
2022-08-18 15:25:52 +00:00
bjorn3
e5493a5ea2 Remove Instance param of DebugContext::define_function 2022-08-18 15:25:47 +00:00
bjorn3
a49416da6d Remove stub local debuginfo implementation
It isn't actually wired up and temporarily removing it will make changes
to the debuginfo generation code much simpler.
2022-08-18 15:14:04 +00:00
bjorn3
5fc1366dfa Register debuginfo for lazy jit shim 2022-08-18 12:55:44 +00:00
bjorn3
4dac65fcbd
Merge pull request #1265 from afonso360/stack_store
Use `stack_store` instead of `stack_addr`+`store` when building structs
2022-08-17 16:51:02 +02:00
bjorn3
df1b25171c Remove TyCtxt parameter from compile_fn 2022-08-17 13:47:52 +00:00
Afonso Bordado
2079b4bb08 Use stack_store instead of stack_addr+store when building structs 2022-08-17 14:46:05 +01:00
bjorn3
c820b7cd60 Remove TyCtxt field from CodegenCx 2022-08-17 13:43:32 +00:00
bjorn3
b181f2b376 Replace instance param of write_clif_file with symbol_name 2022-08-17 13:07:18 +00:00
bjorn3
701b2747c3 Remove optimize_function
It currently doesn't have any optimizations at all.
2022-08-17 13:03:32 +00:00
bjorn3
1cac888e43 Rustup to rustc 1.65.0-nightly (801821d15 2022-08-14) 2022-08-15 16:21:41 +02:00
bjorn3
fd428c0760 Sync from rust 6ce76091c7 2022-08-15 16:17:32 +02:00