LLVM 24.0.0git
AMDGPUEmitPrintf.h
Go to the documentation of this file.
1//===- AMDGPUEmitPrintf.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// Utility function to lower a printf call into a series of device
10// library calls on the AMDGPU target.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_UTILS_AMDGPUEMITPRINTF_H
15#define LLVM_TRANSFORMS_UTILS_AMDGPUEMITPRINTF_H
16
19#include "llvm/ADT/StringRef.h"
20#include "llvm/IR/IRBuilder.h"
22#include <cstdint>
23#include <string>
24
25namespace llvm {
26
28 ArrayRef<Value *> Args, bool isBuffered);
29
30/// Marks the printf arguments that the format string \p Fmt specifies as
31/// strings, i.e. with a "%s" specifier. Argument 0 is the format string itself,
32/// and each '*' in a specifier consumes an argument of its own.
34
35/// Returns the ID that buffered printf stores in place of the constant format
36/// string \p Fmt the low 64 bits of its MD5 hash.
38
39/// Returns the llvm.printf.fmts entry that maps the ID of the constant format
40/// string \p Fmt back to the string.
42
43/// The llvm.printf.fmts entry added when a module only uses buffered printf
44/// with non-constant format strings.
46 "0:0:ffffffff,\"Non const format string\"";
47
48/// Splits the constant string argument \p Str, including its terminating NUL,
49/// into the little-endian 32-bit words that buffered printf stores for it,
50/// padded to a multiple of 8 bytes.
53
54} // end namespace llvm
55
56#endif // LLVM_TRANSFORMS_UTILS_AMDGPUEMITPRINTF_H
uint64_t uint64_t
#define LLVM_ABI
Definition Compiler.h:211
This file defines the SmallVector class.
This file defines the SparseBitVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2947
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition StringRef.h:888
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::string getAMDGPUPrintfFormatMetadata(StringRef Fmt)
Returns the llvm.printf.fmts entry that maps the ID of the constant format string Fmt back to the str...
LLVM_ABI Value * emitAMDGPUPrintfCall(IRBuilder<> &Builder, ArrayRef< Value * > Args, bool isBuffered)
LLVM_ABI uint64_t getAMDGPUPrintfFormatHash(StringRef Fmt)
Returns the ID that buffered printf stores in place of the constant format string Fmt the low 64 bits...
LLVM_ABI void locateAMDGPUPrintfCStrings(SparseBitVector< 8 > &BV, StringRef Fmt)
Marks the printf arguments that the format string Fmt specifies as strings, i.e.
LLVM_ABI void packAMDGPUPrintfConstantString(StringRef Str, SmallVectorImpl< uint32_t > &Words)
Splits the constant string argument Str, including its terminating NUL, into the little-endian 32-bit...
constexpr StringLiteral AMDGPUPrintfNonConstFormatMetadata
The llvm.printf.fmts entry added when a module only uses buffered printf with non-constant format str...