<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>编译点滴 &#187; x86</title>
	<atom:link href="http://www.lingcc.com/tag/x86/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lingcc.com</link>
	<description>编译器、虚拟机、程序设计语言、体系结构、软件调试、操作系统等等</description>
	<lastBuildDate>Sat, 04 Feb 2012 06:56:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How start_kernel get start?</title>
		<link>http://www.lingcc.com/2011/11/26/11814/</link>
		<comments>http://www.lingcc.com/2011/11/26/11814/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 07:21:35 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[CPU]]></category>
		<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[X86]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pmon]]></category>
		<category><![CDATA[start_kernel]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11814</guid>
		<description><![CDATA[start_kernel is the first function that kernel runs, like the main function in user space program. In this post, I will try to get a detailed understand of how start_kernel is called on X86_64 and MIPS architecture. Table of Contents 1 Before the kernel image is in the memory 1.1 On X86 1.2 On MIPS <a href='http://www.lingcc.com/2011/11/26/11814/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="zz《人物》:计算机世界第一人 – 艾兰・图灵" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9964%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115589.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">zz《人物》:计算机世界第一人 – 艾兰・图灵</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="职场男装搭配颜色合身要领" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F13%2F9949%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115493.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">职场男装搭配颜色合身要领</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="再见2010，你好2011" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F12%2F31%2F11482%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/29/7109323.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">再见2010，你好2011</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Pathscale 发布 EKOPath 4 编译器套件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/15/12404015.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Pathscale 发布 EKOPath 4 编译器套件</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="《编译点滴》恭祝各位龙年大吉" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F28%2F11967%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/01/28/14432876.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">《编译点滴》恭祝各位龙年大吉</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/12/05/11872/' rel='bookmark' title='Linux 内核中的.S文件'>Linux 内核中的.S文件</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2011/11/28/11851/' rel='bookmark' title='Illegal Instruction 错误初窥'>Illegal Instruction 错误初窥</a></li>
<li><a href='http://www.lingcc.com/2010/10/13/11318/' rel='bookmark' title='Linux内存的属性'>Linux内存的属性</a></li>
<li><a href='http://www.lingcc.com/2010/02/25/10698/' rel='bookmark' title='好大一筐梅普斯(MIPS)'>好大一筐梅普斯(MIPS)</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>start_kernel is the first function that kernel runs, like the main function in user space program.<br />
In this post, I will try to get a detailed understand of how start_kernel is called on X86_64 and MIPS architecture.<span id="more-11814"></span></p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Before the kernel image is in the memory </a>
<ul>
<li><a href="#sec-1.1">1.1 On X86 </a></li>
<li><a href="#sec-1.2">1.2 On MIPS </a></li>
</ul>
</li>
<li><a href="#sec-2">2 Before start_kernel function </a>
<ul>
<li><a href="#sec-2.1">2.1 On X86 </a></li>
<li><a href="#sec-2.2">2.2 On MIPS </a></li>
</ul>
</li>
<li><a href="#sec-3">3 Reference </a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Before the kernel image is in the memory</h2>
<div id="outline-container-1.1" class="outline-3">
<h3 id="sec-1.1"><span class="section-number-3">1.1</span> On X86</h3>
<div id="text-1.1" class="outline-text-3">
<ol>
<li><strong>BIOS&#8217;s job</strong>: start at address 0xFFF0, firstly performs power-on self test(POST) which will check the HW, then hardware-platform specific startup tasks,<br />
and after the HW is recognized and started correctly,<br />
BIOS will the partition boot code from the designated boot device&#8217;s MBR(Master Boot Record).</li>
<li><strong>Boot load&#8217;s job-stage 1</strong>: find and loads the rest of the boot loader (stage 1.5 and stage 2).</li>
<li><strong>Boot load&#8217;s job-stage 2</strong>: display the GRUB startup menu and chooses the operating system.<br />
load compressed kernel file( vmlinux kernel image and initrd image) to memory, pass the selected options to kernel, and invoke the kerne image in real mode</li>
</ol>
<div id="attachment_11819" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/2011/11/26/11814/bootprocess/" rel="attachment wp-att-11819"><img class="size-medium wp-image-11819  " title="boot Process" src="http://www.lingcc.com/wp-content/uploads/2011/11/bootProcess-300x107.png" alt="" width="300" height="107" /></a><p class="wp-caption-text">boot Process on X86</p></div>
</div>
</div>
<div id="outline-container-1.2" class="outline-3">
<h3 id="sec-1.2"><span class="section-number-3">1.2</span> On MIPS</h3>
<div id="text-1.2" class="outline-text-3">
<p>MIPS uses PMON as its BIOS and bootload. so PMON will do both HW check, load kernel.</p>
<ol>
<li>firstly start kernel at 0xbfc0000, and this address will map to address 0 in flash. This address is the first instruction in start.S</li>
<li>start.S does the initialization of cache. then will call the other init function in PMON</li>
<li>then other function in main.c will init the memory, hardwares, and load kernel to memory and pass options.</li>
</ol>
</div>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Before start_kernel function</h2>
<div id="outline-container-2.1" class="outline-3">
<h3 id="sec-2.1"><span class="section-number-3">2.1</span> On X86</h3>
<div id="text-2.1" class="outline-text-3">
<ol>
<li>computer will execute codes in arch/x86/boot/head.S</li>
<li>and then it will jump to the C code in arch/x86/boot/main.c.</li>
<li>after some work, it will call function go_to_protected_mode()</li>
<li>In go_to_protected_mode(), firstly, setup_idt() and setup_gdt() for interrupt table and global description table setup will be called.<br />
and then protected_mode_jump() is called.</li>
<li>Then start_32() is called. It will do some registers initialization, and then call decompress_kernel()</li>
<li>After decompress_kernel(), start_32() will do 32-bit mode initialization, and jump to start_kernel function.<br />
The initialization including :</p>
<ul>
<li>clear the bss segment for the protected mode kernel</li>
<li>sets up the final global description table for memory</li>
<li>build page tables, enable paging</li>
<li>initialize a stack</li>
<li>create the final interrupt descriptor table</li>
</ul>
</li>
</ol>
<div id="attachment_11818" class="wp-caption alignnone" style="width: 686px"><a href="http://www.lingcc.com/2011/11/26/11814/kernelinitpartone/" rel="attachment wp-att-11818"><img class="size-full wp-image-11818" title="kernelInitPartOne" src="http://www.lingcc.com/wp-content/uploads/2011/11/kernelInitPartOne.png" alt="" width="676" height="307" /></a><p class="wp-caption-text">Before start_kernel</p></div>
</div>
</div>
<div id="outline-container-2.2" class="outline-3">
<h3 id="sec-2.2"><span class="section-number-3">2.2</span> On MIPS</h3>
<div id="text-2.2" class="outline-text-3">
<ol>
<li>Computer will execute codes in arch/mips/boot/compressed/head.S first</li>
<li>It will jump to decompress_kernel in arch/mips/boot/compressed/decompress.c</li>
<li>Then kernel_entry function is called. It will init the global time variable jiffies, and some other memory segment initialization.</li>
<li>Then the status register, kernel entry point, current_thread_info pointer is init.<br />
The arg list will also put in register or memory</li>
<li>Then start_kernel function is called.</li>
</ol>
</div>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Reference</h2>
<div id="text-3" class="outline-text-2">
<ul>
<li><a href="http://stackoverflow.com/questions/2589845/what-are-the-first-operations-that-the-linux-kernel-executes-on-boot">http://stackoverflow.com/questions/2589845/what-are-the-first-operations-that-the-linux-kernel-executes-on-boot</a></li>
<li><a href="http://en.wikipedia.org/wiki/Linux_startup_process">http://en.wikipedia.org/wiki/Linux_startup_process</a></li>
<li><a href="http://www.ibm.com/developerworks/library/l-linuxboot/index.html">http://www.ibm.com/developerworks/library/l-linuxboot/index.html</a></li>
<li><a href="http://hi.baidu.com/freedom_asic/blog/item/e3463b399d704df63b87ce68.html">http://hi.baidu.com/freedom_asic/blog/item/e3463b399d704df63b87ce68.html</a></li>
<li><a href="http://duartes.org/gustavo/blog/post/kernel-boot-process">http://duartes.org/gustavo/blog/post/kernel-boot-process</a></li>
<li><a href="http://duartes.org/gustavo/blog/post/how-computers-boot-up">http://duartes.org/gustavo/blog/post/how-computers-boot-up</a></li>
</ul>
</div>
</div>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="职场男装搭配颜色合身要领" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F13%2F9949%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115493.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">职场男装搭配颜色合身要领</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="擦亮眼睛 “百度Hi”用户协议有猫腻" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F06%2F9928%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115378.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">擦亮眼睛 “百度Hi”用户协议有猫腻</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百度Hi策略的猜想" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F10%2F9937%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20239408.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">百度Hi策略的猜想</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="令人振奋的第六感技术" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F11%2F10639%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7114940.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">令人振奋的第六感技术</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="说说静态单赋值（SSA,Static Single-Assignment)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F08%2F13%2F11685%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/13/22609462.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">说说静态单赋值（SSA,Static Single-Assignment)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/12/05/11872/' rel='bookmark' title='Linux 内核中的.S文件'>Linux 内核中的.S文件</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2011/11/28/11851/' rel='bookmark' title='Illegal Instruction 错误初窥'>Illegal Instruction 错误初窥</a></li>
<li><a href='http://www.lingcc.com/2010/10/13/11318/' rel='bookmark' title='Linux内存的属性'>Linux内存的属性</a></li>
<li><a href='http://www.lingcc.com/2010/02/25/10698/' rel='bookmark' title='好大一筐梅普斯(MIPS)'>好大一筐梅普斯(MIPS)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2011/11/26/11814/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pathscale 发布 EKOPath 4 编译器套件</title>
		<link>http://www.lingcc.com/2011/06/15/11658/</link>
		<comments>http://www.lingcc.com/2011/06/15/11658/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 03:30:53 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[IT产业]]></category>
		<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[open64]]></category>
		<category><![CDATA[编程技术]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[high performance]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Open64]]></category>
		<category><![CDATA[pathscale]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11658</guid>
		<description><![CDATA[Pathscale刚刚发布了EKOPath4(http://www.pathscale.com/) EKOPath4的新特性 Significant improvements in performance and robustness(性能健壮性) Support for latest Intel® 64 &#38; AMD64 processors（新处理器支持） Support for SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A &#38; AVX（新SIMD扩展支持) New C++ backend and GNU compatible runtime（新C++、GNU兼容的运行时库支持) Complete implementation of C++ STL locale library（实现C++ STL本地库) Reference counted basic_string using atomic locking Thread-safety, including iostream and locale objects(线程安全提升) Optimized exception <a href='http://www.lingcc.com/2011/06/15/11658/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F20%2F11104%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Pathscale招聘Fortran编译器背景工程师</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F01%2F9913%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">百度Hi正式版发布时间：2008年3月3日?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F10%2F11799%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64编译器 5.0版本发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F24%2F10451%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/11/10/11799/' rel='bookmark' title='Open64编译器 5.0版本发布'>Open64编译器 5.0版本发布</a></li>
<li><a href='http://www.lingcc.com/2010/07/20/11104/' rel='bookmark' title='Pathscale招聘Fortran编译器背景工程师'>Pathscale招聘Fortran编译器背景工程师</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10414/' rel='bookmark' title='最近用hg的一点记录'>最近用hg的一点记录</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Pathscale刚刚发布了EKOPath4(http://www.pathscale.com/) </p>
<h2>EKOPath4的新特性 </h2>
<ul>
<li>Significant improvements in performance and robustness(性能健壮性)</li>
<li>Support for latest Intel® 64 &amp; AMD64 processors（新处理器支持）</li>
<li>Support for SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A &amp; AVX（新SIMD扩展支持)</li>
<li>New C++ backend and GNU compatible runtime（新C++、GNU兼容的运行时库支持)</li>
<li>Complete implementation of C++ STL locale library（实现C++ STL本地库)</li>
<li>Reference counted basic_string using atomic locking</li>
<li>Thread-safety, including iostream and locale objects(线程安全提升)</li>
<li>Optimized exception handling（例外控制优化)</li>
<li>Optimized C and C++ debugging support（C/C++t调试支持优化)</li>
<li>More Fortran 2003 features（Fortran 2003支持)</li>
<li>Significantly improved IPA (inter-procedural analysis)（IPA分析提升)</li>
<li>Runtime improvements（运行时改进)</li>
<li>New PathAS assembler（新的PathAS汇编器）</li>
<li>Major overhaul of PathDB for better multi-core support</li>
<li>Hundreds of bug fixes and much more..</li>
</ul>
<h2>性能对比</h2>
<p> 高性能编译器最重要的是性能，<a href="http://www.phoronix.com/scan.php?page=article&#038;item=pathscale_ekopath4_open&#038;num=1">Phoronix给出了针对某些例子的对比</a>，EKOPath4.0的性能提升。如下，从这几个例子来看，EKOPath4.0的性能比GCC4.5高不少。</p>
<p> <a href="http://www.lingcc.com/2011/06/15/11658/attachment/4/"><img src="http://www.lingcc.com/wp-content/uploads/2011/06/4-300x101.png" title="4" width="300" height="101" /></a></p>
<p> <a href="http://www.lingcc.com/2011/06/15/11658/attachment/3/"><img src="http://www.lingcc.com/wp-content/uploads/2011/06/3-300x101.png" title="3" width="300" height="101" /></a> </p>
<p><a href="http://www.lingcc.com/2011/06/15/11658/attachment/2/"><img src="http://www.lingcc.com/wp-content/uploads/2011/06/2-300x101.png" title="2" width="300" height="101" /></a></p>
<p> <a href="http://www.lingcc.com/2011/06/15/11658/attachment/1/"><img src="http://www.lingcc.com/wp-content/uploads/2011/06/1-300x101.png" title="1" width="300" height="101" /></a> </p>
<p>另外，Proronix也计划自己编译EKOPath编译器，并综合对比LLVM、EKOPath、GCC和Open64。《编译点滴》也会时刻关注，并第一时间刊登相关内容。 </p>
<h2>EKOPath4相关链接 </h2>
<ul>
<li>直接安装二进制版本Pathscale： http://c591116.r16.cf2.rackcdn.com/ekopath/nightly/Linux/ekopath-2011-06-12-installer.run</li>
<li>编译器源码： git clone git://github.com/path64/compiler.git</li>
<li>调试器(PathDB）源码  git clone git://github.com/path64/debugger.git</li>
</ul>
<h2>Pathscale简介</h2>
<p> Pathscale是一家专注高性能编译器解决方案的公司，包括GPU和X86平台的高性能计算，以卖相关服务为主。CTO是Christopher Bergström。Fred Chow是技术方面的领导人。感兴趣的读者可以在#pathscale@freenode IRC上了解更多。 对于中国用户，Pathscale的CTO表示，如果感兴趣的人多，可以单独开#pathscale-cn频道服务,可以先在#pathscale IRC里和他说一声。   虽然EKOPath4自称开源，也的确能从上面的链接中找到编译器，调试器的源代码。但是也有人指出Pathscale一直承诺的开源兑现的力度很不够。下面的这段评论来自<a href="http://www.phoronix.com/scan.php?page=article&#038;item=pathscale_ekopath4_open&#038;num=1">这里</a>， </p>
<blockquote><p><strong>Notes:</strong> Before continuing, yes, the open-sourcing of EKOPath 4 is what in recent days on Phoronix has been <a href="http://www.phoronix.com/scan.php?page=news_item&#038;px=OTU0Ng">codenamed Dirndl</a> as <a href="http://www.phoronix.com/scan.php?page=news_item&#038;px=OTU1MQ">the results have been very impressive</a>. Some Phoronix readers were <a href="http://phoronix.com/forums/showthread.php?55642-On-The-Heels-Of-An-Impressive-Launch&#038;p=213201#post213201">sharp to figure it out</a> within the forums and those <a href="http://twitter.com/MichaelLarabel">following me on Twitter</a>. Originally this open-source announcement was to happen two weeks ago, but since then there have been multiple delays for various reasons. While some Phoronix readers figured out EKOPath 4 was being open-sourced in advance, in some development circles this was already known for a number of days. Three weeks ago, Christopher Bergström (PathScale&#8217;s CTO), wrote to <a href="http://comments.gmane.org/gmane.os.illumos.devel/2498">the Illumos development list</a> and publicly dropped the EKOPath 4.0.10 binary and said &quot;There will be a more broad and related announcement next week, but PathScale promises to continue providing EKOPath 4 as a free download for Solaris and family.&quot; On <a href="http://echelog.matzon.dk/logs/browse/illumos/1305928800">the Illumos IRC</a> that day, the free EKOPath was again brought up. On a related note, back in April news broke that PathScale was working to develop a &quot;CUDA killer&quot; for the GPU. Back then it was <a href="http://phoronix.com/forums/showthread.php?55642-On-The-Heels-Of-An-Impressive-Launch&#038;p=213370#post213370">promised it would be open-source and freely licensed</a>.   </p>
</blockquote>
<h2>Open64和Pathscale的渊源 </h2>
<ul>
<li>2000年SGI将其 利用GPL协议MIPS Pro64编译器开源</li>
<li>2001年University of Delaware 继续维护该编译器，并将其更名为Open64</li>
<li>2001-2004年，计算所与Intel合作为安腾处理器基于Open64开发ORC项目，即Open Research Coompiler。</li>
<li>2003年，Pathscale开始将该编译器移植到X86平台，并着手优化</li>
<li>随后的几年里，Open64和Pathscale的代码相互移植了很多。</li>
<li>最近，Pathscale升级到了GPLv3，而Open64还采用GPLv2,使得两者的代码越走越远</li>
</ul>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F20%2F11104%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Pathscale招聘Fortran编译器背景工程师</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F01%2F9913%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">百度Hi正式版发布时间：2008年3月3日?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F10%2F11799%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64编译器 5.0版本发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F24%2F10451%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F15%2F11658%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/11/10/11799/' rel='bookmark' title='Open64编译器 5.0版本发布'>Open64编译器 5.0版本发布</a></li>
<li><a href='http://www.lingcc.com/2010/07/20/11104/' rel='bookmark' title='Pathscale招聘Fortran编译器背景工程师'>Pathscale招聘Fortran编译器背景工程师</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10414/' rel='bookmark' title='最近用hg的一点记录'>最近用hg的一点记录</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2011/06/15/11658/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Intel 的AVX2指令集解读</title>
		<link>http://www.lingcc.com/2011/06/14/11639/</link>
		<comments>http://www.lingcc.com/2011/06/14/11639/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 01:51:59 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[CPU]]></category>
		<category><![CDATA[X86]]></category>
		<category><![CDATA[后端优化与处理器]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[avx]]></category>
		<category><![CDATA[avx2]]></category>
		<category><![CDATA[SIMD]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11639</guid>
		<description><![CDATA[在Intel Sandy Bridge微架构中，Intel引入了256位SIMD扩展AVX，这套指令集在兼容原MMX、SSE、SSE2对128位整点SIMD支持的基础上，把支持的总向量数据宽度扩展成了256位。新增了若干条256位浮点SIMD指令。 昨天，Intel刚刚发布了AVX2指令集，这套指令集在AVX基础上做了扩展，不过要在2013年发布的Haswell处理器上才能支持。参考1给出了AVX2的详细特性。 AVX2指令集概述 相比AVX，AVX2在如下方面做了扩展。 支持的整点SIMD数据宽度从128位扩展到256位。Sandy Bridge虽然已经将支持的SIMD数据宽度增加到了256位，但仅仅增加了对256位的浮点SIMD支持，整点SIMD数据的宽度还停留在128位上， 增强广播、置换指令支持的数据元素类型、移位操作对各个数据元素可变移位数的支持、跨距访存支持。 跨距访存支持 跨距访存支持即访存时，每个SIMD数据的向量数据元素可以来自不相邻的内存地址。AVX2的跨距访存指令称为”gather”指令，该指令的操作数是一个基地址加一个向量寄存器，向量寄存器中存放着SIMD数据中各个元素相对基地址的偏移量是多少。有了这条指令，CPU可以轻松用一条指令实现若干不连续数据”聚集”到一个SIMD寄存器中。这会对编译器和虚拟机充分利用向量指令带来很大便利，尤其是自动向量化。另外，参考2中对跨距访存指令的功能描述中可以看到，当该指令的偏移地址向量寄存器中任何两个值相同时，都会出GP错。这意味着编译器还是需要些特殊处理才能利用好这条指令。 但跨距访存指令仅仅支持32位整点、64位整点、单精度浮点、双精度浮点的跨距访存操作。从参考4可以猜测其实gather指令只是在硬件上分解成若干条32位或64位的微访存指令实现。这就移位着其实一条32&#215;8的SIMD访存其实就是8次32位普通数据访存，其访存延时和延时不确定性会非常大，聊剩于无。 拓宽原有整点SIMD指令 理论上从128位到256位的成倍SIMD宽度扩展能带来一倍的加速。 位操作指令支持 这些指令在加速数据库压缩、哈希，大数的算术计算方面会有帮助。 任意位置的SIMD数据置换支持 这一支持将使编译器可以更灵活的使用这条指令协助自动向量化。像参考5这类工作就能实施在Intel的芯片中。 向量-向量移位支持 之前Intel上的所有SIMD扩展指令的移位操作仅支持所有SIMD数据同时移位相同的位数，有了向量-向量移位支持，就可以为每个SIMD数据做不同的移位操作。 浮点乘法累积操作 之前的X86处理器上的累积操作多数针对整点数据，这次针对浮点数据增加的60条SIMD操作会给Intel跑浮点Benchmark，比如linpack之类的带来很多加速。 《编译点滴》评论 之前几乎所有在通用微处理器上的SIMD指令，都倾向于一刀切策略，即所有的SIMD操作都针对SIMD数据实施完全相同的操作，并不存在特性化的指令。比如访存都是从一块连续的地址空间直接访存、移位时所有的数据都移动相同的位数，数据置换指令的支持也是最近才出现在通用CPU中的。AVX2的这些支持再次肯定了个性化的趋势，CPU中的SIMD支持朝着GPU的方向大踏步前进，并最终赶上并超越向量机。不得不称赞一下IBM的超前思想。AVX2中的这些特性支持在几年前的Power处理器中就已经出现了。 虽然AVX号称可以扩展到512位甚至1024位的SIMD支持，但是所带来的问题怎么解决，期待AVX3或者AMD的小宇宙爆发，或者威盛的黑马： 理论上，增加1倍的向量数据宽度，将带来2倍的晶体管数量提升。目前，Intel的AVX指令集只实现在片上每个core里，作为core中的一个功能部件，若扩展到1024位，将增加4倍的晶体管。虽然制造工艺也会改进，但功耗还是会很大，怎么解决？ 在自动向量化仍然不好用的前提下，普通程序很难利用到这些功能做加速，白白的浪费这些晶体管吗？ 这么大的数据计算能力，访存怎么供数？对齐貌似还是没有好的方法。还是要程序员自己吭哧吭哧写向量化代码，调试吗？芯片厂商可以每几年升级一次宽度，但兼容性如何保证，原来有64位、128位、256位分别对应MMX、XMM、YMM寄存器，以后呢？ 参考 http://software.intel.com/en-us/blogs/2011/06/13/haswell-new-instruction-descriptions-now-available/ http://software.intel.com/file/36945 http://en.wikipedia.org/wiki/Haswell_%28microarchitecture%29 http://software.intel.com/en-us/forums/showthread.php?t=83459&#38;o=a&#38;s=lr http://portal.acm.org/citation.cfm?id=1133996 相关文章： Intel Sandy Bridge怎么给力 通用微处理中的SIMD指令扩展 SIMD硬件的发展 前瞻-主流处理器中的数据并行支持(SIMD) 期待未来-一张趣图 好消息：GodSon-T第一款芯片已经流片归来，正在测试<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F01%2F11600%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">通用微处理中的SIMD指令扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F02%2F11605%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SIMD硬件的发展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F09%2F14%2F11718%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Some notes about IBM  XL C Compiler</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9889%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zz 龙芯之火，可以燎原（上）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F03%2F11619%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">自动向量化</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/01/25/11531/' rel='bookmark' title='Intel Sandy Bridge怎么给力'>Intel Sandy Bridge怎么给力</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2011/06/02/11605/' rel='bookmark' title='SIMD硬件的发展'>SIMD硬件的发展</a></li>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2010/05/07/10916/' rel='bookmark' title='期待未来-一张趣图'>期待未来-一张趣图</a></li>
<li><a href='http://www.lingcc.com/2010/10/21/11371/' rel='bookmark' title='好消息：GodSon-T第一款芯片已经流片归来，正在测试'>好消息：GodSon-T第一款芯片已经流片归来，正在测试</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Bitstream Vera Sans;">在</span>Intel Sandy Bridge<span style="font-family: Bitstream Vera Sans;">微架构中，</span>Intel<span style="font-family: Bitstream Vera Sans;">引入了</span>256<span style="font-family: Bitstream Vera Sans;">位</span>SIMD<span style="font-family: Bitstream Vera Sans;">扩展</span>AVX<span style="font-family: Bitstream Vera Sans;">，这套指令集在兼容原</span>MMX<span style="font-family: Bitstream Vera Sans;">、</span>SSE<span style="font-family: Bitstream Vera Sans;">、</span>SSE2<span style="font-family: Bitstream Vera Sans;">对</span>128<span style="font-family: Bitstream Vera Sans;">位整点</span>SIMD<span style="font-family: Bitstream Vera Sans;">支持的基础上，把支持的总向量数据宽度扩展成了</span>256<span style="font-family: Bitstream Vera Sans;">位。新增了若干条</span>256<span style="font-family: Bitstream Vera Sans;">位浮点</span>SIMD<span style="font-family: Bitstream Vera Sans;">指令。</span></p>
<p><span style="font-family: Bitstream Vera Sans;">昨天，</span>Intel<span style="font-family: Bitstream Vera Sans;">刚刚发布了</span>AVX2<span style="font-family: Bitstream Vera Sans;">指令集，这套指令集在</span>AVX<span style="font-family: Bitstream Vera Sans;">基础上做了扩展，不过要在</span>2013<span style="font-family: Bitstream Vera Sans;">年发布的</span>Haswell<span style="font-family: Bitstream Vera Sans;">处理器上才能支持。参考</span>1<span style="font-family: Bitstream Vera Sans;">给出了</span>AVX2<span style="font-family: Bitstream Vera Sans;">的详细特性。</span></p>
<p><span style="font-family: Bitstream Vera Sans;"><span id="more-11639"></span><br />
</span></p>
<h2>AVX2<span style="font-family: 宋体;">指令集概述</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">相比</span>AVX<span style="font-family: Bitstream Vera Sans;">，</span>AVX2<span style="font-family: Bitstream Vera Sans;">在如下方面做了扩展。</span></p>
<ul>
<li><span style="font-family: Bitstream Vera Sans;">支持的整点</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据宽度从</span>128<span style="font-family: Bitstream Vera Sans;">位扩展到</span>256<span style="font-family: Bitstream Vera Sans;">位。</span>Sandy 	Bridge<span style="font-family: Bitstream Vera Sans;">虽然已经将支持的</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据宽度增加到了</span>256<span style="font-family: Bitstream Vera Sans;">位，但仅仅增加了对</span>256<span style="font-family: Bitstream Vera Sans;">位的浮点</span>SIMD<span style="font-family: Bitstream Vera Sans;">支持，整点</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据的宽度还停留在</span>128<span style="font-family: Bitstream Vera Sans;">位上，</span></li>
<li><span style="font-family: Bitstream Vera Sans;">增强广播、置换指令支持的数据元素类型、移位操作对各个数据元素可变移位数的支持、跨距访存支持。</span></li>
</ul>
<h2><span style="font-family: 宋体;">跨距访存支持</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">跨距访存支持即访存时，每个</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据的向量数据元素可以来自不相邻的内存地址。</span>AVX2<span style="font-family: Bitstream Vera Sans;">的跨距访存指令称为”</span>gather”<span style="font-family: Bitstream Vera Sans;">指令，该指令的操作数是一个基地址加一个向量寄存器，向量寄存器中存放着</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据中各个元素相对基地址的偏移量是多少。有了这条指令，</span>CPU<span style="font-family: Bitstream Vera Sans;">可以轻松用一条指令实现若干不连续数据”聚集”到一个</span>SIMD<span style="font-family: Bitstream Vera Sans;">寄存器中。这会对编译器和虚拟机充分利用向量指令带来很大便利，尤其是自动向量化。另外，参考</span>2<span style="font-family: Bitstream Vera Sans;">中对跨距访存指令的功能描述中可以看到，当该指令的偏移地址向量寄存器中任何两个值相同时，都会出</span>GP<span style="font-family: Bitstream Vera Sans;">错。这意味着编译器还是需要些特殊处理才能利用好这条指令。</span></p>
<div id="attachment_11640" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-11640" href="http://www.lingcc.com/2011/06/14/11639/img3/"><img class="size-medium wp-image-11640" title="img3" src="http://www.lingcc.com/wp-content/uploads/2011/06/img3-300x183.png" alt="跨距访存指令" width="300" height="183" /></a><p class="wp-caption-text">跨距访存指令</p></div>
<p><span style="font-family: Bitstream Vera Sans;">但跨距访存指令仅仅支持</span>32<span style="font-family: Bitstream Vera Sans;">位整点、</span>64<span style="font-family: Bitstream Vera Sans;">位整点、单精度浮点、双精度浮点的跨距访存操作。从参考</span>4<span style="font-family: Bitstream Vera Sans;">可以猜测其实</span>gather<span style="font-family: Bitstream Vera Sans;">指令只是在硬件上分解成若干条</span>32<span style="font-family: Bitstream Vera Sans;">位或</span>64<span style="font-family: Bitstream Vera Sans;">位的微访存指令实现。这就移位着其实一条</span>32&#215;8<span style="font-family: Bitstream Vera Sans;">的</span>SIMD<span style="font-family: Bitstream Vera Sans;">访存其实就是</span>8<span style="font-family: Bitstream Vera Sans;">次</span>32<span style="font-family: Bitstream Vera Sans;">位普通数据访存，其访存延时和延时不确定性会非常大，聊剩于无。</span></p>
<h2><span style="font-family: 宋体;">拓宽原有整点</span>SIMD<span style="font-family: 宋体;">指令</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">理论上从</span>128<span style="font-family: Bitstream Vera Sans;">位到</span>256<span style="font-family: Bitstream Vera Sans;">位的成倍</span>SIMD<span style="font-family: Bitstream Vera Sans;">宽度扩展能带来一倍的加速。</span></p>
<p><span style="font-family: Bitstream Vera Sans;"> </span></p>
<div id="attachment_11641" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-11641" href="http://www.lingcc.com/2011/06/14/11639/img1/"><img class="size-medium wp-image-11641" title="img1" src="http://www.lingcc.com/wp-content/uploads/2011/06/img1-300x181.png" alt="" width="300" height="181" /></a><p class="wp-caption-text">从128位扩展到256位的整点SIMD指令</p></div>
<h2><span style="font-family: 宋体;">位操作指令支持</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">这些指令在加速数据库压缩、哈希，大数的算术计算方面会有帮助。</span></p>
<p><span style="font-family: Bitstream Vera Sans;"> </span></p>
<div id="attachment_11642" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-11642" href="http://www.lingcc.com/2011/06/14/11639/img2/"><img class="size-medium wp-image-11642" title="img2" src="http://www.lingcc.com/wp-content/uploads/2011/06/img2-300x166.png" alt="" width="300" height="166" /></a><p class="wp-caption-text">新增的位访存操作指令</p></div>
<h2><span style="font-family: 宋体;">任意位置的</span>SIMD<span style="font-family: 宋体;">数据置换支持</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">这一支持将使编译器可以更灵活的使用这条指令协助自动向量化。像参考</span>5<span style="font-family: Bitstream Vera Sans;">这类工作就能实施在</span>Intel<span style="font-family: Bitstream Vera Sans;">的芯片中。</span></p>
<p><span style="font-family: Bitstream Vera Sans;"> </span></p>
<div id="attachment_11643" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-11643" href="http://www.lingcc.com/2011/06/14/11639/img4/"><img class="size-medium wp-image-11643" title="img4" src="http://www.lingcc.com/wp-content/uploads/2011/06/img4-300x134.png" alt="" width="300" height="134" /></a><p class="wp-caption-text">任意位置数据置换指令支持</p></div>
<h2><span style="font-family: 宋体;">向量</span>-<span style="font-family: 宋体;">向量移位支持</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">之前</span>Intel<span style="font-family: Bitstream Vera Sans;">上的所有</span>SIMD<span style="font-family: Bitstream Vera Sans;">扩展指令的移位操作仅支持所有</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据同时移位相同的位数，有了向量</span>-<span style="font-family: Bitstream Vera Sans;">向量移位支持，就可以为每个</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据做不同的移位操作。</span></p>
<p><span style="font-family: Bitstream Vera Sans;"> </span></p>
<div id="attachment_11644" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-11644" href="http://www.lingcc.com/2011/06/14/11639/img5/"><img class="size-medium wp-image-11644" title="img5" src="http://www.lingcc.com/wp-content/uploads/2011/06/img5-300x151.png" alt="" width="300" height="151" /></a><p class="wp-caption-text">向量-向量移位操作支持</p></div>
<h2><span style="font-family: 宋体;">浮点乘法累积操作</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">之前的</span>X86<span style="font-family: Bitstream Vera Sans;">处理器上的累积操作多数针对整点数据，这次针对浮点数据增加的</span>60<span style="font-family: Bitstream Vera Sans;">条</span>SIMD<span style="font-family: Bitstream Vera Sans;">操作会给</span>Intel<span style="font-family: Bitstream Vera Sans;">跑浮点</span>Benchmark<span style="font-family: Bitstream Vera Sans;">，比如</span>linpack<span style="font-family: Bitstream Vera Sans;">之类的带来很多加速。</span></p>
<h2><span style="font-family: 宋体;">《<a href="http://www.lingcc.com">编译点滴</a>》评论</span></h2>
<p><span style="font-family: Bitstream Vera Sans;">之前几乎所有在通用微处理器上的</span>SIMD<span style="font-family: Bitstream Vera Sans;">指令，都倾向于一刀切策略，即所有的</span>SIMD<span style="font-family: Bitstream Vera Sans;">操作都针对</span>SIMD<span style="font-family: Bitstream Vera Sans;">数据实施完全相同的操作，并不存在特性化的指令。比如访存都是从一块连续的地址空间直接访存、移位时所有的数据都移动相同的位数，数据置换指令的支持也是最近才出现在通用</span>CPU<span style="font-family: Bitstream Vera Sans;">中的。</span>AVX2<span style="font-family: Bitstream Vera Sans;">的这些支持再次肯定了个性化的趋势，</span>CPU<span style="font-family: Bitstream Vera Sans;">中的</span>SIMD<span style="font-family: Bitstream Vera Sans;">支持朝着</span>GPU<span style="font-family: Bitstream Vera Sans;">的方向大踏步前进，并最终赶上并超越向量机。不得不称赞一下</span>IBM<span style="font-family: Bitstream Vera Sans;">的超前思想。</span>AVX2<span style="font-family: Bitstream Vera Sans;">中的这些特性支持在几年前的</span>Power<span style="font-family: Bitstream Vera Sans;">处理器中就已经出现了。</span></p>
<p><span style="font-family: Bitstream Vera Sans;">虽然AVX号称可以扩展到512位甚至1024位的SIMD支持，但是所带来的问题怎么解决，期待AVX3或者AMD的小宇宙爆发，或者威盛的黑马：</span></p>
<ol>
<li><span style="font-family: Bitstream Vera Sans;">理论上，增加1倍的向量数据宽度，将带来2倍的晶体管数量提升。目前，Intel的AVX指令集只实现在片上每个core里，作为core中的一个功能部件，若扩展到1024位，将增加4倍的晶体管。虽然制造工艺也会改进，但功耗还是会很大，怎么解决？</span></li>
<li><span style="font-family: Bitstream Vera Sans;">在自动向量化仍然不好用的前提下，普通程序很难利用到这些功能做加速，白白的浪费这些晶体管吗？</span></li>
<li><span style="font-family: Bitstream Vera Sans;">这么大的数据计算能力，访存怎么供数？对齐貌似还是没有好的方法。还是要程序员自己吭哧吭哧写向量化代码，调试吗？芯片厂商可以每几年升级一次宽度，但兼容性如何保证，原来有64位、128位、256位分别对应MMX、XMM、YMM寄存器，以后呢？<br />
</span></li>
</ol>
<h2><span style="font-family: 宋体;">参考</span></h2>
<ol>
<li><a href="http://software.intel.com/en-us/blogs/2011/06/13/haswell-new-instruction-descriptions-now-available/">http://software.intel.com/en-us/blogs/2011/06/13/haswell-new-instruction-descriptions-now-available/</a></li>
<li><a href="http://software.intel.com/file/36945">http://software.intel.com/file/36945</a></li>
<li><a href="http://en.wikipedia.org/wiki/Haswell_%28microarchitecture%29">http://en.wikipedia.org/wiki/Haswell_%28microarchitecture%29</a></li>
<li><a href="http://software.intel.com/en-us/forums/showthread.php?t=83459&amp;o=a&amp;s=lr">http://software.intel.com/en-us/forums/showthread.php?t=83459&amp;o=a&amp;s=lr</a></li>
<li><a href="http://portal.acm.org/citation.cfm?id=1133996">http://portal.acm.org/citation.cfm?id=1133996</a></li>
</ol>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F01%2F11600%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">通用微处理中的SIMD指令扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F02%2F11605%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SIMD硬件的发展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F09%2F14%2F11718%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Some notes about IBM  XL C Compiler</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9889%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zz 龙芯之火，可以燎原（上）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F03%2F11619%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">自动向量化</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/01/25/11531/' rel='bookmark' title='Intel Sandy Bridge怎么给力'>Intel Sandy Bridge怎么给力</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2011/06/02/11605/' rel='bookmark' title='SIMD硬件的发展'>SIMD硬件的发展</a></li>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2010/05/07/10916/' rel='bookmark' title='期待未来-一张趣图'>期待未来-一张趣图</a></li>
<li><a href='http://www.lingcc.com/2010/10/21/11371/' rel='bookmark' title='好消息：GodSon-T第一款芯片已经流片归来，正在测试'>好消息：GodSon-T第一款芯片已经流片归来，正在测试</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2011/06/14/11639/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>期待未来-一张趣图</title>
		<link>http://www.lingcc.com/2010/05/07/10916/</link>
		<comments>http://www.lingcc.com/2010/05/07/10916/#comments</comments>
		<pubDate>Fri, 07 May 2010 06:42:09 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[云计算]]></category>
		<category><![CDATA[多核]]></category>
		<category><![CDATA[并行]]></category>
		<category><![CDATA[系统健壮性]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[计算技术未来]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10916</guid>
		<description><![CDATA[先看图 图片来自《科学松鼠会》，很棒的探索新知的网站：） 生物信息学里把DNA序列看成生物体的操作系统，这张图左侧是大肠杆菌的控制网络，右侧是Linux系统的。 生物体系统本身是非常健壮的，这张图显示，在底层，大肠杆菌有很多层次的供调用资源，因此自恢复能力很强，而我们的计算机系统庞大的上层软件都依赖一个小小的CPU和之上的操作系统内核。 于是，操作系统，编译器中，稍微一个小bug都会导致上层出错，进而整个系统不再可靠。当我们还在抱怨CISC指令系统多么多么复杂，X86指令集和体系结构多么多么混乱，RISC多么多么简洁的时候，有没有想过，简单的系统设计往往意味着健壮性的缺失。我个人非常喜欢简单高效的实现，但我们必须接受一个健壮的系统需要臃肿和冗余的现实。 我们的多核CPU就是实现冗余的契机。又多了一个程序员必须学习并行编程的有利论据！当然也别想着我们的计算机系统能简单的让所有的核都能时刻在我们需要他的时候，对我们的请求快速反应。不需要它时，自觉的自我运行，优化我们计算机中的程序。难！ 又或许，所谓的云集算才是真正的冗余保证，云计算系统内部的健壮性又如何保证呢？大量的测试？抑或是继续冗余的CPU和虚拟化技术，最后这些都要回归到那些010101010的bit流，哪里才是回归简洁的地方，就像DNA中的四个碱基一样。 未来太令人期待了！ 我们必须要系统健壮起来，只有这样，才能让它更有效率更健壮的运转下去。可靠性设计将会越来越重要。多核，众核，云计算来吧！ PS：现在的多核的核数还远远不够，而且现在的半导体制造技术也很落后。其实8核的CPU在出厂时，至少是有9个以上的核的，因为有成品率问题，到了用户手里时，已经经过检测，只打开了8个核而已。以后咱不超频了，超核！ 相关文章： 探秘CPU性能测试：Spec CPU2000之整点篇 《多核编译技术研讨会》记二 认识静态链接库 前瞻-LLVM大事记(2004-2010) 前瞻-主流处理器中的数据并行支持(SIMD) GCC初窥<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F04%2F12%2F9985%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">并行计算前景-摘要</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F04%2F19%2F9986%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">并行计算前景-引言</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F06%2F01%2F9989%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">并行计算前景-研究动机</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F13%2F10970%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于并行貌似正确的废话-程序语言发展的启示</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F10%2F10625%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">小议并行计算</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/12/05/10234/' rel='bookmark' title='《多核编译技术研讨会》记二'>《多核编译技术研讨会》记二</a></li>
<li><a href='http://www.lingcc.com/2010/05/25/10951/' rel='bookmark' title='认识静态链接库'>认识静态链接库</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>先看图</p>
<div id="attachment_11764" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/2010/05/07/10916/colibacillus-vs-linux/" rel="attachment wp-att-11764"><img class="size-medium wp-image-11764" title="大肠杆菌和Linux系统的控制网络对比" src="http://www.lingcc.com/wp-content/uploads/2010/05/colibacillus-vs-linux-300x191.jpg" alt="大肠杆菌和Linux系统的控制网络对比" width="300" height="191" /></a><p class="wp-caption-text">大肠杆菌和Linux系统的控制网络对比</p></div>
<p>图片来自<a href="http://songshuhui.net/archives/37513.html" target="_blank">《科学松鼠会》</a>，很棒的探索新知的网站：）</p>
<p>生物信息学里把DNA序列看成生物体的操作系统，这张图左侧是大肠杆菌的控制网络，右侧是Linux系统的。<span id="more-10916"></span></p>
<p>生物体系统本身是非常健壮的，这张图显示，在底层，大肠杆菌有很多层次的供调用资源，因此自恢复能力很强，而我们的计算机系统庞大的上层软件都依赖一个小小的CPU和之上的操作系统内核。</p>
<p>于是，操作系统，编译器中，稍微一个小bug都会导致上层出错，进而整个系统不再可靠。当我们还在抱怨CISC指令系统多么多么复杂，X86指令集和体系结构多么多么混乱，RISC多么多么简洁的时候，有没有想过，简单的系统设计往往意味着健壮性的缺失。我个人非常喜欢简单高效的实现，但我们必须接受一个健壮的系统需要臃肿和冗余的现实。</p>
<p>我们的多核CPU就是实现冗余的契机。又多了一个程序员必须学习并行编程的有利论据！当然也别想着我们的计算机系统能简单的让所有的核都能时刻在我们需要他的时候，对我们的请求快速反应。不需要它时，自觉的自我运行，优化我们计算机中的程序。难！</p>
<p>又或许，所谓的云集算才是真正的冗余保证，云计算系统内部的健壮性又如何保证呢？大量的测试？抑或是继续冗余的CPU和虚拟化技术，最后这些都要回归到那些010101010的bit流，哪里才是回归简洁的地方，就像DNA中的四个碱基一样。 未来太令人期待了！</p>
<p>我们必须要系统健壮起来，只有这样，才能让它更有效率更健壮的运转下去。可靠性设计将会越来越重要。多核，众核，云计算来吧！</p>
<p>PS：现在的多核的核数还远远不够，而且现在的半导体制造技术也很落后。其实8核的CPU在出厂时，至少是有9个以上的核的，因为有成品率问题，到了用户手里时，已经经过检测，只打开了8个核而已。以后咱不超频了，超核！</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F04%2F12%2F9985%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">并行计算前景-摘要</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F04%2F19%2F9986%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">并行计算前景-引言</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F06%2F01%2F9989%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">并行计算前景-研究动机</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F13%2F10970%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于并行貌似正确的废话-程序语言发展的启示</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F10%2F10625%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F07%2F10916%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">小议并行计算</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/12/05/10234/' rel='bookmark' title='《多核编译技术研讨会》记二'>《多核编译技术研讨会》记二</a></li>
<li><a href='http://www.lingcc.com/2010/05/25/10951/' rel='bookmark' title='认识静态链接库'>认识静态链接库</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/05/07/10916/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>前瞻-LLVM大事记(2004-2010)</title>
		<link>http://www.lingcc.com/2010/04/30/10822/</link>
		<comments>http://www.lingcc.com/2010/04/30/10822/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 12:04:03 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Chris Lattener]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[Open64]]></category>
		<category><![CDATA[openmp]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[SPEC2000]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[全时优化]]></category>
		<category><![CDATA[后端]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[整点]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器开发]]></category>
		<category><![CDATA[编译器性能]]></category>
		<category><![CDATA[编译器架构]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[过程间分析和优化 Inter procedural Analysis]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10822</guid>
		<description><![CDATA[因为之前的两篇博文前瞻-全时优化和LLVM-1和前瞻-全时优化和LLVM-2都是基于Chris Lattner 2004年发表在CGO的文章写的。所以需要介绍一下LLVM从2004到2010这六年的变化，LLVM的开发社区很活跃。 从2004年三月到2010年4月，LLVM共发布了1.2-1.9，2.0-2.7，16个版本，至少每年发布两个版本。详细的历史发布版本和release都能从这里找到。 1.2增加了调试信息支持， 1.3增加精确垃圾收集功能， 1.4增加PowerPC JIT支持，增加通用的编译驱动器和连接器； 1.5增加针对Alpha,IA-64和SPARC-V8的代码生成器，新的指令选择机制； 1.6指令选择能从机器模型中生成，指令调度支持，支持子目标机代码生成器； 1.7向量支持，新的GCC4.0 C/C++前端，Objective C/C++支持，汇编内联支持； 1.8DWARF调试支持,循环优化改进； 1.9新的X86-64后端，连接时优化能和本机连接器交互； 2.0中间表示更新(整型完全无符号化，任意长度位的整型支持),代码生成器更新(软浮点支持),X86,ARM,PowerPC代码生成改进； 2.1.gcc-4.2前端，Fortran，Ada和OpenMP支持，MIPS后端支持； 2.2 Clang启动，CellSPU后端支持，精确垃圾收集代码重构； 2.3, 不再支持gcc4.0前端，vmkit启动(用LLVM实现JVM和CLI)，多返回值支持，llvmc重构，连接时优化起结构重写 2.4，增加优化，并缩短O0编译时间，PIC16微处理器支持 2.5，启动Pure,LLVM D Compiler,Roadsend PHP;XCore后端支持 2.6，启动compiler-rt,KLEE,machine code toolkit,开优化时调试信息行号支持，新MSP430，SystemZ和Blackin后端支持，Gold连接器插件支持 2.7，启动LLVM新logo，MicroBlaze后端支持。 以上就是从04年到10年LLVM每次发行新版本中给出的最要新特性.可以看出，几乎和普通的编译器没有什么两样。所做的无非在增加新前端，编译更多的语言，支持新后端，可以在更多的处理器上运行。增加中间优化，调bug。 LLVM近几年的发展路线已经越来越像一个标准的，前端+后端+优化的编译器。运行时的优化也大部分集中在JIT上，反馈制导优化也没有涉及。 Chris Lattener最近几年发表的文章： “Making Context-sensitive Points-to Analysis with Heap Cloning Practical For The Real World” PLDI 2007, San Diego, CA, June 2007。 “Macroscopic Data <a href='http://www.lingcc.com/2010/04/30/10822/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>因为之前的两篇博文<a title="Permanent Link: 前瞻-全时优化和LLVM-1" rel="bookmark" href="http://www.lingcc.com/2010/04/07/10721/">前瞻-全时优化和LLVM-1<abbr title="YARPP  中的 5.867000 是指当前文章和关联文章之间的匹配程度。当您以管理员的身份登录时才能查阅，游客等其他权限是不能查阅的。"></abbr></a>和<a href="http://www.lingcc.com/2010/04/29/10728/" target="_blank">前瞻-全时优化和LLVM-2</a>都是基于Chris Lattner 2004年发表在CGO的文章写的。所以需要介绍一下LLVM从2004到2010这六年的变化，LLVM的开发社区很活跃。</p>
<p>从2004年三月到2010年4月，LLVM共发布了1.2-1.9，2.0-2.7，16个版本，至少每年发布两个版本。详细的历史发布版本和release都能从<a href="http://llvm.org/releases/" target="_blank">这里</a>找到。</p>
<p><span id="more-10822"></span></p>
<ul>
<li>1.2增加了调试信息支持，</li>
<li>1.3增加精确垃圾收集功能，</li>
<li>1.4增加PowerPC JIT支持，增加通用的编译驱动器和连接器；</li>
<li>1.5增加针对Alpha,IA-64和SPARC-V8的代码生成器，新的指令选择机制；</li>
<li>1.6指令选择能从机器模型中生成，指令调度支持，支持子目标机代码生成器；</li>
<li>1.7向量支持，新的GCC4.0 C/C++前端，Objective C/C++支持，汇编内联支持；</li>
<li>1.8DWARF调试支持,循环优化改进；</li>
<li>1.9新的X86-64后端，连接时优化能和本机连接器交互；</li>
<li>2.0中间表示更新(整型完全无符号化，任意长度位的整型支持),代码生成器更新(软浮点支持),X86,ARM,PowerPC代码生成改进；</li>
<li>2.1.gcc-4.2前端，Fortran，Ada和OpenMP支持，MIPS后端支持；</li>
<li>2.2 Clang启动，CellSPU后端支持，精确垃圾收集代码重构；</li>
<li>2.3, 不再支持gcc4.0前端，vmkit启动(用LLVM实现JVM和CLI)，多返回值支持，llvmc重构，连接时优化起结构重写</li>
<li>2.4，增加优化，并缩短O0编译时间，PIC16微处理器支持</li>
<li>2.5，启动Pure,LLVM D Compiler,Roadsend PHP;XCore后端支持</li>
<li>2.6，启动compiler-rt,KLEE,machine code toolkit,开优化时调试信息行号支持，新MSP430，SystemZ和Blackin后端支持，Gold连接器插件支持</li>
<li>2.7，启动LLVM新logo，MicroBlaze后端支持。</li>
</ul>
<p>以上就是从04年到10年LLVM每次发行新版本中给出的最要新特性.可以看出，几乎和普通的编译器没有什么两样。所做的无非在增加新前端，编译更多的语言，支持新后端，可以在更多的处理器上运行。增加中间优化，调bug。</p>
<p>LLVM近几年的发展路线已经越来越像一个标准的，前端+后端+优化的编译器。运行时的优化也大部分集中在JIT上，反馈制导优化也没有涉及。</p>
<p>Chris Lattener最近几年发表的文章：</p>
<ol>
<li>“<strong><a href="http://llvm.org/pubs/2007-06-10-PLDI-DSA.html">Making  Context-sensitive  Points-to Analysis with Heap Cloning Practical For The Real World</a></strong>”<br />
<a href="http://ties.ucsd.edu/PLDI/">PLDI 2007</a>, San Diego, CA, June  2007。</li>
<li>“<a href="http://llvm.org/pubs/2005-05-04-LattnerPHDThesis.html"><strong>Macroscopic  Data Structure Analysis and Optimization</strong></a>”<br />
<em>Ph.D. Thesis</em>, <a href="http://www.cs.uiuc.edu/">Computer Science  Dept.</a>, University of Illinois at Urbana-Champaign, May 2005.</li>
<li>“<a href="http://llvm.org/pubs/2005-05-21-PLDI-PoolAlloc.html"><strong>Automatic  Pool  Allocation: Improving Performance by Controlling Data  Structure Layout in the Heap</strong></a>”<br />
<a href="http://research.ihost.com/pldi2005/">PLDI 2005</a>, Chicago, IL, June 2005.<br />
<strong>PLDI&#8217;05 Best paper award.</strong></li>
<li>“<a href="http://llvm.org/pubs/2005-06-12-MSP-PointerComp.html"><strong>Transparent   Pointer Compression for Linked Data Structures</strong></a>”<br />
MSP  2005,  Chicago, IL, June 2005.</li>
</ol>
<p>基本也没有太多触及LLVM整体架构的。</p>
<p>另外，Chris Lattener在近几年的几个邀请报告上也简明扼要的讲解了LLVM的架构。</p>
<ol>
<li>“<a href="http://llvm.org/devmtg/2009-10/">State of Clang</a>”  (shared     talk) and several other pieces of the meeting, such as the  introduction,      open discussion forum, etc.<br />
<em>LLVM Developer Meeting</em>, Cupertino, CA, Oct 2009.</li>
<li>“<a href="http://llvm.org/pubs/2008-10-04-ACAT-LLVM-Intro.html">Introduction  	to the LLVM Compiler System</a>”<br />
Plenary Talk, <em><a href="http://acat2008.cern.ch/">ACAT 2008</a>:  Advanced 	Computing and Analysis Techniques in Physics Research</em>, Erice, Sicily, Italy, November 2008.</li>
<li>“<a href="http://llvm.org/pubs/2008-05-17-BSDCan-LLVMIntro.html">LLVM  and 	Clang: Next Generation Compiler Technology</a>”<br />
<em><a href="http://www.bsdcan.org/2008/">BSDCan 2008</a></em>, Ottawa,  Canada, May 16-17, 2008.</li>
<li>“<a href="http://conferences.oreillynet.com/cs/os2007/view/e_sess/12824">The 		LLVM Compiler System</a>”<br />
<em>2007 O&#8217;Reilly Open Source Convention</em>, Portland, OR, July 2007.</li>
<li>“<a href="http://llvm.org/pubs/2007-07-25-LLVM-2.0-and-Beyond.html">LLVM  	2.0 and Beyond!</a>”<br />
<em>Google Tech Talk</em>, Mountain View, CA, July 25, 2007.</li>
<li>“<a href="http://llvm.org/devmtg/2007-05/">LLVM in OpenGL and for  Dynamic  	Languages</a>” (and several others)<br />
<em>LLVM Developer Meeting</em>, Cupertino, CA, May 2007.</li>
<li>“<a href="http://llvm.org/pubs/2007-03-12-BossaLLVMIntro.html">The  LLVM 	Compiler System</a>”<br />
<em>2007 Bossa Conference on Open Source, Mobile Internet and Multimedia</em>, 	Recife, Brazil, March 2007.</li>
<li>“<a href="http://llvm.org/pubs/2006-04-25-GelatoLLVMIntro.html">Introduction  	to the LLVM Compiler Infrastructure</a>”<br />
<em>2006 Itanium Conference and Expo</em>, San Jose, California, April  2006.</li>
</ol>
<p>对比一下Chris最近几年在不同的文献中，对LLVM的架构描述也是很有意思的。</p>
<div id="attachment_10826" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-02.jpg"><img class="size-medium wp-image-10826" title="LLVM from Chris M.S. Thesis  2002" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-02-300x66.jpg" alt="" width="300" height="66" /></a><p class="wp-caption-text">llvm-02 from Chris M.S. Thesis  2002</p></div>
<div id="attachment_10731" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch1.jpg"><img class="size-medium wp-image-10731" title="llvm-arch" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch1-300x65.jpg" alt="" width="300" height="65" /></a><p class="wp-caption-text">LLVM CGO2004</p></div>
<div id="attachment_10828" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-1.jpg"><img class="size-medium wp-image-10828" title="llvm-06-1" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-1-300x118.jpg" alt="" width="300" height="118" /></a><p class="wp-caption-text">LLVM 06 Link-Time Optimization</p></div>
<div id="attachment_10829" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-2.jpg"><img class="size-medium wp-image-10829" title="llvm-06-2" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-2-300x123.jpg" alt="" width="300" height="123" /></a><p class="wp-caption-text">LLVM 06 Code Generator</p></div>
<div id="attachment_10830" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-08.jpg"><img class="size-medium wp-image-10830" title="llvm-08" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-08-300x118.jpg" alt="" width="300" height="118" /></a><p class="wp-caption-text">LLVM 08</p></div>
<p>LLVM始终坚持的是LLVM代码在代码生成器，解释执行之间的透明性。重点突破的一直是过程间优化。但架构却基本上摒弃了全时优化，开始走经典的静态分析路线。和GCC、Open64相比，在目的上也没有差别了。<br />
LLVM的性能方面，相比于GCC还逊色不少，和Open64就更没法比了.很遗憾，我没有找到将这三个编译器作性能对比的文章.已有的Open64的数据都是非常老的，没什么可比性。而且编译优化这个东西，差距很大。关键是看有没有人做，投入多大经历做，太老的数据没有什么对比意义。</p>
<p>但LLVM和GCC最新版的对比有， LLVM2.7和GCC 4.5的性能对比(图来自<a href="http://vmakarov.fedorapeople.org/spec/" target="_blank">http://vmakarov.fedorapeople.org/spec/</a>）：</p>
<ul>
<li>SPEC 2000 整点(-O2)</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLI2Score32.png"><img class="alignnone size-medium wp-image-10859" title="GLI2Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLI2Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC2000浮点(-O2）</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLF2Score32.png"><img class="alignnone size-medium wp-image-10861" title="GLF2Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLF2Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC 2000 整点（-O3）</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLI3Score32.png"><img class="alignnone size-medium wp-image-10860" title="GLI3Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLI3Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC 2000 浮点(-O3)</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLF3Score32.png"><img class="alignnone size-medium wp-image-10862" title="GLF3Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLF3Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<p>O2和O3优化下，GCC的性能平均都比LLVM 2.7要好大概2%-3%左右。浮点GCC的优势比整点要大.上面数据仅供参考：）</p>
<p>此外上面的网页中也对编译时间做了对比。LLVM比GCC要快30%左右。</p>
<p>以上数据测试平台：2.93Ghz Intel Core I7 with 8GB memory under Fedora Core10. X86 32位系统.</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/30/10822/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>前瞻-全时优化和LLVM-2</title>
		<link>http://www.lingcc.com/2010/04/29/10728/</link>
		<comments>http://www.lingcc.com/2010/04/29/10728/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 04:14:19 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[编译理论实践和应用]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[全时优化]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[空闲时优化]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器架构]]></category>
		<category><![CDATA[编译器设计]]></category>
		<category><![CDATA[虚拟机]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10728</guid>
		<description><![CDATA[上篇文章，以论文为主要依据，介绍了LLVM的概况和中间表示，本篇关注论文的后半部分内容&#8211;架构设计和LLVM的整体评测： LLVM的架构设计： 总览 LLVM的架构设计以让传统的链接时，安装时，运行时和空闲时代码转换都能透明地在LLVM中间表示上展开为目的。上图就是LLVM的高层设计架构。包括静态的编译器前端用于生成LLVM中间表示；连接器用于做连接时优化，尤其是过程间优化。连接器的输出被JIT或者机器代码生成器生成机器代码。在机器代码生成时，可以通过插入低代价的抽样指令来测量运行时的profile，检测热代码，并将空闲时进行优化。 作者认为LLVM的这种架构具有五个优点，这些优点现阶段的编译器或虚拟机等都无法完全具备，它们是： 提供程序的高层信息 离线代码生成器 用户级的profiling和优化 透明的运行时模型 统一的全程序编译 作者比较了如今存在的一些系统，分析它们是否具备以上5点： 传统的源码级编译器：能提供2和4，但很难提供1，3，5.虽然也能提供过程间优化，但需要修改Makefile 一些商用编译器能够在链接时部分支持1和5，这也是用过将它们的中间表示信息输出到目标文件中。但无法在空闲时使用这些信息 高层虚拟机，如JVM和CLI能提供3，部分支持1. CLI部分支持5，因为它支持多语言代码，但很多底层系统代码只能作为不可控代码直接运行。 透明的二进制运行时优化系统，如Dynamo和Transmeta能提供2，4，5，但不能提供1，而且对3的支持只在运行时。 静态profile制导优化（PGO），能提供3代价是不再对其他阶段透明。另外PGO也有缺点：应用开发者很少用它；使用PGO意味着训练用的输入需要严格和用户行为一致；profiling信息是完全静态的。 当然LLVM也有自己的缺点，作者在文中提到两点：1，源程序语言相关优化需要在前端生成LLVM中间表示之前完成；2，编程语言需不需要一个庞大的运行时系统还有争议。 编译时：外部前端和静态优化 外部静态LLVM编译器(即前端)将源语言程序转换为LLVM虚拟指令集。每种静态编译器都要完成三个关键任务：进行语言相关优化，如使用高层函数优化闭包(closures); 将源程序转换为LLVM代码，并综合尽量多的LLVM类型信息，如指针、结构体和数组信息；启动LLVM的全局或过程间优化。其中第二个任务是外部编译器必须要完成的。LLVM的优化都被写成库的形式，方便前端使用。前端无需构建SSA，可以使用一个栈存放变量，于是就能用栈来实现SSA的构建了。对于所谓的高层语言相关优化，LLVM的观点是：将LLVM优化扩展到特定的转换要好过在编码时为特定语言投入大量的精力。 连接时和过程间优化 LLVM中，连接时是绝大部分分析和转换可以实现的首个编译阶段。LLVM现在包含一些过程间优化，包括：内容相关指针分析；调用图构建；定义-引用分析和过程间转换(内联，死全局变量删除、死参数删除、死类型删除、常数传播、数据越界检查删除、简单结构体域重排、自动存储分配等).LLVM中提供的编译和运行时优化器能加快过程间分析速度。编译时，汇总每个函数的过程间信息，并附在LLVM 代码中。链接时，过程间优化器以这些信息作为输入，而非重新从源码中得到信息。这种技术有效的缩短了编译实践，而且在链接时之前，并未破坏源码的结构。 离线和实时代码生成器 代码生成器用于运行代码前将LLVM中间表示转换为目标平台的机器语言(目前LLVM支持X86和Sparc V9平台).有两种方式实现这种转换，一是在链接时或安装时代码生成器静态地生成高效本地码，这时可以使用代价高的代码生成技术。如果用户打算使用运行时和离线优化器，LLVM中间表示将会附在可执行文件中，并且代码生成器会插入低代价的指令来识别常被执行到的代码区间。另外，LLVM还有一个实时执行引擎，直接在运行时启动代码转换器。 运行时程序行为采集和重优化 LLVM设计的目标之一是开发一种全新的普通应用运行时优化架构。程序执行中，识别最常被执行的路径，通常是热循环。识别出热循环后，复制热区域代码，并使用LLVM代码生成器，优化并生成机器码，并在原始代码和新机器码之间插入一个分支指令。这种机制很强大，理由有三：本地代码生成恩公使用经典算法来产生高性能代码；因为本地代码生成器和运行时优化器都是LLVM的一部分，因此能很好的协同工作，让运行时优化起从代码生成器中得到很好支持；运行时优化起能从LLVM的中间表示中得到高层信息以便实施高度优化。 用户行为信息制导的离线重优化 因为LLVM中间表示能保存，使得应用程序的空闲时离线优化能透明地在用户系统上进行。该优化器可以简单修改连接时过程间优化器来得到，只需要把重点放在目标机相关和反馈信息指导优化即可。 LLVM的评测和应用 评测LLVM 作者评测了LLVM的四个方面：语言无关类型系统的完备性；高级语言特性到LLVM中间表示转换如何实现；LLVM中间表示的复杂度；LLVM的编译速度。 类型系统完备性方面，LLVM使用流敏感，域敏感和内容敏感的指针分析算法来保证LLVM类型系统的可靠性。 高级语言特性方面，作者给出了C++中的隐式调用、模板、基类、虚函数表、例外如何使用LLVM中间表示表达。 LLVM中间表示的复杂度方面，作者对比了GCC3.3 O3下生成X86，Sparc可执行文件和LLVM中间表示文件的大小，结果显示LLVM中间表示大小和X86可执行文件大小相当，明显小于Sparc的可执行文件，作者相信这是LLVM的优势，因为LLVM中间表示使用无限多的寄存器，丰富的类型信息，控制流信息和数据流信息(SSA),而可执行代码没有这些信息。 LLVM的编译速度方面，作者给出了LLVM上几个过程间优化：DGE(aggressive Dead Global variable and function Elimination),DAE(aggressive Dead Argument and return value Elimination),inline转换时间并和GCC O3的编译时间对比，结果显示LLVM做以上三个过程间优化的编译时间要大大短于GCC O3的编译时间，而且GCC O3还没有过程间优化，作者也给出了LLVM的优化效果。 LLVM的应用 <a href='http://www.lingcc.com/2010/04/29/10728/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
<li><a href='http://www.lingcc.com/2009/11/19/10024/' rel='bookmark' title='Open64课程-编译过程'>Open64课程-编译过程</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>上篇文章，以论文为主要依据，介绍了LLVM的概况和中间表示，本篇关注论文的后半部分内容&#8211;架构设计和LLVM的整体评测：</p>
<h3>LLVM的架构设计：</h3>
<h4>总览</h4>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch.jpg"><img class="alignnone size-medium wp-image-10729" title="llvm-arch" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch-300x65.jpg" alt="" width="300" height="65" /></a></p>
<p>LLVM的架构设计以让传统的链接时，安装时，运行时和空闲时代码转换都能透明地在LLVM中间表示上展开为目的。上图就是LLVM的高层设计架构。包括静态的编译器前端用于生成LLVM中间表示；连接器用于做连接时优化，尤其是过程间优化。连接器的输出被JIT或者机器代码生成器生成机器代码。在机器代码生成时，可以通过插入低代价的抽样指令来测量运行时的profile，检测热代码，并将空闲时进行优化。</p>
<p><span id="more-10728"></span></p>
<p>作者认为LLVM的这种架构具有五个优点，这些优点现阶段的编译器或虚拟机等都无法完全具备，它们是：</p>
<ol>
<li>提供程序的高层信息</li>
<li>离线代码生成器</li>
<li>用户级的profiling和优化</li>
<li>透明的运行时模型</li>
<li>统一的全程序编译</li>
</ol>
<p>作者比较了如今存在的一些系统，分析它们是否具备以上5点：</p>
<ul>
<li>传统的源码级编译器：能提供2和4，但很难提供1，3，5.虽然也能提供过程间优化，但需要修改Makefile</li>
<li>一些商用编译器能够在链接时部分支持1和5，这也是用过将它们的中间表示信息输出到目标文件中。但无法在空闲时使用这些信息</li>
<li>高层虚拟机，如JVM和CLI能提供3，部分支持1. CLI部分支持5，因为它支持多语言代码，但很多底层系统代码只能作为不可控代码直接运行。</li>
<li>透明的二进制运行时优化系统，如Dynamo和Transmeta能提供2，4，5，但不能提供1，而且对3的支持只在运行时。</li>
<li>静态profile制导优化（PGO），能提供3代价是不再对其他阶段透明。另外PGO也有缺点：应用开发者很少用它；使用PGO意味着训练用的输入需要严格和用户行为一致；profiling信息是完全静态的。</li>
</ul>
<p>当然LLVM也有自己的缺点，作者在文中提到两点：1，源程序语言相关优化需要在前端生成LLVM中间表示之前完成；2，编程语言需不需要一个庞大的运行时系统还有争议。</p>
<h4>编译时：外部前端和静态优化</h4>
<p>外部静态LLVM编译器(即前端)将源语言程序转换为LLVM虚拟指令集。每种静态编译器都要完成三个关键任务：进行语言相关优化，如使用高层函数优化闭包(closures); 将源程序转换为LLVM代码，并综合尽量多的LLVM类型信息，如指针、结构体和数组信息；启动LLVM的全局或过程间优化。其中第二个任务是外部编译器必须要完成的。LLVM的优化都被写成库的形式，方便前端使用。前端无需构建SSA，可以使用一个栈存放变量，于是就能用栈来实现SSA的构建了。对于所谓的高层语言相关优化，LLVM的观点是：将LLVM优化扩展到特定的转换要好过在编码时为特定语言投入大量的精力。</p>
<h4>连接时和过程间优化</h4>
<p>LLVM中，连接时是绝大部分分析和转换可以实现的首个编译阶段。LLVM现在包含一些过程间优化，包括：内容相关指针分析；调用图构建；定义-引用分析和过程间转换(内联，死全局变量删除、死参数删除、死类型删除、常数传播、数据越界检查删除、简单结构体域重排、自动存储分配等).LLVM中提供的编译和运行时优化器能加快过程间分析速度。编译时，汇总每个函数的过程间信息，并附在LLVM 代码中。链接时，过程间优化器以这些信息作为输入，而非重新从源码中得到信息。这种技术有效的缩短了编译实践，而且在链接时之前，并未破坏源码的结构。</p>
<h4>离线和实时代码生成器</h4>
<p>代码生成器用于运行代码前将LLVM中间表示转换为目标平台的机器语言(目前LLVM支持X86和Sparc V9平台).有两种方式实现这种转换，一是在链接时或安装时代码生成器静态地生成高效本地码，这时可以使用代价高的代码生成技术。如果用户打算使用运行时和离线优化器，LLVM中间表示将会附在可执行文件中，并且代码生成器会插入低代价的指令来识别常被执行到的代码区间。另外，LLVM还有一个实时执行引擎，直接在运行时启动代码转换器。</p>
<h4>运行时程序行为采集和重优化</h4>
<p>LLVM设计的目标之一是开发一种全新的普通应用运行时优化架构。程序执行中，识别最常被执行的路径，通常是热循环。识别出热循环后，复制热区域代码，并使用LLVM代码生成器，优化并生成机器码，并在原始代码和新机器码之间插入一个分支指令。这种机制很强大，理由有三：本地代码生成恩公使用经典算法来产生高性能代码；因为本地代码生成器和运行时优化器都是LLVM的一部分，因此能很好的协同工作，让运行时优化起从代码生成器中得到很好支持；运行时优化起能从LLVM的中间表示中得到高层信息以便实施高度优化。</p>
<h4>用户行为信息制导的离线重优化</h4>
<p>因为LLVM中间表示能保存，使得应用程序的空闲时离线优化能透明地在用户系统上进行。该优化器可以简单修改连接时过程间优化器来得到，只需要把重点放在目标机相关和反馈信息指导优化即可。</p>
<h3>LLVM的评测和应用</h3>
<h4>评测LLVM</h4>
<p>作者评测了LLVM的四个方面：语言无关类型系统的完备性；高级语言特性到LLVM中间表示转换如何实现；LLVM中间表示的复杂度；LLVM的编译速度。</p>
<p>类型系统完备性方面，LLVM使用流敏感，域敏感和内容敏感的指针分析算法来保证LLVM类型系统的可靠性。</p>
<p>高级语言特性方面，作者给出了C++中的隐式调用、模板、基类、虚函数表、例外如何使用LLVM中间表示表达。</p>
<p>LLVM中间表示的复杂度方面，作者对比了GCC3.3 O3下生成X86，Sparc可执行文件和LLVM中间表示文件的大小，结果显示LLVM中间表示大小和X86可执行文件大小相当，明显小于Sparc的可执行文件，作者相信这是LLVM的优势，因为LLVM中间表示使用无限多的寄存器，丰富的类型信息，控制流信息和数据流信息(SSA),而可执行代码没有这些信息。</p>
<p>LLVM的编译速度方面，作者给出了LLVM上几个过程间优化：DGE(aggressive Dead Global variable and function Elimination),DAE(aggressive Dead Argument and return value Elimination),inline转换时间并和GCC O3的编译时间对比，结果显示LLVM做以上三个过程间优化的编译时间要大大短于GCC O3的编译时间，而且GCC O3还没有过程间优化，作者也给出了LLVM的优化效果。</p>
<h4>LLVM的应用</h4>
<p>LLVM中已经实现的几种技术：如数据结构体分析(Data Structure Analysis)和自动查询分配(Automatic Poll Allocation)都得益于LLVM的架构。</p>
<p>SAFECode:一个安全的低级中间表示和运行环境。该中间表示基于LLVM中间表示，目的是增强程序的存储安全。除了运行时优化外，SAFECode几乎使用了LLVM架构中的所有结构。</p>
<p>虚拟指令集计算机的外部指令系统设计：虚拟指令集处理器可以使用两个完全不同指令集。外在的虚拟指令级和隐藏的内部实现指令集。LLVM的中间表示就能作为一种外部虚拟指令集。</p>
<h3>与LLVM相关的工作:</h3>
<p>高层语言虚拟机，如SmallTalk，Self，JVM和CLI，需要特定的对象模型和运行时系统支持，但因为太高层，其他语言(如C++)可能很难在该虚拟机上运行。为了可移植性，中间表示需要严格的类型安全，这也限制了对多语言的支持。类型安全的检测也使得很多优化无法进行。</p>
<p>虽然微软的CLI有些支持不同语言的特性。但CLI支持多语言的unmanaged方式使得，部分语言不能用CLI的中间表示完整表达，优化机会也就随之丧失。</p>
<p>Omniware虚拟机和LLVM比较像，因为都实现抽象的低层RISC指令级。但Omniware缺乏高层的类型信息。</p>
<p>Kistler和Franz给出了一个编译器架构，初始代码生成很简单，依靠程序运行行为指导接下来的优化。但不能支持任意语言，而且也没有透明的运行时系统。</p>
<p>类型化的中间表示方面，也有很多相关工作。但多数都为了类型安全，提取高层语言信息。LLVM则重点放在在静态编译优化之外使得经典的程序分析和优化算法能够实现。</p>
<p>统一、通用的中间表示方面也有了不少研究。但几乎都失败了。这些中间表示大多从AST级抽取信息并尽量支持所有源语言特性。LLVM的中间表示更像汇编，使用很小的类型集和低层操作。</p>
<p>过程间优化方面，有的为给定处理器做基于汇编的优化；有些从静态编译器中得到附加信息。但这些都没有考虑运行时和离线优化支持。</p>
<p>也有一些系统提供透明的运行时优化。但这些系统都只是努力的优化机器码。LLVM则是以提供类型，数据流和精确控制流图为目标。</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
<li><a href='http://www.lingcc.com/2009/11/19/10024/' rel='bookmark' title='Open64课程-编译过程'>Open64课程-编译过程</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/29/10728/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>来仔细看看GCC 4.5.0</title>
		<link>http://www.lingcc.com/2010/04/16/10746/</link>
		<comments>http://www.lingcc.com/2010/04/16/10746/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 04:39:51 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[GCC]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[builtin]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[USE]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[内建函数]]></category>
		<category><![CDATA[并行]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[编程技术]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10746</guid>
		<description><![CDATA[距离GCC 4.4的发布一年之久，GNU终于发布GCC 4.5了。新版本带来了很多新特性，包括使用MPC库在编译时完成复杂的算术计算，C++0x支持增强，使用部分Graphite完成自动并行化，支持新的ARM处理器，Intel Atom优化和调优支持，以及AMD Orochi优化支持等。今年稍晚发布的Fedora 14,Ubuntu 10.10,OpenSUSE 11.3，都将有GCC4.5，估计Gentoo马上就会有支持了，磨拳擦掌准备试用喽：）详细支持如下： 总体说明： 编译GCC需要MPC库 故纸堆里的旧系统和很久没有更新和测试的系统在GCC4.5中被标记为待放弃，包括IRIX, Solaris 7, Tru64 UNIX V5.1. GCC4.4中标记为待放弃的支持被放弃 移除Itanium 1变种支持，但Itanium2编译的程序能在Itanium1上正确执行 GCC生成的调试信息包括了更多DWARF 3的特性，甚至包含了DWARF4的一些特性.GDB7.0之前的版本将无法使用这些特性.所以调试GCC4.5编译的程序需要使用GDB7.0及以上版本.也可以使用选项 -gdwarf-s  -gstrict-dwarf来禁止生成DWARF4信息，或者-gdwarf-2 -gstrict-dwarf让GCC严格执行DWARF2标准. X86上，浮点运算在GCC4.5上使用严格C99语法编译时，可能会运行变慢。这是为了和标准一致，可以通过选项-fexcess-precision=fast来避免严格的标准限制。 noinline属性不再能阻止整个函数拷贝。但可以通过新的属性noclone做到。 改进： -save-temps可以增加参数，该功能让用户可以在并行编译的时候得到编译器的中间文件，但不会在不同的文件夹中使用相同的文件名从而干扰比起。 调试信息目标文件也都被放在了同个文件夹下，而不是当前工作目录，这样用户可以在并行编译的时候得到调试信息。 集成了MPC库，这样可以让GCC在编译时更精确的评估复杂的算术运算。GCC也可以通过它，对于常数作参数的数学运算类内建函数调用，直接在编译时使用相等的返回值来代替之。包括下列内建函数：cacos, cacosh, casin, casinh, catan, catanh, ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctan和ctanh。 新的链接时优化器(-flto),打开此选项后，GCC会针对每个输入文件，产生bytecode的表示形式，并将其写入每个目标文件的特定ELF区內。链接时，从这些ELF区內读取函数体，并将其实体化为转换单元。这样就可以使得过程间优化能在不同的文件间进行(甚至不同语言间),进而可能提升性能。使用此功能需要在编译时和链接时都增加-flto选项。如果不需要程序输出任何符号，可以联合-fwhopr和-fwhole-program来让过程间优化器执行更加激进的优化。 增强自动并行化，现在支持外层循环的并行化。 自动并行化能作为Graphite的一部分来打开。在选项-ftree-parallelize-loops=的基础上增加-floop-parallelize-all能打开基于Graphite的优化。(注:Graphite是GCC中使用多面体模型做循环优化的部分) 重写基于严格指针的优化架构，会提高生成代码的效率。基于严格指针的优化在打开-fno-strict-aliasing后可用。 增加关于函数传参的新优化。试图改变函数原型，避免无用传递，仅传递结构体中特定部分，并将引用传参改为值传参。-O2，-Os及以上级别默认开启此优化。 优化异常控制代码。 新语言支持和特定语言改进 所有语言：-fshow-colum选项默认打开，错误信息现在有列信息。 C类语言：若#include的文件未找到，编译器会立即退出；增加一个新内建函数__builtin_unreachable()；增加-Wlogical-op选项，对可能存在的逻辑错误，报警告；嵌入式汇编增加goto特性，允许汇编中的语句直接跳到C中的标号处；C++0x原始strings(raw string)支持；deprecatd树形现在可以增加可选字符串参数,如__attribute__((deprecated(“text string”))),这样，deprecation警告会和字符串一同打印。 <a href='http://www.lingcc.com/2010/04/16/10746/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F27%2F11679%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC几个选项学习</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F29%2F11859%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC如何进出GIMPLE中间表示</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F28%2F11567%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">仔细端详GCC 4.6的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F16%2F11210%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC Internal 中文文档上线</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2009/12/16/10317/' rel='bookmark' title='Open64课程&#8212;代码生成(CG)'>Open64课程&#8212;代码生成(CG)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/01/08/10609/' rel='bookmark' title='GCC中的pie和fpie选项'>GCC中的pie和fpie选项</a></li>
<li><a href='http://www.lingcc.com/2009/12/14/10295/' rel='bookmark' title='open64课程&#8211;过程间分析优化(IPA)'>open64课程&#8211;过程间分析优化(IPA)</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>距离GCC 4.4的发布一年之久，GNU终于发布GCC 4.5了。新版本带来了很多新特性，包括使用MPC库在编译时完成复杂的算术计算，C++0x支持增强，使用部分Graphite完成自动并行化，支持新的ARM处理器，Intel Atom优化和调优支持，以及AMD Orochi优化支持等。今年稍晚发布的Fedora 14,Ubuntu 10.10,OpenSUSE 11.3，都将有GCC4.5，估计Gentoo马上就会有支持了，磨拳擦掌准备试用喽：）详细支持如下：</p>
<h4>总体说明：</h4>
<ul>
<li>编译GCC需要MPC库</li>
<li>故纸堆里的旧系统和很久没有更新和测试的系统在GCC4.5中被标记为待放弃，包括IRIX, Solaris 7, Tru64 UNIX V5.1.</li>
<li>GCC4.4中标记为待放弃的支持被放弃</li>
<li>移除Itanium 1变种支持，但Itanium2编译的程序能在Itanium1上正确执行</li>
<li>GCC生成的调试信息包括了更多DWARF 3的特性，甚至包含了DWARF4的一些特性.GDB7.0之前的版本将无法使用这些特性.所以调试GCC4.5编译的程序需要使用GDB7.0及以上版本.也可以使用选项 -gdwarf-s  -gstrict-dwarf来禁止生成DWARF4信息，或者-gdwarf-2 -gstrict-dwarf让GCC严格执行DWARF2标准.</li>
<li>X86上，浮点运算在GCC4.5上使用严格C99语法编译时，可能会运行变慢。这是为了和标准一致，可以通过选项-fexcess-precision=fast来避免严格的标准限制。</li>
<li>noinline属性不再能阻止整个函数拷贝。但可以通过新的属性noclone做到。</li>
</ul>
<p><span id="more-10746"></span></p>
<h4>改进：</h4>
<ul>
<li>-save-temps可以增加参数，该功能让用户可以在并行编译的时候得到编译器的中间文件，但不会在不同的文件夹中使用相同的文件名从而干扰比起。</li>
<li>调试信息目标文件也都被放在了同个文件夹下，而不是当前工作目录，这样用户可以在并行编译的时候得到调试信息。</li>
<li>集成了MPC库，这样可以让GCC在编译时更精确的评估复杂的算术运算。GCC也可以通过它，对于常数作参数的数学运算类内建函数调用，直接在编译时使用相等的返回值来代替之。包括下列内建函数：cacos, cacosh, casin, casinh, catan, catanh, ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctan和ctanh。</li>
<li>新的链接时优化器(-flto),打开此选项后，GCC会针对每个输入文件，产生bytecode的表示形式，并将其写入每个目标文件的特定ELF区內。链接时，从这些ELF区內读取函数体，并将其实体化为转换单元。这样就可以使得过程间优化能在不同的文件间进行(甚至不同语言间),进而可能提升性能。使用此功能需要在编译时和链接时都增加-flto选项。如果不需要程序输出任何符号，可以联合-fwhopr和-fwhole-program来让过程间优化器执行更加激进的优化。</li>
<li>增强自动并行化，现在支持外层循环的并行化。</li>
<li>自动并行化能作为Graphite的一部分来打开。在选项-ftree-parallelize-loops=的基础上增加-floop-parallelize-all能打开基于Graphite的优化。(注:Graphite是GCC中使用多面体模型做循环优化的部分)</li>
<li>重写基于严格指针的优化架构，会提高生成代码的效率。基于严格指针的优化在打开-fno-strict-aliasing后可用。</li>
<li>增加关于函数传参的新优化。试图改变函数原型，避免无用传递，仅传递结构体中特定部分，并将引用传参改为值传参。-O2，-Os及以上级别默认开启此优化。</li>
<li>优化异常控制代码。</li>
</ul>
<h4>新语言支持和特定语言改进</h4>
<ul>
<li>所有语言：-fshow-colum选项默认打开，错误信息现在有列信息。</li>
<li>C类语言：若#include的文件未找到，编译器会立即退出；增加一个新内建函数__builtin_unreachable()；增加-Wlogical-op选项，对可能存在的逻辑错误，报警告；嵌入式汇编增加goto特性，允许汇编中的语句直接跳到C中的标号处；C++0x原始strings(raw string)支持；deprecatd树形现在可以增加可选字符串参数,如__attribute__((deprecated(“text string”))),这样，deprecation警告会和字符串一同打印。</li>
<li>其他针对各个语言的详细细节请参考官方release。</li>
</ul>
<h4>其他改进：</h4>
<ul>
<li>插件支持：可以不通过改变编译器代码来扩展编译器功能。-fplugin=file.so能指定GCC载入动态链接文件file.so，并将其作为编译器的一部分执行。更多的细节请参考相关文档。</li>
<li>安装文件夹稍有变动。</li>
</ul>
<p>参考：</p>
<p>http://gcc.gnu.org/gcc-4.5/changes.html</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F27%2F11679%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC几个选项学习</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F29%2F11859%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC如何进出GIMPLE中间表示</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F28%2F11567%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">仔细端详GCC 4.6的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F16%2F11210%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F16%2F10746%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC Internal 中文文档上线</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2009/12/16/10317/' rel='bookmark' title='Open64课程&#8212;代码生成(CG)'>Open64课程&#8212;代码生成(CG)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/01/08/10609/' rel='bookmark' title='GCC中的pie和fpie选项'>GCC中的pie和fpie选项</a></li>
<li><a href='http://www.lingcc.com/2009/12/14/10295/' rel='bookmark' title='open64课程&#8211;过程间分析优化(IPA)'>open64课程&#8211;过程间分析优化(IPA)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/16/10746/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Gentoo上安装Texlive2009</title>
		<link>http://www.lingcc.com/2010/04/09/10732/</link>
		<comments>http://www.lingcc.com/2010/04/09/10732/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 14:33:38 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[编译技术]]></category>
		<category><![CDATA[ctex]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[latex 中文]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[texlive]]></category>
		<category><![CDATA[USE]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[写论文]]></category>
		<category><![CDATA[字体]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10732</guid>
		<description><![CDATA[最近想折腾用texlive写点东西，而且要支持中文。就冲着texlive-2009了。大学毕业论文就是用latex写的，不过那是在Windoews下，用CTEX包，很是方便，Gentoo就有点不一样了。虽然texlive有自己的iso镜像，有自己的安装工具和包管理工具，但Gentoo还是将它拆分成了很多的packge来装。这样也好，比较灵活。 下面就开始吧。 首先是keywords和use，因为现在2009还不稳定，而我用的是x86就要增加一堆的keyword，如下： app-text/texlive ~x86 app-text/texlive-core ~x86 dev-texlive/texlive-documentation-english ~x86 dev-texlive/texlive-documentation-base ~x86 dev-texlive/texlive-basic ~x86 dev-texlive/texlive-bibtexextra ~x86 dev-texlive/texlive-context ~x86 dev-texlive/texlive-xetex ~x86 dev-texlive/texlive-genericrecommended ~x86 dev-texlive/texlive-genericextra ~x86 dev-texlive/texlive-htmlxml ~x86 media-libs/silgraphite ~x86 app-text/teckit ~x86 dev-texlive/texlive-latexrecommended ~x86 dev-texlive/texlive-latex ~x86 app-text/ptex ~x86 dev-texlive/texlive-texinfo ~x86 dev-texlive/texlive-formatsextra ~x86 dev-texlive/texlive-metapost ~x86 dev-texlive/texlive-mathextra ~x86 dev-texlive/texlive-fontsextra ~x86 dev-texlive/texlive-langcjk ~x86 dev-texlive/texlive-fontsrecommended ~x86 dev-texlive/texlive-fontutils ~x86 app-text/xdvik ~x86 dev-texlive/texlive-music ~x86 <a href='http://www.lingcc.com/2010/04/09/10732/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F21%2F10761%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo安装texlive2009–字体</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ebuild and emerge</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo 沙盘简介</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/04/21/10761/' rel='bookmark' title='Gentoo安装texlive2009&#8211;字体'>Gentoo安装texlive2009&#8211;字体</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2010/04/16/10746/' rel='bookmark' title='来仔细看看GCC 4.5.0'>来仔细看看GCC 4.5.0</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>最近想折腾用texlive写点东西，而且要支持中文。就冲着texlive-2009了。大学毕业论文就是用latex写的，不过那是在Windoews下，用CTEX包，很是方便，Gentoo就有点不一样了。虽然texlive有自己的iso镜像，有自己的安装工具和包管理工具，但Gentoo还是将它拆分成了很多的packge来装。这样也好，比较灵活。</p>
<p>下面就开始吧。</p>
<p>首先是keywords和use，因为现在2009还不稳定，而我用的是x86就要增加一堆的keyword，如下：</p>
<div id="_mcePaste">app-text/texlive ~x86</div>
<div id="_mcePaste">app-text/texlive-core ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-documentation-english ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-documentation-base ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-basic ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-bibtexextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-context ~x86<span id="more-10732"></span></div>
<div id="_mcePaste">dev-texlive/texlive-xetex ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-genericrecommended ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-genericextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-htmlxml ~x86</div>
<div id="_mcePaste">media-libs/silgraphite ~x86</div>
<div id="_mcePaste">app-text/teckit ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-latexrecommended ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-latex ~x86</div>
<div id="_mcePaste">app-text/ptex ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-texinfo ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-formatsextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-metapost ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-mathextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-fontsextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-langcjk ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-fontsrecommended ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-fontutils ~x86</div>
<div id="_mcePaste">app-text/xdvik ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-music ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-omega ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-games ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-publishers ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-humanities ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-science ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-latexextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-latexextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-langcyrillic ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-plainextra ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-documentation-chinese ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-pstricks ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-pictures ~x86</div>
<div id="_mcePaste">dev-texlive/texlive-luatex ~x86</div>
<div id="_mcePaste">dev-lisp/clisp ~x86</div>
<div>至于use，别忘了cjk就行。</div>
<div>然后就能emerge -av  texlive 开始安装了。安装过程中出了几个小问题，有的可能解决方法比较笨，呵呵。如下：</div>
<div>
<ul>
<li>(&#8216;ebuild&#8217;, &#8216;/&#8217;,  &#8216;app-text/texlive-core-2009-r1&#8242;, &#8216;merge&#8217;) pulled in by app-text/texlive-core required by (&#8216;installed&#8217;, &#8216;/&#8217;,  &#8216;virtual/tex-base-0&#8242;, &#8216;nomerge&#8217;) (&#8216;ebuild&#8217;, &#8216;/&#8217;,  &#8216;app-text/ptex-3.1.10_p20090610-r1&#8242;, &#8216;merge&#8217;) pulled in by app-text/ptex required by (&#8216;installed&#8217;, &#8216;/&#8217;, &#8216;virtual/latex-base-1.0&#8242;,  &#8216;nomerge&#8217;)  just emerge -c  all texlive package /卸载所有texlive相关的包</li>
<li> ptex and   dev-texlive/texlive-fontutils Detected file collision(s)   /usr/bin/epstopdf， emerge -C  app-text/ptex</li>
<li>xindy-2.3 build fail. <a class="externalLink" title="External link to http://bugs.gentoo.org/show_bug.cgi?id=281271" href="http://bugs.gentoo.org/show_bug.cgi?id=281271" target="_blank">http://bugs.gentoo.org/show_bug.cgi?id=281271</a>.  add the patch. make pass</li>
</ul>
</div>
<p>如果一切顺利的话，接下来就能用了。别忘了看看自己系统支持的中文字体，使用这个命令<br />
$ fc-list :lang=zh-cn<br />
本博用来测试各个字体的test-fonts.tex文件，其他问题日后遇到了再详谈，enjoy it :)<br />
<code><br />
\documentclass[12pt,a4paper]{article}<br />
\usepackage{fontspec}<br />
\setromanfont{AR PL UMing CN}<br />
\begin{document}<br />
{\setromanfont{WenQuanYi Micro Hei Mono}<br />
不需要安装字体，文泉驿等宽微米黑,文泉驛等寬微米黑,WenQuanYi Micro Hei Mono  \\}<br />
{\setromanfont{WenQuanYi Zen Hei}<br />
不需要安装字体，文泉驿 正黑 \\}<br />
{\setromanfont{WenQuanYi Zen Hei Mono}<br />
不需要安装字体，文泉驿 正黑 Mono \\}<br />
{\setromanfont{WenQuanYi Zen Hei Sharp}<br />
不需要安装字体，文泉驿 正黑 Sharp \\}<br />
{\setromanfont{AR PL UMing TW}<br />
不需要安装字体, AR PL UMing TW \\}<br />
{\setromanfont{AR PL UMing TW MBE}<br />
不需要安装字体, UMing TW MBE \\}<br />
{\setromanfont{AR PL UMing HK}<br />
不需要安装字体, AR PL UMing HK \\}<br />
{\setromanfont{AR PL UMing CN}<br />
不需要安装字体, UMing CN\\}<br />
{\setromanfont{AR PL UKai CN}<br />
不需要安装字体, UKai CN \\}<br />
{\setromanfont{AR PL UKai HK}<br />
不需要安装字体, UKai HK \\}<br />
{\setromanfont{AR PL UKai TW}<br />
不需要安装字体, UKai TW \\}<br />
{\setromanfont{AR PL UKai TW MBE}<br />
不需要安装字体, UKai TW MBE \\}<br />
{\setromanfont{AR PL KaitiM GB}<br />
不需要安装字体, AR PL KaitiM GB \\}<br />
\end{document}</code></p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F21%2F10761%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo安装texlive2009–字体</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ebuild and emerge</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo 沙盘简介</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/04/21/10761/' rel='bookmark' title='Gentoo安装texlive2009&#8211;字体'>Gentoo安装texlive2009&#8211;字体</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2010/04/16/10746/' rel='bookmark' title='来仔细看看GCC 4.5.0'>来仔细看看GCC 4.5.0</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/09/10732/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

