Skip to content

Instantly share code, notes, and snippets.

@jroelofs
Last active August 29, 2015 14:02
Show Gist options
  • Save jroelofs/3659bed8c1a7751bc5dc to your computer and use it in GitHub Desktop.
Save jroelofs/3659bed8c1a7751bc5dc to your computer and use it in GitHub Desktop.
CLANG: objdump of libcxx/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp built with -Os
rv_value.pass.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <main>:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
0: e92d4810 push {r4, fp, lr}
4: e28db004 add fp, sp, #4
8: e24dd00c sub sp, sp, #12
c: e1a0000d mov r0, sp
10: e3a01000 mov r1, #0
pointer __prev_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY
__list_node_base()
: __prev_(static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this))),
14: e58d0000 str r0, [sp]
__next_(static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this)))
18: e58d0004 str r0, [sp, #4]
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
typedef const _T2& _T2_const_reference;
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
: __first_(_VSTD::forward<_T1_param>(__t1)) {}
1c: e58d1008 str r1, [sp, #8]
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test(std::list<std::unique_ptr<int> >());
20: ebfffffe bl 0 <main>
24: e1a0000d mov r0, sp
}
template <class _Tp, class _Alloc>
__list_imp<_Tp, _Alloc>::~__list_imp()
{
clear();
28: ebfffffe bl 0 <main>
2c: e3a00000 mov r0, #0
#endif
}
30: e24bd004 sub sp, fp, #4
34: e8bd4810 pop {r4, fp, lr}
38: e12fff1e bx lr
3c: e1a04000 mov r4, r0
40: e1a0000d mov r0, sp
44: ebfffffe bl 0 <main>
48: e1a00004 mov r0, r4
4c: ebfffffe bl 0 <_Unwind_Resume>
Disassembly of section .text._Z4testINSt3__14listINS0_10unique_ptrIiNS0_14default_deleteIiEEEENS0_9allocatorIS5_EEEEEvT_:
00000000 <_Z4testINSt3__14listINS0_10unique_ptrIiNS0_14default_deleteIiEEEENS0_9allocatorIS5_EEEEEvT_>:
#include <memory>
#include <cassert>
template <class C>
void
test(C c)
0: e92d4810 push {r4, fp, lr}
4: e28db004 add fp, sp, #4
8: e24dd004 sub sp, sp, #4
c: e1a04000 mov r4, r0
10: e3a0000c mov r0, #12
14: ebfffffe bl 0 <_Znwj>
18: e3a01000 mov r1, #0
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
: _T2(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
is_nothrow_move_constructible<_T2>::value)
: _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {}
1c: e5801008 str r1, [r0, #8]
{
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
20: e5941004 ldr r1, [r4, #4]
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l)
{
__p->__prev_->__next_ = __f;
24: e5912000 ldr r2, [r1]
28: e5820004 str r0, [r2, #4]
__f->__prev_ = __p->__prev_;
2c: e5802000 str r2, [r0]
__p->__prev_ = __l;
30: e5810000 str r0, [r1]
__l->__next_ = __p;
34: e5801004 str r1, [r0, #4]
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
++base::__sz();
38: e5940008 ldr r0, [r4, #8]
3c: e2800001 add r0, r0, #1
40: e5840008 str r0, [r4, #8]
_LIBCPP_INLINE_VISIBILITY
reference front()
{
_LIBCPP_ASSERT(!empty(), "list::front called on empty list");
return base::__end_.__next_->__value_;
44: e5940004 ldr r0, [r4, #4]
}
_LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator*() const
{return *__ptr_.first();}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return __ptr_.first();}
_LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();}
48: e5900008 ldr r0, [r0, #8]
{
std::front_insert_iterator<C> i(c);
i = typename C::value_type();
assert(c.front() == typename C::value_type());
4c: e3500000 cmp r0, #0
}
50: 024bd004 subeq sp, fp, #4
54: 08bd4810 popeq {r4, fp, lr}
58: 012fff1e bxeq lr
void
test(C c)
{
std::front_insert_iterator<C> i(c);
i = typename C::value_type();
assert(c.front() == typename C::value_type());
5c: e59f0014 ldr r0, [pc, #20] ; 78 <_Z4testINSt3__14listINS0_10unique_ptrIiNS0_14default_deleteIiEEEENS0_9allocatorIS5_EEEEEvT_+0x78>
60: e59f2014 ldr r2, [pc, #20] ; 7c <_Z4testINSt3__14listINS0_10unique_ptrIiNS0_14default_deleteIiEEEENS0_9allocatorIS5_EEEEEvT_+0x7c>
64: e59f3014 ldr r3, [pc, #20] ; 80 <_Z4testINSt3__14listINS0_10unique_ptrIiNS0_14default_deleteIiEEEENS0_9allocatorIS5_EEEEEvT_+0x80>
68: e3a0101f mov r1, #31
6c: ebfffffe bl 0 <__assert_func>
70: ebfffffe bl 0 <_Unwind_Resume>
74: ebfffffe bl 0 <_Unwind_Resume>
...
Disassembly of section .text._ZNSt3__110__list_impINS_10unique_ptrIiNS_14default_deleteIiEEEENS_9allocatorIS4_EEE5clearEv:
00000000 <_ZNSt3__110__list_impINS_10unique_ptrIiNS_14default_deleteIiEEEENS_9allocatorIS4_EEE5clearEv>:
0: e92d48f0 push {r4, r5, r6, r7, fp, lr}
4: e28db010 add fp, sp, #16
8: e1a04000 mov r4, r0
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
__list_imp(const allocator_type& __a);
~__list_imp();
void clear() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return __sz() == 0;}
c: e5940008 ldr r0, [r4, #8]
template <class _Tp, class _Alloc>
void
__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
{
if (!empty())
10: e3500000 cmp r0, #0
14: 0a000014 beq 6c <_ZNSt3__110__list_impINS_10unique_ptrIiNS_14default_deleteIiEEEENS_9allocatorIS4_EEE5clearEv+0x6c>
{
__node_allocator& __na = __node_alloc();
__node_pointer __f = __end_.__next_;
__node_pointer __l = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__unlink_nodes(__f, __l->__prev_);
18: e8940021 ldm r4, {r0, r5}
1c: e3a06000 mov r6, #0
inline _LIBCPP_INLINE_VISIBILITY
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l)
_NOEXCEPT
{
__f->__prev_->__next_ = __l->__next_;
20: e5951000 ldr r1, [r5]
24: e5902004 ldr r2, [r0, #4]
__node_pointer __f = __end_.__next_;
__node_pointer __l = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__unlink_nodes(__f, __l->__prev_);
__sz() = 0;
while (__f != __l)
28: e1550004 cmp r5, r4
inline _LIBCPP_INLINE_VISIBILITY
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l)
_NOEXCEPT
{
__f->__prev_->__next_ = __l->__next_;
2c: e5812004 str r2, [r1, #4]
__l->__next_->__prev_ = __f->__prev_;
30: e5900004 ldr r0, [r0, #4]
34: e5801000 str r1, [r0]
__node_allocator& __na = __node_alloc();
__node_pointer __f = __end_.__next_;
__node_pointer __l = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__unlink_nodes(__f, __l->__prev_);
__sz() = 0;
38: e5846008 str r6, [r4, #8]
3c: 0a00000a beq 6c <_ZNSt3__110__list_impINS_10unique_ptrIiNS_14default_deleteIiEEEENS_9allocatorIS4_EEE5clearEv+0x6c>
return __t;
}
_LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer()) _NOEXCEPT
{
pointer __tmp = __ptr_.first();
40: e5950008 ldr r0, [r5, #8]
while (__f != __l)
{
__node_pointer __n = __f;
__f = __f->__next_;
44: e5957004 ldr r7, [r5, #4]
__ptr_.first() = __p;
48: e5856008 str r6, [r5, #8]
if (__tmp)
4c: e3500000 cmp r0, #0
50: 0a000000 beq 58 <_ZNSt3__110__list_impINS_10unique_ptrIiNS_14default_deleteIiEEEENS_9allocatorIS4_EEE5clearEv+0x58>
typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT
{
static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");
static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type");
delete __ptr;
54: ebfffffe bl 0 <_ZdlPv>
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
{return _VSTD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
{return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));}
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
{::operator delete((void*)__p);}
58: e1a00005 mov r0, r5
5c: ebfffffe bl 0 <_ZdlPv>
60: e1a05007 mov r5, r7
__node_pointer __f = __end_.__next_;
__node_pointer __l = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__unlink_nodes(__f, __l->__prev_);
__sz() = 0;
while (__f != __l)
64: e1570004 cmp r7, r4
68: 1afffff4 bne 40 <_ZNSt3__110__list_impINS_10unique_ptrIiNS_14default_deleteIiEEEENS_9allocatorIS4_EEE5clearEv+0x40>
}
}
__get_db()->unlock();
#endif
}
}
6c: e8bd48f0 pop {r4, r5, r6, r7, fp, lr}
70: e12fff1e bx lr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment