Revert "Introduce a NearLabel in thumb2."
Fails some benchmarks and libcore tests.
This reverts commit db0bbab279534974dca507946c66cff2d05dc9f9.
Change-Id: I5d1afef5ede87e65d61f49529027c5c2f35b17fb
diff --git a/compiler/utils/arm/assembler_thumb2.h b/compiler/utils/arm/assembler_thumb2.h
index e8def73..90d489f 100644
--- a/compiler/utils/arm/assembler_thumb2.h
+++ b/compiler/utils/arm/assembler_thumb2.h
@@ -239,7 +239,6 @@
// Branch instructions.
void b(Label* label, Condition cond = AL);
- void b(NearLabel* label, Condition cond = AL);
void bl(Label* label, Condition cond = AL);
void blx(Label* label);
void blx(Register rm, Condition cond = AL) OVERRIDE;
@@ -274,7 +273,6 @@
void Mov(Register rd, Register rm, Condition cond = AL) OVERRIDE;
void CompareAndBranchIfZero(Register r, Label* label) OVERRIDE;
- void CompareAndBranchIfZero(Register r, NearLabel* label) OVERRIDE;
void CompareAndBranchIfNonZero(Register r, Label* label) OVERRIDE;
// Memory barriers.
@@ -433,7 +431,7 @@
void EmitVPushPop(uint32_t reg, int nregs, bool push, bool dbl, Condition cond);
- void EmitBranch(Condition cond, Label* label, bool link, bool x, bool is_near = false);
+ void EmitBranch(Condition cond, Label* label, bool link, bool x);
static int32_t EncodeBranchOffset(int32_t offset, int32_t inst);
static int DecodeBranchOffset(int32_t inst);
int32_t EncodeTstOffset(int offset, int32_t inst);
@@ -561,7 +559,6 @@
// Resolve a branch when the target is known. If this causes the
// size of the branch to change return true. Otherwise return false.
bool Resolve(uint32_t target) {
- uint32_t old_target = target_;
target_ = target;
if (assembler_->CanRelocateBranches()) {
Size new_size = CalculateSize();
@@ -572,11 +569,9 @@
return false;
} else {
if (kIsDebugBuild) {
- if (old_target == kUnresolved) {
- DCHECK(!(CalculateSize() == k32Bit && size_ == k16Bit));
- } else {
- DCHECK(CalculateSize() == size_);
- }
+ Size new_size = CalculateSize();
+ // Check that the size has not increased.
+ DCHECK(!(new_size == k32Bit && size_ == k16Bit));
}
return false;
}
@@ -656,10 +651,6 @@
if (assembler_->IsForced32Bit() && (type_ == kUnconditional || type_ == kConditional)) {
return k32Bit;
}
- if (IsCompareAndBranch()) {
- // Compare and branch instructions can only be encoded on 16 bits.
- return k16Bit;
- }
return assembler_->CanRelocateBranches() ? k16Bit : k32Bit;
}
// When the target is resolved, we know the best encoding for it.
@@ -723,15 +714,8 @@
}
// Add an unresolved branch and return its id.
- uint16_t AddBranch(Branch::Type type,
- uint32_t location,
- Condition cond = AL,
- bool is_near = false) {
- Branch* branch = new Branch(this, type, location, cond);
- if (is_near) {
- branch->ResetSize(Branch::k16Bit);
- }
- branches_.push_back(branch);
+ uint16_t AddBranch(Branch::Type type, uint32_t location, Condition cond = AL) {
+ branches_.push_back(new Branch(this, type, location, cond));
return branches_.size() - 1;
}