clang 17.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
18namespace clang {
19namespace CodeGen {
20
21class CodeGenFunction;
22
23/// This is an IRBuilder insertion helper that forwards to
24/// CodeGenFunction::InsertHelper, which adds necessary metadata to
25/// instructions.
26class CGBuilderInserter final : public llvm::IRBuilderDefaultInserter {
27public:
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
36private:
37 CodeGenFunction *CGF = nullptr;
38};
39
41
42typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
44
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
50public:
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,
141 llvm::SyncScope::ID SSID = llvm::SyncScope::System) {
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,
152 llvm::SyncScope::ID SSID = llvm::SyncScope::System) {
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 Addr.isKnownNonNull());
165 }
166
167 /// Cast the element type of the given address to a different type,
168 /// preserving information like the alignment and address space.
170 const llvm::Twine &Name = "") {
171 auto *PtrTy = Ty->getPointerTo(Addr.getAddressSpace());
172 return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name), Ty,
173 Addr.getAlignment(), Addr.isKnownNonNull());
174 }
175
176 using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
178 llvm::Type *ElementTy,
179 const llvm::Twine &Name = "") {
180 llvm::Value *Ptr =
182 return Address(Ptr, ElementTy, Addr.getAlignment(), Addr.isKnownNonNull());
183 }
184
185 /// Given
186 /// %addr = {T1, T2...}* ...
187 /// produce
188 /// %name = getelementptr inbounds %addr, i32 0, i32 index
189 ///
190 /// This API assumes that drilling into a struct like this is always an
191 /// inbounds operation.
192 using CGBuilderBaseTy::CreateStructGEP;
193 Address CreateStructGEP(Address Addr, unsigned Index,
194 const llvm::Twine &Name = "") {
195 llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
196 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
197 const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
198 auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
199
200 return Address(
201 CreateStructGEP(Addr.getElementType(), Addr.getPointer(), Index, Name),
202 ElTy->getElementType(Index),
204 }
205
206 /// Given
207 /// %addr = [n x T]* ...
208 /// produce
209 /// %name = getelementptr inbounds %addr, i64 0, i64 index
210 /// where i64 is actually the target word size.
211 ///
212 /// This API assumes that drilling into an array like this is always
213 /// an inbounds operation.
214 Address CreateConstArrayGEP(Address Addr, uint64_t Index,
215 const llvm::Twine &Name = "") {
216 llvm::ArrayType *ElTy = cast<llvm::ArrayType>(Addr.getElementType());
217 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
218 CharUnits EltSize =
219 CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy->getElementType()));
220
221 return Address(
222 CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
223 {getSize(CharUnits::Zero()), getSize(Index)}, Name),
224 ElTy->getElementType(),
225 Addr.getAlignment().alignmentAtOffset(Index * EltSize),
226 Addr.isKnownNonNull());
227 }
228
229 /// Given
230 /// %addr = T* ...
231 /// produce
232 /// %name = getelementptr inbounds %addr, i64 index
233 /// where i64 is actually the target word size.
235 const llvm::Twine &Name = "") {
236 llvm::Type *ElTy = Addr.getElementType();
237 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
238 CharUnits EltSize = CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy));
239
240 return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
241 getSize(Index), Name),
242 ElTy, Addr.getAlignment().alignmentAtOffset(Index * EltSize),
243 Addr.isKnownNonNull());
244 }
245
246 /// Given
247 /// %addr = T* ...
248 /// produce
249 /// %name = getelementptr inbounds %addr, i64 index
250 /// where i64 is actually the target word size.
251 Address CreateConstGEP(Address Addr, uint64_t Index,
252 const llvm::Twine &Name = "") {
253 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
254 CharUnits EltSize =
255 CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
256
257 return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
258 getSize(Index), Name),
259 Addr.getElementType(),
260 Addr.getAlignment().alignmentAtOffset(Index * EltSize),
262 }
263
264 /// Create GEP with single dynamic index. The address alignment is reduced
265 /// according to the element size.
266 using CGBuilderBaseTy::CreateGEP;
267 Address CreateGEP(Address Addr, llvm::Value *Index,
268 const llvm::Twine &Name = "") {
269 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
270 CharUnits EltSize =
271 CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
272
273 return Address(
274 CreateGEP(Addr.getElementType(), Addr.getPointer(), Index, Name),
275 Addr.getElementType(),
277 }
278
279 /// Given a pointer to i8, adjust it by a given constant offset.
281 const llvm::Twine &Name = "") {
282 assert(Addr.getElementType() == TypeCache.Int8Ty);
283 return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
284 getSize(Offset), Name),
285 Addr.getElementType(),
287 Addr.isKnownNonNull());
288 }
290 const llvm::Twine &Name = "") {
291 assert(Addr.getElementType() == TypeCache.Int8Ty);
292 return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
293 getSize(Offset), Name),
294 Addr.getElementType(),
297 }
298
299 using CGBuilderBaseTy::CreateConstInBoundsGEP2_32;
300 Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1,
301 const llvm::Twine &Name = "") {
302 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
303
304 auto *GEP = cast<llvm::GetElementPtrInst>(CreateConstInBoundsGEP2_32(
305 Addr.getElementType(), Addr.getPointer(), Idx0, Idx1, Name));
306 llvm::APInt Offset(
307 DL.getIndexSizeInBits(Addr.getType()->getPointerAddressSpace()), 0,
308 /*isSigned=*/true);
309 if (!GEP->accumulateConstantOffset(DL, Offset))
310 llvm_unreachable("offset of GEP with constants is always computable");
311 return Address(GEP, GEP->getResultElementType(),
313 CharUnits::fromQuantity(Offset.getSExtValue())),
314 Addr.isKnownNonNull());
315 }
316
317 using CGBuilderBaseTy::CreateMemCpy;
318 llvm::CallInst *CreateMemCpy(Address Dest, Address Src, llvm::Value *Size,
319 bool IsVolatile = false) {
320 return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
321 Src.getPointer(), Src.getAlignment().getAsAlign(), Size,
322 IsVolatile);
323 }
324 llvm::CallInst *CreateMemCpy(Address Dest, Address Src, uint64_t Size,
325 bool IsVolatile = false) {
326 return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
327 Src.getPointer(), Src.getAlignment().getAsAlign(), Size,
328 IsVolatile);
329 }
330
331 using CGBuilderBaseTy::CreateMemCpyInline;
332 llvm::CallInst *CreateMemCpyInline(Address Dest, Address Src, uint64_t Size) {
333 return CreateMemCpyInline(
334 Dest.getPointer(), Dest.getAlignment().getAsAlign(), Src.getPointer(),
335 Src.getAlignment().getAsAlign(), getInt64(Size));
336 }
337
338 using CGBuilderBaseTy::CreateMemMove;
339 llvm::CallInst *CreateMemMove(Address Dest, Address Src, llvm::Value *Size,
340 bool IsVolatile = false) {
341 return CreateMemMove(Dest.getPointer(), Dest.getAlignment().getAsAlign(),
342 Src.getPointer(), Src.getAlignment().getAsAlign(),
343 Size, IsVolatile);
344 }
345
346 using CGBuilderBaseTy::CreateMemSet;
347 llvm::CallInst *CreateMemSet(Address Dest, llvm::Value *Value,
348 llvm::Value *Size, bool IsVolatile = false) {
349 return CreateMemSet(Dest.getPointer(), Value, Size,
350 Dest.getAlignment().getAsAlign(), IsVolatile);
351 }
352
353 using CGBuilderBaseTy::CreateMemSetInline;
354 llvm::CallInst *CreateMemSetInline(Address Dest, llvm::Value *Value,
355 uint64_t Size) {
356 return CreateMemSetInline(Dest.getPointer(),
357 Dest.getAlignment().getAsAlign(), Value,
358 getInt64(Size));
359 }
360
361 using CGBuilderBaseTy::CreatePreserveStructAccessIndex;
363 unsigned FieldIndex,
364 llvm::MDNode *DbgInfo) {
365 llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
366 const llvm::DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
367 const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
368 auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
369
371 Index, FieldIndex, DbgInfo),
372 ElTy->getElementType(Index),
374 }
375
376 using CGBuilderBaseTy::CreateLaunderInvariantGroup;
379 Addr.isKnownNonNull());
380 }
381};
382
383} // end namespace CodeGen
384} // end namespace clang
385
386#endif
unsigned Offset
Definition: Format.cpp:2776
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
An aligned address.
Definition: Address.h:29
CharUnits getAlignment() const
Return the alignment of this pointer.
Definition: Address.h:81
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Definition: Address.h:65
Address withPointer(llvm::Value *NewPointer, KnownNonNull_t IsKnownNonNull) const
Return address with different pointer, but same element type and alignment.
Definition: Address.h:88
unsigned getAddressSpace() const
Return the address space that this address resides in.
Definition: Address.h:71
KnownNonNull_t isKnownNonNull() const
Whether the pointer is known not to be null.
Definition: Address.h:102
llvm::Value * getPointer() const
Definition: Address.h:54
llvm::PointerType * getType() const
Return the type of the pointer value.
Definition: Address.h:60
This is an IRBuilder insertion helper that forwards to CodeGenFunction::InsertHelper,...
Definition: CGBuilder.h:26
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:29
llvm::LoadInst * CreateLoad(Address Addr, bool IsVolatile, const llvm::Twine &Name="")
Definition: CGBuilder.h:81
llvm::StoreInst * CreateFlagStore(bool Value, llvm::Value *Addr)
Emit a store to an i1 flag variable.
Definition: CGBuilder.h:129
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
Definition: CGBuilder.h:99
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:280
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, uint64_t Size, bool IsVolatile=false)
Definition: CGBuilder.h:324
Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1, const llvm::Twine &Name="")
Definition: CGBuilder.h:300
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C, const llvm::ConstantFolder &F, const CGBuilderInserterTy &Inserter)
Definition: CGBuilder.h:53
llvm::StoreInst * CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr, CharUnits Align, bool IsVolatile=false)
Definition: CGBuilder.h:106
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:169
llvm::CallInst * CreateMemMove(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:339
Address CreatePointerBitCastOrAddrSpaceCast(Address Addr, llvm::Type *Ty, llvm::Type *ElementTy, const llvm::Twine &Name="")
Definition: CGBuilder.h:177
llvm::CallInst * CreateMemCpyInline(Address Dest, Address Src, uint64_t Size)
Definition: CGBuilder.h:332
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
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:214
llvm::CallInst * CreateMemSetInline(Address Dest, llvm::Value *Value, uint64_t Size)
Definition: CGBuilder.h:354
llvm::StoreInst * CreateDefaultAlignedStore(llvm::Value *Val, llvm::Value *Addr, bool IsVolatile=false)
Definition: CGBuilder.h:114
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:347
Address CreateStructGEP(Address Addr, unsigned Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:193
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
Definition: CGBuilder.h:51
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
Definition: CGBuilder.h:57
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Definition: CGBuilder.h:71
Address CreateConstByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Definition: CGBuilder.h:289
Address CreatePreserveStructAccessIndex(Address Addr, unsigned Index, unsigned FieldIndex, llvm::MDNode *DbgInfo)
Definition: CGBuilder.h:362
llvm::LoadInst * CreateFlagLoad(llvm::Value *Addr, const llvm::Twine &Name="")
Emit a load from an i1 flag variable.
Definition: CGBuilder.h:121
Address CreateLaunderInvariantGroup(Address Addr)
Definition: CGBuilder.h:377
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:318
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Definition: CGBuilder.h:89
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
Definition: CGBuilder.h:59
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:251
llvm::ConstantInt * getSize(CharUnits N)
Definition: CGBuilder.h:62
llvm::LoadInst * CreateLoad(Address Addr, const char *Name)
Definition: CGBuilder.h:75
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:234
Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Definition: CGBuilder.h:158
llvm::ConstantInt * getSize(uint64_t N)
Definition: CGBuilder.h:65
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
Address CreateGEP(Address Addr, llvm::Value *Index, const llvm::Twine &Name="")
Definition: CGBuilder.h:267
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::IRBuilder< llvm::ConstantFolder, CGBuilderInserterTy > CGBuilderBaseTy
Definition: CGBuilder.h:43
CGBuilderInserter CGBuilderInserterTy
Definition: CGBuilder.h:40
@ NotKnownNonNull
Definition: Address.h:26
@ C
Languages that the frontend can parse and compile.
This structure provides a set of types that are commonly used during IR emission.
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64