forked from OSchip/llvm-project
[IR] Split out target specific intrinsic enums into separate headers
This has two main effects: - Optimizes debug info size by saving 221.86 MB of obj file size in a Windows optimized+debug build of 'all'. This is 3.03% of 7,332.7MB of object file size. - Incremental step towards decoupling target intrinsics. The enums are still compact, so adding and removing a single target-specific intrinsic will trigger a rebuild of all of LLVM. Assigning distinct target id spaces is potential future work. Part of PR34259 Reviewers: efriedma, echristo, MaskRay Reviewed By: echristo, MaskRay Differential Revision: https://reviews.llvm.org/D71320
This commit is contained in:
parent
85ba5f637a
commit
5d986953c8
|
@ -31,6 +31,17 @@
|
|||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/IntrinsicsBPF.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/IR/IntrinsicsPowerPC.h"
|
||||
#include "llvm/IR/IntrinsicsR600.h"
|
||||
#include "llvm/IR/IntrinsicsS390.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/MDBuilder.h"
|
||||
#include "llvm/Support/ConvertUTF.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CodeGenFunction.h"
|
||||
#include "CGCXXABI.h"
|
||||
#include "CGCleanup.h"
|
||||
#include "CGObjCRuntime.h"
|
||||
#include "CodeGenFunction.h"
|
||||
#include "ConstantEmitter.h"
|
||||
#include "TargetInfo.h"
|
||||
#include "clang/AST/Mangle.h"
|
||||
|
@ -21,8 +21,9 @@
|
|||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/AST/StmtVisitor.h"
|
||||
#include "clang/Basic/TargetBuiltins.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/Support/SaveAndRestore.h"
|
||||
|
||||
using namespace clang;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "llvm/IR/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsPowerPC.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include <cstdarg>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "clang/AST/StmtVisitor.h"
|
||||
#include "clang/Basic/Cuda.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
|
||||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
namespace llvm {
|
||||
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned;
|
||||
typedef unsigned ID;
|
||||
}
|
||||
|
||||
class AssumptionCache;
|
||||
|
|
|
@ -252,7 +252,7 @@ class Type;
|
|||
class Value;
|
||||
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned;
|
||||
typedef unsigned ID;
|
||||
}
|
||||
|
||||
/// Identify if the intrinsic is trivially vectorizable.
|
||||
|
|
|
@ -2,6 +2,20 @@ set(LLVM_TARGET_DEFINITIONS Attributes.td)
|
|||
tablegen(LLVM Attributes.inc -gen-attrs)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS Intrinsics.td)
|
||||
tablegen(LLVM IntrinsicEnums.inc -gen-intrinsic-enums)
|
||||
tablegen(LLVM IntrinsicImpl.inc -gen-intrinsic-impl)
|
||||
tablegen(LLVM IntrinsicEnums.inc -gen-intrinsic-enums)
|
||||
tablegen(LLVM IntrinsicsAArch64.h -gen-intrinsic-enums -intrinsic-prefix=aarch64)
|
||||
tablegen(LLVM IntrinsicsAMDGPU.h -gen-intrinsic-enums -intrinsic-prefix=amdgcn)
|
||||
tablegen(LLVM IntrinsicsARM.h -gen-intrinsic-enums -intrinsic-prefix=arm)
|
||||
tablegen(LLVM IntrinsicsBPF.h -gen-intrinsic-enums -intrinsic-prefix=bpf)
|
||||
tablegen(LLVM IntrinsicsHexagon.h -gen-intrinsic-enums -intrinsic-prefix=hexagon)
|
||||
tablegen(LLVM IntrinsicsMips.h -gen-intrinsic-enums -intrinsic-prefix=mips)
|
||||
tablegen(LLVM IntrinsicsNVPTX.h -gen-intrinsic-enums -intrinsic-prefix=nvvm)
|
||||
tablegen(LLVM IntrinsicsPowerPC.h -gen-intrinsic-enums -intrinsic-prefix=ppc)
|
||||
tablegen(LLVM IntrinsicsR600.h -gen-intrinsic-enums -intrinsic-prefix=r600)
|
||||
tablegen(LLVM IntrinsicsRISCV.h -gen-intrinsic-enums -intrinsic-prefix=riscv)
|
||||
tablegen(LLVM IntrinsicsS390.h -gen-intrinsic-enums -intrinsic-prefix=s390)
|
||||
tablegen(LLVM IntrinsicsWebAssembly.h -gen-intrinsic-enums -intrinsic-prefix=wasm)
|
||||
tablegen(LLVM IntrinsicsX86.h -gen-intrinsic-enums -intrinsic-prefix=x86)
|
||||
tablegen(LLVM IntrinsicsXCore.h -gen-intrinsic-enums -intrinsic-prefix=xcore)
|
||||
add_public_tablegen_target(intrinsics_gen)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
namespace llvm {
|
||||
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned;
|
||||
typedef unsigned ID;
|
||||
}
|
||||
|
||||
template <typename FunTy = const Function, typename BBTy = const BasicBlock,
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
namespace llvm {
|
||||
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned;
|
||||
typedef unsigned ID;
|
||||
}
|
||||
|
||||
class AssemblyAnnotationWriter;
|
||||
|
|
|
@ -38,7 +38,7 @@ class GlobalObject;
|
|||
class Module;
|
||||
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned;
|
||||
typedef unsigned ID;
|
||||
} // end namespace Intrinsic
|
||||
|
||||
class GlobalValue : public Constant {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
namespace llvm {
|
||||
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned;
|
||||
typedef unsigned ID;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -33,14 +33,17 @@ class AttributeList;
|
|||
/// function known by LLVM. The enum values are returned by
|
||||
/// Function::getIntrinsicID().
|
||||
namespace Intrinsic {
|
||||
enum ID : unsigned {
|
||||
not_intrinsic = 0, // Must be zero
|
||||
// Intrinsic ID type. This is an opaque typedef to facilitate splitting up
|
||||
// the enum into target-specific enums.
|
||||
typedef unsigned ID;
|
||||
|
||||
// Get the intrinsic enums generated from Intrinsics.td
|
||||
enum IndependentIntrinsics : unsigned {
|
||||
not_intrinsic = 0, // Must be zero
|
||||
|
||||
// Get the intrinsic enums generated from Intrinsics.td
|
||||
#define GET_INTRINSIC_ENUM_VALUES
|
||||
#include "llvm/IR/IntrinsicEnums.inc"
|
||||
#undef GET_INTRINSIC_ENUM_VALUES
|
||||
, num_intrinsics
|
||||
};
|
||||
|
||||
/// Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "llvm/IR/InstrTypes.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/MDBuilder.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
||||
#include "llvm/Analysis/BlockFrequencyInfo.h"
|
||||
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
||||
#include "llvm/Analysis/ConstantFolding.h"
|
||||
#include "llvm/Analysis/EHPersonalities.h"
|
||||
#include "llvm/Analysis/Loads.h"
|
||||
|
@ -86,6 +86,8 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/User.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
|
|
|
@ -30,8 +30,21 @@
|
|||
#include "llvm/IR/InstIterator.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/IntrinsicsBPF.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/IR/IntrinsicsMips.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/IR/IntrinsicsPowerPC.h"
|
||||
#include "llvm/IR/IntrinsicsR600.h"
|
||||
#include "llvm/IR/IntrinsicsRISCV.h"
|
||||
#include "llvm/IR/IntrinsicsS390.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/IntrinsicsXCore.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/MDBuilder.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
|
@ -560,7 +573,8 @@ Intrinsic::ID Function::lookupIntrinsicID(StringRef Name) {
|
|||
const auto MatchSize = strlen(NameTable[Idx]);
|
||||
assert(Name.size() >= MatchSize && "Expected either exact or prefix match");
|
||||
bool IsExactMatch = Name.size() == MatchSize;
|
||||
return IsExactMatch || isOverloaded(ID) ? ID : Intrinsic::not_intrinsic;
|
||||
return IsExactMatch || Intrinsic::isOverloaded(ID) ? ID
|
||||
: Intrinsic::not_intrinsic;
|
||||
}
|
||||
|
||||
void Function::recalculateIntrinsicID() {
|
||||
|
@ -639,7 +653,7 @@ static std::string getMangledTypeStr(Type* Ty) {
|
|||
|
||||
StringRef Intrinsic::getName(ID id) {
|
||||
assert(id < num_intrinsics && "Invalid intrinsic ID!");
|
||||
assert(!isOverloaded(id) &&
|
||||
assert(!Intrinsic::isOverloaded(id) &&
|
||||
"This version of getName does not support overloading");
|
||||
return IntrinsicNameTable[id];
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "llvm/IR/Function.h" // To access function attributes.
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/KnownBits.h"
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "AArch64ExpandImm.h"
|
||||
#include "AArch64ISelLowering.h"
|
||||
#include "AArch64CallingConvention.h"
|
||||
#include "AArch64ExpandImm.h"
|
||||
#include "AArch64MachineFunctionInfo.h"
|
||||
#include "AArch64PerfectShuffle.h"
|
||||
#include "AArch64RegisterInfo.h"
|
||||
|
@ -58,6 +58,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/OperandTraits.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "llvm/CodeGen/CostTable.h"
|
||||
#include "llvm/CodeGen/TargetLowering.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#define LLVM_LIB_TARGET_AMDGPU_AMDGPU_H
|
||||
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/IR/IntrinsicsR600.h" // TODO: Sink this.
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h" // TODO: Sink this.
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/IR/IntrinsicsR600.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
@ -268,7 +270,7 @@ AMDGPUPromoteAlloca::getLocalSizeYZ(IRBuilder<> &Builder) {
|
|||
Value *AMDGPUPromoteAlloca::getWorkitemID(IRBuilder<> &Builder, unsigned N) {
|
||||
const AMDGPUSubtarget &ST =
|
||||
AMDGPUSubtarget::get(*TM, *Builder.GetInsertBlock()->getParent());
|
||||
Intrinsic::ID IntrID = Intrinsic::ID::not_intrinsic;
|
||||
Intrinsic::ID IntrID = Intrinsic::not_intrinsic;
|
||||
|
||||
switch (N) {
|
||||
case 0:
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "llvm/CodeGen/SelectionDAG.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/IntrinsicsR600.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "AMDGPUBaseInfo.h"
|
||||
#include "AMDGPUTargetTransformInfo.h"
|
||||
#include "AMDGPU.h"
|
||||
#include "SIDefines.h"
|
||||
#include "AMDGPUAsmUtils.h"
|
||||
#include "AMDGPUTargetTransformInfo.h"
|
||||
#include "SIDefines.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
|
@ -20,6 +20,8 @@
|
|||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/IR/IntrinsicsR600.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
||||
#define DEBUG_TYPE "arm-isel"
|
||||
|
|
|
@ -14,23 +14,24 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "ARM.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/LoopAccessAnalysis.h"
|
||||
#include "llvm/Analysis/OrderedBasicBlock.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/NoFolder.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/PassRegistry.h"
|
||||
#include "llvm/PassSupport.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
#include "ARM.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace PatternMatch;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
/// - A loop containing multiple VCPT instructions, predicating multiple VPT
|
||||
/// blocks of instructions operating on different vector types.
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Analysis/LoopPass.h"
|
||||
#include "llvm/Analysis/ScalarEvolution.h"
|
||||
|
@ -28,13 +30,12 @@
|
|||
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include "ARM.h"
|
||||
#include "ARMSubtarget.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "llvm/CodeGen/SelectionDAGISel.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsBPF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Hexagon.h"
|
||||
#include "HexagonISelDAGToDAG.h"
|
||||
#include "Hexagon.h"
|
||||
#include "HexagonISelLowering.h"
|
||||
#include "HexagonMachineFunctionInfo.h"
|
||||
#include "HexagonTargetMachine.h"
|
||||
|
@ -19,6 +19,7 @@
|
|||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/SelectionDAGISel.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
using namespace llvm;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/SelectionDAGISel.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
||||
|
|
|
@ -39,8 +39,9 @@
|
|||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsHexagon.h"
|
||||
#include "llvm/IR/Use.h"
|
||||
#include "llvm/IR/User.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||
#include "llvm/IR/IntrinsicsMips.h"
|
||||
|
||||
#define DEBUG_TYPE "mips-isel"
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "MipsLegalizerInfo.h"
|
||||
#include "MipsTargetMachine.h"
|
||||
#include "llvm/CodeGen/GlobalISel/LegalizerHelper.h"
|
||||
#include "llvm/IR/IntrinsicsMips.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsMips.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsMips.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "NVPTXISelDAGToDAG.h"
|
||||
#include "NVPTXUtilities.h"
|
||||
#include "MCTargetDesc/NVPTXBaseInfo.h"
|
||||
#include "NVPTXUtilities.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/Support/AtomicOrdering.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "llvm/Analysis/ConstantFolding.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "llvm/CodeGen/BasicTTIImpl.h"
|
||||
#include "llvm/CodeGen/CostTable.h"
|
||||
#include "llvm/CodeGen/TargetLowering.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
using namespace llvm;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "llvm/IR/InstIterator.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "llvm/IR/InstIterator.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsPowerPC.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Use.h"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/DiagnosticPrinter.h"
|
||||
#include "llvm/IR/IntrinsicsRISCV.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsS390.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/KnownBits.h"
|
||||
#include <cctype>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "llvm/IR/InstIterator.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsS390.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include <deque>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "llvm/CodeGen/SelectionDAGISel.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/Function.h" // To access function attributes.
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/KnownBits.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "llvm/IR/DiagnosticPrinter.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsWebAssembly.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "llvm/CodeGen/TargetRegisterInfo.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InstrTypes.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/Support/AtomicOrdering.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "X86ISelLowering.h"
|
||||
#include "X86InstrInfo.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsXCore.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "llvm/IR/GlobalAlias.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsXCore.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/KnownBits.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsXCore.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/NoFolder.h"
|
||||
#include "llvm/IR/ValueHandle.h"
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/IntrinsicsARM.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/IntrinsicsNVPTX.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/IR/IntrinsicsPowerPC.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "InstCombineInternal.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/Support/KnownBits.h"
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/MDBuilder.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
|
|
@ -28,7 +28,7 @@ def iAny : ValueType<0, 253>;
|
|||
def llvm_anyint_ty : LLVMType<iAny>;
|
||||
|
||||
// Make sure we generate the long name without crashing
|
||||
// CHECK: this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash // llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash
|
||||
// CHECK: this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash, // llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash
|
||||
def int_foo : Intrinsic<"llvm.foo", [llvm_anyint_ty]>;
|
||||
def int_this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash : Intrinsic<"llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash", [llvm_anyint_ty]>;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ def iAny : ValueType<0, 253>;
|
|||
def llvm_anyint_ty : LLVMType<iAny>;
|
||||
|
||||
// Make sure we can return up to 8 values
|
||||
// CHECK: returns_8_results // llvm.returns.8.results
|
||||
// CHECK: returns_8_results = {{[0-9]+}}, // llvm.returns.8.results
|
||||
def int_returns_8_results : Intrinsic<"llvm.returns.8.results",
|
||||
[llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty,
|
||||
llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty]>;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/MDBuilder.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
|
|
@ -15,14 +15,21 @@
|
|||
#include "SequenceToOffsetTable.h"
|
||||
#include "TableGenBackends.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/StringMatcher.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/TableGen/StringToOffsetTable.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
cl::OptionCategory GenIntrinsicCat("Options for -gen-intrinsic-enums");
|
||||
cl::opt<std::string>
|
||||
IntrinsicPrefix("intrinsic-prefix",
|
||||
cl::desc("Generate intrinsics with this target prefix"),
|
||||
cl::value_desc("target prefix"), cl::cat(GenIntrinsicCat));
|
||||
|
||||
namespace {
|
||||
class IntrinsicEmitter {
|
||||
RecordKeeper &Records;
|
||||
|
@ -57,12 +64,12 @@ void IntrinsicEmitter::run(raw_ostream &OS, bool Enums) {
|
|||
|
||||
CodeGenIntrinsicTable Ints(Records);
|
||||
|
||||
EmitPrefix(OS);
|
||||
|
||||
if (Enums) {
|
||||
// Emit the enum information.
|
||||
EmitEnumInfo(Ints, OS);
|
||||
} else {
|
||||
EmitPrefix(OS);
|
||||
|
||||
// Emit the target metadata.
|
||||
EmitTargetInfo(Ints, OS);
|
||||
|
||||
|
@ -83,9 +90,9 @@ void IntrinsicEmitter::run(raw_ostream &OS, bool Enums) {
|
|||
|
||||
// Emit code to translate MS builtins into LLVM intrinsics.
|
||||
EmitIntrinsicToBuiltinMap(Ints, false, OS);
|
||||
}
|
||||
|
||||
EmitSuffix(OS);
|
||||
EmitSuffix(OS);
|
||||
}
|
||||
}
|
||||
|
||||
void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) {
|
||||
|
@ -108,16 +115,63 @@ void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) {
|
|||
|
||||
void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
|
||||
raw_ostream &OS) {
|
||||
OS << "// Enum values for Intrinsics.h\n";
|
||||
OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n";
|
||||
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
|
||||
// Find the TargetSet for which to generate enums. There will be an initial
|
||||
// set with an empty target prefix which will include target independent
|
||||
// intrinsics like dbg.value.
|
||||
const CodeGenIntrinsicTable::TargetSet *Set = nullptr;
|
||||
for (const auto &Target : Ints.Targets) {
|
||||
if (Target.Name == IntrinsicPrefix) {
|
||||
Set = &Target;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!Set) {
|
||||
std::vector<std::string> KnownTargets;
|
||||
for (const auto &Target : Ints.Targets)
|
||||
if (!Target.Name.empty())
|
||||
KnownTargets.push_back(Target.Name);
|
||||
PrintFatalError("tried to generate intrinsics for unknown target " +
|
||||
IntrinsicPrefix +
|
||||
"\nKnown targets are: " + join(KnownTargets, ", ") + "\n");
|
||||
}
|
||||
|
||||
// Generate a complete header for target specific intrinsics.
|
||||
if (!IntrinsicPrefix.empty()) {
|
||||
std::string UpperPrefix = StringRef(IntrinsicPrefix).upper();
|
||||
OS << "#ifndef LLVM_IR_INTRINSIC_" << UpperPrefix << "_ENUMS_H\n";
|
||||
OS << "#define LLVM_IR_INTRINSIC_" << UpperPrefix << "_ENUMS_H\n\n";
|
||||
OS << "namespace llvm {\n";
|
||||
OS << "namespace Intrinsic {\n";
|
||||
OS << "enum " << UpperPrefix << "Intrinsics : unsigned {\n";
|
||||
} else {
|
||||
EmitPrefix(OS);
|
||||
}
|
||||
|
||||
OS << "// Enum values for intrinsics\n";
|
||||
for (unsigned i = Set->Offset, e = Set->Offset + Set->Count; i != e; ++i) {
|
||||
OS << " " << Ints[i].EnumName;
|
||||
OS << ((i != e-1) ? ", " : " ");
|
||||
|
||||
// Assign a value to the first intrinsic in this target set so that all
|
||||
// intrinsic ids are distinct.
|
||||
if (i == Set->Offset)
|
||||
OS << " = " << (Set->Offset + 1);
|
||||
|
||||
OS << ", ";
|
||||
if (Ints[i].EnumName.size() < 40)
|
||||
OS << std::string(40-Ints[i].EnumName.size(), ' ');
|
||||
OS.indent(40 - Ints[i].EnumName.size());
|
||||
OS << " // " << Ints[i].Name << "\n";
|
||||
}
|
||||
OS << "#endif\n\n";
|
||||
|
||||
// Emit num_intrinsics into the target neutral enum.
|
||||
if (IntrinsicPrefix.empty()) {
|
||||
OS << " num_intrinsics = " << (Ints.size() + 1) << "\n";
|
||||
EmitSuffix(OS);
|
||||
} else {
|
||||
OS << "}; // enum\n";
|
||||
OS << "} // namespace Intrinsic\n";
|
||||
OS << "} // namespace llvm\n\n";
|
||||
OS << "#endif\n";
|
||||
}
|
||||
}
|
||||
|
||||
void IntrinsicEmitter::EmitTargetInfo(const CodeGenIntrinsicTable &Ints,
|
||||
|
|
Loading…
Reference in New Issue