Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: src/arm/assembler-arm.h

Issue 23560010: Thumb2 Backend: 16-bit instruction encoding helper methods Base URL: HEAD^
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm/assembler-arm-inl.h » ('j') | src/arm/assembler-arm-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 // for inline tables, e.g., jump-tables. The constant pool should be 1357 // for inline tables, e.g., jump-tables. The constant pool should be
1358 // emitted before any use of db and dd to ensure that constant pools 1358 // emitted before any use of db and dd to ensure that constant pools
1359 // are not emitted as part of the tables generated. 1359 // are not emitted as part of the tables generated.
1360 void db(uint8_t data); 1360 void db(uint8_t data);
1361 void dd(uint32_t data); 1361 void dd(uint32_t data);
1362 1362
1363 PositionsRecorder* positions_recorder() { return &positions_recorder_; } 1363 PositionsRecorder* positions_recorder() { return &positions_recorder_; }
1364 1364
1365 // Read/patch instructions 1365 // Read/patch instructions
1366 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } 1366 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); }
1367 Instr16 thumb16_instr_at(int pos) {
rmcilroy_google 2013/09/17 17:28:16 thumb2_instr16_at.
1368 return *reinterpret_cast<Instr16*>(buffer_ + pos);
1369 }
1367 void instr_at_put(int pos, Instr instr) { 1370 void instr_at_put(int pos, Instr instr) {
1368 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; 1371 *reinterpret_cast<Instr*>(buffer_ + pos) = instr;
1369 } 1372 }
1370 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } 1373 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
1371 static void instr_at_put(byte* pc, Instr instr) { 1374 static void instr_at_put(byte* pc, Instr instr) {
1372 *reinterpret_cast<Instr*>(pc) = instr; 1375 *reinterpret_cast<Instr*>(pc) = instr;
1373 } 1376 }
1374 static Condition GetCondition(Instr instr); 1377 static Condition GetCondition(Instr instr);
1375 static bool IsBranch(Instr instr); 1378 static bool IsBranch(Instr instr);
1376 static int GetBranchOffset(Instr instr); 1379 static int GetBranchOffset(Instr instr);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 // be 64-bit. 1527 // be 64-bit.
1525 int num_pending_64_bit_reloc_info_; 1528 int num_pending_64_bit_reloc_info_;
1526 1529
1527 // The bound position, before this we cannot do instruction elimination. 1530 // The bound position, before this we cannot do instruction elimination.
1528 int last_bound_pos_; 1531 int last_bound_pos_;
1529 1532
1530 // Code emission 1533 // Code emission
1531 inline void CheckBuffer(); 1534 inline void CheckBuffer();
1532 void GrowBuffer(); 1535 void GrowBuffer();
1533 inline void emit(Instr x); 1536 inline void emit(Instr x);
1537 inline void emit16(Instr16 x, bool check_buffer = true);
1534 1538
1535 // 32-bit immediate values 1539 // 32-bit immediate values
1536 void move_32_bit_immediate(Condition cond, 1540 void move_32_bit_immediate(Condition cond,
1537 Register rd, 1541 Register rd,
1538 SBit s, 1542 SBit s,
1539 const Operand& x); 1543 const Operand& x);
1540 1544
1541 // Instruction generation 1545 // Instruction generation
1542 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); 1546 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x);
1543 void addrmod2(Instr instr, Register rd, const MemOperand& x); 1547 void addrmod2(Instr instr, Register rd, const MemOperand& x);
1544 void addrmod3(Instr instr, Register rd, const MemOperand& x); 1548 void addrmod3(Instr instr, Register rd, const MemOperand& x);
1545 void addrmod4(Instr instr, Register rn, RegList rl); 1549 void addrmod4(Instr instr, Register rn, RegList rl);
1546 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); 1550 void addrmod5(Instr instr, CRegister crd, const MemOperand& x);
1547 1551
1552 Instr16 thumb16_mode1(ThumbMode1Opcode16 op); // A6.2.1 -> mode1
rmcilroy_google 2013/09/17 17:28:16 ditto with thumb16->thumb2 here and below. Also, a
1553 Instr16 thumb16_mode2(ThumbMode2Opcode16 op); // A6.2.2 -> mode2
1554 Instr16 thumb16_mode3(ThumbMode3Opcode16 op); // A6.2.3 -> mode3
1555
1556 // A6.2.4 -> mode4, opA 0101 -> _1
1557 Instr16 thumb16_mode4_1(ThumbMode4_1Opcode16 opB);
1558 // A6.2.4 -> mode4, opA 0110 -> _2
1559 Instr16 thumb16_mode4_2(ThumbMode4_2Opcode16 opB);
1560 // A6.2.4 -> mode4, opA 0111 -> _3
1561 Instr16 thumb16_mode4_3(ThumbMode4_3Opcode16 opB);
1562 // A6.2.4 -> mode4, opA 1000 -> _4
1563 Instr16 thumb16_mode4_4(ThumbMode4_4Opcode16 opB);
1564 // A6.2.4 -> mode4, opA 1001 -> _5
1565 Instr16 thumb16_mode4_5(ThumbMode4_5Opcode16 opB);
1566
1567 Instr16 thumb16_2lowreg_encoding(Register rd,
1568 const Operand& x);
1569 Instr16 thumb16_2lowreg_encoding(Register rd,
1570 Register rs);
1571 Instr16 thumb16_2lowreg_imm3_encoding(Register rd,
1572 Register rn,
1573 const Operand& x);
1574 Instr16 thumb16_2lowreg_imm5_encoding(Register rd,
1575 Register rn,
1576 uint32_t offset);
1577 Instr16 thumb16_2lowreg_imm5_encoding(Register rd,
1578 Register rn,
1579 const Operand& x);
1580 Instr16 thumb16_3lowreg_encoding(Register rd,
1581 Register rn,
1582 const Operand& x);
1583 Instr16 thumb16_3lowreg_encoding(Register rd,
1584 const MemOperand& x);
1585 Instr16 thumb16_anyreg_encoding(const Operand& x);
1586 Instr16 thumb16_anyreg_encoding(Register rm);
1587 Instr16 thumb16_2anyreg_encoding(Register rd, const Operand& x);
1588 Instr16 thumb16_lowreg_imm8_encoding(Register rd, const Operand& x);
1589 Instr16 thumb16_lowreg_imm8_encoding(Register rd, uint32_t offset);
1590 static Instr16 thumb16_instr_at(Address addr);
1591 void thumb16_instr_at_put(int pos, Instr16 instr);
1592 bool fits_thumb16_mode_4(Register reg, const MemOperand& op);
1593 bool fits_thumb16_mode_4_1(Register reg, const MemOperand& op);
1594 bool fits_thumb16_mode_4_5(Register reg, const MemOperand& op);
1595
1596 bool is_low_reg(Register reg);
1597 bool are_low_reg(Register reg1, Register reg2);
1598
1548 // Labels 1599 // Labels
1549 void print(Label* L); 1600 void print(Label* L);
1550 void bind_to(Label* L, int pos); 1601 void bind_to(Label* L, int pos);
1551 void next(Label* L); 1602 void next(Label* L);
1552 1603
1553 enum UseConstantPoolMode { 1604 enum UseConstantPoolMode {
1554 USE_CONSTANT_POOL, 1605 USE_CONSTANT_POOL,
1555 DONT_USE_CONSTANT_POOL 1606 DONT_USE_CONSTANT_POOL
1556 }; 1607 };
1557 1608
(...skipping 17 matching lines...) Expand all
1575 public: 1626 public:
1576 explicit EnsureSpace(Assembler* assembler) { 1627 explicit EnsureSpace(Assembler* assembler) {
1577 assembler->CheckBuffer(); 1628 assembler->CheckBuffer();
1578 } 1629 }
1579 }; 1630 };
1580 1631
1581 1632
1582 } } // namespace v8::internal 1633 } } // namespace v8::internal
1583 1634
1584 #endif // V8_ARM_ASSEMBLER_ARM_H_ 1635 #endif // V8_ARM_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/assembler-arm-inl.h » ('j') | src/arm/assembler-arm-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698