OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [pr44919.C] - Blame information for rev 715

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } }
2
// { dg-options "-O3 -fselective-scheduling2" }
3
 
4
namespace std {
5
 
6
typedef long unsigned int size_t;
7
 
8
template class new_allocator { public: typedef size_t size_type; typedef _Tp* pointer; };
9
template class allocator: public new_allocator<_Tp> { public: typedef size_t size_type; template struct rebind { typedef allocator<_Tp1> other; }; };
10
 
11
class back_insert_iterator { };
12
template back_insert_iterator back_inserter(_Container& __x) { };
13
 
14
class vector { };
15
 
16
struct _List_node_base { };
17
struct _List_node : public _List_node_base { };
18
template struct _List_iterator { typedef _List_iterator<_Tp> _Self; typedef _Tp& reference; explicit _List_iterator(_List_node_base* __x) : _M_node(__x) { } reference operator*() const { } _Self& operator++() { } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } _List_node_base* _M_node; };
19
template class _List_base { protected: typedef typename _Alloc::template rebind<_List_node >::other _Node_alloc_type; struct _List_impl : public _Node_alloc_type { _List_node_base _M_node; }; _List_impl _M_impl; };
20
template > class list : protected _List_base<_Tp, _Alloc> { public: typedef _Tp value_type; typedef _List_iterator<_Tp> iterator; iterator begin() { } iterator end() { return iterator(&this->_M_impl._M_node); } };
21
 
22
namespace tr1 { template struct array { typedef _Tp value_type; typedef const value_type& const_reference; typedef const value_type* const_iterator; typedef size_t size_type; value_type _M_instance[_Nm ? _Nm : 1]; const_iterator begin() const { return const_iterator(&_M_instance[0]); } const_reference operator[](size_type __n) const { return _M_instance[__n]; } }; }
23
}
24
 
25
namespace X {
26
 
27
class Object { };
28
struct Has_qrt { };
29
template  struct qrt_or_not { typedef const typename F::result_type & type; };
30
template  struct Qualified_result_of : qrt_or_not { };
31
 
32
using std::tr1::array;
33
 
34
template  class Point_2 : public R_::Kernel_base::Point_2 {
35
public:
36
  typedef typename R_::Kernel_base::Point_2 RPoint_2;
37
  typedef RPoint_2 Rep;
38
  const Rep& rep() const { }
39
};
40
 
41
template  class Vector_2 : public R_::Kernel_base::Vector_2 {
42
public:
43
  typedef typename R_::Kernel_base::Vector_2 RVector_2;
44
  typedef RVector_2 Rep;
45
  const Rep& rep() const { return *this; }
46
  typedef R_ R;
47
  typename Qualified_result_of::type x() const { return R().compute_x_2_object()(*this); }
48
  typename Qualified_result_of::type y() const { return R().compute_y_2_object()(*this); }
49
  typename Qualified_result_of::type cartesian(int i) const { return (i==0) ? x() : y(); }
50
  typename Qualified_result_of::type hx() const { return R().compute_hx_2_object()(*this); }
51
  typename Qualified_result_of::type hy() const { return R().compute_hy_2_object()(*this); }
52
  typename Qualified_result_of::type hw() const { return R().compute_hw_2_object()(*this); }
53
  typename Qualified_result_of::type homogeneous(int i) const { return (i==0) ? hx() : (i==1)? hy() : hw(); }
54
};
55
 
56
template  class Segment_2 : public R_::Kernel_base::Segment_2 { };
57
template  class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 { };
58
 
59
template  const T& constant() { static const T t(i); return t; }
60
template  > class Handle_for { struct RefCounted { T t; }; typedef typename Alloc::template rebind::other Allocator; typedef typename Allocator::pointer pointer; pointer ptr_; public: typedef T element_type; const T * Ptr() const { return &(ptr_->t); } };
61
template  const T& get(const Handle_for &h) { return *(h.Ptr()); }
62
 
63
template  class PointC2 {
64
public:
65
  typedef typename R_::Vector_2 Vector_2; Vector_2 base;
66
  typedef typename Vector_2::Cartesian_const_iterator Cartesian_const_iterator; Cartesian_const_iterator cartesian_begin() const { return base.cartesian_begin(); }
67
};
68
 
69
template  class VectorC2 {
70
public:
71
  typedef typename R_::FT FT;
72
  typedef array Rep;
73
  typedef typename R_::template Handle::type Base;
74
  Base base;
75
  typedef typename Rep::const_iterator Cartesian_const_iterator;
76
  const FT & x() const { return X::get(base)[0]; }
77
  const FT & y() const { return X::get(base)[1]; }
78
  const FT & hx() const { return x(); }
79
  const FT & hy() const { return y(); }
80
  const FT & hw() const { return constant(); }
81
  Cartesian_const_iterator cartesian_begin() const { return X::get(base).begin(); }
82
};
83
 
84
template  class SegmentC2 { };
85
template  class Iso_rectangleC2 { };
86
 
87
namespace internal {
88
  template  class Segment_2_Iso_rectangle_2_pair {
89
    public:
90
      enum Intersection_results { NO_INTERSECTION };
91
      Segment_2_Iso_rectangle_2_pair(typename K::Segment_2 const *seg, typename K::Iso_rectangle_2 const *rect) ;
92
      Intersection_results intersection_type() const;
93
      mutable Intersection_results _result;
94
      typename K::Point_2 _ref_point;
95
      typename K::Vector_2 _dir;
96
      typename K::Point_2 _isomin;
97
      typename K::Point_2 _isomax;
98
      mutable typename K::FT _min, _max;
99
  };
100
  template  Object intersection( const typename K::Segment_2 &seg, const typename K::Iso_rectangle_2 &iso, const K&) {
101
    typedef Segment_2_Iso_rectangle_2_pair is_t; is_t ispair(&seg, &iso); switch (ispair.intersection_type()) { }
102
  }
103
  template  typename Segment_2_Iso_rectangle_2_pair::Intersection_results Segment_2_Iso_rectangle_2_pair::intersection_type() const {
104
    typedef typename K::RT RT;
105
    typedef typename K::FT FT;
106
    typename K::Construct_cartesian_const_iterator_2 construct_cccit;
107
    typename K::Cartesian_const_iterator_2 ref_point_it = construct_cccit(_ref_point);
108
    typename K::Cartesian_const_iterator_2 end = construct_cccit(_ref_point, 0);
109
    typename K::Cartesian_const_iterator_2 isomin_it = construct_cccit(_isomin);
110
    typename K::Cartesian_const_iterator_2 isomax_it = construct_cccit(_isomax);
111
    for (unsigned int i=0; ref_point_it != end; ++i, ++ref_point_it, ++isomin_it, ++isomax_it) {
112
      if (_dir.homogeneous(i) == RT(0)) {
113
        if ( *(ref_point_it) <*(isomin_it) ) {
114
          _result = NO_INTERSECTION;
115
        }
116
        if ( *(ref_point_it) > *(isomax_it)) {
117
          _result = NO_INTERSECTION;
118
        }
119
      } else {
120
        FT newmin, newmax;
121
        if (_dir.homogeneous(i) > RT(0)) {
122
          newmin = ( *(isomin_it) - (*ref_point_it)) / _dir.cartesian(i);
123
          newmax = ( *(isomax_it) - (*ref_point_it)) / _dir.cartesian(i);
124
        } else {
125
          newmin = ( (*isomax_it) - (*ref_point_it)) / _dir.cartesian(i);
126
          newmax = ( (*isomin_it) - (*ref_point_it)) / _dir.cartesian(i);
127
        }
128
        if (newmin > _min) _min = newmin;
129
        if (newmax <_max) _max = newmax;
130
        if (_max <_min) { return _result; }
131
      }
132
    }
133
  }
134
}
135
 
136
template  Object intersection(const Segment_2 &seg, const Iso_rectangle_2 &iso) { typedef typename K::Intersect_2 Intersect; return Intersect()(seg, iso); }
137
 
138
namespace CommonKernelFunctors {
139
  template  class Construct_cartesian_const_iterator_2 {
140
    typedef typename K::Point_2 Point_2;
141
    typedef typename K::Cartesian_const_iterator_2 Cartesian_const_iterator_2;
142
public:
143
    typedef Cartesian_const_iterator_2 result_type;
144
    Cartesian_const_iterator_2 operator()( const Point_2& p) const { return p.rep().cartesian_begin(); }
145
    Cartesian_const_iterator_2 operator()( const Point_2& p, int) const { }
146
  };
147
  template  class Intersect_2 {
148
    typedef typename K::Object_2 Object_2;
149
  public:
150
    typedef Object_2 result_type;
151
    template  Object_2 operator()(const T1& t1, const T2& t2) const { return internal::intersection(t1, t2, K()); }
152
  };
153
}
154
 
155
namespace CartesianKernelFunctors {
156
  using namespace CommonKernelFunctors;
157
  template  class Compute_x_2 : Has_qrt {
158
    typedef typename K::FT FT;
159
    typedef typename K::Vector_2 Vector_2;
160
  public:
161
    typedef FT result_type;
162
    const result_type & operator()(const Vector_2& v) const { return v.rep().x(); }
163
  };
164
  template  class Compute_y_2 : Has_qrt {
165
    typedef typename K::FT FT;
166
    typedef typename K::Vector_2 Vector_2;
167
  public:
168
    typedef FT result_type;
169
    const result_type & operator()(const Vector_2& v) const { return v.rep().y(); }
170
  };
171
  template  class Compute_hx_2 : public Has_qrt {
172
    typedef typename K::FT FT;
173
    typedef typename K::Vector_2 Vector_2;
174
  public:
175
    typedef FT result_type;
176
    const result_type & operator()(const Vector_2& v) const { return v.rep().hx(); }
177
  };
178
  template  class Compute_hy_2 : public Has_qrt {
179
    typedef typename K::FT FT;
180
    typedef typename K::Vector_2 Vector_2;
181
  public:
182
    typedef FT result_type;
183
    const result_type & operator()(const Vector_2& v) const { return v.rep().hy(); }
184
  };
185
  template  class Compute_hw_2 : public Has_qrt {
186
    typedef typename K::FT FT;
187
    typedef typename K::Vector_2 Vector_2;
188
  public:
189
    typedef FT result_type;
190
    const result_type & operator()(const Vector_2& v) const { return v.rep().hw(); }
191
  };
192
}
193
 
194
template  struct Cartesian_base {
195
  typedef K_ Kernel;
196
  typedef X::Object Object_2;
197
  typedef PointC2 Point_2;
198
  typedef VectorC2 Vector_2;
199
  typedef SegmentC2 Segment_2;
200
  typedef Iso_rectangleC2 Iso_rectangle_2;
201
  typedef typename array::const_iterator Cartesian_const_iterator_2;
202
};
203
 
204
template  struct Type_equality_wrapper : public K_base {
205
  typedef K_base Kernel_base;
206
  typedef X::Point_2 Point_2;
207
  typedef X::Vector_2 Vector_2;
208
  typedef X::Segment_2 Segment_2;
209
  typedef X::Iso_rectangle_2 Iso_rectangle_2;
210
};
211
 
212
template  struct Cartesian_base_ref_count : public Cartesian_base {
213
  typedef FT_ RT;
214
  typedef FT_ FT;
215
  template  struct Handle { typedef Handle_for type; };
216
  typedef Kernel_ K;
217
  typedef CartesianKernelFunctors::Compute_x_2 Compute_x_2;
218
  Compute_x_2 compute_x_2_object() const { }
219
  typedef CartesianKernelFunctors::Compute_y_2 Compute_y_2;
220
  Compute_y_2 compute_y_2_object() const { }
221
  typedef CartesianKernelFunctors::Compute_hx_2 Compute_hx_2;
222
  Compute_hx_2 compute_hx_2_object() const { }
223
  typedef CartesianKernelFunctors::Compute_hy_2 Compute_hy_2;
224
  Compute_hy_2 compute_hy_2_object() const { }
225
  typedef CartesianKernelFunctors::Compute_hw_2 Compute_hw_2;
226
  Compute_hw_2 compute_hw_2_object() const { }
227
  typedef CartesianKernelFunctors::Construct_cartesian_const_iterator_2 Construct_cartesian_const_iterator_2;
228
  typedef CartesianKernelFunctors::Intersect_2 Intersect_2;
229
};
230
 
231
template  struct Cartesian : public Type_equality_wrapper >, Cartesian > { };
232
 
233
template  class Ipelet_base {
234
public:
235
  typedef typename X::Point_2 Point_2;
236
  typedef typename Kernel::Segment_2 Segment_2;
237
  typedef typename Kernel::Iso_rectangle_2 Iso_rectangle_2;
238
 
239
  Iso_rectangle_2 read_active_objects () const { }
240
  struct Voronoi_from_tri{ std::list seg_list; };
241
 
242
  template  bool cast_into_seg(const T& obj,const Iso_rectangle_2& bbox,output_iterator out_it) const{ X::intersection(obj,bbox); }
243
  template void cast_into_seg(const iterator first,const iterator end, const Iso_rectangle_2& bbox, output_iterator out_it) const { for (iterator it=first; it!=end; ++it) cast_into_seg(*it,bbox,out_it); }
244
  void draw_dual_(Voronoi_from_tri& v_recup,const Iso_rectangle_2& bbox) const { std::vector seg_cont; cast_into_seg(v_recup.seg_list.begin(),v_recup.seg_list.end(),bbox,std::back_inserter(seg_cont)); }
245
  void draw_dual_in_ipe(const Iso_rectangle_2& bbox) const { Voronoi_from_tri v_recup; draw_dual_(v_recup,bbox); }
246
};
247
 
248
typedef X::Cartesian Kernel;
249
 
250
class diagrammeIpelet : public X::Ipelet_base { void protected_run(); };
251
void diagrammeIpelet::protected_run() { Iso_rectangle_2 bbox = read_active_objects( ); draw_dual_in_ipe(bbox); }
252
 
253
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.