-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIR-V](2/6) Add SPIRV target description files
Differential Revision: https://reviews.llvm.org/D115786 Authors: Aleksandr Bezzubikov, Lewis Crawford, Ilia Diachkov, Michal Paszkowski, Andrey Tretyakov, Konrad Trifunovic Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com> Co-authored-by: Ilia Diachkov <iliya.diyachkov@intel.com> Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com> Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com> Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
- Loading branch information
1 parent
7fd4622
commit 40114dd
Showing
7 changed files
with
923 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===-- SPIRV.td - Describe the SPIR-V Target Machine ------*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
include "llvm/Target/Target.td" | ||
|
||
include "SPIRVRegisterInfo.td" | ||
include "SPIRVRegisterBanks.td" | ||
include "SPIRVInstrInfo.td" | ||
|
||
def SPIRVInstrInfo : InstrInfo; | ||
|
||
class Proc<string Name, list<SubtargetFeature> Features> | ||
: Processor<Name, NoItineraries, Features>; | ||
|
||
def : Proc<"generic", []>; | ||
|
||
def SPIRV10 : SubtargetFeature<"spirv1.0", "SPIRVVersion", "10", | ||
"Use SPIR-V version 1.0">; | ||
def SPIRV11 : SubtargetFeature<"spirv1.1", "SPIRVVersion", "11", | ||
"Use SPIR-V version 1.1">; | ||
def SPIRV12 : SubtargetFeature<"spirv1.2", "SPIRVVersion", "12", | ||
"Use SPIR-V version 1.2">; | ||
def SPIRV13 : SubtargetFeature<"spirv1.3", "SPIRVVersion", "13", | ||
"Use SPIR-V version 1.3">; | ||
def SPIRV14 : SubtargetFeature<"spirv1.4", "SPIRVVersion", "14", | ||
"Use SPIR-V version 1.4">; | ||
def SPIRV15 : SubtargetFeature<"spirv1.5", "SPIRVVersion", "15", | ||
"Use SPIR-V version 1.5">; | ||
|
||
def SPIRVInstPrinter : AsmWriter { | ||
string AsmWriterClassName = "InstPrinter"; | ||
bit isMCAsmWriter = 1; | ||
} | ||
|
||
def SPIRV : Target { | ||
let InstructionSet = SPIRVInstrInfo; | ||
let AssemblyWriters = [SPIRVInstPrinter]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//===-- SPIRVEnums.td - Describe SPIRV Enum Operands -------*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// All SPIRV enums defined in SPIRVBaseInfo.h should have a corresponding enum | ||
// operand here. This enables the correct PrintMethod to be defined so | ||
// its name or mask bits can be automatically printed in SPIRVInstPrinter | ||
// when referred to in SPIRVInstrInfo.td. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
class EnumOperand<string Name> : Operand<i32>{ | ||
let PrintMethod = "print"#Name; | ||
} | ||
|
||
def ExtInst : EnumOperand<"ExtInst">; | ||
|
||
def Capability : EnumOperand<"Capability">; | ||
def SourceLanguage : EnumOperand<"SourceLanguage">; | ||
def ExecutionModel : EnumOperand<"ExecutionModel">; | ||
def AddressingModel : EnumOperand<"AddressingModel">; | ||
def MemoryModel : EnumOperand<"MemoryModel">; | ||
def ExecutionMode : EnumOperand<"ExecutionMode">; | ||
def StorageClass : EnumOperand<"StorageClass">; | ||
def Dim : EnumOperand<"Dim">; | ||
def SamplerAddressingMode : EnumOperand<"SamplerAddressingMode">; | ||
def SamplerFilterMode : EnumOperand<"SamplerFilterMode">; | ||
def ImageFormat : EnumOperand<"ImageFormat">; | ||
def ImageChannelOrder : EnumOperand<"ImageChannelOrder">; | ||
def ImageChannelDataType : EnumOperand<"ImageChannelDataType">; | ||
def ImageOperand : EnumOperand<"ImageOperand">; | ||
def FPFastMathMode : EnumOperand<"FPFastMathMode">; | ||
def FProundingMode : EnumOperand<"FPRoundingMode">; | ||
def LinkageType : EnumOperand<"LinkageType">; | ||
def AccessQualifier : EnumOperand<"AccessQualifier">; | ||
def FunctionParameterAttribute : EnumOperand<"FunctionParameterAttribute">; | ||
def Decoration : EnumOperand<"Decoration">; | ||
def Builtin : EnumOperand<"Builtin">; | ||
def SelectionControl: EnumOperand<"SelectionControl">; | ||
def LoopControl: EnumOperand<"LoopControl">; | ||
def FunctionControl : EnumOperand<"FunctionControl">; | ||
def MemorySemantics : EnumOperand<"MemorySemantics">; | ||
def MemoryOperand : EnumOperand<"MemoryOperand">; | ||
def Scope : EnumOperand<"Scope">; | ||
def GroupOperation : EnumOperand<"GroupOperation">; | ||
def KernelEnqueueFlags : EnumOperand<"KernelEnqueueFlags">; | ||
def KernelProfilingInfo : EnumOperand<"KernelProfilingInfo">; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//===-- SPIRVInstrFormats.td - SPIR-V Instruction Formats --*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
def StringImm: Operand<i32>{ | ||
let PrintMethod="printStringImm"; | ||
} | ||
|
||
class Op<bits<16> Opcode, dag outs, dag ins, string asmstr, list<dag> pattern = []> | ||
: Instruction { | ||
field bits<16> Inst; | ||
|
||
let Inst = Opcode; | ||
|
||
let Namespace = "SPIRV"; | ||
let DecoderNamespace = "SPIRV"; | ||
|
||
dag OutOperandList = outs; | ||
dag InOperandList = ins; | ||
let AsmString = asmstr; | ||
let Pattern = pattern; | ||
} | ||
|
||
// Pseudo instructions | ||
class Pseudo<dag outs, dag ins> : Op<0, outs, ins, ""> { | ||
let isPseudo = 1; | ||
} |
Oops, something went wrong.