Skip to content

Commit

Permalink
Replace aggregate Jit/lir/lir.h with individual headers
Browse files Browse the repository at this point in the history
Summary:
This is a header that only contains #includes. We should break it up and have users pull in the exact headers they care about instead.

Note:
lir.h includes block.h, function.h, instruction.h, operand.h, and printer.h.

Of these five, some of them include each other.
operand.h doesn't include any of the others
instruction.h includes operand.h
block.h includes instruction.h
function.h includes block.h
printer.h includes function.h and others

Thus, operand.h has the narrowest scope and printer.h has the biggest scope (it has everything). Therefore when I tested to see which of these five were necessary I started by adding all five and then removing the biggest scope ones first. This allows me to see if the biggest scope one has any essential use outside of the other header files it includes.

These were the steps I took:
1. Add all
2. Remove printer.h
    1. If fails remove the rest and just leave printer.h
3. Remove function.h
    1. If it fails remove the rest and just leave function.h
4. Remove Block.h
    1. If it fails remove the rest and just leave block.h
5. Remove Instruction.h
    1. If it fails remove the rest and just leave instruction.h
6. Remove operand.h
    1. If it fails remove the rest and just leave operand.h

I checked failure by running
OPT=-O2 Tools/scripts/facebook/configure_with_fb_toolchain.py --ccache --debug
make -j
make -j testruntime
make -j testcinder
make -j testcinder_jit

Reviewed By: alexmalyshev

Differential Revision: D52371303

fbshipit-source-id: 64b6766e4c199144444ebde4a7228c5638eb98c9
  • Loading branch information
Subbarao Garlapati authored and facebook-github-bot committed Jan 12, 2024
1 parent 3fddf3c commit 85ae9e2
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 22 deletions.
1 change: 0 additions & 1 deletion CinderX/Jit/codegen/autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#pragma once

#include "Jit/codegen/environ.h"
#include "Jit/lir/lir.h"
#include "Jit/util.h"

#include <memory>
Expand Down
1 change: 0 additions & 1 deletion CinderX/Jit/codegen/environ.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "Jit/debug_info.h"
#include "Jit/inline_cache.h"
#include "Jit/jit_rt.h"
#include "Jit/lir/lir.h"
#include "Jit/runtime.h"

#include <asmjit/asmjit.h>
Expand Down
2 changes: 1 addition & 1 deletion CinderX/Jit/codegen/gen_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "Jit/codegen/x86_64.h"
#include "Jit/hir/hir.h"
#include "Jit/jit_rt.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/printer.h"
#include "Jit/util.h"

#include <asmjit/asmjit.h>
Expand Down
1 change: 0 additions & 1 deletion CinderX/Jit/lir/block_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "Jit/lir/generator.h"
#include "Jit/lir/instruction.h"
#include "Jit/lir/lir.h"
#include "Jit/util.h"

#include <dlfcn.h>
Expand Down
2 changes: 1 addition & 1 deletion CinderX/Jit/lir/block_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Jit/codegen/code_section.h"
#include "Jit/codegen/environ.h"
#include "Jit/hir/hir.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/block.h"

#include <fmt/format.h>
#include <fmt/ostream.h>
Expand Down
2 changes: 1 addition & 1 deletion CinderX/Jit/lir/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Jit/hir/hir.h"
#include "Jit/jit_rt.h"
#include "Jit/lir/block_builder.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/function.h"

#include <memory>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion CinderX/Jit/lir/inliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "Jit/containers.h"
#include "Jit/lir/c_helper_translations.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/parser.h"

#include <shared_mutex>
Expand Down
4 changes: 1 addition & 3 deletions CinderX/Jit/lir/inliner.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#pragma once

#include "Jit/containers.h"
#include "Jit/lir/function.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/operand.h"
#include "Jit/lir/printer.h"
#include "Jit/util.h"

namespace jit {
Expand Down
3 changes: 1 addition & 2 deletions CinderX/Jit/lir/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#pragma once

#include "Jit/containers.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/operand.h"
#include "Jit/lir/printer.h"

#include <memory>
#include <string>
Expand Down
2 changes: 0 additions & 2 deletions CinderX/Jit/lir/regalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "Jit/codegen/copy_graph.h"
#include "Jit/codegen/x86_64.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/operand.h"

#include <algorithm>
#include <iostream>
Expand Down
3 changes: 1 addition & 2 deletions CinderX/Jit/lir/regalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "Jit/codegen/copy_graph.h"
#include "Jit/codegen/x86_64.h"
#include "Jit/containers.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/operand.h"
#include "Jit/lir/printer.h"
#include "Jit/log.h"
#include "Jit/util.h"

Expand Down
2 changes: 1 addition & 1 deletion CinderX/Jit/lir/rewrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Jit/codegen/environ.h"
#include "Jit/lir/block.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/printer.h"

#include <functional>
#include <memory>
Expand Down
1 change: 0 additions & 1 deletion CinderX/RuntimeTests/backend_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "Jit/jit_rt.h"
#include "Jit/lir/inliner.h"
#include "Jit/lir/instruction.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/parser.h"
#include "Jit/lir/postalloc.h"
#include "Jit/lir/postgen.h"
Expand Down
2 changes: 0 additions & 2 deletions CinderX/RuntimeTests/lir_inliner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include "Jit/jit_rt.h"
#include "Jit/lir/inliner.h"
#include "Jit/lir/instruction.h"
#include "Jit/lir/lir.h"
#include "Jit/ref.h"

#include "RuntimeTests/fixtures.h"
Expand Down
2 changes: 0 additions & 2 deletions CinderX/RuntimeTests/lir_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "Jit/hir/hir.h"
#include "Jit/hir/parser.h"
#include "Jit/lir/generator.h"
#include "Jit/lir/lir.h"
#include "Jit/lir/operand.h"
#include "Jit/lir/parser.h"
#include "Jit/lir/postgen.h"
#include "Jit/ref.h"
Expand Down

0 comments on commit 85ae9e2

Please sign in to comment.