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"
14
15def BPFInstrInfo : InstrInfo;
16
17class Proc<string Name, list<SubtargetFeature> Features>
18 : Processor<Name, NoItineraries, Features>;
19
20def DummyFeature : SubtargetFeature<"dummy", "isDummyMode",
21                                    "true", "unused feature">;
22
23def ALU32 : SubtargetFeature<"alu32", "HasAlu32", "true",
24                             "Enable ALU32 instructions">;
25
26def DwarfRIS: SubtargetFeature<"dwarfris", "UseDwarfRIS", "true",
27                               "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections">;
28
29def : Proc<"generic", []>;
30def : Proc<"v1", []>;
31def : Proc<"v2", []>;
32def : Proc<"v3", [ALU32]>;
33def : Proc<"probe", []>;
34
35def BPFInstPrinter : AsmWriter {
36  string AsmWriterClassName  = "InstPrinter";
37  bit isMCAsmWriter = 1;
38}
39
40def BPFAsmParser : AsmParser {
41  bit HasMnemonicFirst = 0;
42}
43
44def BPFAsmParserVariant : AsmParserVariant {
45  int Variant = 0;
46  string Name = "BPF";
47  string BreakCharacters = ".";
48  string TokenizingCharacters = "#()[]=:.<>!+*";
49}
50
51def BPF : Target {
52  let InstructionSet = BPFInstrInfo;
53  let AssemblyWriters = [BPFInstPrinter];
54  let AssemblyParsers = [BPFAsmParser];
55  let AssemblyParserVariants = [BPFAsmParserVariant];
56}
57