clang  16.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 
36 private:
37  CodeGenFunction *CGF = nullptr;
38 };
39 
41 
42 typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
44 
45 class CGBuilderTy : public CGBuilderBaseTy {
46  /// Storing a reference to the type cache here makes it a lot easier
47  /// to build natural-feeling, target-specific IR.
48  const CodeGenTypeCache &TypeCache;
49 
50 public:
51  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
52  : CGBuilderBaseTy(C), TypeCache(TypeCache) {}
53  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C,
54  const llvm::ConstantFolder &F,
55  const CGBuilderInserterTy &Inserter)
56  : CGBuilderBaseTy(C, F, Inserter), TypeCache(TypeCache) {}
57  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
58  : CGBuilderBaseTy(I), TypeCache(TypeCache) {}
59  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
60  : CGBuilderBaseTy(BB), TypeCache(TypeCache) {}
61 
62  llvm::ConstantInt *getSize(CharUnits N) {
63  return llvm::ConstantInt::get(TypeCache.SizeTy, N.getQuantity());
64  }
65  llvm::ConstantInt *getSize(uint64_t N) {
66  return llvm::ConstantInt::get(TypeCache.SizeTy, N);
67  }
68 
69  // Note that we intentionally hide the CreateLoad APIs that don't
70  // take an alignment.
71  llvm::LoadInst *CreateLoad(Address Addr, const llvm::Twine &Name = "") {
72  return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(),
73  Addr.getAlignment().getAsAlign(), Name);
74  }
75  llvm::LoadInst *CreateLoad(Address Addr, const char *Name) {
76  // This overload is required to prevent string literals from
77  // ending up in the IsVolatile overload.
78  return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(),
79  Addr.getAlignment().getAsAlign(), Name);
80  }
81  llvm::LoadInst *CreateLoad(Address Addr, bool IsVolatile,
82  const llvm::Twine &Name = "") {
83  return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(),
84  Addr.getAlignment().getAsAlign(), IsVolatile,
85  Name);
86  }
87 
88  using CGBuilderBaseTy::CreateAlignedLoad;
89  llvm::LoadInst *CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr,
90  CharUnits Align,
91  const llvm::Twine &Name = "") {
92  assert(llvm::cast<llvm::PointerType>(Addr->getType())
93  ->isOpaqueOrPointeeTypeMatches(Ty));
94  return CreateAlignedLoad(Ty, Addr, Align.getAsAlign(), Name);
95  }
96 
97  // Note that we intentionally hide the CreateStore APIs that don't
98  // take an alignment.
99  llvm::StoreInst *CreateStore(llvm::Value *Val, Address Addr,
100  bool IsVolatile = false) {
101  return CreateAlignedStore(Val, Addr.getPointer(),
102  Addr.getAlignment().getAsAlign(), IsVolatile);
103  }
104 
105  using CGBuilderBaseTy::CreateAlignedStore;
106  llvm::StoreInst *CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr,
107  CharUnits Align,
108  bool IsVolatile = false) {
109  return CreateAlignedStore(Val, Addr, Align.getAsAlign(), IsVolatile);
110  }
111 
112  // FIXME: these "default-aligned" APIs should be removed,
113  // but I don't feel like fixing all the builtin code right now.
114  llvm::StoreInst *CreateDefaultAlignedStore(llvm::Value *Val,
115  llvm::Value *Addr,
116  bool IsVolatile = false) {
117  return CGBuilderBaseTy::CreateStore(Val, Addr, IsVolatile);
118  }
119 
120  /// Emit a load from an i1 flag variable.
121  llvm::LoadInst *CreateFlagLoad(llvm::Value *Addr,
122  const llvm::Twine &Name = "") {
123  assert(llvm::cast<llvm::PointerType>(Addr->getType())
124  ->isOpaqueOrPointeeTypeMatches(getInt1Ty()));
125  return CreateAlignedLoad(getInt1Ty(), Addr, CharUnits::One(), Name);
126  }
127 
128  /// Emit a store to an i1 flag variable.
129  llvm::StoreInst *CreateFlagStore(bool Value, llvm::Value *Addr) {
130  assert(llvm::cast<llvm::PointerType>(Addr->getType())
131  ->isOpaqueOrPointeeTypeMatches(getInt1Ty()));
132  return CreateAlignedStore(getInt1(Value), Addr, CharUnits::One());
133  }
134 
135  // Temporarily use old signature; clang will be updated to an Address overload
136  // in a subsequent patch.
137  llvm::AtomicCmpXchgInst *
138  CreateAtomicCmpXchg(llvm::Value *Ptr, llvm::Value *Cmp, llvm::Value *New,
139  llvm::AtomicOrdering SuccessOrdering,
140  llvm::AtomicOrdering FailureOrdering,
142  return CGBuilderBaseTy::CreateAtomicCmpXchg(
143  Ptr, Cmp, New, llvm::MaybeAlign(), SuccessOrdering, FailureOrdering,
144  SSID);
145  }
146 
147  // Temporarily use old signature; clang will be updated to an Address overload
148  // in a subsequent patch.
149  llvm::AtomicRMWInst *
150  CreateAtomicRMW(llvm::AtomicRMWInst::BinOp Op, llvm::Value *Ptr,
151  llvm::Value *Val, llvm::AtomicOrdering Ordering,
153  return CGBuilderBaseTy::CreateAtomicRMW(Op, Ptr, Val, llvm::MaybeAlign(),
154  Ordering, SSID);
155  }
156 
157  using CGBuilderBaseTy::CreateAddrSpaceCast;
158  Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty,
159  const llvm::Twine &Name = "") {
160  assert(cast<llvm::PointerType>(Ty)->isOpaqueOrPointeeTypeMatches(
161  Addr.getElementType()) &&
162  "Should not change the element type");
163  return Addr.withPointer(CreateAddrSpaceCast(Addr.getPointer(), Ty, Name));
164  }
165 
166  /// Cast the element type of the given address to a different type,
167  /// preserving information like the alignment and address space.
168  Address CreateElementBitCast(Address Addr, llvm::Type *Ty,
169  const llvm::Twine &Name = "") {
170  auto *PtrTy = Ty->getPointerTo(Addr.getAddressSpace());
171  return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name), Ty,
172  Addr.getAlignment());
173  }
174 
175  using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
177  llvm::Type *ElementTy,
178  const llvm::Twine &Name = "") {
179  llvm::Value *Ptr =
181  return Address(Ptr, ElementTy, Addr.getAlignment());
182  }
183 
184  /// Given
185  /// %addr = {T1, T2...}* ...
186  /// produce
187  /// %name = getelementptr inbounds %addr, i32 0, i32 index
188  ///
189  /// This API assumes that drilling into a struct like this is always an
190  /// inbounds operation.
191  using CGBuilderBaseTy::CreateStructGEP;
192  Address CreateStructGEP(Address Addr, unsigned Index,
193  const llvm::Twine &Name = "") {
194  llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
195  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
196  const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
197  auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
198 
199  return Address(
200  CreateStructGEP(Addr.getElementType(), Addr.getPointer(), Index, Name),
201  ElTy->getElementType(Index),
203  }
204 
205  /// Given
206  /// %addr = [n x T]* ...
207  /// produce
208  /// %name = getelementptr inbounds %addr, i64 0, i64 index
209  /// where i64 is actually the target word size.
210  ///
211  /// This API assumes that drilling into an array like this is always
212  /// an inbounds operation.
214  const llvm::Twine &Name = "") {
215  llvm::ArrayType *ElTy = cast<llvm::ArrayType>(Addr.getElementType());
216  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
217  CharUnits EltSize =
218  CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy->getElementType()));
219 
220  return Address(
221  CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
222  {getSize(CharUnits::Zero()), getSize(Index)}, Name),
223  ElTy->getElementType(),
224  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
225  }
226 
227  /// Given
228  /// %addr = T* ...
229  /// produce
230  /// %name = getelementptr inbounds %addr, i64 index
231  /// where i64 is actually the target word size.
233  const llvm::Twine &Name = "") {
234  llvm::Type *ElTy = Addr.getElementType();
235  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
236  CharUnits EltSize = CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy));
237 
238  return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
239  getSize(Index), Name),
240  ElTy,
241  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
242  }
243 
244  /// Given
245  /// %addr = T* ...
246  /// produce
247  /// %name = getelementptr inbounds %addr, i64 index
248  /// where i64 is actually the target word size.
250  const llvm::Twine &Name = "") {
251  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
252  CharUnits EltSize =
253  CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
254 
255  return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
256  getSize(Index), Name),
257  Addr.getElementType(),
258  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
259  }
260 
261  /// Create GEP with single dynamic index. The address alignment is reduced
262  /// according to the element size.
263  using CGBuilderBaseTy::CreateGEP;
264  Address CreateGEP(Address Addr, llvm::Value *Index,
265  const llvm::Twine &Name = "") {
266  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
267  CharUnits EltSize =
268  CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
269 
270  return Address(
271  CreateGEP(Addr.getElementType(), Addr.getPointer(), Index, Name),
272  Addr.getElementType(),
273  Addr.getAlignment().alignmentOfArrayElement(EltSize));
274  }
275 
276  /// Given a pointer to i8, adjust it by a given constant offset.
278  const llvm::Twine &Name = "") {
279  assert(Addr.getElementType() == TypeCache.Int8Ty);
280  return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
281  getSize(Offset), Name),
282  Addr.getElementType(),
284  }
286  const llvm::Twine &Name = "") {
287  assert(Addr.getElementType() == TypeCache.Int8Ty);
288  return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
289  getSize(Offset), Name),
290  Addr.getElementType(),
292  }
293 
294  using CGBuilderBaseTy::CreateConstInBoundsGEP2_32;
295  Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1,
296  const llvm::Twine &Name = "") {
297  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
298 
299  auto *GEP = cast<llvm::GetElementPtrInst>(CreateConstInBoundsGEP2_32(
300  Addr.getElementType(), Addr.getPointer(), Idx0, Idx1, Name));
302  DL.getIndexSizeInBits(Addr.getType()->getPointerAddressSpace()), 0,
303  /*isSigned=*/true);
304  if (!GEP->accumulateConstantOffset(DL, Offset))
305  llvm_unreachable("offset of GEP with constants is always computable");
306  return Address(GEP, GEP->getResultElementType(),
308  CharUnits::fromQuantity(Offset.getSExtValue())));
309  }
310 
311  using CGBuilderBaseTy::CreateMemCpy;
312  llvm::CallInst *CreateMemCpy(Address Dest, Address Src, llvm::Value *Size,
313  bool IsVolatile = false) {
314  return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
315  Src.getPointer(), Src.getAlignment().getAsAlign(), Size,
316  IsVolatile);
317  }
318  llvm::CallInst *CreateMemCpy(Address Dest, Address Src, uint64_t Size,
319  bool IsVolatile = false) {
320  return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
321  Src.getPointer(), Src.getAlignment().getAsAlign(), Size,
322  IsVolatile);
323  }
324 
325  using CGBuilderBaseTy::CreateMemCpyInline;
326  llvm::CallInst *CreateMemCpyInline(Address Dest, Address Src, uint64_t Size) {
327  return CreateMemCpyInline(
328  Dest.getPointer(), Dest.getAlignment().getAsAlign(), Src.getPointer(),
329  Src.getAlignment().getAsAlign(), getInt64(Size));
330  }
331 
332  using CGBuilderBaseTy::CreateMemMove;
333  llvm::CallInst *CreateMemMove(Address Dest, Address Src, llvm::Value *Size,
334  bool IsVolatile = false) {
335  return CreateMemMove(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
336  Src.getPointer(), Src.getAlignment().getAsAlign(),
337  Size, IsVolatile);
338  }
339 
340  using CGBuilderBaseTy::CreateMemSet;
341  llvm::CallInst *CreateMemSet(Address Dest, llvm::Value *Value,
342  llvm::Value *Size, bool IsVolatile = false) {
343  return CreateMemSet(Dest.getPointer(), Value, Size,
344  Dest.getAlignment().getAsAlign(), IsVolatile);
345  }
346 
347  using CGBuilderBaseTy::CreateMemSetInline;
348  llvm::CallInst *CreateMemSetInline(Address Dest, llvm::Value *Value,
349  uint64_t Size) {
350  return CreateMemSetInline(Dest.getPointer(),
351  Dest.getAlignment().getAsAlign(), Value,
352  getInt64(Size));
353  }
354 
355  using CGBuilderBaseTy::CreatePreserveStructAccessIndex;
357  unsigned FieldIndex,
358  llvm::MDNode *DbgInfo) {
359  llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
360  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
361  const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
362  auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
363 
365  Index, FieldIndex, DbgInfo),
366  ElTy->getElementType(Index),
368  }
369 
370  using CGBuilderBaseTy::CreateLaunderInvariantGroup;
373  }
374 };
375 
376 } // end namespace CodeGen
377 } // end namespace clang
378 
379 #endif
CodeGenTypeCache.h
clang::CodeGen::CGBuilderTy::CreateMemCpy
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:312
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:207
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:99
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:200
clang::CodeGen::CGBuilderTy
Definition: CGBuilder.h:45
clang::CodeGen::CGBuilderTy::CreateStructGEP
Address CreateStructGEP(Address Addr, unsigned Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:192
clang::CodeGen::CGBuilderTy::CreateConstGEP
Address CreateConstGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = T* ...
Definition: CGBuilder.h:249
clang::CodeGen::CGBuilderBaseTy
llvm::IRBuilder< llvm::ConstantFolder, CGBuilderInserterTy > CGBuilderBaseTy
Definition: CGBuilder.h:43
clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast
Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Definition: CGBuilder.h:158
Offset
unsigned Offset
Definition: Format.cpp:2717
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
Definition: CGBuilder.h:59
clang::CodeGen::CGBuilderInserterTy
CGBuilderInserter CGBuilderInserterTy
Definition: CGBuilder.h:40
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:232
clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast
Address CreatePointerBitCastOrAddrSpaceCast(Address Addr, llvm::Type *Ty, llvm::Type *ElementTy, const llvm::Twine &Name="")
Definition: CGBuilder.h:176
clang::CodeGen::CGBuilderTy::CreateAlignedStore
llvm::StoreInst * CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr, CharUnits Align, bool IsVolatile=false)
Definition: CGBuilder.h:106
hlsl::uint64_t
unsigned long uint64_t
Definition: hlsl_basic_types.h:25
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::CodeGen::CGBuilderTy::CreateMemSetInline
llvm::CallInst * CreateMemSetInline(Address Dest, llvm::Value *Value, uint64_t Size)
Definition: CGBuilder.h:348
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:62
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:277
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:121
clang::CodeGen::CGBuilderTy::CreateGEP
Address CreateGEP(Address Addr, llvm::Value *Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:264
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:75
CGBuilderBaseTy
clang::CodeGen::CGBuilderTy::CreateLoad
llvm::LoadInst * CreateLoad(Address Addr, bool IsVolatile, const llvm::Twine &Name="")
Definition: CGBuilder.h:81
clang::CodeGen::CGBuilderTy::CreateLaunderInvariantGroup
Address CreateLaunderInvariantGroup(Address Addr)
Definition: CGBuilder.h:371
Address.h
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
Definition: CGBuilder.h:57
clang::CodeGen::CGBuilderTy::CreateMemMove
llvm::CallInst * CreateMemMove(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:333
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:318
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:103
clang::CodeGen::CGBuilderTy::CreateMemCpyInline
llvm::CallInst * CreateMemCpyInline(Address Dest, Address Src, uint64_t Size)
Definition: CGBuilder.h:326
clang::CodeGen::CGBuilderTy::CreateAlignedLoad
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Definition: CGBuilder.h:89
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:168
clang::CodeGen::CGBuilderInserter::CGBuilderInserter
CGBuilderInserter()=default
clang::CodeGen::CGBuilderTy::CreateConstByteGEP
Address CreateConstByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Definition: CGBuilder.h:285
clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP2_32
Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1, const llvm::Twine &Name="")
Definition: CGBuilder.h:295
clang::CodeGen::CGBuilderTy::CreateConstArrayGEP
Address CreateConstArrayGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = [n x T]* ...
Definition: CGBuilder.h:213
clang::Builtin::ID
ID
Definition: Builtins.h:52
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:129
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:138
clang::CodeGen::CGBuilderTy::CreatePreserveStructAccessIndex
Address CreatePreserveStructAccessIndex(Address Addr, unsigned Index, unsigned FieldIndex, llvm::MDNode *DbgInfo)
Definition: CGBuilder.h:356
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
Definition: CGBuilder.h:51
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:150
clang::CodeGen::CGBuilderTy::CGBuilderTy
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C, const llvm::ConstantFolder &F, const CGBuilderInserterTy &Inserter)
Definition: CGBuilder.h:53
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:2526
clang::CodeGen::CGBuilderTy::CreateDefaultAlignedStore
llvm::StoreInst * CreateDefaultAlignedStore(llvm::Value *Val, llvm::Value *Addr, bool IsVolatile=false)
Definition: CGBuilder.h:114
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:65
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:341
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:71