diff --git a/include/llvm/CompilerDriver/Common.td b/include/llvm/CompilerDriver/Common.td index 9c3e861c220..3ae77aeadf6 100644 --- a/include/llvm/CompilerDriver/Common.td +++ b/include/llvm/CompilerDriver/Common.td @@ -46,6 +46,7 @@ def optional; def really_hidden; def required; def comma_separated; +def forward_not_split; // The 'case' construct. def case; diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp index 2abc94bbcda..98952606c9e 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 << "\" + "