LLVM 20.0.0git
ExtractRanges.h
Go to the documentation of this file.
1//===- ExtractRanges.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#ifndef LLVM_DEBUGINFO_GSYM_EXTRACTRANGES_H
10#define LLVM_DEBUGINFO_GSYM_EXTRACTRANGES_H
11
13#include "llvm/Support/Format.h"
15#include <stdint.h>
16
17#define HEX8(v) llvm::format_hex(v, 4)
18#define HEX16(v) llvm::format_hex(v, 6)
19#define HEX32(v) llvm::format_hex(v, 10)
20#define HEX64(v) llvm::format_hex(v, 18)
21
22namespace llvm {
23class DataExtractor;
24class raw_ostream;
25
26namespace gsym {
27
28class FileWriter;
29
30/// AddressRange objects are encoded and decoded to be relative to a base
31/// address. This will be the FunctionInfo's start address if the AddressRange
32/// is directly contained in a FunctionInfo, or a base address of the
33/// containing parent AddressRange or AddressRanges. This allows address
34/// ranges to be efficiently encoded using ULEB128 encodings as we encode the
35/// offset and size of each range instead of full addresses. This also makes
36/// encoded addresses easy to relocate as we just need to relocate one base
37/// address.
38/// @{
39AddressRange decodeRange(DataExtractor &Data, uint64_t BaseAddr,
41void encodeRange(const AddressRange &Range, FileWriter &O, uint64_t BaseAddr);
42/// @}
43
44/// Skip an address range object in the specified data a the specified
45/// offset.
46///
47/// \param Data The binary stream to read the data from.
48///
49/// \param Offset The byte offset within \a Data.
50void skipRange(DataExtractor &Data, uint64_t &Offset);
51
52/// Address ranges are decoded and encoded to be relative to a base address.
53/// See the AddressRange comment for the encode and decode methods for full
54/// details.
55/// @{
56void decodeRanges(AddressRanges &Ranges, DataExtractor &Data, uint64_t BaseAddr,
58void encodeRanges(const AddressRanges &Ranges, FileWriter &O,
59 uint64_t BaseAddr);
60/// @}
61
62/// Skip an address range object in the specified data a the specified
63/// offset.
64///
65/// \param Data The binary stream to read the data from.
66///
67/// \param Offset The byte offset within \a Data.
68///
69/// \returns The number of address ranges that were skipped.
70uint64_t skipRanges(DataExtractor &Data, uint64_t &Offset);
71
72} // namespace gsym
73
74raw_ostream &operator<<(raw_ostream &OS, const AddressRange &R);
75
76raw_ostream &operator<<(raw_ostream &OS, const AddressRanges &AR);
77
78} // namespace llvm
79
80#endif // LLVM_DEBUGINFO_GSYM_EXTRACTRANGES_H
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
raw_pwrite_stream & OS
AddressRange decodeRange(DataExtractor &Data, uint64_t BaseAddr, uint64_t &Offset)
AddressRange objects are encoded and decoded to be relative to a base address.
void encodeRanges(const AddressRanges &Ranges, FileWriter &O, uint64_t BaseAddr)
void decodeRanges(AddressRanges &Ranges, DataExtractor &Data, uint64_t BaseAddr, uint64_t &Offset)
Address ranges are decoded and encoded to be relative to a base address.
uint64_t skipRanges(DataExtractor &Data, uint64_t &Offset)
Skip an address range object in the specified data a the specified offset.
void encodeRange(const AddressRange &Range, FileWriter &O, uint64_t BaseAddr)
void skipRange(DataExtractor &Data, uint64_t &Offset)
Skip an address range object in the specified data a the specified offset.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:292