[PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 13:50:49 PDT 2016


yaxunl added inline comments.

================
Comment at: test/Headers/opencl-c-header.cl:53-54
@@ +52,4 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
+// RUN: chmod u+w %t/opencl_c.pcm
+// RUN: mv %t/opencl_c.pcm %t/1_0.pcm
+
----------------
I checked the size of the pch file. The largest chunk is for function declarations. Since it contains about 30k declarations, each one is about 50 bytes on average, so total size is about 1.6MB.

The AST of function decl is written by ASTDeclWriter::VisitFunctionDecl http://clang.llvm.org/doxygen/ASTWriterDecl_8cpp_source.html 

A code snippet is as follows:

 515   Record.push_back((int)D->SClass); // FIXME: stable encoding
  516   Record.push_back(D->IsInline);
  517   Record.push_back(D->IsInlineSpecified);
  518   Record.push_back(D->IsVirtualAsWritten);
  519   Record.push_back(D->IsPure);
  520   Record.push_back(D->HasInheritedPrototype);
  521   Record.push_back(D->HasWrittenPrototype);
  522   Record.push_back(D->IsDeleted);
  523   Record.push_back(D->IsTrivial);
  524   Record.push_back(D->IsDefaulted);
  525   Record.push_back(D->IsExplicitlyDefaulted);
  526   Record.push_back(D->HasImplicitReturnZero);
  527   Record.push_back(D->IsConstexpr);
  528   Record.push_back(D->HasSkippedBody);
  529   Record.push_back(D->IsLateTemplateParsed);
  530   Record.push_back(D->getLinkageInternal());
  531   Record.AddSourceLocation(D->getLocEnd());

Record is like a buffer which will be written to file. It uses a vector of int64 to store the values, so it takes space.


http://reviews.llvm.org/D20444





More information about the cfe-commits mailing list