|
6 | 6 | #include "vpr_types.h"
|
7 | 7 | #include "router_delay_profiling.h"
|
8 | 8 |
|
| 9 | +#ifndef __has_attribute |
| 10 | + #define __has_attribute(x) 0 // Compatibility with non-clang compilers. |
| 11 | +#endif |
| 12 | + |
| 13 | +#if defined(COMPILER_GCC) && defined(NDEBUG) |
| 14 | +#define ALWAYS_INLINE inline __attribute__((__always_inline__)) |
| 15 | +#elif defined(COMPILER_MSVC) && defined(NDEBUG) |
| 16 | +#define ALWAYS_INLINE __forceinline |
| 17 | +#elif __has_attribute(always_inline) |
| 18 | +#define ALWAYS_INLINE __attribute__((always_inline)) // clang |
| 19 | +#else |
| 20 | +#define ALWAYS_INLINE inline |
| 21 | +#endif |
| 22 | + |
9 | 23 | //Abstract interface to a placement delay model
|
10 | 24 | class PlaceDelayModel {
|
11 | 25 | public:
|
@@ -95,9 +109,14 @@ class OverrideDelayModel : public PlaceDelayModel {
|
95 | 109 | short delta_x;
|
96 | 110 | short delta_y;
|
97 | 111 |
|
98 |
| - friend bool operator<(const t_override& lhs, const t_override& rhs) { |
99 |
| - return std::tie(lhs.from_type, lhs.to_type, lhs.from_class, lhs.to_class, lhs.delta_x, lhs.delta_y) |
100 |
| - < std::tie(rhs.from_type, rhs.to_type, rhs.from_class, rhs.to_class, rhs.delta_x, rhs.delta_y); |
| 112 | + //A combination of ALWAYS_INLINE attribute and std::lexicographical_compare |
| 113 | + //is required for operator< to be inlined by compiler. |
| 114 | + //Proper inlining of the function reduces place time by around 5%. |
| 115 | + //For more information: https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1225 |
| 116 | + friend ALWAYS_INLINE bool operator<(const t_override& lhs, const t_override& rhs) { |
| 117 | + const short *left = reinterpret_cast<const short*> (&lhs); |
| 118 | + const short *right = reinterpret_cast<const short*> (&rhs); |
| 119 | + return std::lexicographical_compare(left, left+6, right, right+6); |
101 | 120 | }
|
102 | 121 | };
|
103 | 122 |
|
|
0 commit comments