#ifndef V8_COMPILER_BACKEND_INSTRUCTION_CODES_H_
#define V8_COMPILER_BACKEND_INSTRUCTION_CODES_H_
#include <iosfwd>
#if V8_TARGET_ARCH_ARM
#include "src/compiler/backend/arm/instruction-codes-arm.h"
#elif V8_TARGET_ARCH_ARM64
#include "src/compiler/backend/arm64/instruction-codes-arm64.h"
#elif V8_TARGET_ARCH_IA32
#include "src/compiler/backend/ia32/instruction-codes-ia32.h"
#elif V8_TARGET_ARCH_MIPS64
#include "src/compiler/backend/mips64/instruction-codes-mips64.h"
#elif V8_TARGET_ARCH_LOONG64
#include "src/compiler/backend/loong64/instruction-codes-loong64.h"
#elif V8_TARGET_ARCH_X64
#include "src/compiler/backend/x64/instruction-codes-x64.h"
#elif V8_TARGET_ARCH_PPC64
#include "src/compiler/backend/ppc/instruction-codes-ppc.h"
#elif V8_TARGET_ARCH_S390
#include "src/compiler/backend/s390/instruction-codes-s390.h"
#elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
#include "src/compiler/backend/riscv/instruction-codes-riscv.h"
#else
#define TARGET_ARCH_OPCODE_LIST …
#define TARGET_ADDRESSING_MODE_LIST …
#endif
#include "src/base/bit-field.h"
#include "src/codegen/atomic-memory-order.h"
#include "src/compiler/write-barrier-kind.h"
namespace v8 {
namespace internal {
namespace compiler {
enum class RecordWriteMode { … };
inline RecordWriteMode WriteBarrierKindToRecordWriteMode(
WriteBarrierKind write_barrier_kind) { … }
#define COMMON_ARCH_OPCODE_WITH_MEMORY_ACCESS_MODE_LIST(V) …
#define COMMON_ARCH_OPCODE_LIST(V) …
#define ARCH_OPCODE_LIST(V) …
enum ArchOpcode { … };
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const ArchOpcode& ao);
#define ADDRESSING_MODE_LIST(V) …
enum AddressingMode : uint8_t { … };
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const AddressingMode& am);
enum FlagsMode { … };
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const FlagsMode& fm);
enum FlagsCondition : uint8_t { … };
static constexpr FlagsCondition kStackPointerGreaterThanCondition = …;
inline FlagsCondition NegateFlagsCondition(FlagsCondition condition) { … }
FlagsCondition CommuteFlagsCondition(FlagsCondition condition);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const FlagsCondition& fc);
enum MemoryAccessMode { … };
enum class AtomicWidth { … };
inline size_t AtomicWidthSize(AtomicWidth width) { … }
static constexpr int kLazyDeoptOnThrowSentinel = …;
InstructionCode;
using ArchOpcodeField = base::BitField<ArchOpcode, 0, 9>;
static_assert(ArchOpcodeField::is_valid(kLastArchOpcode),
"All opcodes must fit in the 9-bit ArchOpcodeField.");
using AddressingModeField = ArchOpcodeField::Next<AddressingMode, 5>;
static_assert(
AddressingModeField::is_valid(kLastAddressingMode),
"All addressing modes must fit in the 5-bit AddressingModeField.");
using FlagsModeField = AddressingModeField::Next<FlagsMode, 3>;
using FlagsConditionField = FlagsModeField::Next<FlagsCondition, 5>;
using AtomicWidthField = FlagsConditionField::Next<AtomicWidth, 2>;
using AtomicMemoryOrderField = AtomicWidthField::Next<AtomicMemoryOrder, 2>;
using AtomicStoreRecordWriteModeField =
AtomicMemoryOrderField::Next<RecordWriteMode, 4>;
using RecordWriteModeField = FlagsConditionField::Next<RecordWriteMode, 3>;
#ifdef V8_TARGET_ARCH_X64
enum LaneSize { … };
enum VectorLength { … };
using LaneSizeField = FlagsConditionField::Next<LaneSize, 2>;
using VectorLengthField = LaneSizeField::Next<VectorLength, 2>;
#else
using LaneSizeField = FlagsConditionField::Next<int, 8>;
#endif
using AccessModeField =
AtomicStoreRecordWriteModeField::Next<MemoryAccessMode, 2>;
static_assert(AtomicStoreRecordWriteModeField::kLastUsedBit >=
RecordWriteModeField::kLastUsedBit);
#ifdef V8_TARGET_ARCH_X64
static_assert(AtomicStoreRecordWriteModeField::kLastUsedBit >=
VectorLengthField::kLastUsedBit);
#else
static_assert(AtomicStoreRecordWriteModeField::kLastUsedBit >=
LaneSizeField::kLastUsedBit);
#endif
inline bool HasMemoryAccessMode(ArchOpcode opcode) { … }
using DeoptImmedArgsCountField = FlagsConditionField::Next<int, 2>;
using DeoptFrameStateOffsetField = DeoptImmedArgsCountField::Next<int, 8>;
using ParamField = FlagsConditionField::Next<int, 5>;
using FPParamField = ParamField::Next<int, 5>;
using MiscField = FlagsConditionField::Next<int, 10>;
static_assert(ArchOpcodeField::kMax - kLastArchOpcode >= 16,
"We are running close to the number of available opcodes.");
}
}
}
#endif