mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 00:32:23 +00:00
Removed header files from .h by adding forward decls.
Renamed PIC16FrameOverlay namespace to PIC16OVERLAY. Renamed PIC16FrameOverlay class to PIC16Overlay. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b2503c096f
commit
11979aa23e
@ -24,27 +24,27 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
char PIC16FrameOverlay::ID = 0;
|
char PIC16Overlay::ID = 0;
|
||||||
ModulePass *createPIC16OverlayPass() { return new PIC16FrameOverlay(); }
|
ModulePass *createPIC16OverlayPass() { return new PIC16Overlay(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIC16FrameOverlay::getAnalysisUsage(AnalysisUsage &AU) const {
|
void PIC16Overlay::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
AU.addRequired<CallGraph>();
|
AU.addRequired<CallGraph>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIC16FrameOverlay::DFSTraverse(CallGraphNode *CGN, unsigned Depth) {
|
void PIC16Overlay::DFSTraverse(CallGraphNode *CGN, unsigned Depth) {
|
||||||
// Do not set any color for external calling node.
|
// Do not set any color for external calling node.
|
||||||
if (Depth != 0 && CGN->getFunction()) {
|
if (Depth != 0 && CGN->getFunction()) {
|
||||||
unsigned Color = getColor(CGN->getFunction());
|
unsigned Color = getColor(CGN->getFunction());
|
||||||
|
|
||||||
// Handle indirectly called functions
|
// Handle indirectly called functions
|
||||||
if (Color >= PIC16Overlay::StartIndirectCallColor ||
|
if (Color >= PIC16OVERLAY::StartIndirectCallColor ||
|
||||||
Depth >= PIC16Overlay::StartIndirectCallColor) {
|
Depth >= PIC16OVERLAY::StartIndirectCallColor) {
|
||||||
// All functions called from an indirectly called function are given
|
// All functions called from an indirectly called function are given
|
||||||
// an unique color.
|
// an unique color.
|
||||||
if (Color < PIC16Overlay::StartIndirectCallColor &&
|
if (Color < PIC16OVERLAY::StartIndirectCallColor &&
|
||||||
Depth >= PIC16Overlay::StartIndirectCallColor)
|
Depth >= PIC16OVERLAY::StartIndirectCallColor)
|
||||||
setColor(CGN->getFunction(), Depth);
|
setColor(CGN->getFunction(), Depth);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < CGN->size(); i++)
|
for (unsigned int i = 0; i < CGN->size(); i++)
|
||||||
@ -65,7 +65,7 @@ void PIC16FrameOverlay::DFSTraverse(CallGraphNode *CGN, unsigned Depth) {
|
|||||||
DFSTraverse((*CGN)[i], Depth+1);
|
DFSTraverse((*CGN)[i], Depth+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PIC16FrameOverlay::ModifyDepthForInterrupt(CallGraphNode *CGN,
|
unsigned PIC16Overlay::ModifyDepthForInterrupt(CallGraphNode *CGN,
|
||||||
unsigned Depth) {
|
unsigned Depth) {
|
||||||
Function *Fn = CGN->getFunction();
|
Function *Fn = CGN->getFunction();
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ unsigned PIC16FrameOverlay::ModifyDepthForInterrupt(CallGraphNode *CGN,
|
|||||||
return Depth;
|
return Depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIC16FrameOverlay::setColor(Function *Fn, unsigned Color) {
|
void PIC16Overlay::setColor(Function *Fn, unsigned Color) {
|
||||||
std::string Section = "";
|
std::string Section = "";
|
||||||
if (Fn->hasSection())
|
if (Fn->hasSection())
|
||||||
Section = Fn->getSection();
|
Section = Fn->getSection();
|
||||||
@ -119,7 +119,7 @@ void PIC16FrameOverlay::setColor(Function *Fn, unsigned Color) {
|
|||||||
Fn->setSection(Section);
|
Fn->setSection(Section);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PIC16FrameOverlay::getColor(Function *Fn) {
|
unsigned PIC16Overlay::getColor(Function *Fn) {
|
||||||
int Color = 0;
|
int Color = 0;
|
||||||
if (!Fn->hasSection())
|
if (!Fn->hasSection())
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,7 +150,7 @@ unsigned PIC16FrameOverlay::getColor(Function *Fn) {
|
|||||||
return Color;
|
return Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PIC16FrameOverlay::runOnModule(Module &M) {
|
bool PIC16Overlay::runOnModule(Module &M) {
|
||||||
CallGraph &CG = getAnalysis<CallGraph>();
|
CallGraph &CG = getAnalysis<CallGraph>();
|
||||||
CallGraphNode *ECN = CG.getExternalCallingNode();
|
CallGraphNode *ECN = CG.getExternalCallingNode();
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ bool PIC16FrameOverlay::runOnModule(Module &M) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIC16FrameOverlay::MarkIndirectlyCalledFunctions(Module &M) {
|
void PIC16Overlay::MarkIndirectlyCalledFunctions(Module &M) {
|
||||||
// If the use of a function is not a call instruction then this
|
// If the use of a function is not a call instruction then this
|
||||||
// function might be called indirectly. In that case give it
|
// function might be called indirectly. In that case give it
|
||||||
// an unique color.
|
// an unique color.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- PIC16FrameOverlay.h - Interface for PIC16 Frame Overlay -*- C++ -*-===//
|
//===-- PIC16Overlay.h - Interface for PIC16 Frame Overlay -*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@ -14,30 +14,35 @@
|
|||||||
#ifndef PIC16FRAMEOVERLAY_H
|
#ifndef PIC16FRAMEOVERLAY_H
|
||||||
#define PIC16FRAMEOVERLAY_H
|
#define PIC16FRAMEOVERLAY_H
|
||||||
|
|
||||||
#include "llvm/Analysis/CallGraph.h"
|
|
||||||
#include "llvm/Pass.h"
|
|
||||||
#include "llvm/CallGraphSCCPass.h"
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace PIC16Overlay {
|
// Forward declarations.
|
||||||
|
class Function;
|
||||||
|
class Module;
|
||||||
|
class ModulePass;
|
||||||
|
class AnalysisUsage;
|
||||||
|
class CallGraphNode;
|
||||||
|
class CallGraph;
|
||||||
|
|
||||||
|
namespace PIC16OVERLAY {
|
||||||
enum OverlayConsts {
|
enum OverlayConsts {
|
||||||
StartInterruptColor = 200,
|
StartInterruptColor = 200,
|
||||||
StartIndirectCallColor = 300
|
StartIndirectCallColor = 300
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
class PIC16FrameOverlay : public ModulePass {
|
class PIC16Overlay : public ModulePass {
|
||||||
std::string OverlayStr;
|
std::string OverlayStr;
|
||||||
unsigned InterruptDepth;
|
unsigned InterruptDepth;
|
||||||
unsigned IndirectCallColor;
|
unsigned IndirectCallColor;
|
||||||
public:
|
public:
|
||||||
static char ID; // Class identification
|
static char ID; // Class identification
|
||||||
PIC16FrameOverlay() : ModulePass(&ID) {
|
PIC16Overlay() : ModulePass(&ID) {
|
||||||
OverlayStr = "Overlay=";
|
OverlayStr = "Overlay=";
|
||||||
InterruptDepth = PIC16Overlay::StartInterruptColor;
|
InterruptDepth = PIC16OVERLAY::StartInterruptColor;
|
||||||
IndirectCallColor = PIC16Overlay::StartIndirectCallColor;
|
IndirectCallColor = PIC16OVERLAY::StartIndirectCallColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user