[llvm-commits] [llvm] r151252 - in /llvm/trunk: include/llvm/CodeGen/DFAPacketizer.h lib/CodeGen/DFAPacketizer.cpp
Benjamin Kramer
benny.kra at googlemail.com
Thu Feb 23 05:39:13 PST 2012
Author: d0k
Date: Thu Feb 23 07:39:13 2012
New Revision: 151252
URL: http://llvm.org/viewvc/llvm-project?rev=151252&view=rev
Log:
Strip a layer of boilerplate from the VLIWPacketizer by storing the scheduler as an opaque pointer.
Modified:
llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h
llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
Modified: llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h?rev=151252&r1=151251&r2=151252&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h Thu Feb 23 07:39:13 2012
@@ -36,7 +36,6 @@
class MachineLoopInfo;
class MachineDominatorTree;
class InstrItineraryData;
-class VLIWPacketizerImpl;
class SUnit;
class DFAPacketizer {
@@ -92,7 +91,7 @@
const TargetInstrInfo *TII;
// Encapsulate data types not exposed to the target interface.
- VLIWPacketizerImpl *Impl;
+ void *SchedulerImpl;
protected:
// Vector of instructions assigned to the current packet.
Modified: llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DFAPacketizer.cpp?rev=151252&r1=151251&r2=151252&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DFAPacketizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/DFAPacketizer.cpp Thu Feb 23 07:39:13 2012
@@ -104,8 +104,8 @@
// DefaultVLIWScheduler - This class extends ScheduleDAGInstrs and overrides
// Schedule method to build the dependence graph.
//
-// ScheduleDAGInstrs has LLVM_LIBRARY_VISIBILITY so cannot be exposed to the
-// VLIWPacketizerImpl interface, even as an undefined pointer.
+// ScheduleDAGInstrs has LLVM_LIBRARY_VISIBILITY so we have to reference it as
+// an opaque pointer in VLIWPacketizerList.
class DefaultVLIWScheduler : public ScheduleDAGInstrs {
public:
DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI,
@@ -113,18 +113,7 @@
// Schedule - Actual scheduling work.
void Schedule();
};
-}
-
-namespace llvm {
-// Wrapper for holding library-local data types.
-class VLIWPacketizerImpl {
-public:
- DefaultVLIWScheduler DAGBuilder;
- VLIWPacketizerImpl(MachineFunction &MF, MachineLoopInfo &MLI,
- MachineDominatorTree &MDT, bool IsPostRA)
- : DAGBuilder(MF, MLI, MDT, IsPostRA) {}
-};
-}
+} // end anonymous namespace
DefaultVLIWScheduler::DefaultVLIWScheduler(
MachineFunction &MF, MachineLoopInfo &MLI, MachineDominatorTree &MDT,
@@ -143,12 +132,12 @@
bool IsPostRA) : TM(MF.getTarget()), MF(MF) {
TII = TM.getInstrInfo();
ResourceTracker = TII->CreateTargetScheduleState(&TM, 0);
- Impl = new VLIWPacketizerImpl(MF, MLI, MDT, IsPostRA);
+ SchedulerImpl = new DefaultVLIWScheduler(MF, MLI, MDT, IsPostRA);
}
// VLIWPacketizerList Dtor
VLIWPacketizerList::~VLIWPacketizerList() {
- delete Impl;
+ delete (DefaultVLIWScheduler *)SchedulerImpl;
delete ResourceTracker;
}
@@ -195,10 +184,11 @@
void VLIWPacketizerList::PacketizeMIs(MachineBasicBlock *MBB,
MachineBasicBlock::iterator BeginItr,
MachineBasicBlock::iterator EndItr) {
- Impl->DAGBuilder.Run(MBB, BeginItr, EndItr, MBB->size());
+ DefaultVLIWScheduler *Scheduler = (DefaultVLIWScheduler *)SchedulerImpl;
+ Scheduler->Run(MBB, BeginItr, EndItr, MBB->size());
// Remember scheduling units.
- SUnits = Impl->DAGBuilder.SUnits;
+ SUnits = Scheduler->SUnits;
// Generate MI -> SU map.
std::map <MachineInstr*, SUnit*> MIToSUnit;
More information about the llvm-commits
mailing list