1 //===-- PIC16FrameOverlay.h - Interface for PIC16 Frame Overlay -*- 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 the PIC16 Overlay infrastructure.
12 //===----------------------------------------------------------------------===//
14 #ifndef PIC16FRAMEOVERLAY_H
15 #define PIC16FRAMEOVERLAY_H
17 #include "llvm/Analysis/CallGraph.h"
18 #include "llvm/Pass.h"
19 #include "llvm/CallGraphSCCPass.h"
25 namespace PIC16Overlay {
27 StartInterruptColor = 200,
28 StartIndirectCallColor = 300
31 class PIC16FrameOverlay : public ModulePass {
32 std::string OverlayStr;
33 unsigned InterruptDepth;
34 unsigned IndirectCallColor;
36 static char ID; // Class identification
37 PIC16FrameOverlay() : ModulePass(&ID) {
38 OverlayStr = "Overlay=";
39 InterruptDepth = PIC16Overlay::StartInterruptColor;
40 IndirectCallColor = PIC16Overlay::StartIndirectCallColor;
43 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
44 virtual bool runOnModule(Module &M);
47 unsigned getColor(Function *Fn);
48 void setColor(Function *Fn, unsigned Color);
49 unsigned ModifyDepthForInterrupt(CallGraphNode *CGN, unsigned Depth);
50 void MarkIndirectlyCalledFunctions(Module &M);
51 void DFSTraverse(CallGraphNode *CGN, unsigned Depth);