-
Notifications
You must be signed in to change notification settings - Fork 57
use bddisasm replace capstone #107
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
base: master
Are you sure you want to change the base?
Conversation
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>
There was a problem hiding this 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); | ||
|
|
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| ra_free_temp(temp_opnd); |
| 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); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| 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); | ||
|
|
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| ra_free_temp(temp_opnd); | |
| ra_free_temp(imm_opnd); |
| 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); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| 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); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| /* 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); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| } | ||
| la_x86mtflag(flag_opnd, 0x3e); //cf is not recovered | ||
|
|
||
| store_ireg_to_ir1_bd(temp1_opnd, ir1_get_opnd_bd(pir1, 0), false); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| 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); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| 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); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| 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); |
| la_bstrpick_d(esp_opnd, esp_opnd, 31, 0); | ||
| } | ||
| #endif | ||
| la_store_addrx(temp, esp_opnd, -sp_step); |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
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.
| la_store_addrx(temp, esp_opnd, -sp_step); | |
| la_store_addrx(temp, esp_opnd, -sp_step); | |
| ra_free_temp(temp); |
No description provided.