LLVM 22.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
15
16using namespace llvm;
17
18unsigned SuffixTreeNode::getStartIdx() const { return StartIdx; }
19void SuffixTreeNode::incrementStartIdx(unsigned Inc) { StartIdx += Inc; }
20void SuffixTreeNode::setConcatLen(unsigned Len) { ConcatLen = Len; }
21unsigned SuffixTreeNode::getConcatLen() const { return ConcatLen; }
22
24 return getStartIdx() == EmptyIdx;
25}
26unsigned SuffixTreeInternalNode::getEndIdx() const { return EndIdx; }
28 assert(L && "Cannot set a null link?");
29 Link = L;
30}
32
34 assert(EndIdx && "EndIdx is empty?");
35 return *EndIdx;
36}
37
38unsigned SuffixTreeLeafNode::getSuffixIdx() const { return SuffixIdx; }
39void SuffixTreeLeafNode::setSuffixIdx(unsigned Idx) { SuffixIdx = Idx; }
40
41unsigned SuffixTreeNode::getLeftLeafIdx() const { return LeftLeafIdx; }
42unsigned SuffixTreeNode::getRightLeafIdx() const { return RightLeafIdx; }
43void SuffixTreeNode::setLeftLeafIdx(unsigned Idx) { LeftLeafIdx = Idx; }
44void SuffixTreeNode::setRightLeafIdx(unsigned Idx) { RightLeafIdx = Idx; }
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This is an optimization pass for GlobalISel generic memory operations.
SuffixTreeInternalNode * getLink() const
unsigned getEndIdx() const override
void setLink(SuffixTreeInternalNode *L)
Sets Link to L. Assumes L is not null.
SuffixTreeInternalNode(unsigned StartIdx, unsigned EndIdx, SuffixTreeInternalNode *Link)
void setSuffixIdx(unsigned Idx)
Sets the start index of the suffix represented by this leaf to Idx.
unsigned getEndIdx() const override
unsigned getSuffixIdx() const
LLVM_ABI void incrementStartIdx(unsigned Inc)
Advance this node's StartIdx by Inc.
LLVM_ABI void setConcatLen(unsigned Len)
Set the length of the string from the root to this node to Len.
LLVM_ABI unsigned getLeftLeafIdx() const
LLVM_ABI unsigned getRightLeafIdx() const
LLVM_ABI void setRightLeafIdx(unsigned Idx)
Set the index of the right most leaf node of this node to Idx.
LLVM_ABI unsigned getConcatLen() const
static const unsigned EmptyIdx
Represents an undefined index in the suffix tree.
LLVM_ABI unsigned getStartIdx() const
LLVM_ABI void setLeftLeafIdx(unsigned Idx)
Set the index of the left most leaf node of this node to Idx.