Lowers block address. Currently asserts when relocation model is not PIC. Patch by Akira Hatanaka

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127027 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bruno Cardoso Lopes
2011-03-04 20:01:52 +00:00
parent ca9714470e
commit ca8a2aa921
6 changed files with 66 additions and 1 deletions

View File

@@ -121,7 +121,8 @@ SelectAddr(SDValue Addr, SDValue &Offset, SDValue &Base) {
if (TM.getRelocationModel() == Reloc::PIC_) {
if ((Addr.getOpcode() == ISD::TargetGlobalAddress) ||
(Addr.getOpcode() == ISD::TargetConstantPool) ||
(Addr.getOpcode() == ISD::TargetJumpTable)){
(Addr.getOpcode() == ISD::TargetJumpTable) ||
(Addr.getOpcode() == ISD::TargetBlockAddress)) {
Base = CurDAG->getRegister(Mips::GP, MVT::i32);
Offset = Addr;
return true;
@@ -170,6 +171,11 @@ SelectAddr(SDValue Addr, SDValue &Offset, SDValue &Base) {
}
}
if (isa<BlockAddressSDNode>(Addr.getOperand(1))) {
Base = Addr.getOperand(0);
Offset = Addr.getOperand(1);
}
Base = Addr;
Offset = CurDAG->getTargetConstant(0, MVT::i32);
return true;