{"id":30,"date":"2014-01-08T17:06:59","date_gmt":"2014-01-08T08:06:59","guid":{"rendered":"http:\/\/www.kako.com\/blog\/?p=30"},"modified":"2015-12-14T23:10:03","modified_gmt":"2015-12-14T14:10:03","slug":"llvm%e3%81%ae%e4%b8%ad%e9%96%93%e3%82%b3%e3%83%bc%e3%83%89%e3%82%a2%e3%82%bb%e3%83%b3%e3%83%96%e3%83%a9%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%e3%80%82","status":"publish","type":"post","link":"http:\/\/kako.com\/blog\/?p=30","title":{"rendered":"LLVM\u306e\u4e2d\u9593\u30b3\u30fc\u30c9\u30a2\u30bb\u30f3\u30d6\u30e9\u3092\u8a66\u3057\u3066\u307f\u305f (Mac OS X\u7de8)"},"content":{"rendered":"<p>\u4ee5\u524d\u306b.NET\u306e\u4e2d\u9593\u30b3\u30fc\u30c9(MSIL)\u7528\u306eTinyBasic\u30b3\u30f3\u30d1\u30a4\u30e9\u3068\u304b\u3001Java\u306e\u4e2d\u9593\u30b3\u30fc\u30c9(bytecode)\u7528\u306eTinyBasic\u30b3\u30f3\u30d1\u30a4\u30e9\u3068\u304b\u4f5c\u3063\u3066\u304a\u308a\u3001\u6b21\u306fLLVM\u7528\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u308b\u3002<br \/>\n\u2192 <a href=\"http:\/\/www.kako.com\/neta\/2013-004\/2013-004.html\">Java\u30d0\u30a4\u30c8\u30b3\u30fc\u30c9\u3092\u751f\u6210\u3059\u308bTiny BASIC\u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u4f5c\u3063\u3066\u307f\u305f<\/a><br \/>\n\u2192 <a href=\"http:\/\/www.kako.com\/neta\/2012-013\/2012-013.html\">CIL(MSIL)\u4e2d\u9593\u30b3\u30fc\u30c9\u3092\u751f\u6210\u3059\u308bTiny BASIC\u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u4f5c\u3063\u3066\u307f\u305f<\/a><\/p>\n<p>\u304d\u3064\u306d\u3055\u3093\u3067\u3082\u308f\u304b\u308bLLVM\u3068\u3044\u3046\u672c\u3092\u53c2\u8003\u306b\u3057\u3066\u3001LLVM\u306e\u4e2d\u9593\u30b3\u30fc\u30c9\u30a2\u30bb\u30f3\u30d6\u30e9\u3092\u8a66\u3057\u3066\u307f\u305f\u3002<br \/>\n\u3000<a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4844334158\/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;camp=247&amp;creative=1211&amp;creativeASIN=4844334158&amp;linkCode=as2&amp;tag=gid023014-22\">\u304d\u3064\u306d\u3055\u3093\u3067\u3082\u308f\u304b\u308bLLVM ~\u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u81ea\u4f5c\u3059\u308b\u305f\u3081\u306e\u30ac\u30a4\u30c9\u30d6\u30c3\u30af~<\/a><img loading=\"lazy\" style=\"border: none !important; margin: 0px !important;\" alt=\"\" src=\"http:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=gid023014-22&amp;l=as2&amp;o=9&amp;a=4844334158\" width=\"1\" height=\"1\" border=\"0\" \/>(Amazon)<br \/>\n<!--more--><br \/>\n\u3053\u306e\u672c\u3067\u306f\u3001Ubuntu\u4e0a\u3067LLVM\u3092\u30bd\u30fc\u30b9\u304b\u3089\u30d3\u30eb\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u305f\u306e\u3060\u3051\u3069\u3001Mac\u4e0a\u3067\u4f5c\u696d\u3059\u308b\u305f\u3081\u306bMac OS X\u3067LLVM\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3002<br \/>\n\u2192 <a href=\"http:\/\/www.kako.com\/neta\/2013-046\/2013-046.html\">Mac OS X Mavericks\u306bHomebrew\u3067LLVM\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n<p>LLVM\u304c\u52d5\u304b\u305b\u305f\u306e\u3067\u3001\u307e\u305a\u6700\u521d\u306b\u3001\u53c2\u8003\u66f8\u306a\u3069\u306b\u8f09\u3063\u3066\u3044\u308bHello world\u3068\u3044\u3046\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u8a66\u3057\u3066\u307f\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n@HW = internal constant [14 x i8] c&quot;Hello world!&#92;&#48;A&#92;&#48;0&quot;\r\n\r\ndeclare i32 @puts(i8*)\r\n\r\ndefine i32 @main() {\r\n  %cast_hw = getelementptr [14 x i8]* @HW, i32 0, i32 0\r\n  call i32 @puts(i8* %cast_hw)\r\n  ret i32 0\r\n}\r\n<\/pre>\n<p>\u4e0a\u8a18\u3092\u3001hello.ll\u3068\u3044\u3046\u540d\u524d\u3067\u4fdd\u5b58\u3057\u3001<br \/>\n% llvm-as hello.ll<br \/>\n\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3067\u30d3\u30eb\u30c9\u3059\u308b\u3068\u3001LLVM\u306e\u4e2d\u9593\u30b3\u30fc\u30c9\u306ebitcode\u51fa\u529b\u304c\u5f97\u3089\u308c\u308b\u3002<br \/>\nlli\u3092\u4f7f\u3063\u3066\u5b9f\u884c\u3057\u3066\u3001\u52d5\u4f5c\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u3002<\/p>\n<p>\u3067\u3001\u305d\u306e\u6b21\u306f\u3001a=2; b=3; printf(&#8220;%d&#8221;,a); printf(&#8220;%d&#8221;,b); a=a+b; printf(&#8220;%d&#8221;,a);\u3068\u3044\u3046\u3088\u3046\u306a\u51e6\u7406\u3092\u66f8\u3044\u3066\u307f\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndefine i32 @main() {\r\n  %a= alloca i32\r\n  %b= alloca i32\r\n  store i32 2 , i32* %a\r\n  store i32 3 , i32* %b\r\n  %cast_msg = getelementptr [4 x i8]* @MSG, i32 0, i32 0\r\n  %tmp1=load i32* %a\r\n  %tmp2=load i32* %b\r\n  call i32 (i8*, ...)* @printf(i8* %cast_msg, i32 %tmp1)\r\n  call i32 (i8*, ...)* @printf(i8* %cast_msg, i32 %tmp2)\r\n  %tmp3= add i32 %tmp1,%tmp2\r\n  store i32 %tmp3, i32* %a\r\n  %tmp4=load i32* %a\r\n  call i32 (i8*, ...)* @printf(i8* %cast_msg, i32 %tmp4)\r\n  ret i32 0\r\n}\r\ndeclare i32 @printf(i8*, ...)\r\n@MSG = internal constant [4 x i8] c&quot;%d&#92;&#48;A&#92;&#48;0&quot;\r\n<\/pre>\n<p>\u9759\u7684\u5358\u4e00\u4ee3\u5165\u306e\u305f\u3081\u3001\u666e\u901a\u306b%a\u3084%b\u3068\u3044\u3046\u5909\u6570\u3092\u6574\u6570\u578b\u306b\u3057\u3066\u8a08\u7b97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u30dd\u30a4\u30f3\u30bf\u5909\u6570\u3092\u4f7f\u3063\u3066\u30e1\u30e2\u30ea\u78ba\u4fdd\u3092\u3057\u3066\u4e00\u6642\u5909\u6570\u306b\u53d6\u308a\u51fa\u3057\u306a\u304c\u3089\u51e6\u7406\u3092\u3057\u3066\u3044\u308b\u3002<br \/>\n\u305d\u306e\u305f\u3081tmp1,tmp2,tmp3,..\u3068\u304bSSA\u98a8\u306e\u5909\u6570\u3092\u305f\u304f\u3055\u3093\u4f7f\u3044\u6368\u3066\u3067\u4f7f\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3053\u3046\u3044\u3046\u3084\u308a\u304b\u305f\u3067\u826f\u3044\u306e\u304b\u3061\u3087\u3063\u3068\u81ea\u4fe1\u304c\u306a\u3044\u304c\u3001\u306a\u3093\u3068\u306a\u304fTinyBasic\u304f\u3089\u3044\u306a\u3089\u3044\u3051\u305d\u3046\u306a\u6c17\u304c\u3057\u3066\u304d\u305f\u3002<\/p>\n<p>&#8212;<br \/>\n\u8ffd\u8a18<br \/>\n\u6642\u9593\u304c\u7a7a\u3044\u3066\u3057\u307e\u3063\u305f\u304c\u3001\u3088\u3046\u3084\u304fLLVM\u7528\u306eTinyBasic\u3092\u4f5c\u3063\u305f\u3002<br \/>\n\u2192 <a href=\"http:\/\/kako.com\/blog\/?p=10146\">LLVM\u4e2d\u9593\u30b3\u30fc\u30c9\u3092\u751f\u6210\u3059\u308bTiny BASIC\u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u4f5c\u3063\u3066\u307f\u305f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u306b.NET\u306e\u4e2d\u9593\u30b3\u30fc\u30c9(MSIL)\u7528\u306eTinyBasic\u30b3\u30f3\u30d1\u30a4\u30e9\u3068\u304b\u3001Java\u306e\u4e2d\u9593\u30b3\u30fc\u30c9(bytecode)\u7528\u306eTinyBasic\u30b3\u30f3\u30d1\u30a4\u30e9\u3068\u304b\u4f5c\u3063\u3066\u304a\u308a\u3001\u6b21\u306fLLVM\u7528\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u308b\u3002 \u2192 Java [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,14],"tags":[],"_links":{"self":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/30"}],"collection":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30"}],"version-history":[{"count":3,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/30\/revisions"}],"predecessor-version":[{"id":10503,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/30\/revisions\/10503"}],"wp:attachment":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}