Fixed auto keyword use
authorBenjamin Segovia <segovia.benjamin@gmail.com>
Sat, 17 Mar 2012 07:21:05 +0000 (00:21 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 10 Aug 2012 23:15:43 +0000 (16:15 -0700)
backend/src/ir/liveness.hpp
backend/src/ir/value.cpp
backend/src/utest/utest_llvm.cpp

index 6d97b1c..7b29a15 100644 (file)
@@ -56,7 +56,7 @@ namespace ir {
     /*! Set of variables actually killed in each block */
     typedef set<Register> VarKill;
     /*! Per-block info */
-    struct BlockInfo {
+    struct BlockInfo : public NonCopyable {
       BlockInfo(const BasicBlock &bb) : bb(bb) {}
       const BasicBlock &bb;
       INLINE bool inUpwardUsed(Register reg) const {
index 4de5c40..a4fd89b 100644 (file)
@@ -49,13 +49,7 @@ namespace ir {
     /*! All the block definitions map in the functions */
     typedef map<const BasicBlock*, BlockDefMap*> FunctionDefMap;
     /*! Performs the double look-up to get the set of defs per register */
-    RegDefSet &getDefSet(const BasicBlock *bb, const Register &reg) {
-      auto bbIt = defMap.find(bb);
-      GBE_ASSERT(bbIt != defMap.end());
-      auto defIt = bbIt->second->find(reg);
-      GBE_ASSERT(defIt != bbIt->second->end() && defIt->second != NULL);
-      return *defIt->second;
-    }
+    RegDefSet &getDefSet(const BasicBlock *bb, const Register &reg);
     /*! Build a UD-chain as the union of the predecessor chains */
     void fillUDChain(UDChain &udChain, const BasicBlock &bb, const Register &reg);
     /*! Fast per register definition set allocation */
@@ -82,6 +76,22 @@ namespace ir {
     this->iterateLiveOut();
   }
 
+  LiveOutSet::RegDefSet &LiveOutSet::getDefSet(const BasicBlock *bb,
+                                               const Register &reg)
+  {
+    auto bbIt = defMap.find(bb);
+    GBE_ASSERT(bbIt != defMap.end());
+    auto defIt = bbIt->second->find(reg);
+    GBE_ASSERT(defIt != bbIt->second->end() && defIt->second != NULL);
+    return *defIt->second;
+  }
+
+  void LiveOutSet::fillUDChain(UDChain &udChain,
+                               const BasicBlock &bb,
+                               const Register &reg)
+  {
+  }
+
   void LiveOutSet::initializeInstructionDst(void) {
     const Function &fn = liveness.getFunction();
 
@@ -94,8 +104,8 @@ namespace ir {
       defMap.insert(std::make_pair(&bb, blockDefMap));
 
       // We only consider liveout registers
-      auto info = this->liveness.getBlockInfo(bb);
-      auto liveOut = info.liveOut;
+      const auto &info = this->liveness.getBlockInfo(bb);
+      const auto &liveOut = info.liveOut;
       for (auto it = liveOut.begin(); it != liveOut.end(); ++it) {
         GBE_ASSERT(blockDefMap->find(*it) == blockDefMap->end());
         auto regDefSet = this->newRegDefSet();
@@ -126,7 +136,7 @@ namespace ir {
 
     // The first block must also transfer the function arguments
     const BasicBlock &top = fn.getBlock(0);
-    auto info = this->liveness.getBlockInfo(top);
+    const auto &info = this->liveness.getBlockInfo(top);
     auto blockDefMapIt = defMap.find(&top);
     GBE_ASSERT(blockDefMapIt != defMap.end());
     auto blockDefMap = blockDefMapIt->second;
index 172c73d..d368c35 100644 (file)
@@ -84,7 +84,7 @@ runTests:
   GBE_ASSERT(dummyKernel != NULL);
   fclose(dummyKernel);
 
-  UTEST_EXPECT_SUCCESS(utestLLVM2Gen("loop2.ll"));
+  UTEST_EXPECT_SUCCESS(utestLLVM2Gen("loop.ll"));
   //UTEST_EXPECT_SUCCESS(utestLLVM2Gen("function_param.ll"));
   //UTEST_EXPECT_SUCCESS(utestLLVM2Gen("function.ll"));
   //UTEST_EXPECT_SUCCESS(utestLLVM2Gen("mad.ll"));