#include "src/compiler/backend/instruction.h"
#include <cstddef>
#include <iomanip>
#include "src/base/iterator.h"
#include "src/codegen/aligned-slot-allocator.h"
#include "src/codegen/interface-descriptors.h"
#include "src/codegen/machine-type.h"
#include "src/codegen/register-configuration.h"
#include "src/codegen/source-position.h"
#include "src/compiler/backend/instruction-codes.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/frame-states.h"
#include "src/compiler/graph.h"
#include "src/compiler/node.h"
#include "src/compiler/schedule.h"
#include "src/compiler/turboshaft/graph.h"
#include "src/compiler/turboshaft/loop-finder.h"
#include "src/compiler/turboshaft/operations.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/execution/frames.h"
#include "src/execution/isolate-utils-inl.h"
#include "src/objects/instance-type-inl.h"
#include "src/utils/ostreams.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/value-type.h"
#endif
namespace v8 {
namespace internal {
namespace compiler {
const RegisterConfiguration* (*GetRegConfig)() = …;
FlagsCondition CommuteFlagsCondition(FlagsCondition condition) { … }
bool InstructionOperand::InterferesWith(const InstructionOperand& other) const { … }
bool LocationOperand::IsCompatible(LocationOperand* op) { … }
void InstructionOperand::Print() const { … }
std::ostream& operator<<(std::ostream& os, const InstructionOperand& op) { … }
void MoveOperands::Print() const { … }
std::ostream& operator<<(std::ostream& os, const MoveOperands& mo) { … }
bool ParallelMove::IsRedundant() const { … }
void ParallelMove::PrepareInsertAfter(
MoveOperands* move, ZoneVector<MoveOperands*>* to_eliminate) const { … }
bool ParallelMove::Equals(const ParallelMove& that) const { … }
void ParallelMove::Eliminate() { … }
Instruction::Instruction(InstructionCode opcode)
: … { … }
Instruction::Instruction(InstructionCode opcode, size_t output_count,
InstructionOperand* outputs, size_t input_count,
InstructionOperand* inputs, size_t temp_count,
InstructionOperand* temps)
: … { … }
bool Instruction::AreMovesRedundant() const { … }
void Instruction::Print() const { … }
std::ostream& operator<<(std::ostream& os, const ParallelMove& pm) { … }
void ReferenceMap::RecordReference(const AllocatedOperand& op) { … }
std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) { … }
std::ostream& operator<<(std::ostream& os, const ArchOpcode& ao) { … }
std::ostream& operator<<(std::ostream& os, const AddressingMode& am) { … }
std::ostream& operator<<(std::ostream& os, const FlagsMode& fm) { … }
std::ostream& operator<<(std::ostream& os, const FlagsCondition& fc) { … }
std::ostream& operator<<(std::ostream& os, const Instruction& instr) { … }
Constant::Constant(int32_t v) : … { … }
Constant::Constant(RelocatablePtrConstantInfo info) { … }
Handle<HeapObject> Constant::ToHeapObject() const { … }
Handle<Code> Constant::ToCode() const { … }
std::ostream& operator<<(std::ostream& os, const Constant& constant) { … }
PhiInstruction::PhiInstruction(Zone* zone, int virtual_register,
size_t input_count)
: … { … }
void PhiInstruction::SetInput(size_t offset, int virtual_register) { … }
void PhiInstruction::RenameInput(size_t offset, int virtual_register) { … }
InstructionBlock::InstructionBlock(Zone* zone, RpoNumber rpo_number,
RpoNumber loop_header, RpoNumber loop_end,
RpoNumber dominator, bool deferred,
bool handler)
: … { … }
size_t InstructionBlock::PredecessorIndexOf(RpoNumber rpo_number) const { … }
static RpoNumber GetRpo(const BasicBlock* block) { … }
static RpoNumber GetRpo(const turboshaft::Block* block) { … }
static RpoNumber GetLoopEndRpo(const BasicBlock* block) { … }
static RpoNumber GetLoopEndRpo(const turboshaft::Block* block) { … }
static InstructionBlock* InstructionBlockFor(Zone* zone,
const BasicBlock* block) { … }
static InstructionBlock* InstructionBlockFor(
Zone* zone, const turboshaft::Graph& graph, const turboshaft::Block* block,
const turboshaft::Block* loop_header) { … }
std::ostream& operator<<(std::ostream& os,
const PrintableInstructionBlock& printable_block) { … }
InstructionBlocks* InstructionSequence::InstructionBlocksFor(
Zone* zone, const Schedule* schedule) { … }
InstructionBlocks* InstructionSequence::InstructionBlocksFor(
Zone* zone, const turboshaft::Graph& graph) { … }
void InstructionSequence::ValidateEdgeSplitForm() const { … }
void InstructionSequence::ValidateDeferredBlockExitPaths() const { … }
void InstructionSequence::ValidateDeferredBlockEntryPaths() const { … }
void InstructionSequence::ValidateSSA() const { … }
void InstructionSequence::ComputeAssemblyOrder() { … }
void InstructionSequence::RecomputeAssemblyOrderForTesting() { … }
InstructionSequence::InstructionSequence(Isolate* isolate,
Zone* instruction_zone,
InstructionBlocks* instruction_blocks)
: … { … }
int InstructionSequence::NextVirtualRegister() { … }
Instruction* InstructionSequence::GetBlockStart(RpoNumber rpo) const { … }
void InstructionSequence::StartBlock(RpoNumber rpo) { … }
void InstructionSequence::EndBlock(RpoNumber rpo) { … }
int InstructionSequence::AddInstruction(Instruction* instr) { … }
static MachineRepresentation FilterRepresentation(MachineRepresentation rep) { … }
MachineRepresentation InstructionSequence::GetRepresentation(
int virtual_register) const { … }
void InstructionSequence::MarkAsRepresentation(MachineRepresentation rep,
int virtual_register) { … }
int InstructionSequence::AddDeoptimizationEntry(
FrameStateDescriptor* descriptor, DeoptimizeKind kind,
DeoptimizeReason reason, NodeId node_id, FeedbackSource const& feedback) { … }
DeoptimizationEntry const& InstructionSequence::GetDeoptimizationEntry(
int state_id) { … }
RpoNumber InstructionSequence::InputRpo(Instruction* instr, size_t index) { … }
bool InstructionSequence::GetSourcePosition(const Instruction* instr,
SourcePosition* result) const { … }
void InstructionSequence::SetSourcePosition(const Instruction* instr,
SourcePosition value) { … }
void InstructionSequence::Print() const { … }
void InstructionSequence::PrintBlock(int block_id) const { … }
const RegisterConfiguration*
InstructionSequence::registerConfigurationForTesting_ = …;
const RegisterConfiguration*
InstructionSequence::RegisterConfigurationForTesting() { … }
void InstructionSequence::SetRegisterConfigurationForTesting(
const RegisterConfiguration* regConfig) { … }
namespace {
size_t GetConservativeFrameSizeInBytes(FrameStateType type,
size_t parameters_count,
size_t locals_count,
BytecodeOffset bailout_id,
uint32_t wasm_liftoff_frame_size) { … }
size_t GetTotalConservativeFrameSizeInBytes(FrameStateType type,
size_t parameters_count,
size_t locals_count,
BytecodeOffset bailout_id,
uint32_t wasm_liftoff_frame_size,
FrameStateDescriptor* outer_state) { … }
}
FrameStateDescriptor::FrameStateDescriptor(
Zone* zone, FrameStateType type, BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine, uint16_t parameters_count,
uint16_t max_arguments, size_t locals_count, size_t stack_count,
MaybeHandle<SharedFunctionInfo> shared_info,
FrameStateDescriptor* outer_state, uint32_t wasm_liftoff_frame_size,
uint32_t wasm_function_index)
: … { … }
size_t FrameStateDescriptor::GetHeight() const { … }
size_t FrameStateDescriptor::GetSize() const { … }
size_t FrameStateDescriptor::GetTotalSize() const { … }
size_t FrameStateDescriptor::GetFrameCount() const { … }
size_t FrameStateDescriptor::GetJSFrameCount() const { … }
#if V8_ENABLE_WEBASSEMBLY
JSToWasmFrameStateDescriptor::JSToWasmFrameStateDescriptor(
Zone* zone, FrameStateType type, BytecodeOffset bailout_id,
OutputFrameStateCombine state_combine, uint16_t parameters_count,
size_t locals_count, size_t stack_count,
MaybeHandle<SharedFunctionInfo> shared_info,
FrameStateDescriptor* outer_state, const wasm::FunctionSig* wasm_signature)
: … { … }
#endif
std::ostream& operator<<(std::ostream& os, const RpoNumber& rpo) { … }
std::ostream& operator<<(std::ostream& os, const InstructionSequence& code) { … }
std::ostream& operator<<(std::ostream& os, StateValueKind kind) { … }
void StateValueDescriptor::Print(std::ostream& os) const { … }
}
}
}