Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace {
- // Hello - The first implementation, without getAnalysisUsage.
- struct Hello : public ModulePass {
- static char ID; // Pass identification, replacement for typeid
- Hello() : ModulePass(ID) {}
- bool runOnModule(Module &M) override {
- if (auto main = M.getFunction("main")) {
- ValueToValueMapTy vmap;
- auto newF = CloneFunction(main, vmap, true);
- M.getFunctionList().push_back(newF);
- IRBuilder<> IRB(&*main->getEntryBlock().getFirstInsertionPt());
- IRB.CreateCall(newF, {&main->getArgumentList().front(), &main->getArgumentList().back()});
- }
- return true;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement