1//===-- BPF.td - Describe the BPF Target Machine -----------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9include "llvm/Target/Target.td"
10
11include "BPFRegisterInfo.td"
12include "BPFCallingConv.td"
13include "BPFInstrInfo.td"
14include "GISel/BPFRegisterBanks.td"
15
16def BPFInstrInfo : InstrInfo;
17
18class Proc<string Name, list<SubtargetFeature> Features>
19 : Processor<Name, NoItineraries, Features>;
20
21def DummyFeature : SubtargetFeature<"dummy", "isDummyMode",
22                                    "true", "unused feature">;
23
24def ALU32 : SubtargetFeature<"alu32", "HasAlu32", "true",
25                             "Enable ALU32 instructions">;
26
27def DwarfRIS: SubtargetFeature<"dwarfris", "UseDwarfRIS", "true",
28                               "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections">;
29
30def : Proc<"generic", []>;
31def : Proc<"v1", []>;
32def : Proc<"v2", []>;
33def : Proc<"v3", [ALU32]>;
34def : Proc<"v4", [ALU32]>;
35def : Proc<"probe", []>;
36
37def BPFInstPrinter : AsmWriter {
38  string AsmWriterClassName  = "InstPrinter";
39  bit isMCAsmWriter = 1;
40}
41
42def BPFAsmParser : AsmParser {
43  bit HasMnemonicFirst = 0;
44}
45
46def BPFAsmParserVariant : AsmParserVariant {
47  int Variant = 0;
48  string Name = "BPF";
49  string BreakCharacters = ".";
50  string TokenizingCharacters = "#()[]=:.<>!+*%/";
51}
52
53def BPF : Target {
54  let InstructionSet = BPFInstrInfo;
55  let AssemblyWriters = [BPFInstPrinter];
56  let AssemblyParsers = [BPFAsmParser];
57  let AssemblyParserVariants = [BPFAsmParserVariant];
58}
59