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

1

2

3

4

5

6

7

8

17

18using namespace llvm;

19

22 cl::desc("Prints the pass pipeline and returns."));

23

24

26

29 cl::desc("Comma-separated list of vectorizer passes. If not set "

30 "we run the predefined pipeline."));

31

32

33

34

35

36

37

38

39

40

41

44 cl::desc("Run the vectorizer only on file paths that match any in the "

45 "list of comma-separated regex's."));

47

50

51

52

53

54 FPM.setPassPipeline(

55 "seed-collection<tr-save,bottom-up-vec,tr-accept-or-revert>",

57 } else {

58

59 FPM.setPassPipeline(

62 }

63}

64

66 default;

67

69

84

85bool SandboxVectorizerPass::allowFile(const std::string &SrcFilePath) {

86

87 size_t DelimPos = 0;

88 do {

89 size_t LastPos = DelimPos != 0 ? DelimPos + 1 : DelimPos;

91 auto FileNameToMatch = AllowFiles.substr(LastPos, DelimPos - LastPos);

92 if (FileNameToMatch.empty())

93 return false;

94

95 Regex FileNameRegex(".*" + FileNameToMatch + "$");

96 assert(FileNameRegex.isValid() && "Bad regex!");

97 if (FileNameRegex.match(SrcFilePath))

98 return true;

99 } while (DelimPos != std:🧵:npos);

100 return false;

101}

102

103bool SandboxVectorizerPass::runImpl(Function &LLVMF) {

104 if (Ctx == nullptr)

105 Ctx = std::make_uniquesandboxir::Context(LLVMF.getContext());

106

108 FPM.printPipeline(outs());

109 return false;

110 }

111

112

115 if (!allowFile(SrcFilePath))

116 return false;

117 }

118

119

120 if (!TTI->getNumberOfRegisters(TTI->getRegisterClassForType(true))) {

122 << "Target has no vector registers, return.\n");

123 return false;

124 }

126 << ".\n");

127

128 if (LLVMF.hasFnAttribute(Attribute::NoImplicitFloat)) {

130 << "NoImplicitFloat attribute, return.\n");

131 return false;

132 }

133

134

135 sandboxir::Function &F = *Ctx->createFunction(&LLVMF);

136 sandboxir::Analyses A(*AA, *SE, *TTI);

137 bool Change = FPM.runOnFunction(F, A);

138

139

140

141

142 Ctx->clear();

143 return Change;

144}

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

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

#define LLVM_UNLIKELY(EXPR)

Module.h This file contains the declarations for the Module class.

static cl::opt< std::string > UserDefinedPassPipeline("sbvec-passes", cl::init(DefaultPipelineMagicStr), cl::Hidden, cl::desc("Comma-separated list of vectorizer passes. If not set " "we run the predefined pipeline."))

static constexpr char AllowFilesDelim

Definition SandboxVectorizer.cpp:46

static const char * DefaultPipelineMagicStr

A magic string for the default pass pipeline.

Definition SandboxVectorizer.cpp:25

cl::opt< std::string > AllowFiles("sbvec-allow-files", cl::init(".*"), cl::Hidden, cl::desc("Run the vectorizer only on file paths that match any in the " "list of comma-separated regex's."))

static cl::opt< bool > PrintPassPipeline("sbvec-print-pass-pipeline", cl::init(false), cl::Hidden, cl::desc("Prints the pass pipeline and returns."))

This pass exposes codegen information to IR-level passes.

A manager for alias analyses.

PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)

Get the result of an analysis pass for a given IR unit.

Represents analyses that only rely on functions' control flow.

LLVMContext & getContext() const

getContext - Return a reference to the LLVMContext associated with this function.

bool hasFnAttribute(Attribute::AttrKind Kind) const

Return true if the function has the attribute.

Module * getParent()

Get the module that this global value is contained inside of...

const std::string & getSourceFileName() const

Get the module's original source file name.

A set of analyses that are preserved following a run of a transformation pass.

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

PreservedAnalyses & preserveSet()

Mark an analysis set as preserved.

LLVM_ABI ~SandboxVectorizerPass()

LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)

Definition SandboxVectorizer.cpp:70

LLVM_ABI SandboxVectorizerPass()

Definition SandboxVectorizer.cpp:48

Analysis pass that exposes the ScalarEvolution for a function.

Analysis pass providing the TargetTransformInfo.

LLVM_ABI StringRef getName() const

Return a constant reference to the value's name.

static std::unique_ptr< FunctionPass > createFunctionPass(StringRef Name, StringRef Args)

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI raw_fd_ostream & outs()

This returns a reference to a raw_fd_ostream for standard output.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

AnalysisManager< Function > FunctionAnalysisManager

Convenience typedef for the Function analysis manager.