clang: lib/CodeGen/Targets/PPC.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
10#include "TargetInfo.h"
12
13using namespace clang;
15
21 SlotSize, SlotSize, true);
22
24 Address ImagAddr = RealAddr;
26 RealAddr =
29 2 * SlotSize - EltSize);
30 } else {
32 }
33
39
41}
42
44 llvm::Value *Address, bool Is64Bit,
45 bool IsAIX) {
46
47
48
50
51 llvm::IntegerType *i8 = CGF.Int8Ty;
52 llvm::Value *Four8 = llvm::ConstantInt::get(i8, 4);
53 llvm::Value *Eight8 = llvm::ConstantInt::get(i8, 8);
54 llvm::Value *Sixteen8 = llvm::ConstantInt::get(i8, 16);
55
56
58
59
61
62
63
64
65
66
68
69
70
71
73
74
76
77
78
80
81
82 if (IsAIX)
83 return false;
84
85
86
87
89
90 if (!Is64Bit)
91 return false;
92
93
94
95
96
97
98
100
101 return false;
102}
103
104
105namespace {
106
107class AIXABIInfo : public ABIInfo {
108 const bool Is64Bit;
109 const unsigned PtrByteSize;
110 CharUnits getParamTypeAlignment(QualType Ty) const;
111
112public:
113 AIXABIInfo(CodeGen::CodeGenTypes &CGT, bool Is64Bit)
114 : ABIInfo(CGT), Is64Bit(Is64Bit), PtrByteSize(Is64Bit ? 8 : 4) {}
115
116 bool isPromotableTypeForABI(QualType Ty) const;
117
120
121 void computeInfo(CGFunctionInfo &FI) const override {
124
127 }
128
129 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
130 AggValueSlot Slot) const override;
131};
132
134 const bool Is64Bit;
135
136public:
137 AIXTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, bool Is64Bit)
138 : TargetCodeGenInfo(std::make_unique(CGT, Is64Bit)),
139 Is64Bit(Is64Bit) {}
140 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override {
141 return 1;
142 }
143
144 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
145 llvm::Value *Address) const override;
146
147 void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
148 CodeGen::CodeGenModule &M) const override;
149};
150}
151
152
153
154bool AIXABIInfo::isPromotableTypeForABI(QualType Ty) const {
155
157 Ty = ED->getIntegerType();
158
159
160 if (getContext().isPromotableIntegerType(Ty))
161 return true;
162
163 if (!Is64Bit)
164 return false;
165
166
167
168
169 if (const BuiltinType *BT = Ty->getAs())
170 switch (BT->getKind()) {
171 case BuiltinType::Int:
172 case BuiltinType::UInt:
173 return true;
174 default:
175 break;
176 }
177
178 return false;
179}
180
181ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy) const {
184
187
190
192 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
193
196}
197
198ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty) const {
200
203
206
208
209
211 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
213
214 CharUnits CCAlign = getParamTypeAlignment(Ty);
215 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
216
218 CCAlign, getDataLayout().getAllocaAddrSpace(),
219 true,
220 TyAlign > CCAlign);
221 }
222
223 return (isPromotableTypeForABI(Ty)
226}
227
228CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty) const {
229
230 if (const ComplexType *CTy = Ty->getAs())
231 Ty = CTy->getElementType();
232
235
236
239
241}
242
243RValue AIXABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
244 QualType Ty, AggValueSlot Slot) const {
245
246 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
247 TypeInfo.Align = getParamTypeAlignment(Ty);
248
250
251
252
253
254
255
256
257
258 if (const ComplexType *CTy = Ty->getAs()) {
259 CharUnits EltSize = TypeInfo.Width / 2;
260 if (EltSize < SlotSize)
262 }
263
264 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, false, TypeInfo,
265 SlotSize, true, Slot);
266}
267
268bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(
269 CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const {
271}
272
273void AIXTargetCodeGenInfo::setTargetAttributes(
274 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const {
276 return;
277
279 auto GVId = GV->getName();
280
281
282 bool UserSpecifiedTOC =
284
285
286 if (UserSpecifiedTOC ||
289 const unsigned long PointerSize =
290 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;
291 auto *VarD = dyn_cast(D);
292 assert(VarD && "Invalid declaration of global variable.");
293
296 const auto *Ty = VarD->getType().getTypePtr();
298
299 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();
300 auto reportUnsupportedWarning = [&](bool ShouldEmitWarning, StringRef Msg) {
301 if (ShouldEmitWarning)
303 << GVId << Msg;
304 };
306 reportUnsupportedWarning(EmitDiagnostic, "of incomplete type");
308 reportUnsupportedWarning(EmitDiagnostic,
309 "it contains a flexible array member");
311 reportUnsupportedWarning(EmitDiagnostic, "of thread local storage");
312 else if (PointerSize < Context.getTypeInfo(VarD->getType()).Width / 8)
313 reportUnsupportedWarning(EmitDiagnostic,
314 "variable is larger than a pointer");
315 else if (PointerSize < Alignment)
316 reportUnsupportedWarning(EmitDiagnostic,
317 "variable is aligned wider than a pointer");
318 else if (D->hasAttr())
319 reportUnsupportedWarning(EmitDiagnostic,
320 "variable has a section attribute");
321 else if (GV->hasExternalLinkage() ||
322 (M.getCodeGenOpts().AllTocData && !GV->hasLocalLinkage()))
323 GVar->addAttribute("toc-data");
324 }
325}
326
327
328namespace {
329
330class PPC32_SVR4_ABIInfo : public DefaultABIInfo {
331 bool IsSoftFloatABI;
332 bool IsRetSmallStructInRegABI;
333
334 CharUnits getParamTypeAlignment(QualType Ty) const;
335
336public:
337 PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, bool SoftFloatABI,
338 bool RetSmallStructInRegABI)
339 : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
340 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
341
343
344 void computeInfo(CGFunctionInfo &FI) const override {
349 }
350
351 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
352 AggValueSlot Slot) const override;
353};
354
355class PPC32TargetCodeGenInfo : public TargetCodeGenInfo {
356public:
357 PPC32TargetCodeGenInfo(CodeGenTypes &CGT, bool SoftFloatABI,
358 bool RetSmallStructInRegABI)
359 : TargetCodeGenInfo(std::make_unique<PPC32_SVR4_ABIInfo>(
360 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}
361
362 static bool isStructReturnInRegABI(const llvm::Triple &Triple,
363 const CodeGenOptions &Opts);
364
365 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override {
366
367 return 1;
368 }
369
370 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
371 llvm::Value *Address) const override;
372};
373}
374
375CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const {
376
377 if (const ComplexType *CTy = Ty->getAs())
378 Ty = CTy->getElementType();
379
382 : 4);
383
384
385
386 const Type *AlignTy = nullptr;
388 const BuiltinType *BT = EltType->getAs();
389 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
391 AlignTy = EltType;
392 }
393
394 if (AlignTy)
397}
398
399ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const {
401
402
404 (Size = getContext().getTypeSize(RetTy)) <= 64) {
405
406
407
408
409
410
411
412
413
414
415
416 if (Size == 0)
418 else {
419 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
421 }
422 }
423
425}
426
427
428
429RValue PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
430 QualType Ty, AggValueSlot Slot) const {
431 if (getTarget().getTriple().isOSDarwin()) {
432 auto TI = getContext().getTypeInfoInChars(Ty);
433 TI.Align = getParamTypeAlignment(Ty);
434
438 true, Slot);
439 }
440
441 const unsigned OverflowLimit = 8;
442 if (const ComplexType *CTy = Ty->getAs()) {
443
444 (void)CTy;
446 }
447
448
449
450
451
452
453
454
455
456 bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64;
458 bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64;
459
460
461
463
464 CGBuilderTy &Builder = CGF.Builder;
465
466
468 if (isInt || IsSoftFloatABI) {
469 NumRegsAddr = Builder.CreateStructGEP(VAList, 0, "gpr");
470 } else {
471 NumRegsAddr = Builder.CreateStructGEP(VAList, 1, "fpr");
472 }
473
474 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr, "numUsedRegs");
475
476
477 if (isI64 || (isF64 && IsSoftFloatABI)) {
478 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));
479 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((uint8_t) ~1U));
480 }
481
482 llvm::Value *CC =
483 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit), "cond");
484
485 llvm::BasicBlock *UsingRegs = CGF.createBasicBlock("using_regs");
486 llvm::BasicBlock *UsingOverflow = CGF.createBasicBlock("using_overflow");
488
489 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
490
491 llvm::Type *DirectTy = CGF.ConvertType(Ty), *ElementTy = DirectTy;
492 if (isIndirect)
494
495
497 {
499
500 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);
501 RegAddr = Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.Int8Ty,
504
505
506 if (!(isInt || IsSoftFloatABI)) {
507 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,
509 }
510
511
512
514 llvm::Value *RegOffset =
515 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.getQuantity()));
516 RegAddr = Address(Builder.CreateInBoundsGEP(
518 DirectTy,
520
521
522 NumRegs =
523 Builder.CreateAdd(NumRegs,
524 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
525 Builder.CreateStore(NumRegs, NumRegsAddr);
526
528 }
529
530
532 {
534
535 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);
536
537
539
540 CharUnits Size;
541 if (!isIndirect) {
543 Size = TypeInfo.Width.alignTo(OverflowAreaAlign);
544 } else {
546 }
547
548 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);
549 Address OverflowArea =
550 Address(Builder.CreateLoad(OverflowAreaAddr, "argp.cur"), CGF.Int8Ty,
551 OverflowAreaAlign);
552
554 if (Align > OverflowAreaAlign) {
558 }
559
561
562
563 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);
564 Builder.CreateStore(OverflowArea.emitRawPointer(CGF), OverflowAreaAddr);
566 }
567
569
570
571 Address Result = emitMergePHI(CGF, RegAddr, UsingRegs, MemAddr, UsingOverflow,
572 "vaarg.addr");
573
574
575 if (isIndirect) {
576 Result = Address(Builder.CreateLoad(Result, "aggr"), ElementTy,
577 getContext().getTypeAlignInChars(Ty));
578 }
579
581}
582
583bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
584 const llvm::Triple &Triple, const CodeGenOptions &Opts) {
585 assert(Triple.isPPC32());
586
587 switch (Opts.getStructReturnConvention()) {
589 break;
591 return false;
593 return true;
594 }
595
596 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
597 return true;
598
599 return false;
600}
601
602bool
603PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
604 llvm::Value *Address) const {
606 false);
607}
608
609
610
611namespace {
612
613
614class PPC64_SVR4_ABIInfo : public ABIInfo {
615 static const unsigned GPRBits = 64;
617 bool IsSoftFloatABI;
618
619public:
620 PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, PPC64_SVR4_ABIKind Kind,
621 bool SoftFloatABI)
622 : ABIInfo(CGT), Kind(Kind), IsSoftFloatABI(SoftFloatABI) {}
623
624 bool isPromotableTypeForABI(QualType Ty) const;
625 CharUnits getParamTypeAlignment(QualType Ty) const;
626
629
630 bool isHomogeneousAggregateBaseType(QualType Ty) const override;
631 bool isHomogeneousAggregateSmallEnough(const Type *Ty,
632 uint64_t Members) const override;
633
634
635
636
637
638
639
640 void computeInfo(CGFunctionInfo &FI) const override {
644
645
646
648 if (T) {
649 const BuiltinType *BT = T->getAs();
650 if ((T->isVectorType() && getContext().getTypeSize(T) == 128) ||
652 QualType QT(T, 0);
654 continue;
655 }
656 }
658 }
659 }
660
661 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
662 AggValueSlot Slot) const override;
663};
664
665class PPC64_SVR4_TargetCodeGenInfo : public TargetCodeGenInfo {
666
667public:
668 PPC64_SVR4_TargetCodeGenInfo(CodeGenTypes &CGT, PPC64_SVR4_ABIKind Kind,
669 bool SoftFloatABI)
670 : TargetCodeGenInfo(
671 std::make_unique<PPC64_SVR4_ABIInfo>(CGT, Kind, SoftFloatABI)) {
672 SwiftInfo =
673 std::make_unique(CGT, false);
674 }
675
676 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override {
677
678 return 1;
679 }
680
681 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
682 llvm::Value *Address) const override;
683 void emitTargetMetadata(CodeGen::CodeGenModule &CGM,
684 const llvm::MapVector<GlobalDecl, StringRef>
685 &MangledDeclNames) const override;
686};
687
688class PPC64TargetCodeGenInfo : public TargetCodeGenInfo {
689public:
690 PPC64TargetCodeGenInfo(CodeGenTypes &CGT)
691 : TargetCodeGenInfo(std::make_unique(CGT)) {}
692
693 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override {
694
695 return 1;
696 }
697
698 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
699 llvm::Value *Address) const override;
700};
701}
702
703
704
705bool
706PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty) const {
707
709 Ty = ED->getIntegerType();
710
711
712 if (isPromotableIntegerTypeForABI(Ty))
713 return true;
714
715
716
717 if (const BuiltinType *BT = Ty->getAs())
719 case BuiltinType::Int:
720 case BuiltinType::UInt:
721 return true;
722 default:
723 break;
724 }
725
726 if (const auto *EIT = Ty->getAs())
727 if (EIT->getNumBits() < 64)
728 return true;
729
730 return false;
731}
732
733
734
735CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const {
736
737 if (const ComplexType *CTy = Ty->getAs())
738 Ty = CTy->getElementType();
739
740 auto FloatUsesVector = [this](QualType Ty){
741 return Ty->isRealFloatingType() && &getContext().getFloatTypeSemantics(
742 Ty) == &llvm::APFloat::IEEEquad();
743 };
744
745
746
749 } else if (FloatUsesVector(Ty)) {
750
751
752
754 }
755
756
757
758 const Type *AlignAsType = nullptr;
760 if (EltType) {
761 const BuiltinType *BT = EltType->getAs();
762 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
764 AlignAsType = EltType;
765 }
766
767
770 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&
772 AlignAsType = Base;
773
774
775 if (AlignAsType) {
776 bool UsesVector = AlignAsType->isVectorType() ||
777 FloatUsesVector(QualType(AlignAsType, 0));
779 }
780
781
782
785 }
786
788}
789
790bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {
791
792
793 if (const BuiltinType *BT = Ty->getAs()) {
794 if (BT->getKind() == BuiltinType::Float ||
795 BT->getKind() == BuiltinType::Double ||
796 BT->getKind() == BuiltinType::LongDouble ||
797 BT->getKind() == BuiltinType::Ibm128 ||
798 (getContext().getTargetInfo().hasFloat128Type() &&
799 (BT->getKind() == BuiltinType::Float128))) {
800 if (IsSoftFloatABI)
801 return false;
802 return true;
803 }
804 }
805 if (const VectorType *VT = Ty->getAs()) {
806 if (getContext().getTypeSize(VT) == 128)
807 return true;
808 }
809 return false;
810}
811
812bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(
813 const Type *Base, uint64_t Members) const {
814
815
817 ((getContext().getTargetInfo().hasFloat128Type() &&
818 Base->isFloat128Type()) ||
819 Base->isVectorType()) ? 1
820 : (getContext().getTypeSize(Base) + 63) / 64;
821
822
823 return Members * NumRegs <= 8;
824}
825
826ABIArgInfo
827PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty) const {
829
832
833
834
836 uint64_t Size = getContext().getTypeSize(Ty);
837 if (Size > 128)
838 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
839 false);
840 else if (Size < 128) {
841 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
843 }
844 }
845
846 if (const auto *EIT = Ty->getAs())
847 if (EIT->getNumBits() > 128)
848 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
849 true);
850
853 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
855
856 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();
858
859
862 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
863 isHomogeneousAggregate(Ty, Base, Members)) {
864 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
865 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
867 }
868
869
870
871
872
873 uint64_t Bits = getContext().getTypeSize(Ty);
874 if (Bits > 0 && Bits <= 8 * GPRBits) {
875 llvm::Type *CoerceTy;
876
877
878
879 if (Bits <= GPRBits)
880 CoerceTy =
881 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
882
883
884 else {
885 uint64_t RegBits = ABIAlign * 8;
886 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;
887 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);
888 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);
889 }
890
892 }
893
894
897 getDataLayout().getAllocaAddrSpace(),
898 true, TyAlign > ABIAlign);
899 }
900
901 return (isPromotableTypeForABI(Ty)
904}
905
906ABIArgInfo
907PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const {
910
913
914
915
917 uint64_t Size = getContext().getTypeSize(RetTy);
918 if (Size > 128)
919 return getNaturalAlignIndirect(RetTy,
920 getDataLayout().getAllocaAddrSpace());
921 else if (Size < 128) {
922 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
924 }
925 }
926
927 if (const auto *EIT = RetTy->getAs())
928 if (EIT->getNumBits() > 128)
929 return getNaturalAlignIndirect(
930 RetTy, getDataLayout().getAllocaAddrSpace(), false);
931
933
936 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
937 isHomogeneousAggregate(RetTy, Base, Members)) {
938 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
939 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
941 }
942
943
944 uint64_t Bits = getContext().getTypeSize(RetTy);
945 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {
946 if (Bits == 0)
948
949 llvm::Type *CoerceTy;
950 if (Bits > GPRBits) {
951 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
952 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
953 } else
954 CoerceTy =
955 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
957 }
958
959
960 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
961 }
962
965}
966
967
968RValue PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
969 QualType Ty, AggValueSlot Slot) const {
970 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
971 TypeInfo.Align = getParamTypeAlignment(Ty);
972
974
975
976
977
978
979
980
981 if (const ComplexType *CTy = Ty->getAs()) {
982 CharUnits EltSize = TypeInfo.Width / 2;
983 if (EltSize < SlotSize)
985 }
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, false, TypeInfo,
1001 SlotSize, true, Slot,
1002 true);
1003}
1004
1005bool
1006PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(
1007 CodeGen::CodeGenFunction &CGF,
1008 llvm::Value *Address) const {
1010 false);
1011}
1012
1013void PPC64_SVR4_TargetCodeGenInfo::emitTargetMetadata(
1014 CodeGen::CodeGenModule &CGM,
1015 const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames) const {
1019 if (flt == &llvm::APFloat::PPCDoubleDouble())
1020 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi",
1021 llvm::MDString::get(Ctx, "doubledouble"));
1022 else if (flt == &llvm::APFloat::IEEEquad())
1023 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi",
1024 llvm::MDString::get(Ctx, "ieeequad"));
1025 else if (flt == &llvm::APFloat::IEEEdouble())
1026 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi",
1027 llvm::MDString::get(Ctx, "ieeedouble"));
1028 }
1029}
1030
1031bool
1032PPC64TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1033 llvm::Value *Address) const {
1035 false);
1036}
1037
1038std::unique_ptr
1040 return std::make_unique(CGM.getTypes(), Is64Bit);
1041}
1042
1043std::unique_ptr
1045 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(
1047 return std::make_unique(CGM.getTypes(), SoftFloatABI,
1048 RetSmallStructInRegABI);
1049}
1050
1051std::unique_ptr
1053 return std::make_unique(CGM.getTypes());
1054}
1055
1058 return std::make_unique<PPC64_SVR4_TargetCodeGenInfo>(CGM.getTypes(), Kind,
1059 SoftFloatABI);
1060}
static RValue complexTempStructure(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, CharUnits SlotSize, CharUnits EltSize, const ComplexType *CTy)
Definition PPC.cpp:16
static bool PPC_initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address, bool Is64Bit, bool IsAIX)
Definition PPC.cpp:43
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
TypeInfoChars getTypeInfoInChars(const Type *T) const
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
bool isFloatingPoint() 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.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
std::vector< std::string > TocDataVarsUserSpecified
List of global variables explicitly specified by the user as toc-data.
std::vector< std::string > NoTocDataVars
List of global variables that over-ride the toc-data default.
static ABIArgInfo getIgnore()
static ABIArgInfo getDirect(llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)
static ABIArgInfo getIndirect(CharUnits Alignment, unsigned AddrSpace, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
static ABIArgInfo getExtend(QualType Ty, llvm::Type *T=nullptr)
static ABIArgInfo getDirectInReg(llvm::Type *T=nullptr)
ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions.
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.
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
RecordArgABI
Specify how one should pass an argument of a record type.
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
ABIArgInfo & getReturnInfo()
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Type * ConvertType(QualType T)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
RValue EmitLoadOfAnyValue(LValue V, AggValueSlot Slot=AggValueSlot::ignored(), SourceLocation Loc={})
Like EmitLoadOfLValue but also handles complex and aggregate types.
ASTContext & getContext() const
llvm::Type * ConvertTypeForMem(QualType T)
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block,...
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Module & getModule() const
DiagnosticsEngine & getDiags() const
CodeGenTypes & getTypes()
const TargetInfo & getTarget() const
const llvm::DataLayout & getDataLayout() const
const llvm::Triple & getTriple() const
const CodeGenOptions & getCodeGenOpts() const
llvm::LLVMContext & getLLVMContext()
bool isLongDoubleReferenced() const
ABIArgInfo classifyReturnType(QualType RetTy) const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
Complex values, per C99 6.2.5p11.
QualType getElementType() const
ASTContext & getASTContext() const LLVM_READONLY
SourceLocation getLocation() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
A (possibly-)qualified type.
bool hasFlexibleArrayMember() const
const llvm::fltSemantics & getLongDoubleFormat() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isAnyComplexType() const
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isVectorType() const
bool isRealFloatingType() const
Floating point categories.
bool isFloatingType() const
const T * getAs() const
Member-template getAs'.
@ TLS_None
Not a TLS variable.
ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)
Classify the rules for how to pass a particular type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
bool classifyReturnType(const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
std::unique_ptr< TargetCodeGenInfo > createPPC64_SVR4_TargetCodeGenInfo(CodeGenModule &CGM, PPC64_SVR4_ABIKind Kind, bool SoftFloatABI)
Definition PPC.cpp:1056
Address emitVoidPtrDirectVAArg(CodeGenFunction &CGF, Address VAListAddr, llvm::Type *DirectTy, CharUnits DirectSize, CharUnits DirectAlign, CharUnits SlotSize, bool AllowHigherAlign, bool ForceRightAdjust=false)
Emit va_arg for a platform using the common void* representation, where arguments are simply emitted ...
std::unique_ptr< TargetCodeGenInfo > createAIXTargetCodeGenInfo(CodeGenModule &CGM, bool Is64Bit)
Definition PPC.cpp:1039
bool isRecordWithSIMDVectorType(ASTContext &Context, QualType Ty)
RValue emitVoidPtrVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType ValueTy, bool IsIndirect, TypeInfoChars ValueInfo, CharUnits SlotSizeAndAlign, bool AllowHigherAlign, AggValueSlot Slot, bool ForceRightAdjust=false)
Emit va_arg for a platform using the common void* representation, where arguments are simply emitted ...
Address emitMergePHI(CodeGenFunction &CGF, Address Addr1, llvm::BasicBlock *Block1, Address Addr2, llvm::BasicBlock *Block2, const llvm::Twine &Name="")
llvm::Value * emitRoundPointerUpToAlignment(CodeGenFunction &CGF, llvm::Value *Ptr, CharUnits Align)
bool isAggregateTypeForABI(QualType T)
const Type * isSingleElementStruct(QualType T, ASTContext &Context)
isSingleElementStruct - Determine if a structure is a "singleelement struct", i.e.
void AssignToArrayRange(CodeGen::CGBuilderTy &Builder, llvm::Value *Array, llvm::Value *Value, unsigned FirstIndex, unsigned LastIndex)
QualType useFirstFieldIfTransparentUnion(QualType Ty)
Pass transparent unions as if they were the type of the first element.
std::unique_ptr< TargetCodeGenInfo > createPPC32TargetCodeGenInfo(CodeGenModule &CGM, bool SoftFloatABI)
Definition PPC.cpp:1044
std::unique_ptr< TargetCodeGenInfo > createPPC64TargetCodeGenInfo(CodeGenModule &CGM)
Definition PPC.cpp:1052
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
@ Result
The result type of a method or function.
const FunctionProtoType * T
@ Type
The name was classified as a type.
U cast(CodeGen::Address addr)
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
CharUnits getPointerSize() const
llvm::PointerType * DefaultPtrTy