Replies: 3 comments 15 replies
-
You'll have to explain more how you use -sroa . If you're running subprocess.run() chances are you're not using SCons properly. Sounds like (and I could be entirely wrong so please correct me), you want to compile (at least) one source file with a different set of compiler flags? Maybe |
Beta Was this translation helpful? Give feedback.
-
Really sounds like you just want to modify the |
Beta Was this translation helpful? Give feedback.
-
If you're going to replace I'd say pursuing changing the action will probably involve less hit-and-miss than trying to change the command variable. |
Beta Was this translation helpful? Give feedback.
-
What I want to achieve:
The project is already buildable with scons. In the project, I have a file
math.cpp
that depends onadd.h
and some other files. There are other files in the project, such asfruit.cpp
that I don't want to touch. The final executable depends on all these files. My goal is to apply additional LLVM passes such as-sroa
tomath.cpp
and its dependencies.What I have tried:
I added
compilation_db
to SConsstruct, and built the project normally. This exported a compilation database as a JSON file. I usedpython scons.py -Q --tree=prune math.o
to get a tree of dependencies for my math module. This gave me a list of*.h
files. I replaced*.h
with*.o
and locate these symbols in the compilation database. For each command I located this way in the compilation database, I transformed it into three commands (1) original command but with-emit-llvm
(2)opt
with bunch of passes (3) output*.o
. I manually tested these steps with one dependency and worked okay.My questions are:
(1) When I run the commands one by one through Python using
subprocess.run
, the compilation is extremely slow. Also it seems it does not skip the files that do not need to be touched. I am not sure using clang's Python interface could help. Does this sound like a good idea to you?(2) Dependency resolution is already a part of scons, and I image it is possible to do this in scons. However, it is not obvious to me how to split one command action into three based on the dependency of a specific target. Can someone give me some hints how to do this?
Beta Was this translation helpful? Give feedback.
All reactions