@@ -7,7 +7,7 @@ SPDX-License-Identifier: MIT
7
7
============================= end_copyright_notice ===========================*/
8
8
9
9
//
10
- // / GenXImportBiF
10
+ // / GenXImportOCLBiF
11
11
// / -----------
12
12
// /
13
13
// / This pass import Builtin Function library compiled into bitcode
@@ -20,7 +20,7 @@ SPDX-License-Identifier: MIT
20
20
21
21
#define DEBUG_TYPE " cmimportbif"
22
22
23
- #include " GenX .h"
23
+ #include " vc/GenXOpts/GenXOpts .h"
24
24
#include " vc/Support/BackendConfig.h"
25
25
#include " vc/Utils/General/BiF.h"
26
26
@@ -48,8 +48,8 @@ SPDX-License-Identifier: MIT
48
48
#include < unordered_set>
49
49
#include < vector>
50
50
51
- #include " llvm/GenXIntrinsics/GenXIntrinsicInst.h"
52
51
#include " Probe/Assertion.h"
52
+ #include " llvm/GenXIntrinsics/GenXIntrinsicInst.h"
53
53
54
54
using namespace llvm ;
55
55
@@ -181,8 +181,7 @@ void BIConvert::runOnModule(Module &M) {
181
181
if (id == Intrinsic::lifetime_start || id == Intrinsic::lifetime_end) {
182
182
ListDelete.push_back (InstCall);
183
183
continue ;
184
- }
185
- else if (id == Intrinsic::ctlz) {
184
+ } else if (id == Intrinsic::ctlz) {
186
185
// convert this to genx_ldz, but genx_lzd only support 32-bit input
187
186
auto Src = InstCall->getOperand (0 );
188
187
auto SrcTy = Src->getType ();
@@ -194,9 +193,10 @@ void BIConvert::runOnModule(Module &M) {
194
193
tys[0 ] = SrcTy;
195
194
// build argument list for the 1st intrinsic
196
195
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);
200
200
IntrinCall->setDebugLoc (InstCall->getDebugLoc ());
201
201
InstCall->replaceAllUsesWith (IntrinCall);
202
202
ListDelete.push_back (InstCall);
@@ -290,8 +290,8 @@ void BIConvert::runOnModule(Module &M) {
290
290
tys[0 ] = InstCall->getArgOperand (0 )->getType ();
291
291
// build argument list for the 1st intrinsic
292
292
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);
295
295
Instruction *IntrinCall =
296
296
CallInst::Create (IntrinFunc, args, InstCall->getName (), InstCall);
297
297
IntrinCall->setDebugLoc (InstCall->getDebugLoc ());
@@ -308,8 +308,8 @@ void BIConvert::runOnModule(Module &M) {
308
308
tys[0 ] = InstCall->getArgOperand (0 )->getType ();
309
309
// build argument list for the 1st intrinsic
310
310
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);
313
313
Instruction *IntrinCall =
314
314
CallInst::Create (IntrinFunc, args, InstCall->getName (), InstCall);
315
315
IntrinCall->setDebugLoc (InstCall->getDebugLoc ());
@@ -366,8 +366,8 @@ static void removeFunctionBitcasts(llvm::Module &M) {
366
366
CallInst *pInstCall = dyn_cast<CallInst>(I);
367
367
if (!pInstCall || pInstCall->getCalledFunction ())
368
368
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))) {
371
371
if (auto funcTobeChanged =
372
372
dyn_cast<llvm::Function>(constExpr->stripPointerCasts ())) {
373
373
if (funcTobeChanged->isDeclaration ())
@@ -660,37 +660,33 @@ void BiFImporter::run() {
660
660
}
661
661
}
662
662
663
- class GenXImportBiF final : public ModulePass {
663
+ class GenXImportOCLBiF final : public ModulePass {
664
664
665
665
public:
666
666
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" ; }
669
669
void getAnalysisUsage (AnalysisUsage &AU) const override ;
670
670
bool runOnModule (Module &M) override ;
671
671
672
672
private:
673
- std::unique_ptr<Module> getBiFModule (BiFKind Kind,
674
- LLVMContext &Ctx);
673
+ std::unique_ptr<Module> getBiFModule (BiFKind Kind, LLVMContext &Ctx);
675
674
};
676
675
677
- char GenXImportBiF::ID = 0 ;
678
- namespace llvm {
679
- void initializeGenXImportBiFPass (PassRegistry &);
680
- }
676
+ char GenXImportOCLBiF::ID = 0 ;
681
677
682
- INITIALIZE_PASS_BEGIN (GenXImportBiF , " GenXImportBiF " , " GenXImportBiF " , false ,
683
- false )
678
+ INITIALIZE_PASS_BEGIN (GenXImportOCLBiF , " GenXImportOCLBiF " , " GenXImportOCLBiF " ,
679
+ false , false )
684
680
INITIALIZE_PASS_DEPENDENCY(GenXBackendConfig)
685
- INITIALIZE_PASS_END(GenXImportBiF , " GenXImportBiF " , " GenXImportBiF " , false ,
686
- false )
681
+ INITIALIZE_PASS_END(GenXImportOCLBiF , " GenXImportOCLBiF " , " GenXImportOCLBiF " ,
682
+ false , false )
687
683
688
- ModulePass *llvm::createGenXImportBiFPass () {
689
- initializeGenXImportBiFPass (*PassRegistry::getPassRegistry ());
690
- return new GenXImportBiF ;
684
+ ModulePass *llvm::createGenXImportOCLBiFPass () {
685
+ initializeGenXImportOCLBiFPass (*PassRegistry::getPassRegistry ());
686
+ return new GenXImportOCLBiF ;
691
687
}
692
688
693
- void GenXImportBiF ::getAnalysisUsage (AnalysisUsage &AU) const {
689
+ void GenXImportOCLBiF ::getAnalysisUsage (AnalysisUsage &AU) const {
694
690
AU.addRequired <GenXBackendConfig>();
695
691
}
696
692
@@ -742,7 +738,7 @@ static void translateSPIRVOCLBuiltins(Module &M) {
742
738
llvm::for_each (Worklist, [](Function &F) { translateSPIRVOCLBuiltin (F); });
743
739
}
744
740
745
- bool GenXImportBiF ::runOnModule (Module &M) {
741
+ bool GenXImportOCLBiF ::runOnModule (Module &M) {
746
742
if (!OCLBuiltinsRequired (M))
747
743
return false ;
748
744
@@ -756,9 +752,8 @@ bool GenXImportBiF::runOnModule(Module &M) {
756
752
return true ;
757
753
}
758
754
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) {
762
757
MemoryBufferRef BiFModuleBuffer =
763
758
getAnalysis<GenXBackendConfig>().getBiFModule (Kind);
764
759
return vc::getLazyBiFModuleOrReportError (BiFModuleBuffer, Ctx);
0 commit comments