search for: getmembuffer

Displaying 17 results from an estimated 17 matches for "getmembuffer".

2010 Oct 01
0
[LLVMdev] LLVM-2.7 to 2.8 subtle change: MemoryBuffer::getMemBuffer
Hi guys, In porting our project over to LLVM-2.8 today I ran into a change that should probably go in the 2.8 release notes. After r100485, the MemoryBuffer::getMemBuffer went from: /// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note /// that EndPtr[0] must be a null byte and be accessible! static MemoryBuffer *getMemBuffer(const cha...
2014 Mar 19
2
[LLVMdev] load bytecode from string for jiting problem
all of: ---- // cout << "lsr: " << lsr << "\n"; llvm::MemoryBuffer* mbjit = llvm::MemoryBuffer::getMemBufferCopy (sr); ------ string lsr = sr.str(); // cout << "lsr: " << lsr << "\n"; llvm::MemoryBuffer* mbjit = llvm::MemoryBuffer::getMemBuffer (lsr); ------- string...
2014 Mar 19
2
[LLVMdev] load bytecode from string for jiting problem
...uot;; >> if (sr.str()[2] == (char) 0xc0) >> std::cout << "0xc0 ok\n"; >> if (sr.str()[3] == (char) 0xde) >> std::cout << "0xde ok\n"; >> >> 3) I try to parse the gv by >> MemoryBuffer* mbjit = MemoryBuffer::getMemBuffer (sr.str()); > > Not sure if this is your issue, but should be fixed anyway: > > The std::string created by "sr.str()" ends its lifetime in this > statement, and MemoryBuffer for efficiency reasons > avoids copying data it doesn't have to (like StringRef) so will be &...
2014 Mar 20
2
[LLVMdev] load bytecode from string for jiting problem
...)[2] == (char) 0xc0) std::cout << "0xc0 ok\n"; if (sr.str()[3] == (char) 0xde) std::cout << "0xde ok\n"; llvm::MemoryBuffer* mbjit = llvm::MemoryBuffer::getMemBufferCopy (sr); llvm::ErrorOr<llvm::Module*> ModuleOrErr = llvm::parseBitcodeFile (mbjit, context); if (llvm::error_code EC = ModuleOrErr.getError()) { std::cout << ModuleOrErr.getError().message() << "\n"; } Module* Mjit = ModuleOrErr.get(); std::string eeError; Ex...
2014 Mar 13
2
[LLVMdev] load bytecode from string for jiting problem
...(sr.str()[1] == 'C') std::cout << "C ok\n"; if (sr.str()[2] == (char) 0xc0) std::cout << "0xc0 ok\n"; if (sr.str()[3] == (char) 0xde) std::cout << "0xde ok\n"; 3) I try to parse the gv by MemoryBuffer* mbjit = MemoryBuffer::getMemBuffer (sr.str()); LLVMContext& context = getGlobalContext(); ErrorOr<Module*> ModuleOrErr = parseBitcodeFile (mbjit, context); if (error_code EC = ModuleOrErr.getError()) { std::cout << ModuleOrErr.getError().message() << "\n"; assert(false); } This i...
2014 Mar 20
2
[LLVMdev] load bytecode from string for jiting problem
...std::cout << "0xc0 ok\n"; >> if (sr.str()[3] == (char) 0xde) >> std::cout << "0xde ok\n"; >> llvm::MemoryBuffer* mbjit = llvm::MemoryBuffer::getMemBufferCopy (sr); >> >> llvm::ErrorOr<llvm::Module*> ModuleOrErr = llvm::parseBitcodeFile >> (mbjit, context); >> if (llvm::error_code EC = ModuleOrErr.getError()) { >> std::cout << ModuleOrErr.getError().message() << "\n"; >> } >> >&...
2013 Nov 05
1
[LLVMdev] Thread-safe cloning
...ferent // modules. std::string str; raw_string_ostream stream(str); WriteBitcodeToFile(other.myModule, stream); StringRef ref(stream.str()); UT_ScopedPtr<MemoryBuffer> buf(MemoryBuffer::getMemBuffer(ref)); myModule = ParseBitcodeFile(buf.get(), myContext); UT_ASSERT(myModule); } On 06/18/2013 01:29 PM, Reid Kleckner wrote: > You could probably round trip it through bitcode in memory. I think > all of the IR cloning functionality assumes that only o...
2017 Jun 14
2
Using LLD to create a .lib from a .def
...================================== This is so that I can write the following user code: // writes the output to dll_path with .dll replaced with .lib void ZigLLDDefToLib(Buf *def_contents, Buf *dll_path) { lld::coff::Config = new lld::coff::Configuration; auto mem_buf = MemoryBuffer::getMemBuffer(buf_ptr(def_contents)); MemoryBufferRef mbref(*mem_buf); lld::coff::parseModuleDefs(mbref); lld::coff::Config->OutputFile = buf_ptr(dll_path); lld::coff::writeImportLibrary(); } Then I give it def_contents that looks like: LIBRARY kernel32 EXPORTS ExitProcess GetConsoleMode Get...
2014 Jan 20
2
[LLVMdev] MCJIT versus getLazyBitcodeModule?
...e body of code that I precompile to bitcode using "clang++ -S --emit-llvm", then create a .cpp file containing the bitcode, which is compiled into my app. * Before JITing the dynamic code, my app initializes the Module like this: llvm::MemoryBuffer* buf = llvm::MemoryBuffer::getMemBuffer (llvm::StringRef(bitcode, bitcode_size), name); llvm::Module *m = llvm::getLazyBitcodeModule (buf, context(), err); where bitcode is a big char array holding the precompiled bitcode. The idea is to "seed" the module with that precompiled bitcode so that any calls I inserted into...
2009 Oct 07
0
[LLVMdev] patch for CIndex linakge error on Mingw, set the proper LINKER_LANGUAGE for CIndex and c-index-test
...bj):ASTUnit.cpp:(.text$_ZN5clang13SourceManagerC1Ev[clang::SourceManager::SourceManager()]+0x17f): undefined reference to `llvm::BumpPtrAllocator::~BumpPtrAllocator()' ..\..\..\..\lib\libclangFrontend.a(PCHReader.cpp.obj):PCHReader.cpp:(.text+0x61ed): undefined reference to `llvm::MemoryBuffer::getMemBuffer(char const*, char const*, char const*)' ..\..\..\..\lib\libclangFrontend.a(PCHReader.cpp.obj):PCHReader.cpp:(.text+0x79d0): undefined reference to `llvm::MemoryBuffer::getSTDIN()' ..\..\..\..\lib\libclangFrontend.a(PCHReader.cpp.obj):PCHReader.cpp:(.text+0x7a11): undefined reference to `llv...
2011 Oct 31
1
[LLVMdev] Runtime optimization using llvm
Hello, I am getting to know how the Runtime Optimization feature of LLVM works and how I can use it. I want to know how I could print the results of any analysis and transformation pass. Say, I have a program written in c and I ran the edge-profiling pass onto it. Now I want to see the result. How could I do it? Also if I happen to change one of the passes inside folder
2017 Jun 15
2
Using LLD to create a .lib from a .def
...write the following user code: >> >> >> >> // writes the output to dll_path with .dll replaced with .lib >> void ZigLLDDefToLib(Buf *def_contents, Buf *dll_path) { >> lld::coff::Config = new lld::coff::Configuration; >> auto mem_buf = MemoryBuffer::getMemBuffer(buf_ptr(def_contents)); >> MemoryBufferRef mbref(*mem_buf); >> lld::coff::parseModuleDefs(mbref); >> lld::coff::Config->OutputFile = buf_ptr(dll_path); >> lld::coff::writeImportLibrary(); >> } >> >> >> Then I give it def_contents th...
2007 Dec 02
1
[LLVMdev] reading & writing bitcode from non file, e.g. GDBM store (or MySQL database)
...BM entries (or inside MySQL databases). Apparently, I can read a module from a GDBM store with something like (all error handling is skipped) datum keyd, vald; // GDBM key & value // fill keyd appropriately vald = gdbm_fetch (bark_gdbm, keyd); MemoryBuffer* membuf = MemoryBuffer::getMemBuffer(vald.dptr, vald.dptr+vald.dsize, bufnam); Module* lmodu = ParseBitcodeFile(membuf, &errmsg); // do something appropriate with the llvm module lmodu Unfortunately, there is no way of dumping into memory, except by going thru a stdc++ memory output buffer. Or am I wrong on this? Reg...
2013 Jun 18
0
[LLVMdev] Thread-safe cloning
You could probably round trip it through bitcode in memory. I think all of the IR cloning functionality assumes that only one context is being used. Even if the serialization isn't efficient as a clone could be, it should give you very high confidence that everything Just Works. :) On Tue, Jun 18, 2013 at 1:16 PM, Andrew Clinton <andrew at sidefx.com> wrote: > I have a
2009 Sep 24
7
[LLVMdev] MemoryBuffer
...the input since that assert could access invalid memory if it was to one past the end, but if it was to the end of input and not one past the end that that seems inconsistent, so I am curious as to which it is? I know the comments in the header indicate that the end needs to be dereferencable for getMemBuffer, but not for getMemBufferCopy and other ones, so I am curious as to why it is inconsistent? I do not see any real reason why getMemBuffer has the requirement that the EndPtr needs to be dereferencable except for that assert, and I do not really see a reason for that assert right off the bat. Basi...
2013 Jun 18
2
[LLVMdev] Thread-safe cloning
I have a Module/LLVMContext that I'd like to clone and manipulate in different threads (each thread may perform different translation / optimization, so they need unique copies). Currently this process has to be locked, since each clone of the Module still refers to the same LLVMContext. Is there a way to clone both the Module and LLVMContext so that the copies can be manipulated
2017 Jun 16
2
Using LLD to create a .lib from a .def
...;>> >>>> >>>> // writes the output to dll_path with .dll replaced with .lib >>>> void ZigLLDDefToLib(Buf *def_contents, Buf *dll_path) { >>>> lld::coff::Config = new lld::coff::Configuration; >>>> auto mem_buf = MemoryBuffer::getMemBuffer(buf_ptr(def_contents)); >>>> MemoryBufferRef mbref(*mem_buf); >>>> lld::coff::parseModuleDefs(mbref); >>>> lld::coff::Config->OutputFile = buf_ptr(dll_path); >>>> lld::coff::writeImportLibrary(); >>>> } >>>>...