feat(asm): assemble the extended instruction layer on amd64
Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
d4878524e8
commit
6e49cbd099
3 files changed
+604
No files matched your search
@@ -8,6 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"sourcedock.dev/petrbalvin/gasm-sdk/arch"
|
||||
"sourcedock.dev/petrbalvin/gasm-sdk/ast"
|
||||
)
|
||||
|
||||
@@ -929,6 +930,25 @@ func encodeInstr(s *ast.Instr, pc int, offsets map[string]int, fi frameInfo, lon
|
||||
|
||||
func encodeNormal(s *ast.Instr, fi frameInfo, link *linkInfo) ([]byte, []sbPatch, []floatPoolEntry, error) {
|
||||
mnemUpper := strings.ToUpper(s.Mnemonic.Text)
|
||||
|
||||
// The extended-instruction layer: a statement whose mnemonic is
|
||||
// registered in the extension registry and that the scalar paths cannot
|
||||
// encode goes through the registry, before operandFromAST would reject
|
||||
// operands only the layer reads (asm/amd64_ext.go). The registry's
|
||||
// Feature field stays metadata at assembly time: the assembler has no
|
||||
// CPU, and the toolchain does not gate assembly on CPU features, so
|
||||
// every registered feature assembles.
|
||||
if extops, pinned, convErr := amd64ExtStatement(mnemUpper, s.Operands); pinned {
|
||||
if convErr != nil {
|
||||
return nil, nil, nil, convErr
|
||||
}
|
||||
code, encErr := EncodeExtension(arch.AMD64, mnemUpper, extops...)
|
||||
if encErr != nil {
|
||||
return nil, nil, nil, encErr
|
||||
}
|
||||
return code, nil, nil, nil
|
||||
}
|
||||
|
||||
if mnemUpper == "FUNCDATA" || mnemUpper == "PCDATA" {
|
||||
code, err := encodeBookkeeping(mnemUpper, s)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user