Displaying 20 results from an estimated 600 matches similar to: "Passing Array base address/pointer to runtime function in LLVM IR"
2018 Jan 09
0
Passing Array base address/pointer to runtime function in LLVM IR
Hi Bernard,
On 9 January 2018 at 07:08, Bernard Nongpoh via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Tried the above code but no luck ..
I'm afraid there's not enough context here to answer the question. The
code you posted looks like it could work, but a lot would depend on
the definitions you omitted: getElementPtrInst especially, though a
dump of the whole Module as it
2016 Aug 12
2
Check if getElementPtr Operand
Hello,
consider the following IR code :
%count4 = getelementptr inbounds %struct.r32, %struct.r32* %cur.087, i64 0,
i32 4
How to check in the instruction, whether the operand is a structure or not
if(isa<GetElementPtrInst>(instruction))
{
GetElementPtrInst *getElementPtrInst=dyn_cast<GetElementPtrInst>(&instruction);
//check if getElemetPtrInst operands structure or array.
}
2016 Aug 31
2
Check if getElementPtr Operand
Thanks Ryan, I'm able to retrieved the type using the following code:
Type *type=getElementPtrInst->getSourceElementType();
On Fri, Aug 12, 2016 at 7:00 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> Take a look at visitGetElementPtrInst in InstructionCombining.cpp for some
> examples about how to iterate over GEP and check for type.
>
>
2007 Nov 26
1
[LLVMdev] How to declare and use sprintf
On Monday 26 November 2007 00:40, Gordon Henriksen wrote:
> The type you want is:
>
> let sp = pointer_type i8_type in
> var_arg_function_type sp [| sp; sp |]
Awesome stuff. Here is my most elegant Fibonacci example in OCaml so far:
open Llvm
let ( |> ) x f = f x
let int n = const_int i32_type n
let return b x = build_ret x b |> ignore
let build_fib m =
let ty =
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
Here's my translation of the Fibonacci example into OCaml:
open Printf
open Llvm
let build_fib m =
let fibf =
define_function "fib" (function_type i32_type [| i32_type |]) m in
let bb = builder_at_end (entry_block fibf) in
let one = const_int i32_type 1 and two = const_int i32_type 2 in
let argx = param fibf 0 in
set_value_name "AnArg" argx;
let
2007 Dec 23
0
[LLVMdev] Ocaml JIT example
Hi all,
Here's an example of how to LLVM's JIT compiler/interpreter from Ocaml.
$ cat jithelloworld.ml
(* jithelloworld.ml *)
open Llvm
open Llvm_executionengine
let execute_function f m =
(* Set up the JIT. *)
let jit = ExecutionEngine.create (ModuleProvider.create m) in
ExecutionEngine.run_static_ctors jit;
(* Execute the function. *)
ignore
2007 Oct 02
2
[LLVMdev] OCaml Install Error
On 2007-10-02, at 10:46, Jan Rehders wrote:
> where can I read more about this? I assume (hope) the lib provides
> some kind of OCaml bindings? I could not find any trace of it in
> the 2.1 release source so I guess it's currently SVN only?
Jan,
Here's a trivial example.
$ cat metahelloworld.ml
(* metahelloworld.ml *)
open Llvm
open Llvm_bitwriter
let _ =
let filename
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
Here is a complete 104-line native code compiler for a tiny subset of OCaml
that is expressive enough to compile an external Fibonacci program:
type expr =
| Int of int
| Var of string
| BinOp of [ `Add | `Sub | `Leq ] * expr * expr
| If of expr * expr * expr
| Apply of expr * expr
type defn =
| LetRec of string * string * expr
open Camlp4.PreCast;;
let expr = Gram.Entry.mk
2007 Oct 19
0
[LLVMdev] OCaml Install Error
Hi,
this looks very promising. Do you have any plans to add bindings for
the use of an ExecutionEngine, especially recompileAndRelinkFunction?
I've build an interactive toplevel implemented in OCaml and I have to
pull of some stunts to be able to change the definition of a
function. (emit a .ll file containing the code, looking up the
function and calling removeBody, then reading
2015 Oct 08
5
ilist/iplist are broken (maybe I'll fix them?)
I've been digging into some undefined behaviour stemming from how ilist
is typically configured. r247937, r247944, and r247978 caused a UBSan
failure to start firing on our Green Dragon bots, and after an IRC
conversation between David and Nick and Mehdi, we added a blacklist:
--
$echo "src:$WORKSPACE/llvm/include/llvm/CodeGen/MachineFunction.h" >> sanitize.blacklist
--
2012 Sep 22
2
Mechanize and Thread-Safety Revisited
This post from Aaron Patterson back in 2009 seems to be pretty definite about how to use Mechanize in a thread-safe way, but I thought I would revisit the question because there are several posts on StackOverflow since then that would seem to contradict it (of course, I trust Aaron''s answer more than random answers on StackOverlfow, but just in case I thought I would confirm it).
It is
2015 Oct 21
3
ilist/iplist are broken (maybe I'll fix them?)
"Duncan P. N. Exon Smith via llvm-dev" <llvm-dev at lists.llvm.org> writes:
>> On 2015-Oct-20, at 11:23, Reid Kleckner <rnk at google.com> wrote:
>>
>> I think the implicit iterator conversions are much less important
>> now that we have range based for loops, but I still like having
>> them.
>
> IMO, if a developer has an ilist iterator
2007 Nov 25
2
[LLVMdev] How to declare and use sprintf
So my Fib program is segfaulting and I'm not sure why. I think it might be
because my declaration and use of sprintf is wrong.
I notice llvm-gcc produces declarations containing "..." like:
declare int %printf(sbyte*, ...)
but I'm not sure how to do this so I've used:
let sprintf =
declare_function "sprintf"
(function_type (pointer_type
2015 Oct 20
2
ilist/iplist are broken (maybe I'll fix them?)
I think the implicit iterator conversions are much less important now that
we have range based for loops, but I still like having them.
On Tue, Oct 20, 2015 at 11:13 AM, Duncan P. N. Exon Smith via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
>
> > On 2015-Oct-07, at 17:57, Duncan P. N. Exon Smith <dexonsmith at apple.com>
> wrote:
> >
> > I've been
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
I don't think it's the same problem as you described. By 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 =
2020 Jul 19
2
Instrument intrinsic invalid
Hi, I try to use llvm-dis to disassemble the result after opt, my pass will add a intrinsic after the load instruction, like following:
bool fpscan::ldAddMetadata (Instruction *Inst, StringRef c) {
std::vector<Metadata *> dataTuples;
// Add metadata in list
dataTuples.push_back(MDString::get(Inst->getContext(), c));
MDNode* N = MDNode::get(Inst->getContext(),
2007 Nov 25
5
[LLVMdev] OCaml
On Sunday 25 November 2007 12:23, Gordon Henriksen wrote:
> On 2007-11-24, at 21:58, Jon Harrop wrote:
> > - Garbage collection tuned for functional programming
>
> http://llvm.org/docs/GarbageCollection.html
>
> I've been doing some interesting work on this front. Getting Lattner-
> cycles to have it reviewed and integrated is probably the biggest
> challenge; LLVM
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
Hi Everyone,
I'm quite new to LLVM and I want to update value of global variable in LLVM
IR. I created new global variable in ModulePass:
bool runOnModule(llvm::Module &M) {
IRBuilder<> Builder(M.getContext());
Instruction *I = &*inst_begin(M.getFunction("main"));
Builder.SetInsertPoint(I);
M.getOrInsertGlobal("globalKey",
2007 Nov 27
1
[LLVMdev] Fibonacci example in OCaml
On 2007-11-26, at 21:12, Jon Harrop wrote:
> Provide a type enumerating the valid terminators and restrict the
> last instruction in a block to be a terminator. Something like this:
>
> type terminator = [ `ret of llvalue | `br of llvalue ]
> type instruction =
> [ terminator
> | `add of llvalue * llvalue
> | `sub of llvalue * llvalue ]
> type block
2013 Apr 09
0
[LLVMdev] Getting the position of a BasicBlock that doesn't exist anymore in the backend
Hello,
In our LLVM backend we needto output certain labels in the AsmPrinter
in order to access certain data through those labels. These labels are
related to BlockAddress objects (that come from above) and they should
be put into a position that is related to the BasicBlock pointed by that
BlockAddress.
The problem I'm hitting is that if the BasicBlock that the BlockAddress
points to