LLVM: lib/CodeGen/DFAPacketizer.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

38#include

39#include

40#include

41#include

42

43using namespace llvm;

44

45#define DEBUG_TYPE "packets"

46

48 cl::init(0), cl::desc("If present, stops packetizing after N instructions"));

49

51

52

53

55 unsigned Action = ItinActions[MID->getSchedClass()];

57 return false;

58 return A.canAdd(Action);

59}

60

61

62

64 unsigned Action = ItinActions[MID->getSchedClass()];

66 return;

67 A.add(Action);

68}

69

70

71

76

77

78

83

86 assert(!NfaPaths.empty() && "Invalid bundle!");

88

89

90

91 if (InstIdx == 0)

92 return RS[0];

93

94

95 return RS[InstIdx] ^ RS[InstIdx - 1];

96}

97

104

105

107 for (auto &M : Mutations)

108 M->apply(this);

109}

110

116

119 : MF(mf), TII(mf.getSubtarget().getInstrInfo()), AA(aa) {

123}

124

129

130

135 dbgs() << "Finalizing packet:\n";

136 unsigned Idx = 0;

140 }

141 }

142 });

146 }

150}

151

152

159 std::distance(BeginItr, EndItr));

161

163 dbgs() << "Scheduling DAG of the packetize region\n";

165 });

166

167

171

172 bool LimitPresent = InstrLimit.getPosition();

173

174

175 for (; BeginItr != EndItr; ++BeginItr) {

176 if (LimitPresent) {

178 EndItr = BeginItr;

179 break;

180 }

182 }

185

186

189 continue;

190 }

191

192

194 continue;

195

197 assert(SUI && "Missing SUnit Info!");

198

199

200 LLVM_DEBUG(dbgs() << "Checking resources for adding MI to packet " << MI);

201

204 if (ResourceAvail)

205 dbgs() << " Resources are available for adding MI to packet\n";

206 else

207 dbgs() << " Resources NOT available\n";

208 });

210

213 assert(SUJ && "Missing SUnit Info!");

214

215 LLVM_DEBUG(dbgs() << " Checking against MJ " << *MJ);

216

218 LLVM_DEBUG(dbgs() << " Not legal to add MI, try to prune\n");

219

221

223 << " Could not prune dependencies for adding MI\n");

225 break;

226 }

227 LLVM_DEBUG(dbgs() << " Pruned dependence for adding MI\n");

228 }

229 }

230 } else {

232 << "Resources are available, but instruction should not be "

233 "added to packet\n "

234 << MI);

235

236

238 }

239

240

241 LLVM_DEBUG(dbgs() << "* Adding MI to packet " << MI << '\n');

243 }

244

245

249}

250

256 return true;

257

261

267

269}

270

275 return true;

276

280 return true;

281 return false;

282}

283

284

286 std::unique_ptr Mutation) {

288}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static cl::opt< unsigned > InstrLimit("dfa-instr-limit", cl::Hidden, cl::init(0), cl::desc("If present, stops packetizing after N instructions"))

static unsigned InstrCount

Definition DFAPacketizer.cpp:50

static cl::opt< bool > UseTBAA("use-tbaa-in-sched-mi", cl::Hidden, cl::init(true), cl::desc("Enable use of TBAA during MI DAG construction"))

The possible results of an alias query.

@ NoAlias

The two locations do not alias at all.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

const T & front() const

front - Get the first element.

bool empty() const

empty - Check if the array is empty.

unsigned getUsedResources(unsigned InstIdx)

Definition DFAPacketizer.cpp:84

bool canReserveResources(const MCInstrDesc *MID)

Definition DFAPacketizer.cpp:54

void reserveResources(const MCInstrDesc *MID)

Definition DFAPacketizer.cpp:63

void postProcessDAG()

Apply each ScheduleDAGMutation step in order.

Definition DFAPacketizer.cpp:106

void schedule() override

Orders nodes according to selected style.

Definition DFAPacketizer.cpp:111

DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI, AAResults *AA)

Definition DFAPacketizer.cpp:98

TypeSize getValue() const

Describe properties that are true of each instruction in the target description file.

unsigned getSchedClass() const

Return the scheduling class for this instruction.

MachineInstrBundleIterator< MachineInstr > iterator

Representation of each machine instruction.

bool memoperands_empty() const

Return true if we don't have any memory operands which described the memory access done by this instr...

ArrayRef< MachineMemOperand * > memoperands() const

Access to memory operands of the instruction.

A description of a memory reference used in the backend.

LocationSize getSize() const

Return the size in bytes of the memory reference.

AAMDNodes getAAInfo() const

Return the AA tags for the memory reference.

const Value * getValue() const

Return the base address of the memory access.

int64_t getOffset() const

For normal values, this is a byte offset added to the base address.

Representation for a specific memory location.

Scheduling unit. This is a node in the scheduling DAG.

MachineInstr * getInstr() const

Returns the representative MachineInstr for this SUnit.

bool CanHandleTerminators

The standard DAG builder does not normally include terminators as DAG nodes because it does not creat...

ScheduleDAGInstrs(MachineFunction &mf, const MachineLoopInfo *mli, bool RemoveKillFlags=false)

void buildSchedGraph(AAResults *AA, RegPressureTracker *RPTracker=nullptr, PressureDiffs *PDiffs=nullptr, LiveIntervals *LIS=nullptr, bool TrackLaneMasks=false)

Builds SUnits for the current region.

const MachineLoopInfo * MLI

MachineFunction & MF

Machine function.

VLIWPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI, AAResults *AA)

Definition DFAPacketizer.cpp:117

virtual bool isSoloInstruction(const MachineInstr &MI)

void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)

Definition DFAPacketizer.cpp:285

virtual bool isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ)

const TargetInstrInfo * TII

bool alias(const MachineInstr &MI1, const MachineInstr &MI2, bool UseTBAA=true) const

Definition DFAPacketizer.cpp:271

std::vector< MachineInstr * > CurrentPacketMIs

std::map< MachineInstr *, SUnit * > MIToSUnit

DefaultVLIWScheduler * VLIWScheduler

virtual ~VLIWPacketizerList()

Definition DFAPacketizer.cpp:125

virtual bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ)

DFAPacketizer * ResourceTracker

virtual void initPacketizerState()

virtual void endPacket(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI)

Definition DFAPacketizer.cpp:131

virtual bool ignorePseudoInstruction(const MachineInstr &I, const MachineBasicBlock *MBB)

void PacketizeMIs(MachineBasicBlock *MBB, MachineBasicBlock::iterator BeginItr, MachineBasicBlock::iterator EndItr)

Definition DFAPacketizer.cpp:153

virtual MachineBasicBlock::iterator addToPacket(MachineInstr &MI)

virtual bool shouldAddToPacket(const MachineInstr &MI)

self_iterator getIterator()

Abstract Attribute helper functions.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void finalizeBundle(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)

finalizeBundle - Finalize a machine instruction bundle which includes a sequence of instructions star...

std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

SmallVector< uint64_t, 4 > NfaPath

A collection of metadata nodes that might be associated with a memory access used by the alias-analys...