;
22using namespaceCodeGen;
33enum{ DstIdx = 0, SrcIdx = 1 };
34const char*ValNameStr[2] = {
"dst",
"src"};
36template<
classDerived>
structStructVisitor {
39 template<
class... Ts>
47asDerived().visit(FT, FD, CurStructOffset, Args...);
50asDerived().flushTrivialFields(Args...);
53 template<
class... Ts>
voidvisitTrivial(Ts... Args) {}
55 template<
class... Ts>
voidvisitCXXDestructor(Ts... Args) {
56llvm_unreachable(
"field of a C++ struct type is not expected");
59 template<
class... Ts>
voidflushTrivialFields(Ts... Args) {}
71Derived &asDerived() {
return static_cast<Derived &
>(*this); }
77template<
classDerived,
boolIsMove>
78structCopyStructVisitor : StructVisitor<Derived>,
83CopyStructVisitor(
ASTContext&Ctx) : StructVisitor<Derived>(Ctx) {}
85 template<
class... Ts>
89 asDerived().flushTrivialFields(std::forward<Ts>(Args)...);
92 template<
class... Ts>
96 if(
const auto*AT =
asDerived().getContext().getAsArrayType(FT)) {
98CurStructOffset, std::forward<Ts>(Args)...);
103std::forward<Ts>(Args)...);
106 template<
class... Ts>
118 uint64_tFEndInBits = FStartInBits + FieldSize;
150template<
classDerived>
structGenFuncNameBase {
151std::string getVolatileOffsetStr(
boolIsVolatile,
CharUnitsOffset) {
155S += llvm::to_string(Offset.getQuantity());
164 CharUnitsFieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
171 CharUnitsFieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
177 CharUnitsFieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
179asDerived().visitStructFields(QT, FieldOffset);
182 template<
classFieldKind>
183 voidvisitArray(FieldKind FK,
const ArrayType*AT,
boolIsVolatile,
188 returnasDerived().visitTrivial(
QualType(AT, 0), FD, CurStructOffset);
190asDerived().flushTrivialFields();
191 CharUnitsFieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
197appendStr(
"_AB"+ llvm::to_string(FieldOffset.
getQuantity()) +
"s"+
199llvm::to_string(NumElts));
201asDerived().visitWithKind(FK, EltTy,
nullptr, FieldOffset);
205 voidappendStr(StringRef Str) { Name += Str; }
213Derived &asDerived() {
return static_cast<Derived &
>(*this); }
218template<
classDerived>
219structGenUnaryFuncName : StructVisitor<Derived>, GenFuncNameBase<Derived> {
221: StructVisitor<Derived>(Ctx) {
222this->appendStr(Prefix);
223this->appendStr(llvm::to_string(DstAlignment.
getQuantity()));
230 returnllvm::ConstantPointerNull::get(cast<llvm::PointerType>(Ty));
233template<
boolIsMove>
234structGenBinaryFuncName : CopyStructVisitor<GenBinaryFuncName<IsMove>, IsMove>,
235GenFuncNameBase<GenBinaryFuncName<IsMove>> {
237GenBinaryFuncName(StringRef Prefix,
CharUnitsDstAlignment,
239: CopyStructVisitor<GenBinaryFuncName<IsMove>, IsMove>(Ctx) {
240this->appendStr(Prefix);
241this->appendStr(llvm::to_string(DstAlignment.
getQuantity()));
242this->appendStr(
"_"+ llvm::to_string(SrcAlignment.
getQuantity()));
245 voidflushTrivialFields() {
246 if(this->Start == this->End)
249this->appendStr(
"_t"+ llvm::to_string(this->Start.getQuantity()) +
"w"+
250llvm::to_string((this->End - this->Start).getQuantity()));
265this->appendStr(
"_tv"+ llvm::to_string(OffsetInBits) +
"w"+
270structGenDefaultInitializeFuncName
271: GenUnaryFuncName<GenDefaultInitializeFuncName>,
275: GenUnaryFuncName<GenDefaultInitializeFuncName>(
"__default_constructor_",
276DstAlignment, Ctx) {}
279 if(
const auto*AT = getContext().getAsArrayType(FT)) {
288structGenDestructorFuncName : GenUnaryFuncName<GenDestructorFuncName>,
291GenDestructorFuncName(
const char*Prefix,
CharUnitsDstAlignment,
293: GenUnaryFuncName<GenDestructorFuncName>(Prefix, DstAlignment, Ctx) {}
296 if(
const auto*AT = getContext().getAsArrayType(FT)) {
313 for(
unsignedI = 0; I < N; ++I)
316ImplicitParamKind::Other));
318llvm::append_range(Args, Params);
323template<
size_tN,
size_t... Ints>
324staticstd::array<Address, N> getParamAddrs(std::index_sequence<Ints...> IntSeq,
325std::array<CharUnits, N> Alignments,
328 returnstd::array<Address, N>{
335template<
classDerived>
structGenFuncBase {
338std::array<Address, N> Addrs) {
339this->asDerived().callSpecialFunction(
343 template<
classFieldKind,
size_tN>
344 voidvisitArray(FieldKind FK,
const ArrayType*AT,
boolIsVolatile,
346std::array<Address, N> Addrs) {
349 returnasDerived().visitTrivial(
QualType(AT, 0), FD, CurStructOffset,
352asDerived().flushTrivialFields(Addrs);
358std::array<Address, N> StartAddrs = Addrs;
359 for(
unsignedI = 0; I < N; ++I)
360StartAddrs[I] = getAddrWithOffset(Addrs[I], CurStructOffset, FD);
361 AddressDstAddr = StartAddrs[DstIdx];
364llvm::Value *BaseEltSizeVal =
365llvm::ConstantInt::get(NumElts->getType(), BaseEltSize);
366llvm::Value *SizeInBytes =
367CGF.
Builder.CreateNUWMul(BaseEltSizeVal, NumElts);
370llvm::BasicBlock *PreheaderBB = CGF.
Builder.GetInsertBlock();
375llvm::PHINode *PHIs[N];
377 for(
unsignedI = 0; I < N; ++I) {
379PHIs[I]->addIncoming(StartAddrs[I].emitRawPointer(CGF), PreheaderBB);
389CGF.
Builder.CreateICmpEQ(PHIs[DstIdx], DstArrayEnd,
"done");
390CGF.
Builder.CreateCondBr(Done, ExitBB, LoopBB);
396std::array<Address, N> NewAddrs = Addrs;
398 for(
unsignedI = 0; I < N; ++I)
401StartAddrs[I].getAlignment().alignmentAtOffset(EltSize));
404this->asDerived().visitWithKind(FK, EltQT,
nullptr,
CharUnits::Zero(),
407LoopBB = CGF.
Builder.GetInsertBlock();
409 for(
unsignedI = 0; I < N; ++I) {
412NewAddrs[I] = getAddrWithOffset(NewAddrs[I], EltSize);
413PHIs[I]->addIncoming(NewAddrs[I].emitRawPointer(CGF), LoopBB);
417CGF.
Builder.CreateBr(HeaderBB);
423assert(Addr.
isValid() &&
"invalid address");
424 if(Offset.getQuantity() == 0)
433 returngetAddrWithOffset(Addr, StructFieldOffset +
438llvm::Function *getFunction(StringRef FuncName,
QualTypeQT,
439std::array<CharUnits, N> Alignments,
442 if(llvm::Function *F = CGM.
getModule().getFunction(FuncName)) {
443 boolWrongType =
false;
444 if(!F->getReturnType()->isVoidTy())
447 for(
constllvm::Argument &Arg : F->args())
453std::string FuncName = std::string(F->getName());
455CGM.
Error(
Loc,
"special function "+ FuncName +
456 " for non-trivial C struct has incorrect type");
467llvm::Function::Create(FuncTy, llvm::GlobalValue::LinkOnceODRLinkage,
469F->setVisibility(llvm::GlobalValue::HiddenVisibility);
476std::array<Address, N> Addrs =
477getParamAddrs<N>(std::make_index_sequence<N>{}, Alignments, Args, CGF);
484 voidcallFunc(StringRef FuncName,
QualTypeQT, std::array<Address, N> Addrs,
486std::array<CharUnits, N> Alignments;
487llvm::Value *Ptrs[N];
489 for(
unsignedI = 0; I < N; ++I) {
490Alignments[I] = Addrs[I].getAlignment();
491Ptrs[I] = Addrs[I].emitRawPointer(CallerCGF);
494 if(llvm::Function *F =
495getFunction(FuncName, QT, Alignments, CallerCGF.
CGM))
499Derived &asDerived() {
return static_cast<Derived &
>(*this); }
506template<
classDerived,
boolIsMove>
507structGenBinaryFunc : CopyStructVisitor<Derived, IsMove>,
508GenFuncBase<Derived> {
509GenBinaryFunc(
ASTContext&Ctx) : CopyStructVisitor<Derived, IsMove>(Ctx) {}
511 voidflushTrivialFields(std::array<Address, 2> Addrs) {
514 if(
Size.getQuantity() == 0)
517 AddressDstAddr = this->getAddrWithOffset(Addrs[DstIdx], this->Start);
518 AddressSrcAddr = this->getAddrWithOffset(Addrs[SrcIdx], this->Start);
521 if(
Size.getQuantity() >= 16 ||
522!llvm::has_single_bit<uint32_t>(
Size.getQuantity())) {
523llvm::Value *SizeVal =
524llvm::ConstantInt::get(this->CGF->
SizeTy,
Size.getQuantity());
529llvm::Type *Ty = llvm::Type::getIntNTy(
531 Size.getQuantity() * this->CGF->getContext().getCharWidth());
541 template<
class... Ts>
543std::array<Address, 2> Addrs) {
552 AddressDstAddr = this->getAddrWithOffset(Addrs[DstIdx], Offset);
556 AddressSrcAddr = this->getAddrWithOffset(Addrs[SrcIdx], Offset);
573structGenDestructor : StructVisitor<GenDestructor>,
574GenFuncBase<GenDestructor>,
577GenDestructor(
ASTContext&Ctx) : StructVisitor<GenDestructor>(Ctx) {}
581std::array<Address, 1> Addrs) {
582 if(
const auto*AT = getContext().getAsArrayType(FT)) {
591 CharUnitsCurStructOffset, std::array<Address, 1> Addrs) {
593*CGF, getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
597std::array<Address, 1> Addrs) {
599*CGF, getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
603std::array<Address, 1> Addrs) {
605CGF->
MakeAddrLValue(getAddrWithOffset(Addrs[DstIdx], Offset), FT));
609structGenDefaultInitialize
610: StructVisitor<GenDefaultInitialize>,
611GenFuncBase<GenDefaultInitialize>,
614 typedefGenFuncBase<GenDefaultInitialize> GenFuncBaseTy;
617: StructVisitor<GenDefaultInitialize>(Ctx) {}
621std::array<Address, 1> Addrs) {
622 if(
const auto*AT = getContext().getAsArrayType(FT)) {
632 CharUnitsCurStructOffset, std::array<Address, 1> Addrs) {
634getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
638std::array<Address, 1> Addrs) {
640getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
643 template<
classFieldKind,
size_t... Is>
644 voidvisitArray(FieldKind FK,
const ArrayType*AT,
boolIsVolatile,
646std::array<Address, 1> Addrs) {
648 returnvisitTrivial(
QualType(AT, 0), FD, CurStructOffset, Addrs);
655GenFuncBaseTy::visitArray(FK, AT, IsVolatile, FD, CurStructOffset, Addrs);
659llvm::Constant *SizeVal = CGF->
Builder.getInt64(
Size.getQuantity());
660 AddressDstAddr = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
667std::array<Address, 1> Addrs) {
669CGF->
MakeAddrLValue(getAddrWithOffset(Addrs[DstIdx], Offset), FT));
673structGenCopyConstructor : GenBinaryFunc<GenCopyConstructor, false> {
675: GenBinaryFunc<GenCopyConstructor,
false>(Ctx) {}
678 CharUnitsCurStructOffset, std::array<Address, 2> Addrs) {
679Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
680Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
688std::array<Address, 2> Addrs) {
689Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
690Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
695std::array<Address, 2> Addrs) {
696Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
697Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
703structGenMoveConstructor : GenBinaryFunc<GenMoveConstructor, true> {
705: GenBinaryFunc<GenMoveConstructor,
true>(Ctx) {}
708 CharUnitsCurStructOffset, std::array<Address, 2> Addrs) {
709Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
710Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
712llvm::Value *SrcVal =
720std::array<Address, 2> Addrs) {
721Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
722Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
727std::array<Address, 2> Addrs) {
728Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
729Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
735structGenCopyAssignment : GenBinaryFunc<GenCopyAssignment, false> {
737: GenBinaryFunc<GenCopyAssignment,
false>(Ctx) {}
740 CharUnitsCurStructOffset, std::array<Address, 2> Addrs) {
741Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
742Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
750std::array<Address, 2> Addrs) {
751Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
752Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
757std::array<Address, 2> Addrs) {
758Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
759Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
766structGenMoveAssignment : GenBinaryFunc<GenMoveAssignment, true> {
768: GenBinaryFunc<GenMoveAssignment,
true>(Ctx) {}
771 CharUnitsCurStructOffset, std::array<Address, 2> Addrs) {
772Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
773Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
775llvm::Value *SrcVal =
779llvm::Value *DstVal =
786std::array<Address, 2> Addrs) {
787Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
788Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
793std::array<Address, 2> Addrs) {
794Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
795Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
817Gen.visit(QT,
nullptr,
CharUnits::Zero(), std::array<Address, 1>({{DstPtr}}));
820template<
classG,
size_tN>
823std::array<Address, N> Addrs) {
825 for(
unsignedI = 0; I < N; ++I)
826Addrs[I] = Addrs[I].withElementType(CGF.
CGM.
Int8PtrTy);
828Gen.callFunc(FuncName, QT, Addrs, CGF);
831template<
classG,
size_tN>
832staticllvm::Function *
839 returnGen.getFunction(FuncName, QT, Alignments, CGM);
848std::string FuncName = GenName.getName(QT, IsVolatile);
850IsVolatile, *
this, std::array<Address, 1>({{DstPtr}}));
855GenBinaryFuncName<false> GenName(
"", Alignment, Alignment, Ctx);
856 returnGenName.getName(QT, IsVolatile);
863GenDestructorFuncName GenName(
"", Alignment, Ctx);
864 returnGenName.getName(QT, IsVolatile);
871GenDestructorFuncName GenName(
"__destructor_", DstPtr.
getAlignment(),
873std::string FuncName = GenName.getName(QT, IsVolatile);
875*
this, std::array<Address, 1>({{DstPtr}}));
882GenBinaryFuncName<false> GenName(
"__copy_constructor_", DstPtr.
getAlignment(),
884std::string FuncName = GenName.getName(QT, IsVolatile);
887std::array<Address, 2>({{DstPtr, SrcPtr}}));
896GenBinaryFuncName<false> GenName(
"__copy_assignment_", DstPtr.
getAlignment(),
898std::string FuncName = GenName.getName(QT, IsVolatile);
900*
this, std::array<Address, 2>({{DstPtr, SrcPtr}}));
907GenBinaryFuncName<true> GenName(
"__move_constructor_", DstPtr.
getAlignment(),
909std::string FuncName = GenName.getName(QT, IsVolatile);
912std::array<Address, 2>({{DstPtr, SrcPtr}}));
921GenBinaryFuncName<true> GenName(
"__move_assignment_", DstPtr.
getAlignment(),
923std::string FuncName = GenName.getName(QT, IsVolatile);
925*
this, std::array<Address, 2>({{DstPtr, SrcPtr}}));
931GenDefaultInitializeFuncName GenName(DstAlignment, Ctx);
932std::string FuncName = GenName.getName(QT, IsVolatile);
934std::array<CharUnits, 1>({{DstAlignment}}), CGM);
941GenBinaryFuncName<false> GenName(
"__copy_constructor_", DstAlignment,
943std::string FuncName = GenName.getName(QT, IsVolatile);
945GenCopyConstructor(Ctx), FuncName, QT, IsVolatile,
946std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
953GenBinaryFuncName<true> GenName(
"__move_constructor_", DstAlignment,
955std::string FuncName = GenName.getName(QT, IsVolatile);
957GenMoveConstructor(Ctx), FuncName, QT, IsVolatile,
958std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
965GenBinaryFuncName<false> GenName(
"__copy_assignment_", DstAlignment,
967std::string FuncName = GenName.getName(QT, IsVolatile);
969GenCopyAssignment(Ctx), FuncName, QT, IsVolatile,
970std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
977GenBinaryFuncName<true> GenName(
"__move_assignment_", DstAlignment,
979std::string FuncName = GenName.getName(QT, IsVolatile);
981GenMoveAssignment(Ctx), FuncName, QT, IsVolatile,
982std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
988GenDestructorFuncName GenName(
"__destructor_", DstAlignment, Ctx);
989std::string FuncName = GenName.getName(QT, IsVolatile);
991std::array<CharUnits, 1>({{DstAlignment}}), CGM);
static bool getFieldOffsetInBits(CodeGenFunction &CGF, const RecordDecl *RD, const FieldDecl *Field, int64_t &Offset)
The offset of a field from the beginning of the record.
static uint64_t getFieldSize(const FieldDecl *FD, QualType FT, ASTContext &Ctx)
static void callSpecialFunction(G &&Gen, StringRef FuncName, QualType QT, bool IsVolatile, CodeGenFunction &CGF, std::array< Address, N > Addrs)
static llvm::Function * getSpecialFunction(G &&Gen, StringRef FuncName, QualType QT, bool IsVolatile, std::array< CharUnits, N > Alignments, CodeGenModule &CGM)
static llvm::Constant * getNullForVariable(Address addr)
Given the address of a variable of pointer type, find the correct null to store into it.
static uint64_t getFieldOffset(const ASTContext &C, const FieldDecl *FD)
static std::string getName(const CallEvent &Call)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
uint64_t getCharWidth() const
Return the size of the character type, in bits.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getElementType() const
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
CharUnits getAlignment() const
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
static ApplyDebugLocation CreateArtificial(CodeGenFunction &CGF)
Apply TemporaryLocation if it is valid.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
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...
Address CreateInBoundsGEP(Address Addr, ArrayRef< llvm::Value * > IdxList, llvm::Type *ElementType, CharUnits Align, const Twine &Name="")
CGFunctionInfo - Class to encapsulate the information about a function definition.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void FinishFunction(SourceLocation EndLoc=SourceLocation())
FinishFunction - Complete IR generation of the current function.
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
void EmitARCMoveWeak(Address dst, Address src)
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
void callCStructDefaultConstructor(LValue Dst)
llvm::Value * emitArrayLength(const ArrayType *arrayType, QualType &baseType, Address &addr)
emitArrayLength - Compute the length of an array, even if it's a VLA, and drill down to the base elem...
void callCStructCopyAssignmentOperator(LValue Dst, LValue Src)
void callCStructMoveConstructor(LValue Dst, LValue Src)
void callCStructCopyConstructor(LValue Dst, LValue Src)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
void callCStructDestructor(LValue Dst)
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
EmitLoadOfLValue - Given an expression that represents a value lvalue, this method emits the address ...
llvm::Type * ConvertTypeForMem(QualType T)
LValue EmitLValueForField(LValue Base, const FieldDecl *Field)
static std::string getNonTrivialDestructorStr(QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx)
void EmitARCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
void EmitARCCopyWeak(Address dst, Address src)
void defaultInitNonTrivialCStructVar(LValue Dst)
void StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn, const CGFunctionInfo &FnInfo, const FunctionArgList &Args, SourceLocation Loc=SourceLocation(), SourceLocation StartLoc=SourceLocation())
Emit code for the start of a function.
llvm::Value * EmitARCRetain(QualType type, llvm::Value *value)
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
ASTContext & getContext() const
llvm::Value * EmitARCStoreStrong(LValue lvalue, llvm::Value *value, bool resultIgnored)
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
void emitARCMoveAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
void callCStructMoveAssignmentOperator(LValue Dst, LValue Src)
static Destroyer destroyARCWeak
llvm::Type * ConvertType(QualType T)
void emitARCCopyAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
static Destroyer destroyARCStrongImprecise
llvm::LLVMContext & getLLVMContext()
static std::string getNonTrivialCopyConstructorStr(QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx)
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Module & getModule() const
CodeGenTypes & getTypes()
void Error(SourceLocation loc, StringRef error)
Emit a general error that something can't be done.
ASTContext & getContext() const
void SetLLVMFunctionAttributes(GlobalDecl GD, const CGFunctionInfo &Info, llvm::Function *F, bool IsThunk)
Set the LLVM function attributes (sext, zext, etc).
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
const CGFunctionInfo & arrangeBuiltinFunctionDeclaration(QualType resultType, const FunctionArgList &args)
A builtin function is a freestanding function using the default C conventions.
FunctionArgList - Type for representing both the decl and type of parameters to a function.
LValue - This represents an lvalue references.
Address getAddress() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
Represents the canonical version of C arrays with a specified constant size.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getBitWidthValue() const
Computes the bit width of this field, if this is a bit field.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
bool isZeroLengthBitField() const
Is this a zero-length bit-field? Such bit-fields aren't really bit-fields at all and instead act as a...
GlobalDecl - represents a global declaration.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)
Create implicit parameter.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
PrimitiveDefaultInitializeKind
QualType withVolatile() const
Represents a struct/union/class.
field_range fields() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Encodes a location in the source.
const Type * getTypeForDecl() const
The base class of the type hierarchy.
bool isBlockPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
const T * getAs() const
Member-template getAs<specific type>'.
llvm::Function * getNonTrivialCStructCopyConstructor(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the copy constructor for a C struct with non-trivially copyable fields, generating it if nece...
llvm::Function * getNonTrivialCStructMoveConstructor(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the move constructor for a C struct with non-trivially copyable fields, generating it if nece...
llvm::Function * getNonTrivialCStructCopyAssignmentOperator(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the copy assignment operator for a C struct with non-trivially copyable fields,...
llvm::Function * getNonTrivialCStructMoveAssignmentOperator(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Return the move assignment operator for a C struct with non-trivially copyable fields,...
llvm::Function * getNonTrivialCStructDestructor(CodeGenModule &CGM, CharUnits DstAlignment, bool IsVolatile, QualType QT)
Returns the destructor for a C struct with non-trivially copyable fields, generating it if necessary.
llvm::Function * getNonTrivialCStructDefaultConstructor(CodeGenModule &GCM, CharUnits DstAlignment, bool IsVolatile, QualType QT)
Returns the default constructor for a C struct with non-trivially copyable fields,...
The JSON file list parser is used to communicate input to InstallAPI.
llvm::PointerType * VoidPtrTy
llvm::PointerType * Int8PtrPtrTy
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
llvm::IntegerType * SizeTy
llvm::PointerType * Int8PtrTy
RetTy visitWithKind(QualType::PrimitiveCopyKind PCK, QualType FT, Ts &&... Args)
RetTy visitWithKind(QualType::PrimitiveDefaultInitializeKind PDIK, QualType FT, Ts &&... Args)
RetTy visitWithKind(QualType::DestructionKind DK, QualType FT, Ts &&... Args)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4