[llvm-commits] [llvm] r121829 - /llvm/trunk/tools/llvmc/src/Hooks.cpp
Mikhail Glushenkov
foldr at codedgers.com
Tue Dec 14 17:22:34 PST 2010
Author: foldr
Date: Tue Dec 14 19:22:34 2010
New Revision: 121829
URL: http://llvm.org/viewvc/llvm-project?rev=121829&view=rev
Log:
Copy-pastos.
Modified:
llvm/trunk/tools/llvmc/src/Hooks.cpp
Modified: llvm/trunk/tools/llvmc/src/Hooks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Hooks.cpp?rev=121829&r1=121828&r2=121829&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/src/Hooks.cpp (original)
+++ llvm/trunk/tools/llvmc/src/Hooks.cpp Tue Dec 14 19:22:34 2010
@@ -10,19 +10,19 @@
// See http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
inline unsigned NextHighestPowerOf2 (unsigned i) {
+ --i;
i |= i >> 1;
i |= i >> 2;
i |= i >> 4;
i |= i >> 8;
i |= i >> 16;
- i++;
+ ++i;
return i;
}
typedef std::vector<std::string> StrVec;
typedef llvm::StringMap<const char*> ArgMap;
-
/// AddPlusOrMinus - Convert 'no-foo' to '-foo' and 'foo' to '+foo'.
void AddPlusOrMinus (const std::string& Arg, std::string& out) {
if (Arg.find("no-") == 0 && Arg[3] != 0) {
@@ -78,14 +78,22 @@
std::string mcpu("-mcpu=");
bool mattrTouched = false;
bool mcpuTouched = false;
- bool firstIter = true;
for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) {
const std::string& Arg = *B;
- if (firstIter)
- firstIter = false;
- else
+ // Check if the argument should be forwarded to -mcpu instead of -mattr.
+ {
+ ArgMap::const_iterator I = MArchMCpuMap.find(Arg);
+
+ if (I != MArchMCpuMap.end()) {
+ mcpuTouched = true;
+ mcpu += I->getValue();
+ continue;
+ }
+ }
+
+ if (mattrTouched)
mattr += ",";
// Check if the argument is a special case.
@@ -93,23 +101,13 @@
ArgMap::const_iterator I = MArchMap.find(Arg);
if (I != MArchMap.end()) {
+ mattrTouched = true;
mattr += '+';
mattr += I->getValue();
continue;
}
}
- // Check if the argument should be forwarded to -mcpu instead of -mattr.
- {
- ArgMap::const_iterator I = MArchMCpuMap.find(Arg);
-
- if (I != MArchMCpuMap.end()) {
- mcpuTouched = true;
- mcpu += I->getValue();
- continue;
- }
- }
-
AddPlusOrMinus(Arg, mattr);
}
More information about the llvm-commits
mailing list