search for: parseirfile

Displaying 20 results from an estimated 39 matches for "parseirfile".

2018 Jun 12
2
Proper method to initialize all LLVM Internal Data Structures?
Hi: I'm building a small tool on top of LLVM Core Library. ``` LLVMContext context; SMDiagnostic diag; Module *M = parseIRFile(InputIR, diag, context).get(); if (M == nullptr) { diag.print("LLVM", errs()); exit(-1); } assert(M->isMaterialized() && "Module not materialized!"); PointerType *ArrayPtrTy = M->getTypeByName("struct._Array")->getPointerTo(); ```...
2018 Feb 17
0
Proper way to load pre-generated LLVM IR into JIT module and dedup type definitions?
...39;t given new names and inlining and const propagation can still take place?   My attempt so far: I compile a set of C functions to LLVM IR offline via 'clang -c -emit-llvm -S -ffast-math -msse2 -O3 -o MyLib.ll MyLib.c' For each runtime JIT module, I load the generated LLVM IR via llvm::parseIRFile() and "paste" it into the runtime JIT module via llvm::Linker::linkModules(). This works fine for the first JIT module, but not for subsequent JIT modules created. Each time llvm::parseIRFile() is called, the resulting module's type definitions in the IR is given new names.   For ex...
2012 Oct 22
2
[LLVMdev] Reading IR from a std::ostream
Previously I had asked how to write then read back IR to/from a file. The write code looked like: LLVMContext ctx; SMDiagnostic diag; Module *m = ParseIRFile( "my_file", diag, ctx ); However, the code I'm trying to retrofit LLVM IR into passes me just a std::ostream&. How can I read IR from a std::ostream? I figured out how to use raw_os_ostream to adapt a std::ostream to a raw_ostream for writing a module, but there's no obviou...
2012 Oct 08
2
[LLVMdev] How can I find the LHS of the function call when traversing the function call
Hi All, I am a new member in the group, have been doing some experiments with LLVM IR. I am facing issue with de-compiling the following instruction once it is read, %var2 = call i8 @myfuncCall (i2 %var1) In after I parse the file (lets say using parseIRFiles ). I can see the instructions,( the function call instruction ), How can I get the %var2 from the instruction/callInstruction ? going thru the llvm installations cpp and .h files, it is not clear how do I get the desired variable. Thanks in Advance. regards Tarique -------------- next part ----...
2018 Dec 09
2
Parse LLVM IR
...dule.h> #include <llvm/IRReader/IRReader.h> #include <llvm/IR/LLVMContext.h> #include <llvm/Support/SourceMgr.h> #include <iostream> #include <llvm/Support/raw_ostream.h> using namespace llvm; int main() { LLVMContext context; SMDiagnostic error; Module *m = parseIRFile("t.ll", error, context).get(); if(!m) { return 0; } std::cout << error.getMessage().str() << std::endl; std::cout << sizeof(m->getFunctionList()) << std::endl; auto iter1 = m->getFunctionList().begin(); std::cout << " Function: &q...
2018 Feb 24
1
Parsing a bit code file
...uot; << "\n"; return 0;} dump.cpp #include <llvm/IR/Module.h>#include <llvm/IRReader/IRReader.h>#include <llvm/IR/LLVMContext.h>#include <llvm/Support/SourceMgr.h> using namespace llvm;int main(){ LLVMContext context; SMDiagnostic error; Module *m = parseIRFile("hello.bc", error, context).get(); if(m) { m->dump(); } return 0;} *$ clang++ -S -O3 -emit-llvm hello.cpp -c -o hello.bc* *$ clang++ -g -O3 dump.cpp `llvm-config --cxxflags --ldflags --system-libs --libs all`-o dump* *$ ./dump* But I am getting a segmentation fault as...
2019 May 17
3
Copy Function from one LLVM IR file to another
...I created a function pass in which I extract a function using "llvm-extract" from within the pass. *2.* Then I read the (.ll) file created by the "llvm-extract" tool using: SMDiagnostic Err; LLVMContext Context; std::unique_ptr<Module> ParsedMod(parseIRFile("add.ll", Err, Context)); Module &M = dynamic_cast<Module&>(*ParsedMod); Module* Mod_ptr = &M; *3.* Then I read the (.ll) file into which I want to copy the function using: std::unique_ptr<Module> ParsedMod2(parseIRFile("server.ll&quo...
2010 Aug 19
1
[LLVMdev] questions about context
Hi, I am trying to load another bytecode file in one pass. I checked the opt.cpp, it uses following to load a bytecode file: ... LLVMContext &Context = getGlobalContext(); ... SMDiagnostic Err; // Load the input module... std::auto_ptr<Module> M; M.reset(ParseIRFile(InputFilename, Err, Context)); ... My question is in the runOnModule method where I want to load another bytecode file, what context should I use? Is getGlobalContext() still OK? Thanks, Guoliang
2015 Jun 12
2
[LLVMdev] Register Allocation on IR
...-- Code emission Is it possible to emit IR from the 1st 3 stages and then do register allocation on it ? Normally, we would emit assembly based on the machine/ISA specifications during instruction selection. b. I have llvm IR in the form of a DAG already. This was obtained by using the llvm;;parseIRFile function. I am not sure how to provide this ISA as an input to the backend phases as they seem to accept all kinds of other objects. Are there any llvm functions that accept a DAG as input so that we can do register allocation on it subsequently ? Note : This might look like a weird thing to do,...
2013 Jul 29
2
[LLVMdev] opt -O3 causes Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed
...29 15 llc 0x00000000006c367b llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMContext&, std::string*) + 93 16 llc 0x0000000000679302 llvm::ParseIR(llvm::MemoryBuffer*, llvm::SMDiagnostic&, llvm::LLVMContext&) + 214 17 llc 0x000000000067958a llvm::ParseIRFile(std::string const&, llvm::SMDiagnostic&, llvm::LLVMContext&) + 374 18 llc 0x00000000006680f4 19 llc 0x0000000000668fed main + 199 20 libc.so.6 0x000000332fa1d994 __libc_start_main + 244 21 llc 0x0000000000666319 Stack dump: 0. Program arguments:...
2015 Mar 20
2
[LLVMdev] LLVM Exception Handling
...int, const char **) { llvm::InitializeNativeTarget(); llvm::InitializeNativeTargetAsmPrinter(); llvm::InitializeNativeTargetAsmParser(); llvm::LLVMContext &Context = llvm::getGlobalContext(); llvm::SMDiagnostic Err; std::unique_ptr<llvm::Module> Mod = llvm::parseIRFile("test.ll", Err, Context); std::string triple = llvm::sys::getProcessTriple(); Mod->setTargetTriple(triple); llvm::Function* f = Mod->getFunction("exec"); llvm::TargetOptions Opts; Opts.NoFramePointerElim = true; // Build engine with JIT...
2013 Feb 15
0
[LLVMdev] Alternative to Linker::LinkInFile()
Looking at /tools/llvm-link/llvm-link.cpp may give you some ideas here. I havent looked at your specific use case, but llvm-link uses ParseIRFile to pull in a bitcode file and build a Module for it. You can then create a Composite using the Module * and call Linker::LinkModules(Composite.get(), NewModuleToLink.get()... to link a new Module to your Composite Module. -Chris On Feb 14, 2013, at 8:20 PM, Tom Stellard wrote: > On Thu, Feb 1...
2016 Nov 20
3
uninitialized values in Attributes.cpp
...5C16: llvm::parseAssembly(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::SlotMapping*) (Parser.cpp:41) ==29299== by 0x158C59E: llvm::parseIR(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&) (IRReader.cpp:89) ==29299== by 0x158CA61: llvm::parseIRFile(llvm::StringRef, llvm::SMDiagnostic&, llvm::LLVMContext&) (IRReader.cpp:102) ==29299==
2013 Aug 02
2
[LLVMdev] opt -O3 causes Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed
...::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMContext&, >> std::string*) + 93 >> 16 llc 0x0000000000679302 >> llvm::ParseIR(llvm::MemoryBuffer*, llvm::SMDiagnostic&, >> llvm::LLVMContext&) + 214 >> 17 llc 0x000000000067958a llvm::ParseIRFile(std::string >> const&, llvm::SMDiagnostic&, llvm::LLVMContext&) + 374 >> 18 llc 0x00000000006680f4 >> 19 llc 0x0000000000668fed main + 199 >> 20 libc.so.6 0x000000332fa1d994 __libc_start_main + 244 >> 21 llc 0x00000...
2013 Feb 15
2
[LLVMdev] Alternative to Linker::LinkInFile()
On Thu, Feb 14, 2013 at 04:41:41PM -0800, Daniel Dunbar wrote: > Hi Tom, > > From the context I am assuming you are in a JIT context, so the comments > about using a platform specific LTO mechanism don't apply. > > Were you using this code to extract bitcode files from archives, or just to > link in an individual bitcode file? > Hi Daniel, I was using this code to
2013 Aug 02
0
[LLVMdev] opt -O3 causes Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed
...00006c367b > llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMContext&, > std::string*) + 93 > 16 llc 0x0000000000679302 > llvm::ParseIR(llvm::MemoryBuffer*, llvm::SMDiagnostic&, > llvm::LLVMContext&) + 214 > 17 llc 0x000000000067958a llvm::ParseIRFile(std::string > const&, llvm::SMDiagnostic&, llvm::LLVMContext&) + 374 > 18 llc 0x00000000006680f4 > 19 llc 0x0000000000668fed main + 199 > 20 libc.so.6 0x000000332fa1d994 __libc_start_main + 244 > 21 llc 0x0000000000666319 > Sta...
2020 Sep 23
2
ORC JIT - Can modules independently managed with one LLJIT instance? + problems with ExecutionSession.lookup
...%2fexamples%2fKaleidoscope%2fBuildingAJIT%2fChapter1%2ftoy.cpp%23L1148&umid=7d73edbc-e566-4ffc-bd01-827f3d6c8c2e&auth=b6f66d00f8195cc5198eee21f0dbabe6af0a3180-c0d11d7f66acc6ff5b094b7166067e93a53cc1ff>, from lines 1148 to line 1161. Also a related but different question: When using llvm::parseIRFile I need to pass it a LLVMContext - should this be a unique one for every module I pass or can I use a global one? It depends on whether you want to be able to compile concurrently in the JIT process. If you do want to compile concurrently then each module should get its own context. If you are happ...
2013 Aug 09
0
[LLVMdev] opt -O3 causes Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed
...lvm::MemoryBuffer*, llvm::LLVMContext&, >>> std::string*) + 93 >>> 16 llc 0x0000000000679302 >>> llvm::ParseIR(llvm::MemoryBuffer*, llvm::SMDiagnostic&, >>> llvm::LLVMContext&) + 214 >>> 17 llc 0x000000000067958a llvm::ParseIRFile(std::string >>> const&, llvm::SMDiagnostic&, llvm::LLVMContext&) + 374 >>> 18 llc 0x00000000006680f4 >>> 19 llc 0x0000000000668fed main + 199 >>> 20 libc.so.6 0x000000332fa1d994 __libc_start_main + 244 >>> 21 llc...
2012 Dec 27
1
[LLVMdev] Throwing an exception from JITed code, and catching in C++
...ExecutionEngine/JIT.h" #include "llvm/Support/IRReader.h" #include "llvm/Support/TargetSelect.h" #include using namespace llvm; int main(int, char**) { LLVMContext& context = getGlobalContext(); InitializeNativeTarget(); SMDiagnostic error; Module* m = ParseIRFile("./thrower.s.bc", error, context); if (!m) { printf("could not load module\n"); return 1; } ExecutionEngine* ee = ExecutionEngine::create(m); if (!ee) { printf("could not create execution engine\n"); return 1;...
2016 Nov 20
3
uninitialized values in Attributes.cpp
...moryBufferRef, >> llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::SlotMapping*) (Parser.cpp:41) >> ==29299== by 0x158C59E: llvm::parseIR(llvm::MemoryBufferRef, >> llvm::SMDiagnostic&, llvm::LLVMContext&) (IRReader.cpp:89) >> ==29299== by 0x158CA61: llvm::parseIRFile(llvm::StringRef, >> llvm::SMDiagnostic&, llvm::LLVMContext&) (IRReader.cpp:102) >> ==29299== >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo...