LLVM: lib/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

16

17namespace llvm {

18

21 cl::desc("Override the vector register size in bits, "

22 "which is otherwise found by querying TTI."));

25 cl::desc("Allow non-power-of-2 vectorization."));

26

27#define LoadSeedsDef "loads"

28#define StoreSeedsDef "stores"

31 cl::desc("Collect these seeds. Use empty for none or a comma-separated "

33

38

40 bool Change = false;

41 const auto &DL = F.getParent()->getDataLayout();

42 unsigned VecRegBits =

45 : A.getTTI()

47 .getFixedValue();

50

51

52 for (auto &BB : F) {

53 SeedCollector SC(&BB, A.getScalarEvolution(), CollectStores, CollectLoads);

55 unsigned ElmBits =

57 Seeds[Seeds.getFirstUnusedElementIdx()])),

59

60 auto DivideBy2 = [](unsigned Num) {

62 if (Floor == Num)

63 return Floor / 2;

64 return Floor;

65 };

66

67

68 for (unsigned SliceElms = std::min(VecRegBits / ElmBits,

69 Seeds.getNumUnusedBits() / ElmBits);

70 SliceElms >= 2u; SliceElms = DivideBy2(SliceElms)) {

71 if (Seeds.allUsed())

72 break;

73

74

75 for (unsigned Offset = Seeds.getFirstUnusedElementIdx(),

76 OE = Seeds.size();

78

79 if (Seeds.isUsed(Offset))

80 continue;

81 if (Seeds.allUsed())

82 break;

83

84 auto SeedSlice =

86 if (SeedSlice.empty())

87 continue;

88

89 assert(SeedSlice.size() >= 2 && "Should have been rejected!");

90

91

92 auto &Ctx = F.getContext();

93 Region Rgn(Ctx, A.getTTI());

94 Rgn.setAux(SeedSlice);

95

96 Change |= RPM.runOnRegion(Rgn, A);

98 }

99 }

100 }

101 }

102 return Change;

103}

104}

105}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

#define StoreSeedsDef

Definition SeedCollection.cpp:28

#define LoadSeedsDef

Definition SeedCollection.cpp:27

This pass exposes codegen information to IR-level passes.

StringRef - Represent a constant reference to a string, i.e.

FunctionPass(StringRef Name)

Name can't contain any spaces or start with '-'.

The main job of the Region is to point to new instructions generated by vectorization passes.

LLVM_ABI void clearAux()

Clears all auxiliary data.

A set of candidate Instructions for vectorizing together.

bool runOnFunction(Function &F, const Analyses &A) final

\Returns true if it modifies F.

Definition SeedCollection.cpp:39

SeedCollection(StringRef Pipeline)

Definition SeedCollection.cpp:35

iterator_range< SeedContainer::iterator > getStoreSeeds()

static unsigned getNumBits(Type *Ty, const DataLayout &DL)

\Returns the number of bits of Ty.

static Type * getExpectedType(const Value *V)

\Returns the expected type of Value V.

static Type * getElementType(Type *Ty)

Returns Ty if scalar or its element type if vector.

static LLVM_ABI unsigned getFloorPowerOf2(unsigned Num)

\Returns the first integer power of 2 that is <= Num.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

static cl::opt< unsigned > OverrideVecRegBits("sbvec-vec-reg-bits", cl::init(0), cl::Hidden, cl::desc("Override the vector register size in bits, " "which is otherwise found by querying TTI."))

static cl::opt< bool > AllowNonPow2("sbvec-allow-non-pow2", cl::init(false), cl::Hidden, cl::desc("Allow non-power-of-2 vectorization."))

cl::opt< std::string > CollectSeeds("sbvec-collect-seeds", cl::init(StoreSeedsDef), cl::Hidden, cl::desc("Collect these seeds. Use empty for none or a comma-separated " "list of '" StoreSeedsDef "' and '" LoadSeedsDef "'."))