Skip to content

Commit

Permalink
Restore CodeGen/LowLevelType from Support
Browse files Browse the repository at this point in the history
This is rework of;
  - D30046 (LLT)

Since I have introduced `llvm-min-tblgen` as D146352, `llvm-tblgen`
may depend on `CodeGen`.

`LowLevlType.h` originally belonged to `CodeGen`. Almost all userse are
still under `CodeGen` or `Target`. I think `CodeGen` is the right place
to put `LowLevelType.h`.

`MachineValueType.h` may be moved as well. (later, D149024)

I have made many modules depend on `CodeGen`. It is consistent but
inefficient. It will be split out later, D148769

Besides, I had to isolate MVT and LLT in modmap, since
`llvm::PredicateInfo` clashes between `TableGen/CodeGenSchedule.h`
and `Transforms/Utils/PredicateInfo.h`.
(I think better to introduce namespace llvm::TableGen)

Depends on D145937, D146352, and D148768.

Differential Revision: https://reviews.llvm.org/D148767
  • Loading branch information
chapuni committed May 2, 2023
1 parent 2df215f commit 9cfeba5
Show file tree
Hide file tree
Showing 70 changed files with 88 additions and 33 deletions.
1 change: 1 addition & 0 deletions clang/lib/CodeGen/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
Analysis
BitReader
BitWriter
CodeGen
Core
Coroutines
Coverage
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
Expand Up @@ -17,13 +17,13 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetCallingConv.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/MachineValueType.h"
#include <cstdint>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
Expand Up @@ -19,8 +19,8 @@

#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/Register.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/IR/InstrTypes.h"
#include <functional>

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h
Expand Up @@ -18,9 +18,9 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include <bitset>
#include <cstddef>
#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h
Expand Up @@ -16,8 +16,8 @@
#define LLVM_CODEGEN_GLOBALISEL_LEGACYLEGALIZERINFO_H

#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include <unordered_map>

namespace llvm {
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
Expand Up @@ -17,12 +17,12 @@
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include <cassert>
#include <cstdint>
#include <tuple>
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/Utils.h
Expand Up @@ -17,11 +17,11 @@
#include "GISelWorkList.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/Register.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include <cstdint>

namespace llvm {
Expand Down
@@ -1,4 +1,4 @@
//== llvm/Support/LowLevelTypeImpl.h --------------------------- -*- C++ -*-==//
//== llvm/CodeGen/LowLevelType.h ------------------------------- -*- C++ -*-==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -23,8 +23,8 @@
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_LOWLEVELTYPEIMPL_H
#define LLVM_SUPPORT_LOWLEVELTYPEIMPL_H
#ifndef LLVM_CODEGEN_LOWLEVELTYPE_H
#define LLVM_CODEGEN_LOWLEVELTYPE_H

#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/Debug.h"
Expand Down Expand Up @@ -428,4 +428,4 @@ template<> struct DenseMapInfo<LLT> {

}

#endif // LLVM_SUPPORT_LOWLEVELTYPEIMPL_H
#endif // LLVM_CODEGEN_LOWLEVELTYPE_H
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/LowLevelTypeUtils.h
Expand Up @@ -16,8 +16,8 @@
#ifndef LLVM_CODEGEN_LOWLEVELTYPEUTILS_H
#define LLVM_CODEGEN_LOWLEVELTYPEUTILS_H

#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/Support/LowLevelTypeImpl.h"

namespace llvm {

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/MachineMemOperand.h
Expand Up @@ -17,12 +17,12 @@

#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Value.h" // PointerLikeTypeTraits<Value*>
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/LowLevelTypeImpl.h"

namespace llvm {

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/RegisterBankInfo.h
Expand Up @@ -18,9 +18,9 @@
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/Register.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include <cassert>
#include <initializer_list>
#include <memory>
Expand Down
8 changes: 8 additions & 0 deletions llvm/include/llvm/module.modulemap
Expand Up @@ -15,6 +15,14 @@ module LLVM_AsmParser {
module * { export * }
}

module LLVM_CodeGenTypes {
requires cplusplus

module LLT {
header "CodeGen/LowLevelType.h" export *
}
}

// A module covering CodeGen/ and Target/. These are intertwined
// and codependent, and thus notionally form a single module.
module LLVM_Backend {
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/CMakeLists.txt
Expand Up @@ -99,6 +99,7 @@ add_llvm_component_library(LLVMCodeGen
LLVMTargetMachine.cpp
LocalStackSlotAllocation.cpp
LoopTraversal.cpp
LowLevelType.cpp
LowLevelTypeUtils.cpp
LowerEmuTLS.cpp
MachineBasicBlock.cpp
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
Expand Up @@ -28,6 +28,7 @@
#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
#include "llvm/CodeGen/GlobalISel/InlineAsmLowering.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/LowLevelTypeUtils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
Expand Down Expand Up @@ -74,7 +75,6 @@
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
Expand Up @@ -13,6 +13,7 @@

#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
Expand All @@ -21,7 +22,6 @@
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include <algorithm>

using namespace llvm;
Expand Down
@@ -1,4 +1,4 @@
//===-- llvm/Support/LowLevelType.cpp -------------------------------------===//
//===-- llvm/CodeGen/LowLevelType.cpp -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MIRParser/MIParser.cpp
Expand Up @@ -24,6 +24,7 @@
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/AsmParser/SlotMapping.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MIRFormatter.h"
#include "llvm/CodeGen/MIRPrinter.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
Expand Down Expand Up @@ -62,7 +63,6 @@
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MIRPrinter.cpp
Expand Up @@ -18,6 +18,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MIRYamlMapping.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineConstantPool.h"
Expand Down Expand Up @@ -47,7 +48,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineInstr.cpp
Expand Up @@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
Expand Down Expand Up @@ -50,7 +51,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineVerifier.cpp
Expand Up @@ -37,6 +37,7 @@
#include "llvm/CodeGen/LiveRangeCalc.h"
#include "llvm/CodeGen/LiveStacks.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
Expand Down Expand Up @@ -71,7 +72,6 @@
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/raw_ostream.h"
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Support/CMakeLists.txt
Expand Up @@ -183,7 +183,6 @@ add_llvm_component_library(LLVMSupport
LineIterator.cpp
Locale.cpp
LockFileManager.cpp
LowLevelType.cpp
ManagedStatic.cpp
MathExtras.cpp
MemAlloc.cpp
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AsmParser/CMakeLists.txt
Expand Up @@ -7,6 +7,7 @@ add_llvm_component_library(LLVMAArch64AsmParser
AArch64Desc
AArch64Info
AArch64Utils
CodeGen
MC
MCParser
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/MCTargetDesc/CMakeLists.txt
Expand Up @@ -16,6 +16,7 @@ add_llvm_component_library(LLVMAArch64Desc
AArch64Info
AArch64Utils
BinaryFormat
CodeGen
MC
Support
TargetParser
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.cpp
Expand Up @@ -10,8 +10,8 @@
#include "GCNSubtarget.h"
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/IR/Constants.h"
#include "llvm/Support/LowLevelTypeImpl.h"

using namespace llvm;
using namespace MIPatternMatch;
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AMDGPU/AsmParser/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@ add_llvm_component_library(LLVMAMDGPUAsmParser
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
CodeGen
MC
MCParser
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AMDGPU/Disassembler/CMakeLists.txt
Expand Up @@ -7,6 +7,7 @@ add_llvm_component_library(LLVMAMDGPUDisassembler
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
CodeGen
MC
MCDisassembler
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AMDGPU/MCA/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@ add_llvm_component_library(LLVMAMDGPUTargetMCA
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
CodeGen
MC
MCA
MCParser
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AMDGPU/MCTargetDesc/CMakeLists.txt
Expand Up @@ -16,6 +16,7 @@ add_llvm_component_library(LLVMAMDGPUDesc
AMDGPUInfo
AMDGPUUtils
BinaryFormat
CodeGen
Core
MC
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AMDGPU/Utils/CMakeLists.txt
Expand Up @@ -8,6 +8,7 @@ add_llvm_component_library(LLVMAMDGPUUtils
LINK_COMPONENTS
Analysis
BinaryFormat
CodeGen
Core
MC
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/ARC/Disassembler/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@ add_llvm_component_library(LLVMARCDisassembler

LINK_COMPONENTS
ARCInfo
CodeGen
MCDisassembler
Support

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/ARM/ARMCallLowering.cpp
Expand Up @@ -22,6 +22,7 @@
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/LowLevelType.h"
#include "llvm/CodeGen/LowLevelTypeUtils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
Expand All @@ -40,7 +41,6 @@
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/MachineValueType.h"
#include <algorithm>
#include <cassert>
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/ARM/AsmParser/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@ add_llvm_component_library(LLVMARMAsmParser
ARMDesc
ARMInfo
ARMUtils
CodeGen
MC
MCParser
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/ARM/Disassembler/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@ add_llvm_component_library(LLVMARMDisassembler
ARMDesc
ARMInfo
ARMUtils
CodeGen
MC
MCDisassembler
Support
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/ARM/MCTargetDesc/CMakeLists.txt
Expand Up @@ -18,6 +18,7 @@ add_llvm_component_library(LLVMARMDesc
ARMInfo
ARMUtils
BinaryFormat
CodeGen
MC
MCDisassembler
Support
Expand Down

0 comments on commit 9cfeba5

Please sign in to comment.