[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Anton Korobeynikov asl at math.spbu.ru
Thu Sep 14 11:24:03 PDT 2006



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.269 -> 1.270
---
Log message:

Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86 
assembler backends.
External weak linkage added for future use, we don't provide any 
codegeneration, etc. support for it.


---
Diffs of the changes:  (+12 -1)

 Writer.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.269 llvm/lib/Target/CBackend/Writer.cpp:1.270
--- llvm/lib/Target/CBackend/Writer.cpp:1.269	Sat Sep  9 01:17:12 2006
+++ llvm/lib/Target/CBackend/Writer.cpp	Thu Sep 14 13:23:26 2006
@@ -1054,7 +1054,11 @@
         Out << "extern ";
         printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
         Out << ";\n";
-      }
+      } else if (I->hasDLLImportLinkage()) {
+        Out << "__declspec(dllimport) ";
+        printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+        Out << ";\n";        
+      }      
     }
   }
 
@@ -1118,6 +1122,11 @@
         
         if (I->hasInternalLinkage())
           Out << "static ";
+        else if (I->hasDLLImportLinkage())
+          Out << "__declspec(dllimport) ";
+        else if (I->hasDLLExportLinkage())
+          Out << "__declspec(dllexport) ";
+            
         printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
         if (I->hasLinkOnceLinkage())
           Out << " __attribute__((common))";
@@ -1267,6 +1276,8 @@
   bool isCStructReturn = F->getCallingConv() == CallingConv::CSRet;
   
   if (F->hasInternalLinkage()) Out << "static ";
+  if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
+  if (F->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";  
 
   // Loop over the arguments, printing them...
   const FunctionType *FT = cast<FunctionType>(F->getFunctionType());






More information about the llvm-commits mailing list