Skip to content

Commit f742d10

Browse files
[Infra] Cleaned Up Includes in Draw Dir
Cleaned up the includes in the draw files. These ones were much messier than I originally thought. Many of the header files in the draw directory included way more than they needed which was causing false dependencies anywhere in VPR which included any draw files.
1 parent 261abb6 commit f742d10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+159
-456
lines changed

vpr/src/base/vpr_api.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@
105105
#include "serverupdate.h"
106106
#endif /* NO_SERVER */
107107

108+
#ifndef NO_GRAPHICS
109+
#include "draw_global.h"
110+
#endif // NO_GRAPHICS
111+
108112
/* Local subroutines */
109113
static void free_complex_block_types();
110114

vpr/src/draw/breakpoint.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
2+
#ifndef NO_GRAPHICS
3+
14
#include "breakpoint.h"
25
#include "draw_global.h"
6+
#include "vtr_expr_eval.h"
37

48
#include <iostream>
59

6-
#ifndef NO_GRAPHICS
710
//if the user adds a "proceed move" breakpoint using the entry field in the UI, this function converts it to the equivalent expression and calls the expression evaluator. Returns true if a breakpoint is encountered
811
//the way the proceed moves breakpoint works is that it proceeds the indicated number of moves from where the placer currently is i.e if at move 3 and proceed 4 ends up at move 7
912
bool check_for_moves_breakpoints(int moves_to_proceed) {

vpr/src/draw/breakpoint.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616
* breakpoints have the same type, and the same value corresponding to the type.
1717
*/
1818

19-
#ifndef BREAKPOINT_H
20-
#define BREAKPOINT_H
19+
#pragma once
2120

22-
#include <vector>
2321
#include <string>
24-
25-
#include "move_transactions.h"
26-
#include "vtr_expr_eval.h"
22+
#include "breakpoint_state_globals.h"
2723

2824
typedef enum breakpoint_types {
2925
BT_MOVE_NUM,
@@ -133,5 +129,3 @@ BreakpointState get_current_info_b();
133129

134130
//prints current BreakpointState information to terminal when breakpoint is reached
135131
void print_current_info(bool in_placer);
136-
137-
#endif /* BREAKPOINT_H */

vpr/src/draw/breakpoint_state_globals.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef BREAKPOINT_STATE_GLOBALS
2-
#define BREAKPOINT_STATE_GLOBALS
1+
#pragma once
32

43
#include <string>
54
#include <vector>
@@ -29,5 +28,3 @@ class BreakpointStateGlobals {
2928
return &glob_breakpoint_state;
3029
}
3130
};
32-
33-
#endif

vpr/src/draw/buttons.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,10 @@
1010
* Last updated: Aug 2019
1111
*/
1212

13-
#include "draw_global.h"
1413
#include "draw.h"
15-
#include "draw_toggle_functions.h"
1614
#include "buttons.h"
17-
#include "intra_logic_block.h"
18-
#include "clustered_netlist.h"
1915

20-
#include "ezgl/point.hpp"
2116
#include "ezgl/application.hpp"
22-
#include "ezgl/graphics.hpp"
2317

2418
//location of spin buttons, combo boxes, and labels on grid
2519
gint box_width = 1;

vpr/src/draw/buttons.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
#ifndef BUTTONS_H
2-
#define BUTTONS_H
1+
#pragma once
32

43
#ifndef NO_GRAPHICS
54

6-
#include "draw_global.h"
7-
8-
#include "ezgl/point.hpp"
9-
#include "ezgl/application.hpp"
10-
#include "ezgl/graphics.hpp"
5+
#include <gtk/gtk.h>
116

127
void delete_button(const char* button_name);
138
GtkWidget* find_button(const char* button_name);
14-
#endif /* NO_GRAPHICS */
159

16-
#endif /* BUTTONS_H */
10+
#endif /* NO_GRAPHICS */

vpr/src/draw/draw.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@
1515
#include <cstdio>
1616
#include <cstring>
1717
#include <cmath>
18+
#include "draw.h"
19+
#include "timing_info.h"
20+
#include "physical_types.h"
21+
22+
#include "move_utils.h"
23+
24+
#ifndef NO_GRAPHICS
25+
1826
#include <algorithm>
1927
#include <array>
2028
#include <iostream>
2129

30+
#include "draw_debug.h"
2231
#include "vtr_assert.h"
2332
#include "vtr_ndoffsetmatrix.h"
24-
#include "vtr_memory.h"
2533
#include "vtr_log.h"
2634
#include "vtr_color_map.h"
2735
#include "vtr_path.h"
@@ -30,39 +38,27 @@
3038

3139
#include "globals.h"
3240
#include "draw_color.h"
33-
#include "draw.h"
3441
#include "draw_basic.h"
3542
#include "draw_rr.h"
36-
#include "draw_toggle_functions.h"
3743
#include "draw_searchbar.h"
3844
#include "draw_global.h"
3945
#include "intra_logic_block.h"
40-
#include "tatum/report/TimingPathCollector.hpp"
4146
#include "hsl.h"
42-
#include "route_export.h"
4347
#include "search_bar.h"
4448
#include "save_graphics.h"
45-
#include "timing_info.h"
46-
#include "physical_types.h"
4749
#include "manual_moves.h"
4850
#include "draw_noc.h"
4951
#include "draw_floorplanning.h"
5052

51-
#include "move_utils.h"
5253
#include "ui_setup.h"
5354

54-
#ifndef NO_GRAPHICS
55-
5655
//To process key presses we need the X11 keysym definitions,
5756
//which are unavailable when building with MINGW
5857
#if defined(X11) && !defined(__MINGW32__)
5958
#include <X11/keysym.h>
6059
#endif
6160

62-
#include "rr_graph.h"
63-
#include "route_utilization.h"
6461
#include "place_macro.h"
65-
#include "buttons.h"
6662
#include "draw_rr.h"
6763
/****************************** Define Macros *******************************/
6864

vpr/src/draw/draw.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,23 @@
1717
* Last updated: August 2022
1818
*/
1919

20-
#ifndef DRAW_H
21-
#define DRAW_H
20+
#pragma once
2221

23-
#include "rr_graph_fwd.h"
24-
#include "timing_info.h"
22+
#include "blk_loc_registry.h"
2523
#include "physical_types.h"
24+
#include "rr_graph_type.h"
25+
#include "timing_info.h"
26+
#include "vpr_types.h"
27+
#include <string>
2628

2729
#ifndef NO_GRAPHICS
2830

29-
#include "draw_global.h"
30-
31-
#include "ezgl/point.hpp"
31+
#include "draw_types.h"
3232
#include "ezgl/application.hpp"
33-
#include "ezgl/graphics.hpp"
34-
#include "draw_color.h"
35-
#include "search_bar.h"
36-
#include "draw_debug.h"
37-
#include "manual_moves.h"
33+
#include "ezgl/point.hpp"
34+
#include "physical_types.h"
35+
#include "rr_graph_fwd.h"
36+
#include "vtr_color_map.h"
3837
#include "vtr_ndoffsetmatrix.h"
3938

4039
extern ezgl::application::settings settings;
@@ -173,5 +172,3 @@ t_draw_layer_display get_element_visibility_and_transparency(int src_layer, int
173172
ClusterBlockId get_cluster_block_id_from_xy_loc(double x, double y);
174173

175174
#endif /* NO_GRAPHICS */
176-
177-
#endif /* DRAW_H */

vpr/src/draw/draw_basic.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* draw_basic.cpp contains all functions that draw in the main graphics area
22
* that aren't RR nodes or muxes (they have their own file).
33
* All functions in this file contain the prefix draw_. */
4+
#ifndef NO_GRAPHICS
5+
46
#include <cstdio>
57
#include <cmath>
68
#include <algorithm>
@@ -27,18 +29,14 @@
2729
#include "route_export.h"
2830
#include "tatum/report/TimingPathCollector.hpp"
2931

30-
#ifndef NO_GRAPHICS
31-
3232
//To process key presses we need the X11 keysym definitions,
3333
//which are unavailable when building with MINGW
3434
#if defined(X11) && !defined(__MINGW32__)
3535
#include <X11/keysym.h>
3636
#endif
3737

38-
#include "rr_graph.h"
3938
#include "route_utilization.h"
4039
#include "place_macro.h"
41-
#include "buttons.h"
4240

4341
/****************************** Define Macros *******************************/
4442
#define DEFAULT_RR_NODE_COLOR ezgl::BLACK

vpr/src/draw/draw_basic.h

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,23 @@
66
* All functions in this file contain the prefix draw_.
77
*/
88

9-
#ifndef DRAW_BASIC_H
10-
#define DRAW_BASIC_H
9+
#pragma once
10+
11+
#ifndef NO_GRAPHICS
1112

1213
#include <cstdio>
1314
#include <cfloat>
1415
#include <cstring>
1516
#include <cmath>
16-
#include <algorithm>
17-
#include <sstream>
18-
#include <array>
19-
#include <iostream>
20-
21-
#include "vtr_assert.h"
22-
#include "vtr_ndoffsetmatrix.h"
23-
#include "vtr_memory.h"
24-
#include "vtr_log.h"
25-
#include "vtr_color_map.h"
26-
#include "vtr_path.h"
27-
28-
#include "vpr_utils.h"
29-
#include "vpr_error.h"
3017

31-
#include "globals.h"
18+
#include "draw_types.h"
19+
#include "netlist_fwd.h"
20+
#include "rr_graph_fwd.h"
21+
#include "tatum/TimingGraphFwd.hpp"
3222

33-
#include "move_utils.h"
34-
35-
#ifndef NO_GRAPHICS
36-
37-
#include "draw_global.h"
23+
#include "vtr_color_map.h"
3824

3925
#include "ezgl/point.hpp"
40-
#include "ezgl/application.hpp"
4126
#include "ezgl/graphics.hpp"
4227

4328
/* Draws the blocks placed on the proper clbs. Occupied blocks are darker colours *
@@ -158,4 +143,3 @@ void draw_reset_blk_colors();
158143
void draw_reset_blk_color(ClusterBlockId blk_id);
159144

160145
#endif /* NO_GRAPHICS */
161-
#endif /* DRAW_BASIC_H */

vpr/src/draw/draw_color.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
* as well as a global vector of colors shuffled to prevent similar
66
* colors from being close together
77
*/
8-
#ifndef DRAW_COLOR_H
9-
#define DRAW_COLOR_H
8+
#pragma once
109

1110
#ifndef NO_GRAPHICS
1211

13-
#include "ezgl/point.hpp"
14-
#include "ezgl/application.hpp"
15-
#include "ezgl/graphics.hpp"
12+
#include <vector>
13+
#include "ezgl/color.hpp"
1614

1715
static constexpr ezgl::color blk_BISQUE(0xFF, 0xE4, 0xC4);
1816
static constexpr ezgl::color blk_LIGHTGREY(0xD3, 0xD3, 0xD3);
@@ -326,5 +324,3 @@ const std::vector<ezgl::color> block_colors{
326324
};
327325

328326
#endif /* NO_GRAPHICS */
329-
330-
#endif /* DRAW_COLOR_H */

vpr/src/draw/draw_debug.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#include "draw_debug.h"
2-
31
#ifndef NO_GRAPHICS
42

3+
#include "draw_debug.h"
4+
#include "draw_global.h"
5+
#include "vtr_expr_eval.h"
6+
57
//keeps track of open windows to avoid reopenning windows that are alerady open
68
struct open_windows {
79
bool debug_window = false;

vpr/src/draw/draw_debug.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,17 @@
44
* This file contains all functions regarding the graphics related to the setting of place and route breakpoints.
55
* Manages creation of new Gtk Windows with debug options on use of the "Debug" button.
66
*/
7-
#ifndef DRAW_DEBUG_H
8-
#define DRAW_DEBUG_H
7+
#pragma once
98

109
#ifndef NO_GRAPHICS
1110

12-
#include "breakpoint.h"
13-
#include "draw_global.h"
14-
#include "ezgl/application.hpp"
15-
#include "ezgl/graphics.hpp"
16-
17-
#include <cstdio>
1811
#include <cfloat>
19-
#include <cstring>
2012
#include <cmath>
21-
#include <algorithm>
22-
#include <sstream>
23-
#include <array>
24-
#include <iostream>
13+
#include <cstdio>
14+
#include <cstring>
15+
#include <gtk/gtk.h>
16+
#include <string>
17+
#include "breakpoint_state_globals.h"
2518

2619
/** debugger functions **/
2720
void draw_debug_window();
@@ -44,5 +37,3 @@ bool valid_expression(std::string exp);
4437
void breakpoint_info_window(std::string bpDescription, BreakpointState draw_breakpoint_state, bool in_placer);
4538

4639
#endif /*NO_GRAPHICS*/
47-
48-
#endif /*DRAW_DEBUG_H*/

vpr/src/draw/draw_floorplanning.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
#include <vector>
1+
#ifndef NO_GRAPHICS
22

3-
#include "vpr_error.h"
3+
#include <vector>
44

55
#include "globals.h"
66

77
#include "draw_floorplanning.h"
88
#include "user_place_constraints.h"
9-
#include "draw_color.h"
109
#include "draw.h"
11-
#include "read_xml_arch_file.h"
1210
#include "draw_global.h"
13-
#include "intra_logic_block.h"
14-
#include "route_export.h"
15-
#include "tatum/report/TimingPathCollector.hpp"
16-
17-
#ifndef NO_GRAPHICS
1811

1912
//To process key presses we need the X11 keysym definitions,
2013
//which are unavailable when building with MINGW

0 commit comments

Comments
 (0)