buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "../../CompilerInternals.h" |
| 18 | #include "ArmLIR.h" |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 19 | #include "../Ralloc.h" |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 20 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 21 | #include <string> |
| 22 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 23 | static const char* coreRegNames[16] = { |
| 24 | "r0", |
| 25 | "r1", |
| 26 | "r2", |
| 27 | "r3", |
| 28 | "r4", |
| 29 | "r5", |
| 30 | "r6", |
| 31 | "r7", |
| 32 | "r8", |
| 33 | "rSELF", |
| 34 | "r10", |
| 35 | "r11", |
| 36 | "r12", |
| 37 | "sp", |
| 38 | "lr", |
| 39 | "pc", |
| 40 | }; |
| 41 | |
| 42 | |
| 43 | static const char* shiftNames[4] = { |
| 44 | "lsl", |
| 45 | "lsr", |
| 46 | "asr", |
| 47 | "ror"}; |
| 48 | |
| 49 | /* Decode and print a ARM register name */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 50 | STATIC char* decodeRegList(ArmOpcode opcode, int vector, char* buf) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 51 | { |
| 52 | int i; |
| 53 | bool printed = false; |
| 54 | buf[0] = 0; |
| 55 | for (i = 0; i < 16; i++, vector >>= 1) { |
| 56 | if (vector & 0x1) { |
| 57 | int regId = i; |
| 58 | if (opcode == kThumbPush && i == 8) { |
| 59 | regId = r14lr; |
| 60 | } else if (opcode == kThumbPop && i == 8) { |
| 61 | regId = r15pc; |
| 62 | } |
| 63 | if (printed) { |
| 64 | sprintf(buf + strlen(buf), ", r%d", regId); |
| 65 | } else { |
| 66 | printed = true; |
| 67 | sprintf(buf, "r%d", regId); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | return buf; |
| 72 | } |
| 73 | |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 74 | STATIC char* decodeFPCSRegList(int count, int base, char* buf) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 75 | { |
| 76 | sprintf(buf, "s%d", base); |
| 77 | for (int i = 1; i < count; i++) { |
| 78 | sprintf(buf + strlen(buf), ", s%d",base + i); |
| 79 | } |
| 80 | return buf; |
| 81 | } |
| 82 | |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 83 | STATIC int expandImmediate(int value) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 84 | { |
| 85 | int mode = (value & 0xf00) >> 8; |
| 86 | u4 bits = value & 0xff; |
| 87 | switch(mode) { |
| 88 | case 0: |
| 89 | return bits; |
| 90 | case 1: |
| 91 | return (bits << 16) | bits; |
| 92 | case 2: |
| 93 | return (bits << 24) | (bits << 8); |
| 94 | case 3: |
| 95 | return (bits << 24) | (bits << 16) | (bits << 8) | bits; |
| 96 | default: |
| 97 | break; |
| 98 | } |
| 99 | bits = (bits | 0x80) << 24; |
| 100 | return bits >> (((value & 0xf80) >> 7) - 8); |
| 101 | } |
| 102 | |
| 103 | const char* ccNames[] = {"eq","ne","cs","cc","mi","pl","vs","vc", |
| 104 | "hi","ls","ge","lt","gt","le","al","nv"}; |
| 105 | /* |
| 106 | * Interpret a format string and build a string no longer than size |
| 107 | * See format key in Assemble.c. |
| 108 | */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 109 | STATIC std::string buildInsnString(const char* fmt, ArmLIR* lir, unsigned char* baseAddr) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 110 | { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 111 | std::string buf; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 112 | int i; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 113 | const char* fmtEnd = &fmt[strlen(fmt)]; |
| 114 | char tbuf[256]; |
| 115 | const char* name; |
| 116 | char nc; |
| 117 | while (fmt < fmtEnd) { |
| 118 | int operand; |
| 119 | if (*fmt == '!') { |
| 120 | fmt++; |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 121 | DCHECK_LT(fmt, fmtEnd); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 122 | nc = *fmt++; |
| 123 | if (nc=='!') { |
| 124 | strcpy(tbuf, "!"); |
| 125 | } else { |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 126 | DCHECK_LT(fmt, fmtEnd); |
Elliott Hughes | f5a7a47 | 2011-10-07 14:31:02 -0700 | [diff] [blame] | 127 | DCHECK_LT((unsigned)(nc-'0'), 4U); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 128 | operand = lir->operands[nc-'0']; |
| 129 | switch(*fmt++) { |
| 130 | case 'H': |
| 131 | if (operand != 0) { |
| 132 | sprintf(tbuf, ", %s %d",shiftNames[operand & 0x3], |
| 133 | operand >> 2); |
| 134 | } else { |
| 135 | strcpy(tbuf,""); |
| 136 | } |
| 137 | break; |
| 138 | case 'B': |
| 139 | switch (operand) { |
| 140 | case kSY: |
| 141 | name = "sy"; |
| 142 | break; |
| 143 | case kST: |
| 144 | name = "st"; |
| 145 | break; |
| 146 | case kISH: |
| 147 | name = "ish"; |
| 148 | break; |
| 149 | case kISHST: |
| 150 | name = "ishst"; |
| 151 | break; |
| 152 | case kNSH: |
| 153 | name = "nsh"; |
| 154 | break; |
| 155 | case kNSHST: |
| 156 | name = "shst"; |
| 157 | break; |
| 158 | default: |
| 159 | name = "DecodeError2"; |
| 160 | break; |
| 161 | } |
| 162 | strcpy(tbuf, name); |
| 163 | break; |
| 164 | case 'b': |
| 165 | strcpy(tbuf,"0000"); |
| 166 | for (i=3; i>= 0; i--) { |
| 167 | tbuf[i] += operand & 1; |
| 168 | operand >>= 1; |
| 169 | } |
| 170 | break; |
| 171 | case 'n': |
| 172 | operand = ~expandImmediate(operand); |
| 173 | sprintf(tbuf,"%d [%#x]", operand, operand); |
| 174 | break; |
| 175 | case 'm': |
| 176 | operand = expandImmediate(operand); |
| 177 | sprintf(tbuf,"%d [%#x]", operand, operand); |
| 178 | break; |
| 179 | case 's': |
| 180 | sprintf(tbuf,"s%d",operand & FP_REG_MASK); |
| 181 | break; |
| 182 | case 'S': |
| 183 | sprintf(tbuf,"d%d",(operand & FP_REG_MASK) >> 1); |
| 184 | break; |
| 185 | case 'h': |
| 186 | sprintf(tbuf,"%04x", operand); |
| 187 | break; |
| 188 | case 'M': |
| 189 | case 'd': |
| 190 | sprintf(tbuf,"%d", operand); |
| 191 | break; |
| 192 | case 'C': |
| 193 | sprintf(tbuf,"%s",coreRegNames[operand]); |
| 194 | break; |
| 195 | case 'E': |
| 196 | sprintf(tbuf,"%d", operand*4); |
| 197 | break; |
| 198 | case 'F': |
| 199 | sprintf(tbuf,"%d", operand*2); |
| 200 | break; |
| 201 | case 'c': |
| 202 | strcpy(tbuf, ccNames[operand]); |
| 203 | break; |
| 204 | case 't': |
| 205 | sprintf(tbuf,"0x%08x (L%p)", |
| 206 | (int) baseAddr + lir->generic.offset + 4 + |
| 207 | (operand << 1), |
| 208 | lir->generic.target); |
| 209 | break; |
| 210 | case 'u': { |
| 211 | int offset_1 = lir->operands[0]; |
| 212 | int offset_2 = NEXT_LIR(lir)->operands[0]; |
| 213 | intptr_t target = |
| 214 | ((((intptr_t) baseAddr + lir->generic.offset + 4) & |
| 215 | ~3) + (offset_1 << 21 >> 9) + (offset_2 << 1)) & |
| 216 | 0xfffffffc; |
| 217 | sprintf(tbuf, "%p", (void *) target); |
| 218 | break; |
| 219 | } |
| 220 | |
| 221 | /* Nothing to print for BLX_2 */ |
| 222 | case 'v': |
| 223 | strcpy(tbuf, "see above"); |
| 224 | break; |
| 225 | case 'R': |
| 226 | decodeRegList(lir->opcode, operand, tbuf); |
| 227 | break; |
| 228 | case 'P': |
| 229 | decodeFPCSRegList(operand, 16, tbuf); |
| 230 | break; |
| 231 | case 'Q': |
| 232 | decodeFPCSRegList(operand, 0, tbuf); |
| 233 | break; |
| 234 | default: |
| 235 | strcpy(tbuf,"DecodeError1"); |
| 236 | break; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 237 | } |
| 238 | buf += tbuf; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 239 | } |
| 240 | } else { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 241 | buf += *fmt++; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 242 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 243 | } |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 244 | return buf; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | void oatDumpResourceMask(LIR* lir, u8 mask, const char* prefix) |
| 248 | { |
| 249 | char buf[256]; |
| 250 | buf[0] = 0; |
| 251 | ArmLIR* armLIR = (ArmLIR*) lir; |
| 252 | |
| 253 | if (mask == ENCODE_ALL) { |
| 254 | strcpy(buf, "all"); |
| 255 | } else { |
| 256 | char num[8]; |
| 257 | int i; |
| 258 | |
| 259 | for (i = 0; i < kRegEnd; i++) { |
| 260 | if (mask & (1ULL << i)) { |
| 261 | sprintf(num, "%d ", i); |
| 262 | strcat(buf, num); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | if (mask & ENCODE_CCODE) { |
| 267 | strcat(buf, "cc "); |
| 268 | } |
| 269 | if (mask & ENCODE_FP_STATUS) { |
| 270 | strcat(buf, "fpcc "); |
| 271 | } |
| 272 | |
| 273 | /* Memory bits */ |
| 274 | if (armLIR && (mask & ENCODE_DALVIK_REG)) { |
| 275 | sprintf(buf + strlen(buf), "dr%d%s", armLIR->aliasInfo & 0xffff, |
| 276 | (armLIR->aliasInfo & 0x80000000) ? "(+1)" : ""); |
| 277 | } |
| 278 | if (mask & ENCODE_LITERAL) { |
| 279 | strcat(buf, "lit "); |
| 280 | } |
| 281 | |
| 282 | if (mask & ENCODE_HEAP_REF) { |
| 283 | strcat(buf, "heap "); |
| 284 | } |
| 285 | if (mask & ENCODE_MUST_NOT_ALIAS) { |
| 286 | strcat(buf, "noalias "); |
| 287 | } |
| 288 | } |
| 289 | if (buf[0]) { |
| 290 | LOG(INFO) << prefix << ": " << buf; |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | * Debugging macros |
| 296 | */ |
| 297 | #define DUMP_RESOURCE_MASK(X) |
| 298 | #define DUMP_SSA_REP(X) |
| 299 | |
| 300 | /* Pretty-print a LIR instruction */ |
| 301 | void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr) |
| 302 | { |
| 303 | ArmLIR* lir = (ArmLIR*) arg; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 304 | int offset = lir->generic.offset; |
| 305 | int dest = lir->operands[0]; |
| 306 | const bool dumpNop = false; |
| 307 | |
| 308 | /* Handle pseudo-ops individually, and all regular insns as a group */ |
| 309 | switch(lir->opcode) { |
| 310 | case kArmPseudoMethodEntry: |
| 311 | LOG(INFO) << "-------- method entry " << |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 312 | art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 313 | break; |
| 314 | case kArmPseudoMethodExit: |
| 315 | LOG(INFO) << "-------- Method_Exit"; |
| 316 | break; |
| 317 | case kArmPseudoBarrier: |
| 318 | LOG(INFO) << "-------- BARRIER"; |
| 319 | break; |
| 320 | case kArmPseudoExtended: |
| 321 | LOG(INFO) << "-------- " << (char* ) dest; |
| 322 | break; |
| 323 | case kArmPseudoSSARep: |
| 324 | DUMP_SSA_REP(LOG(INFO) << "-------- kMirOpPhi: " << (char* ) dest); |
| 325 | break; |
| 326 | case kArmPseudoEntryBlock: |
| 327 | LOG(INFO) << "-------- entry offset: 0x" << std::hex << dest; |
| 328 | break; |
| 329 | case kArmPseudoDalvikByteCodeBoundary: |
| 330 | LOG(INFO) << "-------- dalvik offset: 0x" << std::hex << |
| 331 | lir->generic.dalvikOffset << " @ " << (char* )lir->operands[0]; |
| 332 | break; |
| 333 | case kArmPseudoExitBlock: |
| 334 | LOG(INFO) << "-------- exit offset: 0x" << std::hex << dest; |
| 335 | break; |
| 336 | case kArmPseudoPseudoAlign4: |
| 337 | LOG(INFO) << (intptr_t)baseAddr + offset << " (0x" << std::hex << |
| 338 | offset << "): .align4"; |
| 339 | break; |
| 340 | case kArmPseudoEHBlockLabel: |
| 341 | LOG(INFO) << "Exception_Handling:"; |
| 342 | break; |
| 343 | case kArmPseudoTargetLabel: |
| 344 | case kArmPseudoNormalBlockLabel: |
| 345 | LOG(INFO) << "L" << (intptr_t)lir << ":"; |
| 346 | break; |
buzbee | 5ade1d2 | 2011-09-09 14:44:52 -0700 | [diff] [blame] | 347 | case kArmPseudoThrowTarget: |
| 348 | LOG(INFO) << "LT" << (intptr_t)lir << ":"; |
| 349 | break; |
buzbee | c1f4504 | 2011-09-21 16:03:19 -0700 | [diff] [blame] | 350 | case kArmPseudoSuspendTarget: |
| 351 | LOG(INFO) << "LS" << (intptr_t)lir << ":"; |
| 352 | break; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 353 | case kArmPseudoCaseLabel: |
| 354 | LOG(INFO) << "LC" << (intptr_t)lir << ": Case target 0x" << |
| 355 | std::hex << lir->operands[0] << "|" << std::dec << |
| 356 | lir->operands[0]; |
| 357 | break; |
| 358 | default: |
| 359 | if (lir->flags.isNop && !dumpNop) { |
| 360 | break; |
buzbee | 3ea4ec5 | 2011-08-22 17:37:19 -0700 | [diff] [blame] | 361 | } else { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 362 | std::string op_name(buildInsnString(EncodingMap[lir->opcode].name, lir, baseAddr)); |
| 363 | std::string op_operands(buildInsnString(EncodingMap[lir->opcode].fmt, lir, baseAddr)); |
| 364 | LOG(INFO) << StringPrintf("%p (%04x): %-9s%s%s%s", baseAddr + offset, offset, |
| 365 | op_name.c_str(), op_operands.c_str(), lir->flags.isNop ? "(nop)" : "", |
| 366 | lir->flags.squashed ? "(squashed)" : ""); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 367 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 368 | break; |
| 369 | } |
| 370 | |
| 371 | if (lir->useMask && (!lir->flags.isNop || dumpNop)) { |
| 372 | DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir, |
| 373 | lir->useMask, "use")); |
| 374 | } |
| 375 | if (lir->defMask && (!lir->flags.isNop || dumpNop)) { |
| 376 | DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir, |
| 377 | lir->defMask, "def")); |
| 378 | } |
| 379 | } |
| 380 | |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 381 | void oatDumpPromotionMap(CompilationUnit *cUnit) |
| 382 | { |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 383 | for (int i = 0; i < cUnit->numDalvikRegisters; i++) { |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 384 | PromotionMap vRegMap = cUnit->promotionMap[i]; |
| 385 | char buf[100]; |
| 386 | if (vRegMap.fpLocation == kLocPhysReg) { |
| 387 | snprintf(buf, 100, " : s%d", vRegMap.fpReg & FP_REG_MASK); |
| 388 | } else { |
| 389 | buf[0] = 0; |
| 390 | } |
| 391 | char buf2[100]; |
| 392 | snprintf(buf2, 100, "V[%02d] -> %s%d%s", i, |
| 393 | vRegMap.coreLocation == kLocPhysReg ? |
| 394 | "r" : "SP+", vRegMap.coreLocation == kLocPhysReg ? |
| 395 | vRegMap.coreReg : oatSRegOffset(cUnit, i), buf); |
| 396 | LOG(INFO) << buf2; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | void oatDumpFullPromotionMap(CompilationUnit *cUnit) |
| 401 | { |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 402 | for (int i = 0; i < cUnit->numDalvikRegisters; i++) { |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 403 | PromotionMap vRegMap = cUnit->promotionMap[i]; |
| 404 | LOG(INFO) << i << " -> " << "CL:" << (int)vRegMap.coreLocation << |
| 405 | ", CR:" << (int)vRegMap.coreReg << ", FL:" << |
| 406 | (int)vRegMap.fpLocation << ", FR:" << (int)vRegMap.fpReg << |
| 407 | ", - " << (int)vRegMap.firstInPair; |
| 408 | } |
| 409 | } |
| 410 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 411 | /* Dump instructions and constant pool contents */ |
| 412 | void oatCodegenDump(CompilationUnit* cUnit) |
| 413 | { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 414 | LOG(INFO) << "/*"; |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 415 | LOG(INFO) << "Dumping LIR insns for " |
| 416 | << art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 417 | LIR* lirInsn; |
| 418 | ArmLIR* armLIR; |
| 419 | int insnsSize = cUnit->insnsSize; |
| 420 | |
| 421 | LOG(INFO) << "Regs (excluding ins) : " << cUnit->numRegs; |
| 422 | LOG(INFO) << "Ins : " << cUnit->numIns; |
| 423 | LOG(INFO) << "Outs : " << cUnit->numOuts; |
buzbee | bbaf894 | 2011-10-02 13:08:29 -0700 | [diff] [blame] | 424 | LOG(INFO) << "CoreSpills : " << cUnit->numCoreSpills; |
| 425 | LOG(INFO) << "FPSpills : " << cUnit->numFPSpills; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 426 | LOG(INFO) << "Padding : " << cUnit->numPadding; |
| 427 | LOG(INFO) << "Frame size : " << cUnit->frameSize; |
| 428 | LOG(INFO) << "Start of ins : " << cUnit->insOffset; |
| 429 | LOG(INFO) << "Start of regs : " << cUnit->regsOffset; |
| 430 | LOG(INFO) << "code size is " << cUnit->totalSize << |
| 431 | " bytes, Dalvik size is " << insnsSize * 2; |
| 432 | LOG(INFO) << "expansion factor: " << |
| 433 | (float)cUnit->totalSize / (float)(insnsSize * 2); |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 434 | oatDumpPromotionMap(cUnit); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 435 | for (lirInsn = cUnit->firstLIRInsn; lirInsn; lirInsn = lirInsn->next) { |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 436 | oatDumpLIRInsn(cUnit, lirInsn, 0); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 437 | } |
| 438 | for (lirInsn = cUnit->classPointerList; lirInsn; lirInsn = lirInsn->next) { |
| 439 | armLIR = (ArmLIR*) lirInsn; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 440 | LOG(INFO) << StringPrintf("%x (%04x): .class (%s)", |
| 441 | armLIR->generic.offset, armLIR->generic.offset, |
| 442 | ((CallsiteInfo *) armLIR->operands[0])->classDescriptor); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 443 | } |
| 444 | for (lirInsn = cUnit->literalList; lirInsn; lirInsn = lirInsn->next) { |
| 445 | armLIR = (ArmLIR*) lirInsn; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 446 | LOG(INFO) << StringPrintf("%x (%04x): .word (%#x)", |
| 447 | armLIR->generic.offset, armLIR->generic.offset, armLIR->operands[0]); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 448 | } |
| 449 | |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 450 | const art::DexFile::MethodId& method_id = |
| 451 | cUnit->dex_file->GetMethodId(cUnit->method_idx); |
Elliott Hughes | 9557241 | 2011-12-13 18:14:20 -0800 | [diff] [blame^] | 452 | std::string signature(cUnit->dex_file->GetMethodSignature(method_id)); |
| 453 | std::string name(cUnit->dex_file->GetMethodName(method_id)); |
| 454 | std::string descriptor(cUnit->dex_file->GetMethodDeclaringClassDescriptor(method_id)); |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 455 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 456 | // Dump mapping table |
buzbee | 4ef7652 | 2011-09-08 10:00:32 -0700 | [diff] [blame] | 457 | if (cUnit->mappingTable.size() > 0) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 458 | std::string line(StringPrintf("\n MappingTable %s%s_%s_mappingTable[%d] = {", |
| 459 | descriptor.c_str(), name.c_str(), signature.c_str(), cUnit->mappingTable.size())); |
| 460 | std::replace(line.begin(), line.end(), ';', '_'); |
| 461 | LOG(INFO) << line; |
buzbee | 4ef7652 | 2011-09-08 10:00:32 -0700 | [diff] [blame] | 462 | for (uint32_t i = 0; i < cUnit->mappingTable.size(); i+=2) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 463 | line = StringPrintf(" {0x%08x, 0x%04x},", |
buzbee | 4ef7652 | 2011-09-08 10:00:32 -0700 | [diff] [blame] | 464 | cUnit->mappingTable[i], cUnit->mappingTable[i+1]); |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 465 | LOG(INFO) << line; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 466 | } |
| 467 | LOG(INFO) <<" };\n\n"; |
| 468 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 469 | } |