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;

111

112public:

114 : ABIInfo(CGT), Is64Bit(Is64Bit), PtrByteSize(Is64Bit ? 8 : 4) {}

115

116 bool isPromotableTypeForABI(QualType Ty) const;

117

120

124

127 }

128

131};

132

134 const bool Is64Bit;

135

136public:

139 Is64Bit(Is64Bit) {}

141 return 1;

142 }

143

145 llvm::Value *Address) const override;

146

149};

150}

151

152

153

154bool AIXABIInfo::isPromotableTypeForABI(QualType Ty) const {

155

157 Ty = EnumTy->getDecl()->getIntegerType();

158

159

160 if (getContext().isPromotableIntegerType(Ty))

161 return true;

162

163 if (!Is64Bit)

164 return false;

165

166

167

168

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

184

187

190

192 return getNaturalAlignIndirect(RetTy);

193

196}

197

200

203

206

208

209

212

213 CharUnits CCAlign = getParamTypeAlignment(Ty);

214 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);

215

217 TyAlign > CCAlign);

218 }

219

220 return (isPromotableTypeForABI(Ty)

223}

224

226

228 Ty = CTy->getElementType();

229

232

233

236

238}

239

242

243 auto TypeInfo = getContext().getTypeInfoInChars(Ty);

245

247

248

249

250

251

252

253

254

257 if (EltSize < SlotSize)

259 }

260

262 SlotSize, true, Slot);

263}

264

265bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(

268}

269

270void AIXTargetCodeGenInfo::setTargetAttributes(

272 if (!isallvm::GlobalVariable(GV))

273 return;

274

275 auto *GVar = castllvm::GlobalVariable(GV);

276 auto GVId = GV->getName();

277

278

279 bool UserSpecifiedTOC =

281

282

283 if (UserSpecifiedTOC ||

286 const unsigned long PointerSize =

287 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;

288 auto *VarD = dyn_cast(D);

289 assert(VarD && "Invalid declaration of global variable.");

290

293 const auto *Ty = VarD->getType().getTypePtr();

296

297 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();

298 auto reportUnsupportedWarning = [&](bool ShouldEmitWarning, StringRef Msg) {

299 if (ShouldEmitWarning)

301 << GVId << Msg;

302 };

304 reportUnsupportedWarning(EmitDiagnostic, "of incomplete type");

306 reportUnsupportedWarning(EmitDiagnostic,

307 "it contains a flexible array member");

309 reportUnsupportedWarning(EmitDiagnostic, "of thread local storage");

310 else if (PointerSize < Context.getTypeInfo(VarD->getType()).Width / 8)

311 reportUnsupportedWarning(EmitDiagnostic,

312 "variable is larger than a pointer");

313 else if (PointerSize < Alignment)

314 reportUnsupportedWarning(EmitDiagnostic,

315 "variable is aligned wider than a pointer");

316 else if (D->hasAttr())

317 reportUnsupportedWarning(EmitDiagnostic,

318 "variable has a section attribute");

319 else if (GV->hasExternalLinkage() ||

320 (M.getCodeGenOpts().AllTocData && !GV->hasLocalLinkage()))

321 GVar->addAttribute("toc-data");

322 }

323}

324

325

326namespace {

327

329 bool IsSoftFloatABI;

330 bool IsRetSmallStructInRegABI;

331

333

334public:

336 bool RetSmallStructInRegABI)

338 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}

339

341

347 }

348

351};

352

354public:

355 PPC32TargetCodeGenInfo(CodeGenTypes &CGT, bool SoftFloatABI,

356 bool RetSmallStructInRegABI)

358 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}

359

360 static bool isStructReturnInRegABI(const llvm::Triple &Triple,

362

364

365 return 1;

366 }

367

369 llvm::Value *Address) const override;

370};

371}

372

373CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const {

374

376 Ty = CTy->getElementType();

377

380 : 4);

381

382

383

384 const Type *AlignTy = nullptr;

387 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||

389 AlignTy = EltType;

390 }

391

392 if (AlignTy)

395}

396

397ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const {

399

400

402 (Size = getContext().getTypeSize(RetTy)) <= 64) {

403

404

405

406

407

408

409

410

411

412

413

414 if (Size == 0)

416 else {

417 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);

419 }

420 }

421

423}

424

425

426

429 if (getTarget().getTriple().isOSDarwin()) {

430 auto TI = getContext().getTypeInfoInChars(Ty);

431 TI.Align = getParamTypeAlignment(Ty);

432

436 true, Slot);

437 }

438

439 const unsigned OverflowLimit = 8;

441

442 (void)CTy;

444 }

445

446

447

448

449

450

451

452

453

454 bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64;

456 bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64;

457

458

459

461

463

464

466 if (isInt || IsSoftFloatABI) {

467 NumRegsAddr = Builder.CreateStructGEP(VAList, 0, "gpr");

468 } else {

469 NumRegsAddr = Builder.CreateStructGEP(VAList, 1, "fpr");

470 }

471

472 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr, "numUsedRegs");

473

474

475 if (isI64 || (isF64 && IsSoftFloatABI)) {

476 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));

477 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((uint8_t) ~1U));

478 }

479

480 llvm::Value *CC =

481 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit), "cond");

482

483 llvm::BasicBlock *UsingRegs = CGF.createBasicBlock("using_regs");

484 llvm::BasicBlock *UsingOverflow = CGF.createBasicBlock("using_overflow");

486

487 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);

488

489 llvm::Type *DirectTy = CGF.ConvertType(Ty), *ElementTy = DirectTy;

490 if (isIndirect)

492

493

495 {

497

498 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);

499 RegAddr = Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.Int8Ty,

502

503

504 if (!(isInt || IsSoftFloatABI)) {

505 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,

507 }

508

509

510

512 llvm::Value *RegOffset =

513 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.getQuantity()));

514 RegAddr = Address(Builder.CreateInBoundsGEP(

516 DirectTy,

518

519

520 NumRegs =

521 Builder.CreateAdd(NumRegs,

522 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));

523 Builder.CreateStore(NumRegs, NumRegsAddr);

524

526 }

527

528

530 {

532

533 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);

534

535

537

539 if (!isIndirect) {

542 } else {

544 }

545

546 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);

548 Address(Builder.CreateLoad(OverflowAreaAddr, "argp.cur"), CGF.Int8Ty,

549 OverflowAreaAlign);

550

552 if (Align > OverflowAreaAlign) {

556 }

557

559

560

561 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);

562 Builder.CreateStore(OverflowArea.emitRawPointer(CGF), OverflowAreaAddr);

564 }

565

567

568

569 Address Result = emitMergePHI(CGF, RegAddr, UsingRegs, MemAddr, UsingOverflow,

570 "vaarg.addr");

571

572

573 if (isIndirect) {

574 Result = Address(Builder.CreateLoad(Result, "aggr"), ElementTy,

575 getContext().getTypeAlignInChars(Ty));

576 }

577

579}

580

581bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(

582 const llvm::Triple &Triple, const CodeGenOptions &Opts) {

583 assert(Triple.isPPC32());

584

585 switch (Opts.getStructReturnConvention()) {

587 break;

589 return false;

591 return true;

592 }

593

594 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())

595 return true;

596

597 return false;

598}

599

600bool

602 llvm::Value *Address) const {

604 false);

605}

606

607

608

609namespace {

610

611

612class PPC64_SVR4_ABIInfo : public ABIInfo {

613 static const unsigned GPRBits = 64;

615 bool IsSoftFloatABI;

616

617public:

619 bool SoftFloatABI)

620 : ABIInfo(CGT), Kind(Kind), IsSoftFloatABI(SoftFloatABI) {}

621

622 bool isPromotableTypeForABI(QualType Ty) const;

624

627

630 uint64_t Members) const override;

631

632

633

634

635

636

637

642

643

644

646 if (T) {

648 if ((T->isVectorType() && getContext().getTypeSize(T) == 128) ||

652 continue;

653 }

654 }

656 }

657 }

658

661};

662

664

665public:

667 bool SoftFloatABI)

669 std::make_unique<PPC64_SVR4_ABIInfo>(CGT, Kind, SoftFloatABI)) {

670 SwiftInfo =

671 std::make_unique(CGT, false);

672 }

673

675

676 return 1;

677 }

678

680 llvm::Value *Address) const override;

682 const llvm::MapVector<GlobalDecl, StringRef>

683 &MangledDeclNames) const override;

684};

685

687public:

690

692

693 return 1;

694 }

695

697 llvm::Value *Address) const override;

698};

699}

700

701

702

703bool

704PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty) const {

705

707 Ty = EnumTy->getDecl()->getIntegerType();

708

709

710 if (isPromotableIntegerTypeForABI(Ty))

711 return true;

712

713

714

717 case BuiltinType::Int:

718 case BuiltinType::UInt:

719 return true;

720 default:

721 break;

722 }

723

725 if (EIT->getNumBits() < 64)

726 return true;

727

728 return false;

729}

730

731

732

733CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const {

734

736 Ty = CTy->getElementType();

737

738 auto FloatUsesVector = [this](QualType Ty){

739 return Ty->isRealFloatingType() && &getContext().getFloatTypeSemantics(

740 Ty) == &llvm::APFloat::IEEEquad();

741 };

742

743

744

747 } else if (FloatUsesVector(Ty)) {

748

749

750

752 }

753

754

755

756 const Type *AlignAsType = nullptr;

758 if (EltType) {

760 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||

762 AlignAsType = EltType;

763 }

764

765

768 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&

770 AlignAsType = Base;

771

772

773 if (AlignAsType) {

774 bool UsesVector = AlignAsType->isVectorType() ||

775 FloatUsesVector(QualType(AlignAsType, 0));

777 }

778

779

780

783 }

784

786}

787

788bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {

789

790

792 if (BT->getKind() == BuiltinType::Float ||

793 BT->getKind() == BuiltinType::Double ||

794 BT->getKind() == BuiltinType::LongDouble ||

795 BT->getKind() == BuiltinType::Ibm128 ||

796 (getContext().getTargetInfo().hasFloat128Type() &&

797 (BT->getKind() == BuiltinType::Float128))) {

798 if (IsSoftFloatABI)

799 return false;

800 return true;

801 }

802 }

804 if (getContext().getTypeSize(VT) == 128)

805 return true;

806 }

807 return false;

808}

809

810bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(

811 const Type *Base, uint64_t Members) const {

812

813

815 ((getContext().getTargetInfo().hasFloat128Type() &&

816 Base->isFloat128Type()) ||

817 Base->isVectorType()) ? 1

818 : (getContext().getTypeSize(Base) + 63) / 64;

819

820

821 return Members * NumRegs <= 8;

822}

823

825PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty) const {

827

830

831

832

834 uint64_t Size = getContext().getTypeSize(Ty);

835 if (Size > 128)

836 return getNaturalAlignIndirect(Ty, false);

837 else if (Size < 128) {

838 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);

840 }

841 }

842

844 if (EIT->getNumBits() > 128)

845 return getNaturalAlignIndirect(Ty, true);

846

850

851 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();

853

854

857 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&

858 isHomogeneousAggregate(Ty, Base, Members)) {

859 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));

860 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);

862 }

863

864

865

866

867

868 uint64_t Bits = getContext().getTypeSize(Ty);

869 if (Bits > 0 && Bits <= 8 * GPRBits) {

870 llvm::Type *CoerceTy;

871

872

873

874 if (Bits <= GPRBits)

875 CoerceTy =

876 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));

877

878

879 else {

880 uint64_t RegBits = ABIAlign * 8;

881 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;

882 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);

883 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);

884 }

885

887 }

888

889

891 true,

892 TyAlign > ABIAlign);

893 }

894

895 return (isPromotableTypeForABI(Ty)

898}

899

901PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const {

904

907

908

909

911 uint64_t Size = getContext().getTypeSize(RetTy);

912 if (Size > 128)

913 return getNaturalAlignIndirect(RetTy);

914 else if (Size < 128) {

915 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);

917 }

918 }

919

921 if (EIT->getNumBits() > 128)

922 return getNaturalAlignIndirect(RetTy, false);

923

925

928 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&

929 isHomogeneousAggregate(RetTy, Base, Members)) {

930 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));

931 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);

933 }

934

935

936 uint64_t Bits = getContext().getTypeSize(RetTy);

937 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {

938 if (Bits == 0)

940

941 llvm::Type *CoerceTy;

942 if (Bits > GPRBits) {

943 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);

944 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);

945 } else

946 CoerceTy =

947 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));

949 }

950

951

952 return getNaturalAlignIndirect(RetTy);

953 }

954

957}

958

959

962 auto TypeInfo = getContext().getTypeInfoInChars(Ty);

964

966

967

968

969

970

971

972

975 if (EltSize < SlotSize)

977 }

978

979

980

981

982

983

984

985

986

987

988

989

990

991

993 SlotSize, true, Slot,

994 true);

995}

996

997bool

998PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(

1000 llvm::Value *Address) const {

1002 false);

1003}

1004

1005void PPC64_SVR4_TargetCodeGenInfo::emitTargetMetadata(

1007 const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames) const {

1011 if (flt == &llvm::APFloat::PPCDoubleDouble())

1012 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi",

1013 llvm::MDString::get(Ctx, "doubledouble"));

1014 else if (flt == &llvm::APFloat::IEEEquad())

1015 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi",

1016 llvm::MDString::get(Ctx, "ieeequad"));

1017 else if (flt == &llvm::APFloat::IEEEdouble())

1018 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi",

1019 llvm::MDString::get(Ctx, "ieeedouble"));

1020 }

1021}

1022

1023bool

1025 llvm::Value *Address) const {

1027 false);

1028}

1029

1030std::unique_ptr

1032 return std::make_unique(CGM.getTypes(), Is64Bit);

1033}

1034

1035std::unique_ptr

1037 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(

1039 return std::make_unique(CGM.getTypes(), SoftFloatABI,

1040 RetSmallStructInRegABI);

1041}

1042

1043std::unique_ptr

1045 return std::make_unique(CGM.getTypes());

1046}

1047

1050 return std::make_unique<PPC64_SVR4_TargetCodeGenInfo>(CGM.getTypes(), Kind,

1051 SoftFloatABI);

1052}

static RValue complexTempStructure(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, CharUnits SlotSize, CharUnits EltSize, const ComplexType *CTy)

static bool PPC_initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address, bool Is64Bit, bool IsAIX)

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

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.

A fixed int type of a specified bitwidth.

This class is used for builtin types like 'int'.

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.

CodeGenOptions - Track various options which control how the code is optimized and passed to the back...

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.

ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to ...

static ABIArgInfo getIgnore()

static ABIArgInfo getIndirect(CharUnits Alignment, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)

static ABIArgInfo getDirect(llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)

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.

CodeGen::CGCXXABI & getCXXABI() const

virtual bool isHomogeneousAggregateBaseType(QualType Ty) const

virtual bool isHomogeneousAggregateSmallEnough(const Type *Base, uint64_t Members) const

virtual RValue EmitVAArg(CodeGen::CodeGenFunction &CGF, CodeGen::Address VAListAddr, QualType Ty, AggValueSlot Slot) const =0

EmitVAArg - Emit the target dependent code to load a value of.

virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const =0

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.

CGFunctionInfo - Class to encapsulate the information about a function definition.

ABIArgInfo & getReturnInfo()

CanQualType getReturnType() const

MutableArrayRef< ArgInfo > arguments()

CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...

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.

llvm::Type * ConvertTypeForMem(QualType T)

void EmitBranch(llvm::BasicBlock *Block)

EmitBranch - Emit a branch to the specified basic block from the current insert block,...

ASTContext & getContext() const

llvm::Type * ConvertType(QualType T)

LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)

RValue EmitLoadOfAnyValue(LValue V, AggValueSlot Slot=AggValueSlot::ignored(), SourceLocation Loc={})

Like EmitLoadOfLValue but also handles complex and aggregate types.

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()

This class organizes the cross-module state that is used while lowering AST types to LLVM types.

bool isLongDoubleReferenced() const

DefaultABIInfo - The default implementation for ABI specific details.

ABIArgInfo classifyArgumentType(QualType RetTy) const

RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, AggValueSlot Slot) const override

EmitVAArg - Emit the target dependent code to load a value of.

ABIArgInfo classifyReturnType(QualType RetTy) const

void computeInfo(CGFunctionInfo &FI) const override

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,...

virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const

Initializes the given DWARF EH register-size table, a char*.

virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const

setTargetAttributes - Provides a convenient hook to handle extra target-specific attributes for the g...

virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const

Determines the DWARF register number for the stack pointer, for exception-handling purposes.

virtual void emitTargetMetadata(CodeGen::CodeGenModule &CGM, const llvm::MapVector< GlobalDecl, StringRef > &MangledDeclNames) const

emitTargetMetadata - Provides a convenient hook to handle extra target-specific metadata for the give...

Complex values, per C99 6.2.5p11.

QualType getElementType() const

Decl - This represents one declaration (or definition), e.g.

ASTContext & getASTContext() const LLVM_READONLY

SourceLocation getLocation() const

DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)

Issue the message to the client.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.

A (possibly-)qualified type.

Represents a struct/union/class.

bool hasFlexibleArrayMember() const

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

const llvm::fltSemantics & getLongDoubleFormat() const

The base class of the type hierarchy.

bool isIntegerType() const

isIntegerType() does not include complex integers (a GCC extension).

bool isAnyComplexType() const

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'.

bool isRecordType() const

@ TLS_None

Not a TLS variable.

Represents a GCC generic vector type.

ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)

Classify the rules for how to pass a particular type.

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)

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)

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 "single element 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)

std::unique_ptr< TargetCodeGenInfo > createPPC64TargetCodeGenInfo(CodeGenModule &CGM)

The JSON file list parser is used to communicate input to InstallAPI.

const FunctionProtoType * T

llvm::IntegerType * Int8Ty

i8, i16, i32, and i64

CharUnits getPointerSize() const

llvm::PointerType * UnqualPtrTy