LLVM 24.0.0git
FunctionLocalMetadata.h
Go to the documentation of this file.
1//===- FunctionLocalMetadata.h - Function-Local Metadata Info ---*- 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// This file contains definitions for the function-local metadata types and the
10// MDFunctionLocalContext class which stores them.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_IR_FUNCTIONLOCALMETADATA_H
15#define LLVM_IR_FUNCTIONLOCALMETADATA_H
16
17#include "llvm/ADT/DenseMap.h"
18#include "llvm/ADT/STLExtras.h"
21#include "llvm/IR/Metadata.h"
22#include <optional>
23
24namespace llvm {
25
26class DILocalScope;
28
29struct FLScope;
30struct FLSrcLoc;
31struct FLInlinedCall;
32
33namespace detail {
34template <typename T> struct HasFLIndex {};
35template <> struct HasFLIndex<FLScope> {
37};
38template <> struct HasFLIndex<FLSrcLoc> {
40};
41template <> struct HasFLIndex<FLInlinedCall> {
43};
44} // namespace detail
45
46/// Small wrapper class for an FLMD index, which may be "no index".
47/// Should be checked to see if value is present before using, otherwise the
48/// implicit/explicit index value will be invalid.
49/// Internally uses 0 as the "no index" value, and stores the internal index
50/// value as the actual index + 1, subtracting to get the real index.
51template <typename IndexedType> class FLIndex {
52public:
54
55private:
56 friend struct DenseMapInfo<FLIndex<IndexedType>>;
57 IndexType Index;
58
59public:
60 FLIndex() : Index(0) {}
61 FLIndex(std::nullopt_t) : Index(0) {}
62 FLIndex(IndexType InIndex) : Index(InIndex + 1) {
63 assert(InIndex < std::numeric_limits<IndexType>::max() &&
64 "Hit maximum index limit!");
65 }
66 operator bool() const { return Index; }
67 IndexType get() const { return Index - 1; }
68 bool operator==(const FLIndex &Other) const { return Index == Other.Index; }
69 bool operator!=(const FLIndex &Other) const { return Index != Other.Index; }
70
71 IndexType asRaw() const { return Index; }
72 static FLIndex fromRaw(IndexType RawIndex) {
73 FLIndex Index;
74 Index.Index = RawIndex;
75 return Index;
76 }
77
78 friend inline hash_code hash_value(const FLIndex<IndexedType> &Idx) {
79 return hash_value(Idx.asRaw());
80 }
81};
82
83template <typename IndexedType> struct DenseMapInfo<FLIndex<IndexedType>> {
85 return hash_value(DL.asRaw());
86 }
87
89 return LHS == RHS;
90 }
91};
92
94 // The FLDebugLoc class, where the atom group numbers are used, has only 13
95 // bits to store AtomGroup - thus there is currently no point in holding
96 // MaxAtomGroup numbers larger than 13 bits.
97 constexpr static uint16_t MaxAllowedAtomGroup = (1 << 13) - 1;
100 // Transient field used to track the largest atom in this inlined call context
101 // for the purpose of generating new atom groups.
102 // NB: We keep the MaxAtomGroup field at 15 bits for padding purposes, but it
103 // is capped at 13 bits (see MaxAllowedAtomGroup above); In future we may
104 // reclaim these bits for some other purpose.
108 FLInlinedCall() = default;
120 // TODO: This assert exists more for testing purposes, to determine whether
121 // this is a limit we actually hit or not. If we hit this frequently, we may
122 // need to consider a fix; if we do relax this assert, then we'll need to
123 // also relax the assert in mapAtomInstance that new atom groups are
124 // strictly greater than old.
125 // Suitable fixes include either refusing further atom groups by always
126 // returning 0 once the limit is reached, or wrapping back around to 1
127 // (which is very unlikely to cause any meaningful collisions).
128 assert(MaxAtomGroup < MaxAllowedAtomGroup && "Atom group limit reached!");
129 return ++MaxAtomGroup;
130 }
131 // Equality check that ignores MaxAtomGroup, which is a transient field - it
132 // is not serialized, and may be modified in-place.
133 bool isEquivalent(const FLInlinedCall &Other) const {
134 return SrcLocIdx == Other.SrcLocIdx && InlinedAtIdx == Other.InlinedAtIdx &&
135 Uniquable == Other.Uniquable &&
136 InlineeContext == Other.InlineeContext;
137 }
138 /// Returns true if the location of this FLInlinedCall is inlined.
139 bool isInlined() const { return InlinedAtIdx; }
140 /// Returns the FLInlinedCall that this call was inlined at; only valid if
141 /// isInlined().
143
144 // Ignores MaxAtomGroup - as a transient field, we do not want to use it as
145 // part of a map key.
146 friend inline hash_code hash_value(const FLInlinedCall &IC) {
148 IC.InlineeContext);
149 }
150};
151template <> struct DenseMapInfo<FLInlinedCall> {
152 static unsigned getHashValue(FLInlinedCall IC) { return hash_value(IC); }
153
155 return LHS.isEquivalent(RHS);
156 }
157};
158
159/// Unique FLMD.
160/// Stores source location information.
161struct FLSrcLoc {
165 FLSrcLoc() = default;
168 assert(ScopeIdx && "SrcLoc needs valid scope!");
169 }
171 static_assert(sizeof(*this) == sizeof(uint64_t));
172 uint64_t Result;
173 std::memcpy(&Result, this, sizeof(Result));
174 return Result;
175 }
176 bool operator==(const FLSrcLoc &Other) const {
177 return asRawInt() == Other.asRawInt();
178 }
179 friend inline hash_code hash_value(const FLSrcLoc &SrcLoc) {
180 return hash_value(SrcLoc.asRawInt());
181 }
182};
183template <> struct DenseMapInfo<FLSrcLoc> {
184 static unsigned getHashValue(FLSrcLoc SrcLoc) { return hash_value(SrcLoc); }
185
186 static bool isEqual(FLSrcLoc LHS, FLSrcLoc RHS) { return LHS == RHS; }
187};
188
189/// Unique FLMD, just a wrapper around a DILocalScope.
190struct FLScope {
192 FLScope() = default;
194 operator DILocalScope *() { return Scope; }
195 DILocalScope *get() { return Scope; }
196 operator const DILocalScope *() const { return Scope; }
197 const DILocalScope *get() const { return Scope; }
198 bool operator==(const FLScope &Other) const { return Scope == Other.Scope; }
199 friend inline hash_code hash_value(const FLScope &Scope) {
200 return hash_value(Scope.Scope);
201 }
202};
203template <> struct DenseMapInfo<FLScope> {
204 static unsigned getHashValue(FLScope Scope) { return hash_value(Scope); }
205
206 static bool isEqual(FLScope LHS, FLScope RHS) { return LHS == RHS; }
207};
208
209/// Storage class for function-local metadata objects.
210/// This is a special MDNode variation: the class benefits from being able to
211/// appear as an operand in other MDNodes, to be treated as a metadata
212/// attachment to functions, and from the generic MDNode enumeration logic.
213/// However, it holds MDNode references that are not part of the MDNode
214/// operands() array and are not tracking references (meaning it contains
215/// forward references that must be resolved separately from the generic MDNode
216/// tracking/resolution facilities), does not meaningfully support cloning, and
217/// can only ever be created as `distinct`, not unique or temporary.
218/// To access all MDNodes referenced from this context, use the
219/// `getUsedMDNodes()` function.
220class MDFunctionLocalContext : public MDNode {
221 MDFunctionLocalContext(LLVMContext &C, StorageType Storage, bool NonDebug)
222 : MDNode(C, MDFunctionLocalContextKind, Storage, {}) {
223 // NonDebug: Identifies this context as belonging to a function without
224 // debug information; see `isNonDebug()` below for more details.
225 setNonDebug(NonDebug);
226 // MaxAtomGroup: Transient/non-serialized field, starts at 0 and mutates
227 // in-place.
228 SubclassData16 = 0;
229 }
230 ~MDFunctionLocalContext() = default;
231
235
236 // Should generally only be used for deferred construction of an
237 // MDFunctionLocalContext, i.e. when we want to construct an instance before
238 // we know whether or not it is a NonDebug context, which may be important (or
239 // at least convenient) for tracking forward references.
240 void setNonDebug(bool IsNonDebug) { SubclassData1 = IsNonDebug; }
241
242public:
243 friend class LLVMContextImpl;
244 friend class MDNode;
245 constexpr static uint16_t MaxAllowedAtomGroup =
247
248 static bool classof(const Metadata *MD) {
249 return MD->getMetadataID() == MDFunctionLocalContextKind;
250 }
251
252 // Populates \p Nodes with the complete set of MDNodes used by this.
254
256 bool NonDebug = false);
257 TempMDFunctionLocalContext clone() const { return cloneImpl(); }
258 TempMDFunctionLocalContext cloneImpl() const {
259 llvm_unreachable("Clone unsupported for MDFunctionLocalContext.");
260 return nullptr;
261 }
262
263 // If this is true, then this is a special FLContext, used for a function
264 // without debug info to store inlined call information. This FLContext
265 // contains no Scopes and no SrcLocs, meaning it is never valid to create a
266 // non-inlined debug loc within it.
267 // Nested InlinedCalls are copied during inlining as normal, and the resulting
268 // InlinedCall for the inlining operation has no SrcLoc and no InlinedAt; this
269 // requires some special handling for functions like "getInlinedAtLocation"
270 // that explicitly traverse the InlinedAt chain. If this function is then
271 // inlined into a debug function, the location-less InlinedCall is overwritten
272 // instead of transferred.
273 // NB: Hopefully this design doesn't raise many problems as-is, because in
274 // general we only care about debug locs inlined into a nodebug function when
275 // they are inlined again into a debug function - otherwise they are generally
276 // ignored. If this leads to problems, then we need a more sophisticated
277 // solution.
278 bool isNonDebug() const { return SubclassData1; }
279
280 ArrayRef<FLScope> getScopes() const { return Scopes; }
281 ArrayRef<FLSrcLoc> getSrcLocs() const { return SrcLocs; }
282 ArrayRef<FLInlinedCall> getInlinedCalls() const { return InlinedCalls; }
283
285 assert(Idx && "Attempted to fetch a Scope with an empty index!");
286 return Scopes[Idx.get()];
287 }
289 FLIndex<FLInlinedCall> InlinedAt) const {
290 assert(Idx && "Attempted to fetch a Scope with an empty index!");
291 if (!InlinedAt)
292 return Scopes[Idx.get()];
293 return InlinedCalls[InlinedAt.get()].getInlinee()->getScope(Idx);
294 }
296 assert(Idx && "Attempted to fetch a SrcLoc with an empty index!");
297 return SrcLocs[Idx.get()];
298 }
300 FLIndex<FLInlinedCall> InlinedAt) const {
301 assert(Idx && "Attempted to fetch a SrcLoc with an empty index!");
302 if (!InlinedAt)
303 return SrcLocs[Idx.get()];
304 return InlinedCalls[InlinedAt.get()].getInlinee()->getSrcLoc(Idx);
305 }
307 assert(Idx && "Attempted to fetch an InlinedCall with an empty index!");
308 return InlinedCalls[Idx.get()];
309 }
310
312 /// Generally this shouldn't be called directly; prefer
313 /// updateAtomGroupWaterline, including any relevant InlinedAt.
314 /// TODO: Should this be private?
315 void setMaxAtomGroup(uint16_t NewAtomGroup) { SubclassData16 = NewAtomGroup; }
316
318 if (!InlinedCallIdx) {
319 // NB: See comment in FLInlinedCall::getNewAtomGroup.
321 "Atom group limit reached!");
323 return getMaxAtomGroup();
324 }
325 return InlinedCalls[InlinedCallIdx.get()].getNewAtomGroup();
326 }
328 uint16_t NewWaterline) {
329 assert(NewWaterline <= MaxAllowedAtomGroup &&
330 "New atom group exceeds limit!");
331 if (!InlinedCallIdx)
332 setMaxAtomGroup(std::max(getMaxAtomGroup(), NewWaterline));
333 else
334 InlinedCalls[InlinedCallIdx.get()].MaxAtomGroup = std::max(
335 InlinedCalls[InlinedCallIdx.get()].MaxAtomGroup, NewWaterline);
336 }
338 if (!InlinedCallIdx)
339 return getMaxAtomGroup();
340 return InlinedCalls[InlinedCallIdx.get()].MaxAtomGroup;
341 }
342
343 /// Inserts a new FLScope \p Scope and returns its index.
345 Scopes.push_back(Scope);
346 return Scopes.size() - 1;
347 }
348 /// Returns the existing index of \p Scope, or else inserts it and returns its
349 /// new index.
350 /// NB: Uses linear search, which is very inefficient, but required if we
351 /// may be inserting a duplicate Scope; if performing this operation
352 /// repeatedly, FLMDBuilder is significantly more efficient.
354 for (uint16_t Idx = 0; Idx < Scopes.size(); ++Idx)
355 if (Scopes[Idx] == Scope)
356 return Idx;
357 return insertScope(Scope);
358 }
359
360 /// Inserts a new FLSrcLoc \p SrcLoc and returns its index.
362 SrcLocs.push_back(SrcLoc);
363 return SrcLocs.size() - 1;
364 }
365 /// Returns the existing index of \p SrcLoc, or else inserts it and returns
366 /// its new index.
367 /// NB: Uses linear search, which is very inefficient, but required if we
368 /// may be inserting a duplicate SrcLoc; if performing this operation
369 /// repeatedly, FLMDBuilder is significantly more efficient.
370 /// An exception to this is if inserting a SrcLoc with DISubprogram scope,
371 /// column=0, and line equal to either 0, SP->getLine(), or
372 /// SP->getScopeLine(); these are inserted near the front of SrcLocs by
373 /// FLMDBuilder, so can generally be retrieved quickly.
375 for (uint32_t Idx = 0; Idx < SrcLocs.size(); ++Idx)
376 if (SrcLocs[Idx] == SrcLoc)
377 return Idx;
378 return insertSrcLoc(SrcLoc);
379 }
380
381 /// Returns the existing index of a uniquable \p InlinedCall, or else inserts
382 /// it and returns its new index.
383 /// NB: Uses linear search for uniquing, which is very inefficient; pass
384 /// \p UniquableMayExist as false if passing an InlinedCall which is uniquable
385 /// but is known to not already exist.
387 bool UniquableMayExist = true) {
388 if (InlinedCall.Uniquable && UniquableMayExist) {
389 for (uint16_t Idx = 0; Idx < InlinedCalls.size(); ++Idx) {
390 if (InlinedCall.isEquivalent(InlinedCalls[Idx])) {
391 InlinedCalls[Idx].MaxAtomGroup = std::max(
392 InlinedCall.MaxAtomGroup, InlinedCalls[Idx].MaxAtomGroup);
393 return FLIndex<FLInlinedCall>(Idx);
394 }
395 }
396 }
397 InlinedCalls.push_back(InlinedCall);
398 return InlinedCalls.size() - 1;
399 }
400};
401
402inline FLInlinedCall
404 assert(isInlined() && "getInlinedAt requires the location of this "
405 "FLInlinedCall to be inlined!");
406 return FLCtx->getInlinedCall(InlinedAtIdx);
407}
408
409/// Builder class used to more efficiently insert new entries into an
410/// MDFunctionLocalContext, using maps to perform uniquing instead of linear
411/// search.
412/// If inserting into an empty MDFunctionLocalContext, also performs initial
413/// insertions of the DISubprogram, and of SrcLocs for
414/// Line={0, SP->getLine(), SP->getScopeLine()} at top-level scope, as these are
415/// likely to be requested by optimizations later on.
417 MDFunctionLocalContext *FLContext;
420
421public:
422 // Returns the index for a Scope with the given arguments, either returning
423 // the index of an existing copy or inserting a new entry and returning its
424 // index.
426 FLScope InsertedScope(const_cast<DILocalScope *>(Scope));
427 auto [ScopeIt, Inserted] = ScopeMap.try_emplace(InsertedScope);
428 if (Inserted)
429 ScopeIt->second = FLContext->insertScope(InsertedScope);
430 return ScopeIt->second;
431 }
432 // Returns the index for a SrcLoc with the given arguments, either returning
433 // the index of an existing copy or inserting a new entry and returning its
434 // index.
436 FLIndex<FLScope> ScopeIdx) {
437 FLSrcLoc InsertedSrcLoc(Line, Column, ScopeIdx);
438 auto [SrcLocIt, Inserted] = SrcLocMap.try_emplace(InsertedSrcLoc);
439 if (Inserted)
440 SrcLocIt->second = FLContext->insertSrcLoc(InsertedSrcLoc);
441 return SrcLocIt->second;
442 }
443 // Returns the index for a SrcLoc with the given arguments, either returning
444 // the index of an existing copy or inserting a new entry and returning its
445 // index. May also insert \p Scope into the FunctionLocalContext.
447 const DILocalScope *Scope) {
448 FLIndex<FLScope> ScopeIdx = getScope(Scope);
449 return getSrcLoc(Line, Column, ScopeIdx);
450 }
451
453 const DISubprogram *SP);
454};
455
456} // end namespace llvm
457
458#endif // LLVM_IR_FUNCTIONLOCALMETADATA_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_ABI
Definition Compiler.h:211
This file defines the DenseMap class.
This file contains the declarations for metadata subclasses.
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
Value * RHS
Value * LHS
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
A scope for locals.
Subprogram description. Uses SubclassData1.
Small wrapper class for an FLMD index, which may be "no index".
FLIndex(std::nullopt_t)
bool operator!=(const FLIndex &Other) const
bool operator==(const FLIndex &Other) const
IndexType get() const
friend hash_code hash_value(const FLIndex< IndexedType > &Idx)
typename detail::HasFLIndex< IndexedType >::IndexType IndexType
static FLIndex fromRaw(IndexType RawIndex)
FLIndex(IndexType InIndex)
IndexType asRaw() const
FLIndex< FLSrcLoc > getSrcLoc(uint32_t Line, uint16_t Column, FLIndex< FLScope > ScopeIdx)
FLIndex< FLSrcLoc > getSrcLocWithScope(uint32_t Line, uint16_t Column, const DILocalScope *Scope)
FLIndex< FLScope > getScope(const DILocalScope *Scope)
LLVM_ABI FLMDBuilder(MDFunctionLocalContext *FLContext, const DISubprogram *SP)
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
Storage class for function-local metadata objects.
ArrayRef< FLInlinedCall > getInlinedCalls() const
FLSrcLoc getSrcLoc(FLIndex< FLSrcLoc > Idx) const
LLVM_ABI void getUsedMDNodes(SmallVectorImpl< const MDNode * > &Nodes) const
static bool classof(const Metadata *MD)
TempMDFunctionLocalContext clone() const
uint16_t getAtomGroupWaterline(FLIndex< FLInlinedCall > InlinedCallIdx)
FLIndex< FLSrcLoc > getOrInsertSrcLoc(FLSrcLoc SrcLoc)
Returns the existing index of SrcLoc, or else inserts it and returns its new index.
void setMaxAtomGroup(uint16_t NewAtomGroup)
Generally this shouldn't be called directly; prefer updateAtomGroupWaterline, including any relevant ...
FLInlinedCall getInlinedCall(FLIndex< FLInlinedCall > Idx) const
FLIndex< FLScope > getOrInsertScope(FLScope Scope)
Returns the existing index of Scope, or else inserts it and returns its new index.
TempMDFunctionLocalContext cloneImpl() const
FLIndex< FLInlinedCall > insertInlinedCall(FLInlinedCall InlinedCall, bool UniquableMayExist=true)
Returns the existing index of a uniquable InlinedCall, or else inserts it and returns its new index.
FLSrcLoc getSrcLoc(FLIndex< FLSrcLoc > Idx, FLIndex< FLInlinedCall > InlinedAt) const
FLIndex< FLSrcLoc > insertSrcLoc(FLSrcLoc SrcLoc)
Inserts a new FLSrcLoc SrcLoc and returns its index.
ArrayRef< FLScope > getScopes() const
void updateAtomGroupWaterline(FLIndex< FLInlinedCall > InlinedCallIdx, uint16_t NewWaterline)
ArrayRef< FLSrcLoc > getSrcLocs() const
FLScope getScope(FLIndex< FLScope > Idx, FLIndex< FLInlinedCall > InlinedAt) const
FLIndex< FLScope > insertScope(FLScope Scope)
Inserts a new FLScope Scope and returns its index.
FLScope getScope(FLIndex< FLScope > Idx) const
static LLVM_ABI MDFunctionLocalContext * getDistinct(LLVMContext &Context, bool NonDebug=false)
uint16_t getNewAtomGroup(FLIndex< FLInlinedCall > InlinedCallIdx)
static constexpr uint16_t MaxAllowedAtomGroup
Root of the metadata hierarchy.
Definition Metadata.h:65
StorageType
Active type of storage.
Definition Metadata.h:73
unsigned short SubclassData16
Definition Metadata.h:79
unsigned char Storage
Storage flag for non-uniqued, otherwise unowned, metadata.
Definition Metadata.h:76
unsigned getMetadataID() const
Definition Metadata.h:105
unsigned char SubclassData1
Definition Metadata.h:78
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An opaque object representing a hash code.
Definition Hashing.h:77
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Definition ADL.h:123
This is an optimization pass for GlobalISel generic memory operations.
hash_code hash_value(const FixedPointSemantics &Val)
@ Other
Any other memory.
Definition ModRef.h:68
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition Hashing.h:307
static bool isEqual(FLIndex< IndexedType > LHS, FLIndex< IndexedType > RHS)
static unsigned getHashValue(FLIndex< IndexedType > DL)
static unsigned getHashValue(FLInlinedCall IC)
static bool isEqual(FLInlinedCall LHS, FLInlinedCall RHS)
static unsigned getHashValue(FLScope Scope)
static bool isEqual(FLScope LHS, FLScope RHS)
static unsigned getHashValue(FLSrcLoc SrcLoc)
static bool isEqual(FLSrcLoc LHS, FLSrcLoc RHS)
An information struct used to provide DenseMap with the various necessary components for a given valu...
bool isInlined() const
Returns true if the location of this FLInlinedCall is inlined.
FLInlinedCall(FLIndex< FLSrcLoc > SrcLocIdx, FLIndex< FLInlinedCall > InlinedAtIdx, MDFunctionLocalContext *InlineeContext, bool Uniquable, uint16_t MaxAtomGroup=0)
FLIndex< FLInlinedCall > InlinedAtIdx
friend hash_code hash_value(const FLInlinedCall &IC)
MDFunctionLocalContext * getInlinee() const
MDFunctionLocalContext * InlineeContext
FLIndex< FLSrcLoc > SrcLocIdx
FLInlinedCall()=default
bool isEquivalent(const FLInlinedCall &Other) const
FLInlinedCall getInlinedAt(const MDFunctionLocalContext *FLCtx) const
Returns the FLInlinedCall that this call was inlined at; only valid if isInlined().
static constexpr uint16_t MaxAllowedAtomGroup
Unique FLMD, just a wrapper around a DILocalScope.
FLScope()=default
FLScope(DILocalScope *Scope)
friend hash_code hash_value(const FLScope &Scope)
const DILocalScope * get() const
DILocalScope * get()
bool operator==(const FLScope &Other) const
uint64_t asRawInt() const
friend hash_code hash_value(const FLSrcLoc &SrcLoc)
FLSrcLoc()=default
bool operator==(const FLSrcLoc &Other) const
FLSrcLoc(uint32_t Line, uint16_t Column, FLIndex< FLScope > ScopeIdx)
FLIndex< FLScope > ScopeIdx