Skip to content

[NFC][TableGen] Code cleanup in CodeGenRegister #137994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions llvm/include/llvm/TableGen/Record.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,11 @@ class BitsInit final : public TypedInit,

const Init *resolveReferences(Resolver &R) const override;

const Init *getBit(unsigned Bit) const override {
assert(Bit < NumBits && "Bit index out of range!");
return getTrailingObjects<const Init *>()[Bit];
ArrayRef<const Init *> getBits() const {
return ArrayRef(getTrailingObjects<const Init *>(), NumBits);
}

const Init *getBit(unsigned Bit) const override { return getBits()[Bit]; }
};

/// '7' - Represent an initialization by a literal integer value.
Expand Down Expand Up @@ -781,10 +782,12 @@ class ListInit final : public TypedInit,

void Profile(FoldingSetNodeID &ID) const;

const Init *getElement(unsigned i) const {
assert(i < NumValues && "List element index out of range!");
return getTrailingObjects<const Init *>()[i];
ArrayRef<const Init *> getValues() const {
return ArrayRef(getTrailingObjects<const Init *>(), NumValues);
}

const Init *getElement(unsigned Index) const { return getValues()[Index]; }

const RecTy *getElementType() const {
return cast<ListRecTy>(getType())->getElementType();
}
Expand All @@ -804,12 +807,8 @@ class ListInit final : public TypedInit,
bool isConcrete() const override;
std::string getAsString() const override;

ArrayRef<const Init *> getValues() const {
return ArrayRef(getTrailingObjects<const Init *>(), NumValues);
}

const_iterator begin() const { return getTrailingObjects<const Init *>(); }
const_iterator end () const { return begin() + NumValues; }
const_iterator begin() const { return getValues().begin(); }
const_iterator end() const { return getValues().end(); }

size_t size () const { return NumValues; }
bool empty() const { return NumValues == 0; }
Expand Down
Loading