//===- InstrInfoEmitter.cpp - Generate a Instruction Set Desc. ------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This tablegen backend is responsible for emitting a description of the target
// instruction set for the code generator.
#include "Support/StringExtras.h"
#include <set>
+namespace llvm {
+
NodeType::ArgResultTypes NodeType::Translate(Record *R) {
const std::string &Name = R->getName();
if (Name == "DNVT_any") return Any;
return true;
}
- throw "Type inferfence contradiction found for pattern " + RecName;
+ throw "Type inference contradiction found for pattern " + RecName;
}
/// InstantiateNonterminals - If this pattern refers to any nonterminals which
} else {
Arg->dump();
error("Unknown leaf value for tree pattern!");
+ return 0;
}
// Apply the type cast...
CalculateComputableValues();
+ OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
+
EmitSourceFileHeader("Instruction Selector for the " + Target.getName() +
" target", OS);
- OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
// Output the slot number enums...
OS << "\nenum { // Slot numbers...\n"
<< " class " << Target.getName() << "ISel {\n"
<< " SelectionDAG &DAG;\n"
<< " public:\n"
- << " X86ISel(SelectionDAG &D) : DAG(D) {}\n"
+ << " " << Target.getName () << "ISel(SelectionDAG &D) : DAG(D) {}\n"
<< " void generateCode();\n"
<< " private:\n"
<< " unsigned makeAnotherReg(const TargetRegisterClass *RC) {\n"
OS << " };\n}\n\n";
// Emit the generateCode entry-point...
- OS << "void X86ISel::generateCode() {\n"
+ OS << "void " << Target.getName () << "ISel::generateCode() {\n"
<< " SelectionDAGNode *Root = DAG.getRoot();\n"
<< " assert(Root->getValueType() == MVT::isVoid && "
"\"Root of DAG produces value??\");\n\n"
<< " }\n\n N->addValue(Val); // Do not ever recalculate this\n"
<< " return Val;\n}\n\n";
}
+ EmitSourceFileTail(OS);
}
+} // End llvm namespace