[Beignet] [PATCH 1/2] Add -dump-opt-asm support to the clLinkProgram() API

Song, Ruiling ruiling.song at intel.com
Sat Oct 10 01:54:55 PDT 2015


> 
>      if(options) {
>        char *p;
>        p = strstr(const_cast<char *>(options), "-cl-opt-disable");
>        if (p)
>          optLevel = 0;
> +
> +    char *str = (char *)malloc(sizeof(char) * (strlen(options) + 1));
> +      memcpy(str, options, strlen(options) + 1);
> +      std::string optionStr(str);
> +      while (end != std::string::npos) {
> +        end = optionStr.find(' ', start);
> +        std::string str = optionStr.substr(start, end - start);
> +        start = end + 1;
> +        if(str.size() == 0)
> +          continue;
> +
> +        if(str.find("-dump-opt-asm=") != std::string::npos) {
> +          dumpASMFileName = str.substr(str.find("=") + 1);
> +          continue; // Don't push this str back; ignore it.
> +        }
> +      }
I think it is not a good way to define two variables with the same name "str" but of different type here, right? Seems compiler can handle it well.
Other parts just LGTM.

Thanks!
Ruiling



More information about the Beignet mailing list