[FEATURE] Add detailed documentation for ARM branch condition codes in hover/intellisense
Feature Description
Enhance ArmLS's on-hover documentation to include detailed explanations of ARM condition code suffixes (e.g., EQ, NE, CS/HS, CC/LO, MI, PL, VS, VC, HI, LS, GE, LT, GT, LE) when users hover over conditional branch instructions like B.EQ, B.NE, B.LT, etc.
The documentation should include:
- The meaning of each condition code suffix
- Which CPSR/NZCV flags are tested (Z, C, N, V)
- The logical condition expression (e.g.,
EQ: Z==1, NE: Z==0)
- Example usage patterns with
CMP, TST, or other flag-setting instructions
- Distinction between AArch32 (A32/T32) and AArch64 (A64) conditional execution semantics
Problem Statement
Currently, ArmLS provides on-hover documentation for instruction mnemonics and operands, but conditional branch instructions with condition code suffixes (e.g., B.EQ label) may not display clear explanations of:
- What condition the suffix represents
- Which processor flags are evaluated
- How the condition relates to preceding comparison instructions
Proposed Solution
- Extend the hover provider to parse condition code suffixes from instruction mnemonics (e.g., extract
EQ from B.EQ)
- Add a condition code reference database within ArmLS containing:
{
"EQ": { "meaning": "Equal", "flags_tested": "Z", "condition": "Z==1", "aliases": [] },
"NE": { "meaning": "Not equal", "flags_tested": "Z", "condition": "Z==0", "aliases": [] },
"CS": { "meaning": "Carry set", "flags_tested": "C", "condition": "C==1", "aliases": ["HS"] },
"CC": { "meaning": "Carry clear", "flags_tested": "C", "condition": "C==0", "aliases": ["LO"] },
// ... all 16 standard condition codes
}
- Display enriched hover content when hovering
B.EQ:
B.EQ (Branch if Equal)
---------------------
Condition: Z flag == 1 (set)
Flags tested: Z (Zero)
Typical usage: After CMP or TST instruction
Example:
CMP R0, R1
B.EQ labels_equal ; Branch if R0 == R1
- Architecture-aware documentation: Differentiate behavior between:
- AArch32: Most instructions support conditional execution
- AArch64: Only branch instructions support condition codes; general instructions use CSEL/CSINC etc.
- Optional: Add quick-info tooltips for individual condition suffixes when hovering just the
EQ portion of B.EQ
Alternative Solutions
- Link to external Arm Developer documentation: Add URLs to official condition code references in hover text. Drawback: Requires internet access and context-switching.
- Expand general instruction documentation: Include condition code info in every conditional instruction's docs. Drawback: Redundant and increases maintenance burden.
- Add a dedicated "Condition Codes" hover target: Allow hovering standalone
EQ, NE, etc. tokens. Drawback: Requires parser changes to recognize suffixes as independent tokens.
- Leverage vscode-armls extension: Implement documentation in the VS Code extension layer. Drawback: Reduces portability to other LSP-compatible editors.
Additional Context
Example workflow improvement:
CMP R0, #10
; User hovers over "B.HI" below:
B.HI greater_than_10 ; Hover shows: "Branch if Higher (unsigned): C==1 && Z==0"
Related search terms users might expect to work: B.EQ documentation, ARM condition codes hover, branch condition flags armls
[FEATURE] Add detailed documentation for ARM branch condition codes in hover/intellisense
Feature Description
Enhance ArmLS's on-hover documentation to include detailed explanations of ARM condition code suffixes (e.g.,
EQ,NE,CS/HS,CC/LO,MI,PL,VS,VC,HI,LS,GE,LT,GT,LE) when users hover over conditional branch instructions likeB.EQ,B.NE,B.LT, etc.The documentation should include:
EQ: Z==1,NE: Z==0)CMP,TST, or other flag-setting instructionsProblem Statement
Currently, ArmLS provides on-hover documentation for instruction mnemonics and operands, but conditional branch instructions with condition code suffixes (e.g.,
B.EQ label) may not display clear explanations of:Proposed Solution
EQfromB.EQ){ "EQ": { "meaning": "Equal", "flags_tested": "Z", "condition": "Z==1", "aliases": [] }, "NE": { "meaning": "Not equal", "flags_tested": "Z", "condition": "Z==0", "aliases": [] }, "CS": { "meaning": "Carry set", "flags_tested": "C", "condition": "C==1", "aliases": ["HS"] }, "CC": { "meaning": "Carry clear", "flags_tested": "C", "condition": "C==0", "aliases": ["LO"] }, // ... all 16 standard condition codes }B.EQ:EQportion ofB.EQAlternative Solutions
EQ,NE, etc. tokens. Drawback: Requires parser changes to recognize suffixes as independent tokens.Additional Context
Example workflow improvement:
Related search terms users might expect to work:
B.EQ documentation,ARM condition codes hover,branch condition flags armls