Skip to content

Commit

Permalink
Remove header for categories and add initial AArch64 instr_is_floatin…
Browse files Browse the repository at this point in the history
…g_ex implementation
  • Loading branch information
kuhanov committed Aug 10, 2023
1 parent 19897a4 commit a011a30
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 59 deletions.
1 change: 0 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,6 @@ DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/instrlist_api.h dr_ir_instrlist.
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/dr_ir_opcodes.h dr_ir_opcodes.h)
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/x86/opcode_api.h dr_ir_opcodes_x86.h)
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/arm/opcode_api.h dr_ir_opcodes_arm.h)
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/category_api.h dr_ir_categories.h)
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/instr_create_shared_api.h dr_ir_macros.h)
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/x86/instr_create_api.h dr_ir_macros_x86.h)
DR_export_header(${CMAKE_CURRENT_SOURCE_DIR}/ir/arm/instr_create_api.h dr_ir_macros_arm.h)
Expand Down
19 changes: 19 additions & 0 deletions core/ir/aarch64/instr.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,25 @@ instr_is_rep_string_op(instr_t *instr)
return false;
}

bool
instr_is_floating_ex(instr_t *instr, dr_fp_type_t *type OUT)
{
uint cat = instr_get_category(instr);
if(cat & DR_INSTR_CATEGORY_FP_MATH) {
if (type != NULL)
*type = DR_FP_MATH;
return true;
}

return false;
}

bool
instr_is_floating(instr_t *instr)
{
return instr_is_floating_ex(instr, NULL);
}

bool
instr_saves_float_pc(instr_t *instr)
{
Expand Down
56 changes: 0 additions & 56 deletions core/ir/category_api.h

This file was deleted.

1 change: 0 additions & 1 deletion core/ir/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#ifndef _INSTR_H_
#define _INSTR_H_ 1

#include "category_api.h"
#include "opcode_api.h"
#include "opnd.h"

Expand Down
14 changes: 14 additions & 0 deletions core/ir/instr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,20 @@ DR_API
bool
instr_is_rep_string_op(instr_t *instr);

/**
* Indicates which category the instruction corresponds to.
*/
typedef enum {
DR_INSTR_CATEGORY_UNCATEGORIZED = 0x0, /**< Uncategorised. */
DR_INSTR_CATEGORY_INT_MATH = 0x1, /**< Integer arithmetic operations */
DR_INSTR_CATEGORY_FP_MATH = 0x2, /**< Floating-Point arithmetic operations */
DR_INSTR_CATEGORY_LOAD = 0x4, /**< Loads */
DR_INSTR_CATEGORY_STORE = 0x8, /**< Stores */
DR_INSTR_CATEGORY_BRANCH = 0x10, /**< Branches */
DR_INSTR_CATEGORY_SIMD = 0x20, /**< Operations with vector registers (SIMD) */
DR_INSTR_CATEGORY_OTHER = 0x40 /**< Other types of instructions */
} dr_instr_category_type_t;

/**
* Indicates which type of floating-point operation and instruction performs.
*/
Expand Down
1 change: 0 additions & 1 deletion core/lib/dr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ extern "C" {
#include "dr_annotation.h"

/* Instruction category constants */
#include "dr_ir_categories.h"

#ifndef DYNAMORIO_STANDALONE
/**
Expand Down

0 comments on commit a011a30

Please sign in to comment.