Skip to content

Commit

Permalink
Rollup merge of rust-lang#76766 - khyperia:generic_intrinsics, r=eddyb
Browse files Browse the repository at this point in the history
Extract some intrinsics out of rustc_codegen_llvm

A significant amount of intrinsics do not actually need backend-specific behaviors to be implemented, instead relying on methods already in rustc_codegen_ssa. So, extract those methods out to rustc_codegen_ssa, so that each backend doesn't need to reimplement the same code.

Almost everything should be a pretty direct translation. A notable not-direct-translation is `add_with_overflow` and friends being changed to `bx.checked_binop`, but it's pretty simple.

I could have been a lot more aggressive here and pulled out way more methods, and add a few new methods in the rustc_codegen_ssa "API". However, because this is my second rustc PR, I thought that moving those to a follow-up PR and doing more incremental changes here would be better (and I guess ask if this work is even desired in the first place). I'm hoping to eventually remove the mess of intrinsic handling in the backend entirely, which would be hecking fantastic ✨
  • Loading branch information
RalfJung authored Sep 20, 2020
2 parents f5e19a3 + 21b0c12 commit 2911b8c
Show file tree
Hide file tree
Showing 4 changed files with 606 additions and 521 deletions.
Loading

0 comments on commit 2911b8c

Please sign in to comment.