harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zouqiong <ust...@gmail.com>
Subject Re: [Drlvm][Opt]Some Questions about LIR expressions
Date Wed, 31 Jan 2007 10:10:45 GMT
Sorry, I still have two questions.
1.

What is the difference between newOpnd, newImmOpnd and newMemOpnd?



Opnd* baseOpnd= irManager.newImmOpnd(typeManager.getUnmanagedPtrType(
                        typeManager.getUIntPtrType()),
(POINTER_SIZE_INT)&current_obj_acc_record_pointer);
Opnd* RefOpnd = irManager.newMemOpnd(typeManager.getUIntPtrType(),
                                MemOpndKind_Heap,
baseOpnd_current_obj_acc_record_pointer, NULL, NULL, NULL);
appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, RefOpnd,
(Opnd*)elemBase));


Opnd* memOpnd = irManager.newMemOpnd(typeManager.getUIntPtrType(),
                         MemOpndKind_Heap,
baseOpnd_current_obj_acc_record_pointer, NULL, NULL, NULL);
appendInsts(irManager.newInst(Mnemonic_SUB,memOpnd, irManager.newImmOpnd(
typeManager.getUInt32Type(), 16)));


What's the difference between memOpnd and baseOpnd?

I look the code emitted as below,  It seems that they have no difference.

mov 0xb40534, %esi
mov %ebp, (%esi)

mov 0xb40534, %ebp
subl 0x10, 0x0(%ebp)

2. If I want to generate such code:
mov 0xb400534, %esi
mov (%esi), %esi

How should I write the LIR?

Thanks,
Qiong

2007/1/31, zouqiong <ustczz@gmail.com>:
>
> Hi, Mikhail:
>   Thanks! I can instrument right now!
>
>
> > On 1/28/07, zouqiong < ustczz@gmail.com> wrote:
> > >
> > > I add the following expression in InstCodeSelector::addElemIndex():
> > >
> > > Opnd* current_buffer = irManager.newImmOpnd(typeManager.getInt32Type(),
> > > (unsigned)&current_obj_acc_record_pointer);
> > >
> > > Opnd * Ip_Opnd = irManager.newMemOpndAutoKind
> > > (typeManager.getPrimitiveType(Type::UInt32),
> > > current_buffer, irManager.newImmOpnd(typeManager.getInt32Type (), 8));
> > >
> > > copyOpnd(Ip_Opnd, irManager.newImmOpnd(typeManager.getInt32Type(),
> > > 0x19820514));
> > >
> > > It seems that the constraints of the Opnds are wrong. Is it?
> > >
> > > current_obj_acc_record_pointer points to a buffer of type
> > obj_acc_record
> > >
> > > typedef struct {
> > >            uint32 base;
> > >            uint32 offset;
> > >            uint32 ip;
> > >            uint32 other_info;
> > > }obj_acc_record;
> > >
> > >
> > > --
> > > Best Regards,
> > > Qiong,Zou
> > >
> > >
> >
> >
> > --
> > Mikhail Fursov
> >
> >
>
>
> --
> Best Regards,
> Qiong,Zou




-- 
Best Regards,
Qiong,Zou

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message