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

Rework the status flag management of s390x. #106

Merged
merged 1 commit into from
Apr 30, 2021
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 API_CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
This file is the short summary of the API changes:

28.04.2021 - Non-backward compatible
The current_flags argument of sljit_set_current_flags
must provide a flag if the status flags were set by an
arithmetic instruction.

16.08.2020 - Non-backward compatible
A second parameter has been added to sljit_create_compiler()
and sljit_free_code() to pass some data to the executable
Expand Down
7 changes: 6 additions & 1 deletion sljit_src/sljitLir.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,13 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *com
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(current_flags);

#if (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
compiler->cc_mode = current_flags;
#endif

#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
if ((current_flags & ~(VARIABLE_FLAG_MASK | SLJIT_I32_OP | SLJIT_SET_Z)) == 0) {
compiler->last_flags = 0;
if ((current_flags & ~(VARIABLE_FLAG_MASK | SLJIT_I32_OP | SLJIT_SET_Z | SLJIT_CURRENT_FLAGS_ARITHMETIC)) == 0) {
compiler->last_flags = GET_FLAG_TYPE(current_flags) | (current_flags & (SLJIT_I32_OP | SLJIT_SET_Z));
}
#endif
Expand Down
12 changes: 10 additions & 2 deletions sljit_src/sljitLir.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ struct sljit_compiler {
#if (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
/* Need to allocate register save area to make calls. */
sljit_s32 have_save_area;
sljit_s32 cc_mode;
#endif

#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
Expand Down Expand Up @@ -1534,8 +1535,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
void *instruction, sljit_s32 size);

/* Define the currently available CPU status flags. It is usually used after an
sljit_emit_op_custom call to define which flags are set. */
/* Flags were set by an ADD, ADDC, SUB, SUBC, or NEG operation. */
#define SLJIT_CURRENT_FLAGS_ARITHMETIC 0x01

/* Define the currently available CPU status flags. It is usually used after
an sljit_emit_label or sljit_emit_op_custom operations to define which CPU
status flags are available.

The current_flags must be a valid combination of SLJIT_SET_* and
SLJIT_CURRENT_FLAGS_* constants. */

SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler,
sljit_s32 current_flags);
Expand Down
Loading