diff options
author | Brad Smith <brad@comstyle.com> | 2025-07-15 13:22:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-15 13:22:33 -0400 |
commit | 0d2e11f3e834e0c1803a6e00da35525b0d476eb2 (patch) | |
tree | c78578470076e86b0bb0219077a6eb503eed50a8 /clang/lib/CodeGen | |
parent | 0967957d7a94e1b5c749c6e963bdca25f3c6d749 (diff) | |
download | llvm-0d2e11f3e834e0c1803a6e00da35525b0d476eb2.zip llvm-0d2e11f3e834e0c1803a6e00da35525b0d476eb2.tar.gz llvm-0d2e11f3e834e0c1803a6e00da35525b0d476eb2.tar.bz2 |
Remove Native Client support (#133661)
Remove the Native Client support now that it has finally reached end of life.
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CMakeLists.txt | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.h | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/Targets/PNaCl.cpp | 114 | ||||
-rw-r--r-- | clang/lib/CodeGen/Targets/X86.cpp | 3 |
5 files changed, 2 insertions, 123 deletions
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt index a05b31f..0f2a352 100644 --- a/clang/lib/CodeGen/CMakeLists.txt +++ b/clang/lib/CodeGen/CMakeLists.txt @@ -144,7 +144,6 @@ add_clang_library(clangCodeGen Targets/MSP430.cpp Targets/Mips.cpp Targets/NVPTX.cpp - Targets/PNaCl.cpp Targets/PPC.cpp Targets/RISCV.cpp Targets/SPIR.cpp diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 678be07..236cc3d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -118,9 +118,7 @@ createTargetCodeGenInfo(CodeGenModule &CGM) { return createM68kTargetCodeGenInfo(CGM); case llvm::Triple::mips: case llvm::Triple::mipsel: - if (Triple.getOS() == llvm::Triple::NaCl) - return createPNaClTargetCodeGenInfo(CGM); - else if (Triple.getOS() == llvm::Triple::Win32) + if (Triple.getOS() == llvm::Triple::Win32) return createWindowsMIPSTargetCodeGenInfo(CGM, /*IsOS32=*/true); return createMIPSTargetCodeGenInfo(CGM, /*IsOS32=*/true); diff --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h index b4057d3..d0edae1 100644 --- a/clang/lib/CodeGen/TargetInfo.h +++ b/clang/lib/CodeGen/TargetInfo.h @@ -545,9 +545,6 @@ createMSP430TargetCodeGenInfo(CodeGenModule &CGM); std::unique_ptr<TargetCodeGenInfo> createNVPTXTargetCodeGenInfo(CodeGenModule &CGM); -std::unique_ptr<TargetCodeGenInfo> -createPNaClTargetCodeGenInfo(CodeGenModule &CGM); - enum class PPC64_SVR4_ABIKind { ELFv1 = 0, ELFv2, diff --git a/clang/lib/CodeGen/Targets/PNaCl.cpp b/clang/lib/CodeGen/Targets/PNaCl.cpp deleted file mode 100644 index 3580107..0000000 --- a/clang/lib/CodeGen/Targets/PNaCl.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//===- PNaCl.cpp ----------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "ABIInfoImpl.h" -#include "TargetInfo.h" - -using namespace clang; -using namespace clang::CodeGen; - -//===----------------------------------------------------------------------===// -// le32/PNaCl bitcode ABI Implementation -// -// This is a simplified version of the x86_32 ABI. Arguments and return values -// are always passed on the stack. -//===----------------------------------------------------------------------===// - -class PNaClABIInfo : public ABIInfo { - public: - PNaClABIInfo(CodeGen::CodeGenTypes &CGT) : ABIInfo(CGT) {} - - ABIArgInfo classifyReturnType(QualType RetTy) const; - ABIArgInfo classifyArgumentType(QualType RetTy) const; - - void computeInfo(CGFunctionInfo &FI) const override; - RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, - AggValueSlot Slot) const override; -}; - -class PNaClTargetCodeGenInfo : public TargetCodeGenInfo { - public: - PNaClTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT) - : TargetCodeGenInfo(std::make_unique<PNaClABIInfo>(CGT)) {} -}; - -void PNaClABIInfo::computeInfo(CGFunctionInfo &FI) const { - if (!getCXXABI().classifyReturnType(FI)) - FI.getReturnInfo() = classifyReturnType(FI.getReturnType()); - - for (auto &I : FI.arguments()) - I.info = classifyArgumentType(I.type); -} - -RValue PNaClABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, - QualType Ty, AggValueSlot Slot) const { - // The PNaCL ABI is a bit odd, in that varargs don't use normal - // function classification. Structs get passed directly for varargs - // functions, through a rewriting transform in - // pnacl-llvm/lib/Transforms/NaCl/ExpandVarArgs.cpp, which allows - // this target to actually support a va_arg instructions with an - // aggregate type, unlike other targets. - return CGF.EmitLoadOfAnyValue( - CGF.MakeAddrLValue( - EmitVAArgInstr(CGF, VAListAddr, Ty, ABIArgInfo::getDirect()), Ty), - Slot); -} - -/// Classify argument of given type \p Ty. -ABIArgInfo PNaClABIInfo::classifyArgumentType(QualType Ty) const { - if (isAggregateTypeForABI(Ty)) { - if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) - return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(), - RAA == CGCXXABI::RAA_DirectInMemory); - return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace()); - } else if (const EnumType *EnumTy = Ty->getAs<EnumType>()) { - // Treat an enum type as its underlying type. - Ty = EnumTy->getDecl()->getIntegerType(); - } else if (Ty->isFloatingType()) { - // Floating-point types don't go inreg. - return ABIArgInfo::getDirect(); - } else if (const auto *EIT = Ty->getAs<BitIntType>()) { - // Treat bit-precise integers as integers if <= 64, otherwise pass - // indirectly. - if (EIT->getNumBits() > 64) - return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace()); - return ABIArgInfo::getDirect(); - } - - return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) - : ABIArgInfo::getDirect()); -} - -ABIArgInfo PNaClABIInfo::classifyReturnType(QualType RetTy) const { - if (RetTy->isVoidType()) - return ABIArgInfo::getIgnore(); - - // In the PNaCl ABI we always return records/structures on the stack. - if (isAggregateTypeForABI(RetTy)) - return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace()); - - // Treat bit-precise integers as integers if <= 64, otherwise pass indirectly. - if (const auto *EIT = RetTy->getAs<BitIntType>()) { - if (EIT->getNumBits() > 64) - return getNaturalAlignIndirect(RetTy, - getDataLayout().getAllocaAddrSpace()); - return ABIArgInfo::getDirect(); - } - - // Treat an enum type as its underlying type. - if (const EnumType *EnumTy = RetTy->getAs<EnumType>()) - RetTy = EnumTy->getDecl()->getIntegerType(); - - return (isPromotableIntegerTypeForABI(RetTy) ? ABIArgInfo::getExtend(RetTy) - : ABIArgInfo::getDirect()); -} - -std::unique_ptr<TargetCodeGenInfo> -CodeGen::createPNaClTargetCodeGenInfo(CodeGenModule &CGM) { - return std::make_unique<PNaClTargetCodeGenInfo>(CGM.getTypes()); -} diff --git a/clang/lib/CodeGen/Targets/X86.cpp b/clang/lib/CodeGen/Targets/X86.cpp index 0f59caa..0b712ac 100644 --- a/clang/lib/CodeGen/Targets/X86.cpp +++ b/clang/lib/CodeGen/Targets/X86.cpp @@ -2572,8 +2572,7 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi, if (HiStart != 8) { // There are usually two sorts of types the ABI generation code can produce // for the low part of a pair that aren't 8 bytes in size: half, float or - // i8/i16/i32. This can also include pointers when they are 32-bit (X32 and - // NaCl). + // i8/i16/i32. This can also include pointers when they are 32-bit (X32). // Promote these to a larger type. if (Lo->isHalfTy() || Lo->isFloatTy()) Lo = llvm::Type::getDoubleTy(Lo->getContext()); |