feat(lint): accept the wired extension mnemonics
Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
9c951c232e
commit
83052ab466
2 files changed
+68
-8
No files matched your search
+16
-8
@@ -328,15 +328,23 @@ func lintText(t *ast.Text, tab *arch.Table, archKnown bool, cfg Config, macros m
|
||||
}
|
||||
|
||||
if archKnown && !cfg.Disable[CodeUnknownInstr] && !pseudoOps[upper] && !isMacroInvocation(mnem, macros) {
|
||||
// The extended-instruction layer is a mnemonic's second home:
|
||||
// one registered there (arm64's SVE family today) is known,
|
||||
// and it encodes through the extension registry rather than
|
||||
// the encoder mirror the unencodable rule consults, so the
|
||||
// wired extensions are never flagged as a gap of the table.
|
||||
_, extended := asm.LookupExtension(cfg.Arch, mnem)
|
||||
if _, ok := tab.Lookup(mnem); !ok {
|
||||
out = append(out, Diagnostic{
|
||||
Pos: st.Mnemonic.Pos,
|
||||
End: st.Mnemonic.End,
|
||||
Severity: Error,
|
||||
Code: CodeUnknownInstr,
|
||||
Message: fmt.Sprintf("unknown %s instruction %q", cfg.Arch, mnem),
|
||||
})
|
||||
} else if cfg.Arch == arch.AMD64 && !cfg.Disable[CodeUnencodable] && !asm.Encodable(upper) {
|
||||
if !extended {
|
||||
out = append(out, Diagnostic{
|
||||
Pos: st.Mnemonic.Pos,
|
||||
End: st.Mnemonic.End,
|
||||
Severity: Error,
|
||||
Code: CodeUnknownInstr,
|
||||
Message: fmt.Sprintf("unknown %s instruction %q", cfg.Arch, mnem),
|
||||
})
|
||||
}
|
||||
} else if cfg.Arch == arch.AMD64 && !extended && !cfg.Disable[CodeUnencodable] && !asm.Encodable(upper) {
|
||||
// Known to the architecture table but missing from the
|
||||
// encoder: the file parses everywhere and then fails at
|
||||
// assembly time. Flag it at lint so the gap is visible
|
||||
|
||||
Reference in new issue
Block a user