| 1903 | return res; |
| 1904 | } |
| 1905 | id emit_call(const location &loc, id function, const type &res_type, const std::vector<expression> &args) override |
| 1906 | { |
| 1907 | #ifndef NDEBUG |
| 1908 | for (const expression &arg : args) |
| 1909 | assert(arg.chain.empty() && arg.base != 0); |
| 1910 | #endif |
| 1911 | |
| 1912 | const id res = make_id(); |
| 1913 | |
| 1914 | std::string &code = _blocks.at(_current_block); |
| 1915 | |
| 1916 | write_location(code, loc); |
| 1917 | |
| 1918 | code += '\t'; |
| 1919 | |
| 1920 | if (!res_type.is_void()) |
| 1921 | { |
| 1922 | write_type(code, res_type); |
| 1923 | code += ' ' + id_to_name(res); |
| 1924 | |
| 1925 | if (res_type.is_array()) |
| 1926 | code += '[' + std::to_string(res_type.array_length) + ']'; |
| 1927 | |
| 1928 | code += " = "; |
| 1929 | } |
| 1930 | |
| 1931 | code += id_to_name(function) + '('; |
| 1932 | |
| 1933 | for (const expression &arg : args) |
| 1934 | { |
| 1935 | code += id_to_name(arg.base); |
| 1936 | code += ", "; |
| 1937 | } |
| 1938 | |
| 1939 | // Remove trailing ", " |
| 1940 | if (!args.empty()) |
| 1941 | code.erase(code.size() - 2); |
| 1942 | |
| 1943 | code += ");\n"; |
| 1944 | |
| 1945 | return res; |
| 1946 | } |
| 1947 | id emit_call_intrinsic(const location &loc, id intrinsic, const type &res_type, const std::vector<expression> &args) override |
| 1948 | { |
| 1949 | #ifndef NDEBUG |
no test coverage detected