1 // Do not edit. Bootstrap copy of /usr/local/google/buildbot/src/android/build-tools/out/obj/go/src/cmd/compile/internal/arm64/reg.go 2 3 //line /usr/local/google/buildbot/src/android/build-tools/out/obj/go/src/cmd/compile/internal/arm64/reg.go:1 4 // Derived from Inferno utils/6c/reg.c 5 // http://code.google.com/p/inferno-os/source/browse/utils/6c/reg.c 6 // 7 // Copyright 1994-1999 Lucent Technologies Inc. All rights reserved. 8 // Portions Copyright 1995-1997 C H Forsyth (forsyth (a] terzarima.net) 9 // Portions Copyright 1997-1999 Vita Nuova Limited 10 // Portions Copyright 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com) 11 // Portions Copyright 2004,2006 Bruce Ellis 12 // Portions Copyright 2005-2007 C H Forsyth (forsyth (a] terzarima.net) 13 // Revisions Copyright 2000-2007 Lucent Technologies Inc. and others 14 // Portions Copyright 2009 The Go Authors. All rights reserved. 15 // 16 // Permission is hereby granted, free of charge, to any person obtaining a copy 17 // of this software and associated documentation files (the "Software"), to deal 18 // in the Software without restriction, including without limitation the rights 19 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 // copies of the Software, and to permit persons to whom the Software is 21 // furnished to do so, subject to the following conditions: 22 // 23 // The above copyright notice and this permission notice shall be included in 24 // all copies or substantial portions of the Software. 25 // 26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 // THE SOFTWARE. 33 34 package arm64 35 36 import ( 37 "bootstrap/compile/internal/gc" 38 "bootstrap/internal/obj/arm64" 39 ) 40 41 const ( 42 NREGVAR = 64 /* 32 general + 32 floating */ 43 ) 44 45 var regname = []string{ 46 ".R0", 47 ".R1", 48 ".R2", 49 ".R3", 50 ".R4", 51 ".R5", 52 ".R6", 53 ".R7", 54 ".R8", 55 ".R9", 56 ".R10", 57 ".R11", 58 ".R12", 59 ".R13", 60 ".R14", 61 ".R15", 62 ".R16", 63 ".R17", 64 ".R18", 65 ".R19", 66 ".R20", 67 ".R21", 68 ".R22", 69 ".R23", 70 ".R24", 71 ".R25", 72 ".R26", 73 ".R27", 74 ".R28", 75 ".R29", 76 ".R30", 77 ".R31", 78 ".F0", 79 ".F1", 80 ".F2", 81 ".F3", 82 ".F4", 83 ".F5", 84 ".F6", 85 ".F7", 86 ".F8", 87 ".F9", 88 ".F10", 89 ".F11", 90 ".F12", 91 ".F13", 92 ".F14", 93 ".F15", 94 ".F16", 95 ".F17", 96 ".F18", 97 ".F19", 98 ".F20", 99 ".F21", 100 ".F22", 101 ".F23", 102 ".F24", 103 ".F25", 104 ".F26", 105 ".F27", 106 ".F28", 107 ".F29", 108 ".F30", 109 ".F31", 110 } 111 112 func regnames(n *int) []string { 113 *n = NREGVAR 114 return regname 115 } 116 117 func excludedregs() uint64 { 118 // Exclude registers with fixed functions 119 regbits := uint64(RtoB(arm64.REGRT1) | RtoB(arm64.REGRT2) | RtoB(arm64.REGPR)) 120 121 // Exclude R26 - R31. 122 for r := arm64.REGMAX + 1; r <= arm64.REGZERO; r++ { 123 regbits |= RtoB(r) 124 } 125 126 // Also exclude floating point registers with fixed constants 127 regbits |= RtoB(arm64.REG_F27) | RtoB(arm64.REG_F28) | RtoB(arm64.REG_F29) | RtoB(arm64.REG_F30) | RtoB(arm64.REG_F31) 128 129 return regbits 130 } 131 132 func doregbits(r int) uint64 { 133 return 0 134 } 135 136 /* 137 * track register variables including external registers: 138 * bit reg 139 * 0 R0 140 * 1 R1 141 * ... ... 142 * 31 R31 143 * 32+0 F0 144 * 32+1 F1 145 * ... ... 146 * 32+31 F31 147 */ 148 func RtoB(r int) uint64 { 149 if r >= arm64.REG_R0 && r <= arm64.REG_R31 { 150 return 1 << uint(r-arm64.REG_R0) 151 } 152 if r >= arm64.REG_F0 && r <= arm64.REG_F31 { 153 return 1 << uint(32+r-arm64.REG_F0) 154 } 155 return 0 156 } 157 158 func BtoR(b uint64) int { 159 b &= 0xffffffff 160 if b == 0 { 161 return 0 162 } 163 return gc.Bitno(b) + arm64.REG_R0 164 } 165 166 func BtoF(b uint64) int { 167 b >>= 32 168 if b == 0 { 169 return 0 170 } 171 return gc.Bitno(b) + arm64.REG_F0 172 } 173