#include "Basic/SDNodeProperties.h"
#include "Common/CodeGenDAGPatterns.h"
#include "Common/CodeGenInstruction.h"
#include "Common/CodeGenRegisters.h"
#include "Common/CodeGenTarget.h"
#include "Common/DAGISelMatcher.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
usingnamespacellvm;
enum { … };
cl::OptionCategory DAGISelCat("Options for -gen-dag-isel");
static cl::opt<bool> OmitComments("omit-comments",
cl::desc("Do not generate comments"),
cl::init(false), cl::cat(DAGISelCat));
static cl::opt<bool> InstrumentCoverage(
"instrument-coverage",
cl::desc("Generates tables to help identify patterns matched"),
cl::init(false), cl::cat(DAGISelCat));
namespace {
class MatcherTableEmitter { … };
}
static std::string GetPatFromTreePatternNode(const TreePatternNode &N) { … }
static unsigned GetVBRSize(unsigned Val) { … }
static unsigned EmitVBRValue(uint64_t Val, raw_ostream &OS) { … }
static unsigned EmitSignedVBRValue(uint64_t Val, raw_ostream &OS) { … }
static std::string getIncludePath(const Record *R) { … }
unsigned MatcherTableEmitter::SizeMatcherList(Matcher *N, raw_ostream &OS) { … }
unsigned MatcherTableEmitter::SizeMatcher(Matcher *N, raw_ostream &OS) { … }
static void BeginEmitFunction(raw_ostream &OS, StringRef RetType,
StringRef Decl, bool AddOverride) { … }
static void EndEmitFunction(raw_ostream &OS) { … }
void MatcherTableEmitter::EmitPatternMatchTable(raw_ostream &OS) { … }
unsigned MatcherTableEmitter::EmitMatcher(const Matcher *N,
const unsigned Indent,
unsigned CurrentIdx,
raw_ostream &OS) { … }
unsigned MatcherTableEmitter::EmitMatcherList(const Matcher *N,
const unsigned Indent,
unsigned CurrentIdx,
raw_ostream &OS) { … }
void MatcherTableEmitter::EmitNodePredicatesFunction(
const std::vector<TreePattern *> &Preds, StringRef Decl, raw_ostream &OS) { … }
void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream &OS) { … }
static StringRef getOpcodeString(Matcher::KindTy Kind) { … }
void MatcherTableEmitter::EmitHistogram(const Matcher *M, raw_ostream &OS) { … }
void llvm::EmitMatcherTable(Matcher *TheMatcher, const CodeGenDAGPatterns &CGP,
raw_ostream &OS) { … }