[PATCH] D27191: TII: add hook getInstrOperandImmValue.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 14:27:39 PST 2016


arsenm added inline comments.


================
Comment at: include/llvm/Target/TargetInstrInfo.h:1144
+                                       const MachineOperand &MO,
+                                       int64_t &Val) const {
+    return false;
----------------
qcolombet wrote:
> kparzysz wrote:
> > qcolombet wrote:
> > > qcolombet wrote:
> > > > qcolombet wrote:
> > > > > MI is probably useless given it is accessible through MO.getParent(), unless it represents something else and in that case it must be documented.
> > > > Val should probably be an APInt.
> > > If this is a compile time known constant, why this is not directly MO_Immediate?
> > > What am I saying is in which cases do we need that API?
> > 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.
> I see.
> One thing that you didn't address is why does the API have both MI and MO?
I thought there was a vague desire to remove the parent from MachineOperands someday to save memory


https://reviews.llvm.org/D27191





More information about the llvm-commits mailing list