RFC: Could we move TargetLibraryInfo into lib/Analysis?

While this is target information, it isn’t actually part of the target today and doesn’t use any part of the target code. Maybe some day we can use a target hook to initialize the data structures, but even then I feel like this really belongs in the core analysis library.

Would there be any objections to just moving it into Analysis?

Doing this would remove a seriously ugly layering violation we have today. I believe this would remove the last dependency on lib/Target by lib/Analysis and the largest set of dependencies on lib/Target by lib/Transforms.

If there is general agreement, I will make it so.
-Chandler

While this is target information, it isn't actually part of the target today
and doesn't use any part of the target code. Maybe some day we can use a
target hook to initialize the data structures, but even then I feel like
this really belongs in the core analysis library.

So I'm curious: do you have an idea of where better to put this
hypothetical hook? Since it's mostly OS-dependent, it doesn't seem
very fit for the way we do targets.

Would there be any objections to just moving it into Analysis?

Doing this would remove a seriously ugly layering violation we have today. I
believe this would remove the last dependency on lib/Target by lib/Analysis
and the largest set of dependencies on lib/Target by lib/Transforms.

If there is general agreement, I will make it so.

FWIW I agree, on all counts.

-Ahmed

> While this is target information, it isn't actually part of the target
today
> and doesn't use any part of the target code. Maybe some day we can use a
> target hook to initialize the data structures, but even then I feel like
> this really belongs in the core analysis library.

So I'm curious: do you have an idea of where better to put this
hypothetical hook? Since it's mostly OS-dependent, it doesn't seem
very fit for the way we do targets.

No idea at all, and I completely agree with you.

Ultimately, I think the word "target" here is misleading. It means target
in the since of a cross compilation target, but it has little to no
relevance to LLVM targets. As you mention, it is an OS and runtime library
availability issue.

Anyways, we don't need a hook today, and if we do at some point in the
future we can figure out how to add one.

> Would there be any objections to just moving it into Analysis?
>
> Doing this would remove a seriously ugly layering violation we have
today. I
> believe this would remove the last dependency on lib/Target by
lib/Analysis
> and the largest set of dependencies on lib/Target by lib/Transforms.
>
> If there is general agreement, I will make it so.

FWIW I agree, on all counts.

Awesome. Will make it so. (Especially now that the release is branched.)