Skip to content

Add support for returns_twice attribute in libgccjit #20

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

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gcc/jit/jit-playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ const char* fn_attribute_to_string(gcc_jit_fn_attribute attr)
return "visibility";
case GCC_JIT_FN_ATTRIBUTE_COLD:
return "cold";
case GCC_JIT_FN_ATTRIBUTE_RETURNS_TWICE:
return "returns_twice";
}
return NULL;
}
Expand Down Expand Up @@ -667,6 +669,9 @@ new_function (location *loc,
TREE_USED (fndecl) = 1;
DECL_PRESERVE_P (fndecl) = 1;
}
/* See handle_returns_twice_attribute in gcc/c-family/c-attribs.cc. */
else if (attr == GCC_JIT_FN_ATTRIBUTE_RETURNS_TWICE)
DECL_IS_RETURNS_TWICE (fndecl) = 1;

const char* attribute = fn_attribute_to_string (attr);
if (attribute)
Expand Down
1 change: 1 addition & 0 deletions gcc/jit/libgccjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,7 @@ enum gcc_jit_fn_attribute
GCC_JIT_FN_ATTRIBUTE_USED,
GCC_JIT_FN_ATTRIBUTE_VISIBILITY,
GCC_JIT_FN_ATTRIBUTE_COLD,
GCC_JIT_FN_ATTRIBUTE_RETURNS_TWICE,
};

/* Add an attribute to a function. */
Expand Down