clang  15.0.0git
CGBuilder.h
Go to the documentation of this file.
1 //===-- CGBuilder.h - Choose IRBuilder implementation ----------*- 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 #ifndef LLVM_CLANG_LIB_CODEGEN_CGBUILDER_H
10 #define LLVM_CLANG_LIB_CODEGEN_CGBUILDER_H
11 
12 #include "Address.h"
13 #include "CodeGenTypeCache.h"
14 #include "llvm/IR/DataLayout.h"
15 #include "llvm/IR/IRBuilder.h"
16 #include "llvm/IR/Type.h"
17 
18 namespace clang {
19 namespace CodeGen {
20 
21 class CodeGenFunction;
22 
23 /// This is an IRBuilder insertion helper that forwards to
24 /// CodeGenFunction::InsertHelper, which adds necessary metadata to
25 /// instructions.
26 class CGBuilderInserter final : public llvm::IRBuilderDefaultInserter {
27 public:
28  CGBuilderInserter() = default;
29  explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
30 
31  /// This forwards to CodeGenFunction::InsertHelper.
32  void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
33  llvm::BasicBlock *BB,
34  llvm::BasicBlock::iterator InsertPt) const override;
35 private:
36  CodeGenFunction *CGF = nullptr;
37 };
38 
40 
41 typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
43 
44 class CGBuilderTy : public CGBuilderBaseTy {
45  /// Storing a reference to the type cache here makes it a lot easier
46  /// to build natural-feeling, target-specific IR.
47  const CodeGenTypeCache &TypeCache;
48 public:
49  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
50  : CGBuilderBaseTy(C), TypeCache(TypeCache) {}
51  CGBuilderTy(const CodeGenTypeCache &TypeCache,
52  llvm::LLVMContext &C, const llvm::ConstantFolder &F,
53  const CGBuilderInserterTy &Inserter)
54  : CGBuilderBaseTy(C, F, Inserter), TypeCache(TypeCache) {}
55  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
56  : CGBuilderBaseTy(I), TypeCache(TypeCache) {}
57  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
58  : CGBuilderBaseTy(BB), TypeCache(TypeCache) {}
59 
60  llvm::ConstantInt *getSize(CharUnits N) {
61  return llvm::ConstantInt::get(TypeCache.SizeTy, N.getQuantity());
62  }
63  llvm::ConstantInt *getSize(uint64_t N) {
64  return llvm::ConstantInt::get(TypeCache.SizeTy, N);
65  }
66 
67  // Note that we intentionally hide the CreateLoad APIs that don't
68  // take an alignment.
69  llvm::LoadInst *CreateLoad(Address Addr, const llvm::Twine &Name = "") {
70  return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(),
71  Addr.getAlignment().getAsAlign(), Name);
72  }
73  llvm::LoadInst *CreateLoad(Address Addr, const char *Name) {
74  // This overload is required to prevent string literals from
75  // ending up in the IsVolatile overload.
76  return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(),
77  Addr.getAlignment().getAsAlign(), Name);
78  }
79  llvm::LoadInst *CreateLoad(Address Addr, bool IsVolatile,
80  const llvm::Twine &Name = "") {
81  return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(),
82  Addr.getAlignment().getAsAlign(), IsVolatile,
83  Name);
84  }
85 
86  using CGBuilderBaseTy::CreateAlignedLoad;
87  llvm::LoadInst *CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr,
88  CharUnits Align,
89  const llvm::Twine &Name = "") {
90  assert(llvm::cast<llvm::PointerType>(Addr->getType())
91  ->isOpaqueOrPointeeTypeMatches(Ty));
92  return CreateAlignedLoad(Ty, Addr, Align.getAsAlign(), Name);
93  }
94 
95  // Note that we intentionally hide the CreateStore APIs that don't
96  // take an alignment.
97  llvm::StoreInst *CreateStore(llvm::Value *Val, Address Addr,
98  bool IsVolatile = false) {
99  return CreateAlignedStore(Val, Addr.getPointer(),
100  Addr.getAlignment().getAsAlign(), IsVolatile);
101  }
102 
103  using CGBuilderBaseTy::CreateAlignedStore;
104  llvm::StoreInst *CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr,
105  CharUnits Align, bool IsVolatile = false) {
106  return CreateAlignedStore(Val, Addr, Align.getAsAlign(), IsVolatile);
107  }
108 
109  // FIXME: these "default-aligned" APIs should be removed,
110  // but I don't feel like fixing all the builtin code right now.
111  llvm::StoreInst *CreateDefaultAlignedStore(llvm::Value *Val,
112  llvm::Value *Addr,
113  bool IsVolatile = false) {
114  return CGBuilderBaseTy::CreateStore(Val, Addr, IsVolatile);
115  }
116 
117  /// Emit a load from an i1 flag variable.
118  llvm::LoadInst *CreateFlagLoad(llvm::Value *Addr,
119  const llvm::Twine &Name = "") {
120  assert(llvm::cast<llvm::PointerType>(Addr->getType())
121  ->isOpaqueOrPointeeTypeMatches(getInt1Ty()));
122  return CreateAlignedLoad(getInt1Ty(), Addr, CharUnits::One(), Name);
123  }
124 
125  /// Emit a store to an i1 flag variable.
126  llvm::StoreInst *CreateFlagStore(bool Value, llvm::Value *Addr) {
127  assert(llvm::cast<llvm::PointerType>(Addr->getType())
128  ->isOpaqueOrPointeeTypeMatches(getInt1Ty()));
129  return CreateAlignedStore(getInt1(Value), Addr, CharUnits::One());
130  }
131 
132  // Temporarily use old signature; clang will be updated to an Address overload
133  // in a subsequent patch.
134  llvm::AtomicCmpXchgInst *
135  CreateAtomicCmpXchg(llvm::Value *Ptr, llvm::Value *Cmp, llvm::Value *New,
136  llvm::AtomicOrdering SuccessOrdering,
137  llvm::AtomicOrdering FailureOrdering,
139  return CGBuilderBaseTy::CreateAtomicCmpXchg(
140  Ptr, Cmp, New, llvm::MaybeAlign(), SuccessOrdering, FailureOrdering,
141  SSID);
142  }
143 
144  // Temporarily use old signature; clang will be updated to an Address overload
145  // in a subsequent patch.
146  llvm::AtomicRMWInst *
147  CreateAtomicRMW(llvm::AtomicRMWInst::BinOp Op, llvm::Value *Ptr,
148  llvm::Value *Val, llvm::AtomicOrdering Ordering,
150  return CGBuilderBaseTy::CreateAtomicRMW(Op, Ptr, Val, llvm::MaybeAlign(),
151  Ordering, SSID);
152  }
153 
154  using CGBuilderBaseTy::CreateAddrSpaceCast;
155  Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty,
156  const llvm::Twine &Name = "") {
157  assert(cast<llvm::PointerType>(Ty)->isOpaqueOrPointeeTypeMatches(
158  Addr.getElementType()) &&
159  "Should not change the element type");
160  return Addr.withPointer(CreateAddrSpaceCast(Addr.getPointer(), Ty, Name));
161  }
162 
163  /// Cast the element type of the given address to a different type,
164  /// preserving information like the alignment and address space.
165  Address CreateElementBitCast(Address Addr, llvm::Type *Ty,
166  const llvm::Twine &Name = "") {
167  auto *PtrTy = Ty->getPointerTo(Addr.getAddressSpace());
168  return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name),
169  Ty, Addr.getAlignment());
170  }
171 
172  using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
174  llvm::Type *ElementTy,
175  const llvm::Twine &Name = "") {
176  llvm::Value *Ptr =
178  return Address(Ptr, ElementTy, Addr.getAlignment());
179  }
180 
181  /// Given
182  /// %addr = {T1, T2...}* ...
183  /// produce
184  /// %name = getelementptr inbounds %addr, i32 0, i32 index
185  ///
186  /// This API assumes that drilling into a struct like this is always an
187  /// inbounds operation.
188  using CGBuilderBaseTy::CreateStructGEP;
189  Address CreateStructGEP(Address Addr, unsigned Index,
190  const llvm::Twine &Name = "") {
191  llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
192  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
193  const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
194  auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
195 
196  return Address(CreateStructGEP(Addr.getElementType(),
197  Addr.getPointer(), Index, Name),
198  ElTy->getElementType(Index),
200  }
201 
202  /// Given
203  /// %addr = [n x T]* ...
204  /// produce
205  /// %name = getelementptr inbounds %addr, i64 0, i64 index
206  /// where i64 is actually the target word size.
207  ///
208  /// This API assumes that drilling into an array like this is always
209  /// an inbounds operation.
210  Address CreateConstArrayGEP(Address Addr, uint64_t Index,
211  const llvm::Twine &Name = "") {
212  llvm::ArrayType *ElTy = cast<llvm::ArrayType>(Addr.getElementType());
213  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
214  CharUnits EltSize =
215  CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy->getElementType()));
216 
217  return Address(
218  CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
219  {getSize(CharUnits::Zero()), getSize(Index)}, Name),
220  ElTy->getElementType(),
221  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
222  }
223 
224  /// Given
225  /// %addr = T* ...
226  /// produce
227  /// %name = getelementptr inbounds %addr, i64 index
228  /// where i64 is actually the target word size.
229  Address CreateConstInBoundsGEP(Address Addr, uint64_t Index,
230  const llvm::Twine &Name = "") {
231  llvm::Type *ElTy = Addr.getElementType();
232  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
233  CharUnits EltSize = CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy));
234 
235  return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
236  getSize(Index), Name),
237  ElTy,
238  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
239  }
240 
241  /// Given
242  /// %addr = T* ...
243  /// produce
244  /// %name = getelementptr inbounds %addr, i64 index
245  /// where i64 is actually the target word size.
246  Address CreateConstGEP(Address Addr, uint64_t Index,
247  const llvm::Twine &Name = "") {
248  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
249  CharUnits EltSize =
250  CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
251 
252  return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
253  getSize(Index), Name),
254  Addr.getElementType(),
255  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
256  }
257 
258  /// Create GEP with single dynamic index. The address alignment is reduced
259  /// according to the element size.
260  using CGBuilderBaseTy::CreateGEP;
261  Address CreateGEP(Address Addr, llvm::Value *Index,
262  const llvm::Twine &Name = "") {
263  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
264  CharUnits EltSize =
265  CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
266 
267  return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(), Index,
268  Name),
269  Addr.getElementType(),
270  Addr.getAlignment().alignmentOfArrayElement(EltSize));
271  }
272 
273  /// Given a pointer to i8, adjust it by a given constant offset.
275  const llvm::Twine &Name = "") {
276  assert(Addr.getElementType() == TypeCache.Int8Ty);
277  return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
278  getSize(Offset), Name),
279  Addr.getElementType(),
281  }
283  const llvm::Twine &Name = "") {
284  assert(Addr.getElementType() == TypeCache.Int8Ty);
285  return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
286  getSize(Offset), Name),
287  Addr.getElementType(),
289  }
290 
291  using CGBuilderBaseTy::CreateConstInBoundsGEP2_32;
292  Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1,
293  const llvm::Twine &Name = "") {
294  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
295 
296  auto *GEP = cast<llvm::GetElementPtrInst>(CreateConstInBoundsGEP2_32(
297  Addr.getElementType(), Addr.getPointer(), Idx0, Idx1, Name));
299  DL.getIndexSizeInBits(Addr.getType()->getPointerAddressSpace()), 0,
300  /*isSigned=*/true);
301  if (!GEP->accumulateConstantOffset(DL, Offset))
302  llvm_unreachable("offset of GEP with constants is always computable");
303  return Address(GEP, GEP->getResultElementType(),
305  CharUnits::fromQuantity(Offset.getSExtValue())));
306  }
307 
308  using CGBuilderBaseTy::CreateMemCpy;
309  llvm::CallInst *CreateMemCpy(Address Dest, Address Src, llvm::Value *Size,
310  bool IsVolatile = false) {
311  return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
312  Src.getPointer(), Src.getAlignment().getAsAlign(), Size,
313  IsVolatile);
314  }
315  llvm::CallInst *CreateMemCpy(Address Dest, Address Src, uint64_t Size,
316  bool IsVolatile = false) {
317  return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
318  Src.getPointer(), Src.getAlignment().getAsAlign(), Size,
319  IsVolatile);
320  }
321 
322  using CGBuilderBaseTy::CreateMemCpyInline;
323  llvm::CallInst *CreateMemCpyInline(Address Dest, Address Src, uint64_t Size) {
324  return CreateMemCpyInline(
325  Dest.getPointer(), Dest.getAlignment().getAsAlign(), Src.getPointer(),
326  Src.getAlignment().getAsAlign(), getInt64(Size));
327  }
328 
329  using CGBuilderBaseTy::CreateMemMove;
330  llvm::CallInst *CreateMemMove(Address Dest, Address Src, llvm::Value *Size,
331  bool IsVolatile = false) {
332  return CreateMemMove(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
333  Src.getPointer(), Src.getAlignment().getAsAlign(),
334  Size, IsVolatile);
335  }
336 
337  using CGBuilderBaseTy::CreateMemSet;
338  llvm::CallInst *CreateMemSet(Address Dest, llvm::Value *Value,
339  llvm::Value *Size, bool IsVolatile = false) {
340  return CreateMemSet(Dest.getPointer(), Value, Size,
341  Dest.getAlignment().getAsAlign(), IsVolatile);
342  }
343 
344  using CGBuilderBaseTy::CreatePreserveStructAccessIndex;
346  unsigned Index,
347  unsigned FieldIndex,
348  llvm::MDNode *DbgInfo) {
349  llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
350  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
351  const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
352  auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
353 
355  Index, FieldIndex, DbgInfo),
356  ElTy->getElementType(Index),
358  }
359 
360  using CGBuilderBaseTy::CreateLaunderInvariantGroup;
363  }
364 };
365 
366 } // end namespace CodeGen
367 } // end namespace clang
368 
369 #endif
CodeGenTypeCache.h
clang::CodeGen::CGBuilderTy::CreateMemCpy
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:309
clang::CodeGen::CodeGenTypeCache::SizeTy
llvm::IntegerType * SizeTy
Definition: CodeGenTypeCache.h:50
clang::CharUnits::getAsAlign
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
Definition: CharUnits.h:183
clang::interp::APInt
llvm::APInt APInt
Definition: Integral.h:27
clang::CharUnits::alignmentOfArrayElement
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
Definition: CharUnits.h:201
clang::CodeGen::Address::getAlignment
CharUnits getAlignment() const
Return the alignment of this pointer.
Definition: Address.h:120
clang::CodeGen::CGBuilderTy::CreateStore
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
Definition: CGBuilder.h:97
clang::CharUnits::alignmentAtOffset
CharUnits alignmentAtOffset(CharUnits offset) const
Given that this is a non-zero alignment value, what is the alignment at the given offset?
Definition: CharUnits.h:194
clang::CodeGen::CGBuilderTy
Definition: CGBuilder.h:44
clang::CodeGen::CGBuilderTy::CreateStructGEP
Address CreateStructGEP(Address Addr, unsigned Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:189
clang::CodeGen::CGBuilderTy::CreateConstGEP
Address CreateConstGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = T* ...
Definition: CGBuilder.h:246
clang::CodeGen::CGBuilderBaseTy
llvm::IRBuilder< llvm::ConstantFolder, CGBuilderInserterTy > CGBuilderBaseTy
Definition: CGBuilder.h:42
clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast
Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Definition: CGBuilder.h:155
Offset
unsigned Offset
Definition: Format.cpp:2570
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
Definition: CGBuilder.h:57
clang::CodeGen::CGBuilderInserterTy
CGBuilderInserter CGBuilderInserterTy
Definition: CGBuilder.h:39
clang::frontend::System
@ System
Like Angled, but marks system directories.
Definition: HeaderSearchOptions.h:43
clang::CodeGen::CodeGenTypeCache
This structure provides a set of types that are commonly used during IR emission.
Definition: CodeGenTypeCache.h:32
clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP
Address CreateConstInBoundsGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = T* ...
Definition: CGBuilder.h:229
clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast
Address CreatePointerBitCastOrAddrSpaceCast(Address Addr, llvm::Type *Ty, llvm::Type *ElementTy, const llvm::Twine &Name="")
Definition: CGBuilder.h:173
clang::CodeGen::CGBuilderTy::CreateAlignedStore
llvm::StoreInst * CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr, CharUnits Align, bool IsVolatile=false)
Definition: CGBuilder.h:104
clang::CharUnits::fromQuantity
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
clang::CodeGen::Address::getType
llvm::PointerType * getType() const
Return the type of the pointer value.
Definition: Address.h:99
clang::CharUnits::One
static CharUnits One()
One - Construct a CharUnits quantity of one.
Definition: CharUnits.h:58
clang::CodeGen::CGBuilderTy::getSize
llvm::ConstantInt * getSize(CharUnits N)
Definition: CGBuilder.h:60
clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
Definition: CGBuilder.h:274
clang::CodeGen::Address
An aligned address.
Definition: Address.h:74
clang::CodeGen::CGBuilderTy::CreateFlagLoad
llvm::LoadInst * CreateFlagLoad(llvm::Value *Addr, const llvm::Twine &Name="")
Emit a load from an i1 flag variable.
Definition: CGBuilder.h:118
clang::CodeGen::CGBuilderTy::CreateGEP
Address CreateGEP(Address Addr, llvm::Value *Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:261
clang::CodeGen::Address::getAddressSpace
unsigned getAddressSpace() const
Return the address space that this address resides in.
Definition: Address.h:110
clang::CodeGen::CGBuilderInserter
This is an IRBuilder insertion helper that forwards to CodeGenFunction::InsertHelper,...
Definition: CGBuilder.h:26
clang::CodeGen::CGBuilderTy::CreateLoad
llvm::LoadInst * CreateLoad(Address Addr, const char *Name)
Definition: CGBuilder.h:73
CGBuilderBaseTy
clang::CodeGen::CGBuilderTy::CreateLoad
llvm::LoadInst * CreateLoad(Address Addr, bool IsVolatile, const llvm::Twine &Name="")
Definition: CGBuilder.h:79
clang::CodeGen::CGBuilderTy::CreateLaunderInvariantGroup
Address CreateLaunderInvariantGroup(Address Addr)
Definition: CGBuilder.h:361
Address.h
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
Definition: CGBuilder.h:55
clang::CodeGen::CGBuilderTy::CreateMemMove
llvm::CallInst * CreateMemMove(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:330
clang::CodeGen::Address::getPointer
llvm::Value * getPointer() const
Definition: Address.h:93
clang::CodeGen::CodeGenFunction
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Definition: CodeGenFunction.h:231
clang::CodeGen::CGBuilderTy::CreateMemCpy
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, uint64_t Size, bool IsVolatile=false)
Definition: CGBuilder.h:315
clang::CodeGen::Address::withPointer
Address withPointer(llvm::Value *NewPointer) const
Return address with different pointer, but same element type and alignment.
Definition: Address.h:127
Value
Value
Definition: UninitializedValues.cpp:102
clang::CodeGen::CGBuilderTy::CreateMemCpyInline
llvm::CallInst * CreateMemCpyInline(Address Dest, Address Src, uint64_t Size)
Definition: CGBuilder.h:323
clang::CodeGen::CGBuilderTy::CreateAlignedLoad
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Definition: CGBuilder.h:87
clang::CodeGen::CGBuilderInserter::CGBuilderInserter
CGBuilderInserter(CodeGenFunction *CGF)
Definition: CGBuilder.h:29
clang::CodeGen::Address::getElementType
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Definition: Address.h:104
clang::CodeGen::CGBuilderTy::CreateElementBitCast
Address CreateElementBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Cast the element type of the given address to a different type, preserving information like the align...
Definition: CGBuilder.h:165
clang::CodeGen::CGBuilderInserter::CGBuilderInserter
CGBuilderInserter()=default
clang::CodeGen::CGBuilderTy::CreateConstByteGEP
Address CreateConstByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Definition: CGBuilder.h:282
clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP2_32
Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1, const llvm::Twine &Name="")
Definition: CGBuilder.h:292
clang::CodeGen::CGBuilderTy::CreateConstArrayGEP
Address CreateConstArrayGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = [n x T]* ...
Definition: CGBuilder.h:210
clang::Builtin::ID
ID
Definition: Builtins.h:51
clang
Definition: CalledOnceCheck.h:17
clang::CodeGen::CGBuilderTy::CreateFlagStore
llvm::StoreInst * CreateFlagStore(bool Value, llvm::Value *Addr)
Emit a store to an i1 flag variable.
Definition: CGBuilder.h:126
clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg
llvm::AtomicCmpXchgInst * CreateAtomicCmpXchg(llvm::Value *Ptr, llvm::Value *Cmp, llvm::Value *New, llvm::AtomicOrdering SuccessOrdering, llvm::AtomicOrdering FailureOrdering, llvm::SyncScope::ID SSID=llvm::SyncScope::System)
Definition: CGBuilder.h:135
clang::CodeGen::CGBuilderTy::CreatePreserveStructAccessIndex
Address CreatePreserveStructAccessIndex(Address Addr, unsigned Index, unsigned FieldIndex, llvm::MDNode *DbgInfo)
Definition: CGBuilder.h:345
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
Definition: CGBuilder.h:49
clang::CodeGen::CGBuilderTy::CreateAtomicRMW
llvm::AtomicRMWInst * CreateAtomicRMW(llvm::AtomicRMWInst::BinOp Op, llvm::Value *Ptr, llvm::Value *Val, llvm::AtomicOrdering Ordering, llvm::SyncScope::ID SSID=llvm::SyncScope::System)
Definition: CGBuilder.h:147
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C, const llvm::ConstantFolder &F, const CGBuilderInserterTy &Inserter)
Definition: CGBuilder.h:51
clang::CodeGen::CGBuilderInserter::InsertHelper
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB, llvm::BasicBlock::iterator InsertPt) const override
This forwards to CodeGenFunction::InsertHelper.
Definition: CodeGenFunction.cpp:2516
clang::CodeGen::CGBuilderTy::CreateDefaultAlignedStore
llvm::StoreInst * CreateDefaultAlignedStore(llvm::Value *Val, llvm::Value *Addr, bool IsVolatile=false)
Definition: CGBuilder.h:111
clang::CharUnits
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
clang::CodeGen::CGBuilderTy::getSize
llvm::ConstantInt * getSize(uint64_t N)
Definition: CGBuilder.h:63
clang::CodeGen::CodeGenTypeCache::Int8Ty
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Definition: CodeGenTypeCache.h:37
clang::CodeGen::CGBuilderTy::CreateMemSet
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:338
clang::CharUnits::getQuantity
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:179
clang::CodeGen::CGBuilderTy::CreateLoad
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Definition: CGBuilder.h:69