[llvm-commits] CVS: llvm/include/llvm/LinkAllVMCore.h IntrinsicInst.h PassSupport.h

Reid Spencer reid at x10sys.com
Wed Jun 7 13:00:34 PDT 2006



Changes in directory llvm/include/llvm:

LinkAllVMCore.h added (r1.1)
IntrinsicInst.h updated: 1.15 -> 1.16
PassSupport.h updated: 1.22 -> 1.23
---
Log message:

For PR780: http://llvm.cs.uiuc.edu/PR780 :
Break the "IncludeFile" mechanism into its own header file and adjust other
files accordingly. Use this facility for the IntrinsicInst problem which
was the subject of PR800: http://llvm.cs.uiuc.edu/PR800 .
More to follow on this.


---
Diffs of the changes:  (+67 -11)

 IntrinsicInst.h |    7 ++++++
 LinkAllVMCore.h |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 PassSupport.h   |   12 -----------
 3 files changed, 67 insertions(+), 11 deletions(-)


Index: llvm/include/llvm/LinkAllVMCore.h
diff -c /dev/null llvm/include/llvm/LinkAllVMCore.h:1.1
*** /dev/null	Wed Jun  7 15:00:29 2006
--- llvm/include/llvm/LinkAllVMCore.h	Wed Jun  7 15:00:19 2006
***************
*** 0 ****
--- 1,59 ----
+ //===- LinkAllVMCore.h - Reference All VMCore Code --------------*- C++ -*-===//
+ //
+ //                      The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Reid Spencer and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This header file pulls in all analysis passes for tools like analyze and
+ // bugpoint that need this functionality.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #ifndef LLVM_LINKALLVMCORE_H
+ #define LLVM_LINKALLVMCORE_H
+ 
+ #include <llvm/Support/IncludeFile.h>
+ #include <llvm/Module.h>
+ #include <llvm/IntrinsicInst.h>
+ #include <llvm/IntrinsicInst.h>
+ #include <llvm/Instructions.h>
+ #include <llvm/Analysis/Dominators.h>
+ #include <llvm/Analysis/Verifier.h>
+ 
+ namespace {
+   struct ForceVMCoreLinking {
+     ForceVMCoreLinking() {
+       // We must reference the passes in such a way that compilers will not
+       // delete it all as dead code, even with whole program optimization,
+       // yet is effectively a NO-OP. As the compiler isn't smart enough
+       // to know that getenv() never returns -1, this will do the job.
+       if (std::getenv("bar") != (char*) -1)
+         return;
+ 
+       (void)new llvm::LocalDataStructures();
+       (void)new llvm::BUDataStructures();
+       (void)new llvm::TDDataStructures();
+       (void)new llvm::CompleteBUDataStructures();
+       (void)new llvm::EquivClassGraphs();
+       (void)llvm::createDataStructureStatsPass();
+       (void)llvm::createDataStructureGraphCheckerPass();
+       (void)llvm::createProfileLoaderPass();
+       (void)llvm::createNoProfileInfoPass();
+       (void)llvm::createInstCountPass();
+       (void)new llvm::IntervalPartition();
+       (void)new llvm::ImmediateDominators();
+       (void)new llvm::PostDominatorSet();
+       (void)new llvm::FindUsedTypes();
+       (void)new llvm::ScalarEvolution();
+       (void)new llvm::CallTargetFinder();
+       ((llvm::Function*)0)->viewCFGOnly();
+       llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)0);
+       X.add((llvm::Value*)0, 0);  // for -print-alias-sets
+     }
+   } ForceVMCoreLinking;
+ }
+ 
+ #endif


Index: llvm/include/llvm/IntrinsicInst.h
diff -u llvm/include/llvm/IntrinsicInst.h:1.15 llvm/include/llvm/IntrinsicInst.h:1.16
--- llvm/include/llvm/IntrinsicInst.h:1.15	Mon Mar 27 17:30:18 2006
+++ llvm/include/llvm/IntrinsicInst.h	Wed Jun  7 15:00:19 2006
@@ -28,6 +28,7 @@
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
+#include "llvm/Support/IncludeFile.h"
 
 namespace llvm {
   /// IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic
@@ -312,6 +313,12 @@
       return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
     }
   };
+
+// A hack to ensure that the IntrinsicInst.cpp file gets added as a dependency
+// of any file that 
+extern char LinkIntrinsicInstStub;
+static IncludeFile LinkIntrinsicInst(&LinkIntrinsicInstStub);
+
 }
 
 #endif


Index: llvm/include/llvm/PassSupport.h
diff -u llvm/include/llvm/PassSupport.h:1.22 llvm/include/llvm/PassSupport.h:1.23
--- llvm/include/llvm/PassSupport.h:1.22	Sun Jan 22 19:01:04 2006
+++ llvm/include/llvm/PassSupport.h	Wed Jun  7 15:00:19 2006
@@ -21,6 +21,7 @@
 #ifndef LLVM_PASS_SUPPORT_H
 #define LLVM_PASS_SUPPORT_H
 
+#include "llvm/Support/IncludeFile.h"
 // No need to include Pass.h, we are being included by it!
 
 namespace llvm {
@@ -367,17 +368,6 @@
   virtual void passEnumerate(const PassInfo *P) {}
 };
 
-
-//===---------------------------------------------------------------------------
-/// IncludeFile class - This class is used as a hack to make sure that the
-/// implementation of a header file is included into a tool that uses the
-/// header.  This is solely to overcome problems linking .a files and not
-/// getting the implementation of passes we need.
-///
-struct IncludeFile {
-  IncludeFile(void *);
-};
-
 } // End llvm namespace
 
 #endif






More information about the llvm-commits mailing list