-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TableGen] Refactor Intrinsics record (#106986)
Eliminate unused `isTarget` field in Intrinsic record. Eliminate `isOverloaded`, `Types` and `TypeSig` fields from the record, as they are already available through the `TypeInfo` field. Change intrinsic emitter code to look for this info using fields of the `TypeInfo` record attached to the `Intrinsic` record. Fix several intrinsic related unit tests to source the `Intrinsic` class def from Intrinsics.td as opposed to defining a skeleton in the test. This eliminates some duplication of information in the Intrinsic class, as well as reduces the memory allocated for record fields, resulting in ~2% reduction (though that's not the main goal).
- Loading branch information
Showing
7 changed files
with
35 additions
and
166 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
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 |
---|---|---|
@@ -1,38 +1,10 @@ | ||
// RUN: llvm-tblgen -gen-intrinsic-enums %s | FileCheck %s | ||
// RUN: llvm-tblgen -gen-intrinsic-enums -I %p/../../include %s -DTEST_INTRINSICS_SUPPRESS_DEFS | FileCheck %s | ||
// XFAIL: vg_leak | ||
|
||
class IntrinsicProperty<bit is_default = 0> { | ||
bit IsDefault = is_default; | ||
} | ||
|
||
class SDNodeProperty; | ||
|
||
class ValueType<int size, int value> { | ||
string Namespace = "MVT"; | ||
int Size = size; | ||
int Value = value; | ||
} | ||
|
||
class LLVMType<ValueType vt> { | ||
ValueType VT = vt; | ||
} | ||
|
||
class Intrinsic<string name, list<LLVMType> param_types = []> { | ||
string LLVMName = name; | ||
bit isTarget = 0; | ||
string TargetPrefix = ""; | ||
list<LLVMType> RetTypes = []; | ||
list<LLVMType> ParamTypes = param_types; | ||
list<IntrinsicProperty> IntrProperties = []; | ||
list<SDNodeProperty> Properties = []; | ||
bit DisableDefaultAttributes = 1; | ||
} | ||
|
||
def iAny : ValueType<0, 253>; | ||
def llvm_anyint_ty : LLVMType<iAny>; | ||
include "llvm/IR/Intrinsics.td" | ||
|
||
// Make sure we generate the long name without crashing | ||
// CHECK: this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash, // llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash | ||
def int_foo : Intrinsic<"llvm.foo", [llvm_anyint_ty]>; | ||
def int_this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash : Intrinsic<"llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash", [llvm_anyint_ty]>; | ||
def int_foo : Intrinsic<[llvm_anyint_ty], [], [], "llvm.foo">; | ||
def int_this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash : Intrinsic<[llvm_anyint_ty], [], [], "llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash">; | ||
|
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 |
---|---|---|
@@ -1,38 +1,11 @@ | ||
// RUN: llvm-tblgen -gen-intrinsic-enums %s | FileCheck %s | ||
// RUN: llvm-tblgen -gen-intrinsic-enums -I %p/../../include %s -DTEST_INTRINSICS_SUPPRESS_DEFS | FileCheck %s | ||
// XFAIL: vg_leak | ||
|
||
class IntrinsicProperty<bit is_default = 0> { | ||
bit IsDefault = is_default; | ||
} | ||
|
||
class SDNodeProperty; | ||
|
||
class ValueType<int size, int value> { | ||
string Namespace = "MVT"; | ||
int Size = size; | ||
int Value = value; | ||
} | ||
|
||
class LLVMType<ValueType vt> { | ||
ValueType VT = vt; | ||
} | ||
|
||
class Intrinsic<string name, list<LLVMType> ret_types = []> { | ||
string LLVMName = name; | ||
bit isTarget = 0; | ||
string TargetPrefix = ""; | ||
list<LLVMType> RetTypes = ret_types; | ||
list<LLVMType> ParamTypes = []; | ||
list<IntrinsicProperty> IntrProperties = []; | ||
list<SDNodeProperty> Properties = []; | ||
bit DisableDefaultAttributes = 1; | ||
} | ||
|
||
def iAny : ValueType<0, 253>; | ||
def llvm_anyint_ty : LLVMType<iAny>; | ||
include "llvm/IR/Intrinsics.td" | ||
|
||
// Make sure we can return up to 8 values | ||
// CHECK: returns_8_results = {{[0-9]+}}, // llvm.returns.8.results | ||
def int_returns_8_results : Intrinsic<"llvm.returns.8.results", | ||
def int_returns_8_results : Intrinsic< | ||
[llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, | ||
llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty]>; | ||
llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty], | ||
[], [], "llvm.returns.8.results">; |
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
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