Displaying 20 results from an estimated 800 matches similar to: "[LLVMdev] Dynamic Creation of a simple program"
2005 Mar 16
1
[LLVMdev] Dynamic Creation of a simple program
Hi,
Given these C instructions:
==============================
struct stru { struct stru *Next; };
struct list *NewStru = malloc ( sizeof ( struct stru ) );
struct list *tmp.3;
...
tmp.3 = NewStru->Next;
==============================
LLVM generates something like this:
%tmp.0 = malloc %struct.stru ; <%struct.stru*>
%tmp.3 = getelementptr %struct.stru* %tmp.0, int 0, uint 1 ;
2006 May 01
0
[LLVMdev] printf decleration
Ok, I think I figured it out. I talked to someone, and we figured out
that when I make a call to printf with a constant string, I need to make
a global variable and use getElementPtr to reference it. The modified
call for accessing the printf is:
/* m is Module*, f is Function*, i is Instruction* */
Constant* constStr = ConstantArray::get("test\n");
GlobalVariable* gv =
2007 Mar 07
1
[LLVMdev] UIntTy, IntTy, and SByteTy
I have llvm code that uses llvm::Type::UIntTy, llvm::Type::IntTy, and
llvm::Type::SByteTy, but these are now removed. What should I use for
their replacement. If I need to specify a size for IntTy and UIntTy, I
want them to be the same size that an integer would be in C on the
platform on which I'm compiling. So, if I need the sizes is their a way
to fetch the size that an integer
2005 Apr 11
2
[LLVMdev] JIT and array pointers
On Sun, 2005-04-10 at 19:47 -0500, Chris Lattner wrote:
> On Mon, 11 Apr 2005, Paul wrote:
> > I'm trying to pass an array pointer to my run-time generated module, and
> > after a long time of searching for the answer, the only thing I got was
> > a headache. Basically I have a few arrays (few megabytes which will
> > sometimes be accessed as 8 / 16 / 32 / 64 bit
2006 May 01
2
[LLVMdev] printf decleration
I am writing a pass where I need to make a function deceleration for
printf. Below is the code I'm trying to use.
-----
bool MyPass::runOnModule(Module &m) {
vector<const Type*> args;
args.push_back(PointerType::get(Type::SByteTy));
Function* f = m.getOrInsertFunction("printf",
FunctionType::get(Type::IntTy, args, true));
-----
When I insert a call
2006 Jun 25
1
[LLVMdev] adding args to func call
This question is similar to Ryan Lefever's post on May 1, 2006 about
printf declaration. In my case, I want to insert fprintf(stderr,
...) calls. I'm new to LLVM, and I don't know what's the recipe for
putting together the arguments. Can someone give me basic
instructions or point me in the direction on what to do? I can't find
any more documentation on this. Thanks!
2005 Apr 11
0
[LLVMdev] JIT and array pointers
On Mon, 11 Apr 2005, dummy1 at boxpl.com wrote:
>> There are many possible ways to do this, can you be a bit more specific
>> about what you're trying to do?
> Here is a basic example:
Ah, ok, I see what you're trying to do. Below is some *pseudo* code for
the basic idea:
> ============================================
> unsigned int buff[4096];
>
> int main
2005 Apr 10
2
[LLVMdev] JIT and array pointers
I'm trying to pass an array pointer to my run-time generated module, and
after a long time of searching for the answer, the only thing I got was
a headache. Basically I have a few arrays (few megabytes which will
sometimes be accessed as 8 / 16 / 32 / 64 bit binary / fp values), that
will be modified by both the generated module, and my main c program, so
I would like to put those into global
2005 Apr 11
0
[LLVMdev] JIT and array pointers
On Mon, 11 Apr 2005, Paul wrote:
> I'm trying to pass an array pointer to my run-time generated module, and
> after a long time of searching for the answer, the only thing I got was
> a headache. Basically I have a few arrays (few megabytes which will
> sometimes be accessed as 8 / 16 / 32 / 64 bit binary / fp values), that
> will be modified by both the generated module, and my
2006 Mar 03
0
[LLVMdev] Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
On Thu, 2 Mar 2006, Chris Lattner wrote:
>> Any ideas what could be wrong?
>
> Sorry for the delay, please try this tarball:
> http://nondot.org/sabre/2006-03-02-llvm-gcc-4.tar.gz
Actually, do to a recent change in CVS, this tarball will probably not
work anymore. Please apply the attached (small) patch on top of it in
the gcc directory.
Worth noting, this front-end only works
2006 Mar 02
4
[LLVMdev] Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
On Thu, 2 Mar 2006, Vladimir Prus wrote:
>>> The instructions seem to have one path wrong. It says to get:
>>
>> I'll put together a tarball today. That will be easier than dealing with
>> a patch, and it will include a bunch of bugfixes since the previous email.
> Further into process, I get this error:
> In file included from
2003 Jan 28
1
[LLVMdev] Building a new struct type, etc
Hi folks,
I was just wondering if someone would be willing to tell me the best way
to make a new structure type in LLVM and get it inserted as a valid type
into a particular Module instance?
I've done the following:
vector<const Type*> types;
types.push_back(Type::UIntTy);
types.push_back(Type::UIntTy);
structType = StructType::get(types);
But
2005 Apr 07
0
[LLVMdev] arguments to standard library functions
Right now I am trying to capture the function name and the number of
arguments ,
so this following is the pass I wrote .
-------------------------------------------------------------
struct pass06a : public ModulePass {
virtual bool runOnModule(Module &M) {
std::vector<const Type*> pList;
pList.push_back( PointerType::get(Type::SByteTy) );
pList.push_back(
2002 Sep 13
0
[LLVMdev] FYI: AllocaInst & MallocInst ctor change
Just a note: I just checked in a change that corrects some very
non-intuitive behavior of the AllocaInst & MallocInst classes. Before,
the constructor would take a Type which would specify the return type of
the instruction, instead of the operand type. Now it takes the operand
type directly. More concretely:
LLVM Code:
X = alloca int ; int*
Y = malloc int * ; int**
Old C++
2005 Mar 21
3
[LLVMdev] arguments to standard library functions
HI ,
I understand that the standard C library functions are executed using the
native library of the host machine. ( for example when we execute a bytecode
to extract the profile info )
Is it possible to extract for each standard library function that is
executed , the arguments that the function is called with.
For example if printf ("%d", some_int ) when called during runtime
2006 May 17
0
[LLVMdev] Obfuscation with LLVM
Hi all,
I was trying to implement an obfuscation tool for C-code on the basis of
LLVM. I got a prototype of the simple obfuscation transformation which
converting control flow graph to something like a state machine. I am not
sure I will have time to work on extending further this tool with new
transformations like opaque predicates and decided to put here source code I
have by now with hope
2002 Sep 29
0
[LLVMdev] Re: llvm question
Sorry for the delay Lee, I was out of town yesterday. In general it's
better to send questions to the LLVMdev list...
> hi. all i want to do now is make a new SetCondInst that i can replace
> some old ones with, and it is turning out *impossible*. the first
> parameter is the opcode, which is of class BinaryOps, which turns out to
> be an enum i can't understand in
2004 May 21
1
[LLVMdev] Re: LLVMdev digest, Vol 1 #292 - 4 msgs
Hi,
Thank Brian Gaeke so much.
Following TraceBasicBlocks.cpp, I modified the code as below and could insert instruction or function I need into anywhere in Module.
But it works well without BB->getInstList().push_back(InstrCall), and if I add the BB->getInstList().push_back() following new CallInst(), I got error information when runing opt. What is the reason for it? And is it necessary
2006 Jun 30
1
[LLVMdev] instruction sequence
I'm trying to insert a call to fprintf(stderr, ...). I've looked at
the emitted assembly from llvm-gcc, and it consists of a LoadInst (of
stderr) and CallInst. It looks like this:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%tmp.1 = load %struct._IO_FILE** %stderr ; ty=%struct._IO_FILE*
%tmp.0 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf(%struct._IO_FILE* %tmp.1, sbyte*
2006 Oct 20
0
[LLVMdev] SignlessTypes: Removal of Constant[SU]Int
All,
Just in case you're not on the llvm-commits list, the classes
ConstantSInt and ConstantUInt have been removed from the LLVM C++ IR.
This affects only the CVS HEAD. A patch to llvm-gcc4 to compensate for
this should be available in the next day or so, depending on when it
gets committed and updated.
If you're maintaining a language front end or other llvm-based software,
you'll