[Beignet] [PATCH 1/3] GBE: Inline all function calls.
Yang, Rong R
rong.r.yang at intel.com
Wed Oct 16 23:42:31 PDT 2013
This patchset LTM, thanks.
-----Original Message-----
From: beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org [mailto:beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org] On Behalf Of Ruiling Song
Sent: Wednesday, October 16, 2013 3:38 PM
To: beignet at lists.freedesktop.org
Cc: Song, Ruiling
Subject: [Beignet] [PATCH 1/3] GBE: Inline all function calls.
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