[LLVMdev] Lowering operations to 8-bit!

Chris Lattner
Thu, 27 Sep 2007 18:23:15 -0000

On Wed, 26 Sep 2007 Alireza.Moshtaghi at microchip.com
wrote:
> I am trying to lower all llvm operations to 8-bit. So far I was trying
> to have llvm do all that for me using things like:

ok

> setOperationAction(ISD::ADD, MVT::ii,Promote);
> setOperationAction(ISD::ADD, MVT::i8,Legal);
> setOperationAction(ISD::ADD, MVT::i16,Expand);
> setOperationAction(ISD::ADD, MVT::i32,Expand);

This should work.

> However, I keep getting an assertion failure that operation can not be
> expanded.

On which operation, of which types?

> Now I am thinking maybe LLVM does not lower all operations and value
> types.

Things are typically added to LegalizeDAG on demand, so you may run into
some corner cases that other targets haven't hit yet.

> Before going ahead and write new DAGs for all LLVM operations, I would
> like to make sure that I am doing the right thing.

In theory, you should just have to add code to LegalizeDAG.cpp to expand
the operation.  With information about which operation is the problem we
can give you more guidance.

-Chris

--