Displaying 20 results from an estimated 12000 matches similar to: "[LLVMdev] structure packing and misaligned members"
2013 May 12
0
[LLVMdev] structure packing and misaligned members
Hi edA-qa mort-ora-y,
On 12/05/13 17:13, edA-qa mort-ora-y wrote:
> I'm trying to determine how to do my packed structure compilation and am
> a bit unclear about how packed structures are handled. Consider this
> structure:
>
> %struct.packed = type <{ i8, i32 }>
>
> Now if I get a pointer to the i32 element the pointer will not be
> properly aligned for a
2013 May 12
1
[LLVMdev] structure packing and misaligned members
On 12/05/13 17:50, Duncan Sands wrote:
> in LLVM, pointer types don't have an alignment associated with them.
> Instead it is pointer operations that have an alignment (when relevant),
> for example load and store instructions have an optional alignment. So
> you need to put the alignment information onto the loads and stores that
> you generate in your front-end.
Okay, so I
2018 Apr 18
4
A struct {i8,i64} has size == 12, clang says size 16
I'm creating a struct of `{i8,i64}` and `DataLayout::getTypeAllocSize`
is returning `12`. `getStructLayout` also gives an `4` offset for the
second element.
The native ABI, and clang, for the same type are producing a size of 16,
with an alignment of 8, for the second element.
This is for the system triple "x86_64-linux-gnu"
What could be causing this difference in alignment and
2012 Dec 30
2
[LLVMdev] alignment issue, getting corrupt double values
I'm having an issue where a certain set of types and insert/extractvalue
are producing the incorrect values. It appears as though extractvalue
getting my sub-structure is not getting the correct data.
I have these types:
%outer = type { i32, %inner, i1 }
%inner = type { double, i32 }
The trouble is that when I have a value of type %outer then proceed to
extract the components of the
2013 Nov 08
2
[LLVMdev] UNREACHABLE executed at MCJIT.cpp:322!
That makes it more mysterious then since I am indeed only calling a main
function. Perhaps I have to invoke it a different way. Here's my call I
have now:
auto main = linker->getModule()->getFunction( "main" );
std::vector<llvm::GenericValue> args(2);
args[0].IntVal = llvm::APInt( platform::abi_int_size, 0 );
args[1].PointerVal = nullptr;
llvm::GenericValue gv =
2012 Nov 11
4
[LLVMdev] IR sizeof?
Is there a way to get the size of a type in the IR assembly code? I know
the size must be known since alloca and getelementptr both implicitly
use it, but I don't see any way to get access to the size directly.
I know my final compiler will have to get the size itself, but I'm just
doing some simple tests directly in assembly now and am hoping there is
an easy way to get the size of a
2018 Apr 18
3
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
Yes, but why is it even copying the memory? It already has a pointer
which it can cast and load from -- and does so in other scenarios.
I'm wondering whether this copying is somehow required and I'm missing
something, or it's just an artifact of the clang emitter. That is, could
it not omit the memcpy and cast the original variable?
On 18/04/18 19:43, Krzysztof Parzyszek via
2013 Nov 08
1
[LLVMdev] UNREACHABLE executed at MCJIT.cpp:322!
It was the return type which was i64. I changed it also to my
abi_int_size and it works now. I have to take care of a few other type
translations, but it looks like MCJIT is working now.
Thank you.
On 08/11/13 18:12, Yaron Keren wrote:
> Something must be wrong with the Function Type. Try to debug into
> runFunction to see which if condition fails.
> Just a guess, if this is on 64
2012 Dec 30
0
[LLVMdev] alignment issue, getting corrupt double values
I also saw this issue before. Llvm seems have trouble returning general
struct values from functions. One easy workaround is to use packed struct
type.
Hope this helps.
-Peng
On Sunday, December 30, 2012, edA-qa mort-ora-y wrote:
> I'm having an issue where a certain set of types and insert/extractvalue
> are producing the incorrect values. It appears as though extractvalue
>
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
2013 Nov 08
0
[LLVMdev] UNREACHABLE executed at MCJIT.cpp:322!
Something must be wrong with the Function Type. Try to debug into
runFunction to see which if condition fails.
Just a guess, if this is on 64 bit system the first argument type may be
int64 but needs to be int32.
Yaron
2013/11/8 edA-qa mort-ora-y <eda-qa at disemia.com>
> That makes it more mysterious then since I am indeed only calling a main
> function. Perhaps I have to invoke
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 18
2
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
Yes, I understand that as well (it's what I'm trying to recreate in my
language now).
I'm really wondering why it does the copy, since from what I can tell it
could just as easily cast the original value and do the load without the
memcpy operation.
That is, the question is about the memcpy and extra alloca -- I
understand what it's doing, just not why it's doing it this way.
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
>
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:
2013 Nov 08
2
[LLVMdev] UNREACHABLE executed at MCJIT.cpp:322!
I'm trying to get MCJIT working but I get the following errors:
Full-featured argument passing not supported yet!
UNREACHABLE executed at MCJIT.cpp:322!
I'm sure the first one will be a problem, but the second one prevents me
from testing anything. I don't know how to fix the problem.
My code works when using the non-MC JIT, and I added to my EngineBuilder:
.setUseMCJIT(true)
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
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 Oct 17
4
[LLVMdev] post-link Dwarf information appears wrong, works in JIT
I'm working on exception handling and having some trouble with type
information. My personality/types work fine when running in the JIT, but
when I produce object files and link them it fails.
In particular, from an action record and the LSDA I get a type table
entry. The problem is this doesn't appear to be pointing to a valid
location. If I derefence it a segfault occurs.
Are there
2012 Nov 02
4
[LLVMdev] Instruction does not dominate all uses! <badref> ??
I'm having trouble figuring out what the error "Instruction does not
dominate all uses!" means. I'm trying to construct a call to a function
with two parameters. The printed IR, with error, looks like this:
define i32 @add(i32, i32) {
EntryBlock:
%2 = add i32 %0, %1
ret i32 %2
}
define i32 @eval_expr() {
EntryBlock:
ret i32 <badref>
}
Instruction does not dominate