@@ -735,12 +735,6 @@ cp_lexer_new_main (void)
735
735
gcc_assert (!the_parser);
736
736
the_parser = cp_parser_new (lexer);
737
737
738
- unsigned raw_data_tokens = 0;
739
- char *raw_data_buf = NULL;
740
- const unsigned int raw_data_max_len
741
- = 131072 - offsetof (struct tree_string, str) - 1;
742
- const unsigned int raw_data_min_len = 128;
743
-
744
738
/* Get the remaining tokens from the preprocessor. */
745
739
while (tok->type != CPP_EOF)
746
740
{
@@ -749,99 +743,6 @@ cp_lexer_new_main (void)
749
743
module_token_lang (tok->type, tok->keyword, tok->u.value,
750
744
tok->location, filter);
751
745
752
- /* Attempt to optimize long lists of 0-255 integers
753
- separated by commas into CPP_EMBED.
754
- In particular, when we see
755
- CPP_NUMBER CPP_COMMA ( CPP_NUMBER CPP_COMMA ){n} CPP_NUMBER
756
- where n is in [raw_data_min_len, raw_data_max_len - 2]
757
- and all CPP_NUMBER tokens have int type and value in [0, UCHAR_MAX]
758
- it is changed into
759
- CPP_NUMBER CPP_COMMA CPP_EMBED CPP_COMMA CPP_NUMBER. */
760
- recheck:
761
- if (tok->type == CPP_NUMBER
762
- && (raw_data_tokens & 1) == 0
763
- && TREE_CODE (tok->u.value) == INTEGER_CST
764
- && TREE_TYPE (tok->u.value) == integer_type_node
765
- && !wi::neg_p (wi::to_wide (tok->u.value))
766
- && wi::to_widest (tok->u.value) <= UCHAR_MAX
767
- && raw_data_tokens < raw_data_max_len * 2)
768
- {
769
- raw_data_tokens++;
770
- /* * 2 comes from each byte in the middle represented by 2 tokens,
771
- CPP_NUMBER and CPP_COMMA, while + 3 stands for the
772
- CPP_NUMBER CPP_COMMA at the start and CPP_NUMBER at the end. */
773
- if (raw_data_tokens >= raw_data_min_len * 2 + 3)
774
- {
775
- unsigned int len = lexer->buffer->length ();
776
- unsigned int new_len;
777
- if (raw_data_tokens == raw_data_min_len * 2 + 3)
778
- {
779
- if (raw_data_buf == NULL)
780
- raw_data_buf = XNEWVEC (char, raw_data_max_len);
781
- for (unsigned i = len - raw_data_tokens, j = 0;
782
- i < len; i += 2, ++j)
783
- raw_data_buf[j]
784
- = (char) tree_to_uhwi ((*lexer->buffer)[i].u.value);
785
- /* + 5 stands for
786
- CPP_NUMBER CPP_COMMA CPP_EMBED CPP_COMMA CPP_NUMBER
787
- tokens that will replace the original raw_data_tokens
788
- tokens. */
789
- new_len = len - raw_data_tokens + 5;
790
- }
791
- else
792
- {
793
- raw_data_buf[raw_data_tokens / 2]
794
- = (char) tree_to_uhwi (tok->u.value);
795
- new_len = len - 2;
796
- }
797
- /* The last 2 tokens are always CPP_COMMA CPP_NUMBER. */
798
- (*lexer->buffer)[new_len - 2] = (*lexer->buffer)[len - 2];
799
- (*lexer->buffer)[new_len - 1] = (*lexer->buffer)[len - 1];
800
- lexer->buffer->truncate (new_len);
801
- }
802
- }
803
- else if (tok->type == CPP_COMMA && (raw_data_tokens & 1) == 1)
804
- raw_data_tokens++;
805
- else if (raw_data_tokens >= raw_data_min_len * 2 + 3)
806
- {
807
- unsigned last_number = (raw_data_tokens & 1);
808
- /* Index of the CPP_EMBED token. From the above code, that
809
- future CPP_EMBED slot is followed by at least CPP_COMMA CPP_NUMBER
810
- tokens and if !last_number by another CPP_COMMA and then
811
- by the current token which is either not a CPP_NUMBER (e.g.
812
- often CPP_CLOSE_BRACE), or CPP_NUMBER with non-int type or with
813
- value not in [0, UCHAR_MAX], or reaching the raw_data_max_len
814
- limit. So we need to substract 1 (to get at the current token
815
- index) plus 3 + !last_number to get at the CPP_EMBED index. */
816
- unsigned int idx = lexer->buffer->length () - 4 - !last_number;
817
- if (!last_number)
818
- --raw_data_tokens;
819
- /* Number of bytes in the sequence, including the first and last
820
- CPP_NUMBER. Those two bytes are included in the underlying
821
- STRING_CST but not in RAW_DATA_CST. */
822
- raw_data_tokens = raw_data_tokens / 2 + 1;
823
- tree raw = make_node (RAW_DATA_CST);
824
- TREE_TYPE (raw) = integer_type_node;
825
- /* Minus the first and last bytes which have their own CPP_NUMBER
826
- tokens. */
827
- RAW_DATA_LENGTH (raw) = raw_data_tokens - 2;
828
- tree owner = build_string (raw_data_tokens, raw_data_buf);
829
- TREE_TYPE (owner) = build_array_type_nelts (unsigned_char_type_node,
830
- raw_data_tokens);
831
- RAW_DATA_OWNER (raw) = owner;
832
- /* Skip over the first byte which has its own CPP_NUMBER token. */
833
- RAW_DATA_POINTER (raw) = TREE_STRING_POINTER (owner) + 1;
834
- (*lexer->buffer)[idx].type = CPP_EMBED;
835
- (*lexer->buffer)[idx].u.value = raw;
836
- raw_data_tokens = 0;
837
- goto recheck;
838
- }
839
- else if (raw_data_tokens)
840
- {
841
- raw_data_tokens = 0;
842
- goto recheck;
843
- }
844
-
845
746
/* Check for early pragmas that need to be handled now. */
846
747
if (tok->type == CPP_PRAGMA_EOL)
847
748
cp_lexer_handle_early_pragma (lexer);
@@ -850,8 +751,6 @@ cp_lexer_new_main (void)
850
751
cp_lexer_get_preprocessor_token (C_LEX_STRING_NO_JOIN, tok);
851
752
}
852
753
853
- XDELETEVEC (raw_data_buf);
854
-
855
754
lexer->next_token = lexer->buffer->address ();
856
755
lexer->last_token = lexer->next_token
857
756
+ lexer->buffer->length ()
0 commit comments