Is it possible to annotate basic blocks in order to manipulate them in
LLVM backend with fine granularity?
Eg: I want to reserve registers for some parts of the code, therefore
need to stop register allocator from using some registers only in
specific basic blocks.
We didn’t have any use case for this kind of things, so no, we don’t have anything to do that.
What you could do is split the live-ranges you are interested in in the place you care and use TargetRegisterInfo::getRegAllocationHints to bias the allocation the way you want.