search for: alignas

Displaying 12 results from an estimated 12 matches for "alignas".

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/
2016 Sep 10
3
DebugInfo: purpose of align field
..."S", file: !5, line: 1, size: 8, align: 8, elements: !7) Am I missing something? What is the purpose of "align: 8" here? Maybe we could include alignment information into DI* objects only when required (and thus dump it only when required): for types with bitfields and when alignas() was specified in code. Please advise. -- Best Regards, Victor
2019 Jun 18
3
Retiring VS2015 Support
...with the 2 most recent releases of Visual Studio. With the release of VS2019, what do people think of retiring VS2015 support before the next major llvm/clang release? As well as simplifying C++14 migration (admittedly only a little), this should also let us remove a number of hacks (e.g. the alignas/AlignedCharArray hack in AlignOf.h), as well as re-enabling a number of warnings in HandleLLVMOptions.cmake. I haven't noticed any build bots still referring to VS2015 (at least not by name). Simon.
2013 May 10
4
[LLVMdev] [cfe-dev] "load groups" IR feature to improve C++ devirtualization
...dard, which is made difficult by the standard being contradictory on many relevant points here. Ultimately I've chosen to be very liberal about what I'm allowing to be considered a newly formed valid pointer. BTW, Richard came up with a wonderful example. What do you make of this?: char alignas(A, B) buffer[max(sizeof(A), sizeof(B))]; A *a = reinterpret_cast<A*>(buffer); B *b = reinterpret_cast<B*>(buffer); new(buffer) A; a->vfn(); new(buffer) B; b->vfn(); Valid? Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http:/...
2016 Sep 30
2
DebugInfo: purpose of align field
..., file: !5, line: 1, size: 8, align: 8, elements: !7) >> >> Am I missing something? What is the purpose of "align: 8" here? Maybe we could include alignment information into DI* objects only when required (and thus dump it only when required): for types with bitfields and when alignas() was specified in code. > What do you mean by "include" in this context? Are you arguing for making an alignment of 8 the implicit default in textual IR? Or do you want to make DICompositeType variable length? I mean that in this case alignment isn't used anywhere in code further....
2013 May 10
0
[LLVMdev] [cfe-dev] "load groups" IR feature to improve C++ devirtualization
...difficult by the standard being contradictory on many relevant points here. Ultimately I've chosen to be very liberal about what I'm allowing to be considered a newly formed valid pointer. > > BTW, Richard came up with a wonderful example. What do you make of this?: > > char alignas(A, B) buffer[max(sizeof(A), sizeof(B))]; > A *a = reinterpret_cast<A*>(buffer); > B *b = reinterpret_cast<B*>(buffer); > new(buffer) A; > a->vfn(); > new(buffer) B; > b->vfn(); > > Valid? > > Nick > > _____________________________...
2013 May 10
0
[LLVMdev] [cfe-dev] "load groups" IR feature to improve C++ devirtualization
...er to have much hope of meaningful optimization. And potentially not just across inlining, but through memory — who actually allocates polymorphic values and doesn't use smart pointers these days? > BTW, Richard came up with a wonderful example. What do you make of this?: > > char alignas(A, B) buffer[max(sizeof(A), sizeof(B))]; > A *a = reinterpret_cast<A*>(buffer); > B *b = reinterpret_cast<B*>(buffer); > new(buffer) A; > a->vfn(); > new(buffer) B; > b->vfn(); > > Valid? Let's answer a simpler question. Why is this valid...
2016 Oct 03
2
DebugInfo: purpose of align field
...gn: 8, elements: !7) > >>> > >>> Am I missing something? What is the purpose of "align: 8" here? Maybe > we could include alignment information into DI* objects only when required > (and thus dump it only when required): for types with bitfields and when > alignas() was specified in code. > >> What do you mean by "include" in this context? Are you arguing for > making an alignment of 8 the implicit default in textual IR? Or do you want > to make DICompositeType variable length? > > I mean that in this case alignment isn't u...
2013 Nov 20
0
[LLVMdev] zero-sized arrays and alignment
...or less strict. If all this is true, which testing shows on the x86_64 platform, then I can use zero-sized arrays to force the alignment of any structure element. I don't have to calculate the padding on my own (as does clang). For example, the C++ struct: struct pine { int8_t a; int8_t alignas(int32_t) b; }; Can become: type { i8, [0 x i32], i8 } -- edA-qa mort-ora-y Leaf Creator Leaf - the language we always wanted http://leaflang.org/
2013 May 10
0
[LLVMdev] [cfe-dev] "load groups" IR feature to improve C++ devirtualization
On May 9, 2013, at 6:34 PM, Nick Lewycky <nlewycky at google.com> wrote: > I'm looking into how we can improve devirtualization in clang, and there a language in C++ feature I'd like to take advantage of which would let us perform elimination of more vptr loads. In this code: > > Cls *p = new Cls; > p->virtual_method1(); > p->method_changing_vptr(); //
2013 May 10
4
[LLVMdev] "load groups" IR feature to improve C++ devirtualization
I'm looking into how we can improve devirtualization in clang, and there a language in C++ feature I'd like to take advantage of which would let us perform elimination of more vptr loads. In this code: Cls *p = new Cls; p->virtual_method1(); p->method_changing_vptr(); // uses placement new to legally change the vptr p->virtual_method2(); // invalid! Cls *q = p;
2017 Jun 21
6
RFC: Cleaning up the Itanium demangler
...data<Float>::max_demangled_size] = {0}; + int n = snprintf(num, sizeof(num), float_data<Float>::spec, value); + s += string_ref(num, num + n); + } + } +}; + +template <std::size_t N> +class arena +{ + static const std::size_t alignment = 16; + alignas(alignment) char buf_[N]; + char* ptr_; + + std::size_t + align_up(std::size_t n) noexcept + {return (n + (alignment-1)) & ~(alignment-1);} + + bool + pointer_in_buffer(char* p) noexcept + {return buf_ <= p && p <= buf_ + N;} + +public: + arena() no...