chromium/v8/src/torque/instructions.h

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_TORQUE_INSTRUCTIONS_H_
#define V8_TORQUE_INSTRUCTIONS_H_

#include <memory>
#include <optional>

#include "src/torque/ast.h"
#include "src/torque/source-positions.h"
#include "src/torque/types.h"
#include "src/torque/utils.h"

namespace v8::internal::torque {

class Block;
class Builtin;
class ControlFlowGraph;
class Intrinsic;
class Macro;
class NamespaceConstant;
class RuntimeFunction;

// Instructions where all backends generate code the same way.
#define TORQUE_BACKEND_AGNOSTIC_INSTRUCTION_LIST(V)

// Instructions where different backends may generate different code.
#define TORQUE_BACKEND_DEPENDENT_INSTRUCTION_LIST(V)

#define TORQUE_INSTRUCTION_LIST(V)

#define TORQUE_INSTRUCTION_BOILERPLATE()

enum class InstructionKind {};

struct InstructionBase;

class DefinitionLocation {};

inline std::ostream& operator<<(std::ostream& stream,
                                const DefinitionLocation& loc) {}

struct InstructionBase {};

class Instruction {};

struct PeekInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const PeekInstruction& instruction) {}

struct PokeInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const PokeInstruction& instruction) {}

// Preserve the top {preserved_slots} number of slots, and delete
// {deleted_slots} number or slots below.
struct DeleteRangeInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const DeleteRangeInstruction& instruction) {}

struct PushUninitializedInstruction : InstructionBase {};

inline std::ostream& operator<<(
    std::ostream& os, const PushUninitializedInstruction& instruction) {}

struct PushBuiltinPointerInstruction : InstructionBase {};

inline std::ostream& operator<<(
    std::ostream& os, const PushBuiltinPointerInstruction& instruction) {}

struct NamespaceConstantInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const NamespaceConstantInstruction& instruction);

struct LoadReferenceInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const LoadReferenceInstruction& instruction) {}

struct StoreReferenceInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const StoreReferenceInstruction& instruction) {}

// Pops a bitfield struct; pushes a bitfield value extracted from it.
struct LoadBitFieldInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const LoadBitFieldInstruction& instruction) {}

// Pops a bitfield value and a bitfield struct; pushes a new bitfield struct
// containing the updated value.
struct StoreBitFieldInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const StoreBitFieldInstruction& instruction) {}

struct CallIntrinsicInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const CallIntrinsicInstruction& instruction);

struct CallCsaMacroInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const CallCsaMacroInstruction& instruction);

struct CallCsaMacroAndBranchInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const CallCsaMacroAndBranchInstruction& instruction);

struct MakeLazyNodeInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const MakeLazyNodeInstruction& instruction);

struct CallBuiltinInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const CallBuiltinInstruction& instruction);

struct CallBuiltinPointerInstruction : InstructionBase {};

inline std::ostream& operator<<(
    std::ostream& os, const CallBuiltinPointerInstruction& instruction) {}

struct CallRuntimeInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const CallRuntimeInstruction& instruction);

struct BranchInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const BranchInstruction& instruction);

struct ConstexprBranchInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os,
                         const ConstexprBranchInstruction& instruction);

struct GotoInstruction : InstructionBase {};

std::ostream& operator<<(std::ostream& os, const GotoInstruction& instruction);

struct GotoExternalInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const GotoExternalInstruction& instruction) {}

struct ReturnInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const ReturnInstruction& instruction) {}

struct PrintErrorInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const PrintErrorInstruction& instruction) {}

struct AbortInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const AbortInstruction& instruction) {}

struct UnsafeCastInstruction : InstructionBase {};

inline std::ostream& operator<<(std::ostream& os,
                                const UnsafeCastInstruction& instruction) {}

}  // namespace v8::internal::torque

#endif  // V8_TORQUE_INSTRUCTIONS_H_