2014-07-30 13:54:45 +00:00
|
|
|
// Copyright 2014 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_COMPILER_PIPELINE_H_
|
|
|
|
#define V8_COMPILER_PIPELINE_H_
|
|
|
|
|
|
|
|
#include "src/v8.h"
|
|
|
|
|
|
|
|
#include "src/compiler.h"
|
|
|
|
|
|
|
|
// Note: TODO(turbofan) implies a performance improvement opportunity,
|
|
|
|
// and TODO(name) implies an incomplete implementation
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
namespace compiler {
|
|
|
|
|
|
|
|
// Clients of this interface shouldn't depend on lots of compiler internals.
|
|
|
|
class Graph;
|
2014-11-17 12:36:58 +00:00
|
|
|
class InstructionSequence;
|
2014-10-14 08:43:33 +00:00
|
|
|
class Linkage;
|
2014-10-27 09:36:51 +00:00
|
|
|
class PipelineData;
|
2014-11-17 12:36:58 +00:00
|
|
|
class RegisterConfiguration;
|
2014-07-30 13:54:45 +00:00
|
|
|
class Schedule;
|
|
|
|
|
|
|
|
class Pipeline {
|
|
|
|
public:
|
2014-08-26 15:17:57 +00:00
|
|
|
explicit Pipeline(CompilationInfo* info) : info_(info) {}
|
2014-07-30 13:54:45 +00:00
|
|
|
|
|
|
|
// Run the entire pipeline and generate a handle to a code object.
|
|
|
|
Handle<Code> GenerateCode();
|
|
|
|
|
|
|
|
// Run the pipeline on a machine graph and generate code. If {schedule}
|
|
|
|
// is {NULL}, then compute a new schedule for code generation.
|
|
|
|
Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph,
|
|
|
|
Schedule* schedule = NULL);
|
|
|
|
|
2014-11-17 12:36:58 +00:00
|
|
|
static bool AllocateRegisters(const RegisterConfiguration* config,
|
|
|
|
InstructionSequence* sequence,
|
|
|
|
bool run_verifier);
|
|
|
|
|
2014-08-05 11:53:32 +00:00
|
|
|
static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; }
|
2014-08-01 13:51:23 +00:00
|
|
|
static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; }
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2014-08-05 13:20:26 +00:00
|
|
|
static void SetUp();
|
|
|
|
static void TearDown();
|
|
|
|
|
2014-07-30 13:54:45 +00:00
|
|
|
private:
|
|
|
|
CompilationInfo* info_;
|
2014-11-14 16:44:38 +00:00
|
|
|
PipelineData* data_;
|
|
|
|
|
|
|
|
// Helpers for executing pipeline phases.
|
|
|
|
template <typename Phase>
|
|
|
|
void Run();
|
|
|
|
template <typename Phase, typename Arg0>
|
|
|
|
void Run(Arg0 arg_0);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2014-08-13 14:05:37 +00:00
|
|
|
CompilationInfo* info() const { return info_; }
|
|
|
|
Isolate* isolate() { return info_->isolate(); }
|
|
|
|
|
2014-11-17 12:36:58 +00:00
|
|
|
void BeginPhaseKind(const char* phase_kind);
|
2014-11-14 16:44:38 +00:00
|
|
|
void RunPrintAndVerify(const char* phase, bool untyped = false);
|
|
|
|
void GenerateCode(Linkage* linkage);
|
2014-11-17 12:36:58 +00:00
|
|
|
void AllocateRegisters(const RegisterConfiguration* config,
|
|
|
|
bool run_verifier);
|
2014-07-30 13:54:45 +00:00
|
|
|
};
|
2014-11-14 16:44:38 +00:00
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2014-07-30 13:54:45 +00:00
|
|
|
|
|
|
|
#endif // V8_COMPILER_PIPELINE_H_
|