1 //===- RSProfiling.cpp - Various profiling using random sampling ----------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // These passes implement a random sampling based profiling. Different methods
11 // of choosing when to sample are supported, as well as different types of
12 // profiling. This is done as two passes. The first is a sequence of profiling
13 // passes which insert profiling into the program, and remember what they inserted.
14 // The second stage duplicates all instructions in a function, ignoring the
15 // profiling code, then connects the two versions togeather at the entry and at
16 // backedges. At each connection point a choice is made as to whether to jump
17 // to the profiled code (take a sample) or execute the unprofiled code.
19 // It is highly recommeneded that after this pass one runs mem2reg and adce
20 // (instcombine load-vn gdce dse also are good to run afterwards)
22 // This design is intended to make the profiling passes independent of the RS
23 // framework, but any profiling pass that implements the RSProfiling interface
24 // is compatible with the rs framework (and thus can be sampled)
26 // TODO: obviously the block and function profiling are almost identical to the
27 // existing ones, so they can be unified (esp since these passes are valid
28 // without the rs framework).
29 // TODO: Fix choice code so that frequency is not hard coded
31 //===----------------------------------------------------------------------===//
33 #include "llvm/Pass.h"
34 #include "llvm/Function.h"
35 #include "llvm/Module.h"
36 #include "llvm/BasicBlock.h"
37 #include "llvm/Instructions.h"
38 #include "llvm/Constants.h"
39 #include "llvm/DerivedTypes.h"
40 #include "llvm/Transforms/Scalar.h"
41 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
42 #include "llvm/ADT/Statistic.h"
43 #include "llvm/Support/CommandLine.h"
44 #include "llvm/Support/Debug.h"
45 #include "llvm/Transforms/Instrumentation.h"
46 #include "ProfilingUtils.h"
47 #include "RSProfiling.h"
58 Statistic<> NumBackEdges("bedge", "Number of BackEdges");
64 cl::opt<RandomMeth> RandomMethod("profile-randomness",
65 cl::desc("How to randomly choose to profile:"),
67 clEnumValN(GBV, "global", "global counter"),
68 clEnumValN(GBVO, "ra_global", "register allocated global counter"),
69 clEnumValN(HOSTCC, "rdcc", "cycle counter"),
73 class FunctionProfilerRS : public RSProfilers {
74 bool runOnModule(Module &M);
77 class BlockProfilerRS : public RSProfilers {
78 bool runOnModule(Module &M);
81 class NullProfilerRS : public RSProfilers {
83 bool isProfiling(Value* v) {
86 bool runOnModule(Module &M) {
89 void getAnalysisUsage(AnalysisUsage &AU) const {
94 static RegisterAnalysisGroup<RSProfilers> A("Profiling passes");
95 static RegisterOpt<NullProfilerRS> NP("insert-null-profiling-rs",
96 "Measure profiling framework overhead");
97 static RegisterAnalysisGroup<RSProfilers, NullProfilerRS, true> NPT;
98 static RegisterOpt<BlockProfilerRS> BBP("insert-block-profiling-rs",
99 "Add block count instrumentation");
100 static RegisterAnalysisGroup<RSProfilers, BlockProfilerRS> BBPT;
101 static RegisterOpt<FunctionProfilerRS> FP("insert-function-profiling-rs",
102 "Add function count instrumentation");
103 static RegisterAnalysisGroup<RSProfilers, FunctionProfilerRS> FPT;
106 //Something that chooses how to sample
109 virtual void ProcessChoicePoint(BasicBlock*) = 0;
110 virtual void PrepFunction(Function*) = 0;
111 virtual ~Chooser() {}
114 //Things that implement sampling policies
115 class GlobalRandomCounter : public Chooser {
116 GlobalVariable* Counter;
120 GlobalRandomCounter(Module& M, const Type* t, uint64_t resetval);
121 virtual ~GlobalRandomCounter();
122 virtual void PrepFunction(Function* F);
123 virtual void ProcessChoicePoint(BasicBlock* bb);
126 class GlobalRandomCounterOpt : public Chooser {
127 GlobalVariable* Counter;
132 GlobalRandomCounterOpt(Module& M, const Type* t, uint64_t resetval);
133 virtual ~GlobalRandomCounterOpt();
134 virtual void PrepFunction(Function* F);
135 virtual void ProcessChoicePoint(BasicBlock* bb);
138 class CycleCounter : public Chooser {
142 CycleCounter(Module& m, uint64_t resetmask);
143 virtual ~CycleCounter();
144 virtual void PrepFunction(Function* F);
145 virtual void ProcessChoicePoint(BasicBlock* bb);
149 struct ProfilerRS : public FunctionPass {
150 std::map<Value*, Value*> TransCache;
151 std::set<BasicBlock*> ChoicePoints;
154 Value* Translate(Value* v);
155 void Duplicate(Function& F, RSProfilers& LI);
156 void ProcessBackEdge(BasicBlock* src, BasicBlock* dst, Function& F);
157 bool runOnFunction(Function& F);
158 bool doInitialization(Module &M);
159 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
162 RegisterOpt<ProfilerRS> X("insert-rs-profiling-framework",
163 "Insert random sampling instrumentation framework");
167 static void ReplacePhiPred(BasicBlock* btarget,
168 BasicBlock* bold, BasicBlock* bnew);
170 static void CollapsePhi(BasicBlock* btarget, BasicBlock* bsrc);
173 static void recBackEdge(BasicBlock* bb, T& BackEdges,
174 std::map<BasicBlock*, int>& color,
175 std::map<BasicBlock*, int>& depth,
176 std::map<BasicBlock*, int>& finish,
179 //find the back edges and where they go to
181 static void getBackEdges(Function& F, T& BackEdges);
184 ///////////////////////////////////////
185 // Methods of choosing when to profile
186 ///////////////////////////////////////
188 GlobalRandomCounter::GlobalRandomCounter(Module& M, const Type* t,
189 uint64_t resetval) : T(t) {
190 Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage,
191 ConstantUInt::get(T, resetval),
192 "RandomSteeringCounter", &M);
193 ResetValue = ConstantUInt::get(T, resetval);
196 GlobalRandomCounter::~GlobalRandomCounter() {}
198 void GlobalRandomCounter::PrepFunction(Function* F) {}
200 void GlobalRandomCounter::ProcessChoicePoint(BasicBlock* bb) {
201 BranchInst* t = cast<BranchInst>(bb->getTerminator());
204 LoadInst* l = new LoadInst(Counter, "counter", t);
206 SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, ConstantUInt::get(T, 0),
208 Value* nv = BinaryOperator::create(Instruction::Sub, l,
209 ConstantInt::get(T, 1),
211 new StoreInst(nv, Counter, t);
215 BasicBlock* oldnext = t->getSuccessor(0);
216 BasicBlock* resetblock = new BasicBlock("reset", oldnext->getParent(), oldnext);
217 TerminatorInst* t2 = new BranchInst(oldnext, resetblock);
218 t->setSuccessor(0, resetblock);
219 new StoreInst(ResetValue, Counter, t2);
220 ReplacePhiPred(oldnext, bb, resetblock);
223 GlobalRandomCounterOpt::GlobalRandomCounterOpt(Module& M, const Type* t,
226 Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage,
227 ConstantUInt::get(T, resetval),
228 "RandomSteeringCounter", &M);
229 ResetValue = ConstantUInt::get(T, resetval);
232 GlobalRandomCounterOpt::~GlobalRandomCounterOpt() {}
234 void GlobalRandomCounterOpt::PrepFunction(Function* F) {
235 //make a local temporary to cache the global
236 BasicBlock& bb = F->getEntryBlock();
237 AI = new AllocaInst(T, 0, "localcounter", bb.begin());
238 LoadInst* l = new LoadInst(Counter, "counterload", AI->getNext());
239 new StoreInst(l, AI, l->getNext());
241 //modify all functions and return values
242 for(Function::iterator fib = F->begin(), fie = F->end();
244 for(BasicBlock::iterator bib = fib->begin(), bie = fib->end();
246 if (isa<CallInst>(&*bib)) {
247 LoadInst* l = new LoadInst(AI, "counter", bib);
248 new StoreInst(l, Counter, bib);
249 l = new LoadInst(Counter, "counter", bib->getNext());
250 new StoreInst(l, AI, l->getNext());
251 } else if (isa<InvokeInst>(&*bib)) {
252 LoadInst* l = new LoadInst(AI, "counter", bib);
253 new StoreInst(l, Counter, bib);
255 BasicBlock* bb = cast<InvokeInst>(&*bib)->getNormalDest();
256 Instruction* i = bb->begin();
257 while (isa<PHINode>(i)) i = i->getNext();
258 l = new LoadInst(Counter, "counter", i);
260 bb = cast<InvokeInst>(&*bib)->getUnwindDest();
262 while (isa<PHINode>(i)) i = i->getNext();
263 l = new LoadInst(Counter, "counter", i);
264 new StoreInst(l, AI, l->getNext());
265 } else if (isa<UnwindInst>(&*bib) || isa<ReturnInst>(&*bib)) {
266 LoadInst* l = new LoadInst(AI, "counter", bib);
267 new StoreInst(l, Counter, bib);
271 void GlobalRandomCounterOpt::ProcessChoicePoint(BasicBlock* bb) {
272 BranchInst* t = cast<BranchInst>(bb->getTerminator());
275 LoadInst* l = new LoadInst(AI, "counter", t);
277 SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, ConstantUInt::get(T, 0),
279 Value* nv = BinaryOperator::create(Instruction::Sub, l,
280 ConstantInt::get(T, 1),
282 new StoreInst(nv, AI, t);
286 BasicBlock* oldnext = t->getSuccessor(0);
287 BasicBlock* resetblock = new BasicBlock("reset", oldnext->getParent(), oldnext);
288 TerminatorInst* t2 = new BranchInst(oldnext, resetblock);
289 t->setSuccessor(0, resetblock);
290 new StoreInst(ResetValue, AI, t2);
291 ReplacePhiPred(oldnext, bb, resetblock);
295 CycleCounter::CycleCounter(Module& m, uint64_t resetmask) : rm(resetmask) {
296 F = m.getOrInsertFunction("llvm.readcyclecounter", Type::ULongTy, NULL);
299 CycleCounter::~CycleCounter() {}
301 void CycleCounter::PrepFunction(Function* F) {}
303 void CycleCounter::ProcessChoicePoint(BasicBlock* bb) {
304 BranchInst* t = cast<BranchInst>(bb->getTerminator());
306 CallInst* c = new CallInst(F, "rdcc", t);
307 BinaryOperator* b = BinaryOperator::create(Instruction::And, c, ConstantUInt::get(Type::ULongTy, rm), "mrdcc", t);
309 SetCondInst* s = new SetCondInst(Instruction::SetEQ, b, ConstantUInt::get(Type::ULongTy, 0),
314 ///////////////////////////////////////
316 ///////////////////////////////////////
317 bool RSProfilers::isProfiling(Value* v) {
318 if (profcode.find(v) != profcode.end())
321 RSProfilers& LI = getAnalysis<RSProfilers>();
322 return LI.isProfiling(v);
325 void RSProfilers::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
326 GlobalValue *CounterArray) {
327 // Insert the increment after any alloca or PHI instructions...
328 BasicBlock::iterator InsertPos = BB->begin();
329 while (isa<AllocaInst>(InsertPos) || isa<PHINode>(InsertPos))
332 // Create the getelementptr constant expression
333 std::vector<Constant*> Indices(2);
334 Indices[0] = Constant::getNullValue(Type::IntTy);
335 Indices[1] = ConstantSInt::get(Type::IntTy, CounterNum);
336 Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices);
338 // Load, increment and store the value back.
339 Value *OldVal = new LoadInst(ElementPtr, "OldCounter", InsertPos);
340 profcode.insert(OldVal);
341 Value *NewVal = BinaryOperator::create(Instruction::Add, OldVal,
342 ConstantInt::get(Type::UIntTy, 1),
343 "NewCounter", InsertPos);
344 profcode.insert(NewVal);
345 profcode.insert(new StoreInst(NewVal, ElementPtr, InsertPos));
348 void RSProfilers::getAnalysisUsage(AnalysisUsage &AU) const {
349 //grab any outstanding profiler, or get the null one
350 AU.addRequired<RSProfilers>();
353 bool FunctionProfilerRS::runOnModule(Module &M) {
354 Function *Main = M.getMainFunction();
356 std::cerr << "WARNING: cannot insert function profiling into a module"
357 << " with no main function!\n";
358 return false; // No main, no instrumentation!
361 unsigned NumFunctions = 0;
362 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
363 if (!I->isExternal())
366 const Type *ATy = ArrayType::get(Type::UIntTy, NumFunctions);
367 GlobalVariable *Counters =
368 new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
369 Constant::getNullValue(ATy), "FuncProfCounters", &M);
371 // Instrument all of the functions...
373 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
374 if (!I->isExternal())
375 // Insert counter at the start of the function
376 IncrementCounterInBlock(I->begin(), i++, Counters);
378 // Add the initialization call to main.
379 InsertProfilingInitCall(Main, "llvm_start_func_profiling", Counters);
383 bool BlockProfilerRS::runOnModule(Module &M) {
384 Function *Main = M.getMainFunction();
386 std::cerr << "WARNING: cannot insert block profiling into a module"
387 << " with no main function!\n";
388 return false; // No main, no instrumentation!
391 unsigned NumBlocks = 0;
392 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
393 NumBlocks += I->size();
395 const Type *ATy = ArrayType::get(Type::UIntTy, NumBlocks);
396 GlobalVariable *Counters =
397 new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
398 Constant::getNullValue(ATy), "BlockProfCounters", &M);
400 // Instrument all of the blocks...
402 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
403 for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB)
404 // Insert counter at the start of the block
405 IncrementCounterInBlock(BB, i++, Counters);
407 // Add the initialization call to main.
408 InsertProfilingInitCall(Main, "llvm_start_block_profiling", Counters);
412 ///////////////////////////////////////
414 ///////////////////////////////////////
416 Value* ProfilerRS::Translate(Value* v) {
418 return TransCache[v];
420 if (BasicBlock* bb = dyn_cast<BasicBlock>(v)) {
421 if (bb == &bb->getParent()->getEntryBlock())
422 TransCache[bb] = bb; //don't translate entry block
424 TransCache[bb] = new BasicBlock("dup_" + bb->getName(), bb->getParent(), NULL);
425 return TransCache[bb];
426 } else if (Instruction* i = dyn_cast<Instruction>(v)) {
427 //we have already translated this
428 //do not translate entry block allocas
429 if(&i->getParent()->getParent()->getEntryBlock() == i->getParent()) {
434 Instruction* i2 = i->clone();
436 i2->setName("dup_" + i->getName());
439 for (unsigned x = 0; x < i2->getNumOperands(); ++x)
440 i2->setOperand(x, Translate(i2->getOperand(x)));
443 } else if (isa<Function>(v) || isa<Constant>(v) || isa<Argument>(v)) {
447 assert(0 && "Value not handled");
451 void ProfilerRS::Duplicate(Function& F, RSProfilers& LI)
453 //perform a breadth first search, building up a duplicate of the code
454 std::queue<BasicBlock*> worklist;
455 std::set<BasicBlock*> seen;
457 //This loop ensures proper BB order, to help performance
458 for (Function::iterator fib = F.begin(), fie = F.end(); fib != fie; ++fib)
460 while (!worklist.empty()) {
461 Translate(worklist.front());
465 //remember than reg2mem created a new entry block we don't want to duplicate
466 worklist.push(F.getEntryBlock().getTerminator()->getSuccessor(0));
467 seen.insert(&F.getEntryBlock());
469 while (!worklist.empty()) {
470 BasicBlock* bb = worklist.front();
472 if(seen.find(bb) == seen.end()) {
473 BasicBlock* bbtarget = cast<BasicBlock>(Translate(bb));
474 BasicBlock::InstListType& instlist = bbtarget->getInstList();
475 for (BasicBlock::iterator iib = bb->begin(), iie = bb->end();
478 if (!LI.isProfiling(&*iib)) {
479 Instruction* i = cast<Instruction>(Translate(iib));
480 instlist.insert(bbtarget->end(), i);
483 //updated search state;
485 TerminatorInst* ti = bb->getTerminator();
486 for (unsigned x = 0; x < ti->getNumSuccessors(); ++x) {
487 BasicBlock* bbs = ti->getSuccessor(x);
488 if (seen.find(bbs) == seen.end()) {
496 void ProfilerRS::ProcessBackEdge(BasicBlock* src, BasicBlock* dst, Function& F) {
497 //given a backedge from B -> A, and translations A' and B',
499 //b: add branches in C to A and A' and in C' to A and A'
500 //c: mod terminators@B, replace A with C
501 //d: mod terminators@B', replace A' with C'
502 //e: mod phis@A for pred B to be pred C
503 // if multiple entries, simplify to one
504 //f: mod phis@A' for pred B' to be pred C'
505 // if multiple entries, simplify to one
506 //g: for all phis@A with pred C using x
507 // add in edge from C' using x'
508 // add in edge from C using x in A'
511 BasicBlock* bbC = new BasicBlock("choice", &F, src->getNext() );
512 //ChoicePoints.insert(bbC);
513 BasicBlock* bbCp = new BasicBlock("choice", &F, cast<BasicBlock>(Translate(src))->getNext() );
514 ChoicePoints.insert(bbCp);
517 //new BranchInst(dst, cast<BasicBlock>(Translate(dst)), ConstantBool::get(true), bbC);
518 new BranchInst(cast<BasicBlock>(Translate(dst)), bbC);
519 new BranchInst(dst, cast<BasicBlock>(Translate(dst)), ConstantBool::get(true), bbCp);
522 TerminatorInst* iB = src->getTerminator();
523 for (unsigned x = 0; x < iB->getNumSuccessors(); ++x)
524 if (iB->getSuccessor(x) == dst)
525 iB->setSuccessor(x, bbC);
529 TerminatorInst* iBp = cast<TerminatorInst>(Translate(src->getTerminator()));
530 for (unsigned x = 0; x < iBp->getNumSuccessors(); ++x)
531 if (iBp->getSuccessor(x) == cast<BasicBlock>(Translate(dst)))
532 iBp->setSuccessor(x, bbCp);
535 ReplacePhiPred(dst, src, bbC);
536 //src could be a switch, in which case we are replacing several edges with one
537 //thus collapse those edges int the Phi
538 CollapsePhi(dst, bbC);
540 ReplacePhiPred(cast<BasicBlock>(Translate(dst)),cast<BasicBlock>(Translate(src)),bbCp);
541 CollapsePhi(cast<BasicBlock>(Translate(dst)), bbCp);
543 for(BasicBlock::iterator ib = dst->begin(), ie = dst->end(); ib != ie;
545 if (PHINode* phi = dyn_cast<PHINode>(&*ib)) {
546 for(unsigned x = 0; x < phi->getNumIncomingValues(); ++x)
547 if(bbC == phi->getIncomingBlock(x)) {
548 phi->addIncoming(Translate(phi->getIncomingValue(x)), bbCp);
549 cast<PHINode>(Translate(phi))->addIncoming(phi->getIncomingValue(x), bbC);
551 phi->removeIncomingValue(bbC);
555 bool ProfilerRS::runOnFunction(Function& F) {
556 if (!F.isExternal()) {
557 std::set<std::pair<BasicBlock*, BasicBlock*> > BackEdges;
558 RSProfilers& LI = getAnalysis<RSProfilers>();
560 getBackEdges(F, BackEdges);
562 for (std::set<std::pair<BasicBlock*, BasicBlock*> >::iterator ii = BackEdges.begin();
563 ii != BackEdges.end(); ++ii)
564 std::cerr << ii->first->getName() << " -> " << ii->second->getName() << "\n";
567 //assume that stuff worked. now connect the duplicated basic blocks
568 //with the originals in such a way as to preserve ssa. yuk!
569 for (std::set<std::pair<BasicBlock*, BasicBlock*> >::iterator ib = BackEdges.begin(),
570 ie = BackEdges.end(); ib != ie; ++ib)
571 ProcessBackEdge(ib->first, ib->second, F);
573 //oh, and add the edge from the reg2mem created entry node to the duplicated second node
574 TerminatorInst* T = F.getEntryBlock().getTerminator();
575 ReplaceInstWithInst(T, new BranchInst(T->getSuccessor(0),
576 cast<BasicBlock>(Translate(T->getSuccessor(0))),
577 ConstantBool::get(true)));
579 //do whatever is needed now that the function is duplicated
582 //add entry node to choice points
583 ChoicePoints.insert(&F.getEntryBlock());
585 for (std::set<BasicBlock*>::iterator ii = ChoicePoints.begin(), ie = ChoicePoints.end();
587 c->ProcessChoicePoint(*ii);
589 ChoicePoints.clear();
597 bool ProfilerRS::doInitialization(Module &M) {
598 switch (RandomMethod) {
600 c = new GlobalRandomCounter(M, Type::UIntTy, (1 << 14) - 1);
603 c = new GlobalRandomCounterOpt(M, Type::UIntTy, (1 << 14) - 1);
606 c = new CycleCounter(M, (1 << 14) - 1);
612 void ProfilerRS::getAnalysisUsage(AnalysisUsage &AU) const {
613 AU.addRequired<RSProfilers>();
614 AU.addRequiredID(DemoteRegisterToMemoryID);
617 ///////////////////////////////////////
619 ///////////////////////////////////////
620 static void ReplacePhiPred(BasicBlock* btarget,
621 BasicBlock* bold, BasicBlock* bnew) {
622 for(BasicBlock::iterator ib = btarget->begin(), ie = btarget->end();
624 if (PHINode* phi = dyn_cast<PHINode>(&*ib)) {
625 for(unsigned x = 0; x < phi->getNumIncomingValues(); ++x)
626 if(bold == phi->getIncomingBlock(x))
627 phi->setIncomingBlock(x, bnew);
631 static void CollapsePhi(BasicBlock* btarget, BasicBlock* bsrc) {
632 for(BasicBlock::iterator ib = btarget->begin(), ie = btarget->end();
634 if (PHINode* phi = dyn_cast<PHINode>(&*ib)) {
635 unsigned total = phi->getNumIncomingValues();
636 std::map<BasicBlock*, Value*> counter;
637 for(unsigned i = 0; i < phi->getNumIncomingValues(); ) {
638 if (counter[phi->getIncomingBlock(i)]) {
639 assert (phi->getIncomingValue(i) == counter[phi->getIncomingBlock(i)]);
640 phi->removeIncomingValue(i, false);
642 counter[phi->getIncomingBlock(i)] = phi->getIncomingValue(i);
650 static void recBackEdge(BasicBlock* bb, T& BackEdges,
651 std::map<BasicBlock*, int>& color,
652 std::map<BasicBlock*, int>& depth,
653 std::map<BasicBlock*, int>& finish,
659 TerminatorInst* t= bb->getTerminator();
660 for(unsigned i = 0; i < t->getNumSuccessors(); ++i) {
661 BasicBlock* bbnew = t->getSuccessor(i);
662 if (color[bbnew] == 0)
663 recBackEdge(bbnew, BackEdges, color, depth, finish, time);
664 else if (color[bbnew] == 1) {
665 BackEdges.insert(std::make_pair(bb, bbnew));
676 //find the back edges and where they go to
678 static void getBackEdges(Function& F, T& BackEdges) {
679 std::map<BasicBlock*, int> color;
680 std::map<BasicBlock*, int> depth;
681 std::map<BasicBlock*, int> finish;
683 recBackEdge(&F.getEntryBlock(), BackEdges, color, depth, finish, time);
684 DEBUG(std::cerr << F.getName() << " " << BackEdges.size() << "\n");
689 ModulePass* llvm::createBlockProfilerRSPass() {
690 return new BlockProfilerRS();
693 ModulePass* llvm::createFunctionProfilerRSPass() {
694 return new FunctionProfilerRS();
697 ModulePass* llvm::createNullProfilerRSPass() {
698 return new NullProfilerRS();
701 FunctionPass* llvm::createRSProfilingPass() {
702 return new ProfilerRS();