From: Brian Gaeke Date: Tue, 24 Feb 2004 19:46:00 +0000 (+0000) Subject: FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=748fba141fc81dc15dbe94d88ada5da9fcad196d;p=oota-llvm.git FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11804 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/FunctionLiveVarInfo.h b/include/llvm/CodeGen/FunctionLiveVarInfo.h deleted file mode 100644 index 23a9d93a6eb..00000000000 --- a/include/llvm/CodeGen/FunctionLiveVarInfo.h +++ /dev/null @@ -1,111 +0,0 @@ -//===-- CodeGen/FunctionLiveVarInfo.h - LiveVar Analysis --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This is the interface for live variable info of a function that is required -// by any other part of the compiler -// -// After the analysis, getInSetOfBB or getOutSetofBB can be called to get -// live var info of a BB. -// -// The live var set before an instruction can be obtained in 2 ways: -// -// 1. Use the method getLiveVarSetAfterInst(Instruction *) to get the LV Info -// just after an instruction. (also exists getLiveVarSetBeforeInst(..)) -// -// This function caluclates the LV info for a BB only once and caches that -// info. If the cache does not contain the LV info of the instruction, it -// calculates the LV info for the whole BB and caches them. -// -// Getting liveVar info this way uses more memory since, LV info should be -// cached. However, if you need LV info of nearly all the instructions of a -// BB, this is the best and simplest interfrace. -// -// 2. Use the OutSet and applyTranferFuncForInst(const Instruction *const Inst) -// declared in LiveVarSet and traverse the instructions of a basic block in -// reverse (using const_reverse_iterator in the BB class). -// -//===----------------------------------------------------------------------===// - -#ifndef FUNCTION_LIVE_VAR_INFO_H -#define FUNCTION_LIVE_VAR_INFO_H - -#include "Support/hash_map" -#include "llvm/Pass.h" -#include "llvm/CodeGen/ValueSet.h" - -namespace llvm { - -class BBLiveVar; -class MachineInstr; - -class FunctionLiveVarInfo : public FunctionPass { - // Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst - // These sets are owned by this map and will be freed in releaseMemory(). - hash_map MInst2LVSetBI; - - // Machine Instr to LiveVarSet Map for providing LVset AFTER each inst. - // These sets are just pointers to sets in MInst2LVSetBI or BBLiveVar. - hash_map MInst2LVSetAI; - - hash_map BBLiveVarInfo; - - // Stored Function that the data is computed with respect to - const Function *M; - - // --------- private methods ----------------------------------------- - - // constructs BBLiveVars and init Def and In sets - void constructBBs(const Function *F); - - // do one backward pass over the CFG - bool doSingleBackwardPass(const Function *F, unsigned int iter); - - // calculates live var sets for instructions in a BB - void calcLiveVarSetsForBB(const BasicBlock *BB); - -public: - // --------- Implement the FunctionPass interface ---------------------- - - // runOnFunction - Perform analysis, update internal data structures. - virtual bool runOnFunction(Function &F); - - // releaseMemory - After LiveVariable analysis has been used, forget! - virtual void releaseMemory(); - - // getAnalysisUsage - Provide self! - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - } - - // --------- Functions to access analysis results ------------------- - - // get OutSet of a BB - const ValueSet &getOutSetOfBB(const BasicBlock *BB) const; - ValueSet &getOutSetOfBB(const BasicBlock *BB) ; - - // get InSet of a BB - const ValueSet &getInSetOfBB(const BasicBlock *BB) const; - ValueSet &getInSetOfBB(const BasicBlock *BB) ; - - // gets the Live var set BEFORE an instruction. - // if BB is specified and the live var set has not yet been computed, - // it will be computed on demand. - const ValueSet &getLiveVarSetBeforeMInst(const MachineInstr *MI, - const BasicBlock *BB = 0); - - // gets the Live var set AFTER an instruction - // if BB is specified and the live var set has not yet been computed, - // it will be computed on demand. - const ValueSet &getLiveVarSetAfterMInst(const MachineInstr *MI, - const BasicBlock *BB = 0); -}; - -} // End llvm namespace - -#endif diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp index 40324322472..4fad07eae8f 100644 --- a/lib/CodeGen/InstrSched/InstrScheduling.cpp +++ b/lib/CodeGen/InstrSched/InstrScheduling.cpp @@ -16,7 +16,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/FunctionLiveVarInfo.h" +#include "../../Target/Sparc/LiveVar/FunctionLiveVarInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/BasicBlock.h" #include "Support/CommandLine.h" diff --git a/lib/CodeGen/InstrSched/SchedPriorities.cpp b/lib/CodeGen/InstrSched/SchedPriorities.cpp index b5bc38e8a07..aab44346358 100644 --- a/lib/CodeGen/InstrSched/SchedPriorities.cpp +++ b/lib/CodeGen/InstrSched/SchedPriorities.cpp @@ -18,7 +18,7 @@ //===----------------------------------------------------------------------===// #include "SchedPriorities.h" -#include "llvm/CodeGen/FunctionLiveVarInfo.h" +#include "../../Target/Sparc/LiveVar/FunctionLiveVarInfo.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/CFG.h" #include "Support/PostOrderIterator.h" diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp index 40324322472..4fad07eae8f 100644 --- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp +++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp @@ -16,7 +16,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/FunctionLiveVarInfo.h" +#include "../../Target/Sparc/LiveVar/FunctionLiveVarInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/BasicBlock.h" #include "Support/CommandLine.h" diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp index b5bc38e8a07..aab44346358 100644 --- a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp @@ -18,7 +18,7 @@ //===----------------------------------------------------------------------===// #include "SchedPriorities.h" -#include "llvm/CodeGen/FunctionLiveVarInfo.h" +#include "../../Target/Sparc/LiveVar/FunctionLiveVarInfo.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/CFG.h" #include "Support/PostOrderIterator.h" diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp index e3515e8bdbe..9f9aaf5ddef 100644 --- a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp +++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "BBLiveVar.h" -#include "llvm/CodeGen/FunctionLiveVarInfo.h" +#include "FunctionLiveVarInfo.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/CFG.h" diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp index e2822c300e8..9d5492371a7 100644 --- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp +++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/CodeGen/FunctionLiveVarInfo.h" +#include "FunctionLiveVarInfo.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Target/TargetMachine.h" diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h new file mode 100644 index 00000000000..23a9d93a6eb --- /dev/null +++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h @@ -0,0 +1,111 @@ +//===-- CodeGen/FunctionLiveVarInfo.h - LiveVar Analysis --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This is the interface for live variable info of a function that is required +// by any other part of the compiler +// +// After the analysis, getInSetOfBB or getOutSetofBB can be called to get +// live var info of a BB. +// +// The live var set before an instruction can be obtained in 2 ways: +// +// 1. Use the method getLiveVarSetAfterInst(Instruction *) to get the LV Info +// just after an instruction. (also exists getLiveVarSetBeforeInst(..)) +// +// This function caluclates the LV info for a BB only once and caches that +// info. If the cache does not contain the LV info of the instruction, it +// calculates the LV info for the whole BB and caches them. +// +// Getting liveVar info this way uses more memory since, LV info should be +// cached. However, if you need LV info of nearly all the instructions of a +// BB, this is the best and simplest interfrace. +// +// 2. Use the OutSet and applyTranferFuncForInst(const Instruction *const Inst) +// declared in LiveVarSet and traverse the instructions of a basic block in +// reverse (using const_reverse_iterator in the BB class). +// +//===----------------------------------------------------------------------===// + +#ifndef FUNCTION_LIVE_VAR_INFO_H +#define FUNCTION_LIVE_VAR_INFO_H + +#include "Support/hash_map" +#include "llvm/Pass.h" +#include "llvm/CodeGen/ValueSet.h" + +namespace llvm { + +class BBLiveVar; +class MachineInstr; + +class FunctionLiveVarInfo : public FunctionPass { + // Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst + // These sets are owned by this map and will be freed in releaseMemory(). + hash_map MInst2LVSetBI; + + // Machine Instr to LiveVarSet Map for providing LVset AFTER each inst. + // These sets are just pointers to sets in MInst2LVSetBI or BBLiveVar. + hash_map MInst2LVSetAI; + + hash_map BBLiveVarInfo; + + // Stored Function that the data is computed with respect to + const Function *M; + + // --------- private methods ----------------------------------------- + + // constructs BBLiveVars and init Def and In sets + void constructBBs(const Function *F); + + // do one backward pass over the CFG + bool doSingleBackwardPass(const Function *F, unsigned int iter); + + // calculates live var sets for instructions in a BB + void calcLiveVarSetsForBB(const BasicBlock *BB); + +public: + // --------- Implement the FunctionPass interface ---------------------- + + // runOnFunction - Perform analysis, update internal data structures. + virtual bool runOnFunction(Function &F); + + // releaseMemory - After LiveVariable analysis has been used, forget! + virtual void releaseMemory(); + + // getAnalysisUsage - Provide self! + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + + // --------- Functions to access analysis results ------------------- + + // get OutSet of a BB + const ValueSet &getOutSetOfBB(const BasicBlock *BB) const; + ValueSet &getOutSetOfBB(const BasicBlock *BB) ; + + // get InSet of a BB + const ValueSet &getInSetOfBB(const BasicBlock *BB) const; + ValueSet &getInSetOfBB(const BasicBlock *BB) ; + + // gets the Live var set BEFORE an instruction. + // if BB is specified and the live var set has not yet been computed, + // it will be computed on demand. + const ValueSet &getLiveVarSetBeforeMInst(const MachineInstr *MI, + const BasicBlock *BB = 0); + + // gets the Live var set AFTER an instruction + // if BB is specified and the live var set has not yet been computed, + // it will be computed on demand. + const ValueSet &getLiveVarSetAfterMInst(const MachineInstr *MI, + const BasicBlock *BB = 0); +}; + +} // End llvm namespace + +#endif diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp index a33d5c9366e..7b224119cef 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp @@ -25,13 +25,13 @@ #include "PhyRegAlloc.h" #include "RegAllocCommon.h" #include "RegClass.h" +#include "../LiveVar/FunctionLiveVarInfo.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/iOther.h" #include "llvm/Module.h" #include "llvm/Type.h" #include "llvm/Analysis/LoopInfo.h" -#include "llvm/CodeGen/FunctionLiveVarInfo.h" #include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineFunction.h"