Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // 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 Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 8 | // Clients of this interface shouldn't depend on lots of compiler internals. |
| 9 | // Do not include anything from src/compiler here! |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 10 | #include "src/objects.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 11 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 12 | namespace v8 { |
| 13 | namespace internal { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 14 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 15 | class CompilationInfo; |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 16 | class CompilationJob; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 17 | class RegisterConfiguration; |
| 18 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 19 | namespace compiler { |
| 20 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 21 | class CallDescriptor; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 22 | class Graph; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 23 | class InstructionSequence; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 24 | class Schedule; |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 25 | class SourcePositionTable; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 26 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 27 | class Pipeline : public AllStatic { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 28 | public: |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 29 | // Returns a new compilation job for the given function. |
| 30 | static CompilationJob* NewCompilationJob(Handle<JSFunction> function); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 31 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 32 | // 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 Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 36 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 37 | // 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 Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 42 | Code::Flags flags, |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 43 | const char* debug_name); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 44 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 45 | // 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 Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 49 | // Run the pipeline on a machine graph and generate code. If {schedule} is |
| 50 | // {nullptr}, then compute a new schedule for code generation. |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 51 | static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 52 | 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 Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 59 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 60 | // Run the pipeline on a machine graph and generate code. If {schedule} is |
| 61 | // {nullptr}, then compute a new schedule for code generation. |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 62 | static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, |
| 63 | CallDescriptor* call_descriptor, |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 64 | Graph* graph, |
| 65 | Schedule* schedule = nullptr); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 66 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 67 | private: |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 68 | DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 69 | }; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 70 | |
| 71 | } // namespace compiler |
| 72 | } // namespace internal |
| 73 | } // namespace v8 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 74 | |
| 75 | #endif // V8_COMPILER_PIPELINE_H_ |