X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FGCMetadata.h;h=163117b0781ccc7f55b4afe5484718ec63a42a1b;hb=a84e7b8f4d9f4f0278da9522937dac9dc2a5bd26;hp=19aa0b031f36dd90c14a17b95fc23e9aa9c1c496;hpb=999412767a20e7c7121151ef2703757e03c4f48b;p=oota-llvm.git diff --git a/include/llvm/CodeGen/GCMetadata.h b/include/llvm/CodeGen/GCMetadata.h index 19aa0b031f3..163117b0781 100644 --- a/include/llvm/CodeGen/GCMetadata.h +++ b/include/llvm/CodeGen/GCMetadata.h @@ -34,9 +34,10 @@ #define LLVM_CODEGEN_GCMETADATA_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" +#include "llvm/CodeGen/GCStrategy.h" #include "llvm/IR/DebugLoc.h" -#include "llvm/IR/GCStrategy.h" #include "llvm/Pass.h" #include @@ -120,7 +121,7 @@ public: /// label just prior to the safe point (if the code generator is using /// MachineModuleInfo). void addSafePoint(GC::PointKind Kind, MCSymbol *Label, DebugLoc DL) { - SafePoints.push_back(GCPoint(Kind, Label, DL)); + SafePoints.emplace_back(Kind, Label, DL); } /// getFrameSize/setFrameSize - Records the function's frame size. @@ -151,11 +152,17 @@ public: /// Records both the function level information used by GCRoots and a /// cache of the 'active' gc strategy objects for the current Module. class GCModuleInfo : public ImmutablePass { - /// A list of GCStrategies which are active in this Module. These are - /// not owning pointers. - std::vector StrategyList; + /// An owning list of all GCStrategies which have been created + SmallVector, 1> GCStrategyList; + /// A helper map to speedup lookups into the above list + StringMap GCStrategyMap; public: + /// Lookup the GCStrategy object associated with the given gc name. + /// Objects are owned internally; No caller should attempt to delete the + /// returned objects. + GCStrategy *getGCStrategy(const StringRef Name); + /// List of per function info objects. In theory, Each of these /// may be associated with a different GC. typedef std::vector> FuncInfoVec; @@ -173,7 +180,7 @@ private: finfo_map_type FInfoMap; public: - typedef std::vector::const_iterator iterator; + typedef SmallVector,1>::const_iterator iterator; static char ID; @@ -186,8 +193,8 @@ public: /// begin/end - Iterators for used strategies. /// - iterator begin() const { return StrategyList.begin(); } - iterator end() const { return StrategyList.end(); } + iterator begin() const { return GCStrategyList.begin(); } + iterator end() const { return GCStrategyList.end(); } /// get - Look up function metadata. This is currently assumed /// have the side effect of initializing the associated GCStrategy. That