| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe | 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe |
| 6 // Please update the (git) revision if we merge changes from Dart. | 6 // Please update the (git) revision if we merge changes from Dart. |
| 7 // https://code.google.com/p/dart/wiki/GettingTheSource | 7 // https://code.google.com/p/dart/wiki/GettingTheSource |
| 8 | 8 |
| 9 #ifndef VM_ASSEMBLER_ARM_H_ | 9 #ifndef VM_ASSEMBLER_ARM_H_ |
| 10 #define VM_ASSEMBLER_ARM_H_ | 10 #define VM_ASSEMBLER_ARM_H_ |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 Operand(const Operand& other) | 125 Operand(const Operand& other) |
| 126 : ValueObject(), type_(other.type_), encoding_(other.encoding_) { } | 126 : ValueObject(), type_(other.type_), encoding_(other.encoding_) { } |
| 127 | 127 |
| 128 // Data-processing operands - Assignment operator. | 128 // Data-processing operands - Assignment operator. |
| 129 Operand& operator=(const Operand& other) { | 129 Operand& operator=(const Operand& other) { |
| 130 type_ = other.type_; | 130 type_ = other.type_; |
| 131 encoding_ = other.encoding_; | 131 encoding_ = other.encoding_; |
| 132 return *this; | 132 return *this; |
| 133 } | 133 } |
| 134 | 134 |
| 135 #if 0 |
| 136 // Moved to encodeRotatedImm8() in IceAssemblerARM32.cpp |
| 135 // Data-processing operands - Immediate. | 137 // Data-processing operands - Immediate. |
| 136 explicit Operand(uint32_t immediate) { | 138 explicit Operand(uint32_t immediate) { |
| 137 ASSERT(immediate < (1 << kImmed8Bits)); | 139 ASSERT(immediate < (1 << kImmed8Bits)); |
| 138 type_ = 1; | 140 type_ = 1; |
| 139 encoding_ = immediate; | 141 encoding_ = immediate; |
| 140 } | 142 } |
| 143 #endif |
| 141 | 144 |
| 142 #if 0 | 145 #if 0 |
| 143 // Moved to decodeOperand() in IceAssemblerARM32.cpp | 146 // Moved to decodeOperand() and encodeRotatedImm8() in IceAssemblerARM32.cpp |
| 144 // Data-processing operands - Rotated immediate. | 147 // Data-processing operands - Rotated immediate. |
| 145 Operand(uint32_t rotate, uint32_t immed8) { | 148 Operand(uint32_t rotate, uint32_t immed8) { |
| 146 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); | 149 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); |
| 147 type_ = 1; | 150 type_ = 1; |
| 148 encoding_ = (rotate << kRotateShift) | (immed8 << kImmed8Shift); | 151 encoding_ = (rotate << kRotateShift) | (immed8 << kImmed8Shift); |
| 149 } | 152 } |
| 150 | 153 |
| 151 // Moved to decodeOperand() in IceAssemblerARM32.cpp | 154 // Moved to decodeOperand() in IceAssemblerARM32.cpp |
| 152 // Data-processing operands - Register. | 155 // Data-processing operands - Register. |
| 153 explicit Operand(Register rm) { | 156 explicit Operand(Register rm) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 167 #endif | 170 #endif |
| 168 | 171 |
| 169 // Data-processing operands - Logical shift/rotate by register. | 172 // Data-processing operands - Logical shift/rotate by register. |
| 170 Operand(Register rm, Shift shift, Register rs) { | 173 Operand(Register rm, Shift shift, Register rs) { |
| 171 type_ = 0; | 174 type_ = 0; |
| 172 encoding_ = static_cast<uint32_t>(rs) << kShiftRegisterShift | | 175 encoding_ = static_cast<uint32_t>(rs) << kShiftRegisterShift | |
| 173 static_cast<uint32_t>(shift) << kShiftShift | (1 << 4) | | 176 static_cast<uint32_t>(shift) << kShiftShift | (1 << 4) | |
| 174 static_cast<uint32_t>(rm); | 177 static_cast<uint32_t>(rm); |
| 175 } | 178 } |
| 176 | 179 |
| 180 #if 0 |
| 181 // Already defined as ARM32::OperandARM32FlexImm::canHoldImm(). |
| 177 static bool CanHold(uint32_t immediate, Operand* o) { | 182 static bool CanHold(uint32_t immediate, Operand* o) { |
| 178 // Avoid the more expensive test for frequent small immediate values. | 183 // Avoid the more expensive test for frequent small immediate values. |
| 179 if (immediate < (1 << kImmed8Bits)) { | 184 if (immediate < (1 << kImmed8Bits)) { |
| 180 o->type_ = 1; | 185 o->type_ = 1; |
| 181 o->encoding_ = (0 << kRotateShift) | (immediate << kImmed8Shift); | 186 o->encoding_ = (0 << kRotateShift) | (immediate << kImmed8Shift); |
| 182 return true; | 187 return true; |
| 183 } | 188 } |
| 184 // Note that immediate must be unsigned for the test to work correctly. | 189 // Note that immediate must be unsigned for the test to work correctly. |
| 185 for (int rot = 0; rot < 16; rot++) { | 190 for (int rot = 0; rot < 16; rot++) { |
| 186 uint32_t imm8 = (immediate << 2*rot) | (immediate >> (32 - 2*rot)); | 191 uint32_t imm8 = (immediate << 2*rot) | (immediate >> (32 - 2*rot)); |
| 187 if (imm8 < (1 << kImmed8Bits)) { | 192 if (imm8 < (1 << kImmed8Bits)) { |
| 188 o->type_ = 1; | 193 o->type_ = 1; |
| 189 o->encoding_ = (rot << kRotateShift) | (imm8 << kImmed8Shift); | 194 o->encoding_ = (rot << kRotateShift) | (imm8 << kImmed8Shift); |
| 190 return true; | 195 return true; |
| 191 } | 196 } |
| 192 } | 197 } |
| 193 return false; | 198 return false; |
| 194 } | 199 } |
| 200 #endif |
| 195 | 201 |
| 196 private: | 202 private: |
| 197 bool is_valid() const { return (type_ == 0) || (type_ == 1); } | 203 bool is_valid() const { return (type_ == 0) || (type_ == 1); } |
| 198 | 204 |
| 199 uint32_t type() const { | 205 uint32_t type() const { |
| 200 ASSERT(is_valid()); | 206 ASSERT(is_valid()); |
| 201 return type_; | 207 return type_; |
| 202 } | 208 } |
| 203 | 209 |
| 204 uint32_t encoding() const { | 210 uint32_t encoding() const { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 void sbc(Register rd, Register rn, Operand o, Condition cond = AL); | 477 void sbc(Register rd, Register rn, Operand o, Condition cond = AL); |
| 472 | 478 |
| 473 void sbcs(Register rd, Register rn, Operand o, Condition cond = AL); | 479 void sbcs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 474 | 480 |
| 475 void rsc(Register rd, Register rn, Operand o, Condition cond = AL); | 481 void rsc(Register rd, Register rn, Operand o, Condition cond = AL); |
| 476 | 482 |
| 477 void tst(Register rn, Operand o, Condition cond = AL); | 483 void tst(Register rn, Operand o, Condition cond = AL); |
| 478 | 484 |
| 479 void teq(Register rn, Operand o, Condition cond = AL); | 485 void teq(Register rn, Operand o, Condition cond = AL); |
| 480 | 486 |
| 487 #if 0 |
| 488 // Moved to ARM32::AssemblerARM32::cmp() |
| 481 void cmp(Register rn, Operand o, Condition cond = AL); | 489 void cmp(Register rn, Operand o, Condition cond = AL); |
| 490 #endif |
| 482 | 491 |
| 483 void cmn(Register rn, Operand o, Condition cond = AL); | 492 void cmn(Register rn, Operand o, Condition cond = AL); |
| 484 | 493 |
| 485 #if 0 | 494 #if 0 |
| 486 // Moved to ARM32::IceAssemblerARM32::orr(). | 495 // Moved to ARM32::IceAssemblerARM32::orr(). |
| 487 void orr(Register rd, Register rn, Operand o, Condition cond = AL); | 496 void orr(Register rd, Register rn, Operand o, Condition cond = AL); |
| 488 void orrs(Register rd, Register rn, Operand o, Condition cond = AL); | 497 void orrs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 489 | 498 |
| 490 // Moved to ARM32::IceAssemblerARM32::mov() | 499 // Moved to ARM32::IceAssemblerARM32::mov() |
| 491 void mov(Register rd, Operand o, Condition cond = AL); | 500 void mov(Register rd, Operand o, Condition cond = AL); |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 Register new_value, | 1273 Register new_value, |
| 1265 FieldContent old_content); | 1274 FieldContent old_content); |
| 1266 | 1275 |
| 1267 DISALLOW_ALLOCATION(); | 1276 DISALLOW_ALLOCATION(); |
| 1268 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1277 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1269 }; | 1278 }; |
| 1270 | 1279 |
| 1271 } // namespace dart | 1280 } // namespace dart |
| 1272 | 1281 |
| 1273 #endif // VM_ASSEMBLER_ARM_H_ | 1282 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |