summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
index 879962001e6..1b16259b8e6 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
@@ -33,7 +33,8 @@ std::vector<CodeTemplate> getSingleton(CodeTemplate &&CT) {
SnippetGeneratorFailure::SnippetGeneratorFailure(const llvm::Twine &S)
: llvm::StringError(S, llvm::inconvertibleErrorCode()) {}
-SnippetGenerator::SnippetGenerator(const LLVMState &State) : State(State) {}
+SnippetGenerator::SnippetGenerator(const LLVMState &State, const Options &Opts)
+ : State(State), Opts(Opts) {}
SnippetGenerator::~SnippetGenerator() = default;
@@ -81,6 +82,9 @@ SnippetGenerator::generateConfigurations(
computeRegisterInitialValues(CT.Instructions);
BC.Key.Config = CT.Config;
Output.push_back(std::move(BC));
+ if (Output.size() >= Opts.MaxConfigsPerOpcode)
+ return Output; // Early exit if we exceeded the number of allowed
+ // configs.
}
}
return Output;
OpenPOWER on IntegriCloud