search for: typebuilder

Displaying 20 results from an estimated 23 matches for "typebuilder".

2010 Feb 08
1
[LLVMdev] TypeBuilder for const void*
Hi! In Line 230 of llvm\Support\TypeBuilder.h is support for void*: /// void* is disallowed in LLVM types, but it occurs often enough in C code that /// we special case it. template<> class TypeBuilder<void*, false> : public TypeBuilder<types::i<8>*, false> {}; If would be cool if the same thing can be added fo...
2009 Aug 25
0
[LLVMdev] Simplifying a front-end project
...eclarations, functions, instructions, etc., is non- > trivial also and the less error-prone we can make it for them, the > better. > > Otherwise, is there any other way they can write their translator that > is easier than learning the LLVM APIs for building up the IR? Are you using TypeBuilder (http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/include/llvm/Support/TypeBuilder.h?view=markup, new in 2.6) and IRBuilder, or trying to use the individual type and value classes directly? I recommend the builders when they support what you need. I don't think they'll ever comp...
2010 Nov 29
0
[LLVMdev] FunctionType as a function argument
You need a pointer-to-function type, but FunctionType just gives you a function type. Use PointerType::getUnqual(FunctionType::get(...)). Or TypeBuilder<char (*func)(void*), false>::get(context) from Support/TypeBuilder.h. On Mon, Nov 29, 2010 at 10:37 AM, Salomon Brys <salomon.brys at gmail.com>wrote: > Hi all. > I would like to declare a function that takes a function pointer as an > argument. > In C, it would be : >...
2010 Nov 29
3
[LLVMdev] FunctionType as a function argument
Hi all. I would like to declare a function that takes a function pointer as an argument. In C, it would be : void execute(char (*func)(void*), void *param) So, in my compiler, I have : std::vector<const Type *> cbFPtrArgs(1, Type::getInt8PtrTy(C)); FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C), cbFPtrArgs, false); Function * func =
2009 Aug 25
4
[LLVMdev] Simplifying a front-end project
For my introductory Compiler Construction class, I have been giving the students a project to write a simple compiler for a toy, single- inheritance object-oriented language. We give them a set of classes implementing an AST for the language and a type checker as well. The students write (1) a scanner and parser to build the AST; (2) a translator from AST to LLVM; and (3) a couple of
2013 Feb 17
2
[LLVMdev] Emitting recursive types
Hi, I'm having a play with LLVM to implement a custom language (for my intellectual curiosity only). I'm wondering how, when using IRBuilder, one can can it to emit a recursive type definition? The code for TypeBuilder explicitly states that it doesn't handle recursive types... I'm after being able to emit, programmatically, stuff like the Named Types example in the Language Reference: %mytype = type { %mytype*, i32 } I'd welcome any advice! Yours, James Jackson. -------------- next part ----------...
2010 Aug 09
3
[LLVMdev] llvm "iword" type
That and the possibility of differently sized pointers made me hesitate to dive into implementing this. I guess nailing it down to be the platform equivalent of size_t would be sensible here. On Mon, Aug 9, 2010 at 1:37 PM, Eugene Toder <eltoder at gmail.com> wrote: > Small nitpick: size_t is not guaranteed to be large enough to hold a > pointer (only an array index, which can be
2011 Sep 22
2
[LLVMdev] How to const char* Value for function argument
Hi, I'm trying to replace function call with call to wrapper(function_name, num_args, ...), where varargs hold args of original call. Function* launch = Function::Create( TypeBuilder<int(const char*, int, ...), false>::get(context), GlobalValue::ExternalLinkage, "kernelgen_launch_", m2); { CallInst* call = dyn_cast<CallInst>(cast<Value>(I)); if (!call) continue; Function* callee = call->getCalledFunction(); if (!callee &...
2010 Aug 09
0
[LLVMdev] llvm "iword" type
...rg is handled specially be llvm-gcc/clang, because it's not >>> implemented on all platforms. >>> >>> You can hide a lot of this in a platform dependent .bc file that you >>> ship with your front-end, or have your front-end build for you. >>> Support/TypeBuilder.h has some macros you might find useful for >>> generating a Module with a platform-independent API that does the >>> necessary typecasting for you to call platform-dependent stuff. >>> TypeBuilder takes a compile-type C/C++ type and turns it into an >>> llvm::Ty...
2010 Aug 09
0
[LLVMdev] llvm "iword" type
I looked through the "intp" thread. I don't really want to start that argument up again, but my immediate thought would be to create a new class of "picked-by-the-target" integer types (equivelents of size_t, intptr_t, etc...), and two new instructions, zcast and scast, which are only valid in the context of casting to / from integer types of unknown sizes. To begin with,
2011 Sep 22
0
[LLVMdev] How to const char* Value for function argument
...ptember 2011 11:06 To: LLVM-Dev Subject: [LLVMdev] How to const char* Value for function argument Hi, I'm trying to replace function call with call to wrapper(function_name, num_args, ...), where varargs hold args of original call. Function* launch = Function::Create( TypeBuilder<int(const char*, int, ...), false>::get(context), GlobalValue::ExternalLinkage, "kernelgen_launch_", m2); { CallInst* call = dyn_cast<CallInst>(cast<Value>(I));...
2009 Jun 18
1
[LLVMdev] User question, using IRBuilder to generate a llvm.memcpy instruction.
Hello, If this is not the correct list to ask this question on I apologize. I am attempting to generate a llvm.memcpy instruction with an IRBuilder but I cannot find the appropriate way to do this. Thanks in advance, Sean -- Sean (Fritz) McQuillan - http://sean-mcquillan.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL:
2010 Mar 24
1
[LLVMdev] How to add extern function declaratioin to llvm bc?
Dear all, I am wondering if there is some API to add extern function declaration to bc file. For example, as given below, I want to add the line "extern void foo();" to my bc file with some llvm methods, how can I do this, please? extern void foo(); // the llvm bc code is: declare void @_Z3foov(). How can I add this line to llvm bc using some llvm methods?
2013 Apr 18
3
[LLVMdev] inserting a function into a module
I'm looking for an example of how to insert a new function into a module. I have a module pass that needs to create some new functions. Tia. Reed
2010 Aug 18
1
[LLVMdev] clang: call extern function using JIT
...t; #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "llvm/DerivedTypes.h" #include "llvm/Support/TypeBuilder.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Config/config.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/Config/config.h" #include "llvm/ExecutionEngine/ExecutionE...
2012 Sep 24
0
[LLVMdev] [llvm-commits] Fwd: Re: [PATCH] Fix for bug in JIT exception table allocation
...return result; + } +}; + +class JITExceptionMemoryTest : public JITTest { + protected: + virtual RecordingJITMemoryManager* CreateMemoryManager() { + return new ExceptionMemoryManagerMock; + } +}; + +TEST_F(JITExceptionMemoryTest, ExceptionTableOverflow) { + Function *F = Function::Create(TypeBuilder<void(void), false>::get(Context), + Function::ExternalLinkage, + "func1", M); + BasicBlock *Block = BasicBlock::Create(Context, "block", F); + IRBuilder<> Builder(Block); + Builder.CreateRetVoid(); +...
2012 Aug 22
1
[LLVMdev] [PATCH] Fix for bug in JIT exception table allocation (no test yet)
On Aug 21, 2012, at 2:12 PM, Michael Muller <mmuller at enduden.com> wrote: > > Hi, I found a bug in the code that generates exception tables, I've attached > what I think is the correct fix. > > When you run out of space writing to a buffer, the buffer management code > simply stops writing at the end of the buffer. It is the responsibility of > the caller to
2012 Aug 23
0
[LLVMdev] [PATCH] Fix for bug in JIT exception table allocation (no test yet)
Eric Christopher wrote: > > On Aug 21, 2012, at 2:12 PM, Michael Muller <mmuller at enduden.com> wrote: > > > > > Hi, I found a bug in the code that generates exception tables, I've attached > > what I think is the correct fix. > > > > When you run out of space writing to a buffer, the buffer management code > > simply stops writing at the
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
I tried what you said, now I get: LLVM ERROR: Program used external function 'yipee' which could not be resolved! Stack dump: 0. Running pass 'X86 Machine Code Emitter' on function '@main' did not even get as far as a breakpoint. Óscar Fuentes wrote: > > gafferuk <gafferuk at gmail.com> writes: > >> Im confused. The function i wish to call is
2010 Aug 18
2
[LLVMdev] clang: call extern function using JIT
gafferuk <gafferuk at gmail.com> writes: > Im confused. The function i wish to call is a return type of int. > Im calling it with int dd = yipee(1); > > What's wrong? Declare the function: int yipee(int); int main() { int dd = yipee(1); return 0; } If that still crashes, put a breakpoint on `yipee' and see if the execution gets there, if the argument is