github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/asm/internal/arch/arm.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // This file encapsulates some of the odd characteristics of the ARM 6 // instruction set, to minimize its interaction with the core of the 7 // assembler. 8 9 package arch 10 11 import ( 12 "github.com/shogo82148/std/cmd/internal/obj" 13 ) 14 15 // IsARMCMP reports whether the op (as defined by an arm.A* constant) is 16 // one of the comparison instructions that require special handling. 17 func IsARMCMP(op obj.As) bool 18 19 // IsARMSTREX reports whether the op (as defined by an arm.A* constant) is 20 // one of the STREX-like instructions that require special handling. 21 func IsARMSTREX(op obj.As) bool 22 23 // IsARMMRC reports whether the op (as defined by an arm.A* constant) is 24 // MRC or MCR. 25 func IsARMMRC(op obj.As) bool 26 27 // IsARMBFX reports whether the op (as defined by an arm.A* constant) is one the 28 // BFX-like instructions which are in the form of "op $width, $LSB, (Reg,) Reg". 29 func IsARMBFX(op obj.As) bool 30 31 // IsARMFloatCmp reports whether the op is a floating comparison instruction. 32 func IsARMFloatCmp(op obj.As) bool 33 34 // ARMMRCOffset implements the peculiar encoding of the MRC and MCR instructions. 35 // The difference between MRC and MCR is represented by a bit high in the word, not 36 // in the usual way by the opcode itself. Asm must use AMRC for both instructions, so 37 // we return the opcode for MRC so that asm doesn't need to import obj/arm. 38 func ARMMRCOffset(op obj.As, cond string, x0, x1, x2, x3, x4, x5 int64) (offset int64, op0 obj.As, ok bool) 39 40 // IsARMMULA reports whether the op (as defined by an arm.A* constant) is 41 // MULA, MULS, MMULA, MMULS, MULABB, MULAWB or MULAWT, the 4-operand instructions. 42 func IsARMMULA(op obj.As) bool 43 44 // ARMConditionCodes handles the special condition code situation for the ARM. 45 // It returns a boolean to indicate success; failure means cond was unrecognized. 46 func ARMConditionCodes(prog *obj.Prog, cond string) bool 47 48 // ParseARMCondition parses the conditions attached to an ARM instruction. 49 // The input is a single string consisting of period-separated condition 50 // codes, such as ".P.W". An initial period is ignored. 51 func ParseARMCondition(cond string) (uint8, bool)