From 2268684f6fef2ef7e5b523d21dbd376f09ec1174 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 1 May 2004 21:27:53 +0000 Subject: [PATCH] Iterate over the Machine CFG that Brian added instead of the LLVM CFG. Look at all of the pretty minuses. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13303 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/FloatingPoint.cpp | 25 ++++--------------------- lib/Target/X86/X86FloatingPoint.cpp | 25 ++++--------------------- 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/lib/Target/X86/FloatingPoint.cpp b/lib/Target/X86/FloatingPoint.cpp index e47554b57b4..b6a9ebfdd75 100644 --- a/lib/Target/X86/FloatingPoint.cpp +++ b/lib/Target/X86/FloatingPoint.cpp @@ -37,8 +37,6 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Function.h" // FIXME: remove when using MBB CFG! -#include "llvm/Support/CFG.h" // FIXME: remove when using MBB CFG! #include "Support/Debug.h" #include "Support/DepthFirstIterator.h" #include "Support/Statistic.h" @@ -161,31 +159,16 @@ bool FPS::runOnMachineFunction(MachineFunction &MF) { LV = &getAnalysis(); StackTop = 0; - // Figure out the mapping of MBB's to BB's. - // - // FIXME: Eventually we should be able to traverse the MBB CFG directly, and - // we will need to extend this when one llvm basic block can codegen to - // multiple MBBs. - // - // FIXME again: Just use the mapping established by LiveVariables! - // - std::map MBBMap; - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) - MBBMap[I->getBasicBlock()] = I; - // Process the function in depth first order so that we process at least one // of the predecessors for every reachable block in the function. - std::set Processed; - const BasicBlock *Entry = MF.getFunction()->begin(); + std::set Processed; + MachineBasicBlock *Entry = MF.begin(); bool Changed = false; - for (df_ext_iterator > + for (df_ext_iterator > I = df_ext_begin(Entry, Processed), E = df_ext_end(Entry, Processed); I != E; ++I) - Changed |= processBasicBlock(MF, *MBBMap[*I]); - - assert(MBBMap.size() == Processed.size() && - "Doesn't handle unreachable code yet!"); + Changed |= processBasicBlock(MF, **I); return Changed; } diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp index e47554b57b4..b6a9ebfdd75 100644 --- a/lib/Target/X86/X86FloatingPoint.cpp +++ b/lib/Target/X86/X86FloatingPoint.cpp @@ -37,8 +37,6 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Function.h" // FIXME: remove when using MBB CFG! -#include "llvm/Support/CFG.h" // FIXME: remove when using MBB CFG! #include "Support/Debug.h" #include "Support/DepthFirstIterator.h" #include "Support/Statistic.h" @@ -161,31 +159,16 @@ bool FPS::runOnMachineFunction(MachineFunction &MF) { LV = &getAnalysis(); StackTop = 0; - // Figure out the mapping of MBB's to BB's. - // - // FIXME: Eventually we should be able to traverse the MBB CFG directly, and - // we will need to extend this when one llvm basic block can codegen to - // multiple MBBs. - // - // FIXME again: Just use the mapping established by LiveVariables! - // - std::map MBBMap; - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) - MBBMap[I->getBasicBlock()] = I; - // Process the function in depth first order so that we process at least one // of the predecessors for every reachable block in the function. - std::set Processed; - const BasicBlock *Entry = MF.getFunction()->begin(); + std::set Processed; + MachineBasicBlock *Entry = MF.begin(); bool Changed = false; - for (df_ext_iterator > + for (df_ext_iterator > I = df_ext_begin(Entry, Processed), E = df_ext_end(Entry, Processed); I != E; ++I) - Changed |= processBasicBlock(MF, *MBBMap[*I]); - - assert(MBBMap.size() == Processed.size() && - "Doesn't handle unreachable code yet!"); + Changed |= processBasicBlock(MF, **I); return Changed; } -- 2.34.1