Commit 1eb3a55d by Jan Voung

Switch to llvm::findFirstSet instead of ffs since mingw doesn't have ffs.

ffs() vs findFirstSet() are slightly different, indexing is 0-based instead of 1-based. Example mingw error: http://build.chromium.org/p/tryserver.nacl/builders/nacl-toolchain-win7-pnacl-x86_64/builds/1920/steps/llvm_i686_w64_mingw32%20%28build%29/logs/stdio BUG=none R=stichnot@chromium.org Review URL: https://codereview.chromium.org/563303002
parent 5ee234a7
...@@ -24,10 +24,9 @@ ...@@ -24,10 +24,9 @@
#include "IceTargetLoweringX8632.def" #include "IceTargetLoweringX8632.def"
#include "IceTargetLoweringX8632.h" #include "IceTargetLoweringX8632.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include <strings.h>
namespace Ice { namespace Ice {
namespace { namespace {
...@@ -557,7 +556,7 @@ void TargetX8632::sortByAlignment(VarList &Dest, const VarList &Source) const { ...@@ -557,7 +556,7 @@ void TargetX8632::sortByAlignment(VarList &Dest, const VarList &Source) const {
++I) { ++I) {
Variable *Var = *I; Variable *Var = *I;
uint32_t NaturalAlignment = typeWidthInBytesOnStack(Var->getType()); uint32_t NaturalAlignment = typeWidthInBytesOnStack(Var->getType());
SizeT LogNaturalAlignment = ffs(NaturalAlignment) - 1; SizeT LogNaturalAlignment = llvm::findFirstSet(NaturalAlignment);
assert(LogNaturalAlignment >= X86_LOG2_OF_MIN_STACK_SLOT_SIZE); assert(LogNaturalAlignment >= X86_LOG2_OF_MIN_STACK_SLOT_SIZE);
assert(LogNaturalAlignment <= X86_LOG2_OF_MAX_STACK_SLOT_SIZE); assert(LogNaturalAlignment <= X86_LOG2_OF_MAX_STACK_SLOT_SIZE);
SizeT BucketIndex = LogNaturalAlignment - X86_LOG2_OF_MIN_STACK_SLOT_SIZE; SizeT BucketIndex = LogNaturalAlignment - X86_LOG2_OF_MIN_STACK_SLOT_SIZE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment