This is an archive of the discontinued LLVM Phabricator instance.

Expose a TargetMachine::getTargetTransformInfo function
ClosedPublic

Authored by sanjoy on Dec 20 2017, 2:05 PM.

Details

Summary

This makes the TargetMachine interface a bit simpler. We still need
the std::function in TargetIRAnalysis to avoid having to add a
dependency from Analysis to Target.

See discussion:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html

I avoided adding all of the backend owners to this review since the
change is simple, but let me know if you feel differently about this.

Diff Detail

Repository
rL LLVM

Event Timeline

sanjoy created this revision.Dec 20 2017, 2:05 PM
hfinkel accepted this revision.Dec 20 2017, 4:18 PM

LGTM

Refactoring this to move the std::function wrapping into once place (as opposed to repeating it in all backends) seems like a good step in general.

This revision is now accepted and ready to land.Dec 20 2017, 4:18 PM
This revision was automatically updated to reflect the committed changes.

Did this change somehow break the -DBUILD_SHARED_LIBS=ON build?

I'm seeing:

clang++  -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -ffunction-sections -fdata-sections -O3  -fuse-ld=gold -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/usr/local/google/home/sbc/dev/wasm/llvm-build/./lib  -Wl,-O3 -Wl,--gc-sections -shared -Wl,-soname,libLLVMPasses.so.6 -o lib/libLLVMPasses.so.6.0.0svn lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o  lib/libLLVMAnalysis.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn lib/libLLVMCore.so.6.0.0svn lib/libLLVMInstCombine.so.6.0.0svn lib/libLLVMInstrumentation.so.6.0.0svn lib/libLLVMScalarOpts.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn lib/libLLVMTransformUtils.so.6.0.0svn lib/libLLVMVectorize.so.6.0.0svn lib/libLLVMipo.so.6.0.0svn -Wl,-rpath,"\$ORIGIN/../lib" && :
lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o:PassBuilder.cpp:function llvm::PassBuilder::registerFunctionAnalyses(llvm::AnalysisManager<llvm::Function>&): error: undefined reference to 'llvm::TargetMachine::getTargetIRAnalysis()'

Did this change somehow break the -DBUILD_SHARED_LIBS=ON build?

Possibly -- I didn't test the shared libs build. I'll revert for now, and try again tomorrow.

I'm seeing:

clang++  -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -ffunction-sections -fdata-sections -O3  -fuse-ld=gold -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/usr/local/google/home/sbc/dev/wasm/llvm-build/./lib  -Wl,-O3 -Wl,--gc-sections -shared -Wl,-soname,libLLVMPasses.so.6 -o lib/libLLVMPasses.so.6.0.0svn lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o  lib/libLLVMAnalysis.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn lib/libLLVMCore.so.6.0.0svn lib/libLLVMInstCombine.so.6.0.0svn lib/libLLVMInstrumentation.so.6.0.0svn lib/libLLVMScalarOpts.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn lib/libLLVMTransformUtils.so.6.0.0svn lib/libLLVMVectorize.so.6.0.0svn lib/libLLVMipo.so.6.0.0svn -Wl,-rpath,"\$ORIGIN/../lib" && :
lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o:PassBuilder.cpp:function llvm::PassBuilder::registerFunctionAnalyses(llvm::AnalysisManager<llvm::Function>&): error: undefined reference to 'llvm::TargetMachine::getTargetIRAnalysis()'

Reverted in r321243.