//===- Pass1.cpp - Example code from "Writing an LLVM Pass" ---------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements two versions of the LLVM "Hello World" pass described
// in docs/WritingAnLLVMPass.html
//
//===----------------------------------------------------------------------===//

#define DEBUG_TYPE "pass1"

// LLVM-related headers:
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/Statistic.h"

// dependent class header(s):
#include "Pass1.h"

// default namespace is llvm
using namespace llvm;



bool Pass1::runOnFunction(Function &F) {
  Counter++;
  errs() << "Hello: ";
  errs().write_escaped(F.getName()) << '\n';
  return false;
}

bool Pass1::doFinalization(Module &M){
  errs() <<"Counter: " << Counter << '\n';
  return false;
}


char Pass1::ID = 0;
static RegisterPass<Pass1>
Y("pass1", "Pass1 (Analysis Pass)");

