similar to: [LLVMdev] zero-sized arrays and alignment

Displaying 20 results from an estimated 8000 matches similar to: "[LLVMdev] zero-sized arrays and alignment"

2013 Nov 20
1
[LLVMdev] Aligning structures/members?
Is there a way to set the alignment of structure types and/or their members? I noticed that if I use the alignas keyword in c++ that clang introduces a bunch of [Y x i8] style padding. -- edA-qa mort-ora-y Leaf Creator Leaf - the language we always wanted http://leaflang.org/
2013 Nov 19
1
[LLVMdev] struct alignment question
On 19/11/13 08:03, Caldarale, Charles R wrote: >> X = { a, b, c, d, e } >> Y = { c, d, e } > In general, no. If a, b, and c were char, and d was an int, using > typical C alignments, there would be one slack byte between c and d > in X, whereas there would be three in Y. You could probably force > what you want with packed structures or by playing with the data >
2013 Nov 19
2
[LLVMdev] struct alignment question
Is a series of fields in a structure guaranteed to have the same layout as those fields in a structure on their own? That is, can I cast a pointer within a main structure to an equivalent type? X = { a, b, c, d, e } Y = { c, d, e } y = BitCast( StructGEP( some_x, 2 ), Y* ) Is that a valid cast? -- edA-qa mort-ora-y Leaf Creator Leaf - the language we always wanted http://leaflang.org/
2013 Dec 02
1
[LLVMdev] must store instructions really have the exact same type pointer?
I'm getting frustrated by assertions whenever I create a store inst (via builder CreateStore). I get the error "Ptr must be a pointer to Val type!" My destination is a pointer to an equivalent to the source type. The problem is that the types were created via different generation paths and the underlying structure is a distinct object (with the exact same fields). I seem to recall
2018 Apr 19
0
A struct {i8, i64} has size == 12, clang says size 16
What exactly is your alignment settings in your LLVM struct? Something like this would tell you the alignment of "something". const llvm::DataLayout dl(theModule); size_t size = dl.getPrefTypeAlignment(something); IIn "my" compiler, I don't do anything special to align structs, so it's plausibly your specific data-layout that says that i64 only needs aligning to
2018 Apr 22
1
Difference between "byval" and actually passing by value?
Super, that clarifies a lot what happens.  And yes, it's been a challenge calling C APIs with by-value structures, but I think I've got it working now, at least on x86_64 Linux. If I understood correctly, when llvm sees a struct like `foo = { i8, i64, float }` and then a function like `bar( %foo )` it is the same as the function `bar( i8, i64, float )`?  Is the call guaranteed to be byte
2018 Apr 18
2
A struct {i8, i64} has size == 12, clang says size 16
I think I see a potential issue. My ExecutionEngine setup may not be using the same target as my object code emitting, and in this test case I'm running in the ExecutionEngine.  I'll go over this code to ensure I'm creating the same triple and see if that helps -- I'm assuming it will, since I can't imagine the exact same triple with clang would produce a different layout. On
2016 Jun 28
2
[BUG] 3.8 alignment/struct padding
Hi, I have what appears to be an alignment/struct padding bug. An i64 is not correctly aligned to the 8-byte boundary, and this results in a mismatched struct size between C and LLVM. We are currently running 3.8, and did not see this bug in 3.5. Please advise. Ram -- %int128m_T = type { [2 x i64] } %cint32_T = type { i32, i32 } %creal_T = type { double, double } %struct0_T = type { float,
2018 Apr 18
0
A struct {i8, i64} has size == 12, clang says size 16
It sounds like your DataLayout may not match clang's for x86_64-linux. What does it say about the alignment of i64? On Wed, Apr 18, 2018 at 12:05 PM edA-qa mort-ora-y via llvm-dev < llvm-dev at lists.llvm.org> wrote: > I'm creating a struct of `{i8,i64}` and `DataLayout::getTypeAllocSize` > is returning `12`. `getStructLayout` also gives an `4` offset for the > second
2018 Apr 19
1
How to set Target/Triple of ExecutionEngine
Hi edaqa, You might need to set your TargetOptions before calling selectTarget. E.g. builder.setTargetOptions(Opts).selectTarget(...); Or you could just let EngineBuilder call selectTarget for you (which is what the no-argument version of EngineBuilder::create does): llvm::ExecutionEngine * ee = builder. setErrorStr( &errStr ). setEngineKind( llvm::EngineKind::JIT ).
2013 Nov 10
0
[LLVMdev] Announcing Leaf v0
I'm proud to announce Leaf <http://leaflang.org/>, a soon to be great new programming language. I've been working over a year on it now, though it's nowhere near completion. Consider this a pre-alpha prototype stage announcement. ;) A lot of my progress is due entirely to LLVM. So while Leaf has a host of features <http://leaflang.org/features/index.html>, I'd like to
2018 Apr 22
0
Subject: How to define vector element type bool in builtin function
Subject: How to define vector element type bool in builtin function hello everyone,I have defined intrinsic function like this: def int_mips_add_32 : GCCBuiltin<"__builtin_dongxin_add_32">, Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,llvm_v8i1_ty]>; Then I write a test code : typedef int v4i32 __attribute__ ((vector_size(16))); typedef bool v8i1
2018 Apr 19
0
How to set Target/Triple of ExecutionEngine
Taking one step back, I'm not clear I'm even setting the triple/DataLayout on the module correctly:     module = new llvm::Module( "test", *llvm_context );     module->setTargetTriple( platform::target->triple ); Is that enough to create an appropriate DataLayout for the module?  I don't see anyway to convert a triple to a DataLayout, so I can't call
2018 Mar 17
1
Migration from 3.8 to 6.0 questions (segfault most concerning)
I'm encountering a few problems in my migration that I haven't yet figured out. `getOrInsertFunction` is generating a SEGFAULT at FunctionType::isValidArgumentType(llvm::Type*).  I'm calling it as:     generic_ptr_ = llvm::PointerType::get( llvm::Type::getInt8Ty(context), 0 );     f_natural_int = llvm::IntegerType::get(context, 64);     module->getOrInsertFunction(        
2018 Apr 08
1
Does an array and homogeneous struct have the same layout?
Does an array of a value type and a structure containing only that type have the same alignment requirements?  That is, in C-syntax: float* array; struct point { float x; float y; } point p; array = (float*)&p; Does `array[0]` now refer to x, and `array[1]` to y? I'm creating these structures in LLVM with default packing (StructType::isPacked == false). I have a library that takes
2016 Jul 03
2
clib `open` writes a linefeed to stdout when used in the JIT
I'm having a problem with my code generating empty lines and it appears to be the CLib `open` function generating an empty line when used within the JIT-VM. If I compile my program to an exe file it doesn't happen. I also have a lot of other code running in the VM without this problem, it's somehow particular to `open`. A chunk of my IR that calls `open`: defer_body_26:
2018 Apr 19
0
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
I believe the memcpy is there just as a consequence of Clang's design - different parts of the compiler own different pieces of this, so in some sense one hand doesn't see what the other is doing. Part of it is "create an argument" (memcpying the local variable into an unnamed value) and then the next part is "oh, but that argument gets passed in registers, so decompose it
2018 May 05
2
Slow IR compilation/JIT, profiling points to LLVM?
On 05/05/18 17:58, Andres Freund wrote: > You're building LLVM with assertions enabled > (-DLLVM_ENABLE_ASSERTIONS=ON). > Some of those are fairly expensive... > Is there another way to get LLVM to check the correctness of my IR without the assertions? That's what I'm assuming I need the flag for (it's been a long time since I experimented with it) If there is no way
2013 Dec 12
1
[LLVMdev] trouble building with clang, doxygen file missing
I'm attempting to build 3.3 with clang included (by checking out clang branches/release_33 to the tools/clang directory). When I run configure I get this error: config.status: creating docs/doxygen.cfg config.status: error: cannot find input file: ./tools/clang/docs/doxygen.cfg.in Even if I "--enable-doxygen=no --enable-docs=no" I still get this error. Attempting to remove the
2018 May 05
0
Slow IR compilation/JIT, profiling points to LLVM?
Hi, Could you share how you compile IR and which version of JIT you use (Orc, MCJIT)? Could it be that you are using interpreter instead of actual JIT? Cheers, Alex. > On 5. May 2018, at 08:04, edA-qa mort-ora-y via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I'm having issues of my compiler, and JIT execution, of LLVM IR being > rather slow. It's accounting for