From f98a6ff64671dd5b73de1681a08de7aae55af3fb Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Wed, 12 May 2021 14:36:24 +0700 Subject: [PATCH] [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 --- include/llvm/CodeGen/GCMetadata.h | 2 +- include/llvm/CodeGen/LinkAllAsmWriterComponents.h | 2 +- include/llvm/CodeGen/LinkAllCodegenComponents.h | 2 +- include/llvm/{CodeGen => IR}/BuiltinGCs.h | 9 +++++---- include/llvm/{CodeGen => IR}/GCStrategy.h | 6 +++--- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +- lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp | 3 +-- lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp | 2 +- lib/CodeGen/CMakeLists.txt | 2 -- lib/CodeGen/GCMetadata.cpp | 1 - lib/CodeGen/GCRootLowering.cpp | 1 - lib/CodeGen/SelectionDAG/StatepointLowering.cpp | 2 +- lib/{CodeGen => IR}/BuiltinGCs.cpp | 4 ++-- lib/IR/CMakeLists.txt | 2 ++ lib/{CodeGen => IR}/GCStrategy.cpp | 2 +- 15 files changed, 20 insertions(+), 22 deletions(-) rename include/llvm/{CodeGen => IR}/BuiltinGCs.h (89%) rename include/llvm/{CodeGen => IR}/GCStrategy.h (98%) rename lib/{CodeGen => IR}/BuiltinGCs.cpp (98%) rename lib/{CodeGen => IR}/GCStrategy.cpp (94%) diff --git a/include/llvm/CodeGen/GCMetadata.h b/include/llvm/CodeGen/GCMetadata.h index 77cd356c49d..334c5c23b8f 100644 --- a/include/llvm/CodeGen/GCMetadata.h +++ b/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 #include diff --git a/include/llvm/CodeGen/LinkAllAsmWriterComponents.h b/include/llvm/CodeGen/LinkAllAsmWriterComponents.h index 75a5c359630..81b0025fddd 100644 --- a/include/llvm/CodeGen/LinkAllAsmWriterComponents.h +++ b/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 namespace { diff --git a/include/llvm/CodeGen/LinkAllCodegenComponents.h b/include/llvm/CodeGen/LinkAllCodegenComponents.h index 56c93b24147..1b13ff53ac8 100644 --- a/include/llvm/CodeGen/LinkAllCodegenComponents.h +++ b/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/include/llvm/CodeGen/BuiltinGCs.h b/include/llvm/IR/BuiltinGCs.h similarity index 89% rename from include/llvm/CodeGen/BuiltinGCs.h rename to include/llvm/IR/BuiltinGCs.h index c1c3cdc22b3..16aff01dbcf 100644 --- a/include/llvm/CodeGen/BuiltinGCs.h +++ b/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/include/llvm/CodeGen/GCStrategy.h b/include/llvm/IR/GCStrategy.h similarity index 98% rename from include/llvm/CodeGen/GCStrategy.h rename to include/llvm/IR/GCStrategy.h index c5731528da4..a69958d596c 100644 --- a/include/llvm/CodeGen/GCStrategy.h +++ b/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; } // end namespace llvm -#endif // LLVM_CODEGEN_GCSTRATEGY_H +#endif // LLVM_IR_GCSTRATEGY_H diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f8f64599b21..7c7279b4fde 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/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/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp b/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp index 0a1260858ab..70777f07fc6 100644 --- a/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp +++ b/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/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp b/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp index 354b638b47a..a9fb31d4267 100644 --- a/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp +++ b/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/lib/CodeGen/CMakeLists.txt b/lib/CodeGen/CMakeLists.txt index 55a8f81641f..a5fb0d84929 100644 --- a/lib/CodeGen/CMakeLists.txt +++ b/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/lib/CodeGen/GCMetadata.cpp b/lib/CodeGen/GCMetadata.cpp index 01167c05967..8fae798b31d 100644 --- a/lib/CodeGen/GCMetadata.cpp +++ b/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/lib/CodeGen/GCRootLowering.cpp b/lib/CodeGen/GCRootLowering.cpp index c3b0cd92498..faf0fb7f09a 100644 --- a/lib/CodeGen/GCRootLowering.cpp +++ b/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/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/lib/CodeGen/SelectionDAG/StatepointLowering.cpp index 9d80e7a1222..b6e7debe717 100644 --- a/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ b/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/lib/CodeGen/BuiltinGCs.cpp b/lib/IR/BuiltinGCs.cpp similarity index 98% rename from lib/CodeGen/BuiltinGCs.cpp rename to lib/IR/BuiltinGCs.cpp index bfc10cb3fef..31ee86383e7 100644 --- a/lib/CodeGen/BuiltinGCs.cpp +++ b/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/lib/IR/CMakeLists.txt b/lib/IR/CMakeLists.txt index fb4993742e8..7f6e698b10f 100644 --- a/lib/IR/CMakeLists.txt +++ b/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/lib/CodeGen/GCStrategy.cpp b/lib/IR/GCStrategy.cpp similarity index 94% rename from lib/CodeGen/GCStrategy.cpp rename to lib/IR/GCStrategy.cpp index 43d06b0f82e..25dad5bec9e 100644 --- a/lib/CodeGen/GCStrategy.cpp +++ b/lib/IR/GCStrategy.cpp @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/CodeGen/GCStrategy.h" +#include "llvm/IR/GCStrategy.h" using namespace llvm;