diff options
| author | 2012-05-18 11:51:26 -0700 | |
|---|---|---|
| committer | 2012-05-18 11:58:56 -0700 | |
| commit | 5772babbe824494ef9fe90a1b07a926d124bb7c7 (patch) | |
| tree | 49daf01f5589f33af0c880ef9ecf1e77a59fc265 /src/compiler/codegen | |
| parent | 6523cf6eccc0730a3ed58565ee9f1d4bc2f69ed8 (diff) | |
Fixed x86 compilation of filled-new-array/range.
Implemented loadBaseIndexed and found a way to implemented
filled-new-array/range using only 4 temps instead of 5 by regenerating
the target pointer value after the loop.
Change-Id: Ibb694600e6852ba3c4939c5878625655809c60fd
Diffstat (limited to 'src/compiler/codegen')
| -rw-r--r-- | src/compiler/codegen/GenCommon.cc | 8 | ||||
| -rw-r--r-- | src/compiler/codegen/x86/X86/Factory.cc | 65 |
2 files changed, 14 insertions, 59 deletions
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc index c9ba285c5f..2209084934 100644 --- a/src/compiler/codegen/GenCommon.cc +++ b/src/compiler/codegen/GenCommon.cc @@ -582,7 +582,8 @@ void genFilledNewArray(CompilationUnit* cUnit, MIR* mir, bool isRange) #if defined(TARGET_ARM) int rVal = rLR; // Using a lot of temps, rLR is known free here #elif defined(TARGET_X86) - int rVal = rSrc; + oatFreeTemp(cUnit, rRET0); + int rVal = oatAllocTemp(cUnit); #else int rVal = oatAllocTemp(cUnit); #endif @@ -609,6 +610,11 @@ void genFilledNewArray(CompilationUnit* cUnit, MIR* mir, bool isRange) opRegImm(cUnit, kOpSub, rIdx, 1); opCmpImmBranch(cUnit, kCondGe, rIdx, 0, target); #endif +#if defined(TARGET_X86) + // Restore the target pointer + opRegRegImm(cUnit, kOpAdd, rRET0, rDst, + -Array::DataOffset(component_size).Int32Value()); +#endif } else if (!isRange) { // TUNING: interleave for (unsigned int i = 0; i < dInsn->vA; i++) { diff --git a/src/compiler/codegen/x86/X86/Factory.cc b/src/compiler/codegen/x86/X86/Factory.cc index 3698d2d724..6f117096f9 100644 --- a/src/compiler/codegen/x86/X86/Factory.cc +++ b/src/compiler/codegen/x86/X86/Factory.cc @@ -360,64 +360,6 @@ LIR *loadConstantValueWide(CompilationUnit *cUnit, int rDestLo, return res; } -/* Load value from base + scaled index. */ -LIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase, - int rIndex, int rDest, int scale, OpSize size) -{ - UNIMPLEMENTED(WARNING) << "loadBaseIndexed"; - newLIR0(cUnit, kX86Bkpt); - return NULL; -#if 0 - LIR *first = NULL; - LIR *res; - X86OpCode opcode = kX86Nop; - int tReg = oatAllocTemp(cUnit); - - if (FPREG(rDest)) { - DCHECK(SINGLEREG(rDest)); - DCHECK((size == kWord) || (size == kSingle)); - size = kSingle; - } else { - if (size == kSingle) - size = kWord; - } - - if (!scale) { - first = newLIR3(cUnit, kX86Addu, tReg , rBase, rIndex); - } else { - first = opRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale); - newLIR3(cUnit, kX86Addu, tReg , rBase, tReg); - } - - switch (size) { - case kSingle: - opcode = kX86Flwc1; - break; - case kWord: - opcode = kX86Lw; - break; - case kUnsignedHalf: - opcode = kX86Lhu; - break; - case kSignedHalf: - opcode = kX86Lh; - break; - case kUnsignedByte: - opcode = kX86Lbu; - break; - case kSignedByte: - opcode = kX86Lb; - break; - default: - LOG(FATAL) << "Bad case in loadBaseIndexed"; - } - - res = newLIR3(cUnit, opcode, rDest, 0, tReg); - oatFreeTemp(cUnit, tReg); - return (first) ? first : res; -#endif -} - LIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask) { UNIMPLEMENTED(WARNING) << "loadMultiple"; @@ -560,6 +502,13 @@ LIR* loadBaseIndexedDisp(CompilationUnit *cUnit, MIR *mir, return load; } +/* Load value from base + scaled index. */ +LIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase, + int rIndex, int rDest, int scale, OpSize size) { + return loadBaseIndexedDisp(cUnit, NULL, rBase, rIndex, scale, 0, + rDest, INVALID_REG, size, INVALID_SREG); +} + LIR *loadBaseDisp(CompilationUnit *cUnit, MIR *mir, int rBase, int displacement, int rDest, |