@@ -555,8 +555,6 @@ static AttributeSet getIntrinsicFnAttributeSet(LLVMContext &C, unsigned ID) {
555
555
default: llvm_unreachable("Invalid attribute set number");)" ;
556
556
557
557
for (const CodeGenIntrinsic &Int : Ints) {
558
- if (!hasFnAttributes (Int))
559
- continue ;
560
558
unsigned ID = UniqFnAttributes.size ();
561
559
if (!UniqFnAttributes.try_emplace (&Int, ID).second )
562
560
continue ;
@@ -606,8 +604,7 @@ static AttributeSet getIntrinsicFnAttributeSet(LLVMContext &C, unsigned ID) {
606
604
}
607
605
} // getIntrinsicFnAttributeSet
608
606
609
- AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {
610
- )" ;
607
+ static constexpr uint16_t IntrinsicsToAttributesMap[] = {)" ;
611
608
612
609
// Compute the maximum number of attribute arguments and the map. For function
613
610
// attributes, we only consider whether the intrinsics has any function
@@ -619,6 +616,14 @@ AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {
619
616
UniqAttributes.try_emplace (&Int, ID);
620
617
}
621
618
619
+ // Emit an array of AttributeList. Most intrinsics will have at least one
620
+ // entry, for the function itself (index ~1), which is usually nounwind.
621
+ for (const CodeGenIntrinsic &Int : Ints) {
622
+ uint16_t FnAttrIndex = UniqFnAttributes[&Int];
623
+ OS << formatv (" \n {} << 8 | {}, // {}" , FnAttrIndex,
624
+ UniqAttributes[&Int], Int.Name );
625
+ }
626
+
622
627
// Assign a 16-bit packed ID for each intrinsic. The lower 8-bits will be its
623
628
// "argument attribute ID" (index in UniqAttributes) and upper 8 bits will be
624
629
// its "function attribute ID" (index in UniqFnAttributes).
@@ -627,17 +632,12 @@ AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {
627
632
if (UniqFnAttributes.size () > 256 )
628
633
PrintFatalError (" Too many unique function attributes for table!" );
629
634
630
- // Emit an array of AttributeList. Most intrinsics will have at least one
631
- // entry, for the function itself (index ~1), which is usually nounwind.
632
- OS << " static constexpr uint16_t IntrinsicsToAttributesMap[] = {" ;
633
- for (const CodeGenIntrinsic &Int : Ints) {
634
- uint16_t FnAttrIndex = hasFnAttributes (Int) ? UniqFnAttributes[&Int] : 0 ;
635
- OS << formatv (" \n {} << 8 | {}, // {}" , FnAttrIndex,
636
- UniqAttributes[&Int], Int.Name );
637
- }
635
+ OS << R"(
636
+ };
637
+
638
+ AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {)" ;
638
639
639
640
OS << formatv (R"(
640
- };
641
641
if (id == 0)
642
642
return AttributeList();
643
643
0 commit comments