Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more intrinsics and refactor how we implement them #1003

Merged
merged 6 commits into from
Mar 11, 2022

Conversation

philberty
Copy link
Member

@philberty philberty commented Mar 9, 2022

This patch series implements:

  1. offset
  2. size_of
  3. unreachable
  4. abort

It removes the GCC wrapper mappings to make them much easier to implement. It also demonstrates in single commits
the implementation of each of these intrinsic to make it easy to follow in how we implement them.

Addresses #658 #849

@philberty
Copy link
Member Author

I would appreciate any GCC folks looking at this. This is part of my set of patches to get slices working, just so you know for context. It would be easier to look at each individual commit rather than the full diff for reviewing purposes.

@tschwinge @dkm @dafaust

@philberty philberty force-pushed the phil/offset-instrinsic branch from d3eeed8 to 7679cbe Compare March 10, 2022 10:52
This patch adds the initial support for generic intrinsics these are do not
map directly to GCC builtins and need to be substited with their specificed
types. This patch allows for custom implementation body for these functions
by specifying handler functions which will generate the applicable
intrinsic when asked for.

Addresses #658
Intrinsics were hidden behind the GCC abstract. This removes it by keeping
all of this logic within rust-intrinsic.cc so that we can make mappings of
the rustc name to GCC ones. We have a big comment from the mappings used
over to LLVM builtins which we can use to help guide how we do this for
GCC.
This demonstrates how we can add in the simple intrinsics in a single
patch.

Addresses #658
This is another type of intrisic since the function contains no parameters
but the argument for the size_of is the generic parameter T. Which uses
TYPE_SIZE_UNIT to get the type size in bytes. GCC will optimize the
function call away when you turn optimizations on.

Addresses #658
@philberty philberty force-pushed the phil/offset-instrinsic branch from 7679cbe to f057445 Compare March 10, 2022 11:47
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Waiting for the experts' opinions :)

@philberty philberty mentioned this pull request Mar 10, 2022
18 tasks
@philberty philberty self-assigned this Mar 10, 2022
@philberty
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 11, 2022

Build succeeded:

@bors bors bot merged commit ddd087b into master Mar 11, 2022
@philberty philberty deleted the phil/offset-instrinsic branch March 11, 2022 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants