Revert r110396 to fix buildbots.
[oota-llvm.git] / lib / Target / PIC16 / PIC16Passes / PIC16Overlay.h
1 //===-- PIC16Overlay.h - Interface for PIC16 Frame Overlay -*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source 
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the PIC16 Overlay infrastructure.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef PIC16FRAMEOVERLAY_H
15 #define PIC16FRAMEOVERLAY_H
16  
17
18 using std::string;
19 using namespace llvm;
20
21 namespace  llvm {
22   // Forward declarations.
23   class Function;
24   class Module;
25   class ModulePass;
26   class AnalysisUsage;
27   class CallGraphNode;
28   class CallGraph;
29
30   namespace PIC16OVERLAY {
31     enum OverlayConsts {
32       StartInterruptColor = 200,
33       StartIndirectCallColor = 300
34     }; 
35   }
36   class PIC16Overlay : public ModulePass {
37     std::string OverlayStr;
38     unsigned InterruptDepth;
39     unsigned IndirectCallColor;
40   public:
41     static char ID; // Class identification 
42     PIC16Overlay() : ModulePass(&ID) {
43       OverlayStr = "Overlay=";
44       InterruptDepth = PIC16OVERLAY::StartInterruptColor;
45       IndirectCallColor = PIC16OVERLAY::StartIndirectCallColor;
46     }
47
48     virtual void getAnalysisUsage(AnalysisUsage &AU) const; 
49     virtual bool runOnModule(Module &M);
50
51   private: 
52     unsigned getColor(Function *Fn);
53     void setColor(Function *Fn, unsigned Color);
54     unsigned ModifyDepthForInterrupt(CallGraphNode *CGN, unsigned Depth);
55     void MarkIndirectlyCalledFunctions(Module &M);
56     void DFSTraverse(CallGraphNode *CGN, unsigned Depth);
57   };
58 }  // End of  namespace
59
60 #endif