Displaying 20 results from an estimated 83 matches for "getmodule".
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...printing I meant
calling printf function and passing my global variable as one of the
arguments.
My code:
Instruction* InstructionVisitor::incrementGlobalKey(Instruction* I) {
IRBuilder<> Builder(I->getContext());
Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey");
if (key) {
LoadInst* load = Builder.CreateLoad(key);
Value* inc = Builder.CreateAdd(load, Builder.getInt64(1));
StoreInst* store = Builder.CreateStore(inc, key);
return store;
}
return I;
}
Instruction* InstructionVisitor::print(Instruction* I, const c...
2004 May 11
3
[LLVMdev] ExecutionEngine/Interpreter/ExternalFunctions.cpp
...FILE *getFILE(void *Ptr) {
static Module *LastMod = 0;
static PointerTy IOBBase = 0;
static unsigned FILESize;
if (LastMod != &TheInterpreter->getModule()) { // Module change or initialize?
Module *M = LastMod = &TheInterpreter->getModule();
// Check to see if the currently loaded module contain...
2015 Apr 09
2
[LLVMdev] BasicBlock.h in the binary and in the source differ
...6.0-x86_64-apple-darwin/include/llvm/IR/
>> BasicBlock.h
>>
>> is slightly different from that of the source
>>
>> llvm/include/llvm/IR/BasicBlock.h
>>
>
> Where specifically did you download the source from?
>
>
>> In particular, llvm:: getModule(..) is included in the latter
>> BasicBlock.h but not in the former BasicBlock.h. Am I misunderstanding
>> something or is it an inconsistency LLVM developers will fix?
>>
>> Thanks in advance.
>>
>>
>> Zhoulai
>>
>>
>> __________________...
2012 Jul 24
1
[LLVMdev] Cannot remove module from empty JIT
...th no modules: jitstate will be
0 and therefore we have a null-pointer exception.
The function returns a boolean for success/failure, however, so you
would expect to be able to call it and get false back.
Should we be checking for jitstate != 0 before accessing the variable?
- if (jitstate->getModule() == M) {
+ if (jitstate && jitstate->getModule() == M) {
Verena
2004 May 11
0
[LLVMdev] ExecutionEngine/Interpreter/ExternalFunctions.cpp
...{
> static Module *LastMod = 0;
> static PointerTy IOBBase = 0;
> static unsigned FILESize;
>
> if (LastMod != &TheInterpreter->getModule()) { // Module change or initialize?
> Module *M = LastMod = &TheInterpreter->getModule();
>
> // Check to see if the currently loaded...
2008 May 13
2
[LLVMdev] Python bindings available.
On 2008-05-13, at 02:12, Mahadevan R wrote:
>>> That's not how the object works...
>
> Gordon, I think I can make it work if we have the following additional
> function in LLVM-C:
>
> LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef MP) {
> return wrap(unwrap(MP)->getModule());
> }
Can I ask, how general is your solution? I only intended to use this
particular example as a proxy for the general problem of interaction
between GC and manual memory management being complex. Will you
require...
2015 Apr 09
3
[LLVMdev] BasicBlock.h in the binary and in the source differ
...nd binary from
http://llvm.org/releases/download.html
I just find the BasicBlock.h file of the binary package
clang+llvm-3.6.0-x86_64-apple-darwin/include/llvm/IR/BasicBlock.h
is slightly different from that of the source
llvm/include/llvm/IR/BasicBlock.h
In particular, llvm:: getModule(..) is included in the latter BasicBlock.h
but not in the former BasicBlock.h. Am I misunderstanding something or is
it an inconsistency LLVM developers will fix?
Thanks in advance.
Zhoulai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...));
for (Instruction &I : instructions(F)) {
visitor.visit(I);
}
}
return true;}
Later in InstructionVisitor I try to update it like that:
IRBuilder<> Builder(I->getContext());Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey");
if (key) {
LoadInst* load = Builder.CreateLoad(key);
Value* inc = Builder.CreateAdd(load, Builder.getInt64(1));
StoreInst* store = Builder.CreateStore(inc, key);}
I print that global variable during execution of instrumented code. I
access i...
2008 May 13
0
[LLVMdev] Python bindings available.
...n at mac.com> wrote:
> On 2008-05-13, at 02:12, Mahadevan R wrote:
>
> >>> That's not how the object works...
> >
> > Gordon, I think I can make it work if we have the following additional
> > function in LLVM-C:
> >
> > LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef MP) {
> > return wrap(unwrap(MP)->getModule());
> > }
>
> Can I ask, how general is your solution? I only intended to use this
> particular example as a proxy for the general problem of interaction
> between GC and manual memory management bein...
2004 May 11
1
[LLVMdev] ExecutionEngine/Interpreter/ExternalFunctions.cpp
...ule *LastMod = 0;
> > static PointerTy IOBBase = 0;
> > static unsigned FILESize;
> >
> > if (LastMod != &TheInterpreter->getModule()) { // Module change or initialize?
> > Module *M = LastMod = &TheInterpreter->getModule();
> >
> > // Check to see if the c...
2013 Aug 05
2
[LLVMdev] Can I add GlobalVariable in MachineFunctionPass ?
Hello,
I want to add a global variable of arrayType in my MachineFunctionPass.
However, I only get const Module from MachineFunction.getMMI().getModule().
I can't add any global variable to a const Module.
Another way is to add a global variable in doInitialization in my
MachineFunctionPass, but I can't determine the size of my arrayType for
global variable in doInitialization.
Is there any suggestion that can help me achieve this?
Than...
2019 Aug 13
3
ORC v2 question
Hi Lang,
On Tue, 13 Aug 2019 at 20:47, Lang Hames <lhames at gmail.com> wrote:
>
> Sorry for the delayed reply. Looks like you have figured out how to solve your issue already. Out of interest, what did you need to do? Do you have anything that you would like to see added to http://llvm.org/docs/ORCv2.html ?
>
Sorry my post was misleading. I figured out below which was part of the
2013 Oct 24
2
[LLVMdev] LLVM use chains
...p()
; Function Attrs: ssp uwtable
define i32 @_Z1fv() #2 {
entry:
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([21
x i8]* @.str1, i32 0, i32 0))
ret i32 0
}
(gdb) n
513 }
(gdb) br llvm::AssemblyWriter::printModule(llvm::Module const*)
(gdb) p m_CurTransaction->getModule()->dump()
llvm::AssemblyWriter::printGlobal (this=0x7fff5fbfe850, GV=0x107274058)
at
/Users/vvassilev/workspace/root/interpreter/llvm/src/lib/IR/AsmWriter.cpp:1444
1444 if (GV->isMaterializable())
(gdb) p GV->use_empty()
$78 = false
(gdb) p GV->use_back()
$79 = (class llvm::User...
2019 Sep 19
3
"corrupted size vs. prev_size" when calling ExecutionSession::lookup()
...r,
llvm::orc::ConcurrentIRCompiler(std::move(*JTMB)));
llvm::orc::MangleAndInterner Mangle(ES, *DL);
ES.getMainJITDylib().setGenerator(
llvm::cantFail(llvm::orc::DynamicLibrarySearchGenerator::GetForCurrentProcess(*DL)));
// ... large part to generate IR code
.
if (llvm::verifyModule(*AST::getModule(), &llvm::errs())) {
return 0;
} else {
std::cout << "Verified success\n";
}
// run the generated IR code
llvm::cantFail(CompileLayer.add(ES.getMainJITDylib(),
llvm::orc::ThreadSafeModule(std::move(AST::takeModule()),
AST::takeContext())));
auto symbol = ll...
2012 Nov 04
0
[LLVMdev] trying to understand linkage with linker
...with:
auto f = module->getOrInsertFunction( "eval_expr", ...)
//create function
Then later I link this with other modules:
Linker link;
link.LinkInModule( base_module );
link.LinkInModule( module );
Then I create an execution engine something like:
auto ee = EngineBuilder( link.getModule() )...create();
If I attempt to run the function directly I get an error:
ee->runFunction( f, args );
"LLVM ERROR: Program used external function 'eval_expr' which could not
be resolved!"
But if I get the same function from the linked module it works:
ee->runFunction( li...
2012 Dec 21
2
[LLVMdev] How to print machine code of JIT IR
Hi,
I am using LLVM 3.1, and wants to print the machine code of JIT IR
I try the following method
EngineBuilder builder(&ctx.getModule());
builder.setEngineKind(EngineKind::JIT);
*
TargetMachine * tm = builder.selectTarget();
tm->Options.PrintMachineCode = true;*
engine = builder.create();
and somewhere in my code, I use
runJITonFunction();
Another question is that I am not sure when JIT would dump machine code....
2005 Feb 20
0
[LLVMdev] Attempt #1: JIT Thread Safety
...ion. Can anyone tell me if I am wrong:
ExecutionEngine:
Module &CurMod;
const TargetData *TD;
JIT:
TargetMachine &TM;
TargetJITInfo &TJI;
MachineCodeEmitter *MCE;
I specifically did not protect the ExecutionEngine::CurMod member
because a reference is returned via ExecutionEngine::getModule(). If
access to it must be serialized, it must be done very carefully. I
tried to make getModule return a constant reference, but that quickly
led me into deep trouble in the world of const correctness.
I've attached my patch against the latest CVS. There is one "trivial"
fix whi...
2008 May 12
2
[LLVMdev] Python bindings available.
On Mon, May 12, 2008 at 9:50 PM, Gordon Henriksen
<gordonhenriksen at mac.com> wrote:
> On May 12, 2008, at 12:00, Mahadevan R wrote:
>
> > 1) The MP dtor does a no-op (deletes self, but not the module it owns)
>
> That's not how the object works...
Yes, I know ;-) I was hoping you could add a detach() or some such API
for the MP...
2008 May 13
0
[LLVMdev] Python bindings available.
> > That's not how the object works...
Gordon, I think I can make it work if we have the following additional
function in LLVM-C:
LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef MP) {
return wrap(unwrap(MP)->getModule());
}
Do you think you could add that? Can I send you a patch?
Thanks & Regards,
-Mahadevan.
2013 Aug 05
3
[LLVMdev] Can I add GlobalVariable in MachineFunctionPass ?
...dev at cs.uiuc.edu
> > Subject: [LLVMdev] Can I add GlobalVariable in MachineFunctionPass ?
> >
> > Hello,
> >
> > I want to add a global variable of arrayType in my MachineFunctionPass.
> > However, I only get const Module from
> > MachineFunction.getMMI().getModule().
> > I can't add any global variable to a const Module.
> > Another way is to add a global variable in doInitialization in my
> > MachineFunctionPass, but I can't determine the size of my arrayType for
> > global variable in doInitialization.
> >
> > Is...