Commit f2ef73d2 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[assembler][x64] Reduce number of templates

Many instructions are declared using DECLARE_INSTRUCTION (via
ASSEMBLER_INSTRUCTION_LIST), and each of them currently defined eight
templates for different sizes and different number of arguments.
This CL reduces this to three variadic templates per instruction.

R=zhin@chromium.org

Bug: v8:12244
Change-Id: Ibd75c55e757f917eb1e9b54c0a1a79632a1ba6d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3181103Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77057}
parent 156b2409
......@@ -508,45 +508,20 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// - Instructions on 64-bit (quadword) operands/registers use 'q'.
// - Instructions on operands/registers with pointer size use 'p'.
#define DECLARE_INSTRUCTION(instruction) \
template <class P1> \
void instruction##_tagged(P1 p1) { \
emit_##instruction(p1, kTaggedSize); \
} \
\
template <class P1> \
void instruction##l(P1 p1) { \
emit_##instruction(p1, kInt32Size); \
} \
\
template <class P1> \
void instruction##q(P1 p1) { \
emit_##instruction(p1, kInt64Size); \
} \
\
template <class P1, class P2> \
void instruction##_tagged(P1 p1, P2 p2) { \
emit_##instruction(p1, p2, kTaggedSize); \
} \
\
template <class P1, class P2> \
void instruction##l(P1 p1, P2 p2) { \
emit_##instruction(p1, p2, kInt32Size); \
} \
\
template <class P1, class P2> \
void instruction##q(P1 p1, P2 p2) { \
emit_##instruction(p1, p2, kInt64Size); \
} \
\
template <class P1, class P2, class P3> \
void instruction##l(P1 p1, P2 p2, P3 p3) { \
emit_##instruction(p1, p2, p3, kInt32Size); \
} \
\
template <class P1, class P2, class P3> \
void instruction##q(P1 p1, P2 p2, P3 p3) { \
emit_##instruction(p1, p2, p3, kInt64Size); \
#define DECLARE_INSTRUCTION(instruction) \
template <typename... Ps> \
void instruction##_tagged(Ps... ps) { \
emit_##instruction(ps..., kTaggedSize); \
} \
\
template <typename... Ps> \
void instruction##l(Ps... ps) { \
emit_##instruction(ps..., kInt32Size); \
} \
\
template <typename... Ps> \
void instruction##q(Ps... ps) { \
emit_##instruction(ps..., kInt64Size); \
}
ASSEMBLER_INSTRUCTION_LIST(DECLARE_INSTRUCTION)
#undef DECLARE_INSTRUCTION
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment