LLVM  15.0.0git
Go to the documentation of this file.
1 //===-- StringSaver.cpp ---------------------------------------------------===//
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 //===----------------------------------------------------------------------===//
11 using namespace llvm;
14  char *P = Alloc.Allocate<char>(S.size() + 1);
15  if (!S.empty())
16  memcpy(P, S.data(), S.size());
17  P[S.size()] = '\0';
18  return StringRef(P, S.size());
19 }
22  auto R = Unique.insert(S);
23  if (R.second) // cache miss, need to actually save the string
24  *R.first = Strings.save(S); // safe replacement with equal value
25  return *R.first;
26 }
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
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
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
StringRef save(const char *S)
Definition: StringSaver.h:50
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
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
StringRef save(const char *S)
Definition: StringSaver.h:28