Vadim Markovtsev
2010-Dec-03 08:56 UTC
[LLVMdev] LLVM API: how to determine if the register is the status register
Hello. I've got the "unsigned int" register number. How one uses LLVM API to determine if that register is the status register (e.g., ARM::CPSR) or not? I know I can just compare the number with ARM::CPSR, but the code becomes not universal. I gave up searching for the solution by myself... Thanks.
Anton Korobeynikov
2010-Dec-03 11:58 UTC
[LLVMdev] LLVM API: how to determine if the register is the status register
Hello,> I've got the "unsigned int" register number. How one uses LLVM API to > determine if that register is the status register (e.g., ARM::CPSR) or > not? I know I can just compare the number with ARM::CPSR, but the code > becomes not universal. I gave up searching for the solution by myself...Why do you need this and what you're trying to do? There is no "status register" stuff inside LLVM, so there is no way to query for it. Also, reg numbers exist only inside particular target backend, thus you can always just compare with target-specific reg. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Anton Korobeynikov
2010-Dec-08 13:29 UTC
[LLVMdev] LLVM API: how to determine if the register is the status register
Hello Vadim,> CMP modifies the status register (e.g. CPSR in ARM). The question is, are > there any modifications of the status register between those two compares. > In other words, how to know if CPSR is changed in the code after the first > CMP and before the second one.After register allocation all the machine instructions have flags on machine operands. So, in this particular case you'll see that CPSR register is implicitly defined by the first CMP. After this you can look over def/kill/... flags on the operands of the instruction to check whether the register is used / changed in between. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Seemingly Similar Threads
- [LLVMdev] LLVM API: how to determine if the register is the status register
- [LLVMdev] Adding "S" suffixed ARM/Thumb2 instructions
- Incorrect placement of an instruction after PostRAScheduler pass
- [ARM] Thumb code-gen for 8-bit imm arguments results in extra reg copies
- ARM: Predicated returns considered analyzable?