#include "Record.h"
#include "Support/Statistic.h"
-bool CodeEmitterGen::run(std::ostream &o) {
- std::vector<Record*> Insts;
- if (Records.getAllDerivedDefinitions("Instruction", Insts)) return true;
+void CodeEmitterGen::run(std::ostream &o) {
+ std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
std::string Namespace = "V9::";
std::string ClassName = "SparcV9CodeEmitter::";
<< " DEBUG(std::cerr << \"Emitting " << R->getName() << "\\n\");\n";
const RecordVal *InstVal = R->getValue("Inst");
- if (!InstVal) {
- std::cerr << "No 'Inst' record found in target description file!\n";
- return true;
- }
+ if (!InstVal)
+ throw std::string("No 'Inst' record found in target description file!");
Init *InitVal = InstVal->getValue();
assert(dynamic_cast<BitsInit*>(InitVal) &&
<< " }\n"
<< " return Value;\n"
<< "}\n";
- return false;
}
public:
CodeEmitterGen(RecordKeeper &R) : Records(R) {}
- // run - Output the code emitter, returning true on failure.
- bool run(std::ostream &o);
+ // run - Output the code emitter
+ void run(std::ostream &o);
private:
void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
void emitGetValueBit(std::ostream &o, const std::string &Namespace);
#include "Record.h"
#include "Support/Statistic.h"
-bool CodeEmitterGen::run(std::ostream &o) {
- std::vector<Record*> Insts;
- if (Records.getAllDerivedDefinitions("Instruction", Insts)) return true;
+void CodeEmitterGen::run(std::ostream &o) {
+ std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
std::string Namespace = "V9::";
std::string ClassName = "SparcV9CodeEmitter::";
<< " DEBUG(std::cerr << \"Emitting " << R->getName() << "\\n\");\n";
const RecordVal *InstVal = R->getValue("Inst");
- if (!InstVal) {
- std::cerr << "No 'Inst' record found in target description file!\n";
- return true;
- }
+ if (!InstVal)
+ throw std::string("No 'Inst' record found in target description file!");
Init *InitVal = InstVal->getValue();
assert(dynamic_cast<BitsInit*>(InitVal) &&
<< " }\n"
<< " return Value;\n"
<< "}\n";
- return false;
}
public:
CodeEmitterGen(RecordKeeper &R) : Records(R) {}
- // run - Output the code emitter, returning true on failure.
- bool run(std::ostream &o);
+ // run - Output the code emitter
+ void run(std::ostream &o);
private:
void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
void emitGetValueBit(std::ostream &o, const std::string &Namespace);