1 //===- Target.td - Target Independent TableGen interface ---*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the target-independent interfaces which should be
11 // implemented by each target which is using a TableGen based code generator.
13 //===----------------------------------------------------------------------===//
15 // Include all information about LLVM intrinsics.
16 include "llvm/IR/Intrinsics.td"
18 //===----------------------------------------------------------------------===//
19 // Register file description - These classes are used to fill in the target
20 // description classes.
22 class RegisterClass; // Forward def
24 // SubRegIndex - Use instances of SubRegIndex to identify subregisters.
25 class SubRegIndex<int size, int offset = 0> {
26 string Namespace = "";
28 // Size - Size (in bits) of the sub-registers represented by this index.
31 // Offset - Offset of the first bit that is part of this sub-register index.
32 // Set it to -1 if the same index is used to represent sub-registers that can
33 // be at different offsets (for example when using an index to access an
34 // element in a register tuple).
37 // ComposedOf - A list of two SubRegIndex instances, [A, B].
38 // This indicates that this SubRegIndex is the result of composing A and B.
39 // See ComposedSubRegIndex.
40 list<SubRegIndex> ComposedOf = [];
42 // CoveringSubRegIndices - A list of two or more sub-register indexes that
43 // cover this sub-register.
45 // This field should normally be left blank as TableGen can infer it.
47 // TableGen automatically detects sub-registers that straddle the registers
48 // in the SubRegs field of a Register definition. For example:
50 // Q0 = dsub_0 -> D0, dsub_1 -> D1
51 // Q1 = dsub_0 -> D2, dsub_1 -> D3
52 // D1_D2 = dsub_0 -> D1, dsub_1 -> D2
53 // QQ0 = qsub_0 -> Q0, qsub_1 -> Q1
55 // TableGen will infer that D1_D2 is a sub-register of QQ0. It will be given
56 // the synthetic index dsub_1_dsub_2 unless some SubRegIndex is defined with
57 // CoveringSubRegIndices = [dsub_1, dsub_2].
58 list<SubRegIndex> CoveringSubRegIndices = [];
61 // ComposedSubRegIndex - A sub-register that is the result of composing A and B.
62 // Offset is set to the sum of A and B's Offsets. Size is set to B's Size.
63 class ComposedSubRegIndex<SubRegIndex A, SubRegIndex B>
64 : SubRegIndex<B.Size, !if(!eq(A.Offset, -1), -1,
65 !if(!eq(B.Offset, -1), -1,
66 !add(A.Offset, B.Offset)))> {
68 let ComposedOf = [A, B];
71 // RegAltNameIndex - The alternate name set to use for register operands of
72 // this register class when printing.
73 class RegAltNameIndex {
74 string Namespace = "";
76 def NoRegAltName : RegAltNameIndex;
78 // Register - You should define one instance of this class for each register
79 // in the target machine. String n will become the "name" of the register.
80 class Register<string n, list<string> altNames = []> {
81 string Namespace = "";
83 list<string> AltNames = altNames;
85 // Aliases - A list of registers that this register overlaps with. A read or
86 // modification of this register can potentially read or modify the aliased
88 list<Register> Aliases = [];
90 // SubRegs - A list of registers that are parts of this register. Note these
91 // are "immediate" sub-registers and the registers within the list do not
92 // themselves overlap. e.g. For X86, EAX's SubRegs list contains only [AX],
94 list<Register> SubRegs = [];
96 // SubRegIndices - For each register in SubRegs, specify the SubRegIndex used
97 // to address it. Sub-sub-register indices are automatically inherited from
99 list<SubRegIndex> SubRegIndices = [];
101 // RegAltNameIndices - The alternate name indices which are valid for this
103 list<RegAltNameIndex> RegAltNameIndices = [];
105 // DwarfNumbers - Numbers used internally by gcc/gdb to identify the register.
106 // These values can be determined by locating the <target>.h file in the
107 // directory llvmgcc/gcc/config/<target>/ and looking for REGISTER_NAMES. The
108 // order of these names correspond to the enumeration used by gcc. A value of
109 // -1 indicates that the gcc number is undefined and -2 that register number
110 // is invalid for this mode/flavour.
111 list<int> DwarfNumbers = [];
113 // CostPerUse - Additional cost of instructions using this register compared
114 // to other registers in its class. The register allocator will try to
115 // minimize the number of instructions using a register with a CostPerUse.
116 // This is used by the x86-64 and ARM Thumb targets where some registers
117 // require larger instruction encodings.
120 // CoveredBySubRegs - When this bit is set, the value of this register is
121 // completely determined by the value of its sub-registers. For example, the
122 // x86 register AX is covered by its sub-registers AL and AH, but EAX is not
123 // covered by its sub-register AX.
124 bit CoveredBySubRegs = 0;
126 // HWEncoding - The target specific hardware encoding for this register.
127 bits<16> HWEncoding = 0;
130 // RegisterWithSubRegs - This can be used to define instances of Register which
131 // need to specify sub-registers.
132 // List "subregs" specifies which registers are sub-registers to this one. This
133 // is used to populate the SubRegs and AliasSet fields of TargetRegisterDesc.
134 // This allows the code generator to be careful not to put two values with
135 // overlapping live ranges into registers which alias.
136 class RegisterWithSubRegs<string n, list<Register> subregs> : Register<n> {
137 let SubRegs = subregs;
140 // DAGOperand - An empty base class that unifies RegisterClass's and other forms
141 // of Operand's that are legal as type qualifiers in DAG patterns. This should
142 // only ever be used for defining multiclasses that are polymorphic over both
143 // RegisterClass's and other Operand's.
145 string OperandNamespace = "MCOI";
146 string DecoderMethod = "";
149 // RegisterClass - Now that all of the registers are defined, and aliases
150 // between registers are defined, specify which registers belong to which
151 // register classes. This also defines the default allocation order of
152 // registers by register allocators.
154 class RegisterClass<string namespace, list<ValueType> regTypes, int alignment,
155 dag regList, RegAltNameIndex idx = NoRegAltName>
157 string Namespace = namespace;
159 // RegType - Specify the list ValueType of the registers in this register
160 // class. Note that all registers in a register class must have the same
161 // ValueTypes. This is a list because some targets permit storing different
162 // types in same register, for example vector values with 128-bit total size,
163 // but different count/size of items, like SSE on x86.
165 list<ValueType> RegTypes = regTypes;
167 // Size - Specify the spill size in bits of the registers. A default value of
168 // zero lets tablgen pick an appropriate size.
171 // Alignment - Specify the alignment required of the registers when they are
172 // stored or loaded to memory.
174 int Alignment = alignment;
176 // CopyCost - This value is used to specify the cost of copying a value
177 // between two registers in this register class. The default value is one
178 // meaning it takes a single instruction to perform the copying. A negative
179 // value means copying is extremely expensive or impossible.
182 // MemberList - Specify which registers are in this class. If the
183 // allocation_order_* method are not specified, this also defines the order of
184 // allocation used by the register allocator.
186 dag MemberList = regList;
188 // AltNameIndex - The alternate register name to use when printing operands
189 // of this register class. Every register in the register class must have
190 // a valid alternate name for the given index.
191 RegAltNameIndex altNameIndex = idx;
193 // isAllocatable - Specify that the register class can be used for virtual
194 // registers and register allocation. Some register classes are only used to
195 // model instruction operand constraints, and should have isAllocatable = 0.
196 bit isAllocatable = 1;
198 // AltOrders - List of alternative allocation orders. The default order is
199 // MemberList itself, and that is good enough for most targets since the
200 // register allocators automatically remove reserved registers and move
201 // callee-saved registers to the end.
202 list<dag> AltOrders = [];
204 // AltOrderSelect - The body of a function that selects the allocation order
205 // to use in a given machine function. The code will be inserted in a
206 // function like this:
208 // static inline unsigned f(const MachineFunction &MF) { ... }
210 // The function should return 0 to select the default order defined by
211 // MemberList, 1 to select the first AltOrders entry and so on.
212 code AltOrderSelect = [{}];
214 // Specify allocation priority for register allocators using a greedy
215 // heuristic. Classes with higher priority values are assigned first. This is
216 // useful as it is sometimes beneficial to assign registers to highly
217 // constrained classes first. The value has to be in the range [0,63].
218 int AllocationPriority = 0;
221 // The memberList in a RegisterClass is a dag of set operations. TableGen
222 // evaluates these set operations and expand them into register lists. These
223 // are the most common operation, see test/TableGen/SetTheory.td for more
224 // examples of what is possible:
226 // (add R0, R1, R2) - Set Union. Each argument can be an individual register, a
227 // register class, or a sub-expression. This is also the way to simply list
230 // (sub GPR, SP) - Set difference. Subtract the last arguments from the first.
232 // (and GPR, CSR) - Set intersection. All registers from the first set that are
233 // also in the second set.
235 // (sequence "R%u", 0, 15) -> [R0, R1, ..., R15]. Generate a sequence of
236 // numbered registers. Takes an optional 4th operand which is a stride to use
237 // when generating the sequence.
239 // (shl GPR, 4) - Remove the first N elements.
241 // (trunc GPR, 4) - Truncate after the first N elements.
243 // (rotl GPR, 1) - Rotate N places to the left.
245 // (rotr GPR, 1) - Rotate N places to the right.
247 // (decimate GPR, 2) - Pick every N'th element, starting with the first.
249 // (interleave A, B, ...) - Interleave the elements from each argument list.
251 // All of these operators work on ordered sets, not lists. That means
252 // duplicates are removed from sub-expressions.
254 // Set operators. The rest is defined in TargetSelectionDAG.td.
259 // RegisterTuples - Automatically generate super-registers by forming tuples of
260 // sub-registers. This is useful for modeling register sequence constraints
261 // with pseudo-registers that are larger than the architectural registers.
263 // The sub-register lists are zipped together:
265 // def EvenOdd : RegisterTuples<[sube, subo], [(add R0, R2), (add R1, R3)]>;
267 // Generates the same registers as:
269 // let SubRegIndices = [sube, subo] in {
270 // def R0_R1 : RegisterWithSubRegs<"", [R0, R1]>;
271 // def R2_R3 : RegisterWithSubRegs<"", [R2, R3]>;
274 // The generated pseudo-registers inherit super-classes and fields from their
275 // first sub-register. Most fields from the Register class are inferred, and
276 // the AsmName and Dwarf numbers are cleared.
278 // RegisterTuples instances can be used in other set operations to form
279 // register classes and so on. This is the only way of using the generated
281 class RegisterTuples<list<SubRegIndex> Indices, list<dag> Regs> {
282 // SubRegs - N lists of registers to be zipped up. Super-registers are
283 // synthesized from the first element of each SubRegs list, the second
284 // element and so on.
285 list<dag> SubRegs = Regs;
287 // SubRegIndices - N SubRegIndex instances. This provides the names of the
288 // sub-registers in the synthesized super-registers.
289 list<SubRegIndex> SubRegIndices = Indices;
293 //===----------------------------------------------------------------------===//
294 // DwarfRegNum - This class provides a mapping of the llvm register enumeration
295 // to the register numbering used by gcc and gdb. These values are used by a
296 // debug information writer to describe where values may be located during
298 class DwarfRegNum<list<int> Numbers> {
299 // DwarfNumbers - Numbers used internally by gcc/gdb to identify the register.
300 // These values can be determined by locating the <target>.h file in the
301 // directory llvmgcc/gcc/config/<target>/ and looking for REGISTER_NAMES. The
302 // order of these names correspond to the enumeration used by gcc. A value of
303 // -1 indicates that the gcc number is undefined and -2 that register number
304 // is invalid for this mode/flavour.
305 list<int> DwarfNumbers = Numbers;
308 // DwarfRegAlias - This class declares that a given register uses the same dwarf
309 // numbers as another one. This is useful for making it clear that the two
310 // registers do have the same number. It also lets us build a mapping
311 // from dwarf register number to llvm register.
312 class DwarfRegAlias<Register reg> {
313 Register DwarfAlias = reg;
316 //===----------------------------------------------------------------------===//
317 // Pull in the common support for scheduling
319 include "llvm/Target/TargetSchedule.td"
321 class Predicate; // Forward def
323 //===----------------------------------------------------------------------===//
324 // Instruction set description - These classes correspond to the C++ classes in
325 // the Target/TargetInstrInfo.h file.
328 string Namespace = "";
330 dag OutOperandList; // An dag containing the MI def operand list.
331 dag InOperandList; // An dag containing the MI use operand list.
332 string AsmString = ""; // The .s format to print the instruction with.
334 // Pattern - Set to the DAG pattern for this instruction, if we know of one,
335 // otherwise, uninitialized.
338 // The follow state will eventually be inferred automatically from the
339 // instruction pattern.
341 list<Register> Uses = []; // Default to using no non-operand registers
342 list<Register> Defs = []; // Default to modifying no non-operand registers
344 // Predicates - List of predicates which will be turned into isel matching
346 list<Predicate> Predicates = [];
348 // Size - Size of encoded instruction, or zero if the size cannot be determined
352 // DecoderNamespace - The "namespace" in which this instruction exists, on
353 // targets like ARM which multiple ISA namespaces exist.
354 string DecoderNamespace = "";
356 // Code size, for instruction selection.
357 // FIXME: What does this actually mean?
360 // Added complexity passed onto matching pattern.
361 int AddedComplexity = 0;
363 // These bits capture information about the high-level semantics of the
365 bit isReturn = 0; // Is this instruction a return instruction?
366 bit isBranch = 0; // Is this instruction a branch instruction?
367 bit isIndirectBranch = 0; // Is this instruction an indirect branch?
368 bit isCompare = 0; // Is this instruction a comparison instruction?
369 bit isMoveImm = 0; // Is this instruction a move immediate instruction?
370 bit isBitcast = 0; // Is this instruction a bitcast instruction?
371 bit isSelect = 0; // Is this instruction a select instruction?
372 bit isBarrier = 0; // Can control flow fall through this instruction?
373 bit isCall = 0; // Is this instruction a call instruction?
374 bit isAdd = 0; // Is this instruction an add instruction?
375 bit canFoldAsLoad = 0; // Can this be folded as a simple memory operand?
376 bit mayLoad = ?; // Is it possible for this inst to read memory?
377 bit mayStore = ?; // Is it possible for this inst to write memory?
378 bit isConvertibleToThreeAddress = 0; // Can this 2-addr instruction promote?
379 bit isCommutable = 0; // Is this 3 operand instruction commutable?
380 bit isTerminator = 0; // Is this part of the terminator for a basic block?
381 bit isReMaterializable = 0; // Is this instruction re-materializable?
382 bit isPredicable = 0; // Is this instruction predicable?
383 bit hasDelaySlot = 0; // Does this instruction have an delay slot?
384 bit usesCustomInserter = 0; // Pseudo instr needing special help.
385 bit hasPostISelHook = 0; // To be *adjusted* after isel by target hook.
386 bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow chains?
387 bit isNotDuplicable = 0; // Is it unsafe to duplicate this instruction?
388 bit isConvergent = 0; // Is this instruction convergent?
389 bit isAsCheapAsAMove = 0; // As cheap (or cheaper) than a move instruction.
390 bit hasExtraSrcRegAllocReq = 0; // Sources have special regalloc requirement?
391 bit hasExtraDefRegAllocReq = 0; // Defs have special regalloc requirement?
392 bit isRegSequence = 0; // Is this instruction a kind of reg sequence?
393 // If so, make sure to override
394 // TargetInstrInfo::getRegSequenceLikeInputs.
395 bit isPseudo = 0; // Is this instruction a pseudo-instruction?
396 // If so, won't have encoding information for
397 // the [MC]CodeEmitter stuff.
398 bit isExtractSubreg = 0; // Is this instruction a kind of extract subreg?
399 // If so, make sure to override
400 // TargetInstrInfo::getExtractSubregLikeInputs.
401 bit isInsertSubreg = 0; // Is this instruction a kind of insert subreg?
402 // If so, make sure to override
403 // TargetInstrInfo::getInsertSubregLikeInputs.
405 // Does the instruction have side effects that are not captured by any
406 // operands of the instruction or other flags?
407 bit hasSideEffects = ?;
409 // Is this instruction a "real" instruction (with a distinct machine
410 // encoding), or is it a pseudo instruction used for codegen modeling
412 // FIXME: For now this is distinct from isPseudo, above, as code-gen-only
413 // instructions can (and often do) still have encoding information
414 // associated with them. Once we've migrated all of them over to true
415 // pseudo-instructions that are lowered to real instructions prior to
416 // the printer/emitter, we can remove this attribute and just use isPseudo.
418 // The intended use is:
419 // isPseudo: Does not have encoding information and should be expanded,
420 // at the latest, during lowering to MCInst.
422 // isCodeGenOnly: Does have encoding information and can go through to the
423 // CodeEmitter unchanged, but duplicates a canonical instruction
424 // definition's encoding and should be ignored when constructing the
425 // assembler match tables.
426 bit isCodeGenOnly = 0;
428 // Is this instruction a pseudo instruction for use by the assembler parser.
429 bit isAsmParserOnly = 0;
431 // This instruction is not expected to be queried for scheduling latencies
432 // and therefore needs no scheduling information even for a complete
434 bit hasNoSchedulingInfo = 0;
436 InstrItinClass Itinerary = NoItinerary;// Execution steps used for scheduling.
438 // Scheduling information from TargetSchedule.td.
439 list<SchedReadWrite> SchedRW;
441 string Constraints = ""; // OperandConstraint, e.g. $src = $dst.
443 /// DisableEncoding - List of operand names (e.g. "$op1,$op2") that should not
444 /// be encoded into the output machineinstr.
445 string DisableEncoding = "";
447 string PostEncoderMethod = "";
448 string DecoderMethod = "";
450 // Is the instruction decoder method able to completely determine if the
451 // given instruction is valid or not. If the TableGen definition of the
452 // instruction specifies bitpattern A??B where A and B are static bits, the
453 // hasCompleteDecoder flag says whether the decoder method fully handles the
454 // ?? space, i.e. if it is a final arbiter for the instruction validity.
455 // If not then the decoder attempts to continue decoding when the decoder
458 // This allows to handle situations where the encoding is not fully
459 // orthogonal. Example:
460 // * InstA with bitpattern 0b0000????,
461 // * InstB with bitpattern 0b000000?? but the associated decoder method
462 // DecodeInstB() returns Fail when ?? is 0b00 or 0b11.
464 // The decoder tries to decode a bitpattern that matches both InstA and
465 // InstB bitpatterns first as InstB (because it is the most specific
466 // encoding). In the default case (hasCompleteDecoder = 1), when
467 // DecodeInstB() returns Fail the bitpattern gets rejected. By setting
468 // hasCompleteDecoder = 0 in InstB, the decoder is informed that
469 // DecodeInstB() is not able to determine if all possible values of ?? are
470 // valid or not. If DecodeInstB() returns Fail the decoder will attempt to
471 // decode the bitpattern as InstA too.
472 bit hasCompleteDecoder = 1;
474 /// Target-specific flags. This becomes the TSFlags field in TargetInstrDesc.
475 bits<64> TSFlags = 0;
477 ///@name Assembler Parser Support
480 string AsmMatchConverter = "";
482 /// TwoOperandAliasConstraint - Enable TableGen to auto-generate a
483 /// two-operand matcher inst-alias for a three operand instruction.
484 /// For example, the arm instruction "add r3, r3, r5" can be written
485 /// as "add r3, r5". The constraint is of the same form as a tied-operand
486 /// constraint. For example, "$Rn = $Rd".
487 string TwoOperandAliasConstraint = "";
489 /// Assembler variant name to use for this instruction. If specified then
490 /// instruction will be presented only in MatchTable for this variant. If
491 /// not specified then assembler variants will be determined based on
493 string AsmVariantName = "";
497 /// UseNamedOperandTable - If set, the operand indices of this instruction
498 /// can be queried via the getNamedOperandIdx() function which is generated
500 bit UseNamedOperandTable = 0;
503 /// PseudoInstExpansion - Expansion information for a pseudo-instruction.
504 /// Which instruction it expands to and how the operands map from the
506 class PseudoInstExpansion<dag Result> {
507 dag ResultInst = Result; // The instruction to generate.
511 /// Predicates - These are extra conditionals which are turned into instruction
512 /// selector matching code. Currently each predicate is just a string.
513 class Predicate<string cond> {
514 string CondString = cond;
516 /// AssemblerMatcherPredicate - If this feature can be used by the assembler
517 /// matcher, this is true. Targets should set this by inheriting their
518 /// feature from the AssemblerPredicate class in addition to Predicate.
519 bit AssemblerMatcherPredicate = 0;
521 /// AssemblerCondString - Name of the subtarget feature being tested used
522 /// as alternative condition string used for assembler matcher.
523 /// e.g. "ModeThumb" is translated to "(Bits & ModeThumb) != 0".
524 /// "!ModeThumb" is translated to "(Bits & ModeThumb) == 0".
525 /// It can also list multiple features separated by ",".
526 /// e.g. "ModeThumb,FeatureThumb2" is translated to
527 /// "(Bits & ModeThumb) != 0 && (Bits & FeatureThumb2) != 0".
528 string AssemblerCondString = "";
530 /// PredicateName - User-level name to use for the predicate. Mainly for use
531 /// in diagnostics such as missing feature errors in the asm matcher.
532 string PredicateName = "";
534 /// Setting this to '1' indicates that the predicate must be recomputed on
535 /// every function change. Most predicates can leave this at '0'.
537 /// Ignored by SelectionDAG, it always recomputes the predicate on every use.
538 bit RecomputePerFunction = 0;
541 /// NoHonorSignDependentRounding - This predicate is true if support for
542 /// sign-dependent-rounding is not enabled.
543 def NoHonorSignDependentRounding
544 : Predicate<"!TM.Options.HonorSignDependentRoundingFPMath()">;
546 class Requires<list<Predicate> preds> {
547 list<Predicate> Predicates = preds;
550 /// ops definition - This is just a simple marker used to identify the operand
551 /// list for an instruction. outs and ins are identical both syntactically and
552 /// semantically; they are used to define def operands and use operands to
553 /// improve readibility. This should be used like this:
554 /// (outs R32:$dst), (ins R32:$src1, R32:$src2) or something similar.
559 /// variable_ops definition - Mark this instruction as taking a variable number
564 /// PointerLikeRegClass - Values that are designed to have pointer width are
565 /// derived from this. TableGen treats the register class as having a symbolic
566 /// type that it doesn't know, and resolves the actual regclass to use by using
567 /// the TargetRegisterInfo::getPointerRegClass() hook at codegen time.
568 class PointerLikeRegClass<int Kind> {
569 int RegClassKind = Kind;
573 /// ptr_rc definition - Mark this operand as being a pointer value whose
574 /// register class is resolved dynamically via a callback to TargetInstrInfo.
575 /// FIXME: We should probably change this to a class which contain a list of
576 /// flags. But currently we have but one flag.
577 def ptr_rc : PointerLikeRegClass<0>;
579 /// unknown definition - Mark this operand as being of unknown type, causing
580 /// it to be resolved by inference in the context it is used.
582 def unknown : unknown_class;
584 /// AsmOperandClass - Representation for the kinds of operands which the target
585 /// specific parser can create and the assembly matcher may need to distinguish.
587 /// Operand classes are used to define the order in which instructions are
588 /// matched, to ensure that the instruction which gets matched for any
589 /// particular list of operands is deterministic.
591 /// The target specific parser must be able to classify a parsed operand into a
592 /// unique class which does not partially overlap with any other classes. It can
593 /// match a subset of some other class, in which case the super class field
594 /// should be defined.
595 class AsmOperandClass {
596 /// The name to use for this class, which should be usable as an enum value.
599 /// The super classes of this operand.
600 list<AsmOperandClass> SuperClasses = [];
602 /// The name of the method on the target specific operand to call to test
603 /// whether the operand is an instance of this class. If not set, this will
604 /// default to "isFoo", where Foo is the AsmOperandClass name. The method
605 /// signature should be:
606 /// bool isFoo() const;
607 string PredicateMethod = ?;
609 /// The name of the method on the target specific operand to call to add the
610 /// target specific operand to an MCInst. If not set, this will default to
611 /// "addFooOperands", where Foo is the AsmOperandClass name. The method
612 /// signature should be:
613 /// void addFooOperands(MCInst &Inst, unsigned N) const;
614 string RenderMethod = ?;
616 /// The name of the method on the target specific operand to call to custom
617 /// handle the operand parsing. This is useful when the operands do not relate
618 /// to immediates or registers and are very instruction specific (as flags to
619 /// set in a processor register, coprocessor number, ...).
620 string ParserMethod = ?;
622 // The diagnostic type to present when referencing this operand in a
623 // match failure error message. By default, use a generic "invalid operand"
624 // diagnostic. The target AsmParser maps these codes to text.
625 string DiagnosticType = "";
627 /// Set to 1 if this operand is optional and not always required. Typically,
628 /// the AsmParser will emit an error when it finishes parsing an
629 /// instruction if it hasn't matched all the operands yet. However, this
630 /// error will be suppressed if all of the remaining unmatched operands are
631 /// marked as IsOptional.
633 /// Optional arguments must be at the end of the operand list.
636 /// The name of the method on the target specific asm parser that returns the
637 /// default operand for this optional operand. This method is only used if
638 /// IsOptional == 1. If not set, this will default to "defaultFooOperands",
639 /// where Foo is the AsmOperandClass name. The method signature should be:
640 /// std::unique_ptr<MCParsedAsmOperand> defaultFooOperands() const;
641 string DefaultMethod = ?;
644 def ImmAsmOperand : AsmOperandClass {
648 /// Operand Types - These provide the built-in operand types that may be used
649 /// by a target. Targets can optionally provide their own operand types as
650 /// needed, though this should not be needed for RISC targets.
651 class Operand<ValueType ty> : DAGOperand {
653 string PrintMethod = "printOperand";
654 string EncoderMethod = "";
655 bit hasCompleteDecoder = 1;
656 string OperandType = "OPERAND_UNKNOWN";
657 dag MIOperandInfo = (ops);
659 // MCOperandPredicate - Optionally, a code fragment operating on
660 // const MCOperand &MCOp, and returning a bool, to indicate if
661 // the value of MCOp is valid for the specific subclass of Operand
662 code MCOperandPredicate;
664 // ParserMatchClass - The "match class" that operands of this type fit
665 // in. Match classes are used to define the order in which instructions are
666 // match, to ensure that which instructions gets matched is deterministic.
668 // The target specific parser must be able to classify an parsed operand into
669 // a unique class, which does not partially overlap with any other classes. It
670 // can match a subset of some other class, in which case the AsmOperandClass
671 // should declare the other operand as one of its super classes.
672 AsmOperandClass ParserMatchClass = ImmAsmOperand;
675 class RegisterOperand<RegisterClass regclass, string pm = "printOperand">
677 // RegClass - The register class of the operand.
678 RegisterClass RegClass = regclass;
679 // PrintMethod - The target method to call to print register operands of
680 // this type. The method normally will just use an alt-name index to look
681 // up the name to print. Default to the generic printOperand().
682 string PrintMethod = pm;
683 // ParserMatchClass - The "match class" that operands of this type fit
684 // in. Match classes are used to define the order in which instructions are
685 // match, to ensure that which instructions gets matched is deterministic.
687 // The target specific parser must be able to classify an parsed operand into
688 // a unique class, which does not partially overlap with any other classes. It
689 // can match a subset of some other class, in which case the AsmOperandClass
690 // should declare the other operand as one of its super classes.
691 AsmOperandClass ParserMatchClass;
693 string OperandType = "OPERAND_REGISTER";
696 let OperandType = "OPERAND_IMMEDIATE" in {
697 def i1imm : Operand<i1>;
698 def i8imm : Operand<i8>;
699 def i16imm : Operand<i16>;
700 def i32imm : Operand<i32>;
701 def i64imm : Operand<i64>;
703 def f32imm : Operand<f32>;
704 def f64imm : Operand<f64>;
707 // Register operands for generic instructions don't have an MVT, but do have
708 // constraints linking the operands (e.g. all operands of a G_ADD must
709 // have the same LLT).
710 class TypedOperand<string Ty> : Operand<untyped> {
711 let OperandType = Ty;
714 def type0 : TypedOperand<"OPERAND_GENERIC_0">;
715 def type1 : TypedOperand<"OPERAND_GENERIC_1">;
716 def type2 : TypedOperand<"OPERAND_GENERIC_2">;
717 def type3 : TypedOperand<"OPERAND_GENERIC_3">;
718 def type4 : TypedOperand<"OPERAND_GENERIC_4">;
719 def type5 : TypedOperand<"OPERAND_GENERIC_5">;
721 /// zero_reg definition - Special node to stand for the zero register.
725 /// All operands which the MC layer classifies as predicates should inherit from
726 /// this class in some manner. This is already handled for the most commonly
727 /// used PredicateOperand, but may be useful in other circumstances.
730 /// OperandWithDefaultOps - This Operand class can be used as the parent class
731 /// for an Operand that needs to be initialized with a default value if
732 /// no value is supplied in a pattern. This class can be used to simplify the
733 /// pattern definitions for instructions that have target specific flags
734 /// encoded as immediate operands.
735 class OperandWithDefaultOps<ValueType ty, dag defaultops>
737 dag DefaultOps = defaultops;
740 /// PredicateOperand - This can be used to define a predicate operand for an
741 /// instruction. OpTypes specifies the MIOperandInfo for the operand, and
742 /// AlwaysVal specifies the value of this predicate when set to "always
744 class PredicateOperand<ValueType ty, dag OpTypes, dag AlwaysVal>
745 : OperandWithDefaultOps<ty, AlwaysVal>, PredicateOp {
746 let MIOperandInfo = OpTypes;
749 /// OptionalDefOperand - This is used to define a optional definition operand
750 /// for an instruction. DefaultOps is the register the operand represents if
751 /// none is supplied, e.g. zero_reg.
752 class OptionalDefOperand<ValueType ty, dag OpTypes, dag defaultops>
753 : OperandWithDefaultOps<ty, defaultops> {
754 let MIOperandInfo = OpTypes;
758 // InstrInfo - This class should only be instantiated once to provide parameters
759 // which are global to the target machine.
762 // Target can specify its instructions in either big or little-endian formats.
763 // For instance, while both Sparc and PowerPC are big-endian platforms, the
764 // Sparc manual specifies its instructions in the format [31..0] (big), while
765 // PowerPC specifies them using the format [0..31] (little).
766 bit isLittleEndianEncoding = 0;
768 // The instruction properties mayLoad, mayStore, and hasSideEffects are unset
769 // by default, and TableGen will infer their value from the instruction
770 // pattern when possible.
772 // Normally, TableGen will issue an error it it can't infer the value of a
773 // property that hasn't been set explicitly. When guessInstructionProperties
774 // is set, it will guess a safe value instead.
776 // This option is a temporary migration help. It will go away.
777 bit guessInstructionProperties = 1;
779 // TableGen's instruction encoder generator has support for matching operands
780 // to bit-field variables both by name and by position. While matching by
781 // name is preferred, this is currently not possible for complex operands,
782 // and some targets still reply on the positional encoding rules. When
783 // generating a decoder for such targets, the positional encoding rules must
784 // be used by the decoder generator as well.
786 // This option is temporary; it will go away once the TableGen decoder
787 // generator has better support for complex operands and targets have
788 // migrated away from using positionally encoded operands.
789 bit decodePositionallyEncodedOperands = 0;
791 // When set, this indicates that there will be no overlap between those
792 // operands that are matched by ordering (positional operands) and those
795 // This option is temporary; it will go away once the TableGen decoder
796 // generator has better support for complex operands and targets have
797 // migrated away from using positionally encoded operands.
798 bit noNamedPositionallyEncodedOperands = 0;
801 // Standard Pseudo Instructions.
802 // This list must match TargetOpcodes.h and CodeGenTarget.cpp.
803 // Only these instructions are allowed in the TargetOpcode namespace.
804 let isCodeGenOnly = 1, isPseudo = 1, hasNoSchedulingInfo = 1,
805 Namespace = "TargetOpcode" in {
806 def PHI : Instruction {
807 let OutOperandList = (outs unknown:$dst);
808 let InOperandList = (ins variable_ops);
809 let AsmString = "PHINODE";
811 def INLINEASM : Instruction {
812 let OutOperandList = (outs);
813 let InOperandList = (ins variable_ops);
815 let hasSideEffects = 0; // Note side effect is encoded in an operand.
817 def CFI_INSTRUCTION : Instruction {
818 let OutOperandList = (outs);
819 let InOperandList = (ins i32imm:$id);
822 let isNotDuplicable = 1;
824 def EH_LABEL : Instruction {
825 let OutOperandList = (outs);
826 let InOperandList = (ins i32imm:$id);
829 let isNotDuplicable = 1;
831 def GC_LABEL : Instruction {
832 let OutOperandList = (outs);
833 let InOperandList = (ins i32imm:$id);
836 let isNotDuplicable = 1;
838 def KILL : Instruction {
839 let OutOperandList = (outs);
840 let InOperandList = (ins variable_ops);
842 let hasSideEffects = 0;
844 def EXTRACT_SUBREG : Instruction {
845 let OutOperandList = (outs unknown:$dst);
846 let InOperandList = (ins unknown:$supersrc, i32imm:$subidx);
848 let hasSideEffects = 0;
850 def INSERT_SUBREG : Instruction {
851 let OutOperandList = (outs unknown:$dst);
852 let InOperandList = (ins unknown:$supersrc, unknown:$subsrc, i32imm:$subidx);
854 let hasSideEffects = 0;
855 let Constraints = "$supersrc = $dst";
857 def IMPLICIT_DEF : Instruction {
858 let OutOperandList = (outs unknown:$dst);
859 let InOperandList = (ins);
861 let hasSideEffects = 0;
862 let isReMaterializable = 1;
863 let isAsCheapAsAMove = 1;
865 def SUBREG_TO_REG : Instruction {
866 let OutOperandList = (outs unknown:$dst);
867 let InOperandList = (ins unknown:$implsrc, unknown:$subsrc, i32imm:$subidx);
869 let hasSideEffects = 0;
871 def COPY_TO_REGCLASS : Instruction {
872 let OutOperandList = (outs unknown:$dst);
873 let InOperandList = (ins unknown:$src, i32imm:$regclass);
875 let hasSideEffects = 0;
876 let isAsCheapAsAMove = 1;
878 def DBG_VALUE : Instruction {
879 let OutOperandList = (outs);
880 let InOperandList = (ins variable_ops);
881 let AsmString = "DBG_VALUE";
882 let hasSideEffects = 0;
884 def REG_SEQUENCE : Instruction {
885 let OutOperandList = (outs unknown:$dst);
886 let InOperandList = (ins unknown:$supersrc, variable_ops);
888 let hasSideEffects = 0;
889 let isAsCheapAsAMove = 1;
891 def COPY : Instruction {
892 let OutOperandList = (outs unknown:$dst);
893 let InOperandList = (ins unknown:$src);
895 let hasSideEffects = 0;
896 let isAsCheapAsAMove = 1;
897 let hasNoSchedulingInfo = 0;
899 def BUNDLE : Instruction {
900 let OutOperandList = (outs);
901 let InOperandList = (ins variable_ops);
902 let AsmString = "BUNDLE";
904 def LIFETIME_START : Instruction {
905 let OutOperandList = (outs);
906 let InOperandList = (ins i32imm:$id);
907 let AsmString = "LIFETIME_START";
908 let hasSideEffects = 0;
910 def LIFETIME_END : Instruction {
911 let OutOperandList = (outs);
912 let InOperandList = (ins i32imm:$id);
913 let AsmString = "LIFETIME_END";
914 let hasSideEffects = 0;
916 def STACKMAP : Instruction {
917 let OutOperandList = (outs);
918 let InOperandList = (ins i64imm:$id, i32imm:$nbytes, variable_ops);
921 let usesCustomInserter = 1;
923 def PATCHPOINT : Instruction {
924 let OutOperandList = (outs unknown:$dst);
925 let InOperandList = (ins i64imm:$id, i32imm:$nbytes, unknown:$callee,
926 i32imm:$nargs, i32imm:$cc, variable_ops);
929 let usesCustomInserter = 1;
931 def STATEPOINT : Instruction {
932 let OutOperandList = (outs);
933 let InOperandList = (ins variable_ops);
934 let usesCustomInserter = 1;
937 let hasSideEffects = 1;
940 def LOAD_STACK_GUARD : Instruction {
941 let OutOperandList = (outs ptr_rc:$dst);
942 let InOperandList = (ins);
944 bit isReMaterializable = 1;
945 let hasSideEffects = 0;
948 def LOCAL_ESCAPE : Instruction {
949 // This instruction is really just a label. It has to be part of the chain so
950 // that it doesn't get dropped from the DAG, but it produces nothing and has
952 let OutOperandList = (outs);
953 let InOperandList = (ins ptr_rc:$symbol, i32imm:$id);
954 let hasSideEffects = 0;
957 def FAULTING_OP : Instruction {
958 let OutOperandList = (outs unknown:$dst);
959 let InOperandList = (ins variable_ops);
960 let usesCustomInserter = 1;
963 let isTerminator = 1;
966 def PATCHABLE_OP : Instruction {
967 let OutOperandList = (outs unknown:$dst);
968 let InOperandList = (ins variable_ops);
969 let usesCustomInserter = 1;
972 let hasSideEffects = 1;
974 def PATCHABLE_FUNCTION_ENTER : Instruction {
975 let OutOperandList = (outs);
976 let InOperandList = (ins);
977 let AsmString = "# XRay Function Enter.";
978 let usesCustomInserter = 1;
979 let hasSideEffects = 0;
981 def PATCHABLE_RET : Instruction {
982 let OutOperandList = (outs unknown:$dst);
983 let InOperandList = (ins variable_ops);
984 let AsmString = "# XRay Function Patchable RET.";
985 let usesCustomInserter = 1;
986 let hasSideEffects = 1;
989 def PATCHABLE_FUNCTION_EXIT : Instruction {
990 let OutOperandList = (outs);
991 let InOperandList = (ins);
992 let AsmString = "# XRay Function Exit.";
993 let usesCustomInserter = 1;
994 let hasSideEffects = 0; // FIXME: is this correct?
995 let isReturn = 0; // Original return instruction will follow
997 def PATCHABLE_TAIL_CALL : Instruction {
998 let OutOperandList = (outs unknown:$dst);
999 let InOperandList = (ins variable_ops);
1000 let AsmString = "# XRay Tail Call Exit.";
1001 let usesCustomInserter = 1;
1002 let hasSideEffects = 1;
1005 def FENTRY_CALL : Instruction {
1006 let OutOperandList = (outs unknown:$dst);
1007 let InOperandList = (ins variable_ops);
1008 let AsmString = "# FEntry call";
1009 let usesCustomInserter = 1;
1012 let hasSideEffects = 1;
1015 // Generic opcodes used in GlobalISel.
1016 include "llvm/Target/GenericOpcodes.td"
1020 //===----------------------------------------------------------------------===//
1021 // AsmParser - This class can be implemented by targets that wish to implement
1024 // Subtargets can have multiple different assembly parsers (e.g. AT&T vs Intel
1025 // syntax on X86 for example).
1028 // AsmParserClassName - This specifies the suffix to use for the asmparser
1029 // class. Generated AsmParser classes are always prefixed with the target
1031 string AsmParserClassName = "AsmParser";
1033 // AsmParserInstCleanup - If non-empty, this is the name of a custom member
1034 // function of the AsmParser class to call on every matched instruction.
1035 // This can be used to perform target specific instruction post-processing.
1036 string AsmParserInstCleanup = "";
1038 // ShouldEmitMatchRegisterName - Set to false if the target needs a hand
1039 // written register name matcher
1040 bit ShouldEmitMatchRegisterName = 1;
1042 // Set to true if the target needs a generated 'alternative register name'
1045 // This generates a function which can be used to lookup registers from
1046 // their aliases. This function will fail when called on targets where
1047 // several registers share the same alias (i.e. not a 1:1 mapping).
1048 bit ShouldEmitMatchRegisterAltName = 0;
1050 // HasMnemonicFirst - Set to false if target instructions don't always
1051 // start with a mnemonic as the first token.
1052 bit HasMnemonicFirst = 1;
1054 def DefaultAsmParser : AsmParser;
1056 //===----------------------------------------------------------------------===//
1057 // AsmParserVariant - Subtargets can have multiple different assembly parsers
1058 // (e.g. AT&T vs Intel syntax on X86 for example). This class can be
1059 // implemented by targets to describe such variants.
1061 class AsmParserVariant {
1062 // Variant - AsmParsers can be of multiple different variants. Variants are
1063 // used to support targets that need to parser multiple formats for the
1064 // assembly language.
1067 // Name - The AsmParser variant name (e.g., AT&T vs Intel).
1070 // CommentDelimiter - If given, the delimiter string used to recognize
1071 // comments which are hard coded in the .td assembler strings for individual
1073 string CommentDelimiter = "";
1075 // RegisterPrefix - If given, the token prefix which indicates a register
1076 // token. This is used by the matcher to automatically recognize hard coded
1077 // register tokens as constrained registers, instead of tokens, for the
1078 // purposes of matching.
1079 string RegisterPrefix = "";
1081 // TokenizingCharacters - Characters that are standalone tokens
1082 string TokenizingCharacters = "[]*!";
1084 // SeparatorCharacters - Characters that are not tokens
1085 string SeparatorCharacters = " \t,";
1087 // BreakCharacters - Characters that start new identifiers
1088 string BreakCharacters = "";
1090 def DefaultAsmParserVariant : AsmParserVariant;
1092 /// AssemblerPredicate - This is a Predicate that can be used when the assembler
1093 /// matches instructions and aliases.
1094 class AssemblerPredicate<string cond, string name = ""> {
1095 bit AssemblerMatcherPredicate = 1;
1096 string AssemblerCondString = cond;
1097 string PredicateName = name;
1100 /// TokenAlias - This class allows targets to define assembler token
1101 /// operand aliases. That is, a token literal operand which is equivalent
1102 /// to another, canonical, token literal. For example, ARM allows:
1103 /// vmov.u32 s4, #0 -> vmov.i32, #0
1104 /// 'u32' is a more specific designator for the 32-bit integer type specifier
1105 /// and is legal for any instruction which accepts 'i32' as a datatype suffix.
1106 /// def : TokenAlias<".u32", ".i32">;
1108 /// This works by marking the match class of 'From' as a subclass of the
1109 /// match class of 'To'.
1110 class TokenAlias<string From, string To> {
1111 string FromToken = From;
1112 string ToToken = To;
1115 /// MnemonicAlias - This class allows targets to define assembler mnemonic
1116 /// aliases. This should be used when all forms of one mnemonic are accepted
1117 /// with a different mnemonic. For example, X86 allows:
1118 /// sal %al, 1 -> shl %al, 1
1119 /// sal %ax, %cl -> shl %ax, %cl
1120 /// sal %eax, %cl -> shl %eax, %cl
1121 /// etc. Though "sal" is accepted with many forms, all of them are directly
1122 /// translated to a shl, so it can be handled with (in the case of X86, it
1123 /// actually has one for each suffix as well):
1124 /// def : MnemonicAlias<"sal", "shl">;
1126 /// Mnemonic aliases are mapped before any other translation in the match phase,
1127 /// and do allow Requires predicates, e.g.:
1129 /// def : MnemonicAlias<"pushf", "pushfq">, Requires<[In64BitMode]>;
1130 /// def : MnemonicAlias<"pushf", "pushfl">, Requires<[In32BitMode]>;
1132 /// Mnemonic aliases can also be constrained to specific variants, e.g.:
1134 /// def : MnemonicAlias<"pushf", "pushfq", "att">, Requires<[In64BitMode]>;
1136 /// If no variant (e.g., "att" or "intel") is specified then the alias is
1137 /// applied unconditionally.
1138 class MnemonicAlias<string From, string To, string VariantName = ""> {
1139 string FromMnemonic = From;
1140 string ToMnemonic = To;
1141 string AsmVariantName = VariantName;
1143 // Predicates - Predicates that must be true for this remapping to happen.
1144 list<Predicate> Predicates = [];
1147 /// InstAlias - This defines an alternate assembly syntax that is allowed to
1148 /// match an instruction that has a different (more canonical) assembly
1150 class InstAlias<string Asm, dag Result, int Emit = 1> {
1151 string AsmString = Asm; // The .s format to match the instruction with.
1152 dag ResultInst = Result; // The MCInst to generate.
1154 // This determines which order the InstPrinter detects aliases for
1155 // printing. A larger value makes the alias more likely to be
1156 // emitted. The Instruction's own definition is notionally 0.5, so 0
1157 // disables printing and 1 enables it if there are no conflicting aliases.
1158 int EmitPriority = Emit;
1160 // Predicates - Predicates that must be true for this to match.
1161 list<Predicate> Predicates = [];
1163 // If the instruction specified in Result has defined an AsmMatchConverter
1164 // then setting this to 1 will cause the alias to use the AsmMatchConverter
1165 // function when converting the OperandVector into an MCInst instead of the
1166 // function that is generated by the dag Result.
1167 // Setting this to 0 will cause the alias to ignore the Result instruction's
1168 // defined AsmMatchConverter and instead use the function generated by the
1170 bit UseInstAsmMatchConverter = 1;
1172 // Assembler variant name to use for this alias. If not specified then
1173 // assembler variants will be determined based on AsmString
1174 string AsmVariantName = "";
1177 //===----------------------------------------------------------------------===//
1178 // AsmWriter - This class can be implemented by targets that need to customize
1179 // the format of the .s file writer.
1181 // Subtargets can have multiple different asmwriters (e.g. AT&T vs Intel syntax
1182 // on X86 for example).
1185 // AsmWriterClassName - This specifies the suffix to use for the asmwriter
1186 // class. Generated AsmWriter classes are always prefixed with the target
1188 string AsmWriterClassName = "InstPrinter";
1190 // PassSubtarget - Determines whether MCSubtargetInfo should be passed to
1191 // the various print methods.
1192 // FIXME: Remove after all ports are updated.
1193 int PassSubtarget = 0;
1195 // Variant - AsmWriters can be of multiple different variants. Variants are
1196 // used to support targets that need to emit assembly code in ways that are
1197 // mostly the same for different targets, but have minor differences in
1198 // syntax. If the asmstring contains {|} characters in them, this integer
1199 // will specify which alternative to use. For example "{x|y|z}" with Variant
1200 // == 1, will expand to "y".
1203 def DefaultAsmWriter : AsmWriter;
1206 //===----------------------------------------------------------------------===//
1207 // Target - This class contains the "global" target information
1210 // InstructionSet - Instruction set description for this target.
1211 InstrInfo InstructionSet;
1213 // AssemblyParsers - The AsmParser instances available for this target.
1214 list<AsmParser> AssemblyParsers = [DefaultAsmParser];
1216 /// AssemblyParserVariants - The AsmParserVariant instances available for
1218 list<AsmParserVariant> AssemblyParserVariants = [DefaultAsmParserVariant];
1220 // AssemblyWriters - The AsmWriter instances available for this target.
1221 list<AsmWriter> AssemblyWriters = [DefaultAsmWriter];
1224 //===----------------------------------------------------------------------===//
1225 // SubtargetFeature - A characteristic of the chip set.
1227 class SubtargetFeature<string n, string a, string v, string d,
1228 list<SubtargetFeature> i = []> {
1229 // Name - Feature name. Used by command line (-mattr=) to determine the
1230 // appropriate target chip.
1234 // Attribute - Attribute to be set by feature.
1236 string Attribute = a;
1238 // Value - Value the attribute to be set to by feature.
1242 // Desc - Feature description. Used by command line (-mattr=) to display help
1247 // Implies - Features that this feature implies are present. If one of those
1248 // features isn't set, then this one shouldn't be set either.
1250 list<SubtargetFeature> Implies = i;
1253 /// Specifies a Subtarget feature that this instruction is deprecated on.
1254 class Deprecated<SubtargetFeature dep> {
1255 SubtargetFeature DeprecatedFeatureMask = dep;
1258 /// A custom predicate used to determine if an instruction is
1259 /// deprecated or not.
1260 class ComplexDeprecationPredicate<string dep> {
1261 string ComplexDeprecationPredicate = dep;
1264 //===----------------------------------------------------------------------===//
1265 // Processor chip sets - These values represent each of the chip sets supported
1266 // by the scheduler. Each Processor definition requires corresponding
1267 // instruction itineraries.
1269 class Processor<string n, ProcessorItineraries pi, list<SubtargetFeature> f> {
1270 // Name - Chip set name. Used by command line (-mcpu=) to determine the
1271 // appropriate target chip.
1275 // SchedModel - The machine model for scheduling and instruction cost.
1277 SchedMachineModel SchedModel = NoSchedModel;
1279 // ProcItin - The scheduling information for the target processor.
1281 ProcessorItineraries ProcItin = pi;
1283 // Features - list of
1284 list<SubtargetFeature> Features = f;
1287 // ProcessorModel allows subtargets to specify the more general
1288 // SchedMachineModel instead if a ProcessorItinerary. Subtargets will
1289 // gradually move to this newer form.
1291 // Although this class always passes NoItineraries to the Processor
1292 // class, the SchedMachineModel may still define valid Itineraries.
1293 class ProcessorModel<string n, SchedMachineModel m, list<SubtargetFeature> f>
1294 : Processor<n, NoItineraries, f> {
1298 //===----------------------------------------------------------------------===//
1299 // InstrMapping - This class is used to create mapping tables to relate
1300 // instructions with each other based on the values specified in RowFields,
1301 // ColFields, KeyCol and ValueCols.
1303 class InstrMapping {
1304 // FilterClass - Used to limit search space only to the instructions that
1305 // define the relationship modeled by this InstrMapping record.
1308 // RowFields - List of fields/attributes that should be same for all the
1309 // instructions in a row of the relation table. Think of this as a set of
1310 // properties shared by all the instructions related by this relationship
1311 // model and is used to categorize instructions into subgroups. For instance,
1312 // if we want to define a relation that maps 'Add' instruction to its
1313 // predicated forms, we can define RowFields like this:
1315 // let RowFields = BaseOp
1316 // All add instruction predicated/non-predicated will have to set their BaseOp
1317 // to the same value.
1319 // def Add: { let BaseOp = 'ADD'; let predSense = 'nopred' }
1320 // def Add_predtrue: { let BaseOp = 'ADD'; let predSense = 'true' }
1321 // def Add_predfalse: { let BaseOp = 'ADD'; let predSense = 'false' }
1322 list<string> RowFields = [];
1324 // List of fields/attributes that are same for all the instructions
1325 // in a column of the relation table.
1326 // Ex: let ColFields = 'predSense' -- It means that the columns are arranged
1327 // based on the 'predSense' values. All the instruction in a specific
1328 // column have the same value and it is fixed for the column according
1329 // to the values set in 'ValueCols'.
1330 list<string> ColFields = [];
1332 // Values for the fields/attributes listed in 'ColFields'.
1333 // Ex: let KeyCol = 'nopred' -- It means that the key instruction (instruction
1334 // that models this relation) should be non-predicated.
1335 // In the example above, 'Add' is the key instruction.
1336 list<string> KeyCol = [];
1338 // List of values for the fields/attributes listed in 'ColFields', one for
1339 // each column in the relation table.
1341 // Ex: let ValueCols = [['true'],['false']] -- It adds two columns in the
1342 // table. First column requires all the instructions to have predSense
1343 // set to 'true' and second column requires it to be 'false'.
1344 list<list<string> > ValueCols = [];
1347 //===----------------------------------------------------------------------===//
1348 // Pull in the common support for calling conventions.
1350 include "llvm/Target/TargetCallingConv.td"
1352 //===----------------------------------------------------------------------===//
1353 // Pull in the common support for DAG isel generation.
1355 include "llvm/Target/TargetSelectionDAG.td"
1357 //===----------------------------------------------------------------------===//
1358 // Pull in the common support for Global ISel register bank info generation.
1360 include "llvm/Target/GlobalISel/RegisterBank.td"
1362 //===----------------------------------------------------------------------===//
1363 // Pull in the common support for DAG isel generation.
1365 include "llvm/Target/GlobalISel/Target.td"
1367 //===----------------------------------------------------------------------===//
1368 // Pull in the common support for the Global ISel DAG-based selector generation.
1370 include "llvm/Target/GlobalISel/SelectionDAGCompat.td"