Guest User

Untitled

a guest
Jul 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.91 KB | None | 0 0
  1. extern "C" {
  2. extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__));
  3. }
  4. typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
  5. typedef __typeof__(sizeof(int)) size_t;
  6. namespace std __attribute__ ((__visibility__ ("default"))) {
  7. }
  8. extern "C" {
  9. extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));
  10. extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
  11. extern size_t strlen (__const char *__s) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
  12. }
  13. namespace std __attribute__ ((__visibility__ ("default"))) {
  14. template<typename _Tp> inline void swap(_Tp& __a, _Tp& __b) {
  15. _Tp __tmp = (__a);
  16. __a = (__b);
  17. __b = (__tmp);
  18. }
  19. template<class _T1, class _T2> struct pair {
  20. typedef _T1 first_type;
  21. typedef _T2 second_type;
  22. _T1 first;
  23. _T2 second;
  24. pair() : first(), second() {
  25. }
  26. pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {
  27. }
  28. template<class _U1, class _U2> pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {
  29. }
  30. };
  31. template<class _T1, class _T2> inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) {
  32. return pair<_T1, _T2>(__x, __y);
  33. }
  34. template<typename _Alloc> class allocator;
  35. template<class _CharT> struct char_traits;
  36. template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string;
  37. typedef basic_string<char> string;
  38. void __throw_bad_alloc(void) __attribute__((__noreturn__));
  39. void __throw_length_error(const char*) __attribute__((__noreturn__));
  40. void __throw_out_of_range(const char*) __attribute__((__noreturn__));
  41. }
  42. namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  43. template<typename _Iterator, typename _Container> class __normal_iterator;
  44. }
  45. namespace std __attribute__ ((__visibility__ ("default"))) {
  46. struct __true_type {
  47. };
  48. struct __false_type {
  49. };
  50. template<typename, typename> struct __are_same {
  51. enum {
  52. __value = 0 };
  53. typedef __false_type __type;
  54. };
  55. template<typename _Tp> struct __is_integer {
  56. enum {
  57. __value = 0 };
  58. typedef __false_type __type;
  59. };
  60. }
  61. namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  62. template<bool _Cond, typename _Iftrue, typename _Iffalse> struct __conditional_type {
  63. typedef _Iftrue __type;
  64. };
  65. }
  66. namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  67. template<typename _Value> struct __numeric_traits_integer {
  68. static const _Value __min = (((_Value)(-1) < 0) ? (_Value)1 << (sizeof(_Value) * 8 - ((_Value)(-1) < 0)) : (_Value)0);
  69. static const _Value __max = (((_Value)(-1) < 0) ? (((((_Value)1 << ((sizeof(_Value) * 8 - ((_Value)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(_Value)0);
  70. static const bool __is_signed = ((_Value)(-1) < 0);
  71. static const int __digits = (sizeof(_Value) * 8 - ((_Value)(-1) < 0));
  72. };
  73. template<typename _Value> struct __numeric_traits_floating {
  74. static const int __max_digits10 = (2 + (std::__are_same<_Value, float>::__value ? 24 : std::__are_same<_Value, double>::__value ? 53 : 64) * 3010 / 10000);
  75. static const bool __is_signed = true;
  76. static const int __digits10 = (std::__are_same<_Value, float>::__value ? 6 : std::__are_same<_Value, double>::__value ? 15 : 18);
  77. static const int __max_exponent10 = (std::__are_same<_Value, float>::__value ? 38 : std::__are_same<_Value, double>::__value ? 308 : 4932);
  78. };
  79. template<typename _Value> struct __numeric_traits : public __conditional_type<std::__is_integer<_Value>::__value, __numeric_traits_integer<_Value>, __numeric_traits_floating<_Value> >::__type {
  80. };
  81. }
  82. namespace std __attribute__ ((__visibility__ ("default"))) {
  83. struct input_iterator_tag {
  84. };
  85. struct forward_iterator_tag : public input_iterator_tag {
  86. };
  87. template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator {
  88. typedef _Category iterator_category;
  89. typedef _Tp value_type;
  90. typedef _Distance difference_type;
  91. typedef _Pointer pointer;
  92. typedef _Reference reference;
  93. };
  94. template<typename _Iterator> struct iterator_traits {
  95. typedef typename _Iterator::iterator_category iterator_category;
  96. typedef typename _Iterator::value_type value_type;
  97. typedef typename _Iterator::difference_type difference_type;
  98. typedef typename _Iterator::pointer pointer;
  99. typedef typename _Iterator::reference reference;
  100. };
  101. template<typename _Iter> inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
  102. return typename iterator_traits<_Iter>::iterator_category();
  103. }
  104. template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type __distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) {
  105. typename iterator_traits<_InputIterator>::difference_type __n = 0;
  106. while (__first != __last) {
  107. ++__first;
  108. ++__n;
  109. }
  110. return __n;
  111. }
  112. template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type distance(_InputIterator __first, _InputIterator __last) {
  113. return std::__distance(__first, __last, std::__iterator_category(__first));
  114. }
  115. template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference> {
  116. protected: _Iterator current;
  117. public: typedef _Iterator iterator_type;
  118. typedef typename iterator_traits<_Iterator>::difference_type difference_type;
  119. typedef typename iterator_traits<_Iterator>::reference reference;
  120. typedef typename iterator_traits<_Iterator>::pointer pointer;
  121. public: reverse_iterator() : current() {
  122. }
  123. explicit reverse_iterator(iterator_type __x) : current(__x) {
  124. }
  125. reverse_iterator(const reverse_iterator& __x) : current(__x.current) {
  126. }
  127. template<typename _Iter> reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {
  128. }
  129. iterator_type base() const {
  130. return current;
  131. }
  132. reference operator*() const {
  133. _Iterator __tmp = current;
  134. }
  135. reverse_iterator operator+(difference_type __n) const {
  136. return reverse_iterator(current - __n);
  137. }
  138. reverse_iterator& operator+=(difference_type __n) {
  139. current -= __n;
  140. return *this;
  141. }
  142. reverse_iterator operator-(difference_type __n) const {
  143. return reverse_iterator(current + __n);
  144. }
  145. reverse_iterator& operator-=(difference_type __n) {
  146. current += __n;
  147. return *this;
  148. }
  149. reference operator[](difference_type __n) const {
  150. return *(*this + __n);
  151. }
  152. };
  153. }
  154. namespace std __attribute__ ((__visibility__ ("default"))) {
  155. template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
  156. if (__b < __a) return __b;
  157. return __a;
  158. }
  159. template<typename _Tp, typename _Compare> inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) {
  160. if (__comp(__a, __b)) return __b;
  161. return __a;
  162. }
  163. }
  164. typedef struct {
  165. }
  166. __mbstate_t;
  167. typedef __mbstate_t mbstate_t;
  168. namespace std __attribute__ ((__visibility__ ("default"))) {
  169. typedef long streamoff;
  170. template<typename _StateT> class fpos {
  171. private: streamoff _M_off;
  172. _StateT _M_state;
  173. public: fpos() : _M_off(0), _M_state() {
  174. }
  175. fpos(streamoff __off) : _M_off(__off), _M_state() {
  176. }
  177. operator streamoff() const {
  178. return _M_off;
  179. }
  180. void state(_StateT __st) {
  181. _M_state = __st;
  182. }
  183. _StateT state() const {
  184. return _M_state;
  185. }
  186. fpos& operator+=(streamoff __off) {
  187. _M_off += __off;
  188. return *this;
  189. }
  190. fpos& operator-=(streamoff __off) {
  191. _M_off -= __off;
  192. return *this;
  193. }
  194. fpos operator+(streamoff __off) const {
  195. fpos __pos(*this);
  196. __pos += __off;
  197. return __pos;
  198. }
  199. fpos operator-(streamoff __off) const {
  200. fpos __pos(*this);
  201. __pos -= __off;
  202. return __pos;
  203. }
  204. streamoff operator-(const fpos& __other) const {
  205. return _M_off - __other._M_off;
  206. }
  207. };
  208. typedef fpos<mbstate_t> streampos;
  209. }
  210. namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  211. }
  212. namespace std __attribute__ ((__visibility__ ("default"))) {
  213. template<> struct char_traits<char> {
  214. typedef char char_type;
  215. typedef int int_type;
  216. typedef streampos pos_type;
  217. typedef streamoff off_type;
  218. typedef mbstate_t state_type;
  219. static void assign(char_type& __c1, const char_type& __c2) {
  220. __c1 = __c2;
  221. }
  222. static bool eq(const char_type& __c1, const char_type& __c2) {
  223. return __c1 == __c2;
  224. }
  225. static bool lt(const char_type& __c1, const char_type& __c2) {
  226. return __c1 < __c2;
  227. }
  228. static int compare(const char_type* __s1, const char_type* __s2, size_t __n) {
  229. return __builtin_memcmp(__s1, __s2, __n);
  230. }
  231. static size_t length(const char_type* __s) {
  232. return __builtin_strlen(__s);
  233. }
  234. static char_type to_char_type(const int_type& __c) {
  235. return static_cast<char_type>(__c);
  236. }
  237. static int_type to_int_type(const char_type& __c) {
  238. return static_cast<int_type>(static_cast<unsigned char>(__c));
  239. }
  240. static bool eq_int_type(const int_type& __c1, const int_type& __c2) {
  241. return __c1 == __c2;
  242. }
  243. static int_type eof() {
  244. return static_cast<int_type>((-1));
  245. }
  246. static int_type not_eof(const int_type& __c) {
  247. return (__c == eof()) ? 0 : __c;
  248. }
  249. };
  250. }
  251. extern "C++" {
  252. namespace std {
  253. class exception {
  254. public: exception() throw() {
  255. }
  256. virtual ~exception() throw();
  257. virtual const char* what() const throw();
  258. };
  259. class bad_exception : public exception {
  260. public: bad_exception() throw() {
  261. }
  262. virtual ~bad_exception() throw();
  263. virtual const char* what() const throw();
  264. };
  265. typedef void (*terminate_handler) ();
  266. typedef void (*unexpected_handler) ();
  267. terminate_handler set_terminate(terminate_handler) throw();
  268. void terminate() __attribute__ ((__noreturn__));
  269. unexpected_handler set_unexpected(unexpected_handler) throw();
  270. void unexpected() __attribute__ ((__noreturn__));
  271. void __verbose_terminate_handler();
  272. }
  273. }
  274. namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  275. template<typename _Tp> class new_allocator {
  276. public: typedef size_t size_type;
  277. typedef ptrdiff_t difference_type;
  278. typedef _Tp* pointer;
  279. typedef const _Tp* const_pointer;
  280. typedef _Tp& reference;
  281. typedef const _Tp& const_reference;
  282. typedef _Tp value_type;
  283. template<typename _Tp1> struct rebind {
  284. typedef new_allocator<_Tp1> other;
  285. };
  286. new_allocator() throw() {
  287. }
  288. new_allocator(const new_allocator&) throw() {
  289. }
  290. template<typename _Tp1> new_allocator(const new_allocator<_Tp1>&) throw() {
  291. }
  292. ~new_allocator() throw() {
  293. }
  294. pointer address(reference __x) const {
  295. return &__x;
  296. }
  297. const_pointer address(const_reference __x) const {
  298. return &__x;
  299. }
  300. pointer allocate(size_type __n, const void* = 0) {
  301. }
  302. void destroy(pointer __p) {
  303. __p->~_Tp();
  304. }
  305. };
  306. }
  307. namespace std __attribute__ ((__visibility__ ("default"))) {
  308. template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
  309. public: typedef size_t size_type;
  310. typedef ptrdiff_t difference_type;
  311. typedef _Tp* pointer;
  312. typedef const _Tp* const_pointer;
  313. typedef _Tp& reference;
  314. typedef const _Tp& const_reference;
  315. typedef _Tp value_type;
  316. template<typename _Tp1> struct rebind {
  317. typedef allocator<_Tp1> other;
  318. };
  319. allocator() throw() {
  320. }
  321. allocator(const allocator& __a) throw() : __gnu_cxx::new_allocator<_Tp>(__a) {
  322. }
  323. template<typename _Tp1> allocator(const allocator<_Tp1>&) throw() {
  324. }
  325. ~allocator() throw() {
  326. }
  327. };
  328. template<typename _Alloc, bool = __is_empty(_Alloc)> struct __alloc_swap {
  329. static void _S_do_it(_Alloc&, _Alloc&) {
  330. }
  331. };
  332. }
  333. namespace std __attribute__ ((__visibility__ ("default"))) {
  334. template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function {
  335. typedef _Arg1 first_argument_type;
  336. typedef _Arg2 second_argument_type;
  337. typedef _Result result_type;
  338. };
  339. template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> {
  340. bool operator()(const _Tp& __x, const _Tp& __y) const {
  341. return __x < __y;
  342. }
  343. };
  344. }
  345. typedef struct {
  346. }
  347. cpu_set_t;
  348. typedef long int __jmp_buf[8];
  349. extern "C" {
  350. typedef struct {
  351. struct {
  352. __jmp_buf __cancel_jmp_buf;
  353. int __mask_was_saved;
  354. }
  355. __cancel_jmp_buf[1];
  356. void *__pad[4];
  357. }
  358. __pthread_unwind_buf_t __attribute__ ((__aligned__));
  359. }
  360. static inline int __gthread_active_p (void) {
  361. }
  362. typedef int _Atomic_word;
  363. namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  364. static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val) {
  365. return __sync_fetch_and_add(__mem, __val);
  366. }
  367. static inline void __atomic_add(volatile _Atomic_word* __mem, int __val) {
  368. __sync_fetch_and_add(__mem, __val);
  369. }
  370. static inline _Atomic_word __exchange_and_add_single(_Atomic_word* __mem, int __val) {
  371. _Atomic_word __result = *__mem;
  372. *__mem += __val;
  373. return __result;
  374. }
  375. static inline void __atomic_add_single(_Atomic_word* __mem, int __val) {
  376. *__mem += __val;
  377. }
  378. static inline _Atomic_word __attribute__ ((__unused__)) __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) {
  379. if (__gthread_active_p()) return __exchange_and_add(__mem, __val);
  380. else return __exchange_and_add_single(__mem, __val);
  381. }
  382. static inline void __attribute__ ((__unused__)) __atomic_add_dispatch(_Atomic_word* __mem, int __val) {
  383. if (__gthread_active_p()) __atomic_add(__mem, __val);
  384. else __atomic_add_single(__mem, __val);
  385. }
  386. }
  387. namespace std __attribute__ ((__visibility__ ("default"))) {
  388. template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
  389. typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
  390. public: typedef _Traits traits_type;
  391. typedef typename _Traits::char_type value_type;
  392. typedef _Alloc allocator_type;
  393. typedef typename _CharT_alloc_type::size_type size_type;
  394. typedef typename _CharT_alloc_type::difference_type difference_type;
  395. typedef typename _CharT_alloc_type::reference reference;
  396. typedef typename _CharT_alloc_type::const_reference const_reference;
  397. typedef typename _CharT_alloc_type::pointer pointer;
  398. typedef typename _CharT_alloc_type::const_pointer const_pointer;
  399. typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
  400. typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string> const_iterator;
  401. typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
  402. typedef std::reverse_iterator<iterator> reverse_iterator;
  403. private: struct _Rep_base {
  404. size_type _M_length;
  405. size_type _M_capacity;
  406. _Atomic_word _M_refcount;
  407. };
  408. struct _Rep : _Rep_base {
  409. typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
  410. static const size_type _S_max_size;
  411. static const _CharT _S_terminal;
  412. static size_type _S_empty_rep_storage[];
  413. static _Rep& _S_empty_rep() {
  414. void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
  415. return *reinterpret_cast<_Rep*>(__p);
  416. }
  417. bool _M_is_leaked() const {
  418. return this->_M_refcount < 0;
  419. }
  420. bool _M_is_shared() const {
  421. return this->_M_refcount > 0;
  422. }
  423. void _M_set_leaked() {
  424. this->_M_refcount = -1;
  425. }
  426. void _M_set_sharable() {
  427. this->_M_refcount = 0;
  428. }
  429. void _M_set_length_and_sharable(size_type __n) {
  430. this->_M_set_sharable();
  431. this->_M_length = __n;
  432. traits_type::assign(this->_M_refdata()[__n], _S_terminal);
  433. }
  434. _CharT* _M_refdata() throw() {
  435. return _M_refdata();
  436. }
  437. _CharT* _M_clone(const _Alloc&, size_type __res = 0);
  438. };
  439. struct _Alloc_hider : _Alloc {
  440. _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) {
  441. }
  442. _CharT* _M_p;
  443. };
  444. public: static const size_type npos = static_cast<size_type>(-1);
  445. private: mutable _Alloc_hider _M_dataplus;
  446. _CharT* _M_data() const {
  447. return _M_dataplus._M_p;
  448. }
  449. _CharT* _M_data(_CharT* __p) {
  450. return (_M_dataplus._M_p = __p);
  451. }
  452. _Rep* _M_rep() const {
  453. return &((reinterpret_cast<_Rep*> (_M_data()))[-1]);
  454. }
  455. iterator _M_ibegin() const {
  456. return iterator(_M_data());
  457. }
  458. iterator _M_iend() const {
  459. return iterator(_M_data() + this->size());
  460. }
  461. void _M_leak() {
  462. if (!_M_rep()->_M_is_leaked()) _M_leak_hard();
  463. }
  464. size_type _M_check(size_type __pos, const char* __s) const {
  465. if (__pos > this->size()) __throw_out_of_range((__s));
  466. return __pos;
  467. }
  468. void _M_check_length(size_type __n1, size_type __n2, const char* __s) const {
  469. if (this->max_size() - (this->size() - __n1) < __n2) __throw_length_error((__s));
  470. }
  471. size_type _M_limit(size_type __pos, size_type __off) const {
  472. const bool __testoff = __off < this->size() - __pos;
  473. return __testoff ? __off : this->size() - __pos;
  474. }
  475. bool _M_disjunct(const _CharT* __s) const {
  476. return (less<const _CharT*>()(__s, _M_data()) || less<const _CharT*>()(_M_data() + this->size(), __s));
  477. }
  478. static void _M_copy(_CharT* __d, const _CharT* __s, size_type __n) {
  479. if (__n == 1) traits_type::assign(*__d, *__s);
  480. else traits_type::copy(__d, __s, __n);
  481. }
  482. static void _M_move(_CharT* __d, const _CharT* __s, size_type __n) {
  483. if (__n == 1) traits_type::assign(*__d, *__s);
  484. else traits_type::move(__d, __s, __n);
  485. }
  486. static void _M_assign(_CharT* __d, size_type __n, _CharT __c) {
  487. if (__n == 1) traits_type::assign(*__d, __c);
  488. else traits_type::assign(__d, __n, __c);
  489. }
  490. template<class _Iterator> static void _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) {
  491. _M_copy(__p, __k1, __k2 - __k1);
  492. }
  493. static void _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) {
  494. _M_copy(__p, __k1, __k2 - __k1);
  495. }
  496. static int _S_compare(size_type __n1, size_type __n2) {
  497. const difference_type __d = difference_type(__n1 - __n2);
  498. if (__d > __gnu_cxx::__numeric_traits<int>::__max) return __gnu_cxx::__numeric_traits<int>::__max;
  499. else if (__d < __gnu_cxx::__numeric_traits<int>::__min) return __gnu_cxx::__numeric_traits<int>::__min;
  500. else return int(__d);
  501. }
  502. void _M_mutate(size_type __pos, size_type __len1, size_type __len2);
  503. void _M_leak_hard();
  504. static _Rep& _S_empty_rep() {
  505. return _Rep::_S_empty_rep();
  506. }
  507. public: inline basic_string();
  508. explicit basic_string(const _Alloc& __a);
  509. basic_string(const basic_string& __str);
  510. basic_string(const basic_string& __str, size_type __pos, size_type __n = npos);
  511. basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a);
  512. basic_string(const _CharT* __s, size_type __n, const _Alloc& __a = _Alloc());
  513. basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
  514. basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
  515. iterator begin() {
  516. _M_leak();
  517. return iterator(_M_data());
  518. }
  519. const_iterator begin() const {
  520. return const_iterator(_M_data());
  521. }
  522. iterator end() {
  523. _M_leak();
  524. return iterator(_M_data() + this->size());
  525. }
  526. const_iterator end() const {
  527. return const_iterator(_M_data() + this->size());
  528. }
  529. reverse_iterator rbegin() {
  530. return reverse_iterator(this->end());
  531. }
  532. const_reverse_iterator rbegin() const {
  533. return const_reverse_iterator(this->end());
  534. }
  535. reverse_iterator rend() {
  536. return reverse_iterator(this->begin());
  537. }
  538. const_reverse_iterator rend() const {
  539. return const_reverse_iterator(this->begin());
  540. }
  541. public: size_type size() const {
  542. return _M_rep()->_M_length;
  543. }
  544. size_type length() const {
  545. return _M_rep()->_M_length;
  546. _M_mutate(0, this->size(), 0);
  547. }
  548. bool empty() const {
  549. return this->size() == 0;
  550. }
  551. const_reference operator[] (size_type __pos) const {
  552. ;
  553. return _M_data()[__pos];
  554. }
  555. const_reference at(size_type __n) const {
  556. if (__n >= this->size()) __throw_out_of_range(("basic_string::at"));
  557. return _M_data()[__n];
  558. }
  559. reference at(size_type __n) {
  560. if (__n >= size()) __throw_out_of_range(("basic_string::at"));
  561. _M_leak();
  562. return _M_data()[__n];
  563. }
  564. basic_string& operator+=(const basic_string& __str) {
  565. return this->append(__str);
  566. }
  567. basic_string& operator+=(const _CharT* __s) {
  568. return this->append(__s);
  569. }
  570. basic_string& operator+=(_CharT __c) {
  571. this->push_back(__c);
  572. return *this;
  573. }
  574. basic_string& append(const basic_string& __str);
  575. basic_string& append(size_type __n, _CharT __c);
  576. template<class _InputIterator> basic_string& append(_InputIterator __first, _InputIterator __last) {
  577. return this->replace(_M_iend(), _M_iend(), __first, __last);
  578. }
  579. void push_back(_CharT __c) {
  580. const size_type __len = 1 + this->size();
  581. if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len);
  582. traits_type::assign(_M_data()[this->size()], __c);
  583. _M_rep()->_M_set_length_and_sharable(__len);
  584. }
  585. basic_string& assign(const basic_string& __str);
  586. const _CharT* c_str() const {
  587. return _M_data();
  588. }
  589. const _CharT* data() const {
  590. return _M_data();
  591. }
  592. allocator_type get_allocator() const {
  593. return _M_dataplus;
  594. }
  595. size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const {
  596. return this->find_first_not_of(__str.data(), __pos, __str.size());
  597. }
  598. size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
  599. int compare(const basic_string& __str) const {
  600. const size_type __size = this->size();
  601. const size_type __osize = __str.size();
  602. const size_type __len = std::min(__size, __osize);
  603. int __r = traits_type::compare(_M_data(), __str.data(), __len);
  604. if (!__r) __r = _S_compare(__size, __osize);
  605. return __r;
  606. }
  607. int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const;
  608. };
  609. }
  610. namespace llvm {
  611. class StringRef {
  612. public: typedef const char *iterator;
  613. static const size_t npos = ~size_t(0);
  614. typedef size_t size_type;
  615. private: const char *Data;
  616. size_t Length;
  617. size_t min(size_t a, size_t b) const {
  618. return a < b ? a : b;
  619. }
  620. size_t max(size_t a, size_t b) const {
  621. return a > b ? a : b;
  622. }
  623. public: StringRef() : Data(0), Length(0) {
  624. }
  625. StringRef(const char *Str) : Data(Str), Length(::strlen(Str)) {
  626. }
  627. StringRef(const char *data, size_t length) : Data(data), Length(length) {
  628. }
  629. StringRef(const std::string &Str) : Data(Str.data()), Length(Str.length()) {
  630. }
  631. iterator begin() const {
  632. return Data;
  633. }
  634. iterator end() const {
  635. return Data + Length;
  636. }
  637. const char *data() const {
  638. return Data;
  639. }
  640. bool empty() const {
  641. return Length == 0;
  642. }
  643. size_t size() const {
  644. return Length;
  645. }
  646. char front() const {
  647. ((!empty()) ? static_cast<void> (0) : __assert_fail ("!empty()", "/usr/local/include/llvm/ADT/StringRef.h", 98, __PRETTY_FUNCTION__));
  648. return Data[0];
  649. }
  650. char back() const {
  651. ((!empty()) ? static_cast<void> (0) : __assert_fail ("!empty()", "/usr/local/include/llvm/ADT/StringRef.h", 104, __PRETTY_FUNCTION__));
  652. return Data[Length-1];
  653. }
  654. bool equals(StringRef RHS) const {
  655. return (Length == RHS.Length && memcmp(Data, RHS.Data, RHS.Length) == 0);
  656. }
  657. bool equals_lower(StringRef RHS) const {
  658. return Length == RHS.Length && compare_lower(RHS) == 0;
  659. }
  660. int compare(StringRef RHS) const {
  661. if (int Res = memcmp(Data, RHS.Data, min(Length, RHS.Length))) return Res < 0 ? -1 : 1;
  662. if (Length == RHS.Length) return 0;
  663. return Length < RHS.Length ? -1 : 1;
  664. }
  665. int compare_lower(StringRef RHS) const;
  666. std::string str() const {
  667. return std::string(Data, Length);
  668. }
  669. char operator[](size_t Index) const {
  670. ((Index < Length && "Invalid index!") ? static_cast<void> (0) : __assert_fail ("Index < Length && \"Invalid index!\"", "/usr/local/include/llvm/ADT/StringRef.h", 144, __PRETTY_FUNCTION__));
  671. return Data[Index];
  672. }
  673. operator std::string() const {
  674. return str();
  675. }
  676. bool startswith(StringRef Prefix) const {
  677. return substr(0, Prefix.Length).equals(Prefix);
  678. }
  679. bool endswith(StringRef Suffix) const {
  680. return slice(size() - Suffix.Length, size()).equals(Suffix);
  681. }
  682. size_t find(char C, size_t From = 0) const {
  683. for (size_t i = min(From, Length), e = Length;
  684. i != e;
  685. ++i) if (Data[i] == C) return i;
  686. return npos;
  687. }
  688. size_t find(StringRef Str, size_t From = 0) const;
  689. size_t rfind(char C, size_t From = npos) const {
  690. From = min(From, Length);
  691. size_t i = From;
  692. while (i != 0) {
  693. --i;
  694. if (Data[i] == C) return i;
  695. }
  696. return npos;
  697. }
  698. size_t rfind(StringRef Str) const;
  699. size_type find_first_of(char C, size_t = 0) const {
  700. return find(C);
  701. }
  702. StringRef substr(size_t Start, size_t N = npos) const {
  703. Start = min(Start, Length);
  704. return StringRef(Data + Start, min(N, Length - Start));
  705. }
  706. StringRef slice(size_t Start, size_t End) const {
  707. Start = min(Start, Length);
  708. End = min(max(Start, End), Length);
  709. return StringRef(Data + Start, End - Start);
  710. }
  711. std::pair<StringRef, StringRef> rsplit(char Separator) const {
  712. size_t Idx = rfind(Separator);
  713. if (Idx == npos) return std::make_pair(*this, StringRef());
  714. return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
  715. }
  716. };
  717. typedef int int64_t __attribute__ ((__mode__ (__DI__)));
  718. }
  719. typedef unsigned long int uint64_t;
  720. namespace llvm {
  721. class format_object_base;
  722. class raw_ostream {
  723. private: void operator=(const raw_ostream &);
  724. raw_ostream(const raw_ostream &);
  725. char *OutBufStart, *OutBufEnd, *OutBufCur;
  726. enum BufferKind {
  727. Unbuffered = 0, InternalBuffer, ExternalBuffer }
  728. BufferMode;
  729. bool Error;
  730. public: enum Colors {
  731. BLACK=0, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, SAVEDCOLOR };
  732. explicit raw_ostream(bool unbuffered=false) : BufferMode(unbuffered ? Unbuffered : InternalBuffer), Error(false) {
  733. OutBufStart = OutBufEnd = OutBufCur = 0;
  734. }
  735. virtual ~raw_ostream();
  736. uint64_t tell() {
  737. return current_pos() + GetNumBytesInBuffer();
  738. }
  739. bool has_error() const {
  740. return Error;
  741. }
  742. void clear_error() {
  743. Error = false;
  744. }
  745. void SetBuffered();
  746. void SetBufferSize(size_t Size) {
  747. flush();
  748. SetBufferAndMode(new char[Size], Size, InternalBuffer);
  749. }
  750. size_t GetBufferSize() {
  751. if (BufferMode != Unbuffered && OutBufStart == 0) return preferred_buffer_size();
  752. return OutBufEnd - OutBufStart;
  753. }
  754. void SetUnbuffered() {
  755. flush();
  756. SetBufferAndMode(0, 0, Unbuffered);
  757. }
  758. size_t GetNumBytesInBuffer() const {
  759. return OutBufCur - OutBufStart;
  760. }
  761. void flush() {
  762. if (OutBufCur != OutBufStart) flush_nonempty();
  763. }
  764. raw_ostream &operator<<(char C) {
  765. if (OutBufCur >= OutBufEnd) return write(C);
  766. *OutBufCur++ = C;
  767. return *this;
  768. }
  769. raw_ostream &operator<<(unsigned char C) {
  770. if (OutBufCur >= OutBufEnd) return write(C);
  771. *OutBufCur++ = C;
  772. return *this;
  773. }
  774. raw_ostream &operator<<(signed char C) {
  775. if (OutBufCur >= OutBufEnd) return write(C);
  776. *OutBufCur++ = C;
  777. return *this;
  778. }
  779. raw_ostream &operator<<(StringRef Str) {
  780. size_t Size = Str.size();
  781. if (OutBufCur+Size > OutBufEnd) return write(Str.data(), Size);
  782. memcpy(OutBufCur, Str.data(), Size);
  783. OutBufCur += Size;
  784. return *this;
  785. }
  786. raw_ostream &operator<<(const char *Str) {
  787. return this->operator<<(StringRef(Str));
  788. }
  789. raw_ostream &operator<<(const std::string &Str) {
  790. return write(Str.data(), Str.length());
  791. }
  792. raw_ostream &write_hex(unsigned long long N);
  793. raw_ostream &write_escaped(StringRef Str);
  794. raw_ostream &write(unsigned char C);
  795. raw_ostream &write(const char *Ptr, size_t Size);
  796. raw_ostream &operator<<(const format_object_base &Fmt);
  797. raw_ostream &indent(unsigned NumSpaces);
  798. virtual void write_impl(const char *Ptr, size_t Size) = 0;
  799. virtual void handle();
  800. virtual uint64_t current_pos() = 0;
  801. protected: void SetBuffer(char *BufferStart, size_t Size) {
  802. SetBufferAndMode(BufferStart, Size, ExternalBuffer);
  803. }
  804. virtual size_t preferred_buffer_size();
  805. void error_detected() {
  806. Error = true;
  807. }
  808. const char *getBufferStart() const {
  809. return OutBufStart;
  810. }
  811. private: void SetBufferAndMode(char *BufferStart, size_t Size, BufferKind Mode);
  812. void flush_nonempty();
  813. void copy_to_buffer(const char *Ptr, size_t Size);
  814. ::new(static_cast<void*>(__p)) _T1(__value);
  815. }
  816. template<typename _Tp> inline void _Destroy(_Tp* __pointer) {
  817. __pointer->~_Tp();
  818. }
  819. template<bool> struct __uninitialized_fill_n {
  820. template<typename _ForwardIterator, typename _Size, typename _Tp> static void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
  821. _ForwardIterator __cur = __first;
  822. try {
  823. for (;
  824. __n > 0;
  825. --__n, ++__cur) std::_Construct(&*__cur, __x);
  826. }
  827. catch(...) {
  828. std::_Destroy(__first, __cur);
  829. throw;
  830. }
  831. }
  832. };
  833. template<typename _ForwardIterator, typename _Size, typename _Tp> inline void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
  834. typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
  835. std::__uninitialized_fill_n<__is_pod(_ValueType)>:: uninitialized_fill_n(__first, __n, __x);
  836. }
  837. template<typename _InputIterator, typename _ForwardIterator, typename _Allocator> _ForwardIterator __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _Allocator& __alloc) {
  838. _ForwardIterator __cur = __result;
  839. try {
  840. for (;
  841. __first != __last;
  842. ++__first, ++__cur) __alloc.construct(&*__cur, *__first);
  843. return __cur;
  844. }
  845. catch(...) {
  846. std::_Destroy(__result, __cur, __alloc);
  847. throw;
  848. }
  849. }
  850. template<typename _ForwardIterator, typename _Size, typename _Tp, typename _Tp2> inline void __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, const _Tp& __x, allocator<_Tp2>&) {
  851. std::uninitialized_fill_n(__first, __n, __x);
  852. }
  853. }
  854. namespace std __attribute__ ((__visibility__ ("default"))) {
  855. template<typename _Tp, typename _Alloc> struct _Vector_base {
  856. typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
  857. struct _Vector_impl : public _Tp_alloc_type {
  858. typename _Tp_alloc_type::pointer _M_start;
  859. typename _Tp_alloc_type::pointer _M_finish;
  860. typename _Tp_alloc_type::pointer _M_end_of_storage;
  861. _Vector_impl() : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) {
  862. }
  863. _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) {
  864. }
  865. };
  866. public: typedef _Alloc allocator_type;
  867. _Tp_alloc_type& _M_get_Tp_allocator() {
  868. return *static_cast<_Tp_alloc_type*>(&this->_M_impl);
  869. }
  870. _Vector_base() : _M_impl() {
  871. }
  872. _Vector_base(const allocator_type& __a) : _M_impl(__a) {
  873. }
  874. _Vector_base(size_t __n, const allocator_type& __a) : _M_impl(__a) {
  875. }
  876. public: _Vector_impl _M_impl;
  877. typename _Tp_alloc_type::pointer _M_allocate(size_t __n) {
  878. return __n != 0 ? _M_impl.allocate(__n) : 0;
  879. }
  880. void _M_deallocate(typename _Tp_alloc_type::pointer __p, size_t __n) {
  881. if (__p) _M_impl.deallocate(__p, __n);
  882. }
  883. };
  884. template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
  885. typedef typename _Alloc::value_type _Alloc_value_type;
  886. typedef _Vector_base<_Tp, _Alloc> _Base;
  887. typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
  888. public: typedef _Tp value_type;
  889. typedef typename _Tp_alloc_type::pointer pointer;
  890. typedef typename _Tp_alloc_type::const_pointer const_pointer;
  891. typedef typename _Tp_alloc_type::reference reference;
  892. typedef typename _Tp_alloc_type::const_reference const_reference;
  893. typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
  894. typedef __gnu_cxx::__normal_iterator<const_pointer, vector> const_iterator;
  895. typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
  896. typedef std::reverse_iterator<iterator> reverse_iterator;
  897. typedef size_t size_type;
  898. typedef ptrdiff_t difference_type;
  899. typedef _Alloc allocator_type;
  900. protected: using _Base::_M_allocate;
  901. using _Base::_M_deallocate;
  902. using _Base::_M_impl;
  903. using _Base::_M_get_Tp_allocator;
  904. public: vector() : _Base() {
  905. }
  906. explicit vector(const allocator_type& __a) : _Base(__a) {
  907. }
  908. explicit vector(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__n, __a) {
  909. return iterator(this->_M_impl._M_start);
  910. }
  911. const_iterator begin() const {
  912. return const_iterator(this->_M_impl._M_start);
  913. }
  914. iterator end() {
  915. return iterator(this->_M_impl._M_finish);
  916. }
  917. const_iterator end() const {
  918. return const_iterator(this->_M_impl._M_finish);
  919. }
  920. reverse_iterator rbegin() {
  921. return reverse_iterator(end());
  922. }
  923. const_reverse_iterator rbegin() const {
  924. return const_reverse_iterator(end());
  925. }
  926. protected: void _M_range_check(size_type __n) const {
  927. if (__n >= this->size()) __throw_out_of_range(("vector::_M_range_check"));
  928. }
  929. public: const_reference at(size_type __n) const {
  930. _M_range_check(__n);
  931. return (*this)[__n];
  932. }
  933. reference front() {
  934. return *begin();
  935. }
  936. const_reference front() const {
  937. return *begin();
  938. }
  939. reference back() {
  940. return *(end() - 1);
  941. }
  942. const_reference back() const {
  943. return *(end() - 1);
  944. }
  945. void push_back(const value_type& __x) {
  946. if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) {
  947. this->_M_impl.construct(this->_M_impl._M_finish, __x);
  948. ++this->_M_impl._M_finish;
  949. }
  950. else _M_insert_aux(end(), __x);
  951. }
  952. iterator erase(iterator __position);
  953. iterator erase(iterator __first, iterator __last);
  954. void swap(vector& __x) {
  955. std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
  956. std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
  957. std::swap(this->_M_impl._M_end_of_storage, __x._M_impl._M_end_of_storage);
  958. std::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(), __x._M_get_Tp_allocator());
  959. }
  960. void clear() {
  961. _M_erase_at_end(this->_M_impl._M_start);
  962. }
  963. protected: template<typename _ForwardIterator> pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last) {
  964. pointer __result = this->_M_allocate(__n);
  965. try {
  966. std::__uninitialized_copy_a(__first, __last, __result, _M_get_Tp_allocator());
  967. return __result;
  968. }
  969. catch(...) {
  970. _M_deallocate(__result, __n);
  971. throw;
  972. }
  973. }
  974. template<typename _Integer> void _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type) {
  975. this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
  976. this->_M_impl._M_end_of_storage = this->_M_impl._M_start + static_cast<size_type>(__n);
  977. _M_fill_initialize(static_cast<size_type>(__n), __value);
  978. }
  979. template<typename _InputIterator> void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) {
  980. typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory;
  981. _M_range_initialize(__first, __last, _IterCategory());
  982. }
  983. template<typename _InputIterator> void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) {
  984. for (;
  985. __first != __last;
  986. ++__first) push_back(*__first);
  987. }
  988. template<typename _ForwardIterator> void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) {
  989. const size_type __n = std::distance(__first, __last);
  990. this->_M_impl._M_start = this->_M_allocate(__n);
  991. }
  992. template<typename _Integer> void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, __true_type) {
  993. _M_fill_insert(__pos, __n, __val);
  994. }
  995. template<typename _InputIterator> void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) {
  996. typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory;
  997. _M_range_insert(__pos, __first, __last, _IterCategory());
  998. }
  999. template<typename _InputIterator> void _M_range_insert(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag);
  1000. template<typename _ForwardIterator> void _M_range_insert(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag);
  1001. void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
  1002. void _M_erase_at_end(pointer __pos) {
  1003. std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
  1004. this->_M_impl._M_finish = __pos;
  1005. }
  1006. };
  1007. }
  1008. namespace std __attribute__ ((__visibility__ ("default"))) {
  1009. }
  1010. namespace llvm {
  1011. class BitRecTy;
  1012. class BitsRecTy;
  1013. class IntRecTy;
  1014. class StringRecTy;
  1015. class ListRecTy;
  1016. class CodeRecTy;
  1017. class DagRecTy;
  1018. class RecordRecTy;
  1019. struct Init;
  1020. class UnsetInit;
  1021. class BitInit;
  1022. class BitsInit;
  1023. class IntInit;
  1024. class StringInit;
  1025. class CodeInit;
  1026. class ListInit;
  1027. class UnOpInit;
  1028. class BinOpInit;
  1029. class TernOpInit;
  1030. class DefInit;
  1031. class DagInit;
  1032. class TypedInit;
  1033. class VarInit;
  1034. class FieldInit;
  1035. class VarBitInit;
  1036. class RecordVal;
  1037. struct RecTy {
  1038. virtual ~RecTy() {
  1039. }
  1040. virtual std::string getAsString() const = 0;
  1041. void print(raw_ostream &OS) const {
  1042. OS << getAsString();
  1043. }
  1044. void dump() const;
  1045. virtual bool typeIsConvertibleTo(const RecTy *RHS) const = 0;
  1046. public: virtual Init *convertValue( UnsetInit *UI) {
  1047. return 0;
  1048. }
  1049. virtual Init *convertValue( BitInit *BI) {
  1050. return 0;
  1051. }
  1052. virtual Init *convertValue(StringInit *SI) {
  1053. return 0;
  1054. }
  1055. virtual Init *convertValue( ListInit *LI) {
  1056. return 0;
  1057. }
  1058. virtual Init *convertValue( DagInit *DI) {
  1059. return 0;
  1060. }
  1061. virtual Init *convertValue( TypedInit *TI) {
  1062. return 0;
  1063. }
  1064. virtual Init *convertValue( VarInit *VI) {
  1065. return convertValue((TypedInit*)VI);
  1066. }
  1067. virtual Init *convertValue( FieldInit *FI) {
  1068. return convertValue((TypedInit*)FI);
  1069. }
  1070. public: virtual bool baseClassOf(const BitRecTy *RHS) const {
  1071. return false;
  1072. }
  1073. virtual bool baseClassOf(const BitsRecTy *RHS) const {
  1074. return false;
  1075. }
  1076. virtual bool baseClassOf(const IntRecTy *RHS) const {
  1077. return false;
  1078. }
  1079. virtual bool baseClassOf(const StringRecTy *RHS) const {
  1080. return false;
  1081. }
  1082. virtual bool baseClassOf(const ListRecTy *RHS) const {
  1083. return false;
  1084. }
  1085. virtual bool baseClassOf(const RecordRecTy *RHS) const {
  1086. return false;
  1087. }
  1088. };
  1089. class IntRecTy : public RecTy {
  1090. public: virtual Init *convertValue( UnsetInit *UI) {
  1091. return (Init*)UI;
  1092. }
  1093. virtual Init *convertValue( BitInit *BI);
  1094. virtual Init *convertValue( BitsInit *BI);
  1095. virtual Init *convertValue( IntInit *II) {
  1096. return (Init*)II;
  1097. }
  1098. virtual Init *convertValue(StringInit *SI) {
  1099. return 0;
  1100. }
  1101. virtual Init *convertValue( FieldInit *FI) {
  1102. return RecTy::convertValue(FI);
  1103. }
  1104. std::string getAsString() const {
  1105. return "int";
  1106. }
  1107. bool typeIsConvertibleTo(const RecTy *RHS) const {
  1108. return RHS->baseClassOf(this);
  1109. }
  1110. virtual bool baseClassOf(const BitRecTy *RHS) const {
  1111. return true;
  1112. return false;
  1113. }
  1114. virtual bool baseClassOf(const CodeRecTy *RHS) const {
  1115. return false;
  1116. }
  1117. };
  1118. struct Init {
  1119. virtual ~Init() {
  1120. }
  1121. virtual bool isComplete() const {
  1122. return true;
  1123. }
  1124. void print(raw_ostream &OS) const {
  1125. OS << getAsString();
  1126. }
  1127. virtual std::string getAsString() const = 0;
  1128. void dump() const;
  1129. virtual Init *convertInitializerTo(RecTy *Ty) = 0;
  1130. virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits) {
  1131. return 0;
  1132. }
  1133. virtual Init *convertInitListSlice(const std::vector<unsigned> &Elements) {
  1134. return 0;
  1135. }
  1136. virtual Init *resolveReferences(Record &R, const RecordVal *RV) {
  1137. return this;
  1138. }
  1139. };
  1140. class TypedInit : public Init {
  1141. RecTy *Ty;
  1142. public: explicit TypedInit(RecTy *T) : Ty(T) {
  1143. }
  1144. RecTy *getType() const {
  1145. return Ty;
  1146. }
  1147. virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
  1148. virtual Init *convertInitListSlice(const std::vector<unsigned> &Elements);
  1149. virtual Init *resolveBitReference(Record &R, const RecordVal *RV, unsigned Bit) = 0;
  1150. virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) = 0;
  1151. };
  1152. class IntInit : public TypedInit {
  1153. int64_t Value;
  1154. public: explicit IntInit(int64_t V) : TypedInit(new IntRecTy), Value(V) {
  1155. }
  1156. int64_t getValue() const {
  1157. return Value;
  1158. }
  1159. virtual Init *convertInitializerTo(RecTy *Ty) {
  1160. return Ty->convertValue(this);
  1161. }
  1162. virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) {
  1163. ((0 && "Illegal element reference off int") ? static_cast<void> (0) : __assert_fail ("0 && \"Illegal element reference off int\"", "utils/TableGen/Record.h", 648, __PRETTY_FUNCTION__));
  1164. return 0;
  1165. }
  1166. };
  1167. }
  1168. using namespace llvm;
  1169. int InitPtrToInt(const Init* ptr) {
  1170. const IntInit& val = dynamic_cast<const IntInit&>(*ptr);
  1171. }
Add Comment
Please, Sign In to add comment