changeset 20:a5b470e0d09d

set FastCC(Calling Convention) when the function is code segment and set GuaranteedTailCallOpt. but llvm still output not jmp but call...
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Sun, 06 Oct 2013 18:16:15 +0900
parents 29d31faaa39e
children fc4a6333556f
files tools/clang/lib/CodeGen/BackendUtil.cpp tools/clang/lib/CodeGen/CGCall.cpp
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/clang/lib/CodeGen/BackendUtil.cpp	Sun Oct 06 00:43:38 2013 +0900
+++ b/tools/clang/lib/CodeGen/BackendUtil.cpp	Sun Oct 06 18:16:15 2013 +0900
@@ -460,6 +460,7 @@
   Options.EnableSegmentedStacks = CodeGenOpts.EnableSegmentedStacks;
 #ifndef noCbC
   Options.HasCodeSegment = LangOpts.HasCodeSegment;
+  Options.GuaranteedTailCallOpt = LangOpts.HasCodeSegment;
 #endif
 
 
--- a/tools/clang/lib/CodeGen/CGCall.cpp	Sun Oct 06 00:43:38 2013 +0900
+++ b/tools/clang/lib/CodeGen/CGCall.cpp	Sun Oct 06 18:16:15 2013 +0900
@@ -445,6 +445,12 @@
   if (FI)
     return *FI;
 
+#ifndef noCbC
+  // if the function is a code segment , set fastcall calling convention.
+  if(resultType.getTypePtr()->is__CodeType())
+    CC = llvm::CallingConv::Fast;
+#endif
+
   // Construct the function info.  We co-allocate the ArgInfos.
   FI = CGFunctionInfo::create(CC, info, resultType, argTypes, required);
   FunctionInfos.InsertNode(FI, insertPos);