On 10/2/2012 9:36 AM, 陳韋任 (Wei-Ren Chen) wrote:> On Tue, Oct 02, 2012 at 09:23:27AM -0500, Matthew Curtis wrote: >> I'm adding support for -ffixed-<reg> for Hexagon and was wondering if I should >> do it in such a way that other targets get the support as well by default or if >> a given target back-end should have to explicitly opt-in for support. > What "-ffixed-<reg>" does? > > Regards, > chenwj >From the GCC manual (http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Code-Gen-Options.html#index-ffixed-2267) -ffixed-/reg/ Treat the register named reg as a fixed register; generated code should never refer to it (except perhaps as a stack pointer, frame pointer or in some other fixed role). reg must be the name of a register. The register names accepted are machine-specific and are defined in the REGISTER_NAMES macro in the machine description macro file. Useful when writing kernel code or other low-level code (e.g. a VM) where you want to reserve a particular register for your own use. Matthew C -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121002/5e3bd400/attachment.html>
> From the GCC manual (http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/ > Code-Gen-Options.html#index-ffixed-2267) > > -ffixed-reg > > Treat the register named reg as a fixed register; generated code should > never refer to it (except perhaps as a stack pointer, frame pointer or in > some other fixed role). > > reg must be the name of a register. The register names accepted are > machine-specific and are defined in the REGISTER_NAMES macro in the machine > description macro file. > > > Useful when writing kernel code or other low-level code (e.g. a VM) where you > want to reserve a particular register for your own use.Ya, I saw people writing VM often ask for this functionality on ML. But I have a question, what the difference between this and global register [1]? To me, they both seems to reserve particular register from being used by the compiler. If they're the same, I remember Chris objected to add global register feature in LLVM. Regards, chenwj [1] http://nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
On 10/2/2012 10:14 AM, 陳韋任 (Wei-Ren Chen) wrote:>> From the GCC manual (http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/ >> Code-Gen-Options.html#index-ffixed-2267) >> >> -ffixed-reg >> >> Treat the register named reg as a fixed register; generated code should >> never refer to it (except perhaps as a stack pointer, frame pointer or in >> some other fixed role). >> >> reg must be the name of a register. The register names accepted are >> machine-specific and are defined in the REGISTER_NAMES macro in the machine >> description macro file. >> >> >> Useful when writing kernel code or other low-level code (e.g. a VM) where you >> want to reserve a particular register for your own use. > Ya, I saw people writing VM often ask for this functionality on ML. > But I have a question, what the difference between this and global > register [1]? To me, they both seems to reserve particular register > from being used by the compiler. If they're the same, I remember Chris > objected to add global register feature in LLVM. > > Regards, > chenwj > > [1] http://nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt >From my understanding ... The two features are often used together. -ffixed-reg must usually be passed to other compilation units in a program that don't actually use a given global register, or to ensure that it is not used by preceding function definitions.[1] Global registers imply some level of language/IR support. In the absence of global register support, use of the register must be written outside of the compiler (e.g. in assembly). Cheers, Matthew C. [1] http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Global-Reg-Vars.html#Global-Reg-Vars -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation