2005-09-03 03:14:03 +02:00
|
|
|
//===- DAGISelEmitter.h - Generate an instruction selector ------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:37:13 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-09-03 03:14:03 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This tablegen backend emits a DAG instruction selector.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef DAGISEL_EMITTER_H
|
|
|
|
#define DAGISEL_EMITTER_H
|
|
|
|
|
2008-04-03 02:02:49 +02:00
|
|
|
#include "TableGenBackend.h"
|
2008-01-05 23:25:12 +01:00
|
|
|
#include "CodeGenDAGPatterns.h"
|
2006-02-07 01:37:41 +01:00
|
|
|
#include <set>
|
2005-09-03 03:14:03 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
2005-12-14 23:02:59 +01:00
|
|
|
|
2006-01-17 22:31:18 +01:00
|
|
|
/// DAGISelEmitter - The top-level class which coordinates construction
|
2005-09-03 03:14:03 +02:00
|
|
|
/// and emission of the instruction selector.
|
|
|
|
///
|
|
|
|
class DAGISelEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
2008-01-06 02:10:31 +01:00
|
|
|
CodeGenDAGPatterns CGP;
|
2005-09-03 03:14:03 +02:00
|
|
|
public:
|
2009-02-18 17:37:45 +01:00
|
|
|
explicit DAGISelEmitter(RecordKeeper &R) : Records(R), CGP(R) {}
|
2005-09-03 03:14:03 +02:00
|
|
|
|
|
|
|
// run - Output the isel, returning true on failure.
|
2005-09-08 01:44:43 +02:00
|
|
|
void run(std::ostream &OS);
|
2005-09-08 23:03:01 +02:00
|
|
|
|
2006-03-25 00:10:39 +01:00
|
|
|
|
2005-09-08 01:44:43 +02:00
|
|
|
private:
|
2008-01-05 23:54:53 +01:00
|
|
|
void EmitNodeTransforms(std::ostream &OS);
|
2008-01-05 23:43:57 +01:00
|
|
|
void EmitPredicateFunctions(std::ostream &OS);
|
|
|
|
|
2008-01-05 23:30:17 +01:00
|
|
|
void GenerateCodeForPattern(const PatternToMatch &Pattern,
|
2006-08-26 02:59:04 +02:00
|
|
|
std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
|
2006-08-26 03:02:19 +02:00
|
|
|
std::set<std::string> &GeneratedDecl,
|
2006-07-15 10:45:20 +02:00
|
|
|
std::vector<std::string> &TargetOpcodes,
|
2008-05-31 04:11:25 +02:00
|
|
|
std::vector<std::string> &TargetVTs,
|
|
|
|
bool &OutputIsVariadic,
|
|
|
|
unsigned &NumInputRootOps);
|
2008-01-05 23:30:17 +01:00
|
|
|
void EmitPatterns(std::vector<std::pair<const PatternToMatch*,
|
2006-08-26 02:59:04 +02:00
|
|
|
std::vector<std::pair<unsigned, std::string> > > > &Patterns,
|
2006-01-29 05:25:26 +01:00
|
|
|
unsigned Indent, std::ostream &OS);
|
2008-01-05 23:43:57 +01:00
|
|
|
|
2005-09-08 01:44:43 +02:00
|
|
|
void EmitInstructionSelector(std::ostream &OS);
|
2005-09-03 03:14:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|