[llvm-commits] [poolalloc] r128667 - in /poolalloc/trunk: include/assistDS/TypeAnalysis.h lib/AssistDS/TypeAnalysis.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Thu Mar 31 13:43:05 PDT 2011
Author: aggarwa4
Date: Thu Mar 31 15:43:05 2011
New Revision: 128667
URL: http://llvm.org/viewvc/llvm-project?rev=128667&view=rev
Log:
Pass to infer types of load/store instructions.
To be used by the dynamic type tracking insertion pass.
TODO: expand to ignore loads/stores only used for
copying values, as seen in the case of mrv.
Added:
poolalloc/trunk/include/assistDS/TypeAnalysis.h
poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp
Added: poolalloc/trunk/include/assistDS/TypeAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/TypeAnalysis.h?rev=128667&view=auto
==============================================================================
--- poolalloc/trunk/include/assistDS/TypeAnalysis.h (added)
+++ poolalloc/trunk/include/assistDS/TypeAnalysis.h Thu Mar 31 15:43:05 2011
@@ -0,0 +1,41 @@
+//===-- TypeAnalysis.h - Deciphers Types of loads and stores --------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code defines a pass which clones functions which could potentially be
+// used in indirect function calls.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Instructions.h"
+#include "llvm/Module.h"
+#include "llvm/Pass.h"
+
+namespace llvm {
+ //
+ // Class: TypeAnalysis
+ //
+ // Description:
+ // Implement an LLVM pass that analyses a file to say what
+ // the type of a load/store instruction is.
+ //
+ class TypeAnalysis : public ModulePass {
+ public:
+ static char ID;
+ TypeAnalysis() : ModulePass(&ID) {}
+ virtual ~TypeAnalysis();
+ virtual bool runOnModule(Module& M);
+ virtual void getAnalysisUsage(llvm::AnalysisUsage &Info) const;
+
+ const Type *getType(LoadInst *);
+ const Type *getType(StoreInst *);
+ const Type *getType(ExtractValueInst *);
+ const Type *getType(InsertValueInst *);
+ };
+}
+
Added: poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp?rev=128667&view=auto
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp (added)
+++ poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp Thu Mar 31 15:43:05 2011
@@ -0,0 +1,48 @@
+//===-- TypeAnalysis.cpp - Clone Indirectly Called Functions --------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "assistDS/TypeAnalysis.h"
+
+
+#include <vector>
+
+using namespace llvm;
+
+// Pass ID variable
+char TypeAnalysis::ID = 0;
+
+// Register the Pass
+static RegisterPass<TypeAnalysis>
+X("type-analysis", "Get types for load/stores");
+
+
+//
+// Method: runOnModule()
+//
+bool
+TypeAnalysis::runOnModule(Module& M) {
+ return false;
+}
+const Type *
+TypeAnalysis::getType(LoadInst *LI){
+ return LI->getType();
+}
+const Type *
+TypeAnalysis::getType(StoreInst *SI){
+ return SI->getOperand(0)->getType();
+}
+const Type *
+TypeAnalysis::getType(InsertValueInst *I){
+ return I->getInsertedValueOperand()->getType();
+}
+const Type *
+TypeAnalysis::getType(ExtractValueInst *I){
+ return I->getType();
+}
+
More information about the llvm-commits
mailing list