llvm.org GIT mirror llvm / d032911
[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239210 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 5 years ago
2 changed file(s) with 10 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
659659 // Clone - Clone this operator, replacing arguments with the new list
660660 virtual OpInit *clone(std::vector &Operands) const = 0;
661661
662 virtual int getNumOperands() const = 0;
663 virtual Init *getOperand(int i) const = 0;
662 virtual unsigned getNumOperands() const = 0;
663 virtual Init *getOperand(unsigned i) const = 0;
664664
665665 // Fold - If possible, fold this to a simpler init. Return this if not
666666 // possible to fold.
701701 return UnOpInit::get(getOpcode(), *Operands.begin(), getType());
702702 }
703703
704 int getNumOperands() const override { return 1; }
705 Init *getOperand(int i) const override {
704 unsigned getNumOperands() const override { return 1; }
705 Init *getOperand(unsigned i) const override {
706706 assert(i == 0 && "Invalid operand id for unary operator");
707707 return getOperand();
708708 }
749749 return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
750750 }
751751
752 int getNumOperands() const override { return 2; }
753 Init *getOperand(int i) const override {
752 unsigned getNumOperands() const override { return 2; }
753 Init *getOperand(unsigned i) const override {
754754 switch (i) {
755755 default: llvm_unreachable("Invalid operand id for binary operator");
756756 case 0: return getLHS();
804804 getType());
805805 }
806806
807 int getNumOperands() const override { return 3; }
808 Init *getOperand(int i) const override {
807 unsigned getNumOperands() const override { return 3; }
808 Init *getOperand(unsigned i) const override {
809809 switch (i) {
810810 default: llvm_unreachable("Invalid operand id for ternary operator");
811811 case 0: return getLHS();
890890 return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass);
891891
892892 std::vector NewOperands;
893 for (int i = 0; i < RHSo->getNumOperands(); ++i) {
893 for (unsigned i = 0; i < RHSo->getNumOperands(); ++i) {
894894 if (auto *RHSoo = dyn_cast(RHSo->getOperand(i))) {
895895 if (Init *Result = EvaluateOperation(RHSoo, LHS, Arg,
896896 Type, CurRec, CurMultiClass))
954954
955955 for (Init *&Item : NewList) {
956956 NewOperands.clear();
957 for(int i = 0; i < RHSo->getNumOperands(); ++i) {
957 for(unsigned i = 0; i < RHSo->getNumOperands(); ++i) {
958958 // First, replace the foreach variable with the list item
959959 if (LHS->getAsString() == RHSo->getOperand(i)->getAsString())
960960 NewOperands.push_back(Item);