Skip to content

Conversation

@rmjskhy
Copy link

@rmjskhy rmjskhy commented Aug 6, 2025

No description provided.

rmjskhy added 9 commits August 6, 2025 10:59
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Change-Id: I73ad9c460459d1ddefb553f9de4727dce97baf3b
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
…anslating fild with option_softfpu=2

Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
        Use --enable-decode-debug to choose the disassembler used for each instruction.

Signed-off-by: liuchaoyi <liuchaoyi@loongson.cn>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request replaces the Capstone disassembly library with bddisasm across the LATX translator-bd module. The change involves adding new translation files for different x86 instruction categories and updating build configuration to use the bddisasm library instead of Capstone.

Key Changes:

  • Complete replacement of Capstone disassembly with bddisasm
  • Addition of new translator-bd files implementing instruction translation for arithmetic, bit manipulation, control flow, and SIMD operations
  • Update of helper function references to use bddisasm-compatible variants
  • Addition of new build configuration for the translator-bd module

Reviewed Changes

Copilot reviewed 59 out of 90 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
target/i386/latx/translator-bd/tr-eflag-bd.c Implements x86 flag manipulation instructions (popf, pushf, clc, etc.)
target/i386/latx/translator-bd/tr-btx-bd.c Handles bit test and manipulation instructions with lock support
target/i386/latx/translator-bd/tr-bmi-bd.c Implements bit manipulation instructions (pext, pdep, bextr, etc.)
target/i386/latx/translator-bd/tr-arith-bd.c Contains arithmetic instruction translations (add, sub, mul, div, etc.)
target/i386/latx/translator-bd/tr-adx-bd.c Implements ADX instruction set (adcx, adox)
target/i386/latx/translator-bd/runtime-trace-bd.c Runtime tracing functionality with bddisasm integration
target/i386/latx/translator-bd/reg-alloc-bd.c Register allocation updates for pattern matching support
target/i386/latx/translator-bd/meson.build Build configuration for new translator-bd module
target/i386/latx/translator-bd/mem-interface-bd.c Memory operand conversion with immediate caching optimization
target/i386/latx/translator-bd/macro-helper-bd.c Helper function updates for bddisasm compatibility
target/i386/latx/sbt/aot.c Updates helper function references for bddisasm

la_label(label_exit);
store_ireg_to_ir1_bd(new_eax, reg_al, false);
generate_eflag_calculation_bd(new_eax, old_eax, old_eax, pir1, true);

Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'temp_opnd' is allocated but never freed, causing a memory leak. Add 'ra_free_temp(temp_opnd);' before freeing n4095_opnd.

Suggested change
ra_free_temp(temp_opnd);

Copilot uses AI. Check for mistakes.
store_ireg_to_ir1_bd(ah, reg_ah, false);
store_ireg_to_ir1_bd(al, reg_al, false);

generate_eflag_calculation_bd(al, old_al, imm_opnd, pir1, true);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'ah' and 'old_al' are allocated but never freed, causing memory leaks. Add appropriate ra_free_temp calls before the return statement.

Suggested change
generate_eflag_calculation_bd(al, old_al, imm_opnd, pir1, true);
generate_eflag_calculation_bd(al, old_al, imm_opnd, pir1, true);
ra_free_temp(old_al);
ra_free_temp(ah);

Copilot uses AI. Check for mistakes.
la_andi(temp_opnd, ax, 0xf);
store_ireg_to_ir1_bd(ax, reg_ax, false);
store_ireg_to_ir1_bd(temp_opnd, reg_al, false);

Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables 'temp_opnd' and 'imm_opnd' are allocated but never freed, causing memory leaks. Add appropriate ra_free_temp calls before freeing n4095_opnd.

Suggested change
ra_free_temp(temp_opnd);
ra_free_temp(imm_opnd);

Copilot uses AI. Check for mistakes.
la_label(label_exit);
/* 3. store result */
store_ireg_to_ir1_bd(result_opnd, ir1_get_opnd_bd(pir1, 0), false);
ra_free_temp(result_opnd);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple temp variables (temp1_opnd, temp2_opnd, temp3_opnd, mask_opnd) are allocated but never freed, causing memory leaks. Add appropriate ra_free_temp calls before the return statement.

Suggested change
ra_free_temp(result_opnd);
ra_free_temp(result_opnd);
ra_free_temp(mask_opnd);
ra_free_temp(temp1_opnd);
ra_free_temp(temp2_opnd);
ra_free_temp(temp3_opnd);

Copilot uses AI. Check for mistakes.
la_label(label_exit);
/* 3. store result */
store_ireg_to_ir1_bd(result_opnd, ir1_get_opnd_bd(pir1, 0), false);
ra_free_temp(result_opnd);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple temp variables (temp1_opnd, temp2_opnd, temp3_opnd, temp4_opnd, mask_opnd) are allocated but never freed, causing memory leaks. Add appropriate ra_free_temp calls before the return statement.

Suggested change
ra_free_temp(result_opnd);
ra_free_temp(result_opnd);
ra_free_temp(mask_opnd);
ra_free_temp(temp1_opnd);
ra_free_temp(temp2_opnd);
ra_free_temp(temp3_opnd);
ra_free_temp(temp4_opnd);

Copilot uses AI. Check for mistakes.
/* set cf = 0, of = 0 */
la_x86mtflag(zero_ir2_opnd, 0x21);
/* 3. store result */
store_ireg_to_ir1_bd(temp2_opnd, ir1_get_opnd_bd(pir1, 0), false);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'slt_opnd' is allocated but never freed, causing a memory leak. Add 'ra_free_temp(slt_opnd);' before the return statement.

Suggested change
store_ireg_to_ir1_bd(temp2_opnd, ir1_get_opnd_bd(pir1, 0), false);
store_ireg_to_ir1_bd(temp2_opnd, ir1_get_opnd_bd(pir1, 0), false);
ra_free_temp(slt_opnd);

Copilot uses AI. Check for mistakes.
}
la_x86mtflag(flag_opnd, 0x3e); //cf is not recovered

store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple temp variables (flag_opnd, cflag_opnd, temp1_opnd) are allocated but never freed, causing memory leaks. Add appropriate ra_free_temp calls before the return statement.

Suggested change
store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false);
store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false);
ra_free_temp(flag_opnd);
ra_free_temp(cflag_opnd);
ra_free_temp(temp1_opnd);

Copilot uses AI. Check for mistakes.
la_bstrins_d(flag_opnd, oflag_opnd, 11, 11);
la_x86mtflag(flag_opnd, 0x3f);

store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple temp variables (flag_opnd, oflag_opnd, temp1_opnd) are allocated but never freed, causing memory leaks. Add appropriate ra_free_temp calls before the return statement.

Suggested change
store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false);
store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false);
ra_free_temp(flag_opnd);
ra_free_temp(oflag_opnd);
ra_free_temp(temp1_opnd);

Copilot uses AI. Check for mistakes.
la_label(label_1);
la_ori(src_opnd, src_opnd, 0xff);
la_label(label_2);
store_ireg_to_ir1_bd(src_opnd, &eax_ir1_opnd_bd, false);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'flag_opnd' is allocated but never freed, causing a memory leak. Add 'ra_free_temp(flag_opnd);' before the return statement.

Suggested change
store_ireg_to_ir1_bd(src_opnd, &eax_ir1_opnd_bd, false);
store_ireg_to_ir1_bd(src_opnd, &eax_ir1_opnd_bd, false);
ra_free_temp(flag_opnd);

Copilot uses AI. Check for mistakes.
la_bstrpick_d(esp_opnd, esp_opnd, 31, 0);
}
#endif
la_store_addrx(temp, esp_opnd, -sp_step);
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'temp' is allocated and used but never freed, causing a memory leak. Add 'ra_free_temp(temp);' after line 79.

Suggested change
la_store_addrx(temp, esp_opnd, -sp_step);
la_store_addrx(temp, esp_opnd, -sp_step);
ra_free_temp(temp);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant