Skip to content

Instantly share code, notes, and snippets.

@sherjilozair
Created August 12, 2014 13:02
Show Gist options
  • Save sherjilozair/58db8273c921baa07746 to your computer and use it in GitHub Desktop.
Save sherjilozair/58db8273c921baa07746 to your computer and use it in GitHub Desktop.
#include "llvm/Pass.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
struct VAC : public ModulePass {
static char ID;
VAC() : ModulePass(ID) {}
virtual bool runOnModule(Module &M) {
for (Module::iterator F = M.begin(), FE = M.end(); F != FE; ++F){
Function *f = F;
for(Function::iterator B = f->begin(), BE = f->end(); B != BE; ++B){
BasicBlock *b = B;
for(BasicBlock::iterator I = b->begin(), IE = b->end(); I != IE; ++I){
Instruction *i = I;
errs() << "\tI (" << i->getName()<<")\n";
}
}
}
return false;
}
};
}
char VAC::ID = 0;
static RegisterPass<VAC> X("vac", "VAC Pass", false, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment