LLVM  14.0.0git
DiagnosticPrinter.h
Go to the documentation of this file.
1 //===- llvm/IR/DiagnosticPrinter.h - Diagnostic Printer ---------*- 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 declares the main interface for printer backend diagnostic.
10 //
11 // Clients of the backend diagnostics should overload this interface based
12 // on their needs.
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_DIAGNOSTICPRINTER_H
16 #define LLVM_IR_DIAGNOSTICPRINTER_H
17 
18 #include <string>
19 
20 namespace llvm {
21 
22 // Forward declarations.
23 class Module;
24 class raw_ostream;
25 class SMDiagnostic;
26 class StringRef;
27 class Twine;
28 class Value;
29 
30 /// Interface for custom diagnostic printing.
32 public:
33  virtual ~DiagnosticPrinter() = default;
34 
35  // Simple types.
36  virtual DiagnosticPrinter &operator<<(char C) = 0;
37  virtual DiagnosticPrinter &operator<<(unsigned char C) = 0;
38  virtual DiagnosticPrinter &operator<<(signed char C) = 0;
39  virtual DiagnosticPrinter &operator<<(StringRef Str) = 0;
40  virtual DiagnosticPrinter &operator<<(const char *Str) = 0;
41  virtual DiagnosticPrinter &operator<<(const std::string &Str) = 0;
42  virtual DiagnosticPrinter &operator<<(unsigned long N) = 0;
43  virtual DiagnosticPrinter &operator<<(long N) = 0;
44  virtual DiagnosticPrinter &operator<<(unsigned long long N) = 0;
45  virtual DiagnosticPrinter &operator<<(long long N) = 0;
46  virtual DiagnosticPrinter &operator<<(const void *P) = 0;
47  virtual DiagnosticPrinter &operator<<(unsigned int N) = 0;
48  virtual DiagnosticPrinter &operator<<(int N) = 0;
49  virtual DiagnosticPrinter &operator<<(double N) = 0;
50  virtual DiagnosticPrinter &operator<<(const Twine &Str) = 0;
51 
52  // IR related types.
53  virtual DiagnosticPrinter &operator<<(const Value &V) = 0;
54  virtual DiagnosticPrinter &operator<<(const Module &M) = 0;
55 
56  // Other types.
57  virtual DiagnosticPrinter &operator<<(const SMDiagnostic &Diag) = 0;
58 };
59 
60 /// Basic diagnostic printer that uses an underlying raw_ostream.
62 protected:
64 
65 public:
67 
68  // Simple types.
69  DiagnosticPrinter &operator<<(char C) override;
70  DiagnosticPrinter &operator<<(unsigned char C) override;
71  DiagnosticPrinter &operator<<(signed char C) override;
72  DiagnosticPrinter &operator<<(StringRef Str) override;
73  DiagnosticPrinter &operator<<(const char *Str) override;
74  DiagnosticPrinter &operator<<(const std::string &Str) override;
75  DiagnosticPrinter &operator<<(unsigned long N) override;
76  DiagnosticPrinter &operator<<(long N) override;
77  DiagnosticPrinter &operator<<(unsigned long long N) override;
78  DiagnosticPrinter &operator<<(long long N) override;
79  DiagnosticPrinter &operator<<(const void *P) override;
80  DiagnosticPrinter &operator<<(unsigned int N) override;
81  DiagnosticPrinter &operator<<(int N) override;
82  DiagnosticPrinter &operator<<(double N) override;
83  DiagnosticPrinter &operator<<(const Twine &Str) override;
84 
85  // IR related types.
86  DiagnosticPrinter &operator<<(const Value &V) override;
87  DiagnosticPrinter &operator<<(const Module &M) override;
88 
89  // Other types.
90  DiagnosticPrinter &operator<<(const SMDiagnostic &Diag) override;
91 };
92 
93 } // end namespace llvm
94 
95 #endif // LLVM_IR_DIAGNOSTICPRINTER_H
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::DiagnosticPrinterRawOStream::DiagnosticPrinterRawOStream
DiagnosticPrinterRawOStream(raw_ostream &Stream)
Definition: DiagnosticPrinter.h:66
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::DiagnosticPrinterRawOStream
Basic diagnostic printer that uses an underlying raw_ostream.
Definition: DiagnosticPrinter.h:61
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::SMDiagnostic
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:251
llvm::DiagnosticPrinterRawOStream::operator<<
DiagnosticPrinter & operator<<(char C) override
Definition: DiagnosticPrinter.cpp:22
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::DiagnosticPrinter
Interface for custom diagnostic printing.
Definition: DiagnosticPrinter.h:31
llvm::DiagnosticPrinter::operator<<
virtual DiagnosticPrinter & operator<<(char C)=0
llvm::DiagnosticPrinterRawOStream::Stream
raw_ostream & Stream
Definition: DiagnosticPrinter.h:63
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::DiagnosticPrinter::~DiagnosticPrinter
virtual ~DiagnosticPrinter()=default
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
N
#define N
llvm::Value
LLVM Value Representation.
Definition: Value.h:74