diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-06-04 11:58:51 +0000 |
commit | 4b6eb0e63c698094db5506763df44cc83c19f643 (patch) | |
tree | f1d30b8c10bc6db323b91538745ae8ab8b593910 /contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 76886853f03395abb680824bcc74e98f83bd477a (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index de096f95afcb..1d3bb286c882 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1495,7 +1495,7 @@ void TargetLoweringObjectFileMachO::getNameWithPrefix( SmallVectorImpl<char> &OutName, const GlobalValue *GV, const TargetMachine &TM) const { bool CannotUsePrivateLabel = true; - if (auto *GO = GV->getBaseObject()) { + if (auto *GO = GV->getAliaseeObject()) { SectionKind GOKind = TargetLoweringObjectFile::getKindForGlobal(GO, TM); const MCSection *TheSection = SectionForGlobal(GO, GOKind, TM); CannotUsePrivateLabel = @@ -1566,7 +1566,7 @@ static int getSelectionForCOFF(const GlobalValue *GV) { if (const Comdat *C = GV->getComdat()) { const GlobalValue *ComdatKey = getComdatGVForCOFF(GV); if (const auto *GA = dyn_cast<GlobalAlias>(ComdatKey)) - ComdatKey = GA->getBaseObject(); + ComdatKey = GA->getAliaseeObject(); if (ComdatKey == GV) { switch (C->getSelectionKind()) { case Comdat::Any: @@ -1945,7 +1945,7 @@ static std::string APIntToHexString(const APInt &AI) { static std::string scalarConstantToHexString(const Constant *C) { Type *Ty = C->getType(); if (isa<UndefValue>(C)) { - return APIntToHexString(APInt::getNullValue(Ty->getPrimitiveSizeInBits())); + return APIntToHexString(APInt::getZero(Ty->getPrimitiveSizeInBits())); } else if (const auto *CFP = dyn_cast<ConstantFP>(C)) { return APIntToHexString(CFP->getValueAPF().bitcastToAPInt()); } else if (const auto *CI = dyn_cast<ConstantInt>(C)) { @@ -2417,7 +2417,20 @@ bool TargetLoweringObjectFileXCOFF::shouldPutJumpTableInFunctionSection( MCSection *TargetLoweringObjectFileXCOFF::getSectionForConstant( const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const { - //TODO: Enable emiting constant pool to unique sections when we support it. + // TODO: Enable emiting constant pool to unique sections when we support it. + if (Alignment > Align(16)) + report_fatal_error("Alignments greater than 16 not yet supported."); + + if (Alignment == Align(8)) { + assert(ReadOnly8Section && "Section should always be initialized."); + return ReadOnly8Section; + } + + if (Alignment == Align(16)) { + assert(ReadOnly16Section && "Section should always be initialized."); + return ReadOnly16Section; + } + return ReadOnlySection; } @@ -2446,7 +2459,8 @@ MCSection *TargetLoweringObjectFileXCOFF::getStaticDtorSection( const MCExpr *TargetLoweringObjectFileXCOFF::lowerRelativeReference( const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const { - report_fatal_error("XCOFF not yet implemented."); + /* Not implemented yet, but don't crash, return nullptr. */ + return nullptr; } XCOFF::StorageClass @@ -2476,12 +2490,12 @@ TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(const GlobalValue *GV) { MCSymbol *TargetLoweringObjectFileXCOFF::getFunctionEntryPointSymbol( const GlobalValue *Func, const TargetMachine &TM) const { - assert( - (isa<Function>(Func) || - (isa<GlobalAlias>(Func) && - isa_and_nonnull<Function>(cast<GlobalAlias>(Func)->getBaseObject()))) && - "Func must be a function or an alias which has a function as base " - "object."); + assert((isa<Function>(Func) || + (isa<GlobalAlias>(Func) && + isa_and_nonnull<Function>( + cast<GlobalAlias>(Func)->getAliaseeObject()))) && + "Func must be a function or an alias which has a function as base " + "object."); SmallString<128> NameStr; NameStr.push_back('.'); |