• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 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_CC_GENERATOR_H_
6 #define V8_TORQUE_CC_GENERATOR_H_
7 
8 #include "src/torque/torque-code-generator.h"
9 
10 namespace v8 {
11 namespace internal {
12 namespace torque {
13 
14 class CCGenerator : public TorqueCodeGenerator {
15  public:
16   CCGenerator(const ControlFlowGraph& cfg, std::ostream& out,
17               bool is_cc_debug = false)
TorqueCodeGenerator(cfg,out)18       : TorqueCodeGenerator(cfg, out), is_cc_debug_(is_cc_debug) {}
19   base::Optional<Stack<std::string>> EmitGraph(Stack<std::string> parameters);
20 
21   static void EmitCCValue(VisitResult result, const Stack<std::string>& values,
22                           std::ostream& out);
23 
24  private:
25   bool is_cc_debug_;
26 
27   void EmitSourcePosition(SourcePosition pos,
28                           bool always_emit = false) override;
29 
30   void EmitGoto(const Block* destination, Stack<std::string>* stack,
31                 std::string indentation);
32 
33   std::vector<std::string> ProcessArgumentsCommon(
34       const TypeVector& parameter_types,
35       std::vector<std::string> constexpr_arguments, Stack<std::string>* stack);
36 
37   Stack<std::string> EmitBlock(const Block* block);
38 #define EMIT_INSTRUCTION_DECLARATION(T)                                 \
39   void EmitInstruction(const T& instruction, Stack<std::string>* stack) \
40       override;
41   TORQUE_BACKEND_DEPENDENT_INSTRUCTION_LIST(EMIT_INSTRUCTION_DECLARATION)
42 #undef EMIT_INSTRUCTION_DECLARATION
43 };
44 
45 }  // namespace torque
46 }  // namespace internal
47 }  // namespace v8
48 
49 #endif  // V8_TORQUE_CC_GENERATOR_H_
50