谢谢。 我看了 http://gcc.gnu.org/onlinedocs/gccint/Register-Classes.html#Register-Classes 上的介绍,感觉gcc对于寄存器约束的描述更加细致。 在 2013年6月24日上午11:06,Joey Ye <Joey.Ye@xxxxxxx>写道: > GCC后端也是同样用SI32表示指针和整数,所以会有类似的问题。 > > GCC可以在tree->RTL expand的时候根据middle-end类型不同用不同的pattern,这样就能很大程度消除拷贝。 > > Joey > > > -----Original Message----- > > From: npickito@xxxxxxxxx [mailto:npickito@xxxxxxxxx] On Behalf Of Kito > > Cheng > > Sent: Sunday, June 23, 2013 23:16 > > To: hellogcc@xxxxxxxxxxxxx > > Cc: Mingjie Xing; Ethan Hunt; 陳韋任; Joey Ye > > Subject: Re: [hellogcc] gcc中的数据类型与寄存器分配 > > > > > http://gcc.gnu.org/onlinedocs/gccint/Register-Classes.html#Register-Classes > > > > gcc 中 REGNO_OK_FOR_BASE_P 以及 REGNO_OK_FOR_INDEX_P > > 可以設定哪些 Register 可以當作 Base register 及 Index register > > 其它一些相關設定則在 MD 部份描述 > > > > 2013/6/23 杨勇勇 <triple.yang@xxxxxxxxx>: > > > 大家好, > > > > > > 最近在做llvm的C编译器后端时遇到一个问题。 > > > 我的目标体系结构中有两类通用寄存器,一类用于算术逻辑运算,一 > > 类用于地址计算以及访存。两类寄存器都是32位,两者之间可以进行 > > 值传递。 > > > > > > 显然,在做寄存器分配时区分指针以及32位整型可以消除一部分寄存 > > 器值传递代码。但是在llvm后端中将指针与32位整型都视为i32,所以 > > 在寄存器分配时无法区分指针与32位整型。更遗憾的是,llvm当前的 > > mainline > > > source > > > tree中没有任何机制支持这种区分。在早前版本的llvm中支持的 > > blackfin具有类似的寄存器分配问题,但是后来这个target被删掉了。 > > > > > > 因为我对gcc内部不熟,故请教大家gcc是如何处理类似情况的。 > > > > > > 先谢啦! > > > > > > -- > > > 杨勇勇 (Yang Yong-Yong) > > -- IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > -- 杨勇勇 (Yang Yong-Yong)