[Beignet] [PATCH 1/3] GBE: Inline all function calls.
Zhigang Gong
zhigang.gong at linux.intel.com
Thu Oct 17 03:16:02 PDT 2013
Pushed the whole patchset, thanks.
On Wed, Oct 16, 2013 at 03:38:06PM +0800, Ruiling Song wrote:
> use an extra large value for llvm flag -inline-threshold to inline all functions.
>
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
> backend/src/backend/program.cpp | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
> index 222dfe9..b2879a4 100644
> --- a/backend/src/backend/program.cpp
> +++ b/backend/src/backend/program.cpp
> @@ -473,6 +473,8 @@ namespace gbe {
> useless.push_back(str);
> args.push_back(str.c_str());
> }
> + args.push_back("-mllvm");
> + args.push_back("-inline-threshold=200000");
> #ifdef GEN7_SAMPLER_CLAMP_BORDER_WORKAROUND
> args.push_back("-DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND");
> #endif
> @@ -537,6 +539,18 @@ namespace gbe {
> clang::LangOptions & lang_opts = Clang.getLangOpts();
> lang_opts.OpenCL = 1;
>
> + //llvm flags need command line parsing to take effect
> + if (!Clang.getFrontendOpts().LLVMArgs.empty()) {
> + unsigned NumArgs = Clang.getFrontendOpts().LLVMArgs.size();
> + const char **Args = new const char*[NumArgs + 2];
> + Args[0] = "clang (LLVM option parsing)";
> + for (unsigned i = 0; i != NumArgs; ++i){
> + Args[i + 1] = Clang.getFrontendOpts().LLVMArgs[i].c_str();
> + }
> + Args[NumArgs + 1] = 0;
> + llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args);
> + }
> +
> // Create an action and make the compiler instance carry it out
> llvm::OwningPtr<clang::CodeGenAction> Act(new clang::EmitLLVMOnlyAction());
> if (!Clang.ExecuteAction(*Act))
> --
> 1.7.9.5
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list