Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
RDFGraph.h
Go to the documentation of this file.
1//===- RDFGraph.h -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Target-independent, SSA-based data flow graph for register data flow (RDF)
10// for a non-SSA program representation (e.g. post-RA machine code).
11//
12//
13// *** Introduction
14//
15// The RDF graph is a collection of nodes, each of which denotes some element
16// of the program. There are two main types of such elements: code and refe-
17// rences. Conceptually, "code" is something that represents the structure
18// of the program, e.g. basic block or a statement, while "reference" is an
19// instance of accessing a register, e.g. a definition or a use. Nodes are
20// connected with each other based on the structure of the program (such as
21// blocks, instructions, etc.), and based on the data flow (e.g. reaching
22// definitions, reached uses, etc.). The single-reaching-definition principle
23// of SSA is generally observed, although, due to the non-SSA representation
24// of the program, there are some differences between the graph and a "pure"
25// SSA representation.
26//
27//
28// *** Implementation remarks
29//
30// Since the graph can contain a large number of nodes, memory consumption
31// was one of the major design considerations. As a result, there is a single
32// base class NodeBase which defines all members used by all possible derived
33// classes. The members are arranged in a union, and a derived class cannot
34// add any data members of its own. Each derived class only defines the
35// functional interface, i.e. member functions. NodeBase must be a POD,
36// which implies that all of its members must also be PODs.
37// Since nodes need to be connected with other nodes, pointers have been
38// replaced with 32-bit identifiers: each node has an id of type NodeId.
39// There are mapping functions in the graph that translate between actual
40// memory addresses and the corresponding identifiers.
41// A node id of 0 is equivalent to nullptr.
42//
43//
44// *** Structure of the graph
45//
46// A code node is always a collection of other nodes. For example, a code
47// node corresponding to a basic block will contain code nodes corresponding
48// to instructions. In turn, a code node corresponding to an instruction will
49// contain a list of reference nodes that correspond to the definitions and
50// uses of registers in that instruction. The members are arranged into a
51// circular list, which is yet another consequence of the effort to save
52// memory: for each member node it should be possible to obtain its owner,
53// and it should be possible to access all other members. There are other
54// ways to accomplish that, but the circular list seemed the most natural.
55//
56// +- CodeNode -+
57// | | <---------------------------------------------------+
58// +-+--------+-+ |
59// |FirstM |LastM |
60// | +-------------------------------------+ |
61// | | |
62// V V |
63// +----------+ Next +----------+ Next Next +----------+ Next |
64// | |----->| |-----> ... ----->| |----->-+
65// +- Member -+ +- Member -+ +- Member -+
66//
67// The order of members is such that related reference nodes (see below)
68// should be contiguous on the member list.
69//
70// A reference node is a node that encapsulates an access to a register,
71// in other words, data flowing into or out of a register. There are two
72// major kinds of reference nodes: defs and uses. A def node will contain
73// the id of the first reached use, and the id of the first reached def.
74// Each def and use will contain the id of the reaching def, and also the
75// id of the next reached def (for def nodes) or use (for use nodes).
76// The "next node sharing the same reaching def" is denoted as "sibling".
77// In summary:
78// - Def node contains: reaching def, sibling, first reached def, and first
79// reached use.
80// - Use node contains: reaching def and sibling.
81//
82// +-- DefNode --+
83// | R2 = ... | <---+--------------------+
84// ++---------+--+ | |
85// |Reached |Reached | |
86// |Def |Use | |
87// | | |Reaching |Reaching
88// | V |Def |Def
89// | +-- UseNode --+ Sib +-- UseNode --+ Sib Sib
90// | | ... = R2 |----->| ... = R2 |----> ... ----> 0
91// | +-------------+ +-------------+
92// V
93// +-- DefNode --+ Sib
94// | R2 = ... |----> ...
95// ++---------+--+
96// | |
97// | |
98// ... ...
99//
100// To get a full picture, the circular lists connecting blocks within a
101// function, instructions within a block, etc. should be superimposed with
102// the def-def, def-use links shown above.
103// To illustrate this, consider a small example in a pseudo-assembly:
104// foo:
105// add r2, r0, r1 ; r2 = r0+r1
106// addi r0, r2, 1 ; r0 = r2+1
107// ret r0 ; return value in r0
108//
109// The graph (in a format used by the debugging functions) would look like:
110//
111// DFG dump:[
112// f1: Function foo
113// b2: === %bb.0 === preds(0), succs(0):
114// p3: phi [d4<r0>(,d12,u9):]
115// p5: phi [d6<r1>(,,u10):]
116// s7: add [d8<r2>(,,u13):, u9<r0>(d4):, u10<r1>(d6):]
117// s11: addi [d12<r0>(d4,,u15):, u13<r2>(d8):]
118// s14: ret [u15<r0>(d12):]
119// ]
120//
121// The f1, b2, p3, etc. are node ids. The letter is prepended to indicate the
122// kind of the node (i.e. f - function, b - basic block, p - phi, s - state-
123// ment, d - def, u - use).
124// The format of a def node is:
125// dN<R>(rd,d,u):sib,
126// where
127// N - numeric node id,
128// R - register being defined
129// rd - reaching def,
130// d - reached def,
131// u - reached use,
132// sib - sibling.
133// The format of a use node is:
134// uN<R>[!](rd):sib,
135// where
136// N - numeric node id,
137// R - register being used,
138// rd - reaching def,
139// sib - sibling.
140// Possible annotations (usually preceding the node id):
141// + - preserving def,
142// ~ - clobbering def,
143// " - shadow ref (follows the node id),
144// ! - fixed register (appears after register name).
145//
146// The circular lists are not explicit in the dump.
147//
148//
149// *** Node attributes
150//
151// NodeBase has a member "Attrs", which is the primary way of determining
152// the node's characteristics. The fields in this member decide whether
153// the node is a code node or a reference node (i.e. node's "type"), then
154// within each type, the "kind" determines what specifically this node
155// represents. The remaining bits, "flags", contain additional information
156// that is even more detailed than the "kind".
157// CodeNode's kinds are:
158// - Phi: Phi node, members are reference nodes.
159// - Stmt: Statement, members are reference nodes.
160// - Block: Basic block, members are instruction nodes (i.e. Phi or Stmt).
161// - Func: The whole function. The members are basic block nodes.
162// RefNode's kinds are:
163// - Use.
164// - Def.
165//
166// Meaning of flags:
167// - Preserving: applies only to defs. A preserving def is one that can
168// preserve some of the original bits among those that are included in
169// the register associated with that def. For example, if R0 is a 32-bit
170// register, but a def can only change the lower 16 bits, then it will
171// be marked as preserving.
172// - Shadow: a reference that has duplicates holding additional reaching
173// defs (see more below).
174// - Clobbering: applied only to defs, indicates that the value generated
175// by this def is unspecified. A typical example would be volatile registers
176// after function calls.
177// - Fixed: the register in this def/use cannot be replaced with any other
178// register. A typical case would be a parameter register to a call, or
179// the register with the return value from a function.
180// - Undef: the register in this reference the register is assumed to have
181// no pre-existing value, even if it appears to be reached by some def.
182// This is typically used to prevent keeping registers artificially live
183// in cases when they are defined via predicated instructions. For example:
184// r0 = add-if-true cond, r10, r11 (1)
185// r0 = add-if-false cond, r12, r13, implicit r0 (2)
186// ... = r0 (3)
187// Before (1), r0 is not intended to be live, and the use of r0 in (3) is
188// not meant to be reached by any def preceding (1). However, since the
189// defs in (1) and (2) are both preserving, these properties alone would
190// imply that the use in (3) may indeed be reached by some prior def.
191// Adding Undef flag to the def in (1) prevents that. The Undef flag
192// may be applied to both defs and uses.
193// - Dead: applies only to defs. The value coming out of a "dead" def is
194// assumed to be unused, even if the def appears to be reaching other defs
195// or uses. The motivation for this flag comes from dead defs on function
196// calls: there is no way to determine if such a def is dead without
197// analyzing the target's ABI. Hence the graph should contain this info,
198// as it is unavailable otherwise. On the other hand, a def without any
199// uses on a typical instruction is not the intended target for this flag.
200//
201// *** Shadow references
202//
203// It may happen that a super-register can have two (or more) non-overlapping
204// sub-registers. When both of these sub-registers are defined and followed
205// by a use of the super-register, the use of the super-register will not
206// have a unique reaching def: both defs of the sub-registers need to be
207// accounted for. In such cases, a duplicate use of the super-register is
208// added and it points to the extra reaching def. Both uses are marked with
209// a flag "shadow". Example:
210// Assume t0 is a super-register of r0 and r1, r0 and r1 do not overlap:
211// set r0, 1 ; r0 = 1
212// set r1, 1 ; r1 = 1
213// addi t1, t0, 1 ; t1 = t0+1
214//
215// The DFG:
216// s1: set [d2<r0>(,,u9):]
217// s3: set [d4<r1>(,,u10):]
218// s5: addi [d6<t1>(,,):, u7"<t0>(d2):, u8"<t0>(d4):]
219//
220// The statement s5 has two use nodes for t0: u7" and u9". The quotation
221// mark " indicates that the node is a shadow.
222//
223
224#ifndef LLVM_CODEGEN_RDFGRAPH_H
225#define LLVM_CODEGEN_RDFGRAPH_H
226
227#include "RDFRegisters.h"
228#include "llvm/ADT/ArrayRef.h"
229#include "llvm/ADT/SmallVector.h"
230#include "llvm/MC/LaneBitmask.h"
231#include "llvm/Support/Allocator.h"
232#include "llvm/Support/MathExtras.h"
233#include <cassert>
234#include <cstdint>
235#include <cstring>
236#include <map>
237#include <memory>
238#include <set>
239#include <unordered_map>
240#include <utility>
241#include <vector>
242
243// RDF uses uint32_t to refer to registers. This is to ensure that the type
244// size remains specific. In other places, registers are often stored using
245// unsigned.
246static_assert(sizeof(uint32_t) ==sizeof(unsigned),"Those should be equal");
247
248namespacellvm {
249
250classMachineBasicBlock;
251classMachineDominanceFrontier;
252classMachineDominatorTree;
253classMachineFunction;
254classMachineInstr;
255classMachineOperand;
256classraw_ostream;
257classTargetInstrInfo;
258classTargetRegisterInfo;
259
260namespacerdf {
261
262usingNodeId =uint32_t;
263
264structDataFlowGraph;
265
266structNodeAttrs {
267// clang-format off
268 enum :uint16_t {
269None = 0x0000,// Nothing
270
271// Types: 2 bits
272TypeMask = 0x0003,
273Code = 0x0001,// 01, Container
274Ref = 0x0002,// 10, Reference
275
276// Kind: 3 bits
277KindMask = 0x0007 << 2,
278Def = 0x0001 << 2,// 001
279Use = 0x0002 << 2,// 010
280Phi = 0x0003 << 2,// 011
281Stmt = 0x0004 << 2,// 100
282Block = 0x0005 << 2,// 101
283Func = 0x0006 << 2,// 110
284
285// Flags: 7 bits for now
286FlagMask = 0x007F << 5,
287Shadow = 0x0001 << 5,// 0000001, Has extra reaching defs.
288Clobbering = 0x0002 << 5,// 0000010, Produces unspecified values.
289PhiRef = 0x0004 << 5,// 0000100, Member of PhiNode.
290Preserving = 0x0008 << 5,// 0001000, Def can keep original bits.
291Fixed = 0x0010 << 5,// 0010000, Fixed register.
292Undef = 0x0020 << 5,// 0100000, Has no pre-existing value.
293Dead = 0x0040 << 5,// 1000000, Does not define a value.
294 };
295// clang-format on
296
297staticuint16_ttype(uint16_tT) {//
298returnT &TypeMask;
299 }
300staticuint16_tkind(uint16_tT) {//
301returnT &KindMask;
302 }
303staticuint16_tflags(uint16_tT) {//
304returnT &FlagMask;
305 }
306staticuint16_tset_type(uint16_tA,uint16_tT) {
307return (A & ~TypeMask) |T;
308 }
309
310staticuint16_tset_kind(uint16_tA,uint16_t K) {
311return (A & ~KindMask) | K;
312 }
313
314staticuint16_tset_flags(uint16_tA,uint16_tF) {
315return (A & ~FlagMask) |F;
316 }
317
318// Test if A contains B.
319staticboolcontains(uint16_tA,uint16_tB) {
320if (type(A) !=Code)
321returnfalse;
322uint16_t KB =kind(B);
323switch (kind(A)) {
324caseFunc:
325return KB ==Block;
326caseBlock:
327return KB ==Phi || KB ==Stmt;
328casePhi:
329caseStmt:
330returntype(B) ==Ref;
331 }
332returnfalse;
333 }
334};
335
336structBuildOptions {
337 enum :unsigned {
338None = 0x00,
339KeepDeadPhis = 0x01,// Do not remove dead phis during build.
340OmitReserved = 0x02,// Do not track reserved registers.
341 };
342};
343
344template <typename T>structNodeAddr {
345NodeAddr() =default;
346NodeAddr(TA,NodeIdI) :Addr(A),Id(I) {}
347
348// Type cast (casting constructor). The reason for having this class
349// instead of std::pair.
350template <typename S>
351NodeAddr(constNodeAddr<S> &NA) :Addr(static_cast<T>(NA.Addr)),Id(NA.Id) {}
352
353booloperator==(constNodeAddr<T> &NA) const{
354assert((Addr == NA.Addr) == (Id == NA.Id));
355returnAddr == NA.Addr;
356 }
357booloperator!=(constNodeAddr<T> &NA) const{//
358return !operator==(NA);
359 }
360
361TAddr =nullptr;
362NodeIdId = 0;
363};
364
365structNodeBase;
366
367structRefNode;
368structDefNode;
369structUseNode;
370structPhiUseNode;
371
372structCodeNode;
373structInstrNode;
374structPhiNode;
375structStmtNode;
376structBlockNode;
377structFuncNode;
378
379// Use these short names with rdf:: qualification to avoid conflicts with
380// preexisting names. Do not use 'using namespace rdf'.
381usingNode =NodeAddr<NodeBase *>;
382
383usingRef =NodeAddr<RefNode *>;
384usingDef =NodeAddr<DefNode *>;
385usingUse =NodeAddr<UseNode *>;// This may conflict with llvm::Use.
386usingPhiUse =NodeAddr<PhiUseNode *>;
387
388usingCode =NodeAddr<CodeNode *>;
389usingInstr =NodeAddr<InstrNode *>;
390usingPhi =NodeAddr<PhiNode *>;
391usingStmt =NodeAddr<StmtNode *>;
392usingBlock =NodeAddr<BlockNode *>;
393usingFunc =NodeAddr<FuncNode *>;
394
395// Fast memory allocation and translation between node id and node address.
396// This is really the same idea as the one underlying the "bump pointer
397// allocator", the difference being in the translation. A node id is
398// composed of two components: the index of the block in which it was
399// allocated, and the index within the block. With the default settings,
400// where the number of nodes per block is 4096, the node id (minus 1) is:
401//
402// bit position: 11 0
403// +----------------------------+--------------+
404// | Index of the block |Index in block|
405// +----------------------------+--------------+
406//
407// The actual node id is the above plus 1, to avoid creating a node id of 0.
408//
409// This method significantly improved the build time, compared to using maps
410// (std::unordered_map or DenseMap) to translate between pointers and ids.
411structNodeAllocator {
412// Amount of storage for a single node.
413enum {NodeMemSize = 32 };
414
415NodeAllocator(uint32_t NPB = 4096)
416 : NodesPerBlock(NPB), BitsPerIndex(Log2_32(NPB)),
417 IndexMask((1 << BitsPerIndex) - 1) {
418assert(isPowerOf2_32(NPB));
419 }
420
421NodeBase *ptr(NodeIdN) const{
422uint32_t N1 =N - 1;
423uint32_t BlockN = N1 >> BitsPerIndex;
424uint32_tOffset = (N1 & IndexMask) *NodeMemSize;
425returnreinterpret_cast<NodeBase *>(Blocks[BlockN] +Offset);
426 }
427
428NodeIdid(constNodeBase *P)const;
429NodeNew();
430voidclear();
431
432private:
433void startNewBlock();
434bool needNewBlock();
435
436uint32_t makeId(uint32_tBlock,uint32_tIndex) const{
437// Add 1 to the id, to avoid the id of 0, which is treated as "null".
438return ((Block << BitsPerIndex) |Index) + 1;
439 }
440
441constuint32_t NodesPerBlock;
442constuint32_t BitsPerIndex;
443constuint32_t IndexMask;
444char *ActiveEnd =nullptr;
445 std::vector<char *> Blocks;
446usingAllocatorTy =BumpPtrAllocatorImpl<MallocAllocator, 65536>;
447 AllocatorTy MemPool;
448};
449
450usingRegisterSet = std::set<RegisterRef>;
451
452structTargetOperandInfo {
453TargetOperandInfo(constTargetInstrInfo &tii) :TII(tii) {}
454virtual~TargetOperandInfo() =default;
455
456virtualboolisPreserving(constMachineInstr &In,unsigned OpNum)const;
457virtualboolisClobbering(constMachineInstr &In,unsigned OpNum)const;
458virtualboolisFixedReg(constMachineInstr &In,unsigned OpNum)const;
459
460constTargetInstrInfo &TII;
461};
462
463// Packed register reference. Only used for storage.
464structPackedRegisterRef {
465RegisterIdReg;
466uint32_tMaskId;
467};
468
469structLaneMaskIndex :privateIndexedSet<LaneBitmask> {
470LaneMaskIndex() =default;
471
472LaneBitmaskgetLaneMaskForIndex(uint32_t K) const{
473return K == 0 ?LaneBitmask::getAll() :get(K);
474 }
475
476uint32_tgetIndexForLaneMask(LaneBitmask LM) {
477assert(LM.any());
478return LM.all() ? 0 :insert(LM);
479 }
480
481uint32_tgetIndexForLaneMask(LaneBitmask LM) const{
482assert(LM.any());
483return LM.all() ? 0 :find(LM);
484 }
485};
486
487structNodeBase {
488public:
489// Make sure this is a POD.
490NodeBase() =default;
491
492uint16_tgetType() const{returnNodeAttrs::type(Attrs); }
493uint16_tgetKind() const{returnNodeAttrs::kind(Attrs); }
494uint16_tgetFlags() const{returnNodeAttrs::flags(Attrs); }
495NodeIdgetNext() const{returnNext; }
496
497uint16_tgetAttrs() const{returnAttrs; }
498voidsetAttrs(uint16_tA) {Attrs =A; }
499voidsetFlags(uint16_tF) {setAttrs(NodeAttrs::set_flags(getAttrs(),F)); }
500
501// Insert node NA after "this" in the circular chain.
502voidappend(Node NA);
503
504// Initialize all members to 0.
505voidinit() { memset(this, 0,sizeof *this); }
506
507voidsetNext(NodeIdN) {Next =N; }
508
509protected:
510uint16_tAttrs;
511uint16_tReserved;
512NodeIdNext;// Id of the next node in the circular chain.
513// Definitions of nested types. Using anonymous nested structs would make
514// this class definition clearer, but unnamed structs are not a part of
515// the standard.
516structDef_struct {
517NodeIdDD,DU;// Ids of the first reached def and use.
518 };
519structPhiU_struct {
520NodeIdPredB;// Id of the predecessor block for a phi use.
521 };
522structCode_struct {
523void *CP;// Pointer to the actual code.
524NodeIdFirstM,LastM;// Id of the first member and last.
525 };
526structRef_struct {
527NodeIdRD,Sib;// Ids of the reaching def and the sibling.
528union{
529Def_structDef;
530PhiU_structPhiU;
531 };
532union{
533MachineOperand *Op;// Non-phi refs point to a machine operand.
534PackedRegisterRefPR;// Phi refs store register info directly.
535 };
536 };
537
538// The actual payload.
539union{
540Ref_structRefData;
541Code_structCodeData;
542 };
543};
544// The allocator allocates chunks of 32 bytes for each node. The fact that
545// each node takes 32 bytes in memory is used for fast translation between
546// the node id and the node address.
547static_assert(sizeof(NodeBase) <=NodeAllocator::NodeMemSize,
548"NodeBase must be at most NodeAllocator::NodeMemSize bytes");
549
550usingNodeList =SmallVector<Node, 4>;
551usingNodeSet = std::set<NodeId>;
552
553structRefNode :publicNodeBase {
554RefNode() =default;
555
556RegisterRefgetRegRef(constDataFlowGraph &G)const;
557
558MachineOperand &getOp() {
559assert(!(getFlags() &NodeAttrs::PhiRef));
560return *RefData.Op;
561 }
562
563voidsetRegRef(RegisterRef RR,DataFlowGraph &G);
564voidsetRegRef(MachineOperand *Op,DataFlowGraph &G);
565
566NodeIdgetReachingDef() const{returnRefData.RD; }
567voidsetReachingDef(NodeId RD) {RefData.RD = RD; }
568
569NodeIdgetSibling() const{returnRefData.Sib; }
570voidsetSibling(NodeId Sib) {RefData.Sib = Sib; }
571
572boolisUse() const{
573assert(getType() ==NodeAttrs::Ref);
574returngetKind() ==NodeAttrs::Use;
575 }
576
577boolisDef() const{
578assert(getType() ==NodeAttrs::Ref);
579returngetKind() ==NodeAttrs::Def;
580 }
581
582template <typename Predicate>
583RefgetNextRef(RegisterRef RR,PredicateP,bool NextOnly,
584constDataFlowGraph &G);
585NodegetOwner(constDataFlowGraph &G);
586};
587
588structDefNode :publicRefNode {
589NodeIdgetReachedDef() const{returnRefData.Def.DD; }
590voidsetReachedDef(NodeIdD) {RefData.Def.DD =D; }
591NodeIdgetReachedUse() const{returnRefData.Def.DU; }
592voidsetReachedUse(NodeId U) {RefData.Def.DU = U; }
593
594voidlinkToDef(NodeId Self,Def DA);
595};
596
597structUseNode :publicRefNode {
598voidlinkToDef(NodeId Self,Def DA);
599};
600
601structPhiUseNode :publicUseNode {
602NodeIdgetPredecessor() const{
603assert(getFlags() &NodeAttrs::PhiRef);
604returnRefData.PhiU.PredB;
605 }
606voidsetPredecessor(NodeIdB) {
607assert(getFlags() &NodeAttrs::PhiRef);
608RefData.PhiU.PredB =B;
609 }
610};
611
612structCodeNode :publicNodeBase {
613template <typename T>TgetCode() const{//
614returnstatic_cast<T>(CodeData.CP);
615 }
616voidsetCode(void *C) {CodeData.CP =C; }
617
618NodegetFirstMember(constDataFlowGraph &G)const;
619NodegetLastMember(constDataFlowGraph &G)const;
620voidaddMember(Node NA,constDataFlowGraph &G);
621voidaddMemberAfter(Node MA,Node NA,constDataFlowGraph &G);
622voidremoveMember(Node NA,constDataFlowGraph &G);
623
624NodeListmembers(constDataFlowGraph &G)const;
625template <typename Predicate>
626NodeListmembers_if(PredicateP,constDataFlowGraph &G)const;
627};
628
629structInstrNode :publicCodeNode {
630NodegetOwner(constDataFlowGraph &G);
631};
632
633structPhiNode :publicInstrNode {
634MachineInstr *getCode() const{returnnullptr; }
635};
636
637structStmtNode :publicInstrNode {
638MachineInstr *getCode() const{//
639return CodeNode::getCode<MachineInstr *>();
640 }
641};
642
643structBlockNode :publicCodeNode {
644MachineBasicBlock *getCode() const{
645return CodeNode::getCode<MachineBasicBlock *>();
646 }
647
648voidaddPhi(Phi PA,constDataFlowGraph &G);
649};
650
651structFuncNode :publicCodeNode {
652MachineFunction *getCode() const{
653return CodeNode::getCode<MachineFunction *>();
654 }
655
656BlockfindBlock(constMachineBasicBlock *BB,constDataFlowGraph &G)const;
657BlockgetEntryBlock(constDataFlowGraph &G);
658};
659
660structDataFlowGraph {
661DataFlowGraph(MachineFunction &mf,constTargetInstrInfo &tii,
662constTargetRegisterInfo &tri,constMachineDominatorTree &mdt,
663constMachineDominanceFrontier &mdf);
664DataFlowGraph(MachineFunction &mf,constTargetInstrInfo &tii,
665constTargetRegisterInfo &tri,constMachineDominatorTree &mdt,
666constMachineDominanceFrontier &mdf,
667constTargetOperandInfo &toi);
668
669structConfig {
670Config() =default;
671Config(unsigned Opts) :Options(Opts) {}
672Config(ArrayRef<const TargetRegisterClass *> RCs) :Classes(RCs) {}
673Config(ArrayRef<MCPhysReg> Track) :TrackRegs(Track.begin(), Track.end()) {}
674Config(ArrayRef<RegisterId> Track)
675 :TrackRegs(Track.begin(), Track.end()) {}
676
677unsignedOptions =BuildOptions::None;
678SmallVector<const TargetRegisterClass *>Classes;
679 std::set<RegisterId>TrackRegs;
680 };
681
682NodeBase *ptr(NodeIdN)const;
683template <typename T>Tptr(NodeIdN) const{//
684returnstatic_cast<T>(ptr(N));
685 }
686
687NodeIdid(constNodeBase *P)const;
688
689template <typename T>NodeAddr<T>addr(NodeIdN) const{
690return {ptr<T>(N),N};
691 }
692
693FuncgetFunc() const{return TheFunc; }
694MachineFunction &getMF() const{return MF; }
695constTargetInstrInfo &getTII() const{return TII; }
696constTargetRegisterInfo &getTRI() const{return TRI; }
697constPhysicalRegisterInfo &getPRI() const{return PRI; }
698constMachineDominatorTree &getDT() const{return MDT; }
699constMachineDominanceFrontier &getDF() const{return MDF; }
700constRegisterAggr &getLiveIns() const{return LiveIns; }
701
702structDefStack {
703DefStack() =default;
704
705boolempty() const{return Stack.empty() ||top() ==bottom(); }
706
707private:
708usingvalue_type =Def;
709structIterator {
710usingvalue_type =DefStack::value_type;
711
712 Iterator &up() {
713 Pos = DS.nextUp(Pos);
714return *this;
715 }
716 Iterator &down() {
717 Pos = DS.nextDown(Pos);
718return *this;
719 }
720
721 value_typeoperator*() const{
722assert(Pos >= 1);
723return DS.Stack[Pos - 1];
724 }
725const value_type *operator->() const{
726assert(Pos >= 1);
727return &DS.Stack[Pos - 1];
728 }
729booloperator==(const Iterator &It) const{return Pos == It.Pos; }
730booloperator!=(const Iterator &It) const{return Pos != It.Pos; }
731
732private:
733friendstructDefStack;
734
735 Iterator(const DefStack &S,bool Top);
736
737// Pos-1 is the index in the StorageType object that corresponds to
738// the top of the DefStack.
739const DefStack &DS;
740unsigned Pos;
741 };
742
743public:
744usingiterator =Iterator;
745
746iteratortop() const{returnIterator(*this,true); }
747iteratorbottom() const{returnIterator(*this,false); }
748unsignedsize()const;
749
750voidpush(Def DA) { Stack.push_back(DA); }
751voidpop();
752voidstart_block(NodeIdN);
753voidclear_block(NodeIdN);
754
755private:
756friendstructIterator;
757
758usingStorageType = std::vector<value_type>;
759
760bool isDelimiter(const StorageType::value_type &P,NodeIdN = 0) const{
761return (P.Addr ==nullptr) && (N == 0 ||P.Id ==N);
762 }
763
764unsigned nextUp(unsignedP)const;
765unsigned nextDown(unsignedP)const;
766
767 StorageType Stack;
768 };
769
770// Make this std::unordered_map for speed of accessing elements.
771// Map: Register (physical or virtual) -> DefStack
772usingDefStackMap = std::unordered_map<RegisterId, DefStack>;
773
774voidbuild(constConfig &config);
775voidbuild() {build(Config()); }
776
777voidpushAllDefs(Instr IA,DefStackMap &DM);
778voidmarkBlock(NodeIdB,DefStackMap &DefM);
779voidreleaseBlock(NodeIdB,DefStackMap &DefM);
780
781PackedRegisterRefpack(RegisterRef RR) {
782return {RR.Reg, LMI.getIndexForLaneMask(RR.Mask)};
783 }
784PackedRegisterRefpack(RegisterRef RR) const{
785return {RR.Reg, LMI.getIndexForLaneMask(RR.Mask)};
786 }
787RegisterRefunpack(PackedRegisterRef PR) const{
788returnRegisterRef(PR.Reg, LMI.getLaneMaskForIndex(PR.MaskId));
789 }
790
791RegisterRefmakeRegRef(unsignedReg,unsigned Sub)const;
792RegisterRefmakeRegRef(constMachineOperand &Op)const;
793
794RefgetNextRelated(Instr IA,RefRA)const;
795RefgetNextShadow(Instr IA,RefRA,bool Create);
796
797NodeListgetRelatedRefs(Instr IA,RefRA)const;
798
799BlockfindBlock(MachineBasicBlock *BB) const{return BlockNodes.at(BB); }
800
801voidunlinkUse(Use UA,bool RemoveFromOwner) {
802 unlinkUseDF(UA);
803if (RemoveFromOwner)
804 removeFromOwner(UA);
805 }
806
807voidunlinkDef(Def DA,bool RemoveFromOwner) {
808 unlinkDefDF(DA);
809if (RemoveFromOwner)
810 removeFromOwner(DA);
811 }
812
813boolisTracked(RegisterRef RR)const;
814boolhasUntrackedRef(Stmt S,bool IgnoreReserved =true)const;
815
816// Some useful filters.
817template <uint16_t Kind>staticboolIsRef(constNode BA) {
818return BA.Addr->getType() ==NodeAttrs::Ref && BA.Addr->getKind() == Kind;
819 }
820
821template <uint16_t Kind>staticboolIsCode(constNode BA) {
822return BA.Addr->getType() ==NodeAttrs::Code && BA.Addr->getKind() == Kind;
823 }
824
825staticboolIsDef(constNode BA) {
826return BA.Addr->getType() ==NodeAttrs::Ref &&
827 BA.Addr->getKind() ==NodeAttrs::Def;
828 }
829
830staticboolIsUse(constNode BA) {
831return BA.Addr->getType() ==NodeAttrs::Ref &&
832 BA.Addr->getKind() ==NodeAttrs::Use;
833 }
834
835staticboolIsPhi(constNode BA) {
836return BA.Addr->getType() ==NodeAttrs::Code &&
837 BA.Addr->getKind() ==NodeAttrs::Phi;
838 }
839
840staticboolIsPreservingDef(constDef DA) {
841uint16_t Flags = DA.Addr->getFlags();
842return (Flags &NodeAttrs::Preserving) && !(Flags &NodeAttrs::Undef);
843 }
844
845private:
846void reset();
847
848RegisterAggr getLandingPadLiveIns()const;
849
850Node newNode(uint16_t Attrs);
851Node cloneNode(constNodeB);
852Use newUse(Instr Owner,MachineOperand &Op,uint16_t Flags =NodeAttrs::None);
853PhiUse newPhiUse(Phi Owner,RegisterRef RR,Block PredB,
854uint16_t Flags =NodeAttrs::PhiRef);
855Def newDef(Instr Owner,MachineOperand &Op,uint16_t Flags =NodeAttrs::None);
856Def newDef(Instr Owner,RegisterRef RR,uint16_t Flags =NodeAttrs::PhiRef);
857Phi newPhi(Block Owner);
858Stmt newStmt(Block Owner,MachineInstr *MI);
859Block newBlock(Func Owner,MachineBasicBlock *BB);
860Func newFunc(MachineFunction *MF);
861
862template <typename Predicate>
863 std::pair<Ref, Ref> locateNextRef(Instr IA,RefRA,PredicateP)const;
864
865usingBlockRefsMap =RegisterAggrMap<NodeId>;
866
867void buildStmt(Block BA,MachineInstr &In);
868void recordDefsForDF(BlockRefsMap &PhiM,Block BA);
869void buildPhis(BlockRefsMap &PhiM,Block BA);
870void removeUnusedPhis();
871
872void pushClobbers(Instr IA,DefStackMap &DM);
873void pushDefs(Instr IA,DefStackMap &DM);
874template <typename T>void linkRefUp(Instr IA,NodeAddr<T> TA, DefStack &DS);
875template <typename Predicate>
876void linkStmtRefs(DefStackMap &DefM,Stmt SA,PredicateP);
877void linkBlockRefs(DefStackMap &DefM,Block BA);
878
879void unlinkUseDF(Use UA);
880void unlinkDefDF(Def DA);
881
882void removeFromOwner(RefRA) {
883Instr IA =RA.Addr->getOwner(*this);
884 IA.Addr->removeMember(RA, *this);
885 }
886
887// Default TOI object, if not given in the constructor.
888 std::unique_ptr<TargetOperandInfo> DefaultTOI;
889
890MachineFunction &MF;
891constTargetInstrInfo &TII;
892constTargetRegisterInfo &TRI;
893const PhysicalRegisterInfo PRI;
894constMachineDominatorTree &MDT;
895constMachineDominanceFrontier &MDF;
896const TargetOperandInfo &TOI;
897
898 RegisterAggr LiveIns;
899Func TheFunc;
900 NodeAllocatorMemory;
901// Local map: MachineBasicBlock -> NodeAddr<BlockNode*>
902 std::map<MachineBasicBlock *, Block> BlockNodes;
903// Lane mask map.
904 LaneMaskIndex LMI;
905
906Config BuildCfg;
907 std::set<unsigned> TrackedUnits;
908BitVector ReservedRegs;
909};// struct DataFlowGraph
910
911template <typename Predicate>
912RefRefNode::getNextRef(RegisterRef RR,PredicateP,bool NextOnly,
913constDataFlowGraph &G) {
914// Get the "Next" reference in the circular list that references RR and
915// satisfies predicate "Pred".
916auto NA =G.addr<NodeBase *>(getNext());
917
918while (NA.Addr !=this) {
919if (NA.Addr->getType() ==NodeAttrs::Ref) {
920RefRA = NA;
921if (G.getPRI().equal_to(RA.Addr->getRegRef(G), RR) &&P(NA))
922return NA;
923if (NextOnly)
924break;
925 NA =G.addr<NodeBase *>(NA.Addr->getNext());
926 }else {
927// We've hit the beginning of the chain.
928assert(NA.Addr->getType() ==NodeAttrs::Code);
929// Make sure we stop here with NextOnly. Otherwise we can return the
930// wrong ref. Consider the following while creating/linking shadow uses:
931// -> code -> sr1 -> sr2 -> [back to code]
932// Say that shadow refs sr1, and sr2 have been linked, but we need to
933// create and link another one. Starting from sr2, we'd hit the code
934// node and return sr1 if the iteration didn't stop here.
935if (NextOnly)
936break;
937Code CA = NA;
938 NA = CA.Addr->getFirstMember(G);
939 }
940 }
941// Return the equivalent of "nullptr" if such a node was not found.
942returnRef();
943}
944
945template <typename Predicate>
946NodeListCodeNode::members_if(PredicateP,constDataFlowGraph &G) const{
947NodeList MM;
948auto M =getFirstMember(G);
949if (M.Id == 0)
950return MM;
951
952while (M.Addr !=this) {
953if (P(M))
954 MM.push_back(M);
955 M =G.addr<NodeBase *>(M.Addr->getNext());
956 }
957return MM;
958}
959
960template <typename T>structPrint {
961Print(constT &x,constDataFlowGraph &g) :Obj(x),G(g) {}
962
963constT &Obj;
964constDataFlowGraph &G;
965};
966
967template <typename T>Print(constT &,constDataFlowGraph &) ->Print<T>;
968
969template <typename T>structPrintNode :Print<NodeAddr<T>> {
970PrintNode(constNodeAddr<T> &x,constDataFlowGraph &g)
971 :Print<NodeAddr<T>>(x,g) {}
972};
973
974raw_ostream &operator<<(raw_ostream &OS,const Print<RegisterRef> &P);
975raw_ostream &operator<<(raw_ostream &OS,const Print<NodeId> &P);
976raw_ostream &operator<<(raw_ostream &OS,const Print<Def> &P);
977raw_ostream &operator<<(raw_ostream &OS,const Print<Use> &P);
978raw_ostream &operator<<(raw_ostream &OS,const Print<PhiUse> &P);
979raw_ostream &operator<<(raw_ostream &OS,const Print<Ref> &P);
980raw_ostream &operator<<(raw_ostream &OS,const Print<NodeList> &P);
981raw_ostream &operator<<(raw_ostream &OS,const Print<NodeSet> &P);
982raw_ostream &operator<<(raw_ostream &OS,const Print<Phi> &P);
983raw_ostream &operator<<(raw_ostream &OS,const Print<Stmt> &P);
984raw_ostream &operator<<(raw_ostream &OS,const Print<Instr> &P);
985raw_ostream &operator<<(raw_ostream &OS,const Print<Block> &P);
986raw_ostream &operator<<(raw_ostream &OS,const Print<Func> &P);
987raw_ostream &operator<<(raw_ostream &OS,const Print<RegisterSet> &P);
988raw_ostream &operator<<(raw_ostream &OS,const Print<RegisterAggr> &P);
989raw_ostream &operator<<(raw_ostream &OS,
990const Print<DataFlowGraph::DefStack> &P);
991
992}// end namespace rdf
993}// end namespace llvm
994
995#endif// LLVM_CODEGEN_RDFGRAPH_H
Allocator.h
This file defines the BumpPtrAllocator interface.
ArrayRef.h
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
DM
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
Config
RelaxConfig Config
Definition:ELF_riscv.cpp:506
TII
const HexagonInstrInfo * TII
Definition:HexagonCopyToCombine.cpp:125
MI
IRTranslator LLVM IR MI
Definition:IRTranslator.cpp:112
LaneBitmask.h
A common definition of LaneBitmask for use in TableGen and CodeGen.
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
G
#define G(x, y, z)
Definition:MD5.cpp:56
TRI
unsigned const TargetRegisterInfo * TRI
Definition:MachineSink.cpp:2029
Reg
unsigned Reg
Definition:MachineSink.cpp:2028
MathExtras.h
T
#define T
Definition:Mips16ISelLowering.cpp:341
P
#define P(N)
RDFRegisters.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
RA
SI optimize exec mask operations pre RA
Definition:SIOptimizeExecMaskingPreRA.cpp:71
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
SmallVector.h
This file defines the SmallVector class.
g
INLINE void g(uint32_t *state, size_t a, size_t b, size_t c, size_t d, uint32_t x, uint32_t y)
Definition:blake3_portable.c:8
Predicate
Definition:AMDGPURegBankLegalizeRules.cpp:332
T
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::BitVector
Definition:BitVector.h:82
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition:Allocator.h:66
llvm::DWARFExpression::Operation
This class represents an Operation in the Expression.
Definition:DWARFExpression.h:32
llvm::MachineBasicBlock
Definition:MachineBasicBlock.h:125
llvm::MachineDominanceFrontier
Definition:MachineDominanceFrontier.h:20
llvm::MachineDominatorTree
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Definition:MachineDominators.h:75
llvm::MachineFunction
Definition:MachineFunction.h:267
llvm::MachineInstr
Representation of each machine instruction.
Definition:MachineInstr.h:71
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition:MachineOperand.h:48
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::TargetInstrInfo
TargetInstrInfo - Interface to description of machine instruction set.
Definition:TargetInstrInfo.h:112
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition:TargetRegisterInfo.h:235
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
llvm::sys::Memory
This class provides various memory handling functions that manipulate MemoryBlock instances.
Definition:Memory.h:53
uint16_t
uint32_t
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::SIInstrFlags::DS
@ DS
Definition:SIDefines.h:88
llvm::rdf::Ref
NodeAddr< RefNode * > Ref
Definition:RDFGraph.h:383
llvm::rdf::RegisterSet
std::set< RegisterRef > RegisterSet
Definition:RDFGraph.h:450
llvm::rdf::Def
NodeAddr< DefNode * > Def
Definition:RDFGraph.h:384
llvm::rdf::NodeId
uint32_t NodeId
Definition:RDFGraph.h:262
llvm::rdf::Func
NodeAddr< FuncNode * > Func
Definition:RDFGraph.h:393
llvm::rdf::operator<<
raw_ostream & operator<<(raw_ostream &OS, const Print< RegisterRef > &P)
Definition:RDFGraph.cpp:44
llvm::rdf::NodeSet
std::set< NodeId > NodeSet
Definition:RDFGraph.h:551
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Offset
@ Offset
Definition:DWP.cpp:480
llvm::operator*
APInt operator*(APInt a, uint64_t RHS)
Definition:APInt.h:2204
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition:APInt.h:2082
llvm::operator==
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
Definition:AddressRanges.h:153
llvm::Log2_32
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Definition:MathExtras.h:341
llvm::isPowerOf2_32
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition:MathExtras.h:292
N
#define N
llvm::LaneBitmask
Definition:LaneBitmask.h:40
llvm::LaneBitmask::getAll
static constexpr LaneBitmask getAll()
Definition:LaneBitmask.h:82
llvm::LaneBitmask::any
constexpr bool any() const
Definition:LaneBitmask.h:53
llvm::LaneBitmask::all
constexpr bool all() const
Definition:LaneBitmask.h:54
llvm::rdf::BlockNode
Definition:RDFGraph.h:643
llvm::rdf::BlockNode::getCode
MachineBasicBlock * getCode() const
Definition:RDFGraph.h:644
llvm::rdf::BlockNode::addPhi
void addPhi(Phi PA, const DataFlowGraph &G)
Definition:RDFGraph.cpp:538
llvm::rdf::BuildOptions
Definition:RDFGraph.h:336
llvm::rdf::BuildOptions::None
@ None
Definition:RDFGraph.h:338
llvm::rdf::BuildOptions::OmitReserved
@ OmitReserved
Definition:RDFGraph.h:340
llvm::rdf::BuildOptions::KeepDeadPhis
@ KeepDeadPhis
Definition:RDFGraph.h:339
llvm::rdf::CodeNode
Definition:RDFGraph.h:612
llvm::rdf::CodeNode::members_if
NodeList members_if(Predicate P, const DataFlowGraph &G) const
Definition:RDFGraph.h:946
llvm::rdf::CodeNode::removeMember
void removeMember(Node NA, const DataFlowGraph &G)
Definition:RDFGraph.cpp:487
llvm::rdf::CodeNode::members
NodeList members(const DataFlowGraph &G) const
Definition:RDFGraph.cpp:519
llvm::rdf::CodeNode::addMember
void addMember(Node NA, const DataFlowGraph &G)
Definition:RDFGraph.cpp:467
llvm::rdf::CodeNode::getFirstMember
Node getFirstMember(const DataFlowGraph &G) const
Definition:RDFGraph.cpp:453
llvm::rdf::CodeNode::addMemberAfter
void addMemberAfter(Node MA, Node NA, const DataFlowGraph &G)
Definition:RDFGraph.cpp:480
llvm::rdf::CodeNode::setCode
void setCode(void *C)
Definition:RDFGraph.h:616
llvm::rdf::CodeNode::getCode
T getCode() const
Definition:RDFGraph.h:613
llvm::rdf::CodeNode::getLastMember
Node getLastMember(const DataFlowGraph &G) const
Definition:RDFGraph.cpp:460
llvm::rdf::DataFlowGraph::Config
Definition:RDFGraph.h:669
llvm::rdf::DataFlowGraph::Config::Config
Config(ArrayRef< const TargetRegisterClass * > RCs)
Definition:RDFGraph.h:672
llvm::rdf::DataFlowGraph::Config::Config
Config(unsigned Opts)
Definition:RDFGraph.h:671
llvm::rdf::DataFlowGraph::Config::Config
Config()=default
llvm::rdf::DataFlowGraph::Config::Classes
SmallVector< const TargetRegisterClass * > Classes
Definition:RDFGraph.h:678
llvm::rdf::DataFlowGraph::Config::Options
unsigned Options
Definition:RDFGraph.h:677
llvm::rdf::DataFlowGraph::Config::TrackRegs
std::set< RegisterId > TrackRegs
Definition:RDFGraph.h:679
llvm::rdf::DataFlowGraph::Config::Config
Config(ArrayRef< RegisterId > Track)
Definition:RDFGraph.h:674
llvm::rdf::DataFlowGraph::Config::Config
Config(ArrayRef< MCPhysReg > Track)
Definition:RDFGraph.h:673
llvm::rdf::DataFlowGraph::DefStack
Definition:RDFGraph.h:702
llvm::rdf::DataFlowGraph::DefStack::clear_block
void clear_block(NodeId N)
Definition:RDFGraph.cpp:698
llvm::rdf::DataFlowGraph::DefStack::empty
bool empty() const
Definition:RDFGraph.h:705
llvm::rdf::DataFlowGraph::DefStack::start_block
void start_block(NodeId N)
Definition:RDFGraph.cpp:690
llvm::rdf::DataFlowGraph::DefStack::bottom
iterator bottom() const
Definition:RDFGraph.h:747
llvm::rdf::DataFlowGraph::DefStack::Iterator
friend struct Iterator
Definition:RDFGraph.h:756
llvm::rdf::DataFlowGraph::DefStack::size
unsigned size() const
Definition:RDFGraph.cpp:673
llvm::rdf::DataFlowGraph::DefStack::push
void push(Def DA)
Definition:RDFGraph.h:750
llvm::rdf::DataFlowGraph::DefStack::pop
void pop()
Definition:RDFGraph.cpp:683
llvm::rdf::DataFlowGraph::DefStack::iterator
Iterator iterator
Definition:RDFGraph.h:744
llvm::rdf::DataFlowGraph::DefStack::DefStack
DefStack()=default
llvm::rdf::DataFlowGraph::DefStack::top
iterator top() const
Definition:RDFGraph.h:746
llvm::rdf::DataFlowGraph
Definition:RDFGraph.h:660
llvm::rdf::DataFlowGraph::id
NodeId id(const NodeBase *P) const
Definition:RDFGraph.cpp:767
llvm::rdf::DataFlowGraph::unlinkUse
void unlinkUse(Use UA, bool RemoveFromOwner)
Definition:RDFGraph.h:801
llvm::rdf::DataFlowGraph::getLiveIns
const RegisterAggr & getLiveIns() const
Definition:RDFGraph.h:700
llvm::rdf::DataFlowGraph::releaseBlock
void releaseBlock(NodeId B, DefStackMap &DefM)
Definition:RDFGraph.cpp:1008
llvm::rdf::DataFlowGraph::pack
PackedRegisterRef pack(RegisterRef RR)
Definition:RDFGraph.h:781
llvm::rdf::DataFlowGraph::getNextRelated
Ref getNextRelated(Instr IA, Ref RA) const
Definition:RDFGraph.cpp:1162
llvm::rdf::DataFlowGraph::isTracked
bool isTracked(RegisterRef RR) const
Definition:RDFGraph.cpp:1772
llvm::rdf::DataFlowGraph::makeRegRef
RegisterRef makeRegRef(unsigned Reg, unsigned Sub) const
Definition:RDFGraph.cpp:984
llvm::rdf::DataFlowGraph::unpack
RegisterRef unpack(PackedRegisterRef PR) const
Definition:RDFGraph.h:787
llvm::rdf::DataFlowGraph::IsDef
static bool IsDef(const Node BA)
Definition:RDFGraph.h:825
llvm::rdf::DataFlowGraph::getNextShadow
Ref getNextShadow(Instr IA, Ref RA, bool Create)
Definition:RDFGraph.cpp:1224
llvm::rdf::DataFlowGraph::IsPhi
static bool IsPhi(const Node BA)
Definition:RDFGraph.h:835
llvm::rdf::DataFlowGraph::getFunc
Func getFunc() const
Definition:RDFGraph.h:693
llvm::rdf::DataFlowGraph::getDF
const MachineDominanceFrontier & getDF() const
Definition:RDFGraph.h:699
llvm::rdf::DataFlowGraph::IsPreservingDef
static bool IsPreservingDef(const Def DA)
Definition:RDFGraph.h:840
llvm::rdf::DataFlowGraph::getDT
const MachineDominatorTree & getDT() const
Definition:RDFGraph.h:698
llvm::rdf::DataFlowGraph::getRelatedRefs
NodeList getRelatedRefs(Instr IA, Ref RA) const
Definition:RDFGraph.cpp:1135
llvm::rdf::DataFlowGraph::unlinkDef
void unlinkDef(Def DA, bool RemoveFromOwner)
Definition:RDFGraph.h:807
llvm::rdf::DataFlowGraph::getMF
MachineFunction & getMF() const
Definition:RDFGraph.h:694
llvm::rdf::DataFlowGraph::getTII
const TargetInstrInfo & getTII() const
Definition:RDFGraph.h:695
llvm::rdf::DataFlowGraph::IsRef
static bool IsRef(const Node BA)
Definition:RDFGraph.h:817
llvm::rdf::DataFlowGraph::pack
PackedRegisterRef pack(RegisterRef RR) const
Definition:RDFGraph.h:784
llvm::rdf::DataFlowGraph::IsUse
static bool IsUse(const Node BA)
Definition:RDFGraph.h:830
llvm::rdf::DataFlowGraph::ptr
T ptr(NodeId N) const
Definition:RDFGraph.h:683
llvm::rdf::DataFlowGraph::getPRI
const PhysicalRegisterInfo & getPRI() const
Definition:RDFGraph.h:697
llvm::rdf::DataFlowGraph::IsCode
static bool IsCode(const Node BA)
Definition:RDFGraph.h:821
llvm::rdf::DataFlowGraph::markBlock
void markBlock(NodeId B, DefStackMap &DefM)
Definition:RDFGraph.cpp:1001
llvm::rdf::DataFlowGraph::ptr
NodeBase * ptr(NodeId N) const
Definition:RDFGraph.cpp:760
llvm::rdf::DataFlowGraph::findBlock
Block findBlock(MachineBasicBlock *BB) const
Definition:RDFGraph.h:799
llvm::rdf::DataFlowGraph::hasUntrackedRef
bool hasUntrackedRef(Stmt S, bool IgnoreReserved=true) const
Definition:RDFGraph.cpp:1776
llvm::rdf::DataFlowGraph::DefStackMap
std::unordered_map< RegisterId, DefStack > DefStackMap
Definition:RDFGraph.h:772
llvm::rdf::DataFlowGraph::build
void build()
Definition:RDFGraph.h:775
llvm::rdf::DataFlowGraph::getTRI
const TargetRegisterInfo & getTRI() const
Definition:RDFGraph.h:696
llvm::rdf::DataFlowGraph::pushAllDefs
void pushAllDefs(Instr IA, DefStackMap &DM)
Definition:RDFGraph.cpp:1026
llvm::rdf::DataFlowGraph::addr
NodeAddr< T > addr(NodeId N) const
Definition:RDFGraph.h:689
llvm::rdf::DefNode
Definition:RDFGraph.h:588
llvm::rdf::DefNode::getReachedUse
NodeId getReachedUse() const
Definition:RDFGraph.h:591
llvm::rdf::DefNode::setReachedUse
void setReachedUse(NodeId U)
Definition:RDFGraph.h:592
llvm::rdf::DefNode::setReachedDef
void setReachedDef(NodeId D)
Definition:RDFGraph.h:590
llvm::rdf::DefNode::getReachedDef
NodeId getReachedDef() const
Definition:RDFGraph.h:589
llvm::rdf::DefNode::linkToDef
void linkToDef(NodeId Self, Def DA)
Definition:RDFGraph.cpp:439
llvm::rdf::FuncNode
Definition:RDFGraph.h:651
llvm::rdf::FuncNode::getCode
MachineFunction * getCode() const
Definition:RDFGraph.h:652
llvm::rdf::FuncNode::findBlock
Block findBlock(const MachineBasicBlock *BB, const DataFlowGraph &G) const
Definition:RDFGraph.cpp:568
llvm::rdf::FuncNode::getEntryBlock
Block getEntryBlock(const DataFlowGraph &G)
Definition:RDFGraph.cpp:578
llvm::rdf::IndexedSet
Definition:RDFRegisters.h:53
llvm::rdf::IndexedSet< LaneBitmask >::get
LaneBitmask get(uint32_t Idx) const
Definition:RDFRegisters.h:56
llvm::rdf::IndexedSet< LaneBitmask >::insert
uint32_t insert(LaneBitmask Val)
Definition:RDFRegisters.h:62
llvm::rdf::IndexedSet< LaneBitmask >::find
uint32_t find(LaneBitmask Val) const
Definition:RDFRegisters.h:71
llvm::rdf::InstrNode
Definition:RDFGraph.h:629
llvm::rdf::InstrNode::getOwner
Node getOwner(const DataFlowGraph &G)
Definition:RDFGraph.cpp:525
llvm::rdf::LaneMaskIndex
Definition:RDFGraph.h:469
llvm::rdf::LaneMaskIndex::getIndexForLaneMask
uint32_t getIndexForLaneMask(LaneBitmask LM) const
Definition:RDFGraph.h:481
llvm::rdf::LaneMaskIndex::getLaneMaskForIndex
LaneBitmask getLaneMaskForIndex(uint32_t K) const
Definition:RDFGraph.h:472
llvm::rdf::LaneMaskIndex::getIndexForLaneMask
uint32_t getIndexForLaneMask(LaneBitmask LM)
Definition:RDFGraph.h:476
llvm::rdf::LaneMaskIndex::LaneMaskIndex
LaneMaskIndex()=default
llvm::rdf::NodeAddr
Definition:RDFGraph.h:344
llvm::rdf::NodeAddr::NodeAddr
NodeAddr()=default
llvm::rdf::NodeAddr::Addr
T Addr
Definition:RDFGraph.h:361
llvm::rdf::NodeAddr::NodeAddr
NodeAddr(const NodeAddr< S > &NA)
Definition:RDFGraph.h:351
llvm::rdf::NodeAddr::operator==
bool operator==(const NodeAddr< T > &NA) const
Definition:RDFGraph.h:353
llvm::rdf::NodeAddr::NodeAddr
NodeAddr(T A, NodeId I)
Definition:RDFGraph.h:346
llvm::rdf::NodeAddr::Id
NodeId Id
Definition:RDFGraph.h:362
llvm::rdf::NodeAddr::operator!=
bool operator!=(const NodeAddr< T > &NA) const
Definition:RDFGraph.h:357
llvm::rdf::NodeAllocator
Definition:RDFGraph.h:411
llvm::rdf::NodeAllocator::ptr
NodeBase * ptr(NodeId N) const
Definition:RDFGraph.h:421
llvm::rdf::NodeAllocator::NodeMemSize
@ NodeMemSize
Definition:RDFGraph.h:413
llvm::rdf::NodeAllocator::id
NodeId id(const NodeBase *P) const
Definition:RDFGraph.cpp:370
llvm::rdf::NodeAllocator::clear
void clear()
Definition:RDFGraph.cpp:382
llvm::rdf::NodeAllocator::New
Node New()
Definition:RDFGraph.cpp:359
llvm::rdf::NodeAllocator::NodeAllocator
NodeAllocator(uint32_t NPB=4096)
Definition:RDFGraph.h:415
llvm::rdf::NodeAttrs
Definition:RDFGraph.h:266
llvm::rdf::NodeAttrs::set_kind
static uint16_t set_kind(uint16_t A, uint16_t K)
Definition:RDFGraph.h:310
llvm::rdf::NodeAttrs::FlagMask
@ FlagMask
Definition:RDFGraph.h:286
llvm::rdf::NodeAttrs::Phi
@ Phi
Definition:RDFGraph.h:280
llvm::rdf::NodeAttrs::Undef
@ Undef
Definition:RDFGraph.h:292
llvm::rdf::NodeAttrs::PhiRef
@ PhiRef
Definition:RDFGraph.h:289
llvm::rdf::NodeAttrs::Ref
@ Ref
Definition:RDFGraph.h:274
llvm::rdf::NodeAttrs::Code
@ Code
Definition:RDFGraph.h:273
llvm::rdf::NodeAttrs::Block
@ Block
Definition:RDFGraph.h:282
llvm::rdf::NodeAttrs::Preserving
@ Preserving
Definition:RDFGraph.h:290
llvm::rdf::NodeAttrs::Shadow
@ Shadow
Definition:RDFGraph.h:287
llvm::rdf::NodeAttrs::Dead
@ Dead
Definition:RDFGraph.h:293
llvm::rdf::NodeAttrs::TypeMask
@ TypeMask
Definition:RDFGraph.h:272
llvm::rdf::NodeAttrs::Stmt
@ Stmt
Definition:RDFGraph.h:281
llvm::rdf::NodeAttrs::Fixed
@ Fixed
Definition:RDFGraph.h:291
llvm::rdf::NodeAttrs::KindMask
@ KindMask
Definition:RDFGraph.h:277
llvm::rdf::NodeAttrs::Clobbering
@ Clobbering
Definition:RDFGraph.h:288
llvm::rdf::NodeAttrs::Def
@ Def
Definition:RDFGraph.h:278
llvm::rdf::NodeAttrs::Func
@ Func
Definition:RDFGraph.h:283
llvm::rdf::NodeAttrs::Use
@ Use
Definition:RDFGraph.h:279
llvm::rdf::NodeAttrs::None
@ None
Definition:RDFGraph.h:269
llvm::rdf::NodeAttrs::flags
static uint16_t flags(uint16_t T)
Definition:RDFGraph.h:303
llvm::rdf::NodeAttrs::kind
static uint16_t kind(uint16_t T)
Definition:RDFGraph.h:300
llvm::rdf::NodeAttrs::set_type
static uint16_t set_type(uint16_t A, uint16_t T)
Definition:RDFGraph.h:306
llvm::rdf::NodeAttrs::contains
static bool contains(uint16_t A, uint16_t B)
Definition:RDFGraph.h:319
llvm::rdf::NodeAttrs::set_flags
static uint16_t set_flags(uint16_t A, uint16_t F)
Definition:RDFGraph.h:314
llvm::rdf::NodeAttrs::type
static uint16_t type(uint16_t T)
Definition:RDFGraph.h:297
llvm::rdf::NodeBase::Code_struct
Definition:RDFGraph.h:522
llvm::rdf::NodeBase::Code_struct::LastM
NodeId LastM
Definition:RDFGraph.h:524
llvm::rdf::NodeBase::Code_struct::FirstM
NodeId FirstM
Definition:RDFGraph.h:524
llvm::rdf::NodeBase::Code_struct::CP
void * CP
Definition:RDFGraph.h:523
llvm::rdf::NodeBase::Def_struct
Definition:RDFGraph.h:516
llvm::rdf::NodeBase::Def_struct::DU
NodeId DU
Definition:RDFGraph.h:517
llvm::rdf::NodeBase::Def_struct::DD
NodeId DD
Definition:RDFGraph.h:517
llvm::rdf::NodeBase::PhiU_struct
Definition:RDFGraph.h:519
llvm::rdf::NodeBase::PhiU_struct::PredB
NodeId PredB
Definition:RDFGraph.h:520
llvm::rdf::NodeBase::Ref_struct
Definition:RDFGraph.h:526
llvm::rdf::NodeBase::Ref_struct::RD
NodeId RD
Definition:RDFGraph.h:527
llvm::rdf::NodeBase::Ref_struct::Op
MachineOperand * Op
Definition:RDFGraph.h:533
llvm::rdf::NodeBase::Ref_struct::Sib
NodeId Sib
Definition:RDFGraph.h:527
llvm::rdf::NodeBase::Ref_struct::PR
PackedRegisterRef PR
Definition:RDFGraph.h:534
llvm::rdf::NodeBase::Ref_struct::PhiU
PhiU_struct PhiU
Definition:RDFGraph.h:530
llvm::rdf::NodeBase::Ref_struct::Def
Def_struct Def
Definition:RDFGraph.h:529
llvm::rdf::NodeBase
Definition:RDFGraph.h:487
llvm::rdf::NodeBase::getNext
NodeId getNext() const
Definition:RDFGraph.h:495
llvm::rdf::NodeBase::setFlags
void setFlags(uint16_t F)
Definition:RDFGraph.h:499
llvm::rdf::NodeBase::NodeBase
NodeBase()=default
llvm::rdf::NodeBase::Attrs
uint16_t Attrs
Definition:RDFGraph.h:510
llvm::rdf::NodeBase::Reserved
uint16_t Reserved
Definition:RDFGraph.h:511
llvm::rdf::NodeBase::RefData
Ref_struct RefData
Definition:RDFGraph.h:540
llvm::rdf::NodeBase::getAttrs
uint16_t getAttrs() const
Definition:RDFGraph.h:497
llvm::rdf::NodeBase::getType
uint16_t getType() const
Definition:RDFGraph.h:492
llvm::rdf::NodeBase::setAttrs
void setAttrs(uint16_t A)
Definition:RDFGraph.h:498
llvm::rdf::NodeBase::append
void append(Node NA)
Definition:RDFGraph.cpp:389
llvm::rdf::NodeBase::getFlags
uint16_t getFlags() const
Definition:RDFGraph.h:494
llvm::rdf::NodeBase::Next
NodeId Next
Definition:RDFGraph.h:512
llvm::rdf::NodeBase::setNext
void setNext(NodeId N)
Definition:RDFGraph.h:507
llvm::rdf::NodeBase::CodeData
Code_struct CodeData
Definition:RDFGraph.h:541
llvm::rdf::NodeBase::getKind
uint16_t getKind() const
Definition:RDFGraph.h:493
llvm::rdf::NodeBase::init
void init()
Definition:RDFGraph.h:505
llvm::rdf::PackedRegisterRef
Definition:RDFGraph.h:464
llvm::rdf::PackedRegisterRef::MaskId
uint32_t MaskId
Definition:RDFGraph.h:466
llvm::rdf::PackedRegisterRef::Reg
RegisterId Reg
Definition:RDFGraph.h:465
llvm::rdf::PhiNode
Definition:RDFGraph.h:633
llvm::rdf::PhiNode::getCode
MachineInstr * getCode() const
Definition:RDFGraph.h:634
llvm::rdf::PhiUseNode
Definition:RDFGraph.h:601
llvm::rdf::PhiUseNode::getPredecessor
NodeId getPredecessor() const
Definition:RDFGraph.h:602
llvm::rdf::PhiUseNode::setPredecessor
void setPredecessor(NodeId B)
Definition:RDFGraph.h:606
llvm::rdf::PhysicalRegisterInfo
Definition:RDFRegisters.h:141
llvm::rdf::PrintNode
Definition:RDFGraph.h:969
llvm::rdf::PrintNode::PrintNode
PrintNode(const NodeAddr< T > &x, const DataFlowGraph &g)
Definition:RDFGraph.h:970
llvm::rdf::Print
Definition:RDFGraph.h:960
llvm::rdf::Print::Print
Print(const T &x, const DataFlowGraph &g)
Definition:RDFGraph.h:961
llvm::rdf::Print::G
const DataFlowGraph & G
Definition:RDFGraph.h:964
llvm::rdf::Print::Obj
const T & Obj
Definition:RDFGraph.h:963
llvm::rdf::RefNode
Definition:RDFGraph.h:553
llvm::rdf::RefNode::isDef
bool isDef() const
Definition:RDFGraph.h:577
llvm::rdf::RefNode::getReachingDef
NodeId getReachingDef() const
Definition:RDFGraph.h:566
llvm::rdf::RefNode::getSibling
NodeId getSibling() const
Definition:RDFGraph.h:569
llvm::rdf::RefNode::getNextRef
Ref getNextRef(RegisterRef RR, Predicate P, bool NextOnly, const DataFlowGraph &G)
Definition:RDFGraph.h:912
llvm::rdf::RefNode::setRegRef
void setRegRef(RegisterRef RR, DataFlowGraph &G)
Definition:RDFGraph.cpp:411
llvm::rdf::RefNode::getOp
MachineOperand & getOp()
Definition:RDFGraph.h:558
llvm::rdf::RefNode::getRegRef
RegisterRef getRegRef(const DataFlowGraph &G) const
Definition:RDFGraph.cpp:401
llvm::rdf::RefNode::RefNode
RefNode()=default
llvm::rdf::RefNode::isUse
bool isUse() const
Definition:RDFGraph.h:572
llvm::rdf::RefNode::setSibling
void setSibling(NodeId Sib)
Definition:RDFGraph.h:570
llvm::rdf::RefNode::setReachingDef
void setReachingDef(NodeId RD)
Definition:RDFGraph.h:567
llvm::rdf::RefNode::getOwner
Node getOwner(const DataFlowGraph &G)
Definition:RDFGraph.cpp:427
llvm::rdf::RegisterAggrMap
Definition:RDFRegisters.h:290
llvm::rdf::RegisterAggr
Definition:RDFRegisters.h:204
llvm::rdf::RegisterRef
Definition:RDFRegisters.h:88
llvm::rdf::RegisterRef::Mask
LaneBitmask Mask
Definition:RDFRegisters.h:90
llvm::rdf::RegisterRef::Reg
RegisterId Reg
Definition:RDFRegisters.h:89
llvm::rdf::StmtNode
Definition:RDFGraph.h:637
llvm::rdf::StmtNode::getCode
MachineInstr * getCode() const
Definition:RDFGraph.h:638
llvm::rdf::TargetOperandInfo
Definition:RDFGraph.h:452
llvm::rdf::TargetOperandInfo::isFixedReg
virtual bool isFixedReg(const MachineInstr &In, unsigned OpNum) const
Definition:RDFGraph.cpp:607
llvm::rdf::TargetOperandInfo::TII
const TargetInstrInfo & TII
Definition:RDFGraph.h:460
llvm::rdf::TargetOperandInfo::~TargetOperandInfo
virtual ~TargetOperandInfo()=default
llvm::rdf::TargetOperandInfo::isPreserving
virtual bool isPreserving(const MachineInstr &In, unsigned OpNum) const
Definition:RDFGraph.cpp:588
llvm::rdf::TargetOperandInfo::isClobbering
virtual bool isClobbering(const MachineInstr &In, unsigned OpNum) const
Definition:RDFGraph.cpp:594
llvm::rdf::TargetOperandInfo::TargetOperandInfo
TargetOperandInfo(const TargetInstrInfo &tii)
Definition:RDFGraph.h:453
llvm::rdf::UseNode
Definition:RDFGraph.h:597
llvm::rdf::UseNode::linkToDef
void linkToDef(NodeId Self, Def DA)
Definition:RDFGraph.cpp:446

Generated on Sun Jul 20 2025 07:12:23 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp