-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[TableGen, CodeGen, CHERI] Add support for the cPTR wildcard value type. #158426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -367,6 +367,10 @@ def aarch64mfp8 : ValueType<8, 253>; // 8-bit value in FPR (AArch64) | |
def c64 : VTCheriCapability<64, 254>; // 64-bit CHERI capability value | ||
def c128 : VTCheriCapability<128, 255>; // 128-bit CHERI capability value | ||
|
||
// Pseudo valuetype mapped to the current CHERI capability pointer size. | ||
// Should only be used in TableGen. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm maybe this regression is caused by this not being inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @abadams I wonder if moving this into the let block just below fixes your problem? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing that drops it back to 0.5 MB, yes. Though the class probably still shouldn't be on the stack. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @resistor are you planning to submit a PR to fix the regression or should I? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm traveling for the next few days. I can do it when I have time, but you might have time sooner than I do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I'll submit it shortly |
||
def cPTR : VTAny<503>; | ||
|
||
let isNormalValueType = false in { | ||
def token : ValueType<0, 504>; // TokenTy | ||
def MetadataVT : ValueType<0, 505> { // Metadata | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// RUN: llvm-tblgen -gen-dag-isel -I %p/../../include %s -o - | FileCheck %s | ||
|
||
// Create an intrinsic that uses cPTR to overload on capability pointer types, | ||
// and verify that we can match it correct in SelectionDAG. | ||
|
||
// CHECK: static const unsigned char MatcherTable[] = { | ||
// CHECK-NEXT: /* 0*/ OPC_CheckOpcode, TARGET_VAL(ISD::INTRINSIC_WO_CHAIN), | ||
// CHECK-NEXT:/* 3*/ OPC_CheckChild0Integer, 42, | ||
// CHECK-NEXT:/* 5*/ OPC_RecordChild1, // #0 = $src | ||
// CHECK-NEXT:/* 6*/ OPC_Scope, 9, /*->17*/ // 2 children in Scope | ||
// CHECK-NEXT:/* 8*/ OPC_CheckChild1Type, /*MVT::c64*/126|128,1/*254*/, | ||
// CHECK-NEXT:/* 11*/ OPC_MorphNodeTo1None, TARGET_VAL(MyTarget::C64_TO_I64), | ||
// CHECK-NEXT: /*MVT::i64*/8, 1/*#Ops*/, 0, | ||
// CHECK-NEXT: // Src: (intrinsic_wo_chain:{ *:[i64] } 21:{ *:[iPTR] }, c64:{ *:[c64] }:$src) - Complexity = 8 | ||
// CHECK-NEXT: // Dst: (C64_TO_I64:{ *:[i64] } ?:{ *:[c64] }:$src) | ||
// CHECK-NEXT:/* 17*/ /*Scope*/ 9, /*->27*/ | ||
// CHECK-NEXT:/* 18*/ OPC_CheckChild1Type, /*MVT::c128*/127|128,1/*255*/, | ||
// CHECK-NEXT:/* 21*/ OPC_MorphNodeTo1None, TARGET_VAL(MyTarget::C128_TO_I64), | ||
// CHECK-NEXT: /*MVT::i64*/8, 1/*#Ops*/, 0, | ||
// CHECK-NEXT: // Src: (intrinsic_wo_chain:{ *:[i64] } 21:{ *:[iPTR] }, c128:{ *:[c128] }:$src) - Complexity = 8 | ||
// CHECK-NEXT: // Dst: (C128_TO_I64:{ *:[i64] } ?:{ *:[c128] }:$src) | ||
// CHECK-NEXT:/* 27*/ 0, /*End of Scope*/ | ||
// CHECK-NEXT: 0 | ||
// CHECK-NEXT: }; // Total Array size is 29 bytes | ||
|
||
include "llvm/Target/Target.td" | ||
|
||
def my_cap_ty : LLVMQualPointerType<200> { | ||
let VT = cPTR; | ||
} | ||
|
||
def int_cap_get_length : | ||
Intrinsic<[llvm_i64_ty], | ||
[my_cap_ty], | ||
[IntrNoMem, IntrWillReturn]>; | ||
|
||
class CapReg<string n> : Register<n> { | ||
let Namespace = "MyTarget"; | ||
} | ||
|
||
def C64 : CapReg<"c0">; | ||
def C64s | ||
: RegisterClass<"MyTarget", [i64, c64], 64, | ||
(add C64)>; | ||
|
||
def C128 : CapReg<"c0">; | ||
def C128s | ||
: RegisterClass<"MyTarget", [c128], 64, | ||
(add C128)>; | ||
|
||
def C64_TO_I64 : Instruction { | ||
let Namespace = "MyTarget"; | ||
let OutOperandList = (outs C64s:$dst); | ||
let InOperandList = (ins C64s:$src); | ||
} | ||
|
||
def C128_TO_I64 : Instruction { | ||
let Namespace = "MyTarget"; | ||
let OutOperandList = (outs C64s:$dst); | ||
let InOperandList = (ins C128s:$src); | ||
} | ||
|
||
def : Pat< | ||
(int_cap_get_length c64:$src), | ||
(C64_TO_I64 $src) | ||
>; | ||
|
||
def : Pat< | ||
(int_cap_get_length c128:$src), | ||
(C128_TO_I64 $src) | ||
>; | ||
|
||
def MyTargetISA : InstrInfo; | ||
def MyTarget : Target { let InstructionSet = MyTargetISA; } |
Uh oh!
There was an error while loading. Please reload this page.