[LLVMdev] RFC: Code Gen Change!
Bill Wendling
isanbard at gmail.com
Tue May 12 22:42:47 PDT 2009
On May 12, 2009, at 10:10 PM, Jakob Stoklund Olesen wrote:
> On 13/05/2009, at 02.46, Bill Wendling wrote:
>> Instead of all of the booleans, you pass in a flag that has bits set
>> to indicate what state the register is in:
>>
>> namespace RegState {
>> enum {
>> Define = 0x1,
>> Implicit = 0x2,
>> Kill = 0x4,
>> Dead = 0x8,
>> EarlyClobber = 0x10,
>> ImplicitDefine = Implicit | Define,
>> ImplicitKill = Implicit | Kill
>> };
>> }
> [...]
>> MachineInstrBuilder &addReg(unsigned RegNo, unsigned flags = 0,
>> unsigned SubReg = 0) const {
>
> Hi Bill,
>
> I definitely like this change. The staccato bool arguments are
> impossible to read. One comment:
>
> If I forget to update an addReg(Reg, true) call, it will still compile
> and work by accident. If you leave bit 0 unused by the enum and
> assert(flags&1 == 0), you make sure I have updated all my addReg
> calls.
>
> Humans being human, we are going to fix addReg calls until everything
> compiles and passes 'make check'. I don't think addReg(Reg, true)
> should be allowed to survive the API change.
>
True. I went over all of the "addReg()" calls and tried to cover all
of them. Your suggestion would be a good way to stop errors from
sneaking back in. :-)
-bw
More information about the llvm-dev
mailing list