This is an archive of the discontinued LLVM Phabricator instance.

[TLI] Unify LibFunc signature checking. NFCI.
ClosedPublic

Authored by ab on Apr 24 2016, 12:45 PM.

Details

Summary

I tried to be as close as possible to the strongest check that existed before; cleaning these up properly is left for future work.

The PointerSize is a little awkward; alternatives welcome. I thought about making TLI require DataLayout as well, but you'd have the same problem of picking a default.

Also, I'm playing with a new tablegen backend for these; what do people think?

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 54807.Apr 24 2016, 12:45 PM
ab retitled this revision from to [TLI] Unify LibFunc signature checking. NFCI..
ab updated this object.
ab added reviewers: mehdi_amini, spatel, echristo.
ab added a subscriber: llvm-commits.
mehdi_amini edited edge metadata.Apr 24 2016, 1:30 PM

I thought about making TLI require DataLayout as well, but you'd have the same problem of picking a default.

I'm not sure to follow: if you require the DataLayout why would you have a problem with a "default"? You always have the value don't you?

ab added a comment.Apr 24 2016, 1:38 PM
In D19469#410333, @joker.eph wrote:

I thought about making TLI require DataLayout as well, but you'd have the same problem of picking a default.

I'm not sure to follow: if you require the DataLayout why would you have a problem with a "default"? You always have the value don't you?

The analysis isn't always built with a module context; the 0-argument constructor would only have the empty DataLayout.

Well either the Caller of getLibFunc supplies it or there should be some "doInitialization()` like every pass?

ab updated this revision to Diff 54816.Apr 24 2016, 5:52 PM
ab edited edge metadata.

Well either the Caller of getLibFunc supplies it or there should be some "doInitialization()` like every pass?

How about this: get the DataLayout from the function's parent, if it has one. Otherwise, default to isIntegerTy()?

There is no *if*. The data layout is not optional on the Module. There is always one.

mehdi_amini accepted this revision.Apr 26 2016, 10:58 PM
mehdi_amini edited edge metadata.

Following our discussion offline, LGTM.

This revision is now accepted and ready to land.Apr 26 2016, 10:58 PM
This revision was automatically updated to reflect the committed changes.