Displaying 20 results from an estimated 2000 matches similar to: "How to know the sub-class of a Value class?"
2017 Jun 12
4
How to know the sub-class of a Value class?
On 11 June 2017 at 23:06, Jeremy Lakeman <Jeremy.Lakeman at gmail.com> wrote:
> http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-
> templates
>
I understand isa and dyn-cast let you test the type of an object at
run-time by leveraging LLVM's custom implementation of RTTI. However, it
doesn't make much sense to test out for all possible sub-classes to
2017 Jun 12
2
How to know the sub-class of a Value class?
On 11 June 2017 at 23:03, Craig Topper <craig.topper at gmail.com> wrote:
> Try value->dump() assuming you're using a debug build.
>
>
The information displayed is non-uniform. There are two different cases
based on my sample program:
(1) dump() shows the Type and *some* value which I don't
understand what it is
(2) dump() shows the instruction that
2017 Jun 11
2
Force casting a Value*
I am trying to cast a Value* irrespective of its underlying subclass to
uint64 and pass it on to a method as an argument.
if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
Value* vo = store_inst->getValueOperand();
uint64 value = /* cast vo to unsigned int 64 bit */
func(value);
}
How can I force
2017 Jun 11
2
Force casting a Value*
On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote:
> Sounds like you're looking for reinterpret_cast: http://en.
> cppreference.com/w/cpp/language/reinterpret_cast
>
I tried cast<ConstInt>(vo), but that failed at run-time.
>
> On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
2017 Jun 12
2
Force casting a Value*
On 11 June 2017 at 14:04, don hinton <hintonda at gmail.com> wrote:
> Assuming you know it's a 64 bit value, and the function you are calling
> takes a uint64_t, try this:
>
The values from the test program are of type: i32/i32*/i32**. Can't I
interpret these as uint64_t some way?
>
> Value* args[] = {store_inst->getOperand(0)};
>
>
> On Sun, Jun 11,
2017 Jun 11
2
Force casting a Value*
On 11 June 2017 at 12:05, Tim Northover <t.p.northover at gmail.com> wrote:
> On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > I can't pass var_value to a function accepting uint64_t. LLVM complains
> > about broken function call.
>
> Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
2017 Jun 11
2
Force casting a Value*
On 11 June 2017 at 11:32, Nikodemus Siivola <nikodemus at random-state.net>
wrote:
> On Sun, Jun 11, 2017 at 7:49 PM, Dipanjan Das via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>>
>>
>> On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote:
>>
>>> Sounds like you're looking for reinterpret_cast: http://en.cp
2018 Mar 09
4
Dump LLVM StoreInst
Hi,
I’m writing a loop-free LLVM pass, my thought is to track if the value inside the loop is changed, so I look up the Instruction StoreInst first and try to get its value in a set. I checked getValueOperand(), getValueName() in the API document but unfortunately they failed the compilation.
if (isa<StoreInst>(I)){
Value* v = I.getOperand(0);
Instruction* op1 =
2017 Apr 28
2
How to get the address of a global variable in LLVM?
Let `x` be the address of a global variable `g` in a program at run-time.
LLVM IR produces a store instruction as shown below:
store i32 30, i32* @g, align 4
I am writing an LLVM pass which will instrument the program such that `x`
is passed to an instrumentation function `func(int addr)` at run-time. I
can insert a call to `func` using `IRBuilder` successfully. What I am not
being able to
2018 Mar 10
0
Dump LLVM StoreInst
The code you've pasted there is inconsistent in variable names. Your
created an instruction called 'op1' but your print uses 'v1'. What should
be an '->' is just a '-'. You also have a variable in your print called
'op' but that's not declared in your code. Also the result of dyn_cast
should always be checked for null before using the result.
2018 Mar 10
0
Dump LLVM StoreInst
On Fri, Mar 9, 2018 at 9:18 AM, Zhou Zhizhong via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Hi,
>
> I’m writing a loop-free LLVM pass, my thought is to track if the value inside the loop is changed, so I look up the Instruction StoreInst first and try to get its value in a set. I checked getValueOperand(), getValueName() in the API document but unfortunately they failed the
2013 Jan 10
2
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
Hello everyone !
In my pass I inspect the penultimate instruction from every basic block in
runOnFunction(). I am interested in ICMP instructions only.
if(BB->size()>1)
if(last->getPrevNode())
{
previous = last->getPrevNode();
ok=1;
}
I want to get the operands of previous, which is of type Instruction*. Due
tests based on getNumOperands, ICMP has 2 (as
2012 Jul 09
1
[LLVMdev] Problem with getting a result of an instruction.
Hello,
I'm a newbie in LLVM. Now I'm trying to implement a pass that does some
simple form of dynamic dataflow analysis.
In my dataflow analysis I want to know if a specific variable is
"dependent" on another one. "Dependent" means the following: if we have
three variables in a program - a, b and c and in some places of this
program we have the following
2013 Jan 10
0
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
Hi,
On 10/01/13 10:56, Alexandru Ionut Diaconescu wrote:
> Hello everyone !
>
> In my pass I inspect the penultimate instruction from every basic block in
> runOnFunction(). I am interested in ICMP instructions only.
>
> |if(BB->size()>1)
> if(last->getPrevNode())
> {
> previous = last->getPrevNode();
> ok=1;
> }
> |
2008 Nov 23
2
[LLVMdev] RFC: Mangling Unnamed Global Values
Hi all,
Right now the Mangler::getValueName() method will produce something
like "__unnamed_1_37" for a global value that doesn't have a name.
This is wrong for Objective-C where CFStrings will get these labels,
thus preventing the linker from coalescing them.
[/tmp]> nm -s __DATA __cfstring -m foo.o
00000000000244d0 (__DATA,__cfstring) non-external __unnamed_1_0
2008 Nov 24
0
[LLVMdev] RFC: Mangling Unnamed Global Values
Can symbols with external linkage but no name be converted
to have internal linkage? Would that solve the problem?
Dan
On Nov 23, 2008, at 2:15 AM, Bill Wendling wrote:
> Hi all,
>
> Right now the Mangler::getValueName() method will produce something
> like "__unnamed_1_37" for a global value that doesn't have a name.
> This is wrong for Objective-C where CFStrings
2009 Mar 26
0
[LLVMdev] how to get the InvodInst 's Operand Name?
Hi zhangzw,
>> invoke void @__cxa_throw(i8* %7, i8* bitcast
>> (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*), void (i8*)*
>> null)
>> noreturn to label %invcont unwind label %lpad
>
> >>are you trying to get the name "@_ZTIi" or "@__cxa_throw"?
>
> yes! i want get the name @_ZTi or @__cxa_throw,
> the latter
2017 Apr 15
2
Why does an LLVM pass based on FunctionPass not get triggered for certain functions?
I am learning to write LLVM pass by trying to reproduce [hello world][1]
example. The pass `hello.cpp` looks like:
#include "llvm/Pass.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
struct Hello : public FunctionPass {
static char ID;
Hello() : FunctionPass(ID) {}
2017 Oct 11
2
How to create an alloca variable of type i64 in LLVM IR?
To create a stack based (local) 64 bit integer in LLVM IR, I used:
Value *var = builder.CreateAlloca(Type::getInt64Ty(Ctx));
I wish to pass this variable to a function "void foo(unsigned long)". I
created the signature of function foo() as follows:
Constant *func = M->getOrInsertFunction("foo",
Type::getVoidTy(Ctx),Type::getInt64Ty(Ctx), NULL);
To pass the newly created
2013 Mar 04
2
[LLVMdev] llvm cannot iterate a [3 x i8]
Hello everyone,
I am trying to "parse" a part of LLVM IR. More exactly, from
@.str = private unnamed_addr constant [3 x i8] c"DS\00", section
"llvm.metadata"
I want to get "DS". It is the single place in the whole bytecode from where
I can get it. I have :
...
Value *VV = cast<Value>(LD100->getOperand(1)->getOperand(0));