mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Upgrade our copy of llvm/clang to 3.2 release.
Release notes for llvm: http://llvm.org/releases/3.2/docs/ReleaseNotes.html Release notes for clang: http://llvm.org/releases/3.2/tools/clang/docs/ReleaseNotes.html MFC after: 2 weeks
This commit is contained in:
commit
c80e6c4bec
27 changed files with 245 additions and 289 deletions
|
|
@ -197,7 +197,11 @@ public:
|
|||
VK_Mips_GOT_PAGE,
|
||||
VK_Mips_GOT_OFST,
|
||||
VK_Mips_HIGHER,
|
||||
VK_Mips_HIGHEST
|
||||
VK_Mips_HIGHEST,
|
||||
VK_Mips_GOT_HI16,
|
||||
VK_Mips_GOT_LO16,
|
||||
VK_Mips_CALL_HI16,
|
||||
VK_Mips_CALL_LO16
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ uint8_t *RuntimeDyldImpl::createStubFunction(uint8_t *Addr) {
|
|||
uint32_t *StubAddr = (uint32_t*)Addr;
|
||||
*StubAddr = 0xe51ff004; // ldr pc,<label>
|
||||
return (uint8_t*)++StubAddr;
|
||||
} else if (Arch == Triple::mipsel) {
|
||||
} else if (Arch == Triple::mipsel || Arch == Triple::mips) {
|
||||
uint32_t *StubAddr = (uint32_t*)Addr;
|
||||
// 0: 3c190000 lui t9,%hi(addr).
|
||||
// 4: 27390000 addiu t9,t9,%lo(addr).
|
||||
|
|
|
|||
|
|
@ -676,7 +676,8 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||
RelType, 0);
|
||||
Section.StubOffset += getMaxStubSize();
|
||||
}
|
||||
} else if (Arch == Triple::mipsel && RelType == ELF::R_MIPS_26) {
|
||||
} else if ((Arch == Triple::mipsel || Arch == Triple::mips) &&
|
||||
RelType == ELF::R_MIPS_26) {
|
||||
// This is an Mips branch relocation, need to use a stub function.
|
||||
DEBUG(dbgs() << "\t\tThis is a Mips branch relocation.");
|
||||
SectionEntry &Section = Sections[Rel.SectionID];
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ protected:
|
|||
inline unsigned getMaxStubSize() {
|
||||
if (Arch == Triple::arm || Arch == Triple::thumb)
|
||||
return 8; // 32-bit instruction and 32-bit address
|
||||
else if (Arch == Triple::mipsel)
|
||||
else if (Arch == Triple::mipsel || Arch == Triple::mips)
|
||||
return 16;
|
||||
else if (Arch == Triple::ppc64)
|
||||
return 44;
|
||||
|
|
|
|||
|
|
@ -229,6 +229,10 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
|
|||
case VK_Mips_GOT_OFST: return "GOT_OFST";
|
||||
case VK_Mips_HIGHER: return "HIGHER";
|
||||
case VK_Mips_HIGHEST: return "HIGHEST";
|
||||
case VK_Mips_GOT_HI16: return "GOT_HI16";
|
||||
case VK_Mips_GOT_LO16: return "GOT_LO16";
|
||||
case VK_Mips_CALL_HI16: return "CALL_HI16";
|
||||
case VK_Mips_CALL_LO16: return "CALL_LO16";
|
||||
}
|
||||
llvm_unreachable("Invalid variant kind");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,10 @@ static void printExpr(const MCExpr *Expr, raw_ostream &OS) {
|
|||
case MCSymbolRefExpr::VK_Mips_GOT_OFST: OS << "%got_ofst("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_HIGHER: OS << "%higher("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_HIGHEST: OS << "%highest("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_HI16: OS << "%got_hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_LO16: OS << "%got_lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_CALL_HI16: OS << "%call_hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_CALL_LO16: OS << "%call_lo("; break;
|
||||
}
|
||||
|
||||
OS << SRE->getSymbol();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
|
|||
case Mips::fixup_Mips_GOT_PAGE:
|
||||
case Mips::fixup_Mips_GOT_OFST:
|
||||
case Mips::fixup_Mips_GOT_DISP:
|
||||
case Mips::fixup_Mips_GOT_LO16:
|
||||
case Mips::fixup_Mips_CALL_LO16:
|
||||
break;
|
||||
case Mips::fixup_Mips_PC16:
|
||||
// So far we are only using this type for branches.
|
||||
|
|
@ -60,6 +62,8 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
|
|||
break;
|
||||
case Mips::fixup_Mips_HI16:
|
||||
case Mips::fixup_Mips_GOT_Local:
|
||||
case Mips::fixup_Mips_GOT_HI16:
|
||||
case Mips::fixup_Mips_CALL_HI16:
|
||||
// Get the 2nd 16-bits. Also add 1 if bit 15 is 1.
|
||||
Value = ((Value + 0x8000) >> 16) & 0xffff;
|
||||
break;
|
||||
|
|
@ -179,7 +183,11 @@ public:
|
|||
{ "fixup_Mips_GOT_OFST", 0, 16, 0 },
|
||||
{ "fixup_Mips_GOT_DISP", 0, 16, 0 },
|
||||
{ "fixup_Mips_HIGHER", 0, 16, 0 },
|
||||
{ "fixup_Mips_HIGHEST", 0, 16, 0 }
|
||||
{ "fixup_Mips_HIGHEST", 0, 16, 0 },
|
||||
{ "fixup_Mips_GOT_HI16", 0, 16, 0 },
|
||||
{ "fixup_Mips_GOT_LO16", 0, 16, 0 },
|
||||
{ "fixup_Mips_CALL_HI16", 0, 16, 0 },
|
||||
{ "fixup_Mips_CALL_LO16", 0, 16, 0 }
|
||||
};
|
||||
|
||||
if (Kind < FirstTargetFixupKind)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,13 @@ namespace MipsII {
|
|||
/// MO_HIGHER/HIGHEST - Represents the highest or higher half word of a
|
||||
/// 64-bit symbol address.
|
||||
MO_HIGHER,
|
||||
MO_HIGHEST
|
||||
MO_HIGHEST,
|
||||
|
||||
/// MO_GOT_HI16/LO16, MO_CALL_HI16/LO16 - Relocations used for large GOTs.
|
||||
MO_GOT_HI16,
|
||||
MO_GOT_LO16,
|
||||
MO_CALL_HI16,
|
||||
MO_CALL_LO16
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -179,6 +179,18 @@ unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target,
|
|||
case Mips::fixup_Mips_HIGHEST:
|
||||
Type = ELF::R_MIPS_HIGHEST;
|
||||
break;
|
||||
case Mips::fixup_Mips_GOT_HI16:
|
||||
Type = ELF::R_MIPS_GOT_HI16;
|
||||
break;
|
||||
case Mips::fixup_Mips_GOT_LO16:
|
||||
Type = ELF::R_MIPS_GOT_LO16;
|
||||
break;
|
||||
case Mips::fixup_Mips_CALL_HI16:
|
||||
Type = ELF::R_MIPS_CALL_HI16;
|
||||
break;
|
||||
case Mips::fixup_Mips_CALL_LO16:
|
||||
Type = ELF::R_MIPS_CALL_LO16;
|
||||
break;
|
||||
}
|
||||
return Type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,18 @@ namespace Mips {
|
|||
// resulting in - R_MIPS_HIGHEST
|
||||
fixup_Mips_HIGHEST,
|
||||
|
||||
// resulting in - R_MIPS_GOT_HI16
|
||||
fixup_Mips_GOT_HI16,
|
||||
|
||||
// resulting in - R_MIPS_GOT_LO16
|
||||
fixup_Mips_GOT_LO16,
|
||||
|
||||
// resulting in - R_MIPS_CALL_HI16
|
||||
fixup_Mips_CALL_HI16,
|
||||
|
||||
// resulting in - R_MIPS_CALL_LO16
|
||||
fixup_Mips_CALL_LO16,
|
||||
|
||||
// Marker
|
||||
LastTargetFixupKind,
|
||||
NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
|
||||
|
|
|
|||
|
|
@ -287,6 +287,18 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
|||
case MCSymbolRefExpr::VK_Mips_HIGHEST:
|
||||
FixupKind = Mips::fixup_Mips_HIGHEST;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_HI16:
|
||||
FixupKind = Mips::fixup_Mips_GOT_HI16;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_LO16:
|
||||
FixupKind = Mips::fixup_Mips_GOT_LO16;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_Mips_CALL_HI16:
|
||||
FixupKind = Mips::fixup_Mips_CALL_HI16;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_Mips_CALL_LO16:
|
||||
FixupKind = Mips::fixup_Mips_CALL_LO16;
|
||||
break;
|
||||
} // switch
|
||||
|
||||
Fixups.push_back(MCFixup::Create(0, MO.getExpr(), MCFixupKind(FixupKind)));
|
||||
|
|
|
|||
|
|
@ -255,6 +255,7 @@ def : MipsPat<(MipsHi tblockaddress:$in), (LUi64 tblockaddress:$in)>;
|
|||
def : MipsPat<(MipsHi tjumptable:$in), (LUi64 tjumptable:$in)>;
|
||||
def : MipsPat<(MipsHi tconstpool:$in), (LUi64 tconstpool:$in)>;
|
||||
def : MipsPat<(MipsHi tglobaltlsaddr:$in), (LUi64 tglobaltlsaddr:$in)>;
|
||||
def : MipsPat<(MipsHi texternalsym:$in), (LUi64 texternalsym:$in)>;
|
||||
|
||||
def : MipsPat<(MipsLo tglobaladdr:$in), (DADDiu ZERO_64, tglobaladdr:$in)>;
|
||||
def : MipsPat<(MipsLo tblockaddress:$in), (DADDiu ZERO_64, tblockaddress:$in)>;
|
||||
|
|
@ -262,6 +263,7 @@ def : MipsPat<(MipsLo tjumptable:$in), (DADDiu ZERO_64, tjumptable:$in)>;
|
|||
def : MipsPat<(MipsLo tconstpool:$in), (DADDiu ZERO_64, tconstpool:$in)>;
|
||||
def : MipsPat<(MipsLo tglobaltlsaddr:$in),
|
||||
(DADDiu ZERO_64, tglobaltlsaddr:$in)>;
|
||||
def : MipsPat<(MipsLo texternalsym:$in), (DADDiu ZERO_64, texternalsym:$in)>;
|
||||
|
||||
def : MipsPat<(add CPU64Regs:$hi, (MipsLo tglobaladdr:$lo)),
|
||||
(DADDiu CPU64Regs:$hi, tglobaladdr:$lo)>;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class MipsCodeEmitter : public MachineFunctionPass {
|
|||
|
||||
private:
|
||||
|
||||
void emitWordLE(unsigned Word);
|
||||
void emitWord(unsigned Word);
|
||||
|
||||
/// Routines that handle operands which add machine relocations which are
|
||||
/// fixed up by the relocation stage.
|
||||
|
|
@ -112,12 +112,6 @@ class MipsCodeEmitter : public MachineFunctionPass {
|
|||
unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||
unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||
|
||||
int emitULW(const MachineInstr &MI);
|
||||
int emitUSW(const MachineInstr &MI);
|
||||
int emitULH(const MachineInstr &MI);
|
||||
int emitULHu(const MachineInstr &MI);
|
||||
int emitUSH(const MachineInstr &MI);
|
||||
|
||||
void emitGlobalAddressUnaligned(const GlobalValue *GV, unsigned Reloc,
|
||||
int Offset) const;
|
||||
};
|
||||
|
|
@ -133,7 +127,7 @@ bool MipsCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
|
|||
MCPEs = &MF.getConstantPool()->getConstants();
|
||||
MJTEs = 0;
|
||||
if (MF.getJumpTableInfo()) MJTEs = &MF.getJumpTableInfo()->getJumpTables();
|
||||
JTI->Initialize(MF, IsPIC);
|
||||
JTI->Initialize(MF, IsPIC, Subtarget->isLittle());
|
||||
MCE.setModuleInfo(&getAnalysis<MachineModuleInfo> ());
|
||||
|
||||
do {
|
||||
|
|
@ -271,103 +265,6 @@ void MipsCodeEmitter::emitMachineBasicBlock(MachineBasicBlock *BB,
|
|||
Reloc, BB));
|
||||
}
|
||||
|
||||
int MipsCodeEmitter::emitUSW(const MachineInstr &MI) {
|
||||
unsigned src = getMachineOpValue(MI, MI.getOperand(0));
|
||||
unsigned base = getMachineOpValue(MI, MI.getOperand(1));
|
||||
unsigned offset = getMachineOpValue(MI, MI.getOperand(2));
|
||||
// swr src, offset(base)
|
||||
// swl src, offset+3(base)
|
||||
MCE.emitWordLE(
|
||||
(0x2e << 26) | (base << 21) | (src << 16) | (offset & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x2a << 26) | (base << 21) | (src << 16) | ((offset+3) & 0xffff));
|
||||
return 2;
|
||||
}
|
||||
|
||||
int MipsCodeEmitter::emitULW(const MachineInstr &MI) {
|
||||
unsigned dst = getMachineOpValue(MI, MI.getOperand(0));
|
||||
unsigned base = getMachineOpValue(MI, MI.getOperand(1));
|
||||
unsigned offset = getMachineOpValue(MI, MI.getOperand(2));
|
||||
unsigned at = 1;
|
||||
if (dst != base) {
|
||||
// lwr dst, offset(base)
|
||||
// lwl dst, offset+3(base)
|
||||
MCE.emitWordLE(
|
||||
(0x26 << 26) | (base << 21) | (dst << 16) | (offset & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x22 << 26) | (base << 21) | (dst << 16) | ((offset+3) & 0xffff));
|
||||
return 2;
|
||||
} else {
|
||||
// lwr at, offset(base)
|
||||
// lwl at, offset+3(base)
|
||||
// addu dst, at, $zero
|
||||
MCE.emitWordLE(
|
||||
(0x26 << 26) | (base << 21) | (at << 16) | (offset & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x22 << 26) | (base << 21) | (at << 16) | ((offset+3) & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x0 << 26) | (at << 21) | (0x0 << 16) | (dst << 11) | (0x0 << 6) | 0x21);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
int MipsCodeEmitter::emitUSH(const MachineInstr &MI) {
|
||||
unsigned src = getMachineOpValue(MI, MI.getOperand(0));
|
||||
unsigned base = getMachineOpValue(MI, MI.getOperand(1));
|
||||
unsigned offset = getMachineOpValue(MI, MI.getOperand(2));
|
||||
unsigned at = 1;
|
||||
// sb src, offset(base)
|
||||
// srl at,src,8
|
||||
// sb at, offset+1(base)
|
||||
MCE.emitWordLE(
|
||||
(0x28 << 26) | (base << 21) | (src << 16) | (offset & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x0 << 26) | (0x0 << 21) | (src << 16) | (at << 11) | (0x8 << 6) | 0x2);
|
||||
MCE.emitWordLE(
|
||||
(0x28 << 26) | (base << 21) | (at << 16) | ((offset+1) & 0xffff));
|
||||
return 3;
|
||||
}
|
||||
|
||||
int MipsCodeEmitter::emitULH(const MachineInstr &MI) {
|
||||
unsigned dst = getMachineOpValue(MI, MI.getOperand(0));
|
||||
unsigned base = getMachineOpValue(MI, MI.getOperand(1));
|
||||
unsigned offset = getMachineOpValue(MI, MI.getOperand(2));
|
||||
unsigned at = 1;
|
||||
// lbu at, offset(base)
|
||||
// lb dst, offset+1(base)
|
||||
// sll dst,dst,8
|
||||
// or dst,dst,at
|
||||
MCE.emitWordLE(
|
||||
(0x24 << 26) | (base << 21) | (at << 16) | (offset & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x20 << 26) | (base << 21) | (dst << 16) | ((offset+1) & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x0 << 26) | (0x0 << 21) | (dst << 16) | (dst << 11) | (0x8 << 6) | 0x0);
|
||||
MCE.emitWordLE(
|
||||
(0x0 << 26) | (dst << 21) | (at << 16) | (dst << 11) | (0x0 << 6) | 0x25);
|
||||
return 4;
|
||||
}
|
||||
|
||||
int MipsCodeEmitter::emitULHu(const MachineInstr &MI) {
|
||||
unsigned dst = getMachineOpValue(MI, MI.getOperand(0));
|
||||
unsigned base = getMachineOpValue(MI, MI.getOperand(1));
|
||||
unsigned offset = getMachineOpValue(MI, MI.getOperand(2));
|
||||
unsigned at = 1;
|
||||
// lbu at, offset(base)
|
||||
// lbu dst, offset+1(base)
|
||||
// sll dst,dst,8
|
||||
// or dst,dst,at
|
||||
MCE.emitWordLE(
|
||||
(0x24 << 26) | (base << 21) | (at << 16) | (offset & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x24 << 26) | (base << 21) | (dst << 16) | ((offset+1) & 0xffff));
|
||||
MCE.emitWordLE(
|
||||
(0x0 << 26) | (0x0 << 21) | (dst << 16) | (dst << 11) | (0x8 << 6) | 0x0);
|
||||
MCE.emitWordLE(
|
||||
(0x0 << 26) | (dst << 21) | (at << 16) | (dst << 11) | (0x0 << 6) | 0x25);
|
||||
return 4;
|
||||
}
|
||||
|
||||
void MipsCodeEmitter::emitInstruction(const MachineInstr &MI) {
|
||||
DEBUG(errs() << "JIT: " << (void*)MCE.getCurrentPCValue() << ":\t" << MI);
|
||||
|
||||
|
|
@ -377,16 +274,19 @@ void MipsCodeEmitter::emitInstruction(const MachineInstr &MI) {
|
|||
if ((MI.getDesc().TSFlags & MipsII::FormMask) == MipsII::Pseudo)
|
||||
return;
|
||||
|
||||
emitWordLE(getBinaryCodeForInstr(MI));
|
||||
emitWord(getBinaryCodeForInstr(MI));
|
||||
++NumEmitted; // Keep track of the # of mi's emitted
|
||||
|
||||
MCE.processDebugLoc(MI.getDebugLoc(), false);
|
||||
}
|
||||
|
||||
void MipsCodeEmitter::emitWordLE(unsigned Word) {
|
||||
void MipsCodeEmitter::emitWord(unsigned Word) {
|
||||
DEBUG(errs() << " 0x";
|
||||
errs().write_hex(Word) << "\n");
|
||||
MCE.emitWordLE(Word);
|
||||
if (Subtarget->isLittle())
|
||||
MCE.emitWordLE(Word);
|
||||
else
|
||||
MCE.emitWordBE(Word);
|
||||
}
|
||||
|
||||
/// createMipsJITCodeEmitterPass - Return a pass that emits the collected Mips
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ static cl::opt<bool>
|
|||
EnableMipsTailCalls("enable-mips-tail-calls", cl::Hidden,
|
||||
cl::desc("MIPS: Enable tail calls."), cl::init(false));
|
||||
|
||||
static cl::opt<bool>
|
||||
LargeGOT("mxgot", cl::Hidden,
|
||||
cl::desc("MIPS: Enable GOT larger than 64k."), cl::init(false));
|
||||
|
||||
static const uint16_t O32IntRegs[4] = {
|
||||
Mips::A0, Mips::A1, Mips::A2, Mips::A3
|
||||
};
|
||||
|
|
@ -77,6 +81,71 @@ static SDValue GetGlobalReg(SelectionDAG &DAG, EVT Ty) {
|
|||
return DAG.getRegister(FI->getGlobalBaseReg(), Ty);
|
||||
}
|
||||
|
||||
static SDValue getTargetNode(SDValue Op, SelectionDAG &DAG, unsigned Flag) {
|
||||
EVT Ty = Op.getValueType();
|
||||
|
||||
if (GlobalAddressSDNode *N = dyn_cast<GlobalAddressSDNode>(Op))
|
||||
return DAG.getTargetGlobalAddress(N->getGlobal(), Op.getDebugLoc(), Ty, 0,
|
||||
Flag);
|
||||
if (ExternalSymbolSDNode *N = dyn_cast<ExternalSymbolSDNode>(Op))
|
||||
return DAG.getTargetExternalSymbol(N->getSymbol(), Ty, Flag);
|
||||
if (BlockAddressSDNode *N = dyn_cast<BlockAddressSDNode>(Op))
|
||||
return DAG.getTargetBlockAddress(N->getBlockAddress(), Ty, 0, Flag);
|
||||
if (JumpTableSDNode *N = dyn_cast<JumpTableSDNode>(Op))
|
||||
return DAG.getTargetJumpTable(N->getIndex(), Ty, Flag);
|
||||
if (ConstantPoolSDNode *N = dyn_cast<ConstantPoolSDNode>(Op))
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(),
|
||||
N->getOffset(), Flag);
|
||||
|
||||
llvm_unreachable("Unexpected node type.");
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
static SDValue getAddrNonPIC(SDValue Op, SelectionDAG &DAG) {
|
||||
DebugLoc DL = Op.getDebugLoc();
|
||||
EVT Ty = Op.getValueType();
|
||||
SDValue Hi = getTargetNode(Op, DAG, MipsII::MO_ABS_HI);
|
||||
SDValue Lo = getTargetNode(Op, DAG, MipsII::MO_ABS_LO);
|
||||
return DAG.getNode(ISD::ADD, DL, Ty,
|
||||
DAG.getNode(MipsISD::Hi, DL, Ty, Hi),
|
||||
DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
|
||||
}
|
||||
|
||||
static SDValue getAddrLocal(SDValue Op, SelectionDAG &DAG, bool HasMips64) {
|
||||
DebugLoc DL = Op.getDebugLoc();
|
||||
EVT Ty = Op.getValueType();
|
||||
unsigned GOTFlag = HasMips64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
|
||||
SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, GetGlobalReg(DAG, Ty),
|
||||
getTargetNode(Op, DAG, GOTFlag));
|
||||
SDValue Load = DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
|
||||
MachinePointerInfo::getGOT(), false, false, false,
|
||||
0);
|
||||
unsigned LoFlag = HasMips64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty, getTargetNode(Op, DAG, LoFlag));
|
||||
return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
|
||||
}
|
||||
|
||||
static SDValue getAddrGlobal(SDValue Op, SelectionDAG &DAG, unsigned Flag) {
|
||||
DebugLoc DL = Op.getDebugLoc();
|
||||
EVT Ty = Op.getValueType();
|
||||
SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, GetGlobalReg(DAG, Ty),
|
||||
getTargetNode(Op, DAG, Flag));
|
||||
return DAG.getLoad(Ty, DL, DAG.getEntryNode(), Tgt,
|
||||
MachinePointerInfo::getGOT(), false, false, false, 0);
|
||||
}
|
||||
|
||||
static SDValue getAddrGlobalLargeGOT(SDValue Op, SelectionDAG &DAG,
|
||||
unsigned HiFlag, unsigned LoFlag) {
|
||||
DebugLoc DL = Op.getDebugLoc();
|
||||
EVT Ty = Op.getValueType();
|
||||
SDValue Hi = DAG.getNode(MipsISD::Hi, DL, Ty, getTargetNode(Op, DAG, HiFlag));
|
||||
Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, GetGlobalReg(DAG, Ty));
|
||||
SDValue Wrapper = DAG.getNode(MipsISD::Wrapper, DL, Ty, Hi,
|
||||
getTargetNode(Op, DAG, LoFlag));
|
||||
return DAG.getLoad(Ty, DL, DAG.getEntryNode(), Wrapper,
|
||||
MachinePointerInfo::getGOT(), false, false, false, 0);
|
||||
}
|
||||
|
||||
const char *MipsTargetLowering::getTargetNodeName(unsigned Opcode) const {
|
||||
switch (Opcode) {
|
||||
case MipsISD::JmpLink: return "MipsISD::JmpLink";
|
||||
|
|
@ -1743,8 +1812,6 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op,
|
|||
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
|
||||
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64) {
|
||||
SDVTList VTs = DAG.getVTList(MVT::i32);
|
||||
|
||||
const MipsTargetObjectFile &TLOF =
|
||||
(const MipsTargetObjectFile&)getObjFileLowering();
|
||||
|
||||
|
|
@ -1752,69 +1819,33 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op,
|
|||
if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) {
|
||||
SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
|
||||
MipsII::MO_GPREL);
|
||||
SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl, VTs, &GA, 1);
|
||||
SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl,
|
||||
DAG.getVTList(MVT::i32), &GA, 1);
|
||||
SDValue GPReg = DAG.getRegister(Mips::GP, MVT::i32);
|
||||
return DAG.getNode(ISD::ADD, dl, MVT::i32, GPReg, GPRelNode);
|
||||
}
|
||||
|
||||
// %hi/%lo relocation
|
||||
SDValue GAHi = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
|
||||
MipsII::MO_ABS_HI);
|
||||
SDValue GALo = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
|
||||
MipsII::MO_ABS_LO);
|
||||
SDValue HiPart = DAG.getNode(MipsISD::Hi, dl, VTs, &GAHi, 1);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, GALo);
|
||||
return DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo);
|
||||
return getAddrNonPIC(Op, DAG);
|
||||
}
|
||||
|
||||
EVT ValTy = Op.getValueType();
|
||||
bool HasGotOfst = (GV->hasInternalLinkage() ||
|
||||
(GV->hasLocalLinkage() && !isa<Function>(GV)));
|
||||
unsigned GotFlag = HasMips64 ?
|
||||
(HasGotOfst ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT_DISP) :
|
||||
(HasGotOfst ? MipsII::MO_GOT : MipsII::MO_GOT16);
|
||||
SDValue GA = DAG.getTargetGlobalAddress(GV, dl, ValTy, 0, GotFlag);
|
||||
GA = DAG.getNode(MipsISD::Wrapper, dl, ValTy, GetGlobalReg(DAG, ValTy), GA);
|
||||
SDValue ResNode = DAG.getLoad(ValTy, dl, DAG.getEntryNode(), GA,
|
||||
MachinePointerInfo(), false, false, false, 0);
|
||||
// On functions and global targets not internal linked only
|
||||
// a load from got/GP is necessary for PIC to work.
|
||||
if (!HasGotOfst)
|
||||
return ResNode;
|
||||
SDValue GALo = DAG.getTargetGlobalAddress(GV, dl, ValTy, 0,
|
||||
HasMips64 ? MipsII::MO_GOT_OFST :
|
||||
MipsII::MO_ABS_LO);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, ValTy, GALo);
|
||||
return DAG.getNode(ISD::ADD, dl, ValTy, ResNode, Lo);
|
||||
if (GV->hasInternalLinkage() || (GV->hasLocalLinkage() && !isa<Function>(GV)))
|
||||
return getAddrLocal(Op, DAG, HasMips64);
|
||||
|
||||
if (LargeGOT)
|
||||
return getAddrGlobalLargeGOT(Op, DAG, MipsII::MO_GOT_HI16,
|
||||
MipsII::MO_GOT_LO16);
|
||||
|
||||
return getAddrGlobal(Op, DAG,
|
||||
HasMips64 ? MipsII::MO_GOT_DISP : MipsII::MO_GOT16);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::LowerBlockAddress(SDValue Op,
|
||||
SelectionDAG &DAG) const {
|
||||
const BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
|
||||
// FIXME there isn't actually debug info here
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
|
||||
return getAddrNonPIC(Op, DAG);
|
||||
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64) {
|
||||
// %hi/%lo relocation
|
||||
SDValue BAHi =
|
||||
DAG.getTargetBlockAddress(BA, MVT::i32, 0, MipsII::MO_ABS_HI);
|
||||
SDValue BALo =
|
||||
DAG.getTargetBlockAddress(BA, MVT::i32, 0, MipsII::MO_ABS_LO);
|
||||
SDValue Hi = DAG.getNode(MipsISD::Hi, dl, MVT::i32, BAHi);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, BALo);
|
||||
return DAG.getNode(ISD::ADD, dl, MVT::i32, Hi, Lo);
|
||||
}
|
||||
|
||||
EVT ValTy = Op.getValueType();
|
||||
unsigned GOTFlag = HasMips64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
|
||||
unsigned OFSTFlag = HasMips64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
|
||||
SDValue BAGOTOffset = DAG.getTargetBlockAddress(BA, ValTy, 0, GOTFlag);
|
||||
BAGOTOffset = DAG.getNode(MipsISD::Wrapper, dl, ValTy,
|
||||
GetGlobalReg(DAG, ValTy), BAGOTOffset);
|
||||
SDValue BALOOffset = DAG.getTargetBlockAddress(BA, ValTy, 0, OFSTFlag);
|
||||
SDValue Load = DAG.getLoad(ValTy, dl, DAG.getEntryNode(), BAGOTOffset,
|
||||
MachinePointerInfo(), false, false, false, 0);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, ValTy, BALOOffset);
|
||||
return DAG.getNode(ISD::ADD, dl, ValTy, Load, Lo);
|
||||
return getAddrLocal(Op, DAG, HasMips64);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::
|
||||
|
|
@ -1901,41 +1932,15 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
|
|||
SDValue MipsTargetLowering::
|
||||
LowerJumpTable(SDValue Op, SelectionDAG &DAG) const
|
||||
{
|
||||
SDValue HiPart, JTI, JTILo;
|
||||
// FIXME there isn't actually debug info here
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;
|
||||
EVT PtrVT = Op.getValueType();
|
||||
JumpTableSDNode *JT = cast<JumpTableSDNode>(Op);
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
|
||||
return getAddrNonPIC(Op, DAG);
|
||||
|
||||
if (!IsPIC && !IsN64) {
|
||||
JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MipsII::MO_ABS_HI);
|
||||
HiPart = DAG.getNode(MipsISD::Hi, dl, PtrVT, JTI);
|
||||
JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MipsII::MO_ABS_LO);
|
||||
} else {// Emit Load from Global Pointer
|
||||
unsigned GOTFlag = HasMips64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
|
||||
unsigned OfstFlag = HasMips64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
|
||||
JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, GOTFlag);
|
||||
JTI = DAG.getNode(MipsISD::Wrapper, dl, PtrVT, GetGlobalReg(DAG, PtrVT),
|
||||
JTI);
|
||||
HiPart = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), JTI,
|
||||
MachinePointerInfo(), false, false, false, 0);
|
||||
JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OfstFlag);
|
||||
}
|
||||
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, PtrVT, JTILo);
|
||||
return DAG.getNode(ISD::ADD, dl, PtrVT, HiPart, Lo);
|
||||
return getAddrLocal(Op, DAG, HasMips64);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::
|
||||
LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
|
||||
{
|
||||
SDValue ResNode;
|
||||
ConstantPoolSDNode *N = cast<ConstantPoolSDNode>(Op);
|
||||
const Constant *C = N->getConstVal();
|
||||
// FIXME there isn't actually debug info here
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
|
||||
// gp_rel relocation
|
||||
// FIXME: we should reference the constant pool using small data sections,
|
||||
// but the asm printer currently doesn't support this feature without
|
||||
|
|
@ -1946,31 +1951,10 @@ LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
|
|||
// SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(MVT::i32);
|
||||
// ResNode = DAG.getNode(ISD::ADD, MVT::i32, GOT, GPRelNode);
|
||||
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64) {
|
||||
SDValue CPHi = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(),
|
||||
N->getOffset(), MipsII::MO_ABS_HI);
|
||||
SDValue CPLo = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(),
|
||||
N->getOffset(), MipsII::MO_ABS_LO);
|
||||
SDValue HiPart = DAG.getNode(MipsISD::Hi, dl, MVT::i32, CPHi);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, CPLo);
|
||||
ResNode = DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo);
|
||||
} else {
|
||||
EVT ValTy = Op.getValueType();
|
||||
unsigned GOTFlag = HasMips64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
|
||||
unsigned OFSTFlag = HasMips64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
|
||||
SDValue CP = DAG.getTargetConstantPool(C, ValTy, N->getAlignment(),
|
||||
N->getOffset(), GOTFlag);
|
||||
CP = DAG.getNode(MipsISD::Wrapper, dl, ValTy, GetGlobalReg(DAG, ValTy), CP);
|
||||
SDValue Load = DAG.getLoad(ValTy, dl, DAG.getEntryNode(), CP,
|
||||
MachinePointerInfo::getConstantPool(), false,
|
||||
false, false, 0);
|
||||
SDValue CPLo = DAG.getTargetConstantPool(C, ValTy, N->getAlignment(),
|
||||
N->getOffset(), OFSTFlag);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, ValTy, CPLo);
|
||||
ResNode = DAG.getNode(ISD::ADD, dl, ValTy, Load, Lo);
|
||||
}
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
|
||||
return getAddrNonPIC(Op, DAG);
|
||||
|
||||
return ResNode;
|
||||
return getAddrLocal(Op, DAG, HasMips64);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG) const {
|
||||
|
|
@ -2862,60 +2846,41 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
|||
// If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
|
||||
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
|
||||
// node so that legalize doesn't hack it.
|
||||
unsigned char OpFlag;
|
||||
bool IsPICCall = (IsN64 || IsPIC); // true if calls are translated to jalr $25
|
||||
bool GlobalOrExternal = false;
|
||||
SDValue CalleeLo;
|
||||
|
||||
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
|
||||
if (IsPICCall && G->getGlobal()->hasInternalLinkage()) {
|
||||
OpFlag = IsO32 ? MipsII::MO_GOT : MipsII::MO_GOT_PAGE;
|
||||
unsigned char LoFlag = IsO32 ? MipsII::MO_ABS_LO : MipsII::MO_GOT_OFST;
|
||||
if (IsPICCall) {
|
||||
if (G->getGlobal()->hasInternalLinkage())
|
||||
Callee = getAddrLocal(Callee, DAG, HasMips64);
|
||||
else if (LargeGOT)
|
||||
Callee = getAddrGlobalLargeGOT(Callee, DAG, MipsII::MO_CALL_HI16,
|
||||
MipsII::MO_CALL_LO16);
|
||||
else
|
||||
Callee = getAddrGlobal(Callee, DAG, MipsII::MO_GOT_CALL);
|
||||
} else
|
||||
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl, getPointerTy(), 0,
|
||||
OpFlag);
|
||||
CalleeLo = DAG.getTargetGlobalAddress(G->getGlobal(), dl, getPointerTy(),
|
||||
0, LoFlag);
|
||||
} else {
|
||||
OpFlag = IsPICCall ? MipsII::MO_GOT_CALL : MipsII::MO_NO_FLAG;
|
||||
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl,
|
||||
getPointerTy(), 0, OpFlag);
|
||||
}
|
||||
|
||||
MipsII::MO_NO_FLAG);
|
||||
GlobalOrExternal = true;
|
||||
}
|
||||
else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
|
||||
if (IsN64 || (!IsO32 && IsPIC))
|
||||
OpFlag = MipsII::MO_GOT_DISP;
|
||||
else if (!IsPIC) // !N64 && static
|
||||
OpFlag = MipsII::MO_NO_FLAG;
|
||||
if (!IsN64 && !IsPIC) // !N64 && static
|
||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy(),
|
||||
MipsII::MO_NO_FLAG);
|
||||
else if (LargeGOT)
|
||||
Callee = getAddrGlobalLargeGOT(Callee, DAG, MipsII::MO_CALL_HI16,
|
||||
MipsII::MO_CALL_LO16);
|
||||
else if (HasMips64)
|
||||
Callee = getAddrGlobal(Callee, DAG, MipsII::MO_GOT_DISP);
|
||||
else // O32 & PIC
|
||||
OpFlag = MipsII::MO_GOT_CALL;
|
||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy(),
|
||||
OpFlag);
|
||||
Callee = getAddrGlobal(Callee, DAG, MipsII::MO_GOT_CALL);
|
||||
|
||||
GlobalOrExternal = true;
|
||||
}
|
||||
|
||||
SDValue InFlag;
|
||||
|
||||
// Create nodes that load address of callee and copy it to T9
|
||||
if (IsPICCall) {
|
||||
if (GlobalOrExternal) {
|
||||
// Load callee address
|
||||
Callee = DAG.getNode(MipsISD::Wrapper, dl, getPointerTy(),
|
||||
GetGlobalReg(DAG, getPointerTy()), Callee);
|
||||
SDValue LoadValue = DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
|
||||
Callee, MachinePointerInfo::getGOT(),
|
||||
false, false, false, 0);
|
||||
|
||||
// Use GOT+LO if callee has internal linkage.
|
||||
if (CalleeLo.getNode()) {
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, getPointerTy(), CalleeLo);
|
||||
Callee = DAG.getNode(ISD::ADD, dl, getPointerTy(), LoadValue, Lo);
|
||||
} else
|
||||
Callee = LoadValue;
|
||||
}
|
||||
}
|
||||
|
||||
// T9 register operand.
|
||||
SDValue T9;
|
||||
|
||||
|
|
|
|||
|
|
@ -1154,12 +1154,14 @@ def : MipsPat<(MipsHi tblockaddress:$in), (LUi tblockaddress:$in)>;
|
|||
def : MipsPat<(MipsHi tjumptable:$in), (LUi tjumptable:$in)>;
|
||||
def : MipsPat<(MipsHi tconstpool:$in), (LUi tconstpool:$in)>;
|
||||
def : MipsPat<(MipsHi tglobaltlsaddr:$in), (LUi tglobaltlsaddr:$in)>;
|
||||
def : MipsPat<(MipsHi texternalsym:$in), (LUi texternalsym:$in)>;
|
||||
|
||||
def : MipsPat<(MipsLo tglobaladdr:$in), (ADDiu ZERO, tglobaladdr:$in)>;
|
||||
def : MipsPat<(MipsLo tblockaddress:$in), (ADDiu ZERO, tblockaddress:$in)>;
|
||||
def : MipsPat<(MipsLo tjumptable:$in), (ADDiu ZERO, tjumptable:$in)>;
|
||||
def : MipsPat<(MipsLo tconstpool:$in), (ADDiu ZERO, tconstpool:$in)>;
|
||||
def : MipsPat<(MipsLo tglobaltlsaddr:$in), (ADDiu ZERO, tglobaltlsaddr:$in)>;
|
||||
def : MipsPat<(MipsLo texternalsym:$in), (ADDiu ZERO, texternalsym:$in)>;
|
||||
|
||||
def : MipsPat<(add CPURegs:$hi, (MipsLo tglobaladdr:$lo)),
|
||||
(ADDiu CPURegs:$hi, tglobaladdr:$lo)>;
|
||||
|
|
|
|||
|
|
@ -222,10 +222,17 @@ void *MipsJITInfo::emitFunctionStub(const Function *F, void *Fn,
|
|||
// addiu t9, t9, %lo(EmittedAddr)
|
||||
// jalr t8, t9
|
||||
// nop
|
||||
JCE.emitWordLE(0xf << 26 | 25 << 16 | Hi);
|
||||
JCE.emitWordLE(9 << 26 | 25 << 21 | 25 << 16 | Lo);
|
||||
JCE.emitWordLE(25 << 21 | 24 << 11 | 9);
|
||||
JCE.emitWordLE(0);
|
||||
if (IsLittleEndian) {
|
||||
JCE.emitWordLE(0xf << 26 | 25 << 16 | Hi);
|
||||
JCE.emitWordLE(9 << 26 | 25 << 21 | 25 << 16 | Lo);
|
||||
JCE.emitWordLE(25 << 21 | 24 << 11 | 9);
|
||||
JCE.emitWordLE(0);
|
||||
} else {
|
||||
JCE.emitWordBE(0xf << 26 | 25 << 16 | Hi);
|
||||
JCE.emitWordBE(9 << 26 | 25 << 21 | 25 << 16 | Lo);
|
||||
JCE.emitWordBE(25 << 21 | 24 << 11 | 9);
|
||||
JCE.emitWordBE(0);
|
||||
}
|
||||
|
||||
sys::Memory::InvalidateInstructionCache(Addr, 16);
|
||||
if (!sys::Memory::setRangeExecutable(Addr, 16))
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@ class MipsTargetMachine;
|
|||
class MipsJITInfo : public TargetJITInfo {
|
||||
|
||||
bool IsPIC;
|
||||
bool IsLittleEndian;
|
||||
|
||||
public:
|
||||
explicit MipsJITInfo() :
|
||||
IsPIC(false) {}
|
||||
IsPIC(false), IsLittleEndian(true) {}
|
||||
|
||||
/// replaceMachineCodeForFunction - Make it so that calling the function
|
||||
/// whose machine code is at OLD turns into a call to NEW, perhaps by
|
||||
|
|
@ -58,8 +59,10 @@ class MipsJITInfo : public TargetJITInfo {
|
|||
unsigned NumRelocs, unsigned char *GOTBase);
|
||||
|
||||
/// Initialize - Initialize internal stage for the function being JITted.
|
||||
void Initialize(const MachineFunction &MF, bool isPIC) {
|
||||
void Initialize(const MachineFunction &MF, bool isPIC,
|
||||
bool isLittleEndian) {
|
||||
IsPIC = isPIC;
|
||||
IsLittleEndian = isLittleEndian;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ MCOperand MipsMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
|||
case MipsII::MO_GOT_OFST: Kind = MCSymbolRefExpr::VK_Mips_GOT_OFST; break;
|
||||
case MipsII::MO_HIGHER: Kind = MCSymbolRefExpr::VK_Mips_HIGHER; break;
|
||||
case MipsII::MO_HIGHEST: Kind = MCSymbolRefExpr::VK_Mips_HIGHEST; break;
|
||||
case MipsII::MO_GOT_HI16: Kind = MCSymbolRefExpr::VK_Mips_GOT_HI16; break;
|
||||
case MipsII::MO_GOT_LO16: Kind = MCSymbolRefExpr::VK_Mips_GOT_LO16; break;
|
||||
case MipsII::MO_CALL_HI16: Kind = MCSymbolRefExpr::VK_Mips_CALL_HI16; break;
|
||||
case MipsII::MO_CALL_LO16: Kind = MCSymbolRefExpr::VK_Mips_CALL_LO16; break;
|
||||
}
|
||||
|
||||
switch (MOTy) {
|
||||
|
|
|
|||
|
|
@ -2160,6 +2160,9 @@ static bool isIntegerWideningViable(const DataLayout &TD,
|
|||
AllocaPartitioning::const_use_iterator I,
|
||||
AllocaPartitioning::const_use_iterator E) {
|
||||
uint64_t SizeInBits = TD.getTypeSizeInBits(AllocaTy);
|
||||
// Don't create integer types larger than the maximum bitwidth.
|
||||
if (SizeInBits > IntegerType::MAX_INT_BITS)
|
||||
return false;
|
||||
|
||||
// Don't try to handle allocas with bit-padding.
|
||||
if (SizeInBits != TD.getTypeStoreSizeInBits(AllocaTy))
|
||||
|
|
@ -2198,7 +2201,7 @@ static bool isIntegerWideningViable(const DataLayout &TD,
|
|||
if (RelBegin == 0 && RelEnd == Size)
|
||||
WholeAllocaOp = true;
|
||||
if (IntegerType *ITy = dyn_cast<IntegerType>(LI->getType())) {
|
||||
if (ITy->getBitWidth() < TD.getTypeStoreSize(ITy))
|
||||
if (ITy->getBitWidth() < TD.getTypeStoreSizeInBits(ITy))
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2214,7 +2217,7 @@ static bool isIntegerWideningViable(const DataLayout &TD,
|
|||
if (RelBegin == 0 && RelEnd == Size)
|
||||
WholeAllocaOp = true;
|
||||
if (IntegerType *ITy = dyn_cast<IntegerType>(ValueTy)) {
|
||||
if (ITy->getBitWidth() < TD.getTypeStoreSize(ITy))
|
||||
if (ITy->getBitWidth() < TD.getTypeStoreSizeInBits(ITy))
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,11 +84,18 @@ public:
|
|||
/// TryScope - This is the scope of a C++ try statement.
|
||||
TryScope = 0x1000,
|
||||
|
||||
/// CatchScope - This is the scope of a C++ catch statement.
|
||||
CatchScope = 0x2000,
|
||||
|
||||
/// FnTryCatchScope - This is the scope for a function-level C++ try or
|
||||
/// catch scope.
|
||||
FnTryCatchScope = 0x4000,
|
||||
|
||||
/// FnTryScope - This is the scope of a function-level C++ try scope.
|
||||
FnTryScope = 0x3000,
|
||||
FnTryScope = TryScope | FnTryCatchScope,
|
||||
|
||||
/// FnCatchScope - This is the scope of a function-level C++ catch scope.
|
||||
FnCatchScope = 0x4000
|
||||
FnCatchScope = CatchScope | FnTryCatchScope
|
||||
};
|
||||
private:
|
||||
/// The parent scope for this scope. This is null for the translation-unit
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ std::string getClangRepositoryPath() {
|
|||
|
||||
// If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
|
||||
// pick up a tag in an SVN export, for example.
|
||||
static StringRef SVNRepository("$URL: http://llvm.org/svn/llvm-project/cfe/branches/release_32/lib/Basic/Version.cpp $");
|
||||
static StringRef SVNRepository("$URL: http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final/lib/Basic/Version.cpp $");
|
||||
if (URL.empty()) {
|
||||
URL = SVNRepository.slice(SVNRepository.find(':'),
|
||||
SVNRepository.find("/lib/Basic"));
|
||||
|
|
|
|||
|
|
@ -1855,6 +1855,8 @@ enum LinuxDistro {
|
|||
UbuntuNatty,
|
||||
UbuntuOneiric,
|
||||
UbuntuPrecise,
|
||||
UbuntuQuantal,
|
||||
UbuntuRaring,
|
||||
UnknownDistro
|
||||
};
|
||||
|
||||
|
|
@ -1872,7 +1874,7 @@ static bool IsDebian(enum LinuxDistro Distro) {
|
|||
}
|
||||
|
||||
static bool IsUbuntu(enum LinuxDistro Distro) {
|
||||
return Distro >= UbuntuHardy && Distro <= UbuntuPrecise;
|
||||
return Distro >= UbuntuHardy && Distro <= UbuntuRaring;
|
||||
}
|
||||
|
||||
static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
|
||||
|
|
@ -1894,6 +1896,8 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
|
|||
.Case("natty", UbuntuNatty)
|
||||
.Case("oneiric", UbuntuOneiric)
|
||||
.Case("precise", UbuntuPrecise)
|
||||
.Case("quantal", UbuntuQuantal)
|
||||
.Case("raring", UbuntuRaring)
|
||||
.Default(UnknownDistro);
|
||||
return Version;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -706,8 +706,7 @@ SourceLocation Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
|
|||
if (SkipUntil(tok::r_paren, /*StopAtSemi=*/true, /*DontConsume=*/true)) {
|
||||
EndLoc = ConsumeParen();
|
||||
} else {
|
||||
assert(Tok.is(tok::semi));
|
||||
if (PP.isBacktrackEnabled()) {
|
||||
if (PP.isBacktrackEnabled() && Tok.is(tok::semi)) {
|
||||
// Backtrack to get the location of the last token before the semi.
|
||||
PP.RevertCachedTokens(2);
|
||||
ConsumeToken(); // the semi.
|
||||
|
|
|
|||
|
|
@ -2197,7 +2197,7 @@ StmtResult Parser::ParseCXXCatchBlock(bool FnCatch) {
|
|||
// The name in a catch exception-declaration is local to the handler and
|
||||
// shall not be redeclared in the outermost block of the handler.
|
||||
ParseScope CatchScope(this, Scope::DeclScope | Scope::ControlScope |
|
||||
(FnCatch ? Scope::FnCatchScope : 0));
|
||||
(FnCatch ? Scope::FnCatchScope : Scope::CatchScope));
|
||||
|
||||
// exception-declaration is equivalent to '...' or a parameter-declaration
|
||||
// without default arguments.
|
||||
|
|
|
|||
|
|
@ -135,16 +135,13 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
|
|||
// of the controlled statement.
|
||||
//
|
||||
assert(S->getParent() && "No TUScope?");
|
||||
if (S->getFlags() & Scope::FnTryScope)
|
||||
return S->getParent()->isDeclScope(D);
|
||||
if (S->getParent()->getFlags() & Scope::ControlScope) {
|
||||
if (S->getParent()->getFlags() & Scope::FnCatchScope) {
|
||||
S = S->getParent();
|
||||
if (S->isDeclScope(D))
|
||||
return true;
|
||||
}
|
||||
return S->getParent()->isDeclScope(D);
|
||||
S = S->getParent();
|
||||
if (S->isDeclScope(D))
|
||||
return true;
|
||||
}
|
||||
if (S->getFlags() & Scope::FnTryCatchScope)
|
||||
return S->getParent()->isDeclScope(D);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
#define CLANG_VERSION_MINOR 2
|
||||
|
||||
#define CLANG_VENDOR "FreeBSD "
|
||||
#define CLANG_VENDOR_SUFFIX " 20121130"
|
||||
#define CLANG_VENDOR_SUFFIX " 20121221"
|
||||
|
||||
#define SVN_REVISION "168974"
|
||||
#define SVN_REVISION "170710"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
.\" $FreeBSD$
|
||||
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
|
||||
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20)
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ========================================================================
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "CLANG 1"
|
||||
.TH CLANG 1 "2012-08-09" "clang 3.2" "Clang Tools Documentation"
|
||||
.TH CLANG 1 "2012-12-21" "clang 3.2" "Clang Tools Documentation"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||
.\" way too many mistakes in technical documents.
|
||||
.if n .ad l
|
||||
|
|
@ -231,8 +231,8 @@ Treat subsequent input files as having type \fIlanguage\fR.
|
|||
.IP "\fB\-std\fR=\fIlanguage\fR" 4
|
||||
.IX Item "-std=language"
|
||||
Specify the language standard to compile for.
|
||||
.IP "\fB\-stdlib\fR=\fIlanguage\fR" 4
|
||||
.IX Item "-stdlib=language"
|
||||
.IP "\fB\-stdlib\fR=\fIlibrary\fR" 4
|
||||
.IX Item "-stdlib=library"
|
||||
Specify the \*(C+ standard library to use; supported options are libstdc++ and
|
||||
libc++.
|
||||
.IP "\fB\-ansi\fR" 4
|
||||
|
|
|
|||
Loading…
Reference in a new issue