[llvm] d8b37de - [GC][NFC] Move GCStrategy from CodeGen to IR

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 22:32:14 PDT 2021


Author: Max Kazantsev
Date: 2021-05-13T12:31:59+07:00
New Revision: d8b37de8a478c1b1532e45b0bfd82ecf1c964d9a

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

LOG: [GC][NFC] Move GCStrategy from CodeGen to IR

We want it to be available in analyzes so that we could use the
CodeGen notion in middle-end passes (for example, to check if
a GC may free some particular pointer).

This is a preparatory patch that simply moves the files around.

Note: if this causes some build issues, this patch must just be reverted.

Differential Revision: https://reviews.llvm.org/D100557
Reviewed By: reames

Added: 
    llvm/include/llvm/IR/BuiltinGCs.h
    llvm/include/llvm/IR/GCStrategy.h
    llvm/lib/IR/BuiltinGCs.cpp
    llvm/lib/IR/GCStrategy.cpp

Modified: 
    llvm/include/llvm/CodeGen/GCMetadata.h
    llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
    llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
    llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
    llvm/lib/CodeGen/CMakeLists.txt
    llvm/lib/CodeGen/GCMetadata.cpp
    llvm/lib/CodeGen/GCRootLowering.cpp
    llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
    llvm/lib/IR/CMakeLists.txt

Removed: 
    llvm/include/llvm/CodeGen/BuiltinGCs.h
    llvm/include/llvm/CodeGen/GCStrategy.h
    llvm/lib/CodeGen/BuiltinGCs.cpp
    llvm/lib/CodeGen/GCStrategy.cpp


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/GCMetadata.h b/llvm/include/llvm/CodeGen/GCMetadata.h
index 77cd356c49dd..334c5c23b8fa 100644
--- a/llvm/include/llvm/CodeGen/GCMetadata.h
+++ b/llvm/include/llvm/CodeGen/GCMetadata.h
@@ -36,8 +36,8 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/GCStrategy.h"
 #include "llvm/Pass.h"
 #include <algorithm>
 #include <cstddef>

diff  --git a/llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h b/llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
index 75a5c359630e..81b0025fdddc 100644
--- a/llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
+++ b/llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
@@ -14,7 +14,7 @@
 #ifndef LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
 #define LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
 
-#include "llvm/CodeGen/BuiltinGCs.h"
+#include "llvm/IR/BuiltinGCs.h"
 #include <cstdlib>
 
 namespace {

diff  --git a/llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h b/llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
index 56c93b24147e..1b13ff53ac85 100644
--- a/llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
+++ b/llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
@@ -14,7 +14,7 @@
 #ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
 #define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
 
-#include "llvm/CodeGen/BuiltinGCs.h"
+#include "llvm/IR/BuiltinGCs.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/SchedulerRegistry.h"
 #include "llvm/Target/TargetMachine.h"

diff  --git a/llvm/include/llvm/CodeGen/BuiltinGCs.h b/llvm/include/llvm/IR/BuiltinGCs.h
similarity index 89%
rename from llvm/include/llvm/CodeGen/BuiltinGCs.h
rename to llvm/include/llvm/IR/BuiltinGCs.h
index c1c3cdc22b31..16aff01dbcf3 100644
--- a/llvm/include/llvm/CodeGen/BuiltinGCs.h
+++ b/llvm/include/llvm/IR/BuiltinGCs.h
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_BUILTINGCS_H
-#define LLVM_CODEGEN_BUILTINGCS_H
+#ifndef LLVM_IR_BUILTINGCS_H
+#define LLVM_IR_BUILTINGCS_H
 
 namespace llvm {
 
@@ -27,6 +27,7 @@ void linkOcamlGCPrinter();
 
 /// Creates an erlang-compatible metadata printer.
 void linkErlangGCPrinter();
-}
 
-#endif
+} // namespace llvm
+
+#endif // LLVM_IR_BUILTINGCS_H

diff  --git a/llvm/include/llvm/CodeGen/GCStrategy.h b/llvm/include/llvm/IR/GCStrategy.h
similarity index 98%
rename from llvm/include/llvm/CodeGen/GCStrategy.h
rename to llvm/include/llvm/IR/GCStrategy.h
index c5731528da4e..a69958d596c6 100644
--- a/llvm/include/llvm/CodeGen/GCStrategy.h
+++ b/llvm/include/llvm/IR/GCStrategy.h
@@ -46,8 +46,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_GCSTRATEGY_H
-#define LLVM_CODEGEN_GCSTRATEGY_H
+#ifndef LLVM_IR_GCSTRATEGY_H
+#define LLVM_IR_GCSTRATEGY_H
 
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
@@ -133,4 +133,4 @@ using GCRegistry = Registry<GCStrategy>;
 
 } // end namespace llvm
 
-#endif // LLVM_CODEGEN_GCSTRATEGY_H
+#endif // LLVM_IR_GCSTRATEGY_H

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index f8f64599b218..7c7279b4fde8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -38,7 +38,6 @@
 #include "llvm/BinaryFormat/ELF.h"
 #include "llvm/CodeGen/GCMetadata.h"
 #include "llvm/CodeGen/GCMetadataPrinter.h"
-#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineDominators.h"
@@ -68,6 +67,7 @@
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
+#include "llvm/IR/GCStrategy.h"
 #include "llvm/IR/GlobalAlias.h"
 #include "llvm/IR/GlobalIFunc.h"
 #include "llvm/IR/GlobalIndirectSymbol.h"

diff  --git a/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
index 0a1260858ab1..70777f07fc6c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
@@ -14,10 +14,9 @@
 
 #include "llvm/BinaryFormat/ELF.h"
 #include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/BuiltinGCs.h"
 #include "llvm/CodeGen/GCMetadata.h"
 #include "llvm/CodeGen/GCMetadataPrinter.h"
-#include "llvm/CodeGen/GCStrategy.h"
+#include "llvm/IR/BuiltinGCs.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Module.h"

diff  --git a/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
index 354b638b47a2..a9fb31d42679 100644
--- a/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
@@ -14,9 +14,9 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/BuiltinGCs.h"
 #include "llvm/CodeGen/GCMetadata.h"
 #include "llvm/CodeGen/GCMetadataPrinter.h"
+#include "llvm/IR/BuiltinGCs.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Mangler.h"

diff  --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 55a8f81641f6..a5fb0d849298 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -7,7 +7,6 @@ add_llvm_component_library(LLVMCodeGen
   BranchFolding.cpp
   BranchRelaxation.cpp
   BreakFalseDeps.cpp
-  BuiltinGCs.cpp
   BasicBlockSections.cpp
   CalcSpillWeights.cpp
   CallingConvLower.cpp
@@ -38,7 +37,6 @@ add_llvm_component_library(LLVMCodeGen
   GCMetadata.cpp
   GCMetadataPrinter.cpp
   GCRootLowering.cpp
-  GCStrategy.cpp
   GlobalMerge.cpp
   HardwareLoops.cpp
   IfConversion.cpp

diff  --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp
index 01167c059676..8fae798b31d9 100644
--- a/llvm/lib/CodeGen/GCMetadata.cpp
+++ b/llvm/lib/CodeGen/GCMetadata.cpp
@@ -13,7 +13,6 @@
 #include "llvm/CodeGen/GCMetadata.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/InitializePasses.h"

diff  --git a/llvm/lib/CodeGen/GCRootLowering.cpp b/llvm/lib/CodeGen/GCRootLowering.cpp
index c3b0cd92498a..faf0fb7f09a7 100644
--- a/llvm/lib/CodeGen/GCRootLowering.cpp
+++ b/llvm/lib/CodeGen/GCRootLowering.cpp
@@ -11,7 +11,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/GCMetadata.h"
-#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"

diff  --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index 9d80e7a1222e..b6e7debe7173 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -21,7 +21,6 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/CodeGen/FunctionLoweringInfo.h"
 #include "llvm/CodeGen/GCMetadata.h"
-#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/ISDOpcodes.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineFunction.h"
@@ -33,6 +32,7 @@
 #include "llvm/CodeGen/TargetOpcodes.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/GCStrategy.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"

diff  --git a/llvm/lib/CodeGen/BuiltinGCs.cpp b/llvm/lib/IR/BuiltinGCs.cpp
similarity index 98%
rename from llvm/lib/CodeGen/BuiltinGCs.cpp
rename to llvm/lib/IR/BuiltinGCs.cpp
index bfc10cb3fef2..31ee86383e78 100644
--- a/llvm/lib/CodeGen/BuiltinGCs.cpp
+++ b/llvm/lib/IR/BuiltinGCs.cpp
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CodeGen/BuiltinGCs.h"
-#include "llvm/CodeGen/GCStrategy.h"
+#include "llvm/IR/BuiltinGCs.h"
+#include "llvm/IR/GCStrategy.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/Casting.h"
 

diff  --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index fb4993742e85..7f6e698b10f9 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -5,6 +5,7 @@ add_llvm_component_library(LLVMCore
   Attributes.cpp
   AutoUpgrade.cpp
   BasicBlock.cpp
+  BuiltinGCs.cpp
   Comdat.cpp
   ConstantFold.cpp
   ConstantRange.cpp
@@ -21,6 +22,7 @@ add_llvm_component_library(LLVMCore
   Dominators.cpp
   FPEnv.cpp
   Function.cpp
+  GCStrategy.cpp
   GVMaterializer.cpp
   Globals.cpp
   IRBuilder.cpp

diff  --git a/llvm/lib/CodeGen/GCStrategy.cpp b/llvm/lib/IR/GCStrategy.cpp
similarity index 94%
rename from llvm/lib/CodeGen/GCStrategy.cpp
rename to llvm/lib/IR/GCStrategy.cpp
index 43d06b0f82e9..25dad5bec9ef 100644
--- a/llvm/lib/CodeGen/GCStrategy.cpp
+++ b/llvm/lib/IR/GCStrategy.cpp
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CodeGen/GCStrategy.h"
+#include "llvm/IR/GCStrategy.h"
 
 using namespace llvm;
 


        


More information about the llvm-commits mailing list