NewBits.push_back(BI->getBit((e - i) - 1));
continue;
}
+ // bits<n> can also come from variable initializers.
+ if (VarInit *VI = dyn_cast<VarInit>(Vals[i])) {
+ if (BitsRecTy *BitsRec = dyn_cast<BitsRecTy>(VI->getType())) {
+ for (unsigned i = 0, e = BitsRec->getNumBits(); i != e; ++i)
+ NewBits.push_back(VI->getBit((e - i) - 1));
+ continue;
+ }
+ // Fallthrough to try convert this to a bit.
+ }
// All other values must be convertible to just a single bit.
Init *Bit = Vals[i]->convertInitializerTo(BitRecTy::get());
if (!Bit) {
// CHECK: bits<2> opc = { 0, 1 };
// CHECK: bits<2> opc2 = { 1, 0 };
// CHECK: bits<1> opc3 = { 1 };
-// CHECK: bits<2> a = { ?, ? };
+// CHECK: bits<2> a;
// CHECK: bits<2> b = { 1, 0 };
// CHECK: bits<2> c = { 1, 1 };
// CHECK: }
bits<16> H;
let H{15-0} = { { 0b11001100 }, 0b00110011 };
+ bits<16> I = { G1, G2 };
// Make sure we can initialise ints with bits<> values.
int J = H;
// CHECK: bits<8> G2 = { 0, 1, 1, 0, 0, 1, 0, 0 };
// CHECK: bits<8> G3 = { 0, 1, 1, 0, 0, 1, 0, 0 };
// CHECK: bits<16> H = { 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1 };
+// CHECK: bits<16> I = { 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0 };
// CHECK: int J = 52275;
// CHECK: int K = 1;
// CHECK: }