Skip to content

Commit

Permalink
Rework the status flag management of s390x.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Herczeg committed Apr 28, 2021
1 parent 19309dc commit ce6ce04
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 175 deletions.
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
6 changes: 5 additions & 1 deletion sljit_src/sljitLir.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,12 @@ 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) {
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

0 comments on commit ce6ce04

Please sign in to comment.