- for (int f = Vals.size()-1; f >= 0; --f) {
- if (Vals[f].getPrefix()) {
- BitsInit *FieldInitializer = (BitsInit*)Vals[f].getValue();
+ // Start by filling in fixed values...
+ unsigned Value = 0;
+ for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) {
+ if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1))) {
+ Value |= B->getValue() << (e-i-1);
+ }
+ }
+ o << " " << Value << "U," << '\t' << "// " << R->getName() << "\n";
+ }
+ o << " 0U\n };\n";
+
+ // Map to accumulate all the cases.
+ std::map<std::string, std::vector<std::string> > CaseMap;
+
+ // Construct all cases statement for each opcode
+ for (std::vector<Record*>::iterator IC = Insts.begin(), EC = Insts.end();
+ IC != EC; ++IC) {
+ Record *R = *IC;
+ const std::string &InstName = R->getName();
+ std::string Case("");
+
+ if (InstName == "PHI" ||
+ InstName == "INLINEASM" ||
+ InstName == "DBG_LABEL"||
+ InstName == "EH_LABEL"||
+ InstName == "GC_LABEL"||
+ InstName == "KILL"||
+ InstName == "EXTRACT_SUBREG" ||
+ InstName == "INSERT_SUBREG" ||
+ InstName == "IMPLICIT_DEF" ||
+ InstName == "SUBREG_TO_REG" ||
+ InstName == "COPY_TO_REGCLASS" ||
+ InstName == "DEBUG_VALUE") continue;