[llvm-commits] [llvm-gcc-4.2] r111225 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Eric Christopher
echristo at apple.com
Mon Aug 16 21:57:09 PDT 2010
Author: echristo
Date: Mon Aug 16 23:57:09 2010
New Revision: 111225
URL: http://llvm.org/viewvc/llvm-project?rev=111225&view=rev
Log:
Add support for -mllvm -mattr= command line options.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=111225&r1=111224&r2=111225&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Aug 16 23:57:09 2010
@@ -99,6 +99,12 @@
/// optimizations off.
static cl::opt<bool> DisableLLVMOptimizations("disable-llvm-optzns");
+static cl::list<std::string>
+MAttrs("mattr",
+ cl::CommaSeparated,
+ cl::desc("Target specific attributes (-mattr=help for details)"),
+ cl::value_desc("a1,+a2,-a3,..."));
+
std::vector<std::pair<Constant*, int> > StaticCtors, StaticDtors;
SmallSetVector<Constant*, 32> AttributeUsedGlobals;
SmallSetVector<Constant*, 32> AttributeCompilerUsedGlobals;
@@ -512,13 +518,18 @@
// Figure out the subtarget feature string we pass to the target.
std::string FeatureStr;
+ SubtargetFeatures Features;
// The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
// backend.
#ifdef LLVM_SET_SUBTARGET_FEATURES
- SubtargetFeatures Features;
LLVM_SET_SUBTARGET_FEATURES(Features);
- FeatureStr = Features.getString();
#endif
+
+ // Handle -mattr options passed into llvm
+ for (unsigned i = 0; i != MAttrs.size(); ++i)
+ Features.AddFeature(MAttrs[i]);
+ FeatureStr = Features.getString();
+
TheTarget = TME->createTargetMachine(TargetTriple, FeatureStr);
assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
More information about the llvm-commits
mailing list