[llvm] r239210 - [TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC
Craig Topper
craig.topper at gmail.com
Fri Jun 5 18:34:04 PDT 2015
Author: ctopper
Date: Fri Jun 5 20:34:04 2015
New Revision: 239210
URL: http://llvm.org/viewvc/llvm-project?rev=239210&view=rev
Log:
[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
llvm/trunk/lib/TableGen/Record.cpp
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=239210&r1=239209&r2=239210&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Fri Jun 5 20:34:04 2015
@@ -660,8 +660,8 @@ public:
// Clone - Clone this operator, replacing arguments with the new list
virtual OpInit *clone(std::vector<Init *> &Operands) const = 0;
- virtual int getNumOperands() const = 0;
- virtual Init *getOperand(int i) const = 0;
+ virtual unsigned getNumOperands() const = 0;
+ virtual Init *getOperand(unsigned i) const = 0;
// Fold - If possible, fold this to a simpler init. Return this if not
// possible to fold.
@@ -702,8 +702,8 @@ public:
return UnOpInit::get(getOpcode(), *Operands.begin(), getType());
}
- int getNumOperands() const override { return 1; }
- Init *getOperand(int i) const override {
+ unsigned getNumOperands() const override { return 1; }
+ Init *getOperand(unsigned i) const override {
assert(i == 0 && "Invalid operand id for unary operator");
return getOperand();
}
@@ -750,8 +750,8 @@ public:
return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
}
- int getNumOperands() const override { return 2; }
- Init *getOperand(int i) const override {
+ unsigned getNumOperands() const override { return 2; }
+ Init *getOperand(unsigned i) const override {
switch (i) {
default: llvm_unreachable("Invalid operand id for binary operator");
case 0: return getLHS();
@@ -805,8 +805,8 @@ public:
getType());
}
- int getNumOperands() const override { return 3; }
- Init *getOperand(int i) const override {
+ unsigned getNumOperands() const override { return 3; }
+ Init *getOperand(unsigned i) const override {
switch (i) {
default: llvm_unreachable("Invalid operand id for ternary operator");
case 0: return getLHS();
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=239210&r1=239209&r2=239210&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Fri Jun 5 20:34:04 2015
@@ -891,7 +891,7 @@ static Init *EvaluateOperation(OpInit *R
return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass);
std::vector<Init *> NewOperands;
- for (int i = 0; i < RHSo->getNumOperands(); ++i) {
+ for (unsigned i = 0; i < RHSo->getNumOperands(); ++i) {
if (auto *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i))) {
if (Init *Result = EvaluateOperation(RHSoo, LHS, Arg,
Type, CurRec, CurMultiClass))
@@ -955,7 +955,7 @@ static Init *ForeachHelper(Init *LHS, In
for (Init *&Item : NewList) {
NewOperands.clear();
- for(int i = 0; i < RHSo->getNumOperands(); ++i) {
+ for(unsigned i = 0; i < RHSo->getNumOperands(); ++i) {
// First, replace the foreach variable with the list item
if (LHS->getAsString() == RHSo->getOperand(i)->getAsString())
NewOperands.push_back(Item);
More information about the llvm-commits
mailing list