forked from gcc-mirror/gcc
-
Notifications
You must be signed in to change notification settings - Fork 17
Added support for creating constant Rvalues backed by different intiger sizes. #71
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
Open
FractalFir
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
FractalFir:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -2020,6 +2020,35 @@ gcc_jit_rvalue_set_type (gcc_jit_rvalue *rvalue, gcc_jit_type *new_type) | |||||||
"not a numeric type: %s", \ | ||||||||
NUMERIC_TYPE->get_debug_string ()); \ | ||||||||
JIT_END_STMT | ||||||||
/* Public entrypoint. See description in libgccjit.h. | ||||||||
|
||||||||
After error-checking, the real work is done by the | ||||||||
gcc::jit::recording::context::new_rvalue_from_const <int> method in | ||||||||
jit-recording.cc. */ | ||||||||
gcc_jit_rvalue * | ||||||||
gcc_jit_context_new_rvalue_from_char (gcc_jit_context *ctxt, | ||||||||
gcc_jit_type *numeric_type, | ||||||||
char value) | ||||||||
{ | ||||||||
RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); | ||||||||
JIT_LOG_FUNC (ctxt->get_logger ()); | ||||||||
RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); | ||||||||
|
||||||||
return ((gcc_jit_rvalue *)ctxt | ||||||||
->new_rvalue_from_const <char> (numeric_type, value)); | ||||||||
} | ||||||||
gcc_jit_rvalue * | ||||||||
gcc_jit_context_new_rvalue_from_short (gcc_jit_context *ctxt, | ||||||||
gcc_jit_type *numeric_type, | ||||||||
short value) | ||||||||
{ | ||||||||
RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); | ||||||||
JIT_LOG_FUNC (ctxt->get_logger ()); | ||||||||
RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); | ||||||||
|
||||||||
return ((gcc_jit_rvalue *)ctxt | ||||||||
->new_rvalue_from_const <short> (numeric_type, value)); | ||||||||
} | ||||||||
|
||||||||
/* Public entrypoint. See description in libgccjit.h. | ||||||||
|
||||||||
|
@@ -2058,7 +2087,20 @@ gcc_jit_context_new_rvalue_from_long (gcc_jit_context *ctxt, | |||||||
return ((gcc_jit_rvalue *)ctxt | ||||||||
->new_rvalue_from_const <long> (numeric_type, value)); | ||||||||
} | ||||||||
#ifdef __SIZEOF_INT128__ | ||||||||
gcc_jit_rvalue * | ||||||||
gcc_jit_context_new_rvalue_from_int128 (gcc_jit_context *ctxt, | ||||||||
gcc_jit_type *numeric_type, | ||||||||
__int128_t value) | ||||||||
{ | ||||||||
RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); | ||||||||
JIT_LOG_FUNC (ctxt->get_logger ()); | ||||||||
RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); | ||||||||
|
||||||||
return ((gcc_jit_rvalue *)ctxt | ||||||||
->new_rvalue_from_const <__int128_t> (numeric_type, value)); | ||||||||
} | ||||||||
#endif | ||||||||
/* Public entrypoint. See description in libgccjit.h. | ||||||||
|
||||||||
This is essentially equivalent to: | ||||||||
|
@@ -2111,6 +2153,18 @@ gcc_jit_context_new_rvalue_from_double (gcc_jit_context *ctxt, | |||||||
return ((gcc_jit_rvalue *)ctxt | ||||||||
->new_rvalue_from_const <double> (numeric_type, value)); | ||||||||
} | ||||||||
gcc_jit_rvalue * | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
gcc_jit_context_new_rvalue_from_float (gcc_jit_context *ctxt, | ||||||||
gcc_jit_type *numeric_type, | ||||||||
float value) | ||||||||
{ | ||||||||
RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); | ||||||||
JIT_LOG_FUNC (ctxt->get_logger ()); | ||||||||
RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); | ||||||||
|
||||||||
return ((gcc_jit_rvalue *)ctxt | ||||||||
->new_rvalue_from_const <float> (numeric_type, value)); | ||||||||
} | ||||||||
|
||||||||
/* Public entrypoint. See description in libgccjit.h. | ||||||||
|
||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -373,3 +373,10 @@ LIBGCCJIT_ABI_42 { | |||||||
global: | ||||||||
gcc_jit_lvalue_add_attribute; | ||||||||
} LIBGCCJIT_ABI_41; | ||||||||
LIBGCCJIT_ABI_43 { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
global: | ||||||||
gcc_jit_context_new_rvalue_from_float; | ||||||||
gcc_jit_context_new_rvalue_from_int128; | ||||||||
gcc_jit_context_new_rvalue_from_short; | ||||||||
gcc_jit_context_new_rvalue_from_char; | ||||||||
} LIBGCCJIT_ABI_42; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the way we should handle the case where 128-bit integers are not supported is by adding an error and returning
NULL
: so the function would still be defined on targets that don't support them.