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