[LLVMdev] How to calculate the address in TableGen?

Yang Yang geraint0923 at gmail.com
Sun Jul 22 07:03:21 PDT 2012


Hello everyone,

I would like to ask a question about the address calculation in TableGen.
I replace a definition in MipsInstrInfo.td:
def : Pat<(i32 (extloadi16_a addr:$src)), (LHu addr:$src)>;
to:
def : Pat<(i32 (extloadi16_a addr:$src)), (OR (LBu addr:$src), (SLL (LBu addr:($src+1)), 8))>;

However, it failed to compiled. It seems that ($src+1) is a wrong representation in TableGen.
I find the definition of adds:
def addr : ComplexPattern<iPTR, 2, "SelectAddr", [frameindex], [SDNPWantParent]>;

How to calculate a new address in TableGen?

Thanks,
Yang



More information about the llvm-dev mailing list