This is an archive of the discontinued LLVM Phabricator instance.

[vim] Add initial syntax definition for .mir files
ClosedPublic

Authored by porglezomp on Jan 27 2021, 11:35 AM.

Details

Summary

This initial definition handles the yaml container and the embedding of
the inner IRs. As a stopgap, this reuses the LLVM IR syntax highlighting
for the MIR function bodies--even though it's not technically correct,
it produces decent highlighting for a first pass.

Diff Detail

Event Timeline

porglezomp requested review of this revision.Jan 27 2021, 11:35 AM
porglezomp created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2021, 11:35 AM

A question for reviewers who might be able to explain:

llvm/utils/vim/syntax/machine-ir.vim
11

I actually don't need this unlet I don't think…

llvm/utils/vim/syntax/mir.vim
10

I don't understand why we bail out if a current_syntax is defined—I just copied this from the llvm.vim file. It seems to cause trouble with embedding syntax inside other syntax, but I assume it does something else useful to make up for that?

dblaikie accepted this revision.Feb 16 2021, 12:06 PM
dblaikie added a subscriber: dblaikie.

Can't say I know much about these things - but honestly, if it works enough/helps you, it doesn't seem like it'd do any harm to the project, so I'm good with it.

Out of curiosity, why is there both an mir.vim and a machine-ir.vim?

This revision is now accepted and ready to land.Feb 16 2021, 12:06 PM

The MIR syntax is based on extending the yaml syntax and then embedding the machine-ir syntax inside it, I've defined it as two separate files so it's easier to separate "highlighting the instructions" from "embedding it inside yaml".

The MIR syntax is based on extending the yaml syntax and then embedding the machine-ir syntax inside it, I've defined it as two separate files so it's easier to separate "highlighting the instructions" from "embedding it inside yaml".

ah, fair enough - thanks for explaining!

Can you commit these yourself (do you have commit access) or would you like me to do it for you?

I can commit them.

This revision was landed with ongoing or failed builds.Feb 16 2021, 11:41 PM
This revision was automatically updated to reflect the committed changes.