- // Just OR in the result
- o << " Value |= op" << OpOrder[Vals[i].getName()] << ";\n";
- }
-
- // otherwise, will be taken care of in the loop below using this
- // value:
- OpContinuous[Vals[i].getName()] = continuous;
- }
- }
- }
-
- for (unsigned f = 0, e = Vals.size(); f != e; ++f) {
- if (Vals[f].getPrefix()) {
- BitsInit *FieldInitializer = (BitsInit*)Vals[f].getValue();
-
- // Scan through the field looking for bit initializers of the current
- // variable...
- for (int i = FieldInitializer->getNumBits()-1; i >= 0; --i) {
- Init *I = FieldInitializer->getBit(i);
- if (BitInit *BI = dynamic_cast<BitInit*>(I)) {
- DEBUG(o << " // bit init: f: " << f << ", i: " << i << "\n");
- } else if (UnsetInit *UI = dynamic_cast<UnsetInit*>(I)) {
- DEBUG(o << " // unset init: f: " << f << ", i: " << i << "\n");
- } else if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(I)) {
- TypedInit *TI = VBI->getVariable();
- if (VarInit *VI = dynamic_cast<VarInit*>(TI)) {
- // If the bits of the field are laid out consecutively in the
- // instruction, then instead of separately ORing in bits, just
- // mask and shift the entire field for efficiency.
- if (OpContinuous[VI->getName()]) {
- // already taken care of in the loop above, thus there is no
- // need to individually OR in the bits
-
- // for debugging, output the regular version anyway, commented
- DEBUG(o << " // Value |= getValueBit(op"
- << OpOrder[VI->getName()] << ", " << VBI->getBitNum()
- << ")" << " << " << i << ";\n");
- } else {
- o << " Value |= getValueBit(op" << OpOrder[VI->getName()]
- << ", " << VBI->getBitNum()
- << ")" << " << " << i << ";\n";
- }
- } else if (FieldInit *FI = dynamic_cast<FieldInit*>(TI)) {
- // FIXME: implement this!
- o << "FIELD INIT not implemented yet!\n";