Skip to content

Commit

Permalink
[TableGen] CodeGenIntrinsic - pass DefaultProperties as ArrayRef inst…
Browse files Browse the repository at this point in the history
…ead of std::vector by value.

Avoid std::vector copies as setDefaultProperties just iterates across the Records

Fixes llvm#89207
  • Loading branch information
RKSimon committed Jun 3, 2024
1 parent 9a7bd8a commit 72c901f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CodeGenIntrinsicTable::CodeGenIntrinsicTable(const RecordKeeper &RC) {
}

CodeGenIntrinsic::CodeGenIntrinsic(Record *R,
std::vector<Record *> DefaultProperties) {
ArrayRef<Record *> DefaultProperties) {
TheDef = R;
std::string DefName = std::string(R->getName());
ArrayRef<SMLoc> DefLoc = R->getLoc();
Expand Down Expand Up @@ -148,7 +148,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R,
}

void CodeGenIntrinsic::setDefaultProperties(
Record *R, std::vector<Record *> DefaultProperties) {
Record *R, ArrayRef<Record *> DefaultProperties) {
// opt-out of using default attributes.
if (R->getValueAsBit("DisableDefaultAttributes"))
return;
Expand Down
5 changes: 3 additions & 2 deletions llvm/utils/TableGen/Basic/CodeGenIntrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H

#include "SDNodeProperties.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/ModRef.h"
#include <string>
Expand Down Expand Up @@ -140,7 +141,7 @@ struct CodeGenIntrinsic {

/// Goes through all IntrProperties that have IsDefault
/// value set and sets the property.
void setDefaultProperties(Record *R, std::vector<Record *> DefaultProperties);
void setDefaultProperties(Record *R, ArrayRef<Record *> DefaultProperties);

/// Helper function to set property \p Name to true;
void setProperty(Record *R);
Expand All @@ -154,7 +155,7 @@ struct CodeGenIntrinsic {

bool isParamImmArg(unsigned ParamIdx) const;

CodeGenIntrinsic(Record *R, std::vector<Record *> DefaultProperties);
CodeGenIntrinsic(Record *R, ArrayRef<Record *> DefaultProperties);
};

class CodeGenIntrinsicTable {
Expand Down

0 comments on commit 72c901f

Please sign in to comment.