7
7
8
8
#include " llvm-version.h"
9
9
#include " support/dtypes.h"
10
+ #include " passes.h"
10
11
11
12
#include < llvm-c/Core.h>
12
13
#include < llvm-c/Types.h>
@@ -34,13 +35,12 @@ typedef Instruction TerminatorInst;
34
35
35
36
namespace {
36
37
37
- struct LowerPTLS : public ModulePass {
38
- static char ID;
38
+ struct LowerPTLS {
39
39
LowerPTLS (bool imaging_mode=false )
40
- : ModulePass(ID),
41
- imaging_mode (imaging_mode)
40
+ : imaging_mode(imaging_mode)
42
41
{}
43
42
43
+ bool runOnModule (Module &M);
44
44
private:
45
45
const bool imaging_mode;
46
46
Module *M;
@@ -62,7 +62,6 @@ struct LowerPTLS: public ModulePass {
62
62
template <typename T> T *add_comdat (T *G) const ;
63
63
GlobalVariable *create_aliased_global (Type *T, StringRef name) const ;
64
64
void fix_pgcstack_use (CallInst *pgcstack);
65
- bool runOnModule (Module &M) override ;
66
65
};
67
66
68
67
void LowerPTLS::set_pgcstack_attrs (CallInst *pgcstack) const
@@ -291,17 +290,37 @@ bool LowerPTLS::runOnModule(Module &_M)
291
290
return true ;
292
291
}
293
292
294
- char LowerPTLS::ID = 0 ;
293
+ struct LowerPTLSLegacy : public ModulePass {
294
+ static char ID;
295
+ LowerPTLSLegacy (bool imaging_mode=false )
296
+ : ModulePass(ID),
297
+ imaging_mode (imaging_mode)
298
+ {}
295
299
296
- static RegisterPass<LowerPTLS> X (" LowerPTLS" , " LowerPTLS Pass" ,
300
+ bool imaging_mode;
301
+ bool runOnModule (Module &M) override {
302
+ LowerPTLS lower (imaging_mode);
303
+ return lower.runOnModule (M);
304
+ }
305
+ };
306
+
307
+ char LowerPTLSLegacy::ID = 0 ;
308
+
309
+ static RegisterPass<LowerPTLSLegacy> X (" LowerPTLS" , " LowerPTLS Pass" ,
297
310
false /* Only looks at CFG */ ,
298
311
false /* Analysis Pass */ );
299
312
300
313
} // anonymous namespace
301
314
315
+ PreservedAnalyses LowerPTLSPass::run (Module &M, ModuleAnalysisManager &AM) {
316
+ LowerPTLS lower (imaging_mode);
317
+ lower.runOnModule (M);
318
+ return PreservedAnalyses::all ();
319
+ }
320
+
302
321
Pass *createLowerPTLSPass (bool imaging_mode)
303
322
{
304
- return new LowerPTLS (imaging_mode);
323
+ return new LowerPTLSLegacy (imaging_mode);
305
324
}
306
325
307
326
extern " C" JL_DLLEXPORT void LLVMExtraAddLowerPTLSPass_impl (LLVMPassManagerRef PM, LLVMBool imaging_mode)
0 commit comments