diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2022-03-09 09:03:48 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-09 22:31:34 +0000 |
commit | 6c18c4497a6e4a387d9e546a1c9ae7d54eab7342 (patch) | |
tree | 169660079bad4cc34f5f052df1b318144b6737a9 | |
parent | 108eb261f8fdc639069d2388650a2786a5a775a5 (diff) |
masm: Fix whitespaces in x86Assembler.h
Change-Id: I7a64585cc47c5dd3b1bb2139246bd98eea6335b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ada4580b69b22d21ac3c457af45ba87dc81a0aa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/3rdparty/masm/assembler/X86Assembler.h | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/src/3rdparty/masm/assembler/X86Assembler.h b/src/3rdparty/masm/assembler/X86Assembler.h index 1061021227..c6705f3265 100644 --- a/src/3rdparty/masm/assembler/X86Assembler.h +++ b/src/3rdparty/masm/assembler/X86Assembler.h @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef X86Assembler_h @@ -164,7 +164,7 @@ private: OP_HLT = 0xF4, OP_GROUP3_EbIb = 0xF6, OP_GROUP3_Ev = 0xF7, - OP_GROUP3_EvIz = 0xF7, // OP_GROUP3_Ev has an immediate, when instruction is a test. + OP_GROUP3_EvIz = 0xF7, // OP_GROUP3_Ev has an immediate, when instruction is a test. OP_GROUP5_Ev = 0xFF, } OneByteOpcodeID; @@ -220,12 +220,12 @@ private: GROUP1_OP_CMP = 7, GROUP1A_OP_POP = 0, - + GROUP2_OP_ROL = 0, GROUP2_OP_ROR = 1, GROUP2_OP_RCL = 2, GROUP2_OP_RCR = 3, - + GROUP2_OP_SHL = 4, GROUP2_OP_SHR = 5, GROUP2_OP_SAR = 7, @@ -246,7 +246,7 @@ private: ESCAPE_DD_FSTP_doubleReal = 3, } GroupOpcodeID; - + class X86InstructionFormatter; public: @@ -308,7 +308,7 @@ public: { m_formatter.oneByteOp(OP_ADD_GvEv, dst, base, offset); } - + #if !CPU(X86_64) void addl_mr(const void* addr, RegisterID dst) { @@ -577,7 +577,7 @@ public: m_formatter.immediate32(imm); } } - + void subl_im(int imm, int offset, RegisterID base) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -671,12 +671,12 @@ public: m_formatter.immediate32(imm); } } - + void xorq_rm(RegisterID src, int offset, RegisterID base) { m_formatter.oneByteOp64(OP_XOR_EvGv, src, base, offset); } - + void rorq_i8r(int imm, RegisterID dst) { if (imm == 1) @@ -749,7 +749,7 @@ public: { m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SAR, dst); } - + void shrl_i8r(int imm, RegisterID dst) { if (imm == 1) @@ -759,7 +759,7 @@ public: m_formatter.immediate8(imm); } } - + void shrl_CLr(RegisterID dst) { m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SHR, dst); @@ -834,7 +834,7 @@ public: m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, dst); m_formatter.immediate32(imm); } - + void cmpl_im(int imm, int offset, RegisterID base) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -845,19 +845,19 @@ public: m_formatter.immediate32(imm); } } - + void cmpb_im(int imm, int offset, RegisterID base) { m_formatter.oneByteOp(OP_GROUP1_EbIb, GROUP1_OP_CMP, base, offset); m_formatter.immediate8(imm); } - + void cmpb_im(int imm, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.oneByteOp(OP_GROUP1_EbIb, GROUP1_OP_CMP, base, index, scale, offset); m_formatter.immediate8(imm); } - + #if CPU(X86) void cmpb_im(int imm, const void* addr) { @@ -985,7 +985,7 @@ public: { m_formatter.oneByteOp(OP_TEST_EvGv, src, dst); } - + void testl_i32r(int imm, RegisterID dst) { m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, dst); @@ -1008,7 +1008,7 @@ public: m_formatter.oneByteOp(OP_GROUP3_EbIb, GROUP3_OP_TEST, base, offset); m_formatter.immediate8(imm); } - + void testb_im(int imm, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.oneByteOp(OP_GROUP3_EbIb, GROUP3_OP_TEST, base, index, scale, offset); @@ -1057,14 +1057,14 @@ public: m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, index, scale, offset); m_formatter.immediate32(imm); } -#endif +#endif void testw_rr(RegisterID src, RegisterID dst) { m_formatter.prefix(PRE_OPERAND_SIZE); m_formatter.oneByteOp(OP_TEST_EvGv, src, dst); } - + void testb_i8r(int imm, RegisterID dst) { m_formatter.oneByteOp8(OP_GROUP3_EbIb, GROUP3_OP_TEST, dst); @@ -1124,7 +1124,7 @@ public: { m_formatter.oneByteOp(OP_MOV_EvGv, src, dst); } - + void movl_rm(RegisterID src, int offset, RegisterID base) { m_formatter.oneByteOp(OP_MOV_EvGv, src, base, offset); @@ -1139,7 +1139,7 @@ public: { m_formatter.oneByteOp(OP_MOV_EvGv, src, base, index, scale, offset); } - + void movl_mEAX(const void* addr) { m_formatter.oneByteOp(OP_MOV_EAXOv); @@ -1159,7 +1159,7 @@ public: { m_formatter.oneByteOp_disp32(OP_MOV_GvEv, dst, base, offset); } - + void movl_mr_disp8(int offset, RegisterID base, RegisterID dst) { m_formatter.oneByteOp_disp8(OP_MOV_GvEv, dst, base, offset); @@ -1181,7 +1181,7 @@ public: m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, base, offset); m_formatter.immediate32(imm); } - + void movl_i32m(int imm, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, base, index, scale, offset); @@ -1210,12 +1210,12 @@ public: m_formatter.oneByteOp(OP_GROUP11_EvIb, GROUP11_MOV, base, index, scale, offset); m_formatter.immediate8(imm); } - + void movb_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.oneByteOp8(OP_MOV_EbGb, src, base, index, scale, offset); } - + void movw_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.prefix(PRE_OPERAND_SIZE); @@ -1296,22 +1296,22 @@ public: m_formatter.oneByteOp64(OP_MOV_EAXIv, dst); m_formatter.immediate64(imm); } - + void movsxd_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_MOVSXD_GvEv, dst, src); } - - + + #else void movl_rm(RegisterID src, const void* addr) { if (src == X86Registers::eax) movl_EAXm(addr); - else + else m_formatter.oneByteOp(OP_MOV_EvGv, src, addr); } - + void movl_mr(const void* addr, RegisterID dst) { if (dst == X86Registers::eax) @@ -1351,7 +1351,7 @@ public: { m_formatter.twoByteOp(OP2_MOVZX_GvEb, dst, base, offset); } - + void movzbl_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst) { m_formatter.twoByteOp(OP2_MOVZX_GvEb, dst, base, index, scale, offset); @@ -1361,7 +1361,7 @@ public: { m_formatter.twoByteOp(OP2_MOVSX_GvEb, dst, base, offset); } - + void movsbl_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst) { m_formatter.twoByteOp(OP2_MOVSX_GvEb, dst, base, index, scale, offset); @@ -1404,13 +1404,13 @@ public: m_formatter.oneByteOp(OP_CALL_rel32); return m_formatter.immediateRel32(); } - + AssemblerLabel call(RegisterID dst) { m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_CALLN, dst); return m_formatter.label(); } - + void call_m(int offset, RegisterID base) { m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_CALLN, base, offset); @@ -1421,7 +1421,7 @@ public: m_formatter.oneByteOp(OP_JMP_rel32); return m_formatter.immediateRel32(); } - + // Return a AssemblerLabel so we have a label to the jump, so we can use this // To make a tail recursive call on x86-64. The MacroAssembler // really shouldn't wrap this as a Jump, since it can't be linked. :-/ @@ -1430,12 +1430,12 @@ public: m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_JMPN, dst); return m_formatter.label(); } - + void jmp_m(int offset, RegisterID base) { m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_JMPN, base, offset); } - + #if !CPU(X86_64) void jmp_m(const void* address) { @@ -1448,7 +1448,7 @@ public: m_formatter.twoByteOp(jccRel32(ConditionNE)); return m_formatter.immediateRel32(); } - + AssemblerLabel jnz() { return jne(); @@ -1459,7 +1459,7 @@ public: m_formatter.twoByteOp(jccRel32(ConditionE)); return m_formatter.immediateRel32(); } - + AssemblerLabel jz() { return je(); @@ -1470,25 +1470,25 @@ public: m_formatter.twoByteOp(jccRel32(ConditionL)); return m_formatter.immediateRel32(); } - + AssemblerLabel jb() { m_formatter.twoByteOp(jccRel32(ConditionB)); return m_formatter.immediateRel32(); } - + AssemblerLabel jle() { m_formatter.twoByteOp(jccRel32(ConditionLE)); return m_formatter.immediateRel32(); } - + AssemblerLabel jbe() { m_formatter.twoByteOp(jccRel32(ConditionBE)); return m_formatter.immediateRel32(); } - + AssemblerLabel jge() { m_formatter.twoByteOp(jccRel32(ConditionGE)); @@ -1506,13 +1506,13 @@ public: m_formatter.twoByteOp(jccRel32(ConditionA)); return m_formatter.immediateRel32(); } - + AssemblerLabel jae() { m_formatter.twoByteOp(jccRel32(ConditionAE)); return m_formatter.immediateRel32(); } - + AssemblerLabel jo() { m_formatter.twoByteOp(jccRel32(ConditionO)); @@ -1530,7 +1530,7 @@ public: m_formatter.twoByteOp(jccRel32(ConditionP)); return m_formatter.immediateRel32(); } - + AssemblerLabel js() { m_formatter.twoByteOp(jccRel32(ConditionS)); @@ -1611,7 +1611,7 @@ public: m_formatter.prefix(PRE_SSE_F3); m_formatter.twoByteOp(OP2_CVTSS2SD_VsdWsd, dst, (RegisterID)src); } - + #if CPU(X86_64) void cvttsd2siq_rr(XMMRegisterID src, RegisterID dst) { @@ -1657,19 +1657,19 @@ public: m_formatter.prefix(PRE_SSE_F2); m_formatter.twoByteOp(OP2_MOVSD_WsdVsd, (RegisterID)src, base, offset); } - + void movsd_rm(XMMRegisterID src, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.prefix(PRE_SSE_F2); m_formatter.twoByteOp(OP2_MOVSD_WsdVsd, (RegisterID)src, base, index, scale, offset); } - + void movss_rm(XMMRegisterID src, int offset, RegisterID base, RegisterID index, int scale) { m_formatter.prefix(PRE_SSE_F3); m_formatter.twoByteOp(OP2_MOVSD_WsdVsd, (RegisterID)src, base, index, scale, offset); } - + void movsd_mr(int offset, RegisterID base, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1681,7 +1681,7 @@ public: m_formatter.prefix(PRE_SSE_F2); m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, dst, base, index, scale, offset); } - + void movss_mr(int offset, RegisterID base, RegisterID index, int scale, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F3); @@ -1800,7 +1800,7 @@ public: { m_formatter.oneByteOp(OP_INT3); } - + void ret() { m_formatter.oneByteOp(OP_RET); @@ -1817,7 +1817,7 @@ public: { return m_formatter.codeSize(); } - + AssemblerLabel labelForWatchpoint() { AssemblerLabel result = m_formatter.label(); @@ -1827,7 +1827,7 @@ public: m_indexOfTailOfLastWatchpoint = result.m_offset + maxJumpReplacementSize(); return result; } - + AssemblerLabel labelIgnoringWatchpoints() { return m_formatter.label(); @@ -1877,7 +1877,7 @@ public: memcpy(&val, t_ptr, sizeof(T)); return val; } - + static void linkJump(void* code, AssemblerLabel from, void* to) { ASSERT(from.isSet()); @@ -1903,12 +1903,12 @@ public: { setRel32(from, to); } - + static void relinkCall(void* from, void* to) { setRel32(from, to); } - + static void repatchCompact(void* where, int32_t value) { ASSERT(value >= std::numeric_limits<int8_t>::min()); @@ -1925,7 +1925,7 @@ public: { setPointer(where, value); } - + static void* readPointer(void* where) { return reinterpret_cast<void**>(where)[-1]; @@ -1939,12 +1939,12 @@ public: ptr[0] = static_cast<uint8_t>(OP_JMP_rel32); *reinterpret_cast<int32_t*>(ptr + 1) = static_cast<int32_t>(distance); } - + static ptrdiff_t maxJumpReplacementSize() { return 5; } - + #if CPU(X86_64) static void revertJumpTo_movq_i64r(void* instructionStart, int64_t imm, RegisterID dst) { @@ -1954,7 +1954,7 @@ public: uint8_t* ptr = reinterpret_cast<uint8_t*>(instructionStart); ptr[0] = PRE_REX | (1 << 3) | (dst >> 3); ptr[1] = OP_MOV_EAXIv | (dst & 7); - + union { uint64_t asWord; uint8_t asBytes[8]; @@ -1964,7 +1964,7 @@ public: ptr[i] = u.asBytes[i - rexBytes - opcodeBytes]; } #endif - + static void revertJumpTo_cmpl_ir_force32(void* instructionStart, int32_t imm, RegisterID dst) { const int opcodeBytes = 1; @@ -1981,7 +1981,7 @@ public: for (unsigned i = opcodeBytes + modRMBytes; i < static_cast<unsigned>(maxJumpReplacementSize()); ++i) ptr[i] = u.asBytes[i - opcodeBytes - modRMBytes]; } - + static void revertJumpTo_cmpl_im_force32(void* instructionStart, int32_t imm, int offset, RegisterID dst) { ASSERT_UNUSED(offset, !offset); @@ -1999,7 +1999,7 @@ public: for (unsigned i = opcodeBytes + modRMBytes; i < static_cast<unsigned>(maxJumpReplacementSize()); ++i) ptr[i] = u.asBytes[i - opcodeBytes - modRMBytes]; } - + static void replaceWithLoad(void* instructionStart) { uint8_t* ptr = reinterpret_cast<uint8_t*>(instructionStart); @@ -2017,7 +2017,7 @@ public: RELEASE_ASSERT_NOT_REACHED(); } } - + static void replaceWithAddressComputation(void* instructionStart) { uint8_t* ptr = reinterpret_cast<uint8_t*>(instructionStart); @@ -2035,7 +2035,7 @@ public: RELEASE_ASSERT_NOT_REACHED(); } } - + static unsigned getCallReturnOffset(AssemblerLabel call) { ASSERT(call.isSet()); @@ -2047,12 +2047,12 @@ public: ASSERT(label.isSet()); return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + label.m_offset); } - + static int getDifferenceBetweenLabels(AssemblerLabel a, AssemblerLabel b) { return b.m_offset - a.m_offset; } - + PassRefPtr<ExecutableMemoryHandle> executableCopy(JSGlobalData& globalData, void* ownerUID, JITCompilationEffort effort) { return m_formatter.executableCopy(globalData, ownerUID, effort); @@ -2086,7 +2086,7 @@ private: T *ptr = &reinterpret_cast<T*>(where)[idx]; memcpy(ptr, &value, sizeof(T)); } - + static void setInt8(void* where, int8_t value) { reinterpret_cast<int8_t*>(where)[-1] = value; @@ -2172,7 +2172,7 @@ private: m_buffer.putByteUnchecked(opcode); memoryModRM_disp32(reg, base, offset); } - + void oneByteOp_disp8(OneByteOpcodeID opcode, int reg, RegisterID base, int offset) { m_buffer.ensureSpace(maxInstructionSize); @@ -2286,7 +2286,7 @@ private: m_buffer.putByteUnchecked(opcode); memoryModRM_disp32(reg, base, offset); } - + void oneByteOp64_disp8(OneByteOpcodeID opcode, int reg, RegisterID base, int offset) { m_buffer.ensureSpace(maxInstructionSize); @@ -2567,7 +2567,7 @@ private: m_buffer.putIntUnchecked(offset); } } - + void memoryModRM(int reg, RegisterID base, RegisterID index, int scale, int offset) { ASSERT(index != noIndex); |