llvm.org GIT mirror llvm / 71bb0e1
[TableGen] Replace a couple if/else chains with a switch. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239023 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 5 years ago
1 changed file(s) with 9 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
751751
752752 int getNumOperands() const override { return 2; }
753753 Init *getOperand(int i) const override {
754 assert((i == 0 || i == 1) && "Invalid operand id for binary operator");
755 if (i == 0) {
756 return getLHS();
757 } else {
758 return getRHS();
754 switch (i) {
755 default: llvm_unreachable("Invalid operand id for binary operator");
756 case 0: return getLHS();
757 case 1: return getRHS();
759758 }
760759 }
761760
807806
808807 int getNumOperands() const override { return 3; }
809808 Init *getOperand(int i) const override {
810 assert((i == 0 || i == 1 || i == 2) &&
811 "Invalid operand id for ternary operator");
812 if (i == 0) {
813 return getLHS();
814 } else if (i == 1) {
815 return getMHS();
816 } else {
817 return getRHS();
809 switch (i) {
810 default: llvm_unreachable("Invalid operand id for ternary operator");
811 case 0: return getLHS();
812 case 1: return getMHS();
813 case 2: return getRHS();
818814 }
819815 }
820816