[PATCH] D27191: TII: add hook getInstrOperandImmValue.

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 07:44:42 PST 2016


SjoerdMeijer added inline comments.


================
Comment at: include/llvm/Target/TargetInstrInfo.h:1144
+                                       const MachineOperand &MO,
+                                       int64_t &Val) const {
+    return false;
----------------
arsenm wrote:
> 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
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. 


https://reviews.llvm.org/D27191





More information about the llvm-commits mailing list