TII: add hook getInstrOperandImmValue. This is refactored from the Hexagon backend, which has been changed accordingly; this is change is intended to be NFC. This target hook is some more groundwork for recognising loop induction statement and trip counts for MachineLoops.
Diff Detail
Event Timeline
include/llvm/Target/TargetInstrInfo.h | ||
---|---|---|
1144 | MI is probably useless given it is accessible through MO.getParent(), unless it represents something else and in that case it must be documented. | |
1144 | Val should probably be an APInt. | |
1144 | If this is a compile time known constant, why this is not directly MO_Immediate? |
include/llvm/Target/TargetInstrInfo.h | ||
---|---|---|
1144 | The intent was to evaluate the value of the operand at compile-time: for immediate operands that is trivial, for registers the function would look up their definitions, etc. |
include/llvm/Target/TargetInstrInfo.h | ||
---|---|---|
1144 | I see. |
include/llvm/Target/TargetInstrInfo.h | ||
---|---|---|
1144 | I thought there was a vague desire to remove the parent from MachineOperands someday to save memory |
include/llvm/Target/TargetInstrInfo.h | ||
---|---|---|
1144 | I think I added the MI here (so that the API has both the MI and MO). But for no real good reason, other than perhaps consistency that most TII functions take a MI. Will remove it from since MO->getParent() will also give access to it. |
Abandoning as the approach is not generic enough, see also https://reviews.llvm.org/D27193
MI is probably useless given it is accessible through MO.getParent(), unless it represents something else and in that case it must be documented.