Index: src/arm/assembler-arm.cc |
=================================================================== |
--- src/arm/assembler-arm.cc (revision 2308) |
+++ src/arm/assembler-arm.cc (working copy) |
@@ -491,6 +491,20 @@ |
} |
+// We have to use the temporary register for things that can be relocated even |
+// if they can be encoded in the ARM's 12 bits of immediate-offset instruction |
+// space. There is no guarantee that the relocated location can be similarly |
+// encoded. |
+static bool MustUseIp(RelocInfo::Mode rmode) { |
+ if (rmode == RelocInfo::EXTERNAL_REFERENCE) { |
+ return Serializer::enabled(); |
+ } else if (rmode == RelocInfo::NONE) { |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+ |
void Assembler::addrmod1(Instr instr, |
Register rn, |
Register rd, |
@@ -501,8 +515,7 @@ |
// immediate |
uint32_t rotate_imm; |
uint32_t immed_8; |
- if ((x.rmode_ != RelocInfo::NONE && |
- x.rmode_ != RelocInfo::EXTERNAL_REFERENCE) || |
+ if (MustUseIp(x.rmode_) || |
!fits_shifter(x.imm32_, &rotate_imm, &immed_8, &instr)) { |
// The immediate operand cannot be encoded as a shifter operand, so load |
// it first to register ip and change the original instruction to use ip. |
@@ -904,8 +917,7 @@ |
// immediate |
uint32_t rotate_imm; |
uint32_t immed_8; |
- if ((src.rmode_ != RelocInfo::NONE && |
- src.rmode_ != RelocInfo::EXTERNAL_REFERENCE)|| |
+ if (MustUseIp(src.rmode_) || |
!fits_shifter(src.imm32_, &rotate_imm, &immed_8, NULL)) { |
// immediate operand cannot be encoded, load it first to register ip |
RecordRelocInfo(src.rmode_, src.imm32_); |