llvm.org GIT mirror llvm / f18a9a2
Avoid emitting empty arrays, they're not standard C++. It's only by luck that we haven't produced any yet, and clang refuses to compile them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149546 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 7 years ago
1 changed file(s) with 11 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
639639 << "getRawAllocationOrder(const MachineFunction &MF) const {\n";
640640 for (unsigned oi = 1 , oe = RC.getNumOrders(); oi != oe; ++oi) {
641641 ArrayRef Elems = RC.getOrder(oi);
642 OS << " static const unsigned AltOrder" << oi << "[] = {";
643 for (unsigned elem = 0; elem != Elems.size(); ++elem)
644 OS << (elem ? ", " : " ") << getQualifiedName(Elems[elem]);
645 OS << " };\n";
642 if (!Elems.empty()) {
643 OS << " static const unsigned AltOrder" << oi << "[] = {";
644 for (unsigned elem = 0; elem != Elems.size(); ++elem)
645 OS << (elem ? ", " : " ") << getQualifiedName(Elems[elem]);
646 OS << " };\n";
647 }
646648 }
647649 OS << " const MCRegisterClass &MCR = " << Target.getName()
648 << "MCRegisterClasses[" << RC.getQualifiedName() + "RegClassID];"
650 << "MCRegisterClasses[" << RC.getQualifiedName() + "RegClassID];\n"
649651 << " static const ArrayRef Order[] = {\n"
650652 << " makeArrayRef(MCR.begin(), MCR.getNumRegs()";
651653 for (unsigned oi = 1, oe = RC.getNumOrders(); oi != oe; ++oi)
652 OS << "),\n makeArrayRef(AltOrder" << oi;
654 if (RC.getOrder(oi).empty())
655 OS << "),\n ArrayRef(";
656 else
657 OS << "),\n makeArrayRef(AltOrder" << oi;
653658 OS << ")\n };\n const unsigned Select = " << RC.getName()
654659 << "AltOrderSelect(MF);\n assert(Select < " << RC.getNumOrders()
655660 << ");\n return Order[Select];\n}\n";