タグ

clangとC++に関するcrafのブックマーク (11)

  • LLVMのstd::uniform_real_distributionが遅い件のLLVM観点の原因を探ってみた - Qiita

    はじめに 興味があったので以下の件についてLLVMの観点で原因を探ってみました。 以下、デバッグビルドしたLLVM15.0.7を使ってみていきます。 "std::uniform_real_distributionが遅い件"で問題とされた部分 const long double __r = static_cast<long double>(__urng.max()) - static_cast<long double>(__urng.min()) + 1.0L; const size_t __log2r = std::log(__r) / std::log(2.0L); このままでは、コンパイル出来ないので整形します。上記コード中の__urng.max()と__urng.min()は、たどるとそれぞれstd::numeric_limitsのmax()とmin()となっているので、そのように置

    LLVMのstd::uniform_real_distributionが遅い件のLLVM観点の原因を探ってみた - Qiita
  • 大学院生のためのLLVM | POSTD

    (注:2017/07/06、いただいたフィードバックを元に翻訳を修正いたしました。) この記事は、 LLVM コンパイラ基盤を使ってリサーチをする人のための入門書です。これを読めば、コンパイラに全く興味のない大学院生も、楽しみながらLLVMを使って優れた功績をあげられるようになるでしょう。 LLVMとは何か? LLVMは非常に優れていて、ハックしやすく、C言語やC++のような”ネイティブ”言語向けの、時代の先端を行くコンパイラです。 LLVMの素晴らしさに関しては他にも様々な話を聞くのではないでしょうか(JITコンパイラとしても使えるとか、C言語系列以外の様々な言語を強化できるとか、 App Storeからの新しい配信形態 であるとか、などなど)。もちろん全部当のことですが、今回の記事の目的としては、上述の定義が重要です。 LLVMが他のコンパイラと差別化される理由には、いくつかの大きな

  • Clang is now used to build Chrome for Windows

    PerformanceWe conducted extensive A/B testing of performance. Performance telemetry numbers are about the same for MSVC-built and clang-built Chrome – some metrics get better, some get worse, but all of them are within 5% of each other. The official MSVC builds used LTCG and PGO, while the Clang builds currently use neither of these. This is potential for improvement that we look forward to explor

  • C++の未定義の挙動で呼ばれないはずの関数が呼ばれる場合

    Krister Walfridsson’s blog: Why undefined behavior may call a never-called function 以下のようなコードをClangでコンパイルすると、 #include <cstdlib> typedef int (*Function)(); static Function Do; static int EraseAll() { return system("rm -rf /"); } void NeverCalled() { Do = EraseAll; } int main() { return Do(); } Clangは以下のような最適化されたコードを吐く。 main: movl $.L.str, %edi jmp system .L.str: .asciz "rm -rf /" これは以下のようなコードと同じだ。

    craf
    craf 2017/09/26
  • Visual Studio 2017でclangをコンソールで利用する - L'eclat des jours(2017-04-16)

    _ Visual Studio 2017でclangをコンソールで利用する VS2015のときは、c2.dll問題とかあってもなんとなくクリアできていたのだが(clangはx86用だということさえわかれば、あとは適切なほうのclang.exeのPATHを設定する)、VS2017では常に失敗するようになった。 -vを付けてやり直せと出てきたので、やってみると、link.exeの起動に失敗している。 おや? と思ってVS2015のclangで見てみると、こちらはlink.exeをフルパスで起動している。ふつうに考えてみれば、MSがclangをコマンドラインで利用できないように一工夫したようだ。気か? で、解決策として、clang.exeと同じディレクトリにlink.exeを入れるとか考えてみたが、ばかげている。 であれば、しょうがない。 MSBuildの出番である。 とはいえ、なんかいろいろ

  • L&#39;eclat des jours(2016-09-19)

    _ Visual StudioでclangでC11を試す(が) C11のAppendix Kを試してみたくて、bash on Windowsのclangで次のコードをコンパイルした。 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int main() { char tmp[80]; int n = scanf_s("%s", tmp); // => コンパイルエラーとなる if (n > 0) { puts(tmp); } } するとscanf_sは未定義だと警告され、結局はリンクエラーとなる。 test.c:(.text+0x1e): `scanf_s' に対する定義されていない参照です /usr/include/studio.hを見たら、確かに定義が存在しない。 まあAppendix Kはオプションだからそんなものかも知れない。

    L&#39;eclat des jours(2016-09-19)
  • Bringing Clang to Windows - Visual C++ Team Blog

    As you may know, Visual Studio now supports building Android and iOS applications using Clang. We realize the need of our users to write cross-platform apps and we know that C++ offers massive benefits in the cross-platform arena. Clang has made impressive strides in standards conformance and diagnostics and is fast becoming the preferred C++ compiler for non-Windows platforms. In order to extend

    Bringing Clang to Windows - Visual C++ Team Blog
  • Shows

    AI is suddenly everywhere. Do you need to go and get a shiny machine learning degree to remain competitive? John Maeda says not to worry. He’ll show you how to cook delicious dishes into your coding repertoire with his new show - Mr. Maeda’s Cozy AI Kitchen. Find out how you can use GitHub Copilot, an add-on that is powered by AI, to get helpful suggestions when writing code or documentation. This

    Shows
    craf
    craf 2014/11/15
    Android/iOS用にclang対応か
  • External Clang Examples — Clang 19.0.0git documentation

    External Clang Examples¶ Introduction¶ This page provides some examples of the kinds of things that people have done with Clang that might serve as useful guides (or starting points) from which to develop your own tools. They may be helpful even for something as banal (but necessary) as how to set up your build to integrate Clang. Clang’s library-based design is deliberately aimed at facilitating

    craf
    craf 2013/04/26
  • Clang のコード補完 - Backnumbers: Steps to Phantasien

    Clang のツリーを眺めていたら, "clang-completion-mode.el" というファイルがあった. clang のプログラムを呼び出してコード補完ができるらしい. (使いかたを説明してくれている人もいた.) 以前読んだ時 は気付かなかったけど, 二年前からあったようだ. こんなものがプラグインで書けてしまうなんてさすがモダンなコンパイラは違うなーインデクスはどうするのかなーと 感心しつつコードを見ていたらインデクスのような前処理はないようす. それに全然プラグインじゃない. Clang 組み込みの機能として実装されていた. 以前から Xcode(4) がどんな風に Clang を統合するのか気になっていた. コード補完はそうした取り組みの一環かもしれない. 高々 Emacs のため Clang 組込みの機能を増やすとも思えないからね. というわけでざっとコードを眺めてみよ

    craf
    craf 2011/04/28
  • clangでソフトウェアをビルドしC++を知る - 射撃しつつ前転 改

    clangというのはllvm向けのC/C++/Obj-Cのためのフロントエンドで、最近はGoogle ChromeとかFirefoxもコンパイルできるレベルにまで成熟してきているらしい。 いくつかのブログで紹介されているのを見ても、ふーん、ぐらいにしか思っていなかったのだが、あんな大規模なソフトウェアがコンパイルできるというのは、考えてみるとすごいことである。大事なことなので強調しておくが、すごいことである。十分に実用的なレベルに到達していることだ。ビルドも早いし生成されたコードもg++と同程度には速いというし、試してみる必要がある。 という訳で、いくつか実際にソフトウェアをビルドしてみた。試してみた限りでは、 libstdc++のtr1/unordered_mapがビルドできない C++のコーナーケースで、clangが許容しないものが多い といった問題があったが、割とどれもすんなりとコン

    clangでソフトウェアをビルドしC++を知る - 射撃しつつ前転 改
  • 1