LLVM 20.0.0git
SuffixTreeNode.cpp
Go to the documentation of this file.
1//===- llvm/ADT/SuffixTreeNode.cpp - Nodes for SuffixTrees --------*- C++
2//-*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines nodes for use within a SuffixTree.
11//
12//===----------------------------------------------------------------------===//
13
16
17using namespace llvm;
18
19unsigned SuffixTreeNode::getStartIdx() const { return StartIdx; }
20void SuffixTreeNode::incrementStartIdx(unsigned Inc) { StartIdx += Inc; }
21void SuffixTreeNode::setConcatLen(unsigned Len) { ConcatLen = Len; }
22unsigned SuffixTreeNode::getConcatLen() const { return ConcatLen; }
23
25 return getStartIdx() == EmptyIdx;
26}
27unsigned SuffixTreeInternalNode::getEndIdx() const { return EndIdx; }
29 assert(L && "Cannot set a null link?");
30 Link = L;
31}
33
35 assert(EndIdx && "EndIdx is empty?");
36 return *EndIdx;
37}
38
39unsigned SuffixTreeLeafNode::getSuffixIdx() const { return SuffixIdx; }
40void SuffixTreeLeafNode::setSuffixIdx(unsigned Idx) { SuffixIdx = Idx; }
41
42unsigned SuffixTreeNode::getLeftLeafIdx() const { return LeftLeafIdx; }
43unsigned SuffixTreeNode::getRightLeafIdx() const { return RightLeafIdx; }
44void SuffixTreeNode::setLeftLeafIdx(unsigned Idx) { LeftLeafIdx = Idx; }
45void SuffixTreeNode::setRightLeafIdx(unsigned Idx) { RightLeafIdx = Idx; }
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
SuffixTreeInternalNode * getLink() const
unsigned getEndIdx() const override
void setLink(SuffixTreeInternalNode *L)
Sets Link to L. Assumes L is not null.
void setSuffixIdx(unsigned Idx)
Sets the start index of the suffix represented by this leaf to Idx.
unsigned getEndIdx() const override
unsigned getSuffixIdx() const
void incrementStartIdx(unsigned Inc)
Advance this node's StartIdx by Inc.
void setConcatLen(unsigned Len)
Set the length of the string from the root to this node to Len.
unsigned getLeftLeafIdx() const
unsigned getRightLeafIdx() const
void setRightLeafIdx(unsigned Idx)
Set the index of the right most leaf node of this node to Idx.
unsigned getConcatLen() const
static const unsigned EmptyIdx
Represents an undefined index in the suffix tree.
unsigned getStartIdx() const
void setLeftLeafIdx(unsigned Idx)
Set the index of the left most leaf node of this node to Idx.