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