@@ -7,7 +7,7 @@ SPDX-License-Identifier: MIT
77============================= end_copyright_notice ===========================*/
88
99//
10- // / GenXImportBiF
10+ // / GenXImportOCLBiF
1111// / -----------
1212// /
1313// / This pass import Builtin Function library compiled into bitcode
@@ -20,7 +20,7 @@ SPDX-License-Identifier: MIT
2020
2121#define DEBUG_TYPE " cmimportbif"
2222
23- #include " GenX .h"
23+ #include " vc/GenXOpts/GenXOpts .h"
2424#include " vc/Support/BackendConfig.h"
2525#include " vc/Utils/General/BiF.h"
2626
@@ -48,8 +48,8 @@ SPDX-License-Identifier: MIT
4848#include < unordered_set>
4949#include < vector>
5050
51- #include " llvm/GenXIntrinsics/GenXIntrinsicInst.h"
5251#include " Probe/Assertion.h"
52+ #include " llvm/GenXIntrinsics/GenXIntrinsicInst.h"
5353
5454using namespace llvm ;
5555
@@ -181,8 +181,7 @@ void BIConvert::runOnModule(Module &M) {
181181 if (id == Intrinsic::lifetime_start || id == Intrinsic::lifetime_end) {
182182 ListDelete.push_back (InstCall);
183183 continue ;
184- }
185- else if (id == Intrinsic::ctlz) {
184+ } else if (id == Intrinsic::ctlz) {
186185 // convert this to genx_ldz, but genx_lzd only support 32-bit input
187186 auto Src = InstCall->getOperand (0 );
188187 auto SrcTy = Src->getType ();
@@ -194,9 +193,10 @@ void BIConvert::runOnModule(Module &M) {
194193 tys[0 ] = SrcTy;
195194 // build argument list for the 1st intrinsic
196195 args.push_back (Src);
197- Function *IntrinFunc = GenXIntrinsic::getAnyDeclaration (&M, GenXIntrinsic::genx_lzd, tys);
198- Instruction *IntrinCall = CallInst::Create (
199- IntrinFunc, args, InstCall->getName (), InstCall);
196+ Function *IntrinFunc = GenXIntrinsic::getAnyDeclaration (
197+ &M, GenXIntrinsic::genx_lzd, tys);
198+ Instruction *IntrinCall =
199+ CallInst::Create (IntrinFunc, args, InstCall->getName (), InstCall);
200200 IntrinCall->setDebugLoc (InstCall->getDebugLoc ());
201201 InstCall->replaceAllUsesWith (IntrinCall);
202202 ListDelete.push_back (InstCall);
@@ -290,8 +290,8 @@ void BIConvert::runOnModule(Module &M) {
290290 tys[0 ] = InstCall->getArgOperand (0 )->getType ();
291291 // build argument list for the 1st intrinsic
292292 args.push_back (Mul);
293- Function *IntrinFunc =
294- GenXIntrinsic::getAnyDeclaration ( &M, GenXIntrinsic::genx_rndz, tys);
293+ Function *IntrinFunc = GenXIntrinsic::getAnyDeclaration (
294+ &M, GenXIntrinsic::genx_rndz, tys);
295295 Instruction *IntrinCall =
296296 CallInst::Create (IntrinFunc, args, InstCall->getName (), InstCall);
297297 IntrinCall->setDebugLoc (InstCall->getDebugLoc ());
@@ -308,8 +308,8 @@ void BIConvert::runOnModule(Module &M) {
308308 tys[0 ] = InstCall->getArgOperand (0 )->getType ();
309309 // build argument list for the 1st intrinsic
310310 args.push_back (Add);
311- Function *IntrinFunc =
312- GenXIntrinsic::getAnyDeclaration ( &M, GenXIntrinsic::genx_rndz, tys);
311+ Function *IntrinFunc = GenXIntrinsic::getAnyDeclaration (
312+ &M, GenXIntrinsic::genx_rndz, tys);
313313 Instruction *IntrinCall =
314314 CallInst::Create (IntrinFunc, args, InstCall->getName (), InstCall);
315315 IntrinCall->setDebugLoc (InstCall->getDebugLoc ());
@@ -366,8 +366,8 @@ static void removeFunctionBitcasts(llvm::Module &M) {
366366 CallInst *pInstCall = dyn_cast<CallInst>(I);
367367 if (!pInstCall || pInstCall->getCalledFunction ())
368368 continue ;
369- if (auto constExpr =
370- dyn_cast<llvm::ConstantExpr>( IGCLLVM::getCalledValue (pInstCall))) {
369+ if (auto constExpr = dyn_cast<llvm::ConstantExpr>(
370+ IGCLLVM::getCalledValue (pInstCall))) {
371371 if (auto funcTobeChanged =
372372 dyn_cast<llvm::Function>(constExpr->stripPointerCasts ())) {
373373 if (funcTobeChanged->isDeclaration ())
@@ -660,37 +660,33 @@ void BiFImporter::run() {
660660 }
661661}
662662
663- class GenXImportBiF final : public ModulePass {
663+ class GenXImportOCLBiF final : public ModulePass {
664664
665665public:
666666 static char ID;
667- GenXImportBiF () : ModulePass(ID) {}
668- StringRef getPassName () const override { return " GenX import BiF" ; }
667+ GenXImportOCLBiF () : ModulePass(ID) {}
668+ StringRef getPassName () const override { return " GenX import OCL BiF" ; }
669669 void getAnalysisUsage (AnalysisUsage &AU) const override ;
670670 bool runOnModule (Module &M) override ;
671671
672672private:
673- std::unique_ptr<Module> getBiFModule (BiFKind Kind,
674- LLVMContext &Ctx);
673+ std::unique_ptr<Module> getBiFModule (BiFKind Kind, LLVMContext &Ctx);
675674};
676675
677- char GenXImportBiF::ID = 0 ;
678- namespace llvm {
679- void initializeGenXImportBiFPass (PassRegistry &);
680- }
676+ char GenXImportOCLBiF::ID = 0 ;
681677
682- INITIALIZE_PASS_BEGIN (GenXImportBiF , " GenXImportBiF " , " GenXImportBiF " , false ,
683- false )
678+ INITIALIZE_PASS_BEGIN (GenXImportOCLBiF , " GenXImportOCLBiF " , " GenXImportOCLBiF " ,
679+ false , false )
684680INITIALIZE_PASS_DEPENDENCY(GenXBackendConfig)
685- INITIALIZE_PASS_END(GenXImportBiF , " GenXImportBiF " , " GenXImportBiF " , false ,
686- false )
681+ INITIALIZE_PASS_END(GenXImportOCLBiF , " GenXImportOCLBiF " , " GenXImportOCLBiF " ,
682+ false , false )
687683
688- ModulePass *llvm::createGenXImportBiFPass () {
689- initializeGenXImportBiFPass (*PassRegistry::getPassRegistry ());
690- return new GenXImportBiF ;
684+ ModulePass *llvm::createGenXImportOCLBiFPass () {
685+ initializeGenXImportOCLBiFPass (*PassRegistry::getPassRegistry ());
686+ return new GenXImportOCLBiF ;
691687}
692688
693- void GenXImportBiF ::getAnalysisUsage (AnalysisUsage &AU) const {
689+ void GenXImportOCLBiF ::getAnalysisUsage (AnalysisUsage &AU) const {
694690 AU.addRequired <GenXBackendConfig>();
695691}
696692
@@ -742,7 +738,7 @@ static void translateSPIRVOCLBuiltins(Module &M) {
742738 llvm::for_each (Worklist, [](Function &F) { translateSPIRVOCLBuiltin (F); });
743739}
744740
745- bool GenXImportBiF ::runOnModule (Module &M) {
741+ bool GenXImportOCLBiF ::runOnModule (Module &M) {
746742 if (!OCLBuiltinsRequired (M))
747743 return false ;
748744
@@ -756,9 +752,8 @@ bool GenXImportBiF::runOnModule(Module &M) {
756752 return true ;
757753}
758754
759- std::unique_ptr<Module>
760- GenXImportBiF::getBiFModule (BiFKind Kind,
761- LLVMContext &Ctx) {
755+ std::unique_ptr<Module> GenXImportOCLBiF::getBiFModule (BiFKind Kind,
756+ LLVMContext &Ctx) {
762757 MemoryBufferRef BiFModuleBuffer =
763758 getAnalysis<GenXBackendConfig>().getBiFModule (Kind);
764759 return vc::getLazyBiFModuleOrReportError (BiFModuleBuffer, Ctx);
0 commit comments