LLVM 19.0.0git
DbgVariableFragmentInfo.h
Go to the documentation of this file.
1//===- llvm/IR/DbgVariableFragmentInfo.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// Helper struct to describe a fragment of a debug variable.
10//
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_IR_DBGVARIABLEFRAGMENTINFO_H
13#define LLVM_IR_DBGVARIABLEFRAGMENTINFO_H
14
15#include <cstdint>
16
17namespace llvm {
24 /// Return the index of the first bit of the fragment.
25 uint64_t startInBits() const { return OffsetInBits; }
26 /// Return the index of the bit after the end of the fragment, e.g. for
27 /// fragment offset=16 and size=32 return their sum, 48.
29
30 /// Returns a zero-sized fragment if A and B don't intersect.
33 // Don't use std::max or min to avoid including <algorithm>.
34 uint64_t StartInBits =
35 A.OffsetInBits > B.OffsetInBits ? A.OffsetInBits : B.OffsetInBits;
36 uint64_t EndInBits =
37 A.endInBits() < B.endInBits() ? A.endInBits() : B.endInBits();
38 if (EndInBits <= StartInBits)
39 return {0, 0};
40 return DbgVariableFragmentInfo(EndInBits - StartInBits, StartInBits);
41 }
42};
43} // end namespace llvm
44
45#endif // LLVM_IR_DBGVARIABLEFRAGMENTINFO_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
uint64_t startInBits() const
Return the index of the first bit of the fragment.
DbgVariableFragmentInfo(uint64_t SizeInBits, uint64_t OffsetInBits)
static DbgVariableFragmentInfo intersect(DbgVariableFragmentInfo A, DbgVariableFragmentInfo B)
Returns a zero-sized fragment if A and B don't intersect.
uint64_t endInBits() const
Return the index of the bit after the end of the fragment, e.g.