fcml  1.1.3
fcml_optimizers.h
Go to the documentation of this file.
1 /*
2  * FCML - Free Code Manipulation Library.
3  * Copyright (C) 2010-2015 Slawomir Wojtasiak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
26 #ifndef FCML_OPTIMIZERS_H_
27 #define FCML_OPTIMIZERS_H_
28 
29 #include "fcml_lib_export.h"
30 
31 #include "fcml_types.h"
32 #include "fcml_errors.h"
33 #include "fcml_common.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
42  fcml_uint16_t optimizer_flags;
46  fcml_usize asa;
48  fcml_usize osa;
50 
66  fcml_usize easa;
72  fcml_usize eosa;
76  fcml_bool break_optimization;
78 
84 typedef fcml_ceh_error (*fcml_fnp_asm_optimizer_callback)( fcml_ptr args );
85 
95  fcml_fnp_asm_optimizer_callback callback, fcml_ptr args );
96 
97 /* Optimizers flags that can be used to configure optimization process. */
98 #define FCML_OPTF_ASA_16 0x01
99 #define FCML_OPTF_ASA_32 0x02
100 #define FCML_OPTF_ASA_64 0x03
101 #define FCML_OPTF_OSA_16 0x10
102 #define FCML_OPTF_OSA_32 0x20
103 #define FCML_OPTF_OSA_64 0x30
104 #define FCML_OPTF_ALL_FORMS 0xFF
105 
116  fcml_fnp_asm_optimizer_callback callback, fcml_ptr callback_args );
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* FCML_OPTIMIZERS_H_ */
fcml_st_nullable_size_flags allowed_eosa
Allowed values of the operand size attribute calculated by the assembler engine.
Definition: fcml_optimizers.h:56
fcml_usize easa
Effective address size attribute chosen for currently processed instruction form. ...
Definition: fcml_optimizers.h:66
Definition: fcml_types.h:217
fcml_en_operating_mode
Supported processor operating modes.
Definition: fcml_common.h:73
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_asm_default_optimizer(fcml_st_asm_optimizer_context *context, fcml_st_asm_optimizer_processing_details *ds_flags, fcml_fnp_asm_optimizer_callback callback, fcml_ptr callback_args)
Default optimizer implementation.
fcml_en_operating_mode op_mode
Processor operating mode 16/32/64-bit.
Definition: fcml_optimizers.h:44
Definitions of common structures used by FCML components.
Handles Win32 DLL symbols importing/exporting.
fcml_ceh_error(* fcml_fnp_asm_optimizer_callback)(fcml_ptr args)
Callback used to invoke encoding process for given processing details configuration.
Definition: fcml_optimizers.h:84
struct fcml_st_asm_optimizer_context fcml_st_asm_optimizer_context
Optimizer context used as a connector with the environment.
fcml_nuint8_t l
L bit from VEX like prefixes set for encoded instruction.
Definition: fcml_optimizers.h:74
Nullable wrapper for mask of size flags.
Definition: fcml_common.h:398
fcml_bool break_optimization
Set to true in order to break optimization process immediately.
Definition: fcml_optimizers.h:76
fcml_usize osa
Default operand size attribute not modified by prefixes yet.
Definition: fcml_optimizers.h:48
fcml_st_nullable_size_flags allowed_easa
Allowed values of the address size attribute calculated by the assembler engine.
Definition: fcml_optimizers.h:60
fcml_usize eosa
Effective operand size attribute chosen for currently processed instruction form. ...
Definition: fcml_optimizers.h:72
fcml_usize asa
Default address size attribute not modified by prefixes yet.
Definition: fcml_optimizers.h:46
Processing details for optimizers.
Definition: fcml_optimizers.h:52
struct fcml_st_asm_optimizer_processing_details fcml_st_asm_optimizer_processing_details
Processing details for optimizers.
Global error handling related declarations.
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition: fcml_errors.h:139
Types declarations.
Optimizer context used as a connector with the environment.
Definition: fcml_optimizers.h:40
fcml_uint16_t optimizer_flags
Optimizer flags passed through the assembler context.
Definition: fcml_optimizers.h:42
fcml_ceh_error(LIB_CALL * fcml_fnp_asm_optimizer)(fcml_st_asm_optimizer_context *context, fcml_st_asm_optimizer_processing_details *ds_flags, fcml_fnp_asm_optimizer_callback callback, fcml_ptr args)
Function pointer declaration for optimizers.
Definition: fcml_optimizers.h:94