summaryrefslogtreecommitdiff
path: root/utils/TableGen/LLVMCConfigurationEmitter.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-02-23 09:04:13 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-02-23 09:04:13 +0000
commita04d4ed690505b4474fd272d260512b23288aac2 (patch)
tree03c4955c4a692db88f89b143f27d194c8fbab32b /utils/TableGen/LLVMCConfigurationEmitter.cpp
parenta3f173237d6bff072600b63a34f3fd7e280a624c (diff)
downloadllvm-a04d4ed690505b4474fd272d260512b23288aac2.tar.gz
llvm-a04d4ed690505b4474fd272d260512b23288aac2.tar.bz2
llvm-a04d4ed690505b4474fd272d260512b23288aac2.tar.xz
Add a way to enable '-opt=foo' forwarding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96916 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/LLVMCConfigurationEmitter.cpp')
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index 2abc94bbcd..98952606c9 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -229,7 +229,7 @@ namespace OptionDescriptionFlags {
enum OptionDescriptionFlags { Required = 0x1, Hidden = 0x2,
ReallyHidden = 0x4, Extern = 0x8,
OneOrMore = 0x10, Optional = 0x20,
- CommaSeparated = 0x40 };
+ CommaSeparated = 0x40, ForwardNotSplit = 0x80 };
}
/// OptionDescription - Represents data contained in a single
@@ -271,6 +271,9 @@ struct OptionDescription {
bool isExtern() const;
void setExtern();
+ bool isForwardNotSplit() const;
+ void setForwardNotSplit();
+
bool isRequired() const;
void setRequired();
@@ -327,6 +330,13 @@ void OptionDescription::setCommaSeparated() {
Flags |= OptionDescriptionFlags::CommaSeparated;
}
+bool OptionDescription::isForwardNotSplit() const {
+ return Flags & OptionDescriptionFlags::ForwardNotSplit;
+}
+void OptionDescription::setForwardNotSplit() {
+ Flags |= OptionDescriptionFlags::ForwardNotSplit;
+}
+
bool OptionDescription::isExtern() const {
return Flags & OptionDescriptionFlags::Extern;
}
@@ -586,6 +596,8 @@ public:
AddHandler("required", &CollectOptionProperties::onRequired);
AddHandler("optional", &CollectOptionProperties::onOptional);
AddHandler("comma_separated", &CollectOptionProperties::onCommaSeparated);
+ AddHandler("forward_not_split",
+ &CollectOptionProperties::onForwardNotSplit);
staticMembersInitialized_ = true;
}
@@ -629,6 +641,13 @@ private:
optDesc_.setCommaSeparated();
}
+ void onForwardNotSplit (const DagInit& d) {
+ CheckNumberOfArguments(d, 0);
+ if (!optDesc_.isParameter())
+ throw "'forward_not_split' is valid only for parameter options!";
+ optDesc_.setForwardNotSplit();
+ }
+
void onRequired (const DagInit& d) {
CheckNumberOfArguments(d, 0);
if (optDesc_.isOneOrMore() || optDesc_.isOptional())
@@ -1792,8 +1811,16 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n";
break;
case OptionType::Parameter:
- O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n";
- O.indent(IndentLevel) << "vec.push_back(" << D.GenVariableName() << ");\n";
+ O.indent(IndentLevel) << "vec.push_back(\"" << Name;
+
+ if (!D.isForwardNotSplit()) {
+ O << "\");\n";
+ O.indent(IndentLevel) << "vec.push_back("
+ << D.GenVariableName() << ");\n";
+ }
+ else {
+ O << "=\" + " << D.GenVariableName() << ");\n";
+ }
break;
case OptionType::Prefix:
O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\" + "