[LLVMdev] Purpose of (XXX)Wrapper
Paul S
pauls at dataworx.com.au
Tue Jul 24 22:10:04 PDT 2012
Hello,
I'm considering creating an LLVM backend for a 16 bit processor and modelling it around the (experimental) MSP430 back end.
When reviewing MSP430InstrInfo.td I see
def MSP430Wrapper : SDNode<"MSP430ISD::Wrapper", SDT_MSP430Wrapper>;
and can see in MSP430ISelLowering.cpp that
ISD::GlobalAddress:
ISD::BlockAddress:
ISD::ExternalSymbol
all get lowered to MSP430ISD::Wrapper(address base) plus the wrapped address node.
What has me mystified is that in some of the patterns in
MSP430InstrInfo.td take the form
def : Pat<(i16 (MSP430Wrapper tglobaladdr:$dst)), (MOV16ri tglobaladdr:$dst)>;
and others ...
def : Pat<(MSP430call (i16 tglobaladdr:$dst)), (CALLi tglobaladdr:$dst)>;
In other words, some patterns rely on MSP430Wrapper being part of the pattern then extract the wrapped info anyway, and some others just directly match tglobaladdr and friends.
I have noticed that many other backends use the same idiom but so far I can't see what it offers to the matching process.
Can someone please explain what I'm not seeing ?
Thanks, Paul.
.
More information about the llvm-dev
mailing list