t-crest / patmos-llvm

Port of the LLVM compiler infrastructure to the time-predictable processor Patmos
Other
15 stars 8 forks source link

Remove MachineModulePass from LLVM #31

Open Emoun opened 3 years ago

Emoun commented 3 years ago

A customization to LLVM that we have is llvm/CodeGen/MachineModulePass. The LLVM project has moved in a different direction, so we should get ready to do so too.

Back when we implemented MachineModulePass there was no way in LLVM to do so. Therefore, we added it to LLVM with the hope that some day LLVM would also provide it. After looking into the history of this feature, I have concluded that the LLVM project decided on a different API for doing "machine module passes". From what I can tell, they edited the codegen step of the backend to allow ModulePass to be used in it. This means MachineModulePasses can simply extend ModulePass.

As a result, I propose to move MachineModulePass into the Patmos folder for now. Then, as we port to LLVM 11, we switch to using the LLVM machine module pass infrastructure.

Note: I made a gist summarizing my finding with sources for anyone interested: here.

Emoun commented 3 years ago

We cannot trivially move MachineModulePass into the Patmos folder as the serialization pass depends on it. Serialization is also a customization of the LLVM, which means it must also be moved into the Patmos folder to continue to use MachineModulePass.

We could move the serialization into the Patmos folder, however, it seems that platin also supports ARM targets, which means it might have been the plan to add the serialization to the ARM backend too.

Emoun commented 3 years ago

Serialization is not enabled for the ARM targets, so effectively PML Import/Export is a Patmos specific pass. Will move it into the Patmos folder.

Emoun commented 3 years ago

Moving PML Import/Export into the Patmos folder results in clang failing to build, since it uses the PML.h header.