forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teach tablegen how to inherit from classes in 'defm' definitions.
The rule is simple: only inherit from a class list if they come in the end, after the last multiclass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106305 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
78db186
commit 6e0a99a
Showing
3 changed files
with
127 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,36 @@ | ||
// RUN: tblgen %s | FileCheck %s | ||
// XFAIL: vg_leak | ||
|
||
class XD { bits<4> Prefix = 11; } | ||
// CHECK: Prefix = { 1, 1, 0, 0 }; | ||
class XS { bits<4> Prefix = 12; } | ||
class VEX { bit hasVEX_4VPrefix = 1; } | ||
|
||
def xd : XD; | ||
|
||
class BaseI { | ||
bits<4> Prefix = 0; | ||
bit hasVEX_4VPrefix = 0; | ||
} | ||
|
||
class I<bits<4> op> : BaseI { | ||
bits<4> opcode = op; | ||
int val = !if(!eq(Prefix, xd.Prefix), 7, 21); | ||
} | ||
|
||
multiclass R { | ||
def rr : I<4>; | ||
} | ||
|
||
multiclass M { | ||
def rm : I<2>; | ||
} | ||
|
||
multiclass Y { | ||
defm SS : R, M, XD; | ||
// CHECK: Prefix = { 1, 1, 0, 0 }; | ||
// CHECK: Prefix = { 1, 1, 0, 0 }; | ||
defm SD : R, M, XS; | ||
} | ||
|
||
defm Instr : Y, VEX; |
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