1 /* libs/pixelflinger/codeflinger/ARMAssemblerProxy.cpp 2 ** 3 ** Copyright 2006, The Android Open Source Project 4 ** 5 ** Licensed under the Apache License, Version 2.0 (the "License"); 6 ** you may not use this file except in compliance with the License. 7 ** You may obtain a copy of the License at 8 ** 9 ** http://www.apache.org/licenses/LICENSE-2.0 10 ** 11 ** Unless required by applicable law or agreed to in writing, software 12 ** distributed under the License is distributed on an "AS IS" BASIS, 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ** See the License for the specific language governing permissions and 15 ** limitations under the License. 16 */ 17 18 19 #include <stdint.h> 20 #include <sys/types.h> 21 22 #include "ARMAssemblerProxy.h" 23 24 namespace android { 25 26 // ---------------------------------------------------------------------------- 27 28 ARMAssemblerProxy::ARMAssemblerProxy() 29 : mTarget(0) 30 { 31 } 32 33 ARMAssemblerProxy::ARMAssemblerProxy(ARMAssemblerInterface* target) 34 : mTarget(target) 35 { 36 } 37 38 ARMAssemblerProxy::~ARMAssemblerProxy() 39 { 40 delete mTarget; 41 } 42 43 void ARMAssemblerProxy::setTarget(ARMAssemblerInterface* target) 44 { 45 delete mTarget; 46 mTarget = target; 47 } 48 49 void ARMAssemblerProxy::reset() { 50 mTarget->reset(); 51 } 52 int ARMAssemblerProxy::generate(const char* name) { 53 return mTarget->generate(name); 54 } 55 void ARMAssemblerProxy::disassemble(const char* name) { 56 return mTarget->disassemble(name); 57 } 58 int ARMAssemblerProxy::getCodegenArch() 59 { 60 return mTarget->getCodegenArch(); 61 } 62 void ARMAssemblerProxy::prolog() { 63 mTarget->prolog(); 64 } 65 void ARMAssemblerProxy::epilog(uint32_t touched) { 66 mTarget->epilog(touched); 67 } 68 void ARMAssemblerProxy::comment(const char* string) { 69 mTarget->comment(string); 70 } 71 72 73 74 // addressing modes 75 76 bool ARMAssemblerProxy::isValidImmediate(uint32_t immed) 77 { 78 return mTarget->isValidImmediate(immed); 79 } 80 81 int ARMAssemblerProxy::buildImmediate(uint32_t i, uint32_t& rot, uint32_t& imm) 82 { 83 return mTarget->buildImmediate(i, rot, imm); 84 } 85 86 87 88 uint32_t ARMAssemblerProxy::imm(uint32_t immediate) 89 { 90 return mTarget->imm(immediate); 91 } 92 93 uint32_t ARMAssemblerProxy::reg_imm(int Rm, int type, uint32_t shift) 94 { 95 return mTarget->reg_imm(Rm, type, shift); 96 } 97 98 uint32_t ARMAssemblerProxy::reg_rrx(int Rm) 99 { 100 return mTarget->reg_rrx(Rm); 101 } 102 103 uint32_t ARMAssemblerProxy::reg_reg(int Rm, int type, int Rs) 104 { 105 return mTarget->reg_reg(Rm, type, Rs); 106 } 107 108 109 // addressing modes... 110 // LDR(B)/STR(B)/PLD 111 // (immediate and Rm can be negative, which indicates U=0) 112 uint32_t ARMAssemblerProxy::immed12_pre(int32_t immed12, int W) 113 { 114 return mTarget->immed12_pre(immed12, W); 115 } 116 117 uint32_t ARMAssemblerProxy::immed12_post(int32_t immed12) 118 { 119 return mTarget->immed12_post(immed12); 120 } 121 122 uint32_t ARMAssemblerProxy::reg_scale_pre(int Rm, int type, uint32_t shift, int W) 123 { 124 return mTarget->reg_scale_pre(Rm, type, shift, W); 125 } 126 127 uint32_t ARMAssemblerProxy::reg_scale_post(int Rm, int type, uint32_t shift) 128 { 129 return mTarget->reg_scale_post(Rm, type, shift); 130 } 131 132 133 // LDRH/LDRSB/LDRSH/STRH 134 // (immediate and Rm can be negative, which indicates U=0) 135 uint32_t ARMAssemblerProxy::immed8_pre(int32_t immed8, int W) 136 { 137 return mTarget->immed8_pre(immed8, W); 138 } 139 140 uint32_t ARMAssemblerProxy::immed8_post(int32_t immed8) 141 { 142 return mTarget->immed8_post(immed8); 143 } 144 145 uint32_t ARMAssemblerProxy::reg_pre(int Rm, int W) 146 { 147 return mTarget->reg_pre(Rm, W); 148 } 149 150 uint32_t ARMAssemblerProxy::reg_post(int Rm) 151 { 152 return mTarget->reg_post(Rm); 153 } 154 155 156 //------------------------------------------------------------------------ 157 158 159 160 void ARMAssemblerProxy::dataProcessing( int opcode, int cc, int s, 161 int Rd, int Rn, uint32_t Op2) 162 { 163 mTarget->dataProcessing(opcode, cc, s, Rd, Rn, Op2); 164 } 165 166 void ARMAssemblerProxy::MLA(int cc, int s, int Rd, int Rm, int Rs, int Rn) { 167 mTarget->MLA(cc, s, Rd, Rm, Rs, Rn); 168 } 169 void ARMAssemblerProxy::MUL(int cc, int s, int Rd, int Rm, int Rs) { 170 mTarget->MUL(cc, s, Rd, Rm, Rs); 171 } 172 void ARMAssemblerProxy::UMULL(int cc, int s, 173 int RdLo, int RdHi, int Rm, int Rs) { 174 mTarget->UMULL(cc, s, RdLo, RdHi, Rm, Rs); 175 } 176 void ARMAssemblerProxy::UMUAL(int cc, int s, 177 int RdLo, int RdHi, int Rm, int Rs) { 178 mTarget->UMUAL(cc, s, RdLo, RdHi, Rm, Rs); 179 } 180 void ARMAssemblerProxy::SMULL(int cc, int s, 181 int RdLo, int RdHi, int Rm, int Rs) { 182 mTarget->SMULL(cc, s, RdLo, RdHi, Rm, Rs); 183 } 184 void ARMAssemblerProxy::SMUAL(int cc, int s, 185 int RdLo, int RdHi, int Rm, int Rs) { 186 mTarget->SMUAL(cc, s, RdLo, RdHi, Rm, Rs); 187 } 188 189 void ARMAssemblerProxy::B(int cc, uint32_t* pc) { 190 mTarget->B(cc, pc); 191 } 192 void ARMAssemblerProxy::BL(int cc, uint32_t* pc) { 193 mTarget->BL(cc, pc); 194 } 195 void ARMAssemblerProxy::BX(int cc, int Rn) { 196 mTarget->BX(cc, Rn); 197 } 198 void ARMAssemblerProxy::label(const char* theLabel) { 199 mTarget->label(theLabel); 200 } 201 void ARMAssemblerProxy::B(int cc, const char* label) { 202 mTarget->B(cc, label); 203 } 204 void ARMAssemblerProxy::BL(int cc, const char* label) { 205 mTarget->BL(cc, label); 206 } 207 208 uint32_t* ARMAssemblerProxy::pcForLabel(const char* label) { 209 return mTarget->pcForLabel(label); 210 } 211 212 void ARMAssemblerProxy::LDR(int cc, int Rd, int Rn, uint32_t offset) { 213 mTarget->LDR(cc, Rd, Rn, offset); 214 } 215 void ARMAssemblerProxy::LDRB(int cc, int Rd, int Rn, uint32_t offset) { 216 mTarget->LDRB(cc, Rd, Rn, offset); 217 } 218 void ARMAssemblerProxy::STR(int cc, int Rd, int Rn, uint32_t offset) { 219 mTarget->STR(cc, Rd, Rn, offset); 220 } 221 void ARMAssemblerProxy::STRB(int cc, int Rd, int Rn, uint32_t offset) { 222 mTarget->STRB(cc, Rd, Rn, offset); 223 } 224 void ARMAssemblerProxy::LDRH(int cc, int Rd, int Rn, uint32_t offset) { 225 mTarget->LDRH(cc, Rd, Rn, offset); 226 } 227 void ARMAssemblerProxy::LDRSB(int cc, int Rd, int Rn, uint32_t offset) { 228 mTarget->LDRSB(cc, Rd, Rn, offset); 229 } 230 void ARMAssemblerProxy::LDRSH(int cc, int Rd, int Rn, uint32_t offset) { 231 mTarget->LDRSH(cc, Rd, Rn, offset); 232 } 233 void ARMAssemblerProxy::STRH(int cc, int Rd, int Rn, uint32_t offset) { 234 mTarget->STRH(cc, Rd, Rn, offset); 235 } 236 void ARMAssemblerProxy::LDM(int cc, int dir, int Rn, int W, uint32_t reg_list) { 237 mTarget->LDM(cc, dir, Rn, W, reg_list); 238 } 239 void ARMAssemblerProxy::STM(int cc, int dir, int Rn, int W, uint32_t reg_list) { 240 mTarget->STM(cc, dir, Rn, W, reg_list); 241 } 242 243 void ARMAssemblerProxy::SWP(int cc, int Rn, int Rd, int Rm) { 244 mTarget->SWP(cc, Rn, Rd, Rm); 245 } 246 void ARMAssemblerProxy::SWPB(int cc, int Rn, int Rd, int Rm) { 247 mTarget->SWPB(cc, Rn, Rd, Rm); 248 } 249 void ARMAssemblerProxy::SWI(int cc, uint32_t comment) { 250 mTarget->SWI(cc, comment); 251 } 252 253 254 void ARMAssemblerProxy::PLD(int Rn, uint32_t offset) { 255 mTarget->PLD(Rn, offset); 256 } 257 void ARMAssemblerProxy::CLZ(int cc, int Rd, int Rm) { 258 mTarget->CLZ(cc, Rd, Rm); 259 } 260 void ARMAssemblerProxy::QADD(int cc, int Rd, int Rm, int Rn) { 261 mTarget->QADD(cc, Rd, Rm, Rn); 262 } 263 void ARMAssemblerProxy::QDADD(int cc, int Rd, int Rm, int Rn) { 264 mTarget->QDADD(cc, Rd, Rm, Rn); 265 } 266 void ARMAssemblerProxy::QSUB(int cc, int Rd, int Rm, int Rn) { 267 mTarget->QSUB(cc, Rd, Rm, Rn); 268 } 269 void ARMAssemblerProxy::QDSUB(int cc, int Rd, int Rm, int Rn) { 270 mTarget->QDSUB(cc, Rd, Rm, Rn); 271 } 272 void ARMAssemblerProxy::SMUL(int cc, int xy, int Rd, int Rm, int Rs) { 273 mTarget->SMUL(cc, xy, Rd, Rm, Rs); 274 } 275 void ARMAssemblerProxy::SMULW(int cc, int y, int Rd, int Rm, int Rs) { 276 mTarget->SMULW(cc, y, Rd, Rm, Rs); 277 } 278 void ARMAssemblerProxy::SMLA(int cc, int xy, int Rd, int Rm, int Rs, int Rn) { 279 mTarget->SMLA(cc, xy, Rd, Rm, Rs, Rn); 280 } 281 void ARMAssemblerProxy::SMLAL( int cc, int xy, 282 int RdHi, int RdLo, int Rs, int Rm) { 283 mTarget->SMLAL(cc, xy, RdHi, RdLo, Rs, Rm); 284 } 285 void ARMAssemblerProxy::SMLAW(int cc, int y, int Rd, int Rm, int Rs, int Rn) { 286 mTarget->SMLAW(cc, y, Rd, Rm, Rs, Rn); 287 } 288 289 void ARMAssemblerProxy::UXTB16(int cc, int Rd, int Rm, int rotate) { 290 mTarget->UXTB16(cc, Rd, Rm, rotate); 291 } 292 293 void ARMAssemblerProxy::UBFX(int cc, int Rd, int Rn, int lsb, int width) { 294 mTarget->UBFX(cc, Rd, Rn, lsb, width); 295 } 296 297 void ARMAssemblerProxy::ADDR_LDR(int cc, int Rd, int Rn, uint32_t offset) { 298 mTarget->ADDR_LDR(cc, Rd, Rn, offset); 299 } 300 void ARMAssemblerProxy::ADDR_STR(int cc, int Rd, int Rn, uint32_t offset) { 301 mTarget->ADDR_STR(cc, Rd, Rn, offset); 302 } 303 void ARMAssemblerProxy::ADDR_ADD(int cc, int s, int Rd, int Rn, uint32_t Op2){ 304 mTarget->ADDR_ADD(cc, s, Rd, Rn, Op2); 305 } 306 void ARMAssemblerProxy::ADDR_SUB(int cc, int s, int Rd, int Rn, uint32_t Op2){ 307 mTarget->ADDR_SUB(cc, s, Rd, Rn, Op2); 308 } 309 310 }; // namespace android 311 312