Hong Seok
2015-Jul-22 12:17 UTC
[LLVMdev] is it impossible to use the external llvm custom pass on windows?
Hello all, Still, is it impossible to use the external llvm custom pass on windows? I can build the 'mypass.dll' on windows using LLVM libraries. And, I use these 2 way to use my pass. clang.exe -Xclang -load -Xclang mypass.dll -c test.c opt.exe -load -Xclang mypass.dll -mypass test.bc -o optimized_test.bc But, Clang and opt didn't working well with my pass. This mean, my pass can dump the llvm::Module in compilation time. and my pass can dump that on Linux. but, my pass didn't print anything on Windows. Additionally, i already built the LLVM and Clang on Windows using CMake. To avoid confusing, i'm writing my source code. #include <iostream> using namespace std; #include <llvm/Pass.h> #include <llvm/IR/Module.h> using namespace llvm; class SampleIRModule : public llvm::ModulePass { public: static char ID; SampleIRModule() : llvm::ModulePass(ID) {} bool runOnModule(llvm::Module &M); }; bool SampleIRModule::runOnModule(llvm::Module &M) { M.dump(); return false; } char SampleIRModule::ID = 0; static RegisterPass<SampleIRModule> X("SampleIRModule", "SampleIRModule Pass"); And,here is my build command on windows. cl /EHsc -ID:\LLVM\llvm-3.4.2\build_nmake\output/include -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -wd4146 -wd4180 -wd4244 -wd4267 -wd4345 -wd4351 -wd4355 -wd4503 -wd4624 -wd4800 -wd4291 -w14062 -we4238 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -c testpass.cpp cl /D_USRDLL /D_WINDLL testpass.obj /link /DLL /OUT:testpass.dll D:\LLVM\llvm-3.4.2\build_nmake\output\lib\LLVMCore.lib ... (including other LLVM libraries) Thanks, Seok Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150722/de43acd2/attachment.html>
mats petersson
2015-Jul-22 13:10 UTC
[LLVMdev] is it impossible to use the external llvm custom pass on windows?
It would probably help if you explained what happens and how that is different from what you expect... -- Mats On 22 July 2015 at 13:17, Hong Seok <seok85.hong at gmail.com> wrote:> Hello all, > > Still, is it impossible to use the external llvm custom pass on windows? > > I can build the 'mypass.dll' on windows using LLVM libraries. And, I use > these 2 way to use my pass. > clang.exe -Xclang -load -Xclang mypass.dll -c test.c > opt.exe -load -Xclang mypass.dll -mypass test.bc -o optimized_test.bc > > > But, Clang and opt didn't working well with my pass. > > > This mean, my pass can dump the llvm::Module in compilation time. and my > pass can dump that on Linux. but, my pass didn't print anything on Windows. > > Additionally, i already built the LLVM and Clang on Windows using CMake. > > To avoid confusing, i'm writing my source code. > > #include <iostream> > using namespace std; > > #include <llvm/Pass.h> > #include <llvm/IR/Module.h> > using namespace llvm; > > class SampleIRModule : public llvm::ModulePass { > public: > static char ID; > SampleIRModule() : llvm::ModulePass(ID) {} > > bool runOnModule(llvm::Module &M); > }; > > bool SampleIRModule::runOnModule(llvm::Module &M) { > M.dump(); > return false; > } > > char SampleIRModule::ID = 0; > static RegisterPass<SampleIRModule> X("SampleIRModule", "SampleIRModule > Pass"); > > > And,here is my build command on windows. > cl /EHsc -ID:\LLVM\llvm-3.4.2\build_nmake\output/include > -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS > -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS > -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -wd4146 -wd4180 > -wd4244 -wd4267 -wd4345 -wd4351 -wd4355 -wd4503 -wd4624 -wd4800 -wd4291 > -w14062 -we4238 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS > -D__STDC_LIMIT_MACROS -c testpass.cpp > > cl /D_USRDLL /D_WINDLL testpass.obj /link /DLL /OUT:testpass.dll > D:\LLVM\llvm-3.4.2\build_nmake\output\lib\LLVMCore.lib ... (including other > LLVM libraries) > > Thanks, > Seok Hong > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150722/c32974d6/attachment.html>
Hong Seok
2015-Jul-22 13:35 UTC
[LLVMdev] is it impossible to use the external llvm custom pass on windows?
i want to use the external LLVM pass that built in out-of-source on windows. and, my sample pass just dump the llvm::Module during compiling some source code. i use this command. opt.exe -load -Xclang mypass.dll -mypass test.bc -o optimized_test.bc so, as my expect, my pass should dump the llvm::Module of 'test.bc', but, i couldn't see anything in my console. one the other hand, i can see the result of dump() on Linux with same source code (testpass.cpp) Thanks, Seok Hong 2015-07-22 22:10 GMT+09:00 mats petersson <mats at planetcatfish.com>:> It would probably help if you explained what happens and how that is > different from what you expect... > > -- > Mats > > On 22 July 2015 at 13:17, Hong Seok <seok85.hong at gmail.com> wrote: > >> Hello all, >> >> Still, is it impossible to use the external llvm custom pass on windows? >> >> I can build the 'mypass.dll' on windows using LLVM libraries. And, I use >> these 2 way to use my pass. >> clang.exe -Xclang -load -Xclang mypass.dll -c test.c >> opt.exe -load -Xclang mypass.dll -mypass test.bc -o optimized_test.bc >> >> >> But, Clang and opt didn't working well with my pass. >> >> >> This mean, my pass can dump the llvm::Module in compilation time. and my >> pass can dump that on Linux. but, my pass didn't print anything on Windows. >> >> Additionally, i already built the LLVM and Clang on Windows using CMake. >> >> To avoid confusing, i'm writing my source code. >> >> #include <iostream> >> using namespace std; >> >> #include <llvm/Pass.h> >> #include <llvm/IR/Module.h> >> using namespace llvm; >> >> class SampleIRModule : public llvm::ModulePass { >> public: >> static char ID; >> SampleIRModule() : llvm::ModulePass(ID) {} >> >> bool runOnModule(llvm::Module &M); >> }; >> >> bool SampleIRModule::runOnModule(llvm::Module &M) { >> M.dump(); >> return false; >> } >> >> char SampleIRModule::ID = 0; >> static RegisterPass<SampleIRModule> X("SampleIRModule", "SampleIRModule >> Pass"); >> >> >> And,here is my build command on windows. >> cl /EHsc -ID:\LLVM\llvm-3.4.2\build_nmake\output/include >> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS >> -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS >> -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -wd4146 -wd4180 >> -wd4244 -wd4267 -wd4345 -wd4351 -wd4355 -wd4503 -wd4624 -wd4800 -wd4291 >> -w14062 -we4238 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS >> -D__STDC_LIMIT_MACROS -c testpass.cpp >> >> cl /D_USRDLL /D_WINDLL testpass.obj /link /DLL /OUT:testpass.dll >> D:\LLVM\llvm-3.4.2\build_nmake\output\lib\LLVMCore.lib ... (including other >> LLVM libraries) >> >> Thanks, >> Seok Hong >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150722/20a3d58e/attachment.html>
Maybe Matching Threads
- [LLVMdev] is it impossible to use the external llvm custom pass on windows?
- custom LLVM Pass with options fails to load
- custom LLVM Pass with options fails to load
- [LLVMdev] Splitting basic block results in unknown instruction type assertion
- How to use Master Users.