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.

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.

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.