diff options
Diffstat (limited to 'src/gallium/state_trackers/clover')
7 files changed, 26 insertions, 129 deletions
diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index c9856901c2e..b3be2b8d1bb 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -216,7 +216,7 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs, throw error(CL_INVALID_OPERATION); if (!any_of(key_equals(name), headers)) - headers.push_back(std::pair<compat::string, compat::string>( + headers.push_back(std::pair<std::string, std::string>( name, header.source())); }, range(header_names, num_headers), diff --git a/src/gallium/state_trackers/clover/core/compiler.hpp b/src/gallium/state_trackers/clover/core/compiler.hpp index bec8aacf65d..62c0f476040 100644 --- a/src/gallium/state_trackers/clover/core/compiler.hpp +++ b/src/gallium/state_trackers/clover/core/compiler.hpp @@ -29,17 +29,17 @@ #include "pipe/p_defines.h" namespace clover { - typedef compat::vector<std::pair<compat::string, - compat::string> > header_map; + typedef compat::vector<std::pair<std::string, + std::string> > header_map; - module compile_program_llvm(const compat::string &source, + module compile_program_llvm(const std::string &source, const header_map &headers, pipe_shader_ir ir, - const compat::string &target, - const compat::string &opts, - compat::string &r_log); + const std::string &target, + const std::string &opts, + std::string &r_log); - module compile_program_tgsi(const compat::string &source); + module compile_program_tgsi(const std::string &source); } #endif diff --git a/src/gallium/state_trackers/clover/core/error.hpp b/src/gallium/state_trackers/clover/core/error.hpp index 45a38c1165b..805a0eceb6a 100644 --- a/src/gallium/state_trackers/clover/core/error.hpp +++ b/src/gallium/state_trackers/clover/core/error.hpp @@ -54,7 +54,7 @@ namespace clover { /// class error : public std::runtime_error { public: - error(cl_int code, compat::string what = "") : + error(cl_int code, std::string what = "") : std::runtime_error(what), code(code) { } @@ -68,7 +68,7 @@ namespace clover { class build_error : public error { public: - build_error(const compat::string &what = "") : + build_error(const std::string &what = "") : error(CL_COMPILE_PROGRAM_FAILURE, what) { } }; diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp index c07548c8f62..50ac01b4ee6 100644 --- a/src/gallium/state_trackers/clover/core/program.cpp +++ b/src/gallium/state_trackers/clover/core/program.cpp @@ -52,7 +52,7 @@ program::build(const ref_vector<device> &devs, const char *opts, _opts.insert({ &dev, opts }); - compat::string log; + std::string log; try { auto module = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index e07d95b1dbe..21579094a94 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -136,7 +136,7 @@ namespace { const std::string &name, const std::string &triple, const std::string &processor, const std::string &opts, clang::LangAS::Map& address_spaces, unsigned &optimization_level, - compat::string &r_log) { + std::string &r_log) { clang::CompilerInstance c; clang::EmitLLVMOnlyAction act(&llvm_ctx); @@ -470,7 +470,7 @@ namespace { emit_code(LLVMTargetMachineRef tm, LLVMModuleRef mod, LLVMCodeGenFileType file_type, LLVMMemoryBufferRef *out_buffer, - compat::string &r_log) { + std::string &r_log) { LLVMBool err; char *err_message = NULL; @@ -491,7 +491,7 @@ namespace { std::vector<char> compile_native(const llvm::Module *mod, const std::string &triple, const std::string &processor, unsigned dump_asm, - compat::string &r_log) { + std::string &r_log) { std::string log; LLVMTargetRef target; @@ -545,7 +545,7 @@ namespace { std::map<std::string, unsigned> get_kernel_offsets(std::vector<char> &code, const std::vector<llvm::Function *> &kernels, - compat::string &r_log) { + std::string &r_log) { // One of the libelf implementations // (http://www.mr511.de/software/english.htm) requires calling @@ -611,7 +611,7 @@ namespace { const llvm::Module *mod, const std::vector<llvm::Function *> &kernels, const clang::LangAS::Map &address_spaces, - compat::string &r_log) { + std::string &r_log) { std::map<std::string, unsigned> kernel_offsets = get_kernel_offsets(code, kernels, r_log); @@ -641,12 +641,12 @@ namespace { void diagnostic_handler(const llvm::DiagnosticInfo &di, void *data) { if (di.getSeverity() == llvm::DS_Error) { - std::string message = *(compat::string*)data; + std::string message = *(std::string*)data; llvm::raw_string_ostream stream(message); llvm::DiagnosticPrinterRawOStream dp(stream); di.print(dp); stream.flush(); - *(compat::string*)data = message; + *(std::string*)data = message; throw build_error(); } @@ -686,12 +686,12 @@ namespace { } // End anonymous namespace module -clover::compile_program_llvm(const compat::string &source, +clover::compile_program_llvm(const std::string &source, const header_map &headers, enum pipe_shader_ir ir, - const compat::string &target, - const compat::string &opts, - compat::string &r_log) { + const std::string &target, + const std::string &opts, + std::string &r_log) { init_targets(); diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp index 93dfeb54fa6..9e959f7bb2e 100644 --- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp +++ b/src/gallium/state_trackers/clover/tgsi/compiler.cpp @@ -88,11 +88,12 @@ namespace { } module -clover::compile_program_tgsi(const compat::string &source) { - const char *body = source.find("COMP\n"); +clover::compile_program_tgsi(const std::string &source) { + const size_t body_pos = source.find("COMP\n"); + const char *body = &source[body_pos]; module m; - read_header({ source.begin(), body }, m); + read_header({ source.begin(), source.begin() + body_pos }, m); read_body(body, m); return m; diff --git a/src/gallium/state_trackers/clover/util/compat.hpp b/src/gallium/state_trackers/clover/util/compat.hpp index ea7d3a000be..dc063344c3c 100644 --- a/src/gallium/state_trackers/clover/util/compat.hpp +++ b/src/gallium/state_trackers/clover/util/compat.hpp @@ -307,110 +307,6 @@ namespace clover { size_t offset; }; - class string { - public: - typedef char *iterator; - typedef const char *const_iterator; - typedef char value_type; - typedef char &reference; - typedef const char &const_reference; - typedef std::ptrdiff_t difference_type; - typedef std::size_t size_type; - - string() : v() { - } - - string(const char *p) : v(p, std::strlen(p)) { - } - - template<typename C> - string(const C &v) : v(v) { - } - - operator std::string() const { - return std::string(v.begin(), v.end()); - } - - bool - operator==(const string &s) const { - return this->v == s.v; - } - - void - reserve(size_type n) { - v.reserve(n); - } - - void - resize(size_type n, char x = char()) { - v.resize(n, x); - } - - void - push_back(char x) { - v.push_back(x); - } - - size_type - size() const { - return v.size(); - } - - size_type - capacity() const { - return v.capacity(); - } - - iterator - begin() { - return v.begin(); - } - - const_iterator - begin() const { - return v.begin(); - } - - iterator - end() { - return v.end(); - } - - const_iterator - end() const { - return v.end(); - } - - reference - operator[](size_type i) { - return v[i]; - } - - const_reference - operator[](size_type i) const { - return v[i]; - } - - const char * - c_str() const { - v.reserve(size() + 1); - *v.end() = 0; - return v.begin(); - } - - const char * - find(const string &s) const { - for (size_t i = 0; i + s.size() < size(); ++i) { - if (!std::memcmp(begin() + i, s.begin(), s.size())) - return begin() + i; - } - - return end(); - } - - private: - mutable vector<char> v; - }; } } |