#ifndef _CALL_GRAPH_H
#define _CALL_GRAPH_H

#include "Global.h"

class CallGraphPass : public IterativeModulePass {
private:
    llvm::Function *getFuncDef(llvm::Function *F);
    bool runOnFunction(llvm::Function*);
    bool isCompatibleType(llvm::Type *T1, llvm::Type *T2);
    bool findCalleesByType(llvm::CallInst*, FuncSet&);

public:
    CallGraphPass(GlobalContext *Ctx_)
        : IterativeModulePass(Ctx_, "CallGraph") { }
    virtual bool doInitialization(llvm::Module *);
    virtual bool doFinalization(llvm::Module *);
    virtual bool doModulePass(llvm::Module *);

    // debug
    void dumpCallees();
};

#endif
