clang  19.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 "CGValue.h"
14 #include "CodeGenTypeCache.h"
15 #include "llvm/Analysis/Utils/Local.h"
16 #include "llvm/IR/DataLayout.h"
17 #include "llvm/IR/IRBuilder.h"
18 #include "llvm/IR/Type.h"
19 
20 namespace clang {
21 namespace CodeGen {
22 
23 class CGBuilderTy;
24 class CodeGenFunction;
25 
26 /// This is an IRBuilder insertion helper that forwards to
27 /// CodeGenFunction::InsertHelper, which adds necessary metadata to
28 /// instructions.
29 class CGBuilderInserter final : public llvm::IRBuilderDefaultInserter {
30  friend CGBuilderTy;
31 
32 public:
33  CGBuilderInserter() = default;
34  explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
35 
36  /// This forwards to CodeGenFunction::InsertHelper.
37  void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
38  llvm::BasicBlock *BB,
39  llvm::BasicBlock::iterator InsertPt) const override;
40 
41 private:
42  CodeGenFunction *CGF = nullptr;
43 };
44 
46 
47 typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
49 
50 class CGBuilderTy : public CGBuilderBaseTy {
51  friend class Address;
52 
53  /// Storing a reference to the type cache here makes it a lot easier
54  /// to build natural-feeling, target-specific IR.
55  const CodeGenTypeCache &TypeCache;
56 
57  CodeGenFunction *getCGF() const { return getInserter().CGF; }
58 
59  llvm::Value *emitRawPointerFromAddress(Address Addr) const {
60  return Addr.getBasePointer();
61  }
62 
63  template <bool IsInBounds>
64  Address createConstGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1,
65  const llvm::Twine &Name) {
66  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
67  llvm::GetElementPtrInst *GEP;
68  if (IsInBounds)
69  GEP = cast<llvm::GetElementPtrInst>(CreateConstInBoundsGEP2_32(
70  Addr.getElementType(), emitRawPointerFromAddress(Addr), Idx0, Idx1,
71  Name));
72  else
73  GEP = cast<llvm::GetElementPtrInst>(CreateConstGEP2_32(
74  Addr.getElementType(), emitRawPointerFromAddress(Addr), Idx0, Idx1,
75  Name));
77  DL.getIndexSizeInBits(Addr.getType()->getPointerAddressSpace()), 0,
78  /*isSigned=*/true);
79  if (!GEP->accumulateConstantOffset(DL, Offset))
80  llvm_unreachable("offset of GEP with constants is always computable");
81  return Address(GEP, GEP->getResultElementType(),
82  Addr.getAlignment().alignmentAtOffset(
83  CharUnits::fromQuantity(Offset.getSExtValue())),
84  IsInBounds ? Addr.isKnownNonNull() : NotKnownNonNull);
85  }
86 
87 public:
88  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
89  : CGBuilderBaseTy(C), TypeCache(TypeCache) {}
90  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C,
91  const llvm::ConstantFolder &F,
92  const CGBuilderInserterTy &Inserter)
93  : CGBuilderBaseTy(C, F, Inserter), TypeCache(TypeCache) {}
94  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
95  : CGBuilderBaseTy(I), TypeCache(TypeCache) {}
96  CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
97  : CGBuilderBaseTy(BB), TypeCache(TypeCache) {}
98 
99  llvm::ConstantInt *getSize(CharUnits N) {
100  return llvm::ConstantInt::get(TypeCache.SizeTy, N.getQuantity());
101  }
102  llvm::ConstantInt *getSize(uint64_t N) {
103  return llvm::ConstantInt::get(TypeCache.SizeTy, N);
104  }
105 
106  // Note that we intentionally hide the CreateLoad APIs that don't
107  // take an alignment.
108  llvm::LoadInst *CreateLoad(Address Addr, const llvm::Twine &Name = "") {
109  return CreateAlignedLoad(Addr.getElementType(),
110  emitRawPointerFromAddress(Addr),
111  Addr.getAlignment().getAsAlign(), Name);
112  }
113  llvm::LoadInst *CreateLoad(Address Addr, const char *Name) {
114  // This overload is required to prevent string literals from
115  // ending up in the IsVolatile overload.
116  return CreateAlignedLoad(Addr.getElementType(),
117  emitRawPointerFromAddress(Addr),
118  Addr.getAlignment().getAsAlign(), Name);
119  }
120  llvm::LoadInst *CreateLoad(Address Addr, bool IsVolatile,
121  const llvm::Twine &Name = "") {
122  return CreateAlignedLoad(
123  Addr.getElementType(), emitRawPointerFromAddress(Addr),
124  Addr.getAlignment().getAsAlign(), IsVolatile, Name);
125  }
126 
127  using CGBuilderBaseTy::CreateAlignedLoad;
128  llvm::LoadInst *CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr,
129  CharUnits Align,
130  const llvm::Twine &Name = "") {
131  return CreateAlignedLoad(Ty, Addr, Align.getAsAlign(), Name);
132  }
133 
134  // Note that we intentionally hide the CreateStore APIs that don't
135  // take an alignment.
136  llvm::StoreInst *CreateStore(llvm::Value *Val, Address Addr,
137  bool IsVolatile = false) {
138  return CreateAlignedStore(Val, emitRawPointerFromAddress(Addr),
139  Addr.getAlignment().getAsAlign(), IsVolatile);
140  }
141 
142  using CGBuilderBaseTy::CreateAlignedStore;
143  llvm::StoreInst *CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr,
144  CharUnits Align,
145  bool IsVolatile = false) {
146  return CreateAlignedStore(Val, Addr, Align.getAsAlign(), IsVolatile);
147  }
148 
149  // FIXME: these "default-aligned" APIs should be removed,
150  // but I don't feel like fixing all the builtin code right now.
151  llvm::StoreInst *CreateDefaultAlignedStore(llvm::Value *Val,
152  llvm::Value *Addr,
153  bool IsVolatile = false) {
154  return CGBuilderBaseTy::CreateStore(Val, Addr, IsVolatile);
155  }
156 
157  /// Emit a load from an i1 flag variable.
158  llvm::LoadInst *CreateFlagLoad(llvm::Value *Addr,
159  const llvm::Twine &Name = "") {
160  return CreateAlignedLoad(getInt1Ty(), Addr, CharUnits::One(), Name);
161  }
162 
163  /// Emit a store to an i1 flag variable.
164  llvm::StoreInst *CreateFlagStore(bool Value, llvm::Value *Addr) {
165  return CreateAlignedStore(getInt1(Value), Addr, CharUnits::One());
166  }
167 
168  llvm::AtomicCmpXchgInst *
169  CreateAtomicCmpXchg(Address Addr, llvm::Value *Cmp, llvm::Value *New,
170  llvm::AtomicOrdering SuccessOrdering,
171  llvm::AtomicOrdering FailureOrdering,
173  return CGBuilderBaseTy::CreateAtomicCmpXchg(
174  Addr.emitRawPointer(*getCGF()), Cmp, New,
175  Addr.getAlignment().getAsAlign(), SuccessOrdering, FailureOrdering,
176  SSID);
177  }
178 
179  llvm::AtomicRMWInst *
180  CreateAtomicRMW(llvm::AtomicRMWInst::BinOp Op, Address Addr, llvm::Value *Val,
181  llvm::AtomicOrdering Ordering,
183  return CGBuilderBaseTy::CreateAtomicRMW(
184  Op, Addr.emitRawPointer(*getCGF()), Val,
185  Addr.getAlignment().getAsAlign(), Ordering, SSID);
186  }
187 
188  using CGBuilderBaseTy::CreateAddrSpaceCast;
189  Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty,
190  llvm::Type *ElementTy,
191  const llvm::Twine &Name = "") {
192  if (!Addr.hasOffset())
193  return Address(CreateAddrSpaceCast(Addr.getBasePointer(), Ty, Name),
194  ElementTy, Addr.getAlignment(), nullptr,
195  Addr.isKnownNonNull());
196  // Eagerly force a raw address if these is an offset.
197  return RawAddress(
198  CreateAddrSpaceCast(Addr.emitRawPointer(*getCGF()), Ty, Name),
199  ElementTy, Addr.getAlignment(), Addr.isKnownNonNull());
200  }
201 
202  using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
204  llvm::Type *ElementTy,
205  const llvm::Twine &Name = "") {
206  if (Addr.getType()->getAddressSpace() == Ty->getPointerAddressSpace())
207  return Addr.withElementType(ElementTy);
208  return CreateAddrSpaceCast(Addr, Ty, ElementTy, Name);
209  }
210 
211  /// Given
212  /// %addr = {T1, T2...}* ...
213  /// produce
214  /// %name = getelementptr inbounds %addr, i32 0, i32 index
215  ///
216  /// This API assumes that drilling into a struct like this is always an
217  /// inbounds operation.
218  using CGBuilderBaseTy::CreateStructGEP;
219  Address CreateStructGEP(Address Addr, unsigned Index,
220  const llvm::Twine &Name = "") {
221  llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
222  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
223  const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
224  auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
225 
227  Index, Name),
228  ElTy->getElementType(Index),
230  Addr.isKnownNonNull());
231  }
232 
233  /// Given
234  /// %addr = [n x T]* ...
235  /// produce
236  /// %name = getelementptr inbounds %addr, i64 0, i64 index
237  /// where i64 is actually the target word size.
238  ///
239  /// This API assumes that drilling into an array like this is always
240  /// an inbounds operation.
242  const llvm::Twine &Name = "") {
243  llvm::ArrayType *ElTy = cast<llvm::ArrayType>(Addr.getElementType());
244  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
245  CharUnits EltSize =
246  CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy->getElementType()));
247 
248  return Address(
250  {getSize(CharUnits::Zero()), getSize(Index)}, Name),
251  ElTy->getElementType(),
252  Addr.getAlignment().alignmentAtOffset(Index * EltSize),
253  Addr.isKnownNonNull());
254  }
255 
256  /// Given
257  /// %addr = T* ...
258  /// produce
259  /// %name = getelementptr inbounds %addr, i64 index
260  /// where i64 is actually the target word size.
262  const llvm::Twine &Name = "") {
263  llvm::Type *ElTy = Addr.getElementType();
264  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
265  CharUnits EltSize = CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy));
266 
267  return Address(
268  CreateInBoundsGEP(ElTy, Addr.getBasePointer(), getSize(Index), Name),
269  ElTy, Addr.getAlignment().alignmentAtOffset(Index * EltSize),
270  Addr.isKnownNonNull());
271  }
272 
273  /// Given
274  /// %addr = T* ...
275  /// produce
276  /// %name = getelementptr inbounds %addr, i64 index
277  /// where i64 is actually the target word size.
279  const llvm::Twine &Name = "") {
280  llvm::Type *ElTy = Addr.getElementType();
281  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
282  CharUnits EltSize = CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy));
283 
284  return Address(CreateGEP(ElTy, Addr.getBasePointer(), getSize(Index), Name),
285  Addr.getElementType(),
286  Addr.getAlignment().alignmentAtOffset(Index * EltSize));
287  }
288 
289  /// Create GEP with single dynamic index. The address alignment is reduced
290  /// according to the element size.
291  using CGBuilderBaseTy::CreateGEP;
292  Address CreateGEP(CodeGenFunction &CGF, Address Addr, llvm::Value *Index,
293  const llvm::Twine &Name = "") {
294  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
295  CharUnits EltSize =
296  CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
297 
298  return Address(
299  CreateGEP(Addr.getElementType(), Addr.emitRawPointer(CGF), Index, Name),
300  Addr.getElementType(),
301  Addr.getAlignment().alignmentOfArrayElement(EltSize));
302  }
303 
304  /// Given a pointer to i8, adjust it by a given constant offset.
306  const llvm::Twine &Name = "") {
307  assert(Addr.getElementType() == TypeCache.Int8Ty);
308  return Address(
310  getSize(Offset), Name),
312  Addr.isKnownNonNull());
313  }
314 
316  const llvm::Twine &Name = "") {
317  assert(Addr.getElementType() == TypeCache.Int8Ty);
318  return Address(CreateGEP(Addr.getElementType(), Addr.getBasePointer(),
319  getSize(Offset), Name),
320  Addr.getElementType(),
322  }
323 
324  using CGBuilderBaseTy::CreateConstInBoundsGEP2_32;
325  Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1,
326  const llvm::Twine &Name = "") {
327  return createConstGEP2_32<true>(Addr, Idx0, Idx1, Name);
328  }
329 
330  using CGBuilderBaseTy::CreateConstGEP2_32;
331  Address CreateConstGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1,
332  const llvm::Twine &Name = "") {
333  return createConstGEP2_32<false>(Addr, Idx0, Idx1, Name);
334  }
335 
337  llvm::Type *ElementType, CharUnits Align,
338  const Twine &Name = "") {
339  llvm::Value *Ptr = emitRawPointerFromAddress(Addr);
340  return RawAddress(CreateGEP(Addr.getElementType(), Ptr, IdxList, Name),
341  ElementType, Align);
342  }
343 
344  using CGBuilderBaseTy::CreateInBoundsGEP;
346  llvm::Type *ElementType, CharUnits Align,
347  const Twine &Name = "") {
349  emitRawPointerFromAddress(Addr),
350  IdxList, Name),
351  ElementType, Align, Addr.isKnownNonNull());
352  }
353 
354  using CGBuilderBaseTy::CreateIsNull;
355  llvm::Value *CreateIsNull(Address Addr, const Twine &Name = "") {
356  if (!Addr.hasOffset())
357  return CreateIsNull(Addr.getBasePointer(), Name);
358  // The pointer isn't null if Addr has an offset since offsets can always
359  // be applied inbound.
360  return llvm::ConstantInt::getFalse(Context);
361  }
362 
363  using CGBuilderBaseTy::CreateMemCpy;
364  llvm::CallInst *CreateMemCpy(Address Dest, Address Src, llvm::Value *Size,
365  bool IsVolatile = false) {
366  llvm::Value *DestPtr = emitRawPointerFromAddress(Dest);
367  llvm::Value *SrcPtr = emitRawPointerFromAddress(Src);
368  return CreateMemCpy(DestPtr, Dest.getAlignment().getAsAlign(), SrcPtr,
369  Src.getAlignment().getAsAlign(), Size, IsVolatile);
370  }
371  llvm::CallInst *CreateMemCpy(Address Dest, Address Src, uint64_t Size,
372  bool IsVolatile = false) {
373  llvm::Value *DestPtr = emitRawPointerFromAddress(Dest);
374  llvm::Value *SrcPtr = emitRawPointerFromAddress(Src);
375  return CreateMemCpy(DestPtr, Dest.getAlignment().getAsAlign(), SrcPtr,
376  Src.getAlignment().getAsAlign(), Size, IsVolatile);
377  }
378 
379  using CGBuilderBaseTy::CreateMemCpyInline;
380  llvm::CallInst *CreateMemCpyInline(Address Dest, Address Src, uint64_t Size) {
381  llvm::Value *DestPtr = emitRawPointerFromAddress(Dest);
382  llvm::Value *SrcPtr = emitRawPointerFromAddress(Src);
383  return CreateMemCpyInline(DestPtr, Dest.getAlignment().getAsAlign(), SrcPtr,
384  Src.getAlignment().getAsAlign(), getInt64(Size));
385  }
386 
387  using CGBuilderBaseTy::CreateMemMove;
388  llvm::CallInst *CreateMemMove(Address Dest, Address Src, llvm::Value *Size,
389  bool IsVolatile = false) {
390  llvm::Value *DestPtr = emitRawPointerFromAddress(Dest);
391  llvm::Value *SrcPtr = emitRawPointerFromAddress(Src);
392  return CreateMemMove(DestPtr, Dest.getAlignment().getAsAlign(), SrcPtr,
393  Src.getAlignment().getAsAlign(), Size, IsVolatile);
394  }
395 
396  using CGBuilderBaseTy::CreateMemSet;
397  llvm::CallInst *CreateMemSet(Address Dest, llvm::Value *Value,
398  llvm::Value *Size, bool IsVolatile = false) {
399  return CreateMemSet(emitRawPointerFromAddress(Dest), Value, Size,
400  Dest.getAlignment().getAsAlign(), IsVolatile);
401  }
402 
403  using CGBuilderBaseTy::CreateMemSetInline;
404  llvm::CallInst *CreateMemSetInline(Address Dest, llvm::Value *Value,
405  uint64_t Size) {
406  return CreateMemSetInline(emitRawPointerFromAddress(Dest),
407  Dest.getAlignment().getAsAlign(), Value,
408  getInt64(Size));
409  }
410 
411  using CGBuilderBaseTy::CreatePreserveStructAccessIndex;
413  unsigned FieldIndex,
414  llvm::MDNode *DbgInfo) {
415  llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
416  const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
417  const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
418  auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
419 
420  return Address(
421  CreatePreserveStructAccessIndex(ElTy, emitRawPointerFromAddress(Addr),
422  Index, FieldIndex, DbgInfo),
423  ElTy->getElementType(Index),
425  }
426 
427  using CGBuilderBaseTy::CreatePreserveUnionAccessIndex;
428  Address CreatePreserveUnionAccessIndex(Address Addr, unsigned FieldIndex,
429  llvm::MDNode *DbgInfo) {
431  Addr.getBasePointer(), FieldIndex, DbgInfo));
432  return Addr;
433  }
434 
435  using CGBuilderBaseTy::CreateLaunderInvariantGroup;
438  return Addr;
439  }
440 
441  using CGBuilderBaseTy::CreateStripInvariantGroup;
444  return Addr;
445  }
446 };
447 
448 } // end namespace CodeGen
449 } // end namespace clang
450 
451 #endif
static char ID
Definition: Arena.cpp:183
unsigned Offset
Definition: Format.cpp:2978
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
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:207
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:189
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:185
static CharUnits One()
One - Construct a CharUnits quantity of one.
Definition: CharUnits.h:58
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:214
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
Definition: Address.h:111
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
Definition: Address.h:220
CharUnits getAlignment() const
Definition: Address.h:166
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Definition: Address.h:184
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
Definition: Address.h:241
bool hasOffset() const
Definition: Address.h:214
KnownNonNull_t isKnownNonNull() const
Whether the pointer is known not to be null.
Definition: Address.h:203
llvm::PointerType * getType() const
Return the type of the pointer value.
Definition: Address.h:176
llvm::Value * getBasePointer() const
Definition: Address.h:170
void replaceBasePointer(llvm::Value *P)
This function is used in situations where the caller is doing some sort of opaque "laundering" of the...
Definition: Address.h:158
This is an IRBuilder insertion helper that forwards to CodeGenFunction::InsertHelper,...
Definition: CGBuilder.h:29
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB, llvm::BasicBlock::iterator InsertPt) const override
This forwards to CodeGenFunction::InsertHelper.
CGBuilderInserter(CodeGenFunction *CGF)
Definition: CGBuilder.h:34
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:305
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Definition: CGBuilder.h:128
Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1, const llvm::Twine &Name="")
Definition: CGBuilder.h:325
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C, const llvm::ConstantFolder &F, const CGBuilderInserterTy &Inserter)
Definition: CGBuilder.h:90
llvm::LoadInst * CreateLoad(Address Addr, bool IsVolatile, const llvm::Twine &Name="")
Definition: CGBuilder.h:120
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:397
llvm::CallInst * CreateMemMove(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:388
Address CreateGEP(CodeGenFunction &CGF, Address Addr, llvm::Value *Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:292
llvm::AtomicRMWInst * CreateAtomicRMW(llvm::AtomicRMWInst::BinOp Op, Address Addr, llvm::Value *Val, llvm::AtomicOrdering Ordering, llvm::SyncScope::ID SSID=llvm::SyncScope::System)
Definition: CGBuilder.h:180
llvm::StoreInst * CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr, CharUnits Align, bool IsVolatile=false)
Definition: CGBuilder.h:143
Address CreatePointerBitCastOrAddrSpaceCast(Address Addr, llvm::Type *Ty, llvm::Type *ElementTy, const llvm::Twine &Name="")
Definition: CGBuilder.h:203
llvm::CallInst * CreateMemCpyInline(Address Dest, Address Src, uint64_t Size)
Definition: CGBuilder.h:380
llvm::CallInst * CreateMemSetInline(Address Dest, llvm::Value *Value, uint64_t Size)
Definition: CGBuilder.h:404
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
Definition: CGBuilder.h:136
llvm::ConstantInt * getSize(uint64_t N)
Definition: CGBuilder.h:102
Address CreateConstGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1, const llvm::Twine &Name="")
Definition: CGBuilder.h:331
Address CreateConstArrayGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = [n x T]* ...
Definition: CGBuilder.h:241
llvm::LoadInst * CreateFlagLoad(llvm::Value *Addr, const llvm::Twine &Name="")
Emit a load from an i1 flag variable.
Definition: CGBuilder.h:158
Address CreateStructGEP(Address Addr, unsigned Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:219
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
Definition: CGBuilder.h:88
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
Definition: CGBuilder.h:94
Address CreateConstByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Definition: CGBuilder.h:315
llvm::Value * CreateIsNull(Address Addr, const Twine &Name="")
Definition: CGBuilder.h:355
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, uint64_t Size, bool IsVolatile=false)
Definition: CGBuilder.h:371
Address CreatePreserveStructAccessIndex(Address Addr, unsigned Index, unsigned FieldIndex, llvm::MDNode *DbgInfo)
Definition: CGBuilder.h:412
llvm::StoreInst * CreateDefaultAlignedStore(llvm::Value *Val, llvm::Value *Addr, bool IsVolatile=false)
Definition: CGBuilder.h:151
llvm::LoadInst * CreateLoad(Address Addr, const char *Name)
Definition: CGBuilder.h:113
Address CreateLaunderInvariantGroup(Address Addr)
Definition: CGBuilder.h:436
llvm::ConstantInt * getSize(CharUnits N)
Definition: CGBuilder.h:99
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
Definition: CGBuilder.h:96
Address CreateConstGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = T* ...
Definition: CGBuilder.h:278
llvm::AtomicCmpXchgInst * CreateAtomicCmpXchg(Address Addr, llvm::Value *Cmp, llvm::Value *New, llvm::AtomicOrdering SuccessOrdering, llvm::AtomicOrdering FailureOrdering, llvm::SyncScope::ID SSID=llvm::SyncScope::System)
Definition: CGBuilder.h:169
Address CreatePreserveUnionAccessIndex(Address Addr, unsigned FieldIndex, llvm::MDNode *DbgInfo)
Definition: CGBuilder.h:428
Address CreateStripInvariantGroup(Address Addr)
Definition: CGBuilder.h:442
Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty, llvm::Type *ElementTy, const llvm::Twine &Name="")
Definition: CGBuilder.h:189
Address CreateConstInBoundsGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = T* ...
Definition: CGBuilder.h:261
Address CreateInBoundsGEP(Address Addr, ArrayRef< llvm::Value * > IdxList, llvm::Type *ElementType, CharUnits Align, const Twine &Name="")
Definition: CGBuilder.h:345
llvm::StoreInst * CreateFlagStore(bool Value, llvm::Value *Addr)
Emit a store to an i1 flag variable.
Definition: CGBuilder.h:164
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Definition: CGBuilder.h:108
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:364
Address CreateGEP(Address Addr, ArrayRef< llvm::Value * > IdxList, llvm::Type *ElementType, CharUnits Align, const Twine &Name="")
Definition: CGBuilder.h:336
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
An abstract representation of an aligned address.
Definition: Address.h:41
llvm::IRBuilder< llvm::ConstantFolder, CGBuilderInserterTy > CGBuilderBaseTy
Definition: CGBuilder.h:48
CGBuilderInserter CGBuilderInserterTy
Definition: CGBuilder.h:45
@ NotKnownNonNull
Definition: Address.h:32
@ System
Like Angled, but marks system directories.
llvm::APInt APInt
Definition: Integral.h:29
The JSON file list parser is used to communicate input to InstallAPI.
unsigned long uint64_t
This structure provides a set of types that are commonly used during IR emission.
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64