aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-10-20 21:44:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-10-20 21:44:59 +0000
commit09e8ca8a582bb67ef290d77d9b9441716dd6ba2e (patch)
treec1e8f265dd2b82a5a9dc0f716686ad9d0cbe58b9
parent932a32d2512353478d16c4101582adff404a55a5 (diff)
Add skeleton for the pre-register allocation live interval splitting pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57847 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/Passes.h2
-rw-r--r--lib/CodeGen/PreAllocSplitting.cpp81
2 files changed, 83 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h
index e07f7de12a..6357f0635b 100644
--- a/include/llvm/CodeGen/Passes.h
+++ b/include/llvm/CodeGen/Passes.h
@@ -61,6 +61,8 @@ namespace llvm {
/// This pass is still in development
extern const PassInfo *const StrongPHIEliminationID;
+ extern const PassInfo *const PreAllocSplittingID;
+
/// SimpleRegisterCoalescing pass. Aggressively coalesces every register
/// copy it can.
///
diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp
new file mode 100644
index 0000000000..7b4ec8efbc
--- /dev/null
+++ b/lib/CodeGen/PreAllocSplitting.cpp
@@ -0,0 +1,81 @@
+//===-- PreAllocSplitting.cpp - Pre-allocation Interval Spltting Pass. ----===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the machine instruction level pre-register allocation
+// live interval splitting pass. It finds live interval barriers, i.e.
+// instructions which will kill all physical registers in certain register
+// classes, and split all live intervals which cross the barrier.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "pre-alloc-split"
+#include "llvm/CodeGen/LiveIntervalAnalysis.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/CodeGen/RegisterCoalescer.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/SmallPtrSet.h"
+using namespace llvm;
+
+namespace {
+ class VISIBILITY_HIDDEN PreAllocSplitting : public MachineFunctionPass {
+ // ProcessedBarriers - Register live interval barriers that have already
+ // been processed.
+ SmallPtrSet<MachineInstr*, 16> ProcessedBarriers;
+
+ // ActiveBarriers - Register live interval barriers that are currently
+ // being processed.
+ SmallSet<unsigned, 16> ActiveBarriers;
+ public:
+ static char ID;
+ PreAllocSplitting() : MachineFunctionPass(&ID) {}
+
+ virtual bool runOnMachineFunction(MachineFunction &MF);
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.addRequired<LiveIntervals>();
+ AU.addPreserved<LiveIntervals>();
+ AU.addPreserved<MachineLoopInfo>();
+ AU.addPreserved<RegisterCoalescer>();
+ if (StrongPHIElim)
+ AU.addPreservedID(StrongPHIEliminationID);
+ else
+ AU.addPreservedID(PHIEliminationID);
+ AU.addPreservedID(TwoAddressInstructionPassID);
+ MachineFunctionPass::getAnalysisUsage(AU);
+ }
+
+ virtual void releaseMemory() {
+ ProcessedBarriers.clear();
+ ActiveBarriers.clear();
+ }
+
+ virtual const char *getPassName() const {
+ return "Pre-Register Allocaton Live Interval Splitting";
+ }
+ };
+} // end anonymous namespace
+
+char PreAllocSplitting::ID = 0;
+
+static RegisterPass<PreAllocSplitting>
+X("pre-alloc-splitting", "Pre-Register Allocation Live Interval Splitting");
+
+const PassInfo *const llvm::PreAllocSplittingID = &X;
+
+bool PreAllocSplitting::runOnMachineFunction(MachineFunction &MF) {
+ return false;
+}