aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-05-14 19:17:24 +0000
committerOwen Anderson <resistor@mac.com>2009-05-14 19:17:24 +0000
commit2b2c0d716a6a6ebdf5fdb805d9a639dcc057d83a (patch)
tree0f8a6fd1fb5173cbd6cae97bf65c1d42e409cb55 /lib
parenta681515ee695b9209f49998588e27a33f40a8881 (diff)
downloadexternal_llvm-2b2c0d716a6a6ebdf5fdb805d9a639dcc057d83a.zip
external_llvm-2b2c0d716a6a6ebdf5fdb805d9a639dcc057d83a.tar.gz
external_llvm-2b2c0d716a6a6ebdf5fdb805d9a639dcc057d83a.tar.bz2
Down with static variables!
Part one of many. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/MachineFunction.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index 5135308..cacfed1 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -35,9 +35,6 @@
#include <sstream>
using namespace llvm;
-static AnnotationID MF_AID(
- AnnotationManager::getID("CodeGen::MachineCodeForFunction"));
-
bool MachineFunctionPass::runOnFunction(Function &F) {
// Do not codegen any 'available_externally' functions at all, they have
// definitions outside the translation unit.
@@ -115,7 +112,8 @@ void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
MachineFunction::MachineFunction(const Function *F,
const TargetMachine &TM)
- : Annotation(MF_AID), Fn(F), Target(TM) {
+ : Annotation(AnnotationManager::getID("CodeGen::MachineCodeForFunction")),
+ Fn(F), Target(TM) {
if (TM.getRegisterInfo())
RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
MachineRegisterInfo(*TM.getRegisterInfo());
@@ -365,6 +363,8 @@ void MachineFunction::viewCFGOnly() const
MachineFunction&
MachineFunction::construct(const Function *Fn, const TargetMachine &Tar)
{
+ AnnotationID MF_AID =
+ AnnotationManager::getID("CodeGen::MachineCodeForFunction");
assert(Fn->getAnnotation(MF_AID) == 0 &&
"Object already exists for this function!");
MachineFunction* mcInfo = new MachineFunction(Fn, Tar);
@@ -373,6 +373,8 @@ MachineFunction::construct(const Function *Fn, const TargetMachine &Tar)
}
void MachineFunction::destruct(const Function *Fn) {
+ AnnotationID MF_AID =
+ AnnotationManager::getID("CodeGen::MachineCodeForFunction");
bool Deleted = Fn->deleteAnnotation(MF_AID);
assert(Deleted && "Machine code did not exist for function!");
Deleted = Deleted; // silence warning when no assertions.
@@ -380,6 +382,8 @@ void MachineFunction::destruct(const Function *Fn) {
MachineFunction& MachineFunction::get(const Function *F)
{
+ AnnotationID MF_AID =
+ AnnotationManager::getID("CodeGen::MachineCodeForFunction");
MachineFunction *mc = (MachineFunction*)F->getAnnotation(MF_AID);
assert(mc && "Call construct() method first to allocate the object");
return *mc;