blob: e63cd635cccb265672be9bb923eea48e9acccdcd [file] [log] [blame]
Chris Lattneree6b5f62003-07-29 23:07:13 +00001//===- Target.td - Target Independent TableGen interface --------*- C++ -*-===//
2//
3// This file defines the target-independent interfaces which should be
4// implemented by each target which is using a TableGen based code generator.
5//
Misha Brukman01c16382003-05-29 18:48:17 +00006//===----------------------------------------------------------------------===//
7
Chris Lattner7c289522003-07-30 05:50:12 +00008
9//===----------------------------------------------------------------------===//
10//
Chris Lattnerb3aa3192003-07-28 04:24:59 +000011// Value types - These values correspond to the register types defined in the
Chris Lattner84c40c12003-07-29 23:02:49 +000012// ValueTypes.h file.
Chris Lattner0ad13612003-07-30 22:16:41 +000013//
Chris Lattner84c40c12003-07-29 23:02:49 +000014class ValueType { string Namespace = "MVT"; }
Chris Lattner7c289522003-07-30 05:50:12 +000015
Chris Lattnerb3aa3192003-07-28 04:24:59 +000016def i1 : ValueType; // One bit boolean value
17def i8 : ValueType; // 8-bit integer value
18def i16 : ValueType; // 16-bit integer value
19def i32 : ValueType; // 32-bit integer value
20def i64 : ValueType; // 64-bit integer value
21def i128 : ValueType; // 128-bit integer value
22def f32 : ValueType; // 32-bit floating point value
23def f64 : ValueType; // 64-bit floating point value
24def f80 : ValueType; // 80-bit floating point value
25def f128 : ValueType; // 128-bit floating point value
26
Chris Lattner7c289522003-07-30 05:50:12 +000027
28//===----------------------------------------------------------------------===//
29// Register file description - These classes are used to fill in the target
30// description classes in llvm/Target/MRegisterInfo.h
31
32
33// Register - You should define one instance of this class for each register in
34// the target machine.
35//
Misha Brukman01c16382003-05-29 18:48:17 +000036class Register {
37 string Namespace = "";
Misha Brukman01c16382003-05-29 18:48:17 +000038}
39
Chris Lattner7c289522003-07-30 05:50:12 +000040// RegisterAliases - You should define instances of this class to indicate which
41// registers in the register file are aliased together. This allows the code
42// generator to be careful not to put two values with overlapping live ranges
43// into registers which alias.
44//
45class RegisterAliases<Register reg, list<Register> aliases> {
46 Register Reg = reg;
47 list<Register> Aliases = aliases;
48}
49
50// RegisterClass - Now that all of the registers are defined, and aliases
51// between registers are defined, specify which registers belong to which
52// register classes. This also defines the default allocation order of
53// registers by register allocators.
54//
55class RegisterClass<ValueType regType, int alignment, list<Register> regList> {
Chris Lattner0ad13612003-07-30 22:16:41 +000056 // RegType - Specify the ValueType of the registers in this register class.
57 // Note that all registers in a register class must have the same ValueType.
58 //
Chris Lattner7c289522003-07-30 05:50:12 +000059 ValueType RegType = regType;
Chris Lattner0ad13612003-07-30 22:16:41 +000060
61 // Alignment - Specify the alignment required of the registers when they are
62 // stored or loaded to memory.
63 //
Chris Lattner7c289522003-07-30 05:50:12 +000064 int Alignment = alignment;
Chris Lattner0ad13612003-07-30 22:16:41 +000065
66 // MemberList - Specify which registers are in this class. If the
67 // allocation_order_* method are not specified, this also defines the order of
68 // allocation used by the register allocator.
69 //
Chris Lattner7c289522003-07-30 05:50:12 +000070 list<Register> MemberList = regList;
Chris Lattner0ad13612003-07-30 22:16:41 +000071
72 // allocation_order_* - These methods define the order that the registers
73 // should be allocated. See the MRegister.h file for more information.
74 //
75 code allocation_order_begin;
76 code allocation_order_end;
Chris Lattner7c289522003-07-30 05:50:12 +000077}
78
79
80//===----------------------------------------------------------------------===//
81// Instruction set description -
82//
83
Misha Brukman01c16382003-05-29 18:48:17 +000084class Instruction {
85 string Name; // The opcode string for this instruction
86 string Namespace = "";
87
88 list<Register> Uses = []; // Default to using no non-operand registers
89 list<Register> Defs = []; // Default to modifying no non-operand registers
90
91 // These bits capture information about the high-level semantics of the
92 // instruction.
Chris Lattner84c40c12003-07-29 23:02:49 +000093 bit isReturn = 0; // Is this instruction a return instruction?
94 bit isBranch = 0; // Is this instruction a branch instruction?
95 bit isCall = 0; // Is this instruction a call instruction?
96 bit isTwoAddress = 0; // Is this a two address instruction?
97 bit isTerminator = 0; // Is this part of the terminator for a basic block?
Misha Brukman01c16382003-05-29 18:48:17 +000098}