Skip to content

RISCV: Preserve dots in mnemonics for name2id() lookup#91

Merged
Rot127 merged 2 commits intocapstone-engine:auto-sync-18from
slate5:fix/riscv-mnemonics-keep-dot
Apr 8, 2026
Merged

RISCV: Preserve dots in mnemonics for name2id() lookup#91
Rot127 merged 2 commits intocapstone-engine:auto-sync-18from
slate5:fix/riscv-mnemonics-keep-dot

Conversation

@slate5
Copy link
Copy Markdown
Contributor

@slate5 slate5 commented Apr 7, 2026

This is needed for mnemonics that contain a dot when map_set_alias_id() calls name2id() for matching. Aliases with a dot in their name would not match the mnemonic from RISCVGenCSAliasMnemMap.inc (e.g., cv.mulhhu != cv_mulhhu).

Capstone issue: capstone-engine/capstone#2861

@Rot127
Copy link
Copy Markdown
Collaborator

Rot127 commented Apr 7, 2026

@moste00 Please take a look.

@Rot127 Rot127 changed the base branch from auto-sync to auto-sync-18 April 7, 2026 11:37
if (Target.getName().equals_insensitive("PPC"))
ReplaceDotInMnemonic = false;
else if (Target.getName().equals_insensitive("RISCV"))
ReplaceDotInMnemonic = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could simply do bool ReplaceDotInMnemonic = Target.getName().equals_insensitive("PPC") || Target.getName().equals_insensitive("RISCV")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @moste00, I thought it might be better if more architectures get added to this if-else. Anyway, I'll change it. Is this how you meant:

bool ReplaceDotInMnemonic =
    !(Target.getName().equals_insensitive("PPC") ||
      Target.getName().equals_insensitive("RISCV"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah I meant that, sorry I got confused and forgot the = false part.

@moste00
Copy link
Copy Markdown
Contributor

moste00 commented Apr 7, 2026

Looks good, please add a depends-on clause on the other PR (the capstone one having the generated .inc file) in your PR description.

@Rot127 Rot127 merged commit 759c75a into capstone-engine:auto-sync-18 Apr 8, 2026
3 checks passed
@slate5 slate5 deleted the fix/riscv-mnemonics-keep-dot branch April 8, 2026 22:16
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.

3 participants