summaryrefslogtreecommitdiff
path: root/src/tools/tool-options.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/tool-options.h')
-rw-r--r--src/tools/tool-options.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/tool-options.h b/src/tools/tool-options.h
index 10a03acc7..c9d891a00 100644
--- a/src/tools/tool-options.h
+++ b/src/tools/tool-options.h
@@ -126,7 +126,10 @@ struct ToolOptions : public Options {
.add("--pass-arg",
"-pa",
"An argument passed along to optimization passes being run. Must be "
- "in the form KEY@VALUE",
+ "in the form KEY@VALUE. If KEY is the name of a pass then it "
+ "applies to the closest instance of that pass before us. If KEY is "
+ "not the name of a pass then it is a global option that applies to "
+ "all pass instances that read it.",
ToolOptionsCategory,
Options::Arguments::N,
[this](Options*, const std::string& argument) {
@@ -139,7 +142,8 @@ struct ToolOptions : public Options {
key = argument.substr(0, colon);
value = argument.substr(colon + 1);
}
- passOptions.arguments[key] = value;
+
+ addPassArg(key, value);
})
.add(
"--closed-world",
@@ -213,6 +217,12 @@ struct ToolOptions : public Options {
module.features.disable(disabledFeatures);
}
+ virtual void addPassArg(const std::string& key, const std::string& value) {
+ passOptions.arguments[key] = value;
+ }
+
+ virtual ~ToolOptions() = default;
+
private:
FeatureSet enabledFeatures = FeatureSet::Default;
FeatureSet disabledFeatures = FeatureSet::None;