LLVM 22.0.0git
FDRRecordConsumer.h
Go to the documentation of this file.
1//===- FDRRecordConsumer.h - XRay Flight Data Recorder Mode Records -------===//
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#ifndef LLVM_XRAY_FDRRECORDCONSUMER_H
9#define LLVM_XRAY_FDRRECORDCONSUMER_H
10
12#include "llvm/Support/Error.h"
14#include <algorithm>
15#include <memory>
16#include <vector>
17
18namespace llvm {
19namespace xray {
20
22public:
23 virtual Error consume(std::unique_ptr<Record> R) = 0;
24 virtual ~RecordConsumer() = default;
25};
26
27// This consumer will collect all the records into a vector of records, in
28// arrival order.
30 std::vector<std::unique_ptr<Record>> &Records;
31
32public:
33 explicit LogBuilderConsumer(std::vector<std::unique_ptr<Record>> &R)
34 : Records(R) {}
35
36 Error consume(std::unique_ptr<Record> R) override;
37};
38
39// A PipelineConsumer applies a set of visitors to every consumed Record, in the
40// order by which the visitors are added to the pipeline in the order of
41// appearance.
43 std::vector<RecordVisitor *> Visitors;
44
45public:
46 PipelineConsumer(std::initializer_list<RecordVisitor *> V) : Visitors(V) {}
47
48 Error consume(std::unique_ptr<Record> R) override;
49};
50
51} // namespace xray
52} // namespace llvm
53
54#endif // LLVM_XRAY_FDRRECORDCONSUMER_H
#define LLVM_ABI
Definition Compiler.h:213
static bool consume(InternalInstruction *insn, T &ptr)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
LogBuilderConsumer(std::vector< std::unique_ptr< Record > > &R)
PipelineConsumer(std::initializer_list< RecordVisitor * > V)
virtual Error consume(std::unique_ptr< Record > R)=0
virtual ~RecordConsumer()=default
This is an optimization pass for GlobalISel generic memory operations.