search for: vpt_test

Displaying 13 results from an estimated 13 matches for "vpt_test".

2018 Apr 18
2
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
I'm implementing function arguments and tested this code in C:     // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty     typedef struct vpt_data {         char a;         int b;         float c;     } vpt_data;         void vpt_test( vpt_data vd ) {     }     int main() {         vpt_data v;         vpt_test(v);     } This emits an odd LLVM structure that casts to the desired struct type, but also memcpy's to a temporary structure. I'm unsure of why the memcpy is done as opposed to just casting directly?     define...
2018 Apr 18
2
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
...m implementing function arguments and tested this code in C: >> >> // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty >> typedef struct vpt_data { >> char a; >> int b; >> float c; >> } vpt_data; >> >> void vpt_test( vpt_data vd ) { >> } >> >> int main() { >> vpt_data v; >> vpt_test(v); >> } >> >> This emits an odd LLVM structure that casts to the desired struct type, >> but also memcpy's to a temporary structure. I'm uns...
2018 Apr 18
0
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
...m.org> wrote: > > I'm implementing function arguments and tested this code in C: > > // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty > typedef struct vpt_data { > char a; > int b; > float c; > } vpt_data; > > void vpt_test( vpt_data vd ) { > } > > int main() { > vpt_data v; > vpt_test(v); > } > > This emits an odd LLVM structure that casts to the desired struct type, > but also memcpy's to a temporary structure. I'm unsure of why the memcpy > is done...
2018 Apr 18
2
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
...gt;>>>      // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty >>>>      typedef struct vpt_data { >>>>          char a; >>>>          int b; >>>>          float c; >>>>      } vpt_data; >>>> >>>>      void vpt_test( vpt_data vd ) { >>>>      } >>>> >>>>      int main() { >>>>          vpt_data v; >>>>          vpt_test(v); >>>>      } >>>> >>>> This emits an odd LLVM structure that casts to the desired struct >&...
2018 Apr 18
0
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
...d this code in C: >>> >>> // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty >>> typedef struct vpt_data { >>> char a; >>> int b; >>> float c; >>> } vpt_data; >>> >>> void vpt_test( vpt_data vd ) { >>> } >>> >>> int main() { >>> vpt_data v; >>> vpt_test(v); >>> } >>> >>> This emits an odd LLVM structure that casts to the desired struct type, >>> but also memcpy...
2018 Apr 14
0
Creating a C-ABI compatible function signature with a struct
Is there some way to create a target-specific C-ABI compatible function signature using LLVM? For example, this C-Code:     typedef struct vpt_data {         char x;         int a;         char c;         float b;     } vpt_data;         void vpt_test( vpt_data vd ) { Generates a function:     define void @vpt_test(i64 %vd.coerce0, i64 %vd.coerce1) #0 { And also packs/unpacks the structure values when calling/being called. If I create the function signature `vpt_test( vpt_data vd)` in LLVM however, it will just pass the structure as is to th...
2018 Apr 18
4
A struct {i8,i64} has size == 12, clang says size 16
...ference in alignment and how can I fix it? I'm verifying the native ABI with:     // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty     #include <stddef.h>     typedef struct vpt_data {         _Bool c;         long int b;     } vpt_data;     int main() {         vpt_data v;         vpt_test(v);         auto a = sizeof(v);         auto off = offsetof(vpt_data,b);     } 16 is stored to `a` and 8 to `off`. -- edA-qa mort-ora-y http://mortoray.com/ Creator of the Leaf language http://leaflang.org/ Streaming algorithms, AI, and design on Twitch https://www.twitch.tv/mortoray Tw...
2018 Apr 18
3
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
.../dev/tty >>>>>>       typedef struct vpt_data { >>>>>>           char a; >>>>>>           int b; >>>>>>           float c; >>>>>>       } vpt_data; >>>>>> >>>>>>       void vpt_test( vpt_data vd ) { >>>>>>       } >>>>>> >>>>>>       int main() { >>>>>>           vpt_data v; >>>>>>           vpt_test(v); >>>>>>       } >>>>>> >>>>>> Th...
2018 Apr 18
0
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
...t-llvm ll_struct_arg.c -S -o /dev/tty >>>>>      typedef struct vpt_data { >>>>>          char a; >>>>>          int b; >>>>>          float c; >>>>>      } vpt_data; >>>>> >>>>>      void vpt_test( vpt_data vd ) { >>>>>      } >>>>> >>>>>      int main() { >>>>>          vpt_data v; >>>>>          vpt_test(v); >>>>>      } >>>>> >>>>> This emits an odd LLVM structure t...
2018 Apr 18
0
A struct {i8, i64} has size == 12, clang says size 16
...erifying the native ABI with: > // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty > #include <stddef.h> > typedef struct vpt_data { > _Bool c; > long int b; > } vpt_data; > int main() { > vpt_data v; > vpt_test(v); > auto a = sizeof(v); > auto off = offsetof(vpt_data,b); > } > 16 is stored to `a` and 8 to `off`. > -- > edA-qa mort-ora-y > http://mortoray.com/ > Creator of the Leaf language > http://leaflang.org/ > Streaming algori...
2018 Apr 19
0
Why does clang do a memcpy? Is the cast not enough? (ABI function args)
...> typedef struct vpt_data { > >>>>>> char a; > >>>>>> int b; > >>>>>> float c; > >>>>>> } vpt_data; > >>>>>> > >>>>>> void vpt_test( vpt_data vd ) { > >>>>>> } > >>>>>> > >>>>>> int main() { > >>>>>> vpt_data v; > >>>>>> vpt_test(v); > >>>>>> } > >>>>&...
2018 Apr 18
2
A struct {i8, i64} has size == 12, clang says size 16
...;> // clang -emit-llvm ll_struct_arg.c -S -o /dev/tty >> #include <stddef.h> >> typedef struct vpt_data { >> _Bool c; >> long int b; >> } vpt_data; >> int main() { >> vpt_data v; >> vpt_test(v); >> auto a = sizeof(v); >> auto off = offsetof(vpt_data,b); >> } > >> 16 is stored to `a` and 8 to `off`. >> -- >> edA-qa mort-ora-y >> http://mortoray.com/ >> Creator of the Leaf language >> http:/...
2018 Apr 19
0
A struct {i8, i64} has size == 12, clang says size 16
..._arg.c -S -o /dev/tty > >> #include <stddef.h> > >> typedef struct vpt_data { > >> _Bool c; > >> long int b; > >> } vpt_data; > >> int main() { > >> vpt_data v; > >> vpt_test(v); > >> auto a = sizeof(v); > >> auto off = offsetof(vpt_data,b); > >> } > > > >> 16 is stored to `a` and 8 to `off`. > >> -- > >> edA-qa mort-ora-y > >> http://mortoray.com/ > >> Creator...