2012-12-12 05:25:42 +08:00
|
|
|
//===-- AMDGPU.h - MachineFunction passes hw codegen --------------*- C++ -*-=//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPU_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_AMDGPU_H
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2016-10-04 02:47:26 +08:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class AMDGPUTargetMachine;
|
2013-06-08 04:37:48 +08:00
|
|
|
class FunctionPass;
|
2016-07-20 07:16:53 +08:00
|
|
|
class GCNTargetMachine;
|
2016-08-12 03:18:50 +08:00
|
|
|
class ModulePass;
|
|
|
|
class Pass;
|
2013-06-08 04:37:48 +08:00
|
|
|
class Target;
|
|
|
|
class TargetMachine;
|
2016-08-12 03:18:50 +08:00
|
|
|
class PassRegistry;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
// R600 Passes
|
2013-06-06 05:38:04 +08:00
|
|
|
FunctionPass *createR600VectorRegMerger(TargetMachine &tm);
|
2012-12-12 05:25:42 +08:00
|
|
|
FunctionPass *createR600ExpandSpecialInstrsPass(TargetMachine &tm);
|
2013-12-12 01:51:41 +08:00
|
|
|
FunctionPass *createR600EmitClauseMarkers();
|
2013-10-02 03:32:58 +08:00
|
|
|
FunctionPass *createR600ClauseMergePass(TargetMachine &tm);
|
2013-04-30 08:14:27 +08:00
|
|
|
FunctionPass *createR600Packetizer(TargetMachine &tm);
|
2013-04-02 05:48:05 +08:00
|
|
|
FunctionPass *createR600ControlFlowFinalizer(TargetMachine &tm);
|
2013-12-12 01:51:47 +08:00
|
|
|
FunctionPass *createAMDGPUCFGStructurizerPass();
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
// SI Passes
|
2013-08-15 07:24:45 +08:00
|
|
|
FunctionPass *createSITypeRewriter();
|
2012-12-20 06:10:31 +08:00
|
|
|
FunctionPass *createSIAnnotateControlFlowPass();
|
2014-11-22 06:06:37 +08:00
|
|
|
FunctionPass *createSIFoldOperandsPass();
|
2014-04-30 23:31:33 +08:00
|
|
|
FunctionPass *createSILowerI1CopiesPass();
|
2014-07-22 00:55:33 +08:00
|
|
|
FunctionPass *createSIShrinkInstructionsPass();
|
2014-10-11 06:01:59 +08:00
|
|
|
FunctionPass *createSILoadStoreOptimizerPass(TargetMachine &tm);
|
2016-03-22 04:28:33 +08:00
|
|
|
FunctionPass *createSIWholeQuadModePass();
|
2015-05-13 01:13:02 +08:00
|
|
|
FunctionPass *createSIFixControlFlowLiveIntervalsPass();
|
2015-11-04 06:30:13 +08:00
|
|
|
FunctionPass *createSIFixSGPRCopiesPass();
|
2016-05-11 02:33:41 +08:00
|
|
|
FunctionPass *createSIDebuggerInsertNopsPass();
|
2016-02-06 01:42:38 +08:00
|
|
|
FunctionPass *createSIInsertWaitsPass();
|
2016-07-20 07:16:53 +08:00
|
|
|
FunctionPass *createAMDGPUCodeGenPreparePass(const GCNTargetMachine *TM = nullptr);
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-11-07 02:01:57 +08:00
|
|
|
ModulePass *createAMDGPUAnnotateKernelFeaturesPass();
|
|
|
|
void initializeAMDGPUAnnotateKernelFeaturesPass(PassRegistry &);
|
|
|
|
extern char &AMDGPUAnnotateKernelFeaturesID;
|
|
|
|
|
2014-11-22 06:06:37 +08:00
|
|
|
void initializeSIFoldOperandsPass(PassRegistry &);
|
|
|
|
extern char &SIFoldOperandsID;
|
|
|
|
|
2016-06-10 07:18:47 +08:00
|
|
|
void initializeSIShrinkInstructionsPass(PassRegistry&);
|
|
|
|
extern char &SIShrinkInstructionsID;
|
|
|
|
|
2015-11-04 06:30:13 +08:00
|
|
|
void initializeSIFixSGPRCopiesPass(PassRegistry &);
|
|
|
|
extern char &SIFixSGPRCopiesID;
|
|
|
|
|
2014-04-30 23:31:33 +08:00
|
|
|
void initializeSILowerI1CopiesPass(PassRegistry &);
|
|
|
|
extern char &SILowerI1CopiesID;
|
|
|
|
|
2014-10-11 06:01:59 +08:00
|
|
|
void initializeSILoadStoreOptimizerPass(PassRegistry &);
|
|
|
|
extern char &SILoadStoreOptimizerID;
|
|
|
|
|
2016-03-22 04:28:33 +08:00
|
|
|
void initializeSIWholeQuadModePass(PassRegistry &);
|
|
|
|
extern char &SIWholeQuadModeID;
|
|
|
|
|
2016-02-12 10:16:10 +08:00
|
|
|
void initializeSILowerControlFlowPass(PassRegistry &);
|
2016-08-23 03:33:16 +08:00
|
|
|
extern char &SILowerControlFlowID;
|
2016-02-12 10:16:10 +08:00
|
|
|
|
2016-08-23 03:33:16 +08:00
|
|
|
void initializeSIInsertSkipsPass(PassRegistry &);
|
|
|
|
extern char &SIInsertSkipsPassID;
|
2016-02-12 10:16:10 +08:00
|
|
|
|
2016-09-29 09:44:16 +08:00
|
|
|
void initializeSIOptimizeExecMaskingPass(PassRegistry &);
|
|
|
|
extern char &SIOptimizeExecMaskingID;
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
// Passes common to R600 and SI
|
2016-01-30 13:19:45 +08:00
|
|
|
FunctionPass *createAMDGPUPromoteAlloca(const TargetMachine *TM = nullptr);
|
|
|
|
void initializeAMDGPUPromoteAllocaPass(PassRegistry&);
|
|
|
|
extern char &AMDGPUPromoteAllocaID;
|
|
|
|
|
2012-12-20 06:10:31 +08:00
|
|
|
Pass *createAMDGPUStructurizeCFGPass();
|
2016-10-04 02:47:26 +08:00
|
|
|
FunctionPass *createAMDGPUISelDag(TargetMachine &TM,
|
|
|
|
CodeGenOpt::Level OptLevel);
|
2014-11-04 03:49:05 +08:00
|
|
|
ModulePass *createAMDGPUAlwaysInlinePass();
|
2015-08-08 07:19:30 +08:00
|
|
|
ModulePass *createAMDGPUOpenCLImageTypeLoweringPass();
|
2015-12-16 04:55:55 +08:00
|
|
|
FunctionPass *createAMDGPUAnnotateUniformValues();
|
2013-06-08 04:37:48 +08:00
|
|
|
|
2015-05-13 01:13:02 +08:00
|
|
|
void initializeSIFixControlFlowLiveIntervalsPass(PassRegistry&);
|
|
|
|
extern char &SIFixControlFlowLiveIntervalsID;
|
|
|
|
|
2015-12-16 04:55:55 +08:00
|
|
|
void initializeAMDGPUAnnotateUniformValuesPass(PassRegistry&);
|
|
|
|
extern char &AMDGPUAnnotateUniformValuesPassID;
|
2014-07-03 04:53:48 +08:00
|
|
|
|
2016-06-24 15:07:55 +08:00
|
|
|
void initializeAMDGPUCodeGenPreparePass(PassRegistry&);
|
|
|
|
extern char &AMDGPUCodeGenPrepareID;
|
|
|
|
|
2016-01-20 23:48:27 +08:00
|
|
|
void initializeSIAnnotateControlFlowPass(PassRegistry&);
|
|
|
|
extern char &SIAnnotateControlFlowPassID;
|
|
|
|
|
2016-05-11 02:33:41 +08:00
|
|
|
void initializeSIDebuggerInsertNopsPass(PassRegistry&);
|
|
|
|
extern char &SIDebuggerInsertNopsID;
|
2016-03-03 11:53:29 +08:00
|
|
|
|
2016-02-06 01:42:38 +08:00
|
|
|
void initializeSIInsertWaitsPass(PassRegistry&);
|
|
|
|
extern char &SIInsertWaitsID;
|
|
|
|
|
2013-06-08 04:37:48 +08:00
|
|
|
extern Target TheAMDGPUTarget;
|
2015-01-07 02:00:21 +08:00
|
|
|
extern Target TheGCNTarget;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-07-21 22:01:14 +08:00
|
|
|
namespace AMDGPU {
|
|
|
|
enum TargetIndex {
|
2015-01-21 01:49:47 +08:00
|
|
|
TI_CONSTDATA_START,
|
|
|
|
TI_SCRATCH_RSRC_DWORD0,
|
|
|
|
TI_SCRATCH_RSRC_DWORD1,
|
|
|
|
TI_SCRATCH_RSRC_DWORD2,
|
|
|
|
TI_SCRATCH_RSRC_DWORD3
|
2014-07-21 22:01:14 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
} // End namespace llvm
|
|
|
|
|
2013-06-08 04:37:48 +08:00
|
|
|
/// OpenCL uses address spaces to differentiate between
|
|
|
|
/// various memory regions on the hardware. On the CPU
|
|
|
|
/// all of the address spaces point to the same memory,
|
|
|
|
/// however on the GPU, each address space points to
|
2014-01-25 01:20:08 +08:00
|
|
|
/// a separate piece of memory that is unique from other
|
2013-06-08 04:37:48 +08:00
|
|
|
/// memory locations.
|
|
|
|
namespace AMDGPUAS {
|
2015-06-09 05:57:57 +08:00
|
|
|
enum AddressSpaces : unsigned {
|
2013-06-08 04:37:48 +08:00
|
|
|
PRIVATE_ADDRESS = 0, ///< Address space for private memory.
|
|
|
|
GLOBAL_ADDRESS = 1, ///< Address space for global memory (RAT0, VTX0).
|
2016-05-14 04:39:16 +08:00
|
|
|
CONSTANT_ADDRESS = 2, ///< Address space for constant memory (VTX2)
|
2013-06-08 04:37:48 +08:00
|
|
|
LOCAL_ADDRESS = 3, ///< Address space for local memory.
|
2014-05-23 02:27:07 +08:00
|
|
|
FLAT_ADDRESS = 4, ///< Address space for flat memory.
|
|
|
|
REGION_ADDRESS = 5, ///< Address space for region memory.
|
2013-06-08 04:37:48 +08:00
|
|
|
PARAM_D_ADDRESS = 6, ///< Address space for direct addressible parameter memory (CONST0)
|
|
|
|
PARAM_I_ADDRESS = 7, ///< Address space for indirect addressible parameter memory (VTX1)
|
2013-07-23 09:48:18 +08:00
|
|
|
|
|
|
|
// Do not re-order the CONSTANT_BUFFER_* enums. Several places depend on this
|
|
|
|
// order to be able to dynamically index a constant buffer, for example:
|
|
|
|
//
|
|
|
|
// ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx
|
|
|
|
|
2013-06-08 04:37:48 +08:00
|
|
|
CONSTANT_BUFFER_0 = 8,
|
|
|
|
CONSTANT_BUFFER_1 = 9,
|
|
|
|
CONSTANT_BUFFER_2 = 10,
|
|
|
|
CONSTANT_BUFFER_3 = 11,
|
|
|
|
CONSTANT_BUFFER_4 = 12,
|
|
|
|
CONSTANT_BUFFER_5 = 13,
|
|
|
|
CONSTANT_BUFFER_6 = 14,
|
|
|
|
CONSTANT_BUFFER_7 = 15,
|
|
|
|
CONSTANT_BUFFER_8 = 16,
|
|
|
|
CONSTANT_BUFFER_9 = 17,
|
|
|
|
CONSTANT_BUFFER_10 = 18,
|
|
|
|
CONSTANT_BUFFER_11 = 19,
|
|
|
|
CONSTANT_BUFFER_12 = 20,
|
|
|
|
CONSTANT_BUFFER_13 = 21,
|
|
|
|
CONSTANT_BUFFER_14 = 22,
|
|
|
|
CONSTANT_BUFFER_15 = 23,
|
2015-06-05 00:17:42 +08:00
|
|
|
|
|
|
|
// Some places use this if the address space can't be determined.
|
|
|
|
UNKNOWN_ADDRESS_SPACE = ~0u
|
2013-06-08 04:37:48 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace AMDGPUAS
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|