[llvm] d812efb - [SafeStack,NFC] Fix names after files move

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 01:08:50 PDT 2020


Author: Vitaly Buka
Date: 2020-06-17T01:08:40-07:00
New Revision: d812efb121f72958cc88c866f3ed3b80ed052856

URL: https://github.com/llvm/llvm-project/commit/d812efb121f72958cc88c866f3ed3b80ed052856
DIFF: https://github.com/llvm/llvm-project/commit/d812efb121f72958cc88c866f3ed3b80ed052856.diff

LOG: [SafeStack,NFC] Fix names after files move

Summary: Depends on D81831.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81832

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/StackLifetime.h
    llvm/lib/Analysis/StackLifetime.cpp
    llvm/lib/CodeGen/SafeStack.cpp
    llvm/lib/CodeGen/SafeStackLayout.cpp
    llvm/lib/CodeGen/SafeStackLayout.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/StackLifetime.h b/llvm/include/llvm/Analysis/StackLifetime.h
index b71b374182c0..6622433b4dcd 100644
--- a/llvm/include/llvm/Analysis/StackLifetime.h
+++ b/llvm/include/llvm/Analysis/StackLifetime.h
@@ -1,4 +1,4 @@
-//===- SafeStackColoring.h - SafeStack frame coloring ----------*- C++ -*--===//
+//===- StackLifetime.h - Alloca Lifetime Analysis --------------*- C++ -*--===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIB_CODEGEN_SAFESTACKCOLORING_H
-#define LLVM_LIB_CODEGEN_SAFESTACKCOLORING_H
+#ifndef LLVM_ANALYSIS_STACKLIFETIME_H
+#define LLVM_ANALYSIS_STACKLIFETIME_H
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitVector.h"
@@ -25,8 +25,6 @@ class BasicBlock;
 class Function;
 class Instruction;
 
-namespace safestack {
-
 /// Compute live ranges of allocas.
 /// Live ranges are represented as sets of "interesting" instructions, which are
 /// defined as instructions that may start or end an alloca's lifetime. These
@@ -35,7 +33,7 @@ namespace safestack {
 /// * first instruction of any basic block
 /// Interesting instructions are numbered in the depth-first walk of the CFG,
 /// and in the program order inside each basic block.
-class StackColoring {
+class StackLifetime {
   /// A class representing liveness information for a single basic block.
   /// Each bit in the BitVector represents the liveness property
   /// for a 
diff erent stack slot.
@@ -62,7 +60,7 @@ class StackColoring {
   class LiveRange {
     BitVector Bits;
     friend raw_ostream &operator<<(raw_ostream &OS,
-                                   const StackColoring::LiveRange &R);
+                                   const StackLifetime::LiveRange &R);
 
   public:
     LiveRange(unsigned Size, bool Set = false) : Bits(Size, Set) {}
@@ -121,7 +119,7 @@ class StackColoring {
   void calculateLiveIntervals();
 
 public:
-  StackColoring(const Function &F, ArrayRef<const AllocaInst *> Allocas);
+  StackLifetime(const Function &F, ArrayRef<const AllocaInst *> Allocas);
 
   void run();
   std::vector<const IntrinsicInst *> getMarkers() const;
@@ -156,12 +154,10 @@ static inline raw_ostream &operator<<(raw_ostream &OS, const BitVector &V) {
 }
 
 inline raw_ostream &operator<<(raw_ostream &OS,
-                               const StackColoring::LiveRange &R) {
+                               const StackLifetime::LiveRange &R) {
   return OS << R.Bits;
 }
 
-} // end namespace safestack
-
 } // end namespace llvm
 
-#endif // LLVM_LIB_CODEGEN_SAFESTACKCOLORING_H
+#endif // LLVM_ANALYSIS_STACKLIFETIME_H

diff  --git a/llvm/lib/Analysis/StackLifetime.cpp b/llvm/lib/Analysis/StackLifetime.cpp
index dc2707c21654..7dde0ec38d57 100644
--- a/llvm/lib/Analysis/StackLifetime.cpp
+++ b/llvm/lib/Analysis/StackLifetime.cpp
@@ -1,4 +1,4 @@
-//===- SafeStackColoring.cpp - SafeStack frame coloring -------------------===//
+//===- StackLifetime.cpp - Alloca Lifetime Analysis -----------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -22,12 +22,11 @@
 #include <tuple>
 
 using namespace llvm;
-using namespace llvm::safestack;
 
-#define DEBUG_TYPE "safestackcoloring"
+#define DEBUG_TYPE "stack-lifetime"
 
-const StackColoring::LiveRange &
-StackColoring::getLiveRange(const AllocaInst *AI) const {
+const StackLifetime::LiveRange &
+StackLifetime::getLiveRange(const AllocaInst *AI) const {
   const auto IT = AllocaNumbering.find(AI);
   assert(IT != AllocaNumbering.end());
   return LiveRanges[IT->second];
@@ -42,7 +41,7 @@ static bool readMarker(const Instruction *I, bool *IsStart) {
   return true;
 }
 
-std::vector<const IntrinsicInst *> StackColoring::getMarkers() const {
+std::vector<const IntrinsicInst *> StackLifetime::getMarkers() const {
   std::vector<const IntrinsicInst *> Markers;
   for (auto &M : InstructionNumbering)
     if (M.getFirst()->isLifetimeStartOrEnd())
@@ -50,7 +49,7 @@ std::vector<const IntrinsicInst *> StackColoring::getMarkers() const {
   return Markers;
 }
 
-void StackColoring::collectMarkers() {
+void StackLifetime::collectMarkers() {
   InterestingAllocas.resize(NumAllocas);
   DenseMap<const BasicBlock *, SmallDenseMap<const IntrinsicInst *, Marker>>
       BBMarkerSet;
@@ -143,7 +142,7 @@ void StackColoring::collectMarkers() {
   NumInst = InstNo;
 }
 
-void StackColoring::calculateLocalLiveness() {
+void StackLifetime::calculateLocalLiveness() {
   bool Changed = true;
   while (Changed) {
     Changed = false;
@@ -187,7 +186,7 @@ void StackColoring::calculateLocalLiveness() {
   } // while changed.
 }
 
-void StackColoring::calculateLiveIntervals() {
+void StackLifetime::calculateLiveIntervals() {
   for (auto IT : BlockLiveness) {
     const BasicBlock *BB = IT.getFirst();
     BlockLifetimeInfo &BlockInfo = IT.getSecond();
@@ -237,13 +236,13 @@ void StackColoring::calculateLiveIntervals() {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void StackColoring::dumpAllocas() const {
+LLVM_DUMP_METHOD void StackLifetime::dumpAllocas() const {
   dbgs() << "Allocas:\n";
   for (unsigned AllocaNo = 0; AllocaNo < NumAllocas; ++AllocaNo)
     dbgs() << "  " << AllocaNo << ": " << *Allocas[AllocaNo] << "\n";
 }
 
-LLVM_DUMP_METHOD void StackColoring::dumpBlockLiveness() const {
+LLVM_DUMP_METHOD void StackLifetime::dumpBlockLiveness() const {
   dbgs() << "Block liveness:\n";
   for (auto IT : BlockLiveness) {
     const BasicBlock *BB = IT.getFirst();
@@ -256,14 +255,14 @@ LLVM_DUMP_METHOD void StackColoring::dumpBlockLiveness() const {
   }
 }
 
-LLVM_DUMP_METHOD void StackColoring::dumpLiveRanges() const {
+LLVM_DUMP_METHOD void StackLifetime::dumpLiveRanges() const {
   dbgs() << "Alloca liveness:\n";
   for (unsigned AllocaNo = 0; AllocaNo < NumAllocas; ++AllocaNo)
     dbgs() << "  " << AllocaNo << ": " << LiveRanges[AllocaNo] << "\n";
 }
 #endif
 
-StackColoring::StackColoring(const Function &F,
+StackLifetime::StackLifetime(const Function &F,
                              ArrayRef<const AllocaInst *> Allocas)
     : F(F), Allocas(Allocas), NumAllocas(Allocas.size()) {
   LLVM_DEBUG(dumpAllocas());
@@ -274,7 +273,7 @@ StackColoring::StackColoring(const Function &F,
   collectMarkers();
 }
 
-void StackColoring::run() {
+void StackLifetime::run() {
   LiveRanges.resize(NumAllocas, LiveRange(NumInst));
   for (unsigned I = 0; I < NumAllocas; ++I)
     if (!InterestingAllocas.test(I))

diff  --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index a60a49355c25..1481894186e4 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -497,8 +497,8 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
 
   DIBuilder DIB(*F.getParent());
 
-  StackColoring SSC(F, StaticAllocas);
-  static const StackColoring::LiveRange NoColoringRange(1, true);
+  StackLifetime SSC(F, StaticAllocas);
+  static const StackLifetime::LiveRange NoColoringRange(1, true);
   if (ClColoring)
     SSC.run();
 

diff  --git a/llvm/lib/CodeGen/SafeStackLayout.cpp b/llvm/lib/CodeGen/SafeStackLayout.cpp
index 3feb8501a03e..c823454f825c 100644
--- a/llvm/lib/CodeGen/SafeStackLayout.cpp
+++ b/llvm/lib/CodeGen/SafeStackLayout.cpp
@@ -39,7 +39,7 @@ LLVM_DUMP_METHOD void StackLayout::print(raw_ostream &OS) {
 }
 
 void StackLayout::addObject(const Value *V, unsigned Size, unsigned Alignment,
-                            const StackColoring::LiveRange &Range) {
+                            const StackLifetime::LiveRange &Range) {
   StackObjects.push_back({V, Size, Alignment, Range});
   ObjectAlignments[V] = Alignment;
   MaxAlignment = std::max(MaxAlignment, Alignment);
@@ -96,7 +96,7 @@ void StackLayout::layoutObject(StackObject &Obj) {
     if (Start > LastRegionEnd) {
       LLVM_DEBUG(dbgs() << "  Creating gap region: " << LastRegionEnd << " .. "
                         << Start << "\n");
-      Regions.emplace_back(LastRegionEnd, Start, StackColoring::LiveRange(0));
+      Regions.emplace_back(LastRegionEnd, Start, StackLifetime::LiveRange(0));
       LastRegionEnd = Start;
     }
     LLVM_DEBUG(dbgs() << "  Creating new region: " << LastRegionEnd << " .. "

diff  --git a/llvm/lib/CodeGen/SafeStackLayout.h b/llvm/lib/CodeGen/SafeStackLayout.h
index ec709db83dc4..f0db1b42aa00 100644
--- a/llvm/lib/CodeGen/SafeStackLayout.h
+++ b/llvm/lib/CodeGen/SafeStackLayout.h
@@ -27,10 +27,10 @@ class StackLayout {
   struct StackRegion {
     unsigned Start;
     unsigned End;
-    StackColoring::LiveRange Range;
+    StackLifetime::LiveRange Range;
 
     StackRegion(unsigned Start, unsigned End,
-                const StackColoring::LiveRange &Range)
+                const StackLifetime::LiveRange &Range)
         : Start(Start), End(End), Range(Range) {}
   };
 
@@ -40,7 +40,7 @@ class StackLayout {
   struct StackObject {
     const Value *Handle;
     unsigned Size, Alignment;
-    StackColoring::LiveRange Range;
+    StackLifetime::LiveRange Range;
   };
 
   SmallVector<StackObject, 8> StackObjects;
@@ -56,7 +56,7 @@ class StackLayout {
   /// Add an object to the stack frame. Value pointer is opaque and used as a
   /// handle to retrieve the object's offset in the frame later.
   void addObject(const Value *V, unsigned Size, unsigned Alignment,
-                 const StackColoring::LiveRange &Range);
+                 const StackLifetime::LiveRange &Range);
 
   /// Run the layout computation for all previously added objects.
   void computeLayout();


        


More information about the llvm-commits mailing list