LLVM
15.0.0git
lib
Target
NVPTX
ManagedStringPool.h
Go to the documentation of this file.
1
//===-- ManagedStringPool.h - Managed String Pool ---------------*- 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
// The strings allocated from a managed string pool are owned by the string
10
// pool and will be deleted together with the managed string pool.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_LIB_TARGET_NVPTX_MANAGEDSTRINGPOOL_H
15
#define LLVM_LIB_TARGET_NVPTX_MANAGEDSTRINGPOOL_H
16
17
#include "
llvm/ADT/SmallVector.h
"
18
#include <string>
19
20
namespace
llvm
{
21
22
/// ManagedStringPool - The strings allocated from a managed string pool are
23
/// owned by the string pool and will be deleted together with the managed
24
/// string pool.
25
class
ManagedStringPool
{
26
SmallVector<std::string *, 8>
Pool;
27
28
public
:
29
ManagedStringPool
() =
default
;
30
31
~ManagedStringPool
() {
32
SmallVectorImpl<std::string *>::iterator
Current = Pool.begin();
33
while
(Current != Pool.end()) {
34
delete
*Current;
35
++Current;
36
}
37
}
38
39
std::string *
getManagedString
(
const
char
*
S
) {
40
std::string *Str =
new
std::string(
S
);
41
Pool.push_back(Str);
42
return
Str;
43
}
44
};
45
46
}
// end namespace llvm
47
48
#endif // LLVM_LIB_TARGET_NVPTX_MANAGEDSTRINGPOOL_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:17
llvm::SmallVector< std::string *, 8 >
llvm::ManagedStringPool::getManagedString
std::string * getManagedString(const char *S)
Definition:
ManagedStringPool.h:39
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition:
README.txt:210
llvm::ManagedStringPool
ManagedStringPool - The strings allocated from a managed string pool are owned by the string pool and...
Definition:
ManagedStringPool.h:25
llvm::ManagedStringPool::ManagedStringPool
ManagedStringPool()=default
llvm::ManagedStringPool::~ManagedStringPool
~ManagedStringPool()
Definition:
ManagedStringPool.h:31
SmallVector.h
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:
APFloat.h:42
Generated on Mon Jul 4 2022 08:07:24 for LLVM by
1.8.17