Closed leissa closed 10 months ago
@NeuralCoder3, @fodinabor: bump
Currently, the path of a file pass.cpp
in a plugin is
plugins/[name]/src/thorin/plug/[name]/pass/pass.cpp
.
Which seems extensively long (nearly java level).
An advantage is that the local path corresponds directly to the build path of the files.
However, conceptually, all files you want to create in the source of your plugin are usually in the thorin/plug/[name]
scope.
Hence, we could maybe shorten this and just have
plugins/[name]/src/pass/pass.cpp
.
Currently, the path of a file
pass.cpp
in a plugin isplugins/[name]/src/thorin/plug/[name]/pass/pass.cpp
. Which seems extensively long (nearly java level). An advantage is that the local path corresponds directly to the build path of the files. However, conceptually, all files you want to create in the source of your plugin are usually in thethorin/plug/[name]
scope. Hence, we could maybe shorten this and just haveplugins/[name]/src/pass/pass.cpp
.
yeah, paths are getting quite long. I do like that the src
path mirrors the include
path and your suggestion would only fix the src
files anyway. I already removed the rw
/fp
subdirs from pass
to mitigate some of the pain. Other options may include:
thorin/plug/
to thorplug
or sth like this (which I find quite weird)pass
part as this thing does not mirror a sub namespace but on the other hand, it's quite useful to have to navigateIn the end of the day, if you use a vim-plugin such as ctrlp or sth similar, the dir structure doesn't matter that much.
include/
andsrc/
include/
+src
dir structure like this:thorin::plug
such asthorin::plug::mem::SSAConstr
.plugin/fp
andplugin/rw
->plugin
I sometimes find myself moving passes between these two subdirs as they change fromFPPass
andRWPass
or vice versa and some plugins weren't using these subdirs anyway.--output-d
and spits out a dependency file similar to-M
in gccadd_thorin_plugin
got an overhaul and uses the new flag to automatically track dependencies of*.thorin
filesThe
<plugin_name>
is expected to be the name of the plugin. This means, there should be (relative to your CMakeLists.txt) a file<plugin_name>.thorin
containing the axiom declarations. This will generate a headerplug/<plugin_name>/autogen.h
that can be used in normalizers and passes to identify the axioms. The command will create three targets:thorin_internal_<plugin_name>
: This is an internal target to bootstrap the plugin, i.e. generate the header etc.thorin_interface_<plugin_name>
: This is a header-onlyINTERFACE
library that consists of all<header>
files. It "links" viaINTERFACE
with all<interface_item>
targets. This means everybody who links tothorin_interface_<plugin_name>
will also have access to the include directories of these targets. In addition,thorin_interface_<plugin_name>
depends onthorin_internal_<plugin_name>
.thorin_<plugin_name>
: This is the actualMODULE
library and conists of all<source>
files and linksPUBLIC
tothorin_interface_<plugin_name>
. Thus, all sources will have access to the headers ofthorin_interface_<plugin_name>
and to all other targets specified viaINTERFACE
. Furthermore, you can specify additionalpublic_item
targets that the module should link against asPUBLIC
. Finally, you can specify additional<private_item>
build dependencies.The
<source>
files are used to build the loadable plugin containing normalizers, passes and backends. One of the source files must export thethorin_get_plugin
function. Custom properties can be specified in theCMakeLists.txt
file, e.g. adding include paths is done withtarget_include_directories(thorin_<plugin_name> <path>...)
.