{"id":2987,"date":"2013-09-01T14:42:17","date_gmt":"2013-09-01T05:42:17","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=2987"},"modified":"2013-09-01T14:46:58","modified_gmt":"2013-09-01T05:46:58","slug":"5-3-4-for%e3%83%ab%e3%83%bc%e3%83%97%e3%81%ae%e3%81%9f%e3%82%81%e3%81%aellvm-ir","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/2987","title":{"rendered":"5.3.4. for\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306eLLVM IR"},"content":{"rendered":"<p><a href=\"https:\/\/peta.okechan.net\/blog\/archives\/2836\" title=\"LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\">LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u65e5\u672c\u8a9e\u8a33<\/a><br \/>\n\u7b2c5\u7ae0 \u4e07\u83ef\u93e1: \u8a00\u8a9e\u306e\u62e1\u5f35: \u5236\u5fa1\u30d5\u30ed\u30fc<br \/>\n<a href=\"http:\/\/llvm.org\/docs\/tutorial\/LangImpl05.html#llvm-ir-for-the-for-loop\" target=\"_blank\">\u7b2c3.4\u7bc0 for\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306eLLVM IR<\/a><\/p>\n<p>\u3053\u3053\u304b\u3089\u304c\u304a\u3082\u3057\u308d\u3044\u3068\u3053\u308d\u3067\u3042\u308b\u3002<br \/>\nfor\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306b\u751f\u6210\u3055\u305b\u305f\u3044LLVM IR\u3064\u3044\u3066\u8aac\u660e\u3059\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/archives\/2979\" title=\"5.3. for\u30eb\u30fc\u30d7\u5f0f\">\u7b2c3\u7bc0\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u4f8b<\/a>\u306b\u3088\u3063\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306aLLVM IR\u304c\u51fa\u529b\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3002\uff08\u5206\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u6700\u9069\u5316\u7121\u3057\u3067\u751f\u6210\u3055\u308c\u305f\u30c0\u30f3\u30d7\u3067\u3042\u308b\u4e8b\u306b\u6ce8\u610f\u3002\uff09<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">declare double @putchard(double)\r\n\r\ndefine double @printstar(double %n) {\r\nentry:\r\n  ; \u521d\u671f\u5024 = 1.0 (phi\u547d\u4ee4\u306e\u4e2d\u306b\u30a4\u30f3\u30e9\u30a4\u30f3\u3067\u66f8\u3044\u3066\u3042\u308b)\r\n  br label %loop\r\n\r\nloop:       ; preds = %loop, %entry\r\n  %i = phi double &#x5B; 1.000000e+00, %entry ], &#x5B; %nextvar, %loop ]\r\n  ; \u672c\u6587\r\n  %calltmp = call double @putchard(double 4.200000e+01)\r\n  ; \u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\r\n  %nextvar = fadd double %i, 1.000000e+00\r\n\r\n  ; \u30c6\u30b9\u30c8\u306e\u7d42\u4e86\r\n  %cmptmp = fcmp ult double %i, %n\r\n  %booltmp = uitofp i1 %cmptmp to double\r\n  %loopcond = fcmp one double %booltmp, 0.000000e+00\r\n  br i1 %loopcond, label %loop, label %afterloop\r\n\r\nafterloop:      ; preds = %loop\r\n  ; \u30eb\u30fc\u30d7\u306f\u5e38\u306b0\u3092\u8fd4\u3059\u3002\r\n  ret double 0.000000e+00\r\n}<\/pre>\n<p>\u3053\u306efor\u30eb\u30fc\u30d7\u306f\u3001\u6211\u3005\u304c\u3053\u308c\u307e\u3067\u898b\u3066\u304d\u305f\u5168\u3066\u306e\u69cb\u6210\u7269\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3002<br \/>\nphi\u30ce\u30fc\u30c9\u3084\u3001\u3044\u304f\u3064\u304b\u306e\u5f0f\u3001\u305d\u3057\u3066\u57fa\u672c\u7684\u306a\u30d6\u30ed\u30c3\u30af\u3002<br \/>\n\u305d\u308c\u3089\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u898b\u3066\u307f\u3088\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/peta.okechan.net\/blog\/archives\/2836\" title=\"LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\">LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u65e5\u672c\u8a9e\u8a33<\/a><br \/>\n\u7b2c5\u7ae0 \u4e07\u83ef\u93e1: \u8a00\u8a9e\u306e\u62e1\u5f35: \u5236\u5fa1\u30d5\u30ed\u30fc<br \/>\n<a href=\"http:\/\/llvm.org\/docs\/tutorial\/LangImpl05.html#llvm-ir-for-the-for-loop\" target=\"_blank\">\u7b2c3.4\u7bc0 for\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306eLLVM IR<\/a><\/p>\n<p>\u3053\u3053\u304b\u3089\u304c\u304a\u3082\u3057\u308d\u3044\u3068\u3053\u308d\u3067\u3042\u308b\u3002<br \/>\nfor\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306b\u751f\u6210\u3055\u305b\u305f\u3044LLVM IR\u3064\u3044\u3066\u8aac\u660e\u3059\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/archives\/2979\" title=\"5.3. for\u30eb\u30fc\u30d7\u5f0f\">\u7b2c3\u7bc0\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u4f8b<\/a>\u306b\u3088\u3063\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306aLLVM IR\u304c\u51fa\u529b\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3002\uff08\u5206\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u6700\u9069\u5316\u7121\u3057\u3067\u751f\u6210\u3055\u308c\u305f\u30c0\u30f3\u30d7\u3067\u3042\u308b\u4e8b\u306b\u6ce8\u610f\u3002\uff09<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">declare double @putchard(double)\r\n\r\ndefine double @printstar(double %n) {\r\nentry:\r\n  ; \u521d\u671f\u5024 = 1.0 (phi\u547d\u4ee4\u306e\u4e2d\u306b\u30a4\u30f3\u30e9\u30a4\u30f3\u3067\u66f8\u3044\u3066\u3042\u308b)\r\n  br label %loop\r\n\r\nloop:       ; preds = %loop, %entry\r\n  %i = phi double &#x5B; 1.000000e+00, %entry ], &#x5B; %nextvar, %loop ]\r\n  ; \u672c\u6587\r\n  %calltmp = call double @putchard(double 4.200000e+01)\r\n  ; \u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\r\n  %nextvar = fadd double %i, 1.000000e+00\r\n\r\n  ; \u30c6\u30b9\u30c8\u306e\u7d42\u4e86\r\n  %cmptmp = fcmp ult double %i, %n\r\n  %booltmp = uitofp i1 %cmptmp to double\r\n  %loopcond = fcmp one double %booltmp, 0.000000e+00\r\n  br i1 %loopcond, label %loop, label %afterloop\r\n\r\nafterloop:      ; preds = %loop\r\n  ; \u30eb\u30fc\u30d7\u306f\u5e38\u306b0\u3092\u8fd4\u3059\u3002\r\n  ret double 0.000000e+00\r\n}<\/pre>\n<p>\u3053\u306efor\u30eb\u30fc\u30d7\u306f\u3001\u6211\u3005\u304c\u3053\u308c\u307e\u3067\u898b\u3066\u304d\u305f\u5168\u3066\u306e\u69cb\u6210\u7269\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3002<br \/>\nphi\u30ce\u30fc\u30c9\u3084\u3001\u3044\u304f\u3064\u304b\u306e\u5f0f\u3001\u305d\u3057\u3066\u57fa\u672c\u7684\u306a\u30d6\u30ed\u30c3\u30af\u3002<br \/>\n\u305d\u308c\u3089\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u898b\u3066\u307f\u3088\u3046\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[466,467],"class_list":["post-2987","post","type-post","status-publish","format-standard","hentry","category-tech","tag-kaleidoscope","tag-llvm"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=2987"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2987\/revisions"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=2987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=2987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=2987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}