Skip to content

Commit d40235a

Browse files
authored
[TableGen] Remove unused functionality from OpInit class. NFC (#121680)
clone, getNumOperands, and getOperand haven't been used for quite some time. The only remaining useful thing is the common implementation of getBit.
1 parent db88071 commit d40235a

File tree

1 file changed

+1
-55
lines changed

1 file changed

+1
-55
lines changed

llvm/include/llvm/TableGen/Record.h

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -834,13 +834,7 @@ class OpInit : public TypedInit {
834834
I->getKind() <= IK_LastOpInit;
835835
}
836836

837-
// Clone - Clone this operator, replacing arguments with the new list
838-
virtual const OpInit *clone(ArrayRef<const Init *> Operands) const = 0;
839-
840-
virtual unsigned getNumOperands() const = 0;
841-
virtual const Init *getOperand(unsigned i) const = 0;
842-
843-
const Init *getBit(unsigned Bit) const override;
837+
const Init *getBit(unsigned Bit) const final;
844838
};
845839

846840
/// !op (X) - Transform an init.
@@ -881,20 +875,6 @@ class UnOpInit final : public OpInit, public FoldingSetNode {
881875

882876
void Profile(FoldingSetNodeID &ID) const;
883877

884-
// Clone - Clone this operator, replacing arguments with the new list
885-
const OpInit *clone(ArrayRef<const Init *> Operands) const override {
886-
assert(Operands.size() == 1 &&
887-
"Wrong number of operands for unary operation");
888-
return UnOpInit::get(getOpcode(), *Operands.begin(), getType());
889-
}
890-
891-
unsigned getNumOperands() const override { return 1; }
892-
893-
const Init *getOperand(unsigned i) const override {
894-
assert(i == 0 && "Invalid operand id for unary operator");
895-
return getOperand();
896-
}
897-
898878
UnaryOp getOpcode() const { return (UnaryOp)Opc; }
899879
const Init *getOperand() const { return LHS; }
900880

@@ -962,22 +942,6 @@ class BinOpInit final : public OpInit, public FoldingSetNode {
962942

963943
void Profile(FoldingSetNodeID &ID) const;
964944

965-
// Clone - Clone this operator, replacing arguments with the new list
966-
const OpInit *clone(ArrayRef<const Init *> Operands) const override {
967-
assert(Operands.size() == 2 &&
968-
"Wrong number of operands for binary operation");
969-
return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
970-
}
971-
972-
unsigned getNumOperands() const override { return 2; }
973-
const Init *getOperand(unsigned i) const override {
974-
switch (i) {
975-
default: llvm_unreachable("Invalid operand id for binary operator");
976-
case 0: return getLHS();
977-
case 1: return getRHS();
978-
}
979-
}
980-
981945
BinaryOp getOpcode() const { return (BinaryOp)Opc; }
982946
const Init *getLHS() const { return LHS; }
983947
const Init *getRHS() const { return RHS; }
@@ -1030,24 +994,6 @@ class TernOpInit final : public OpInit, public FoldingSetNode {
1030994

1031995
void Profile(FoldingSetNodeID &ID) const;
1032996

1033-
// Clone - Clone this operator, replacing arguments with the new list
1034-
const OpInit *clone(ArrayRef<const Init *> Operands) const override {
1035-
assert(Operands.size() == 3 &&
1036-
"Wrong number of operands for ternary operation");
1037-
return TernOpInit::get(getOpcode(), Operands[0], Operands[1], Operands[2],
1038-
getType());
1039-
}
1040-
1041-
unsigned getNumOperands() const override { return 3; }
1042-
const Init *getOperand(unsigned i) const override {
1043-
switch (i) {
1044-
default: llvm_unreachable("Invalid operand id for ternary operator");
1045-
case 0: return getLHS();
1046-
case 1: return getMHS();
1047-
case 2: return getRHS();
1048-
}
1049-
}
1050-
1051997
TernaryOp getOpcode() const { return (TernaryOp)Opc; }
1052998
const Init *getLHS() const { return LHS; }
1053999
const Init *getMHS() const { return MHS; }

0 commit comments

Comments
 (0)