summaryrefslogtreecommitdiff
path: root/compiler/utils/arm/assembler_arm.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-05-20 12:31:08 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-05-20 18:44:51 +0100
commitdb0bbab279534974dca507946c66cff2d05dc9f9 (patch)
tree190c7ace8cfb404202a342bef51aa967592c8d6b /compiler/utils/arm/assembler_arm.h
parent099d3750d59719cecffdf49284f2633308b9c221 (diff)
Introduce a NearLabel in thumb2.
This tells the assembler that the user knows the encoding can be in 16bits. Change-Id: Idf36c38beb1e07a69862c972484aeb08326a0499
Diffstat (limited to 'compiler/utils/arm/assembler_arm.h')
-rw-r--r--compiler/utils/arm/assembler_arm.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/utils/arm/assembler_arm.h b/compiler/utils/arm/assembler_arm.h
index dee8287e67..a19a7645c2 100644
--- a/compiler/utils/arm/assembler_arm.h
+++ b/compiler/utils/arm/assembler_arm.h
@@ -33,6 +33,16 @@ namespace arm {
class Arm32Assembler;
class Thumb2Assembler;
+// This class indicates that the label and its uses
+// will fall into a range that is encodable in 16bits on thumb2.
+class NearLabel : public Label {
+ public:
+ NearLabel() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NearLabel);
+};
+
class ShifterOperand {
public:
ShifterOperand() : type_(kUnknown), rm_(kNoRegister), rs_(kNoRegister),
@@ -519,6 +529,9 @@ class ArmAssembler : public Assembler {
// Branch instructions.
virtual void b(Label* label, Condition cond = AL) = 0;
+ virtual void b(NearLabel* label, Condition cond = AL) {
+ b(reinterpret_cast<Label*>(label), cond);
+ }
virtual void bl(Label* label, Condition cond = AL) = 0;
virtual void blx(Register rm, Condition cond = AL) = 0;
virtual void bx(Register rm, Condition cond = AL) = 0;
@@ -654,6 +667,9 @@ class ArmAssembler : public Assembler {
virtual void Bind(Label* label) = 0;
virtual void CompareAndBranchIfZero(Register r, Label* label) = 0;
+ virtual void CompareAndBranchIfZero(Register r, NearLabel* label) {
+ CompareAndBranchIfZero(r, reinterpret_cast<Label*>(label));
+ }
virtual void CompareAndBranchIfNonZero(Register r, Label* label) = 0;
//