LLVM  14.0.0git
Printable.h
Go to the documentation of this file.
1 //===--- Printable.h - Print function helpers -------------------*- 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 defines the Printable struct.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_SUPPORT_PRINTABLE_H
14 #define LLVM_SUPPORT_PRINTABLE_H
15 
16 #include <functional>
17 #include <utility>
18 
19 namespace llvm {
20 
21 class raw_ostream;
22 
23 /// Simple wrapper around std::function<void(raw_ostream&)>.
24 /// This class is useful to construct print helpers for raw_ostream.
25 ///
26 /// Example:
27 /// Printable PrintRegister(unsigned Register) {
28 /// return Printable([Register](raw_ostream &OS) {
29 /// OS << getRegisterName(Register);
30 /// }
31 /// }
32 /// ... OS << PrintRegister(Register); ...
33 ///
34 /// Implementation note: Ideally this would just be a typedef, but doing so
35 /// leads to operator << being ambiguous as function has matching constructors
36 /// in some STL versions. I have seen the problem on gcc 4.6 libstdc++ and
37 /// microsoft STL.
38 class Printable {
39 public:
42  : Print(std::move(Print)) {}
43 };
44 
46  P.Print(OS);
47  return OS;
48 }
49 
50 }
51 
52 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
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::Printable::Printable
Printable(std::function< void(raw_ostream &OS)> Print)
Definition: Printable.h:41
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::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1639
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
std
Definition: BitVector.h:838
llvm::Printable::Print
std::function< void(raw_ostream &OS)> Print
Definition: Printable.h:40
llvm::Printable
Simple wrapper around std::function<void(raw_ostream&)>.
Definition: Printable.h:38