[llvm-commits] [124233] Clear out the target builtin cache before reading a PCH file.

bwendlin at apple.com bwendlin at apple.com
Fri Feb 23 12:14:45 PST 2007


Revision: 124233
Author:   bwendlin
Date:     2007-02-23 12:14:43 -0800 (Fri, 23 Feb 2007)

Log Message:
-----------
Clear out the target builtin cache before reading a PCH file.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-backend.cpp
    apple-local/branches/llvm/gcc/llvm-convert.cpp
    apple-local/branches/llvm/gcc/llvm-internal.h

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-02-23 19:54:33 UTC (rev 124232)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-02-23 20:14:43 UTC (rev 124233)
@@ -195,6 +195,7 @@
   fclose (asm_out_file);
   
   std::string ErrMsg;
+  clearTargetBuiltinCache();
   TheModule = ParseBytecodeFile(asm_file_name,
                                 Compressor::decompressToNewBuffer,
                                 &ErrMsg);

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-02-23 19:54:33 UTC (rev 124232)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-02-23 20:14:43 UTC (rev 124233)
@@ -187,10 +187,10 @@
   Constant *LLVMValuesNameTable = ConstantStruct::get(LLVMValuesNames, false);
 
   // Create variable to hold this string table.
-  GlobalVariable *GV = new GlobalVariable(LLVMValuesNameTable->getType(), true,
-                                          GlobalValue::ExternalLinkage, 
-                                          LLVMValuesNameTable,
-                                          "llvm.pch.values", TheModule);
+  new GlobalVariable(LLVMValuesNameTable->getType(), true,
+                     GlobalValue::ExternalLinkage, 
+                     LLVMValuesNameTable,
+                     "llvm.pch.values", TheModule);
 }
 
 /// isGCC_SSA_Temporary - Return true if this is an SSA temporary that we can
@@ -3454,7 +3454,14 @@
   return false;
 }
 
+/// TargetBuiltinCache - A cache of builtin intrisics indexed by the GCC builtin
+/// number.
+static std::vector<Constant*> TargetBuiltinCache;
 
+void clearTargetBuiltinCache() {
+  TargetBuiltinCache.clear();
+}
+
 /// EmitBuiltinCall - exp is a call to fndecl, a builtin function.  Try to emit
 /// the call in a special way, setting Result to the scalar result if necessary.
 /// If we can't handle the builtin, return false, otherwise return true.
@@ -3462,7 +3469,6 @@
                                  Value *DestLoc, Value *&Result) {
   if (DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_MD) {
     unsigned FnCode = DECL_FUNCTION_CODE(fndecl);
-    static std::vector<Constant*> TargetBuiltinCache;
     if (TargetBuiltinCache.size() <= FnCode)
       TargetBuiltinCache.resize(FnCode+1);
     

Modified: apple-local/branches/llvm/gcc/llvm-internal.h
===================================================================
--- apple-local/branches/llvm/gcc/llvm-internal.h	2007-02-23 19:54:33 UTC (rev 124232)
+++ apple-local/branches/llvm/gcc/llvm-internal.h	2007-02-23 20:14:43 UTC (rev 124233)
@@ -91,6 +91,7 @@
 extern void writeLLVMTypesStringTable();
 extern void readLLVMValuesStringTable();
 extern void writeLLVMValuesStringTable();
+extern void clearTargetBuiltinCache();
 
 struct StructTypeConversionInfo;
 





More information about the llvm-commits mailing list