This is an archive of the discontinued LLVM Phabricator instance.

Refactor backend diagnostics for unsupported features
ClosedPublic

Authored by olista01 on Jan 26 2016, 10:05 AM.

Details

Summary

The BPF and WebAssembly backends had identical code for emitting errors
for unsupported features, and AMDGPU had very similar code. This merges
them all into one DiagnosticInfo subclass, that can be used by any
backend.

There should be minimal functional changes here, but some AMDGPU tests
have been updated for the new format of errors (it used a slightly
different format to BPF and WebAssembly). The AMDGPU error messages will
now benefit from having precise source locations when debug info is
available.

The implementation of DiagnosticInfoUnsupported::print must be in
lib/Codegen rather than in the existing file in lib/IR/ to avoid
introducing a dependency from IR to CodeGen.

Diff Detail

Repository
rL LLVM

Event Timeline

olista01 updated this revision to Diff 46007.Jan 26 2016, 10:05 AM
olista01 retitled this revision from to Refactor backend diagnostics for unsupported features.
olista01 updated this object.
olista01 added reviewers: ast, sunfish, tstellarAMD.
olista01 set the repository for this revision to rL LLVM.
olista01 added a subscriber: llvm-commits.
jfb added a comment.Jan 26 2016, 10:09 AM

WebAssembly part lgtm, thanks for doing this!

arsenm accepted this revision.Jan 26 2016, 10:34 AM
arsenm added a reviewer: arsenm.

LGTM

This revision is now accepted and ready to land.Jan 26 2016, 10:34 AM
ast accepted this revision.Jan 26 2016, 10:48 AM
ast edited edge metadata.

lgtm as well. Thank you for working on this.

This revision was automatically updated to reflect the committed changes.
tra added a subscriber: tra.Jan 27 2016, 10:49 AM
tra added inline comments.
llvm/trunk/lib/CodeGen/DiagnosticInfoCodeGen.cpp
27

This creates circular dependency between libraries as SDNode->print is in SelectionDAG library which in turn depends on CodeGen library.

It works OK with static linking, but breaks the build with shared libraries enabled.

This was reverted last night, I've re-committed it as r259035 with the layering violation fixed.

Hi,

The shared library build is still broken - as mentioned before, there's a circular dependency between CodeGen and SelectionDAG because of the Value->print(OS); line.

Can we revert/fix this please?

Cheers!

I'd revert it (and others) again within a few hours. Could you resolve cyclic deps?

Please include r259040 in the next commit.

arsenm added inline comments.Jan 28 2016, 11:09 AM
llvm/trunk/include/llvm/IR/DiagnosticInfo.h
596

Why can't this include the emitted message?

You can then include a wrapper for this in codegen that accepts the SDValue

llvm/trunk/lib/IR/DiagnosticInfo.cpp