@@ -1559,6 +1559,7 @@ extern int CISAparse(CISA_IR_Builder *builder);
15591559extern YY_BUFFER_STATE CISA_scan_string (const char *yy_str);
15601560extern void CISA_delete_buffer (YY_BUFFER_STATE buf);
15611561static std::mutex mtx;
1562+ extern void resetGlobalVariables ();
15621563
15631564int CISA_IR_Builder::ParseVISAText (const std::string &visaText,
15641565 const std::string &visaTextFile) {
@@ -1581,6 +1582,7 @@ int CISA_IR_Builder::ParseVISAText(const std::string &visaText,
15811582 }
15821583 }
15831584
1585+ resetGlobalVariables ();
15841586 YY_BUFFER_STATE visaBuf = CISA_scan_string (visaText.c_str ());
15851587 if (CISAparse (this ) != 0 ) {
15861588#ifndef DLL_MODE
@@ -1622,6 +1624,7 @@ int CISA_IR_Builder::ParseVISAText(const std::string &visaFile) {
16221624 return VISA_FAILURE;
16231625 }
16241626
1627+ resetGlobalVariables ();
16251628 if (CISAparse (this ) != 0 ) {
16261629 vISA_ASSERT (false , " Parsing visa text failed" );
16271630 return VISA_FAILURE;
@@ -4012,6 +4015,30 @@ CISA_IR_Builder::get_input_class(Common_ISA_Var_Class var_class) {
40124015}
40134016void CISA_IR_Builder::CISA_post_file_parse () { return ; }
40144017
4018+ void CISA_IR_Builder::CISA_parse_build_options (const char * argStr) {
4019+ std::string args (argStr);
4020+ size_t first_quote = args.find_first_of (' "' );
4021+ size_t last_quote = args.find_last_of (' "' );
4022+
4023+ if (first_quote != std::string::npos &&
4024+ last_quote != std::string::npos &&
4025+ first_quote < last_quote) {
4026+ args = args.substr (first_quote + 1 , last_quote - first_quote - 1 );
4027+ std::vector<std::string> argvStrings;
4028+ std::vector<const char *> argv;
4029+ std::string token;
4030+ std::istringstream ss (args);
4031+ while (ss >> token) {
4032+ argvStrings.push_back (token);
4033+ }
4034+ argv.reserve (argvStrings.size ());
4035+ for (const std::string& s : argvStrings) {
4036+ argv.push_back (s.c_str ());
4037+ }
4038+ getOptions ()->parseOptions (argv.size (), argv.data ());
4039+ }
4040+ }
4041+
40154042// place it here so that internal Gen_IR files don't have to include
40164043// VISAKernel.h
40174044std::stringstream &IR_Builder::criticalMsgStream () {
0 commit comments