v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
csa-generator.h
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_TORQUE_CSA_GENERATOR_H_
6#define V8_TORQUE_CSA_GENERATOR_H_
7
8#include <optional>
9
11
12namespace v8::internal::torque {
13
15 public:
16 CSAGenerator(const ControlFlowGraph& cfg, std::ostream& out,
17 std::optional<Builtin::Kind> linkage = std::nullopt)
18 : TorqueCodeGenerator(cfg, out), linkage_(linkage) {}
19 std::optional<Stack<std::string>> EmitGraph(Stack<std::string> parameters);
20
21 static constexpr const char* ARGUMENTS_VARIABLE_STRING = "arguments";
22
23 static void EmitCSAValue(VisitResult result, const Stack<std::string>& values,
24 std::ostream& out);
25
26 private:
27 std::optional<Builtin::Kind> linkage_;
28
30 bool always_emit = false) override;
31
33 std::optional<Block*> catch_block);
35 const std::string& catch_name, const Type* return_type,
36 std::optional<Block*> catch_block, Stack<std::string>* stack,
37 const std::optional<DefinitionLocation>& exception_object_definition);
38
39 std::vector<std::string> ProcessArgumentsCommon(
40 const TypeVector& parameter_types,
41 std::vector<std::string> constexpr_arguments, Stack<std::string>* stack);
42
44#define EMIT_INSTRUCTION_DECLARATION(T) \
45 void EmitInstruction(const T& instruction, Stack<std::string>* stack) \
46 override;
48#undef EMIT_INSTRUCTION_DECLARATION
49};
50
51} // namespace v8::internal::torque
52
53#endif // V8_TORQUE_CSA_GENERATOR_H_
#define EMIT_INSTRUCTION_DECLARATION(T)
SourcePosition pos
std::optional< Stack< std::string > > EmitGraph(Stack< std::string > parameters)
std::optional< Builtin::Kind > linkage_
std::vector< std::string > ProcessArgumentsCommon(const TypeVector &parameter_types, std::vector< std::string > constexpr_arguments, Stack< std::string > *stack)
void PostCallableExceptionPreparation(const std::string &catch_name, const Type *return_type, std::optional< Block * > catch_block, Stack< std::string > *stack, const std::optional< DefinitionLocation > &exception_object_definition)
static constexpr const char * ARGUMENTS_VARIABLE_STRING
Stack< std::string > EmitBlock(const Block *block)
CSAGenerator(const ControlFlowGraph &cfg, std::ostream &out, std::optional< Builtin::Kind > linkage=std::nullopt)
static void EmitCSAValue(VisitResult result, const Stack< std::string > &values, std::ostream &out)
std::string PreCallableExceptionPreparation(std::optional< Block * > catch_block)
void EmitSourcePosition(SourcePosition pos, bool always_emit=false) override
Linkage * linkage
#define TORQUE_BACKEND_DEPENDENT_INSTRUCTION_LIST(V)
ZoneVector< RpoNumber > & result
std::vector< const Type * > TypeVector
Definition types.h:85