blob: 64befbfe064ceb078a376b59f3af7b8b7bc6a027 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 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_COMPILER_PIPELINE_H_
6#define V8_COMPILER_PIPELINE_H_
7
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00008// Clients of this interface shouldn't depend on lots of compiler internals.
9// Do not include anything from src/compiler here!
Ben Murdoch097c5b22016-05-18 11:27:45 +010010#include "src/objects.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +000011
Ben Murdochb8a8cc12014-11-26 15:28:44 +000012namespace v8 {
13namespace internal {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000014
Ben Murdoch097c5b22016-05-18 11:27:45 +010015class CompilationInfo;
Ben Murdochc5610432016-08-08 18:44:38 +010016class CompilationJob;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000017class RegisterConfiguration;
18
Ben Murdochb8a8cc12014-11-26 15:28:44 +000019namespace compiler {
20
Emily Bernierd0a1eb72015-03-24 16:35:39 -040021class CallDescriptor;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000022class Graph;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040023class InstructionSequence;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040024class Schedule;
Ben Murdochc5610432016-08-08 18:44:38 +010025class SourcePositionTable;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000026
Ben Murdochc5610432016-08-08 18:44:38 +010027class Pipeline : public AllStatic {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000028 public:
Ben Murdochc5610432016-08-08 18:44:38 +010029 // Returns a new compilation job for the given function.
30 static CompilationJob* NewCompilationJob(Handle<JSFunction> function);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031
Ben Murdochc5610432016-08-08 18:44:38 +010032 // Returns a new compilation job for the WebAssembly compilation info.
33 static CompilationJob* NewWasmCompilationJob(
34 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor,
35 SourcePositionTable* source_positions);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000036
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000037 // Run the pipeline on a machine graph and generate code. The {schedule} must
38 // be valid, hence the given {graph} does not need to be schedulable.
39 static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate,
40 CallDescriptor* call_descriptor,
41 Graph* graph, Schedule* schedule,
Ben Murdoch097c5b22016-05-18 11:27:45 +010042 Code::Flags flags,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000043 const char* debug_name);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040044
Ben Murdochc5610432016-08-08 18:44:38 +010045 // Run the entire pipeline and generate a handle to a code object suitable for
46 // testing.
47 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info);
48
Emily Bernierd0a1eb72015-03-24 16:35:39 -040049 // Run the pipeline on a machine graph and generate code. If {schedule} is
50 // {nullptr}, then compute a new schedule for code generation.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000051 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
Emily Bernierd0a1eb72015-03-24 16:35:39 -040052 Graph* graph,
53 Schedule* schedule = nullptr);
54
55 // Run just the register allocator phases.
56 static bool AllocateRegistersForTesting(const RegisterConfiguration* config,
57 InstructionSequence* sequence,
58 bool run_verifier);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000059
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000060 // Run the pipeline on a machine graph and generate code. If {schedule} is
61 // {nullptr}, then compute a new schedule for code generation.
Emily Bernierd0a1eb72015-03-24 16:35:39 -040062 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
63 CallDescriptor* call_descriptor,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000064 Graph* graph,
65 Schedule* schedule = nullptr);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040066
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000067 private:
Ben Murdochc5610432016-08-08 18:44:38 +010068 DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000069};
Emily Bernierd0a1eb72015-03-24 16:35:39 -040070
71} // namespace compiler
72} // namespace internal
73} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000074
75#endif // V8_COMPILER_PIPELINE_H_