[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Type.cpp Verifier.cpp

Anton Korobeynikov asl at math.spbu.ru
Sun Jan 28 05:32:20 PST 2007



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.255 -> 1.256
Type.cpp updated: 1.166 -> 1.167
Verifier.cpp updated: 1.186 -> 1.187
---
Log message:

Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this 
parameter in registers, if possible". This is some generalization of 
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend. 
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each 
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in 
on first attribute has meaning 'This is hidden pointer to structure 
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to 
FunctionExtraction pass, which relinks all internal-linkaged callees 
from deleted function to external linkage. This will allow further 
linking everything together.

NOTEs: 1. Documentation will be updated soon. 
       2. llvm-upgrade should be improved to translate csret => sret. 
          Before this, there will be some unexpected test fails.


---
Diffs of the changes:  (+9 -8)

 AsmWriter.cpp |    3 ---
 Type.cpp      |    4 ++++
 Verifier.cpp  |   10 +++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.255 llvm/lib/VMCore/AsmWriter.cpp:1.256
--- llvm/lib/VMCore/AsmWriter.cpp:1.255	Fri Jan 26 02:02:52 2007
+++ llvm/lib/VMCore/AsmWriter.cpp	Sun Jan 28 07:31:35 2007
@@ -956,7 +956,6 @@
   // Print the calling convention.
   switch (F->getCallingConv()) {
   case CallingConv::C: break;   // default
-  case CallingConv::CSRet:        Out << "csretcc "; break;
   case CallingConv::Fast:         Out << "fastcc "; break;
   case CallingConv::Cold:         Out << "coldcc "; break;
   case CallingConv::X86_StdCall:  Out << "x86_stdcallcc "; break;
@@ -1166,7 +1165,6 @@
     // Print the calling convention being used.
     switch (CI->getCallingConv()) {
     case CallingConv::C: break;   // default
-    case CallingConv::CSRet: Out << " csretcc"; break;
     case CallingConv::Fast:  Out << " fastcc"; break;
     case CallingConv::Cold:  Out << " coldcc"; break;
     case CallingConv::X86_StdCall:  Out << "x86_stdcallcc "; break;
@@ -1209,7 +1207,6 @@
     // Print the calling convention being used.
     switch (II->getCallingConv()) {
     case CallingConv::C: break;   // default
-    case CallingConv::CSRet: Out << " csretcc"; break;
     case CallingConv::Fast:  Out << " fastcc"; break;
     case CallingConv::Cold:  Out << " coldcc"; break;
     case CallingConv::X86_StdCall:  Out << "x86_stdcallcc "; break;


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.166 llvm/lib/VMCore/Type.cpp:1.167
--- llvm/lib/VMCore/Type.cpp:1.166	Fri Jan 26 01:51:36 2007
+++ llvm/lib/VMCore/Type.cpp	Sun Jan 28 07:31:35 2007
@@ -1089,6 +1089,10 @@
     Result += "sext ";
   if (Attr & NoReturnAttribute)
     Result += "noreturn ";
+  if (Attr & InRegAttribute)
+    Result += "inreg ";
+  if (Attr & StructRetAttribute)
+    Result += "sret ";  
   return Result;
 }
 


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.186 llvm/lib/VMCore/Verifier.cpp:1.187
--- llvm/lib/VMCore/Verifier.cpp:1.186	Sun Jan 14 20:27:26 2007
+++ llvm/lib/VMCore/Verifier.cpp	Sun Jan 28 07:31:35 2007
@@ -338,17 +338,17 @@
           F.getReturnType() == Type::VoidTy,
           "Functions cannot return aggregate values!", &F);
 
+  Assert1(!FT->isStructReturn() ||
+          (FT->getReturnType() == Type::VoidTy && 
+           FT->getNumParams() > 0 && isa<PointerType>(FT->getParamType(0))),
+          "Invalid struct-return function!", &F);
+
   // Check that this function meets the restrictions on this calling convention.
   switch (F.getCallingConv()) {
   default:
     break;
   case CallingConv::C:
     break;
-  case CallingConv::CSRet:
-    Assert1(FT->getReturnType() == Type::VoidTy && 
-            FT->getNumParams() > 0 && isa<PointerType>(FT->getParamType(0)),
-            "Invalid struct-return function!", &F);
-    break;
   case CallingConv::Fast:
   case CallingConv::Cold:
   case CallingConv::X86_FastCall:






More information about the llvm-commits mailing list