diff options
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index c763463..302dc65 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -10169,24 +10169,26 @@ void XCoreTargetCodeGenInfo::emitTargetMetadata( } } } + //===----------------------------------------------------------------------===// -// SPIR ABI Implementation +// Base ABI and target codegen info implementation common between SPIR and +// SPIR-V. //===----------------------------------------------------------------------===// namespace { -class SPIRABIInfo : public DefaultABIInfo { +class CommonSPIRABIInfo : public DefaultABIInfo { public: - SPIRABIInfo(CodeGenTypes &CGT) : DefaultABIInfo(CGT) { setCCs(); } + CommonSPIRABIInfo(CodeGenTypes &CGT) : DefaultABIInfo(CGT) { setCCs(); } private: void setCCs(); }; } // end anonymous namespace namespace { -class SPIRTargetCodeGenInfo : public TargetCodeGenInfo { +class CommonSPIRTargetCodeGenInfo : public TargetCodeGenInfo { public: - SPIRTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT) - : TargetCodeGenInfo(std::make_unique<SPIRABIInfo>(CGT)) {} + CommonSPIRTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT) + : TargetCodeGenInfo(std::make_unique<CommonSPIRABIInfo>(CGT)) {} LangAS getASTAllocaAddressSpace() const override { return getLangASFromTargetAS( @@ -10197,7 +10199,7 @@ public: }; } // End anonymous namespace. -void SPIRABIInfo::setCCs() { +void CommonSPIRABIInfo::setCCs() { assert(getRuntimeCC() == llvm::CallingConv::C); RuntimeCC = llvm::CallingConv::SPIR_FUNC; } @@ -10211,7 +10213,7 @@ void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI) { } } -unsigned SPIRTargetCodeGenInfo::getOpenCLKernelCallingConv() const { +unsigned CommonSPIRTargetCodeGenInfo::getOpenCLKernelCallingConv() const { return llvm::CallingConv::SPIR_KERNEL; } @@ -11280,7 +11282,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { return SetCGInfo(new ARCTargetCodeGenInfo(Types)); case llvm::Triple::spir: case llvm::Triple::spir64: - return SetCGInfo(new SPIRTargetCodeGenInfo(Types)); + case llvm::Triple::spirv32: + case llvm::Triple::spirv64: + return SetCGInfo(new CommonSPIRTargetCodeGenInfo(Types)); case llvm::Triple::ve: return SetCGInfo(new VETargetCodeGenInfo(Types)); } |