Displaying 20 results from an estimated 2000 matches similar to: "[LLVMdev] Retrieving Underlying Type from AllocaInst"
2010 May 28
2
[LLVMdev] Retrieving Underlying Type from AllocaInst
Thanks Nick,
Unfortunately, that is indeed what I asked for but not what I really am looking for.
My naive approach is to store symbol table entries as Value* objects so I can allocate global variables and alloca variables and place them into the symbol table and the rest of the code didn't need to know which kind they were, in general. Loads and Stores of these types (as well as other
2010 May 28
0
[LLVMdev] Retrieving Underlying Type from AllocaInst
Curtis Faith wrote:
> Is there a recommended way to retrieve the original type from an
> AllocaInst object?
>
> For example, I am creating alloca instructions using the IRBuilder
> interface like:
>
> alloca = builder.CreateAlloca( Type::getDoubleTy( context ), 0,
> variableName.c_str() );
>
> and I place the alloca into a symbol table.
>
> Later when I am
2010 May 28
0
[LLVMdev] Retrieving Underlying Type from AllocaInst
You should be able to use the second alternative that Nick proposed:
cast<PointerType*>(pointer_value->getType())->getElementType()
Reid
On Fri, May 28, 2010 at 9:37 AM, Curtis Faith <curtis at curtisfaith.com> wrote:
> Thanks Nick,
> Unfortunately, that is indeed what I asked for but not what I really am
> looking for.
> My naive approach is to store symbol table
2014 Aug 04
3
[LLVMdev] LLVM AllocaInst and StoreInst
Hi,
I am trying to write a simple interpreter.
I am trying to generate LLVM IR for assignment operation. The code for the
generation part looks like this
llvm::Value* codeGenSymTab(llvm::LLVMContext& context) {
> printf("\n CodeGen SymTab \n");
> Value *num = ConstantInt::get(Type::getInt64Ty(context), aTable.value,
> true);
> Value *alloc = new
2008 Nov 07
2
[LLVMdev] non-pointer gcroot
Hi
I'm getting an assert in LowerIntrinsics::InsertRootInitializers
because I'm gcroot'ing an alloca to a non-pointer.
I was hoping to modify InsertRootInitializers to memset the structure
in the case that it's not a pointer, but I'm not sure how to. Can
anyone suggest what should go at "todo; something here"?
...
for (AllocaInst **I = Roots, **E = Roots +
2014 Feb 18
3
[LLVMdev] How to codegen an LLVM-IR that has dynamic arrays in it?
Hi Fellows,
Is there a way to allocate dynamic array within an LLVM IR file
from my code generator? Say., how to create an array type with a size
determined through a global variable. Symbolically, something like below:
Value *sz = Mod->getOrInsertGlobal("SIZE", Int32Ty);
Type *ArrayTy = ArrayType::get(FloatTy, sz)
2009 Nov 11
4
[LLVMdev] Adding function call in LLVM IR using IRBuilder causes assertion error
Hi,
I'm trying to add function calls in the LLVM IR using the IRBuilder
class. I've read both tutorials about functions but I still get
assertion errors. I allocate memory for all function arguments and pass
them as explained in the tutorial.
My code is (this function is supposed to add a call to f in bb at pos):
void addCallSite(Function *f, BasicBlock *bb, BasicBlock::iterator pos)
2009 Nov 11
0
[LLVMdev] Adding function call in LLVM IR using IRBuilder causes assertion error
CreateAlloca(Type) returns an object of type Type*, the memory that
can hold an object of type Type. You probably don't want to be
creating allocas just before calling the function since 1) if that
call winds up in a loop they'll grow your stack frame without bound,
and 2) the memory they point to is initially uninitialized. Where did
the tutorial tell you to do that?
In general, when I
2015 Jun 30
4
[LLVMdev] Crashes on Windows 8 with >4k stack frames
Hi All,
we have an issue with our LLVM-based JIT compiler - executing the
compiled code corrupts memory (and subsequently crashes) if we alloca
more than 4k of variables (more than 511 8-byte ints). The same code
works on Windows 7 (32 and 64 bit), Linux, MacOS. We compile LLVM and
our program with Microsoft's Visual Studio 2010. Both debug and release
builds are affected.
The variables
2010 Apr 14
4
[LLVMdev] Operand, instruction
Thanks for reply.
I have used AllocaInst, it's working but i think it's only for allocating
some memory for new variable. And CallInst creates a call instruction. I am
looking for creating a add or sub instruction.
I used function instruction(), which gives me error "error: cannot allocate
an object of abstract type ‘llvm::Instruction’" and also "Instruction.h:28:
note:
2009 Aug 05
2
[LLVMdev] Dominator error inserting instructions into BasicBlock
Hi,
I've been writing some optimization passes for LLVM and had good luck
with
the simple stuff, but I am running into all kinds of trouble trying to
make copies of variables within a BasicBlock as part of a LoopPass
I am trying to make copies of the variables that are in scope in the
loop body like so:
//Remove the existing terminator
2015 Jun 30
2
[LLVMdev] Crashes on Windows 8 with >4k stack frames
We tested on 3.4.2 and 3.5.1. Later versions are slightly problematic
to test since they don't compile with VS2010. Do you happen to know if
it's fixed in one of the released versions, or if there is a workaround
(chkstk?) or a bug report online?
Thanks!
Eph
On 30.06.2015 12:58, Nicholas Chapman wrote:
> It's a known issue. I believe it's fixed in trunk however.
>
2010 Apr 13
3
[LLVMdev] Operand, instruction
Can you please give an example of creating an instruction (for example add
instructions with two operand a and b)? I am trying instruction() for a
while, but no success yet.
Duncan Sands wrote:
>
> Hi,
>
>> Actually i have to implement strength reduction, for that i have to first
>> detect induction variables using ALLEN-COCKE-KENNEDY algorithm. To find
>> out
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
Hi,
I'm trying to get my head around c++ - IR - c++ API and getting used
tramform manual information to code.
The manual states alloca is defined for <type>. FunstionType is a type, so
alloca for functionType should be possible? Not?
If we have a valid Module *m
we can get an allocate instruction allocating space for a non-argumented
function as follows:
AllocaInst* pa2 = new
2010 Apr 13
0
[LLVMdev] Operand, instruction
help__me_please wrote:
> Can you please give an example of creating an instruction (for example add
> instructions with two operand a and b)? I am trying instruction() for a
> while, but no success yet.
>
You need to look for the appropriate subclass of llvm::Instruction and
find the method for creating a new instruction. The method is usually a
static method and takes arguments
2012 Sep 21
0
[LLVMdev] How To Get The Name of the type the popinter is pointing to
i am using llvm ,
i did this
if ( AllocaInst *allocInst =
dyn_cast<AllocaInst>(&*bbit)){
PointerType *p = allocInst->getType();
if ( p->getElementType()->isPointerTy()){
StringRef name =
allocInst->getName();
2012 Sep 20
5
[LLVMdev] How To Get The Name of the type the popinter is pointing to
I want to know the type of pointer .
for example
if we have
int *p,
struct node *w
char *q
then i want int for p,char for q , struct node for w.
any help would be appreciated.
--
View this message in context: http://llvm.1065342.n5.nabble.com/How-To-Get-The-Name-of-the-type-the-popinter-is-pointing-to-tp49121.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
2016 Jun 28
0
mutateType on AllocaInst problem
Hi,
I'm trying to replace pointer typed alloca instructions to allocate a
vector of pointers. The idea is to change from [1] to [2]:
[1]: %0 = alloca i<N>*
[2]: %0 = alloca <3 x i8*>
I did it this way:
- first, create and insert [2] (for debug purpose, not necessary to
insert)
- mutate type so that replaceAllUsesWith can be called in a correctly
typed way
- replace all
2013 Nov 10
1
[LLVMdev] about creating the first value of the storeinst
Dear All
I'm trying to create storeInst using
StoreInst *SI = new StoreInst(val, AI, BB);
AI is an alloca instruction previously created, BB is the basicBlock I want to put instructionsi in. Val is the value to store.
I've created val from a genericValue like this:
Value* val = ConstantInt::get(getGlobalContext(), Result.IntVal);
Result is the genericValue
However I keep getting
2009 Aug 23
1
[LLVMdev] Having JIT resolve extern "C" functions declared in executible
2009/8/22 Bill Wendling <isanbard at gmail.com>:
> I think you might have to provide an empty list if your function doesn't
> take parameters. Maybe using an irbuilder would help?
It does take one parameter. Here's the important bits:
// My Function
extern "C"
void print(double X) {
printf("%f\n", X);
}
// Args type
std::vector<const Type*>