1 //===-- PIC16Cloner.h - PIC16 LLVM Cloner for shared functions --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains declaration of a cloner class clone all functions that
11 // are shared between the main line code (ML) and interrupt line code (IL).
13 //===----------------------------------------------------------------------===//
18 #include "llvm/ADT/DenseMap.h"
35 class PIC16Cloner : public ModulePass {
37 static char ID; // Class identification
38 PIC16Cloner() : ModulePass(&ID) {}
40 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired<CallGraph>();
43 virtual bool runOnModule(Module &M);
46 // Mark reachable functions for the MainLine or InterruptLine.
47 void markCallGraph(CallGraphNode *CGN, string StringMark);
49 // Clone auto variables of function specified.
50 void CloneAutos(Function *F);
52 // Error reporting for PIC16Pass
53 void reportError(string ErrorString, vector<string> &Values);
54 void reportError(string ErrorString);
57 // Records if the interrupt function has already been found.
58 // If more than one interrupt function is found then an error
62 // This ValueMap maps the auto variables of the original functions with
63 // the corresponding cloned auto variable of the cloned function.
64 // This value map is passed during the function cloning so that all the
65 // uses of auto variables be updated properly.
66 DenseMap<const Value*, Value*> ValueMap;
68 } // End of anonymous namespace