[cfe-dev] codegen binaryOperator constant exprs

Eli Friedman eli.friedman at gmail.com
Tue Jan 29 08:50:47 PST 2008


On Jan 29, 2008 8:17 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
> Hi,
>
> Below is a patch to add support to codegen for a few binary operators in
> constant exprs.
> I'm not sure about SDiv and SRem. I dunno if the operations should be signed
> or not, but I leave that to someone more enlighten in the subject than me :)

The add, sub, div, and rem operations are incomplete; see
CGExprScalar.cpp for correct implementations (EmitDiv and friends).

Specifically, for Div and Rem, you need to check the types of the
operands, since the correct operation to use varies; in LLVM, signed
and unsigned integers don't have distinct types, the division
operation has to be separate.

-Eli



More information about the cfe-dev mailing list