From lhames at gmail.com Mon Aug 10 00:28:35 2009
From: lhames at gmail.com (Lang Hames)
Date: Sun, 9 Aug 2009 22:28:35 -0700
Subject: [llvm-commits] [llvm] r78354 - in /llvm/trunk/lib/CodeGen:
PBQP.cpp PBQP.h PBQP/ PBQP/AnnotatedGraph.h
PBQP/ExhaustiveSolver.h PBQP/GraphBase.h
PBQP/GraphGenerator.h PBQP/HeuristicSolver.h PBQP/Heuristics/
PBQP/Heuristics/Briggs.h PBQP/PBQPMath.h
Message-ID: <728927c70908092228q7b654ba6j6c5f8cb6fb8de268@mail.gmail.com>
On Sun, Aug 9, 2009 at 9:52 PM, Evan Cheng wrote:
> I somehow doubt PBQP is very good fit for a single register target.
No I don't think so. I certainly appreciate the test case though. Any
feedback I can get as I try to improve the allocator is welcome.
Thanks Sanjiv.
Cheers,
Lang.
From evan.cheng at apple.com Mon Aug 10 00:49:43 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 05:49:43 -0000
Subject: [llvm-commits] [llvm] r78556 -
/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp
Message-ID: <200908100549.n7A5nhDG001110@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 00:49:43 2009
New Revision: 78556
URL: http://llvm.org/viewvc/llvm-project?rev=78556&view=rev
Log:
Use tMOVgpr2gpr instead of t2MOVr.
Modified:
llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=78556&r1=78555&r2=78556&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Mon Aug 10 00:49:43 2009
@@ -1297,10 +1297,13 @@
ARMCC::AL, 0, TII);
} else {
// Thumb2 or ARM.
- unsigned MOVrOpc = isARM ? ARM::MOVr : ARM::t2MOVr;
- BuildMI(MBB, MBBI, dl, TII.get(MOVrOpc), ARM::SP)
- .addReg(FramePtr)
- .addImm((unsigned)ARMCC::AL).addReg(0).addReg(0);
+ if (isARM)
+ BuildMI(MBB, MBBI, dl, TII.get(ARM::MOVr), ARM::SP)
+ .addReg(FramePtr)
+ .addImm((unsigned)ARMCC::AL).addReg(0).addReg(0);
+ else
+ BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVgpr2gpr), ARM::SP)
+ .addReg(FramePtr);
}
}
} else if (NumBytes)
From evan.cheng at apple.com Mon Aug 10 00:51:48 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 05:51:48 -0000
Subject: [llvm-commits] [llvm] r78557 -
/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
Message-ID: <200908100551.n7A5pmE0001396@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 00:51:48 2009
New Revision: 78557
URL: http://llvm.org/viewvc/llvm-project?rev=78557&view=rev
Log:
80 col violation.
Modified:
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=78557&r1=78556&r2=78557&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Aug 10 00:51:48 2009
@@ -796,13 +796,14 @@
bool
ARMBaseInstrInfo::canFoldMemoryOperand(const MachineInstr *MI,
- const SmallVectorImpl &Ops) const {
+ const SmallVectorImpl &Ops) const {
if (Ops.size() != 1) return false;
unsigned Opc = MI->getOpcode();
if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) {
// If it is updating CPSR, then it cannot be folded.
- return MI->getOperand(4).getReg() != ARM::CPSR ||MI->getOperand(4).isDead();
+ return MI->getOperand(4).getReg() != ARM::CPSR ||
+ MI->getOperand(4).isDead();
} else if (Opc == ARM::FCPYS || Opc == ARM::FCPYD) {
return true;
} else if (Opc == ARM::VMOVD || Opc == ARM::VMOVQ) {
From clattner at apple.com Mon Aug 10 00:53:36 2009
From: clattner at apple.com (Chris Lattner)
Date: Sun, 9 Aug 2009 22:53:36 -0700
Subject: [llvm-commits] [llvm] r78547 - in /llvm/trunk: include/llvm/MC/
include/llvm/Target/ lib/MC/ lib/Target/ lib/Target/ARM/AsmPrinter/
lib/Target/PowerPC/AsmPrinter/ lib/Target/X86/AsmPrinter/
test/CodeGen/ARM/ test/CodeGen/PowerPC/ test/CodeGen/X86
In-Reply-To: <6a8523d60908092043x128dce05lb66cdc750d5d1688@mail.gmail.com>
References: <6a8523d60908092043x128dce05lb66cdc750d5d1688@mail.gmail.com>
Message-ID:
On Aug 9, 2009, at 8:43 PM, Daniel Dunbar wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=78547&view=rev
>> Log:
>> Make the big switch: Change MCSectionMachO to represent a section
>> *semantically*
>> instead of syntactically as a string. This means that it keeps
>> track of the
>> segment, section, flags, etc directly and asmprints them in the
>> right format.
>> This also includes parsing and validation support for llvm-mc and
>> "attribute(section)", so we should now start getting errors about
>> invalid
>> section attributes from the compiler instead of the assembler on
>> darwin.
>
> I couldn't help but wire this up:
>
> --
> ddunbar at giles:Frontend$ clang -c backend-errors.c
> fatal error: error in backend: Global variable 'a' has an invalid
> section specifier
> 'I AM, not, legal': mach-o section specifier uses an unknown
> section type.
> --
> compare to:
> --
> ddunbar at giles:Frontend$ gcc -c backend-errors.c
> /var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:
> 2:Expected
> comma after segment-name
> /var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest
> of line ignored. 1st junk character valued 77 (M).
> --
>
> Hmm, I'm not sure which one is easier to read!
Ah, the idea is that clang would try this out when processing the
"attribute section" in sema, and reject it if it (with a really nice
sloc) if it isn't valid!
-Chris
From evan.cheng at apple.com Mon Aug 10 01:32:05 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 06:32:05 -0000
Subject: [llvm-commits] [llvm] r78558 -
/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
Message-ID: <200908100632.n7A6W5nX006531@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 01:32:05 2009
New Revision: 78558
URL: http://llvm.org/viewvc/llvm-project?rev=78558&view=rev
Log:
Add support for folding loads / stores into 16-bit moves used by Thumb2.
Modified:
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=78558&r1=78557&r2=78558&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Aug 10 01:32:05 2009
@@ -698,45 +698,65 @@
unsigned OpNum = Ops[0];
unsigned Opc = MI->getOpcode();
MachineInstr *NewMI = NULL;
- if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) { // FIXME: tMOVgpr2gpr etc.?
+ if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) {
// If it is updating CPSR, then it cannot be folded.
- if (MI->getOperand(4).getReg() != ARM::CPSR || MI->getOperand(4).isDead()) {
- unsigned Pred = MI->getOperand(2).getImm();
- unsigned PredReg = MI->getOperand(3).getReg();
- if (OpNum == 0) { // move -> store
- unsigned SrcReg = MI->getOperand(1).getReg();
- bool isKill = MI->getOperand(1).isKill();
- bool isUndef = MI->getOperand(1).isUndef();
- if (Opc == ARM::MOVr)
- NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::STR))
- .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef))
- .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg);
- else // ARM::t2MOVr
- NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::t2STRi12))
- .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef))
- .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg);
- } else { // move -> load
- unsigned DstReg = MI->getOperand(0).getReg();
- bool isDead = MI->getOperand(0).isDead();
- bool isUndef = MI->getOperand(0).isUndef();
- if (Opc == ARM::MOVr)
- NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::LDR))
- .addReg(DstReg,
- RegState::Define |
- getDeadRegState(isDead) |
- getUndefRegState(isUndef))
- .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg);
- else // ARM::t2MOVr
- NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::t2LDRi12))
- .addReg(DstReg,
- RegState::Define |
- getDeadRegState(isDead) |
- getUndefRegState(isUndef))
- .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg);
- }
+ if (MI->getOperand(4).getReg() == ARM::CPSR && !MI->getOperand(4).isDead())
+ return NULL;
+ unsigned Pred = MI->getOperand(2).getImm();
+ unsigned PredReg = MI->getOperand(3).getReg();
+ if (OpNum == 0) { // move -> store
+ unsigned SrcReg = MI->getOperand(1).getReg();
+ bool isKill = MI->getOperand(1).isKill();
+ bool isUndef = MI->getOperand(1).isUndef();
+ if (Opc == ARM::MOVr)
+ NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::STR))
+ .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef))
+ .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg);
+ else // ARM::t2MOVr
+ NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::t2STRi12))
+ .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef))
+ .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg);
+ } else { // move -> load
+ unsigned DstReg = MI->getOperand(0).getReg();
+ bool isDead = MI->getOperand(0).isDead();
+ bool isUndef = MI->getOperand(0).isUndef();
+ if (Opc == ARM::MOVr)
+ NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::LDR))
+ .addReg(DstReg,
+ RegState::Define |
+ getDeadRegState(isDead) |
+ getUndefRegState(isUndef))
+ .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg);
+ else // ARM::t2MOVr
+ NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::t2LDRi12))
+ .addReg(DstReg,
+ RegState::Define |
+ getDeadRegState(isDead) |
+ getUndefRegState(isUndef))
+ .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg);
+ }
+ } else if (Opc == ARM::tMOVgpr2gpr ||
+ Opc == ARM::tMOVtgpr2gpr ||
+ Opc == ARM::tMOVgpr2tgpr) {
+ if (OpNum == 0) { // move -> store
+ unsigned SrcReg = MI->getOperand(1).getReg();
+ bool isKill = MI->getOperand(1).isKill();
+ bool isUndef = MI->getOperand(1).isUndef();
+ NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::t2STRi12))
+ .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef))
+ .addFrameIndex(FI).addImm(0).addImm(ARMCC::AL).addReg(0);
+ } else { // move -> load
+ unsigned DstReg = MI->getOperand(0).getReg();
+ bool isDead = MI->getOperand(0).isDead();
+ bool isUndef = MI->getOperand(0).isUndef();
+ NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::t2LDRi12))
+ .addReg(DstReg,
+ RegState::Define |
+ getDeadRegState(isDead) |
+ getUndefRegState(isUndef))
+ .addFrameIndex(FI).addImm(0).addImm(ARMCC::AL).addReg(0);
}
- }
- else if (Opc == ARM::FCPYS) {
+ } else if (Opc == ARM::FCPYS) {
unsigned Pred = MI->getOperand(2).getImm();
unsigned PredReg = MI->getOperand(3).getReg();
if (OpNum == 0) { // move -> store
@@ -804,6 +824,10 @@
// If it is updating CPSR, then it cannot be folded.
return MI->getOperand(4).getReg() != ARM::CPSR ||
MI->getOperand(4).isDead();
+ } else if (Opc == ARM::tMOVgpr2gpr ||
+ Opc == ARM::tMOVtgpr2gpr ||
+ Opc == ARM::tMOVgpr2tgpr) {
+ return true;
} else if (Opc == ARM::FCPYS || Opc == ARM::FCPYD) {
return true;
} else if (Opc == ARM::VMOVD || Opc == ARM::VMOVQ) {
From evan.cheng at apple.com Mon Aug 10 01:57:42 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 06:57:42 -0000
Subject: [llvm-commits] [llvm] r78559 -
/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Message-ID: <200908100657.n7A6vgbJ009732@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 01:57:42 2009
New Revision: 78559
URL: http://llvm.org/viewvc/llvm-project?rev=78559&view=rev
Log:
CPSR can be livein; transfer predicate operands correctly; tMUL is two-address.
Modified:
llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=78559&r1=78558&r2=78559&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Mon Aug 10 01:57:42 2009
@@ -21,8 +21,8 @@
#include "llvm/ADT/Statistic.h"
using namespace llvm;
-STATISTIC(NumNarrows, "Number of 32-bit instructions reduced to 16-bit ones");
-STATISTIC(Num2Addrs, "Number of 32-bit instructions reduced to 2-address");
+STATISTIC(NumNarrows, "Number of 32-bit instrs reduced to 16-bit ones");
+STATISTIC(Num2Addrs, "Number of 32-bit instrs reduced to 2addr 16-bit ones");
namespace {
/// ReduceTable - A static table with information on mapping from wide
@@ -63,8 +63,9 @@
{ ARM::t2LSRrr, ARM::tLSRrr, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2MOVi, ARM::tMOVi8, 0, 8, 0, 1, 0, 0,0, 0 },
// FIXME: Do we need the 16-bit 'S' variant?
+ // FIXME: t2MOVcc
{ ARM::t2MOVr,ARM::tMOVgpr2gpr,0, 0, 0, 0, 0, 1,0, 0 },
- { ARM::t2MUL, ARM::tMUL, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2MUL, 0, ARM::tMUL, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2MVNr, ARM::tMVN, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2ORRrr, ARM::tORR, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2REV, ARM::tREV, 0, 0, 0, 1, 0, 0,0, 0 },
@@ -126,10 +127,8 @@
}
static bool VerifyPredAndCC(MachineInstr *MI, const ReduceEntry &Entry,
- bool is2Addr, bool LiveCPSR,
- bool &HasCC, bool &CCDead) {
- unsigned PredReg = 0;
- ARMCC::CondCodes Pred = getInstrPredicate(MI, PredReg);
+ bool is2Addr, ARMCC::CondCodes Pred,
+ bool LiveCPSR, bool &HasCC, bool &CCDead) {
if ((is2Addr && Entry.PredCC2 == 0) ||
(!is2Addr && Entry.PredCC1 == 0)) {
if (Pred == ARMCC::AL) {
@@ -181,6 +180,19 @@
return false;
}
+ // Check if it's possible / necessary to transfer the predicate.
+ const TargetInstrDesc &NewTID = TII->get(Entry.NarrowOpc2);
+ unsigned PredReg = 0;
+ ARMCC::CondCodes Pred = getInstrPredicate(MI, PredReg);
+ bool SkipPred = false;
+ if (Pred != ARMCC::AL) {
+ if (!NewTID.isPredicable())
+ // Can't transfer predicate, fail.
+ return false;
+ } else {
+ SkipPred = !NewTID.isPredicable();
+ }
+
bool HasCC = false;
bool CCDead = false;
if (TID.hasOptionalDef()) {
@@ -189,7 +201,7 @@
if (HasCC && MI->getOperand(NumOps-1).isDead())
CCDead = true;
}
- if (!VerifyPredAndCC(MI, Entry, true, LiveCPSR, HasCC, CCDead))
+ if (!VerifyPredAndCC(MI, Entry, true, Pred, LiveCPSR, HasCC, CCDead))
return false;
// Add the 16-bit instruction.
@@ -201,15 +213,18 @@
// Transfer the rest of operands.
unsigned NumOps = TID.getNumOperands();
- for (unsigned i = 1, e = MI->getNumOperands(); i != e; ++i)
- if (!(i < NumOps && TID.OpInfo[i].isOptionalDef()))
- MIB.addOperand(MI->getOperand(i));
+ for (unsigned i = 1, e = MI->getNumOperands(); i != e; ++i) {
+ if (i < NumOps && TID.OpInfo[i].isOptionalDef())
+ continue;
+ if (SkipPred && TID.OpInfo[i].isPredicate())
+ continue;
+ MIB.addOperand(MI->getOperand(i));
+ }
DOUT << "Converted 32-bit: " << *MI << " to 16-bit: " << *MIB;
MBB.erase(MI);
++Num2Addrs;
- ++NumNarrows;
return true;
}
@@ -238,6 +253,19 @@
}
}
+ // Check if it's possible / necessary to transfer the predicate.
+ const TargetInstrDesc &NewTID = TII->get(Entry.NarrowOpc1);
+ unsigned PredReg = 0;
+ ARMCC::CondCodes Pred = getInstrPredicate(MI, PredReg);
+ bool SkipPred = false;
+ if (Pred != ARMCC::AL) {
+ if (!NewTID.isPredicable())
+ // Can't transfer predicate, fail.
+ return false;
+ } else {
+ SkipPred = !NewTID.isPredicable();
+ }
+
bool HasCC = false;
bool CCDead = false;
if (TID.hasOptionalDef()) {
@@ -246,7 +274,7 @@
if (HasCC && MI->getOperand(NumOps-1).isDead())
CCDead = true;
}
- if (!VerifyPredAndCC(MI, Entry, false, LiveCPSR, HasCC, CCDead))
+ if (!VerifyPredAndCC(MI, Entry, false, Pred, LiveCPSR, HasCC, CCDead))
return false;
// Add the 16-bit instruction.
@@ -258,15 +286,18 @@
// Transfer the rest of operands.
unsigned NumOps = TID.getNumOperands();
- for (unsigned i = 1, e = MI->getNumOperands(); i != e; ++i)
- if (!(i < NumOps && TID.OpInfo[i].isOptionalDef()))
- MIB.addOperand(MI->getOperand(i));
+ for (unsigned i = 1, e = MI->getNumOperands(); i != e; ++i) {
+ if (i < NumOps && TID.OpInfo[i].isOptionalDef())
+ continue;
+ if (SkipPred && TID.OpInfo[i].isPredicate())
+ continue;
+ MIB.addOperand(MI->getOperand(i));
+ }
DOUT << "Converted 32-bit: " << *MI << " to 16-bit: " << *MIB;
MBB.erase(MI);
- ++Num2Addrs;
++NumNarrows;
return true;
}
@@ -298,9 +329,16 @@
bool Thumb2SizeReduce::ReduceMBB(MachineBasicBlock &MBB) {
bool Modified = false;
- // FIXME: Track whether CPSR is live. If not, then it's possible to convert
- // one that doesn't set CPSR to one that does.
bool LiveCPSR = false;
+ // Yes, CPSR could be livein.
+ for (MachineBasicBlock::const_livein_iterator I = MBB.livein_begin(),
+ E = MBB.livein_end(); I != E; ++I) {
+ if (*I == ARM::CPSR) {
+ LiveCPSR = true;
+ break;
+ }
+ }
+
MachineBasicBlock::iterator MII = MBB.begin(), E = MBB.end();
MachineBasicBlock::iterator NextMII = next(MII);
for (; MII != E; MII = NextMII) {
From evan.cheng at apple.com Mon Aug 10 02:20:38 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 07:20:38 -0000
Subject: [llvm-commits] [llvm] r78560 -
/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Message-ID: <200908100720.n7A7Kcen012691@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 02:20:37 2009
New Revision: 78560
URL: http://llvm.org/viewvc/llvm-project?rev=78560&view=rev
Log:
Duh. Most 16-bit Thumb rr instructions are two-address. Fix table.
Modified:
llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=78560&r1=78559&r2=78560&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Mon Aug 10 02:20:37 2009
@@ -15,6 +15,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/DenseMap.h"
@@ -24,6 +25,8 @@
STATISTIC(NumNarrows, "Number of 32-bit instrs reduced to 16-bit ones");
STATISTIC(Num2Addrs, "Number of 32-bit instrs reduced to 2addr 16-bit ones");
+static cl::opt ReduceLimit("t2-reduce-limit", cl::init(-1), cl::Hidden);
+
namespace {
/// ReduceTable - A static table with information on mapping from wide
/// opcodes to narrow
@@ -47,31 +50,31 @@
// FIXME: t2ADDS variants.
{ ARM::t2ADDri, ARM::tADDi3, ARM::tADDi8, 3, 8, 1, 1, 0,0, 0 },
{ ARM::t2ADDrr, ARM::tADDrr, ARM::tADDhirr, 0, 0, 1, 0, 0,1, 0 },
- { ARM::t2ANDrr, ARM::tAND, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2ANDrr, 0, ARM::tAND, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2ASRri, ARM::tASRri, 0, 5, 0, 1, 0, 0,0, 0 },
- { ARM::t2ASRrr, ARM::tASRrr, 0, 0, 0, 1, 0, 0,0, 0 },
- { ARM::t2BICrr, ARM::tBIC, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2ASRrr, 0, ARM::tASRrr, 0, 0, 0, 1, 0,0, 0 },
+ { ARM::t2BICrr, 0, ARM::tBIC, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2CMNrr, ARM::tCMN, 0, 0, 0, 1, 0, 1,0, 0 },
{ ARM::t2CMPri, ARM::tCMPi8, 0, 8, 0, 1, 0, 1,0, 0 },
{ ARM::t2CMPrr, ARM::tCMPhir, 0, 0, 0, 0, 0, 1,0, 0 },
{ ARM::t2CMPzri,ARM::tCMPzi8, 0, 8, 0, 1, 0, 1,0, 0 },
{ ARM::t2CMPzrr,ARM::tCMPzhir,0, 0, 0, 0, 0, 1,0, 0 },
- { ARM::t2EORrr, ARM::tEOR, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2EORrr, 0, ARM::tEOR, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2LSLri, ARM::tLSLri, 0, 5, 0, 1, 0, 0,0, 0 },
- { ARM::t2LSLrr, ARM::tLSLrr, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2LSLrr, 0, ARM::tLSLrr, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2LSRri, ARM::tLSRri, 0, 5, 0, 1, 0, 0,0, 0 },
- { ARM::t2LSRrr, ARM::tLSRrr, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2LSRrr, 0, ARM::tLSRrr, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2MOVi, ARM::tMOVi8, 0, 8, 0, 1, 0, 0,0, 0 },
// FIXME: Do we need the 16-bit 'S' variant?
// FIXME: t2MOVcc
{ ARM::t2MOVr,ARM::tMOVgpr2gpr,0, 0, 0, 0, 0, 1,0, 0 },
- { ARM::t2MUL, 0, ARM::tMUL, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2MUL, 0, ARM::tMUL, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2MVNr, ARM::tMVN, 0, 0, 0, 1, 0, 0,0, 0 },
- { ARM::t2ORRrr, ARM::tORR, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2ORRrr, 0, ARM::tORR, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2REV, ARM::tREV, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2REV16, ARM::tREV16, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2REVSH, ARM::tREVSH, 0, 0, 0, 1, 0, 0,0, 0 },
- { ARM::t2RORrr, ARM::tROR, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2RORrr, 0, ARM::tROR, 0, 0, 0, 1, 0,0, 0 },
// FIXME: T2RSBri immediate must be zero. Also need entry for T2RSBS
//{ ARM::t2RSBri, ARM::tRSB, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2SUBri, ARM::tSUBi3, ARM::tSUBi8, 3, 8, 1, 1, 0,0, 0 },
@@ -368,6 +371,9 @@
ProcessNext:
LiveCPSR = UpdateCPSRLiveness(*MI, LiveCPSR);
+
+ if (ReduceLimit != -1 && ((int)(NumNarrows + Num2Addrs) > ReduceLimit))
+ break;
}
return Modified;
From evan.cheng at apple.com Mon Aug 10 02:58:46 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 07:58:46 -0000
Subject: [llvm-commits] [llvm] r78561 -
/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Message-ID: <200908100758.n7A7wkYc025397@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 02:58:45 2009
New Revision: 78561
URL: http://llvm.org/viewvc/llvm-project?rev=78561&view=rev
Log:
rev, rev16, and revsh do not set CPSR.
Modified:
llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=78561&r1=78560&r2=78561&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Mon Aug 10 02:58:45 2009
@@ -71,9 +71,9 @@
{ ARM::t2MUL, 0, ARM::tMUL, 0, 0, 0, 1, 0,0, 0 },
{ ARM::t2MVNr, ARM::tMVN, 0, 0, 0, 1, 0, 0,0, 0 },
{ ARM::t2ORRrr, 0, ARM::tORR, 0, 0, 0, 1, 0,0, 0 },
- { ARM::t2REV, ARM::tREV, 0, 0, 0, 1, 0, 0,0, 0 },
- { ARM::t2REV16, ARM::tREV16, 0, 0, 0, 1, 0, 0,0, 0 },
- { ARM::t2REVSH, ARM::tREVSH, 0, 0, 0, 1, 0, 0,0, 0 },
+ { ARM::t2REV, ARM::tREV, 0, 0, 0, 1, 0, 1,0, 0 },
+ { ARM::t2REV16, ARM::tREV16, 0, 0, 0, 1, 0, 1,0, 0 },
+ { ARM::t2REVSH, ARM::tREVSH, 0, 0, 0, 1, 0, 1,0, 0 },
{ ARM::t2RORrr, 0, ARM::tROR, 0, 0, 0, 1, 0,0, 0 },
// FIXME: T2RSBri immediate must be zero. Also need entry for T2RSBS
//{ ARM::t2RSBri, ARM::tRSB, 0, 0, 0, 1, 0, 0,0, 0 },
From evan.cheng at apple.com Mon Aug 10 03:10:14 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 08:10:14 -0000
Subject: [llvm-commits] [llvm] r78562 -
/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Message-ID: <200908100810.n7A8AE5d031439@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 03:10:13 2009
New Revision: 78562
URL: http://llvm.org/viewvc/llvm-project?rev=78562&view=rev
Log:
Watch out for empty BB.
Modified:
llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=78562&r1=78561&r2=78562&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Mon Aug 10 03:10:13 2009
@@ -343,7 +343,7 @@
}
MachineBasicBlock::iterator MII = MBB.begin(), E = MBB.end();
- MachineBasicBlock::iterator NextMII = next(MII);
+ MachineBasicBlock::iterator NextMII;
for (; MII != E; MII = NextMII) {
NextMII = next(MII);
From david_goodwin at apple.com Mon Aug 10 10:55:26 2009
From: david_goodwin at apple.com (David Goodwin)
Date: Mon, 10 Aug 2009 15:55:26 -0000
Subject: [llvm-commits] [llvm] r78563 - in /llvm/trunk:
include/llvm/CodeGen/ScheduleHazardRecognizer.h
include/llvm/Target/TargetInstrItineraries.h lib/CodeGen/CMakeLists.txt
lib/CodeGen/ExactHazardRecognizer.cpp lib/CodeGen/ExactHazardRecognizer.h
lib/CodeGen/PostRASchedulerList.cpp lib/CodeGen/ScheduleDAGInstrs.cpp
lib/CodeGen/SimpleHazardRecognizer.h
Message-ID: <200908101555.n7AFtQ7i026880@zion.cs.uiuc.edu>
Author: david_goodwin
Date: Mon Aug 10 10:55:25 2009
New Revision: 78563
URL: http://llvm.org/viewvc/llvm-project?rev=78563&view=rev
Log:
Post RA scheduler changes. Introduce a hazard recognizer that uses the target schedule information to accurately model the pipeline. Update the scheduler to correctly handle multi-issue targets.
Added:
llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp
llvm/trunk/lib/CodeGen/ExactHazardRecognizer.h
llvm/trunk/lib/CodeGen/SimpleHazardRecognizer.h
Modified:
llvm/trunk/include/llvm/CodeGen/ScheduleHazardRecognizer.h
llvm/trunk/include/llvm/Target/TargetInstrItineraries.h
llvm/trunk/lib/CodeGen/CMakeLists.txt
llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp
llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
Modified: llvm/trunk/include/llvm/CodeGen/ScheduleHazardRecognizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleHazardRecognizer.h?rev=78563&r1=78562&r2=78563&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ScheduleHazardRecognizer.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ScheduleHazardRecognizer.h Mon Aug 10 10:55:25 2009
@@ -43,6 +43,11 @@
return NoHazard;
}
+ /// Reset - This callback is invoked when a new block of
+ /// instructions is about to be schedule. The hazard state should be
+ /// set to an initialized state.
+ virtual void Reset() {}
+
/// EmitInstruction - This callback is invoked when an instruction is
/// emitted, to advance the hazard state.
virtual void EmitInstruction(SUnit *) {}
Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrItineraries.h?rev=78563&r1=78562&r2=78563&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrItineraries.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrItineraries.h Mon Aug 10 10:55:25 2009
@@ -20,9 +20,9 @@
//===----------------------------------------------------------------------===//
/// Instruction stage - These values represent a step in the execution of an
-/// instruction. The latency represents the number of discrete time slots used
-/// need to complete the stage. Units represent the choice of functional units
-/// that can be used to complete the stage. Eg. IntUnit1, IntUnit2.
+/// instruction. The latency represents the number of discrete time slots
+/// needed to complete the stage. Units represent the choice of functional
+/// units that can be used to complete the stage. Eg. IntUnit1, IntUnit2.
///
struct InstrStage {
unsigned Cycles; ///< Length of stage in machine cycles
@@ -84,7 +84,9 @@
if (isEmpty())
return 1;
- // Just sum the cycle count for each stage.
+ // Just sum the cycle count for each stage. The assumption is that all
+ // inputs are consumed at the start of the first stage and that all
+ // outputs are produced at the end of the last stage.
unsigned Latency = 0;
for (const InstrStage *IS = begin(ItinClassIndx), *E = end(ItinClassIndx);
IS != E; ++IS)
Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=78563&r1=78562&r2=78563&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CMakeLists.txt (original)
+++ llvm/trunk/lib/CodeGen/CMakeLists.txt Mon Aug 10 10:55:25 2009
@@ -6,6 +6,7 @@
DwarfEHPrepare.cpp
ELFCodeEmitter.cpp
ELFWriter.cpp
+ ExactHazardRecognizer.cpp
GCMetadata.cpp
GCMetadataPrinter.cpp
GCStrategy.cpp
Added: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=78563&view=auto
==============================================================================
--- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (added)
+++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Mon Aug 10 10:55:25 2009
@@ -0,0 +1,149 @@
+//===----- ExactHazardRecognizer.cpp - hazard recognizer -------- ---------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This implements a a hazard recognizer using the instructions itineraries
+// defined for the current target.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "exact-hazards"
+#include "ExactHazardRecognizer.h"
+#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Target/TargetInstrItineraries.h"
+
+namespace llvm {
+
+ExactHazardRecognizer::ExactHazardRecognizer(const InstrItineraryData &LItinData) :
+ ScheduleHazardRecognizer(), ItinData(LItinData)
+{
+ // Determine the maximum depth of any itinerary. This determines the
+ // depth of the scoreboard. We always make the scoreboard at least 1
+ // cycle deep to avoid dealing with the boundary condition.
+ ScoreboardDepth = 1;
+ if (!ItinData.isEmpty()) {
+ for (unsigned idx = 0; ; ++idx) {
+ // If the begin stage of an itinerary has 0 cycles and units,
+ // then we have reached the end of the itineraries.
+ const InstrStage *IS = ItinData.begin(idx), *E = ItinData.end(idx);
+ if ((IS->Cycles == 0) && (IS->Units == 0))
+ break;
+
+ unsigned ItinDepth = 0;
+ for (; IS != E; ++IS)
+ ItinDepth += IS->Cycles;
+
+ ScoreboardDepth = std::max(ScoreboardDepth, ItinDepth);
+ }
+ }
+
+ Scoreboard = new unsigned[ScoreboardDepth];
+ ScoreboardHead = 0;
+
+ DOUT << "Using exact hazard recognizer: ScoreboardDepth = "
+ << ScoreboardDepth << '\n';
+}
+
+ExactHazardRecognizer::~ExactHazardRecognizer() {
+ delete Scoreboard;
+}
+
+void ExactHazardRecognizer::Reset() {
+ memset(Scoreboard, 0, ScoreboardDepth * sizeof(unsigned));
+ ScoreboardHead = 0;
+}
+
+unsigned ExactHazardRecognizer::getFutureIndex(unsigned offset) {
+ return (ScoreboardHead + offset) % ScoreboardDepth;
+}
+
+void ExactHazardRecognizer::dumpScoreboard() {
+ DOUT << "Scoreboard:\n";
+
+ unsigned last = ScoreboardDepth - 1;
+ while ((last > 0) && (Scoreboard[getFutureIndex(last)] == 0))
+ last--;
+
+ for (unsigned i = 0; i <= last; i++) {
+ unsigned FUs = Scoreboard[getFutureIndex(i)];
+ DOUT << "\t";
+ for (int j = 31; j >= 0; j--)
+ DOUT << ((FUs & (1 << j)) ? '1' : '0');
+ DOUT << '\n';
+ }
+}
+
+ExactHazardRecognizer::HazardType ExactHazardRecognizer::getHazardType(SUnit *SU) {
+ unsigned cycle = 0;
+
+ // Use the itinerary for the underlying instruction to check for
+ // free FU's in the scoreboard at the appropriate future cycles.
+ unsigned idx = SU->getInstr()->getDesc().getSchedClass();
+ for (const InstrStage *IS = ItinData.begin(idx), *E = ItinData.end(idx);
+ IS != E; ++IS) {
+ // We must find one of the stage's units free for every cycle the
+ // stage is occupied.
+ for (unsigned int i = 0; i < IS->Cycles; ++i) {
+ assert((cycle < ScoreboardDepth) && "Scoreboard depth exceeded!");
+
+ unsigned index = getFutureIndex(cycle);
+ unsigned freeUnits = IS->Units & ~Scoreboard[index];
+ if (!freeUnits) {
+ DOUT << "*** Hazard in cycle " << cycle << ", ";
+ DOUT << "SU(" << SU->NodeNum << "): ";
+ DEBUG(SU->getInstr()->dump());
+ return Hazard;
+ }
+
+ ++cycle;
+ }
+ }
+
+ return NoHazard;
+}
+
+void ExactHazardRecognizer::EmitInstruction(SUnit *SU) {
+ unsigned cycle = 0;
+
+ // Use the itinerary for the underlying instruction to reserve FU's
+ // in the scoreboard at the appropriate future cycles.
+ unsigned idx = SU->getInstr()->getDesc().getSchedClass();
+ for (const InstrStage *IS = ItinData.begin(idx), *E = ItinData.end(idx);
+ IS != E; ++IS) {
+ // We must reserve one of the stage's units for every cycle the
+ // stage is occupied.
+ for (unsigned int i = 0; i < IS->Cycles; ++i) {
+ assert((cycle < ScoreboardDepth) && "Scoreboard depth exceeded!");
+
+ unsigned index = getFutureIndex(cycle);
+ unsigned freeUnits = IS->Units & ~Scoreboard[index];
+
+ // reduce to a single unit
+ unsigned freeUnit = 0;
+ do {
+ freeUnit = freeUnits;
+ freeUnits = freeUnit & (freeUnit - 1);
+ } while (freeUnits);
+
+ assert(freeUnit && "No function unit available!");
+ Scoreboard[index] |= freeUnit;
+ ++cycle;
+ }
+ }
+
+ DEBUG(dumpScoreboard());
+}
+
+void ExactHazardRecognizer::AdvanceCycle() {
+ Scoreboard[ScoreboardHead] = 0;
+ ScoreboardHead = getFutureIndex(1);
+}
+
+} /* namespace llvm */
Added: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.h?rev=78563&view=auto
==============================================================================
--- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.h (added)
+++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.h Mon Aug 10 10:55:25 2009
@@ -0,0 +1,61 @@
+//=- llvm/CodeGen/ExactHazardRecognizer.h - Scheduling Support -*- C++ -*-=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the ExactHazardRecognizer class, which
+// implements hazard-avoidance heuristics for scheduling, based on the
+// scheduling itineraries specified for the target.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_EXACTHAZARDRECOGNIZER_H
+#define LLVM_CODEGEN_EXACTHAZARDRECOGNIZER_H
+
+#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
+#include "llvm/CodeGen/ScheduleDAG.h"
+#include "llvm/Target/TargetInstrItineraries.h"
+
+namespace llvm {
+ class ExactHazardRecognizer : public ScheduleHazardRecognizer {
+ // Itinerary data for the target.
+ const InstrItineraryData &ItinData;
+
+ // Scoreboard to track function unit usage. Scoreboard[0] is a
+ // mask of the FUs in use in the cycle currently being
+ // schedule. Scoreboard[1] is a mask for the next cycle. The
+ // Scoreboard is used as a circular buffer with the current cycle
+ // indicated by ScoreboardHead.
+ unsigned *Scoreboard;
+
+ // The maximum number of cycles monitored by the Scoreboard. This
+ // value is determined based on the target itineraries to ensure
+ // that all hazards can be tracked.
+ unsigned ScoreboardDepth;
+
+ // Indices into the Scoreboard that represent the current cycle.
+ unsigned ScoreboardHead;
+
+ // Return the scoreboard index to use for 'offset' cycles in the
+ // future. 'offset' of 0 returns ScoreboardHead.
+ unsigned getFutureIndex(unsigned offset);
+
+ // Print the scoreboard.
+ void dumpScoreboard();
+
+ public:
+ ExactHazardRecognizer(const InstrItineraryData &ItinData);
+ ~ExactHazardRecognizer();
+
+ virtual HazardType getHazardType(SUnit *SU);
+ virtual void Reset();
+ virtual void EmitInstruction(SUnit *SU);
+ virtual void AdvanceCycle();
+ };
+}
+
+#endif
Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=78563&r1=78562&r2=78563&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original)
+++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Mon Aug 10 10:55:25 2009
@@ -19,6 +19,8 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "post-RA-sched"
+#include "ExactHazardRecognizer.h"
+#include "SimpleHazardRecognizer.h"
#include "ScheduleDAGInstrs.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/LatencyPriorityQueue.h"
@@ -49,8 +51,8 @@
static cl::opt
EnablePostRAHazardAvoidance("avoid-hazards",
- cl::desc("Enable simple hazard-avoidance"),
- cl::init(true), cl::Hidden);
+ cl::desc("Enable exact hazard avoidance"),
+ cl::init(false), cl::Hidden);
namespace {
class VISIBILITY_HIDDEN PostRAScheduler : public MachineFunctionPass {
@@ -156,62 +158,6 @@
void ListScheduleTopDown();
bool BreakAntiDependencies();
};
-
- /// SimpleHazardRecognizer - A *very* simple hazard recognizer. It uses
- /// a coarse classification and attempts to avoid that instructions of
- /// a given class aren't grouped too densely together.
- class SimpleHazardRecognizer : public ScheduleHazardRecognizer {
- /// Class - A simple classification for SUnits.
- enum Class {
- Other, Load, Store
- };
-
- /// Window - The Class values of the most recently issued
- /// instructions.
- Class Window[8];
-
- /// getClass - Classify the given SUnit.
- Class getClass(const SUnit *SU) {
- const MachineInstr *MI = SU->getInstr();
- const TargetInstrDesc &TID = MI->getDesc();
- if (TID.mayLoad())
- return Load;
- if (TID.mayStore())
- return Store;
- return Other;
- }
-
- /// Step - Rotate the existing entries in Window and insert the
- /// given class value in position as the most recent.
- void Step(Class C) {
- std::copy(Window+1, array_endof(Window), Window);
- Window[array_lengthof(Window)-1] = C;
- }
-
- public:
- SimpleHazardRecognizer() : Window() {}
-
- virtual HazardType getHazardType(SUnit *SU) {
- Class C = getClass(SU);
- if (C == Other)
- return NoHazard;
- unsigned Score = 0;
- for (unsigned i = 0; i != array_lengthof(Window); ++i)
- if (Window[i] == C)
- Score += i + 1;
- if (Score > array_lengthof(Window) * 2)
- return Hazard;
- return NoHazard;
- }
-
- virtual void EmitInstruction(SUnit *SU) {
- Step(getClass(SU));
- }
-
- virtual void AdvanceCycle() {
- Step(Other);
- }
- };
}
/// isSchedulingBoundary - Test if the given instruction should be
@@ -241,9 +187,10 @@
const MachineLoopInfo &MLI = getAnalysis();
const MachineDominatorTree &MDT = getAnalysis();
+ const InstrItineraryData &InstrItins = Fn.getTarget().getInstrItineraryData();
ScheduleHazardRecognizer *HR = EnablePostRAHazardAvoidance ?
- new SimpleHazardRecognizer :
- new ScheduleHazardRecognizer();
+ (ScheduleHazardRecognizer *)new ExactHazardRecognizer(InstrItins) :
+ (ScheduleHazardRecognizer *)new SimpleHazardRecognizer();
SchedulePostRATDList Scheduler(Fn, MLI, MDT, HR);
@@ -289,6 +236,9 @@
// Call the superclass.
ScheduleDAGInstrs::StartBlock(BB);
+ // Reset the hazard recognizer.
+ HazardRec->Reset();
+
// Clear out the register class data.
std::fill(Classes, array_endof(Classes),
static_cast(0));
@@ -380,6 +330,9 @@
}
}
+ DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
+ SUnits[su].dumpAll(this));
+
AvailableQueue.initNodes(SUnits);
ListScheduleTopDown();
@@ -872,13 +825,6 @@
MinDepth = PendingQueue[i]->getDepth();
}
- // If there are no instructions available, don't try to issue anything, and
- // don't advance the hazard recognizer.
- if (AvailableQueue.empty()) {
- CurCycle = MinDepth != ~0u ? MinDepth : CurCycle + 1;
- continue;
- }
-
SUnit *FoundSUnit = 0;
bool HasNoopHazards = false;
@@ -909,10 +855,14 @@
ScheduleNodeTopDown(FoundSUnit, CurCycle);
HazardRec->EmitInstruction(FoundSUnit);
- // If this is a pseudo-op node, we don't want to increment the current
- // cycle.
- if (FoundSUnit->Latency) // Don't increment CurCycle for pseudo-ops!
- ++CurCycle;
+ // If we are using the target-specific hazards, then don't
+ // advance the cycle time just because we schedule a node. If
+ // the target allows it we can schedule multiple nodes in the
+ // same cycle.
+ if (!EnablePostRAHazardAvoidance) {
+ if (FoundSUnit->Latency) // Don't increment CurCycle for pseudo-ops!
+ ++CurCycle;
+ }
} else if (!HasNoopHazards) {
// Otherwise, we have a pipeline stall, but no other problem, just advance
// the current cycle and try again.
Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=78563&r1=78562&r2=78563&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Mon Aug 10 10:55:25 2009
@@ -174,16 +174,20 @@
assert(TRI->isPhysicalRegister(Reg) && "Virtual register encountered!");
std::vector &UseList = Uses[Reg];
std::vector &DefList = Defs[Reg];
- // Optionally add output and anti dependencies.
- // TODO: Using a latency of 1 here assumes there's no cost for
- // reusing registers.
+ // Optionally add output and anti dependencies. For anti
+ // dependencies we use a latency of 0 because for a multi-issue
+ // target we want to allow the defining instruction to issue
+ // in the same cycle as the using instruction.
+ // TODO: Using a latency of 1 here for output dependencies assumes
+ // there's no cost for reusing registers.
SDep::Kind Kind = MO.isUse() ? SDep::Anti : SDep::Output;
+ unsigned AOLatency = (Kind == SDep::Anti) ? 0 : 1;
for (unsigned i = 0, e = DefList.size(); i != e; ++i) {
SUnit *DefSU = DefList[i];
if (DefSU != SU &&
(Kind != SDep::Output || !MO.isDead() ||
!DefSU->getInstr()->registerDefIsDead(Reg)))
- DefSU->addPred(SDep(SU, Kind, /*Latency=*/1, /*Reg=*/Reg));
+ DefSU->addPred(SDep(SU, Kind, AOLatency, /*Reg=*/Reg));
}
for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias) {
std::vector &DefList = Defs[*Alias];
@@ -192,7 +196,7 @@
if (DefSU != SU &&
(Kind != SDep::Output || !MO.isDead() ||
!DefSU->getInstr()->registerDefIsDead(Reg)))
- DefSU->addPred(SDep(SU, Kind, /*Latency=*/1, /*Reg=*/ *Alias));
+ DefSU->addPred(SDep(SU, Kind, AOLatency, /*Reg=*/ *Alias));
}
}
@@ -399,8 +403,7 @@
void ScheduleDAGInstrs::ComputeLatency(SUnit *SU) {
const InstrItineraryData &InstrItins = TM.getInstrItineraryData();
- // Compute the latency for the node. We use the sum of the latencies for
- // all nodes flagged together into this SUnit.
+ // Compute the latency for the node.
SU->Latency =
InstrItins.getLatency(SU->getInstr()->getDesc().getSchedClass());
Added: llvm/trunk/lib/CodeGen/SimpleHazardRecognizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleHazardRecognizer.h?rev=78563&view=auto
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleHazardRecognizer.h (added)
+++ llvm/trunk/lib/CodeGen/SimpleHazardRecognizer.h Mon Aug 10 10:55:25 2009
@@ -0,0 +1,89 @@
+//=- llvm/CodeGen/SimpleHazardRecognizer.h - Scheduling Support -*- C++ -*-=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the SimpleHazardRecognizer class, which
+// implements hazard-avoidance heuristics for scheduling, based on the
+// scheduling itineraries specified for the target.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_SIMPLEHAZARDRECOGNIZER_H
+#define LLVM_CODEGEN_SIMPLEHAZARDRECOGNIZER_H
+
+#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
+#include "llvm/CodeGen/ScheduleDAG.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetInstrInfo.h"
+
+namespace llvm {
+ /// SimpleHazardRecognizer - A *very* simple hazard recognizer. It uses
+ /// a coarse classification and attempts to avoid that instructions of
+ /// a given class aren't grouped too densely together.
+ class SimpleHazardRecognizer : public ScheduleHazardRecognizer {
+ /// Class - A simple classification for SUnits.
+ enum Class {
+ Other, Load, Store
+ };
+
+ /// Window - The Class values of the most recently issued
+ /// instructions.
+ Class Window[8];
+
+ /// getClass - Classify the given SUnit.
+ Class getClass(const SUnit *SU) {
+ const MachineInstr *MI = SU->getInstr();
+ const TargetInstrDesc &TID = MI->getDesc();
+ if (TID.mayLoad())
+ return Load;
+ if (TID.mayStore())
+ return Store;
+ return Other;
+ }
+
+ /// Step - Rotate the existing entries in Window and insert the
+ /// given class value in position as the most recent.
+ void Step(Class C) {
+ std::copy(Window+1, array_endof(Window), Window);
+ Window[array_lengthof(Window)-1] = C;
+ }
+
+ public:
+ SimpleHazardRecognizer() : Window() {
+ Reset();
+ }
+
+ virtual HazardType getHazardType(SUnit *SU) {
+ Class C = getClass(SU);
+ if (C == Other)
+ return NoHazard;
+ unsigned Score = 0;
+ for (unsigned i = 0; i != array_lengthof(Window); ++i)
+ if (Window[i] == C)
+ Score += i + 1;
+ if (Score > array_lengthof(Window) * 2)
+ return Hazard;
+ return NoHazard;
+ }
+
+ virtual void Reset() {
+ for (unsigned i = 0; i != array_lengthof(Window); ++i)
+ Window[i] = Other;
+ }
+
+ virtual void EmitInstruction(SUnit *SU) {
+ Step(getClass(SU));
+ }
+
+ virtual void AdvanceCycle() {
+ Step(Other);
+ }
+ };
+}
+
+#endif
From david_goodwin at apple.com Mon Aug 10 10:56:13 2009
From: david_goodwin at apple.com (David Goodwin)
Date: Mon, 10 Aug 2009 15:56:13 -0000
Subject: [llvm-commits] [llvm] r78564 - in /llvm/trunk/lib/Target/ARM:
ARMSchedule.td ARMScheduleV6.td ARMScheduleV7.td
Message-ID: <200908101556.n7AFuDp7026997@zion.cs.uiuc.edu>
Author: david_goodwin
Date: Mon Aug 10 10:56:13 2009
New Revision: 78564
URL: http://llvm.org/viewvc/llvm-project?rev=78564&view=rev
Log:
Checkpoint scheduling itinerary changes.
Modified:
llvm/trunk/lib/Target/ARM/ARMSchedule.td
llvm/trunk/lib/Target/ARM/ARMScheduleV6.td
llvm/trunk/lib/Target/ARM/ARMScheduleV7.td
Modified: llvm/trunk/lib/Target/ARM/ARMSchedule.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSchedule.td?rev=78564&r1=78563&r2=78564&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMSchedule.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMSchedule.td Mon Aug 10 10:56:13 2009
@@ -10,11 +10,10 @@
//===----------------------------------------------------------------------===//
// Functional units across ARM processors
//
-def FU_iALU : FuncUnit; // Integer alu unit
-def FU_iLdSt : FuncUnit; // Integer load / store unit
-def FU_FpALU : FuncUnit; // FP alu unit
-def FU_FpLdSt : FuncUnit; // FP load / store unit
-def FU_Br : FuncUnit; // Branch unit
+def FU_Pipe0 : FuncUnit; // pipeline 0 issue
+def FU_Pipe1 : FuncUnit; // pipeline 1 issue
+def FU_LdSt0 : FuncUnit; // pipeline 0 load/store
+def FU_LdSt1 : FuncUnit; // pipeline 1 load/store
//===----------------------------------------------------------------------===//
// Instruction Itinerary classes used for ARM
@@ -30,7 +29,16 @@
//===----------------------------------------------------------------------===//
// Processor instruction itineraries.
-def GenericItineraries : ProcessorItineraries<[]>;
+def GenericItineraries : ProcessorItineraries<[
+ InstrItinData]>,
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ InstrItinData]>,
+ InstrItinData]>,
+ InstrItinData]>,
+ InstrItinData]>
+]>;
+
include "ARMScheduleV6.td"
include "ARMScheduleV7.td"
Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV6.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV6.td?rev=78564&r1=78563&r2=78564&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMScheduleV6.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMScheduleV6.td Mon Aug 10 10:56:13 2009
@@ -11,12 +11,18 @@
//
//===----------------------------------------------------------------------===//
+// Single issue pipeline so every itinerary starts with FU_pipe0
def V6Itineraries : ProcessorItineraries<[
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>
+ // single-cycle integer ALU
+ InstrItinData]>,
+ // loads have an extra cycle of latency, but are fully pipelined
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ // fully-pipelined stores
+ InstrItinData]>,
+ InstrItinData]>,
+ // fp ALU is not pipelined
+ InstrItinData]>,
+ // no delay slots, so the latency of a branch is unimportant
+ InstrItinData]>
]>;
Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV7.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV7.td?rev=78564&r1=78563&r2=78564&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMScheduleV7.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Mon Aug 10 10:56:13 2009
@@ -11,23 +11,34 @@
//
//===----------------------------------------------------------------------===//
+// Single issue pipeline so every itinerary starts with FU_Pipe0
def V7Itineraries : ProcessorItineraries<[
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>
+ // single-cycle integer ALU
+ InstrItinData]>,
+ // loads have an extra cycle of latency, but are fully pipelined
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ // fully-pipelined stores
+ InstrItinData]>,
+ InstrItinData]>,
+ // fp ALU is not pipelined
+ InstrItinData]>,
+ // no delay slots, so the latency of a branch is unimportant
+ InstrItinData]>
]>;
-
+// Dual issue pipeline so every itinerary starts with FU_Pipe0 | FU_Pipe1
def CortexA8Itineraries : ProcessorItineraries<[
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>,
- InstrItinData]>
+ // single-cycle integer ALU
+ InstrItinData]>,
+ // loads have an extra cycle of latency, but are fully pipelined
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ InstrItinData, InstrStage<1, [FU_LdSt0]>]>,
+ // fully-pipelined stores
+ InstrItinData]>,
+ InstrItinData]>,
+ // fp ALU is not pipelined
+ InstrItinData]>,
+ // no delay slots, so the latency of a branch is unimportant
+ InstrItinData]>
]>;
From daniel at zuster.org Mon Aug 10 11:05:48 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 16:05:48 -0000
Subject: [llvm-commits] [llvm] r78565 - in /llvm/trunk:
test/MC/AsmParser/hello.s utils/TableGen/AsmMatcherEmitter.cpp
Message-ID: <200908101605.n7AG5mEc028278@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 11:05:47 2009
New Revision: 78565
URL: http://llvm.org/viewvc/llvm-project?rev=78565&view=rev
Log:
llvm-mc/AsmParser: Check for matches with super classes when matching
instruction operands.
Modified:
llvm/trunk/test/MC/AsmParser/hello.s
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/test/MC/AsmParser/hello.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/hello.s?rev=78565&r1=78564&r2=78565&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/hello.s (original)
+++ llvm/trunk/test/MC/AsmParser/hello.s Mon Aug 10 11:05:47 2009
@@ -1,5 +1,4 @@
// RUN: llvm-mc -triple i386-unknown-unknown %s -o -
-// XFAIL: *
.text
.align 4,0x90
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=78565&r1=78564&r2=78565&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Aug 10 11:05:47 2009
@@ -876,6 +876,53 @@
OS << "}\n\n";
}
+/// EmitIsSubclass - Emit the subclass predicate function.
+static void EmitIsSubclass(CodeGenTarget &Target,
+ std::vector &Infos,
+ raw_ostream &OS) {
+ OS << "/// IsSubclass - Compute whether \\arg A is a subclass of \\arg B.\n";
+ OS << "static bool IsSubclass(MatchClassKind A, MatchClassKind B) {\n";
+ OS << " if (A == B)\n";
+ OS << " return true;\n\n";
+
+ OS << " switch (A) {\n";
+ OS << " default:\n";
+ OS << " return false;\n";
+ for (std::vector::iterator it = Infos.begin(),
+ ie = Infos.end(); it != ie; ++it) {
+ ClassInfo &A = **it;
+
+ if (A.Kind != ClassInfo::Token) {
+ std::vector SuperClasses;
+ for (std::vector::iterator it = Infos.begin(),
+ ie = Infos.end(); it != ie; ++it) {
+ ClassInfo &B = **it;
+
+ if (&A != &B && A.getRootClass() == B.getRootClass() && A < B)
+ SuperClasses.push_back(B.Name);
+ }
+
+ if (SuperClasses.empty())
+ continue;
+
+ OS << "\n case " << A.Name << ":\n";
+
+ if (SuperClasses.size() == 1) {
+ OS << " return B == " << SuperClasses.back() << ";\n\n";
+ continue;
+ }
+
+ OS << " switch (B) {\n";
+ OS << " default: return false;\n";
+ for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
+ OS << " case " << SuperClasses[i] << ": return true;\n";
+ OS << " }\n\n";
+ }
+ }
+ OS << " }\n";
+ OS << "}\n\n";
+}
+
typedef std::pair StringPair;
/// FindFirstNonCommonLetter - Find the first character in the keys of the
@@ -1115,6 +1162,9 @@
// Emit the routine to classify an operand.
EmitClassifyOperand(Target, Info.Classes, OS);
+ // Emit the subclass predicate routine.
+ EmitIsSubclass(Target, Info.Classes, OS);
+
// Finally, build the match function.
size_t MaxNumOperands = 0;
@@ -1188,7 +1238,8 @@
<< "*ie = MatchTable + " << Info.Instructions.size()
<< "; it != ie; ++it) {\n";
for (unsigned i = 0; i != MaxNumOperands; ++i) {
- OS << " if (Classes[" << i << "] != it->Classes[" << i << "])\n";
+ OS << " if (!IsSubclass(Classes["
+ << i << "], it->Classes[" << i << "]))\n";
OS << " continue;\n";
}
OS << "\n";
From greened at obbligato.org Mon Aug 10 11:38:08 2009
From: greened at obbligato.org (David Greene)
Date: Mon, 10 Aug 2009 16:38:08 -0000
Subject: [llvm-commits] [llvm] r78567 - in /llvm/trunk:
include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Message-ID: <200908101638.n7AGc8CB032679@zion.cs.uiuc.edu>
Author: greened
Date: Mon Aug 10 11:38:07 2009
New Revision: 78567
URL: http://llvm.org/viewvc/llvm-project?rev=78567&view=rev
Log:
Add support for printing loop structure information in asm comments.
This definitely slows down asm output so put it under an -asm-exuberant
flag.
This information is useful when doing static analysis of performance
issues.
Added:
llvm/trunk/include/llvm/Support/IOManip.h
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=78567&r1=78566&r2=78567&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Aug 10 11:38:07 2009
@@ -29,6 +29,8 @@
class ConstantVector;
class GCMetadataPrinter;
class GlobalVariable;
+ class MachineLoopInfo;
+ class MachineLoop;
class MachineConstantPoolEntry;
class MachineConstantPoolValue;
class MachineModuleInfo;
@@ -64,6 +66,16 @@
/// controlled and used by the SwitchToSection method.
const MCSection *CurrentSection;
+ /// If ExuberantAsm is set, a pointer to the loop info for this
+ /// function.
+ ///
+ MachineLoopInfo *LI;
+
+ /// PrintChildLoopComment - Print comments about child loops
+ /// within the loop for this basic block, with nesting.
+ ///
+ void PrintChildLoopComment(const MachineLoop *loop) const;
+
protected:
/// MMI - If available, this is a pointer to the current MachineModuleInfo.
MachineModuleInfo *MMI;
@@ -122,6 +134,11 @@
///
bool VerboseAsm;
+ /// ExuberantAsm - Emit many more comments in assembly output if
+ /// this is true.
+ ///
+ bool ExuberantAsm;
+
/// Private state for PrintSpecial()
// Assign a unique ID to this machine instruction.
mutable const MachineInstr *LastMI;
@@ -325,6 +342,8 @@
void EmitComments(const MachineInstr &MI) const;
/// EmitComments - Pretty-print comments for instructions
void EmitComments(const MCInst &MI) const;
+ /// EmitComments - Pretty-print comments for basic blocks
+ void EmitComments(const MachineBasicBlock &MBB) const;
protected:
/// EmitZeros - Emit a block of zeros.
Added: llvm/trunk/include/llvm/Support/IOManip.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IOManip.h?rev=78567&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/IOManip.h (added)
+++ llvm/trunk/include/llvm/Support/IOManip.h Mon Aug 10 11:38:07 2009
@@ -0,0 +1,43 @@
+//===----------------- IOManip.h - iostream manipulators ---------*- C++ -*===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Manipulators to do special-purpose formatting.
+//
+//===----------------------------------------------------------------------===//
+
+namespace llvm {
+ /// Indent - Insert spaces into the character output stream. The
+ /// "level" is multiplied by the "scale" to calculate the number of
+ /// spaces to insert. "level" can represent something like loop
+ /// nesting level, for example.
+ ///
+ class Indent {
+ public:
+ explicit Indent(int lvl, int amt = 2)
+ : level(lvl), scale(amt) {}
+
+ template
+ OStream &operator()(OStream &out) const {
+ for(int i = 0; i < level*scale; ++i) {
+ out << " ";
+ }
+ return out;
+ }
+
+ private:
+ int level;
+ int scale;
+ };
+
+ template
+ OStream &operator<<(OStream &out, const Indent &indent)
+ {
+ return(indent(out));
+ }
+}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=78567&r1=78566&r2=78567&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug 10 11:38:07 2009
@@ -19,6 +19,7 @@
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
+#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/Analysis/DebugInfo.h"
@@ -29,6 +30,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/IOManip.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
@@ -46,6 +48,10 @@
AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
cl::init(cl::BOU_UNSET));
+static cl::opt
+AsmExuberant("asm-exuberant", cl::desc("Add many comments."),
+ cl::init(cl::BOU_FALSE));
+
char AsmPrinter::ID = 0;
AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
const TargetAsmInfo *T, bool VDef)
@@ -64,6 +70,11 @@
case cl::BOU_TRUE: VerboseAsm = true; break;
case cl::BOU_FALSE: VerboseAsm = false; break;
}
+ switch (AsmExuberant) {
+ case cl::BOU_UNSET: ExuberantAsm = false; break;
+ case cl::BOU_TRUE: ExuberantAsm = true; break;
+ case cl::BOU_FALSE: ExuberantAsm = false; break;
+ }
}
AsmPrinter::~AsmPrinter() {
@@ -101,6 +112,9 @@
AU.setPreservesAll();
MachineFunctionPass::getAnalysisUsage(AU);
AU.addRequired();
+ if (ExuberantAsm) {
+ AU.addRequired();
+ }
}
bool AsmPrinter::doInitialization(Module &M) {
@@ -233,6 +247,10 @@
// What's my mangled name?
CurrentFnName = Mang->getMangledName(MF.getFunction());
IncrementFunctionNumber();
+
+ if (ExuberantAsm) {
+ LI = &getAnalysis();
+ }
}
namespace {
@@ -1558,9 +1576,16 @@
<< MBB->getNumber();
if (printColon)
O << ':';
- if (printComment && MBB->getBasicBlock())
- O << '\t' << TAI->getCommentString() << ' '
- << MBB->getBasicBlock()->getNameStr();
+ if (printComment) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+
+ if (MBB->getBasicBlock())
+ O << '\t' << TAI->getCommentString() << ' '
+ << MBB->getBasicBlock()->getNameStr();
+
+ if (printColon)
+ EmitComments(*MBB);
+ }
}
/// printPICJumpTableSetLabel - This method prints a set label for the
@@ -1720,3 +1745,74 @@
}
}
}
+
+/// EmitComments - Pretty-print comments for basic blocks
+void AsmPrinter::EmitComments(const MachineBasicBlock &MBB) const
+{
+ if (ExuberantAsm) {
+ // Add loop depth information
+ const MachineLoop *loop = LI->getLoopFor(&MBB);
+
+ if (loop) {
+ // Print a newline after bb# annotation.
+ O << "\n";
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " Loop Depth " << loop->getLoopDepth()
+ << '\n';
+
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+
+ MachineBasicBlock *Header = loop->getHeader();
+ assert(Header && "No header for loop");
+
+ if (Header == &MBB) {
+ O << TAI->getCommentString() << " Loop Header";
+ PrintChildLoopComment(loop);
+ }
+ else {
+ O << TAI->getCommentString() << " Loop Header is BB"
+ << getFunctionNumber() << "_" << loop->getHeader()->getNumber();
+ }
+
+ if (loop->empty()) {
+ O << '\n';
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " Inner Loop";
+ }
+
+ // Add parent loop information
+ for (const MachineLoop *CurLoop = loop->getParentLoop();
+ CurLoop;
+ CurLoop = CurLoop->getParentLoop()) {
+ MachineBasicBlock *Header = CurLoop->getHeader();
+ assert(Header && "No header for loop");
+
+ O << '\n';
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << Indent(CurLoop->getLoopDepth()-1)
+ << " Inside Loop BB" << getFunctionNumber() << "_"
+ << Header->getNumber() << " Depth " << CurLoop->getLoopDepth();
+ }
+ }
+ }
+}
+
+void AsmPrinter::PrintChildLoopComment(const MachineLoop *loop) const {
+ // Add child loop information
+ for(MachineLoop::iterator cl = loop->begin(),
+ clend = loop->end();
+ cl != clend;
+ ++cl) {
+ MachineBasicBlock *Header = (*cl)->getHeader();
+ assert(Header && "No header for loop");
+
+ O << '\n';
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+
+ O << TAI->getCommentString() << Indent((*cl)->getLoopDepth()-1)
+ << " Child Loop BB" << getFunctionNumber() << "_"
+ << Header->getNumber() << " Depth " << (*cl)->getLoopDepth();
+
+ PrintChildLoopComment(*cl);
+ }
+}
From dpatel at apple.com Mon Aug 10 11:37:29 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 10 Aug 2009 16:37:29 -0000
Subject: [llvm-commits] [llvm] r78566 -
/llvm/trunk/docs/WritingAnLLVMPass.html
Message-ID: <200908101637.n7AGbT84032580@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Aug 10 11:37:29 2009
New Revision: 78566
URL: http://llvm.org/viewvc/llvm-project?rev=78566&view=rev
Log:
Clarify limitations of a ModulePass requiring a FunctionPass.
Modified:
llvm/trunk/docs/WritingAnLLVMPass.html
Modified: llvm/trunk/docs/WritingAnLLVMPass.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=78566&r1=78565&r2=78566&view=diff
==============================================================================
--- llvm/trunk/docs/WritingAnLLVMPass.html (original)
+++ llvm/trunk/docs/WritingAnLLVMPass.html Mon Aug 10 11:37:29 2009
@@ -497,7 +497,7 @@
the getAnalysis interface
getAnalysis<DominatorTree>(llvm::Function *) to provide the
function to retrieve analysis result for, if the function pass does not require
-any module passes. Note that this can only be done for functions for which the
+any module or immutable passes. Note that this can only be done for functions for which the
analysis ran, e.g. in the case of dominators you should only ask for the
DominatorTree for function definitions, not declarations.
From bob.wilson at apple.com Mon Aug 10 11:45:37 2009
From: bob.wilson at apple.com (Bob Wilson)
Date: Mon, 10 Aug 2009 09:45:37 -0700
Subject: [llvm-commits] [llvm] r78514 - in /llvm/trunk/lib/Target/ARM:
ARMInstrInfo.td ARMInstrNEON.td ARMInstrThumb.td ARMInstrThumb2.td
AsmPrinter/ARMAsmPrinter.cpp
In-Reply-To: <6a8523d60908091537x4a59941aib5acf7dd4e646739@mail.gmail.com>
References: <200908082310.n78NAfqE027992@zion.cs.uiuc.edu>
<6a8523d60908091537x4a59941aib5acf7dd4e646739@mail.gmail.com>
Message-ID: <3F02C2B4-3C7E-4C8B-8455-6380A9F5E00D@apple.com>
On Aug 9, 2009, at 3:37 PM, Daniel Dunbar wrote:
> On Sat, Aug 8, 2009 at 9:44 PM, Bob Wilson
> wrote:
>> I have a vague idea of what Daniel's thinking, but I'm not sure I get
>> it. It is kind of weird to have "lane_cst" and "printLaneOperand"
>> for
>> things that have nothing to do with Neon lanes. Maybe it would be
>> better to keep the "no_hash" name instead of "lane"? Somehow I
>> suspect that would defeat the purpose.
>
> The name doesn't matter, I would just prefer not to use modifiers for
> things we can express in the .td following existing mechanisms. The
> modifiers are too free form (strstr?) and there is no place to attach
> extra metadata, for example to explain how they should be parsed.
>
> Does that make sense?
So you're not trying to distinguish lane numbers from other immediate
operands that are printed without hash marks? In that case I
definitely prefer a "no_hash" name, or something like that. It sounds
like Anton doesn't care too much about the name, so unless someone
objects, I'll change it sometime.
From gohman at apple.com Mon Aug 10 11:48:40 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 10 Aug 2009 16:48:40 -0000
Subject: [llvm-commits] [llvm] r78568 - in /llvm/trunk/test/CodeGen/ARM:
fnmscs.ll fnmuls.ll
Message-ID: <200908101648.n7AGmeRC001648@zion.cs.uiuc.edu>
Author: djg
Date: Mon Aug 10 11:48:40 2009
New Revision: 78568
URL: http://llvm.org/viewvc/llvm-project?rev=78568&view=rev
Log:
Add nounwind keywords.
Modified:
llvm/trunk/test/CodeGen/ARM/fnmscs.ll
llvm/trunk/test/CodeGen/ARM/fnmuls.ll
Modified: llvm/trunk/test/CodeGen/ARM/fnmscs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fnmscs.ll?rev=78568&r1=78567&r2=78568&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fnmscs.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/fnmscs.ll Mon Aug 10 11:48:40 2009
@@ -5,7 +5,7 @@
; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E {fnmscs\\W*s\[0-9\]+,\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 2
; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E {fnmscs\\W*s\[0-9\]+,\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 2
-define float @test1(float %acc, float %a, float %b) {
+define float @test1(float %acc, float %a, float %b) nounwind {
entry:
%0 = fmul float %a, %b
%1 = fsub float 0.0, %0
@@ -13,7 +13,7 @@
ret float %2
}
-define float @test2(float %acc, float %a, float %b) {
+define float @test2(float %acc, float %a, float %b) nounwind {
entry:
%0 = fmul float %a, %b
%1 = fmul float -1.0, %0
Modified: llvm/trunk/test/CodeGen/ARM/fnmuls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fnmuls.ll?rev=78568&r1=78567&r2=78568&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fnmuls.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/fnmuls.ll Mon Aug 10 11:48:40 2009
@@ -3,14 +3,14 @@
; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E {fnmuls\\W*s\[0-9\]+,\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 2
; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E {fnmuls\\W*s\[0-9\]+,\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 2
-define float @test1(float %a, float %b) {
+define float @test1(float %a, float %b) nounwind {
entry:
%0 = fmul float %a, %b
%1 = fsub float 0.0, %0
ret float %1
}
-define float @test2(float %a, float %b) {
+define float @test2(float %a, float %b) nounwind {
entry:
%0 = fmul float %a, %b
%1 = fmul float -1.0, %0
From gohman at apple.com Mon Aug 10 11:50:32 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 10 Aug 2009 16:50:32 -0000
Subject: [llvm-commits] [llvm] r78569 -
/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200908101650.n7AGoW5a001942@zion.cs.uiuc.edu>
Author: djg
Date: Mon Aug 10 11:50:32 2009
New Revision: 78569
URL: http://llvm.org/viewvc/llvm-project?rev=78569&view=rev
Log:
Make this comment more closely reflect the code.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=78569&r1=78568&r2=78569&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Aug 10 11:50:32 2009
@@ -4061,7 +4061,7 @@
// fold (fmul X, 2.0) -> (fadd X, X)
if (N1CFP && N1CFP->isExactlyValue(+2.0))
return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0, N0);
- // fold (fmul X, (fneg 1.0)) -> (fneg X)
+ // fold (fmul X, -1.0) -> (fneg X)
if (N1CFP && N1CFP->isExactlyValue(-1.0))
if (!LegalOperations || TLI.isOperationLegal(ISD::FNEG, VT))
return DAG.getNode(ISD::FNEG, N->getDebugLoc(), VT, N0);
From Alireza.Moshtaghi at microchip.com Mon Aug 10 12:11:53 2009
From: Alireza.Moshtaghi at microchip.com (Alireza.Moshtaghi at microchip.com)
Date: Mon, 10 Aug 2009 10:11:53 -0700
Subject: [llvm-commits] [llvm] r78354 - in
/llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h PBQP/
PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.h
PBQP/GraphBase.hPBQP/GraphGenerator.h PBQP/HeuristicSolver.h
PBQP/Heuristics/PBQP/Heuristics/Briggs.h PBQP/PBQPMath.h
In-Reply-To: <728927c70908092228q7b654ba6j6c5f8cb6fb8de268@mail.gmail.com>
References: <728927c70908092228q7b654ba6j6c5f8cb6fb8de268@mail.gmail.com>
Message-ID:
Hi Lang,
I read the papers regarding PBQP and it seemed like it has the potential
to be useful for the single register of PIC16, (maybe an overkill but it
has been working fine so far). I was wondering if you can let me know a
little bit about the nature of your modifications. I see that you have
mainly refactored the code into C++ classes, but have you also made
algorithmic changes?
Thanks
Ali
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Lang Hames
> Sent: Sunday, August 09, 2009 10:29 PM
> To: Evan Cheng
> Cc: Commit Messages and Patches for LLVM
> Subject: Re: [llvm-commits] [llvm] r78354 - in
> /llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h PBQP/
> PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.h
> PBQP/GraphBase.hPBQP/GraphGenerator.h PBQP/HeuristicSolver.h
> PBQP/Heuristics/PBQP/Heuristics/Briggs.h PBQP/PBQPMath.h
>
> On Sun, Aug 9, 2009 at 9:52 PM, Evan Cheng
wrote:
> > I somehow doubt PBQP is very good fit for a single register target.
>
> No I don't think so. I certainly appreciate the test case though. Any
> feedback I can get as I try to improve the allocator is welcome.
> Thanks Sanjiv.
>
> Cheers,
> Lang.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From daniel at zuster.org Mon Aug 10 12:14:14 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 10:14:14 -0700
Subject: [llvm-commits] [llvm] r78514 - in /llvm/trunk/lib/Target/ARM:
ARMInstrInfo.td ARMInstrNEON.td ARMInstrThumb.td
ARMInstrThumb2.td AsmPrinter/ARMAsmPrinter.cpp
In-Reply-To: <3F02C2B4-3C7E-4C8B-8455-6380A9F5E00D@apple.com>
References: <200908082310.n78NAfqE027992@zion.cs.uiuc.edu>
<6a8523d60908091537x4a59941aib5acf7dd4e646739@mail.gmail.com>
<3F02C2B4-3C7E-4C8B-8455-6380A9F5E00D@apple.com>
Message-ID: <6a8523d60908101014r1e1c8882y7f5b93e4d82cf89d@mail.gmail.com>
On Mon, Aug 10, 2009 at 9:45 AM, Bob Wilson wrote:
> On Aug 9, 2009, at 3:37 PM, Daniel Dunbar wrote:
>> On Sat, Aug 8, 2009 at 9:44 PM, Bob Wilson
>> wrote:
>>> I have a vague idea of what Daniel's thinking, but I'm not sure I get
>>> it. ?It is kind of weird to have "lane_cst" and "printLaneOperand"
>>> for
>>> things that have nothing to do with Neon lanes. ?Maybe it would be
>>> better to keep the "no_hash" name instead of "lane"? ?Somehow I
>>> suspect that would defeat the purpose.
>>
>> The name doesn't matter, I would just prefer not to use modifiers for
>> things we can express in the .td following existing mechanisms. The
>> modifiers are too free form (strstr?) and there is no place to attach
>> extra metadata, for example to explain how they should be parsed.
>>
>> Does that make sense?
>
> So you're not trying to distinguish lane numbers from other immediate
> operands that are printed without hash marks?
Yes, that is correct.
>?In that case I
> definitely prefer a "no_hash" name, or something like that. ?It sounds
> like Anton doesn't care too much about the name, so unless someone
> objects, I'll change it sometime.
Ok!
- Daniel
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From sabre at nondot.org Mon Aug 10 12:35:42 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 10 Aug 2009 17:35:42 -0000
Subject: [llvm-commits] [llvm] r78571 - in /llvm/trunk:
lib/Target/PIC16/PIC16AsmPrinter.cpp tools/llvm-stub/llvm-stub.c
Message-ID: <200908101735.n7AHZgtS008158@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Aug 10 12:35:42 2009
New Revision: 78571
URL: http://llvm.org/viewvc/llvm-project?rev=78571&view=rev
Log:
fix some warnings for the MSVC build, by Yonggang Luo!
Modified:
llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
llvm/trunk/tools/llvm-stub/llvm-stub.c
Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=78571&r1=78570&r2=78571&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Aug 10 12:35:42 2009
@@ -35,7 +35,7 @@
PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
const TargetAsmInfo *T, bool V)
: AsmPrinter(O, TM, T, V), DbgInfo(O, T) {
- PTLI = static_cast(TM.getTargetLowering());
+ PTLI = static_cast(TM.getTargetLowering());
PTAI = static_cast(T);
PTOF = (PIC16TargetObjectFile*)&PTLI->getObjFileLowering();
}
Modified: llvm/trunk/tools/llvm-stub/llvm-stub.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-stub/llvm-stub.c?rev=78571&r1=78570&r2=78571&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-stub/llvm-stub.c (original)
+++ llvm/trunk/tools/llvm-stub/llvm-stub.c Mon Aug 10 12:35:42 2009
@@ -64,8 +64,7 @@
memcpy(Args+2, argv+1, sizeof(char*)*argc);
/* Run the JIT. */
- execvp(Interp, (char *const*)Args);
-
+ execvp(Interp, (char **)Args);
/* if _execv returns, the JIT could not be started. */
fprintf(stderr, "Could not execute the LLVM JIT. Either add 'lli' to your"
" path, or set the\ninterpreter you want to use in the LLVMINTERP "
From lhames at gmail.com Mon Aug 10 12:41:43 2009
From: lhames at gmail.com (Lang Hames)
Date: Mon, 10 Aug 2009 10:41:43 -0700
Subject: [llvm-commits] [llvm] r78354 - in
/llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h PBQP/
PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.h
PBQP/GraphBase.hPBQP/GraphGenerator.h PBQP/HeuristicSolver.h
PBQP/Heuristics/PBQP/Heuristics/Briggs.h PBQP/PBQPMath.h
In-Reply-To:
References: <728927c70908092228q7b654ba6j6c5f8cb6fb8de268@mail.gmail.com>
Message-ID: <728927c70908101041t271ccb08p6bd9f78d25baf2bb@mail.gmail.com>
Hi Ali,
The new solver is, as you have noted, simply a C++ refactoring of the
C solver. The Briggs heuristic has been rewritten to eagerly evaluate
colorability of RN nodes whenever one of their neighbours is removed.
This may lead to the C++ solver finding different solutions than the C
solver, however the cost of solutions found should, on average, be the
same.
Cheers,
Lang.
On Mon, Aug 10, 2009 at 10:11 AM, wrote:
> Hi Lang,
> I read the papers regarding PBQP and it seemed like it has the potential
> to be useful for the single register of PIC16, (maybe an overkill but it
> has been working fine so far). I was wondering if you can let me know a
> little bit about the nature of your modifications. I see that you have
> mainly refactored the code into C++ classes, but have you also made
> algorithmic changes?
>
> Thanks
> Ali
>
>> -----Original Message-----
>> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
>> bounces at cs.uiuc.edu] On Behalf Of Lang Hames
>> Sent: Sunday, August 09, 2009 10:29 PM
>> To: Evan Cheng
>> Cc: Commit Messages and Patches for LLVM
>> Subject: Re: [llvm-commits] [llvm] r78354 - in
>> /llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h PBQP/
>> PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.h
>> PBQP/GraphBase.hPBQP/GraphGenerator.h PBQP/HeuristicSolver.h
>> PBQP/Heuristics/PBQP/Heuristics/Briggs.h PBQP/PBQPMath.h
>>
>> On Sun, Aug 9, 2009 at 9:52 PM, Evan Cheng
> wrote:
>> > I somehow doubt PBQP is very good fit for a single register target.
>>
>> No I don't think so. I certainly appreciate the test case though. Any
>> feedback I can get as I try to improve the allocator is welcome.
>> Thanks Sanjiv.
>>
>> Cheers,
>> Lang.
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From sabre at nondot.org Mon Aug 10 12:58:51 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 10 Aug 2009 17:58:51 -0000
Subject: [llvm-commits] [llvm] r78572 -
/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
Message-ID: <200908101758.n7AHwpbd011471@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Aug 10 12:58:51 2009
New Revision: 78572
URL: http://llvm.org/viewvc/llvm-project?rev=78572&view=rev
Log:
Fix a weird ppc64-specific link error during an llvm-gcc build:
ld: bad offset (0x00000091) for lo14 instruction pic-base fix-up in ___popcountdi2 from libgcc/./_popcountsi2_s.o
The problem is that the non lazy symbol pointers need to be 8 byte aligned
on ppc64 and .section doesn't have an implicit alignment like ".non_lazy_symbol_pointer"
does.
Modified:
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=78572&r1=78571&r2=78572&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Aug 10 12:58:51 2009
@@ -1063,6 +1063,8 @@
if (!GVStubs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection());
+ EmitAlignment(isPPC64 ? 3 : 2);
+
for (StringMap::iterator I = GVStubs.begin(),
E = GVStubs.end(); I != E; ++I) {
O << I->second << ":\n";
From sabre at nondot.org Mon Aug 10 13:01:34 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 10 Aug 2009 18:01:34 -0000
Subject: [llvm-commits] [llvm] r78573 -
/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Message-ID: <200908101801.n7AI1YKS011866@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Aug 10 13:01:34 2009
New Revision: 78573
URL: http://llvm.org/viewvc/llvm-project?rev=78573&view=rev
Log:
make sure that arm nonlazypointers are aligned properly
Modified:
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=78573&r1=78572&r2=78573&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug 10 13:01:34 2009
@@ -1337,6 +1337,7 @@
if (!GVNonLazyPtrs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection());
+ EmitAlignment(2);
for (StringMap::iterator I = GVNonLazyPtrs.begin(),
E = GVNonLazyPtrs.end(); I != E; ++I) {
O << I->second << ":\n";
From sabre at nondot.org Mon Aug 10 13:02:17 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 10 Aug 2009 18:02:17 -0000
Subject: [llvm-commits] [llvm] r78574 -
/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Message-ID: <200908101802.n7AI2H2R011982@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Aug 10 13:02:16 2009
New Revision: 78574
URL: http://llvm.org/viewvc/llvm-project?rev=78574&view=rev
Log:
arm only needs to emit one .align directive for hidden nlp's, not one
per pointer.
Modified:
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=78574&r1=78573&r2=78574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug 10 13:02:16 2009
@@ -1348,9 +1348,9 @@
if (!HiddenGVNonLazyPtrs.empty()) {
SwitchToSection(getObjFileLowering().getDataSection());
+ EmitAlignment(2);
for (StringMap::iterator I = HiddenGVNonLazyPtrs.begin(),
E = HiddenGVNonLazyPtrs.end(); I != E; ++I) {
- EmitAlignment(2);
O << I->second << ":\n";
O << "\t.long " << I->getKeyData() << "\n";
}
From sabre at nondot.org Mon Aug 10 13:05:55 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 10 Aug 2009 18:05:55 -0000
Subject: [llvm-commits] [llvm] r78575 -
/llvm/trunk/tools/llvm-mc/AsmParser.cpp
Message-ID: <200908101805.n7AI5t9H012494@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Aug 10 13:05:55 2009
New Revision: 78575
URL: http://llvm.org/viewvc/llvm-project?rev=78575&view=rev
Log:
add a fixme
Modified:
llvm/trunk/tools/llvm-mc/AsmParser.cpp
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=78575&r1=78574&r2=78575&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 10 13:05:55 2009
@@ -723,6 +723,10 @@
return false;
}
+/// ParseDirectiveSectionSwitch -
+///
+/// FIXME! Many of these directives implicitly cause a ".align" directive to get
+/// emitted, we don't do this yet which can lead to subtle miscompiles.
bool AsmParser::ParseDirectiveSectionSwitch(const char *Segment,
const char *Section,
unsigned TAA, unsigned StubSize) {
From wendling at apple.com Mon Aug 10 13:07:18 2009
From: wendling at apple.com (Bill Wendling)
Date: Mon, 10 Aug 2009 11:07:18 -0700
Subject: [llvm-commits] [llvm] r78563 - in /llvm/trunk:
include/llvm/CodeGen/ScheduleHazardRecognizer.h
include/llvm/Target/TargetInstrItineraries.h
lib/CodeGen/CMakeLists.txt lib/CodeGen/ExactHazardRecognizer.cpp
lib/CodeGen/ExactHazardRecognizer.h
lib/CodeGen/PostRASchedulerList.cpp
lib/CodeGen/ScheduleDAGInstrs.cpp
lib/CodeGen/SimpleHazardRecognizer.h
In-Reply-To: <200908101555.n7AFtQ7i026880@zion.cs.uiuc.edu>
References: <200908101555.n7AFtQ7i026880@zion.cs.uiuc.edu>
Message-ID: <1C695586-FD87-4291-83AB-4A3BAF535097@apple.com>
Hi David,
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (added)
> +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Mon Aug 10
> 10:55:25 2009
> @@ -0,0 +1,149 @@
> +//===----- ExactHazardRecognizer.cpp - hazard recognizer --------
> ---------===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open
> Source
> +// License. See LICENSE.TXT for details.
> +//
> +//
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> +//
> +// This implements a a hazard recognizer using the instructions
> itineraries
> +// defined for the current target.
> +//
> +//
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> +
> +
> + Scoreboard = new unsigned[ScoreboardDepth];
> + ScoreboardHead = 0;
> +
> + DOUT << "Using exact hazard recognizer: ScoreboardDepth = "
> + << ScoreboardDepth << '\n';
> +}
A general comment, the use of "DOUT" is deprecated. Please use
"DEBUG(errs() << ...); instead.
-bw
From wendling at apple.com Mon Aug 10 13:11:31 2009
From: wendling at apple.com (Bill Wendling)
Date: Mon, 10 Aug 2009 11:11:31 -0700
Subject: [llvm-commits] [llvm] r78567 - in /llvm/trunk:
include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
In-Reply-To: <200908101638.n7AGc8CB032679@zion.cs.uiuc.edu>
References: <200908101638.n7AGc8CB032679@zion.cs.uiuc.edu>
Message-ID: <16FCDF19-368E-4D6E-8052-4249597CAC03@apple.com>
Hi David,
> --- llvm/trunk/include/llvm/Support/IOManip.h (added)
> +++ llvm/trunk/include/llvm/Support/IOManip.h Mon Aug 10 11:38:07 2009
> @@ -0,0 +1,43 @@
> +//===----------------- IOManip.h - iostream manipulators ---------
> *- C++ -*===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open
> Source
> +// License. See LICENSE.TXT for details.
> +//
> +//
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> +//
> +// Manipulators to do special-purpose formatting.
> +//
> +//
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> +
> +namespace llvm {
> + /// Indent - Insert spaces into the character output stream. The
> + /// "level" is multiplied by the "scale" to calculate the number of
> + /// spaces to insert. "level" can represent something like loop
> + /// nesting level, for example.
> + ///
> + class Indent {
> + public:
> + explicit Indent(int lvl, int amt = 2)
> + : level(lvl), scale(amt) {}
> +
> + template
> + OStream &operator()(OStream &out) const {
> + for(int i = 0; i < level*scale; ++i) {
> + out << " ";
> + }
> + return out;
> + }
> +
OStream is already a proper name in Support/Streams.h. This could lead
to confusion, especially if you're #including Support/Debug.h before
this. Could you rename the template argument?
-bw
From sabre at nondot.org Mon Aug 10 13:15:02 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 10 Aug 2009 18:15:02 -0000
Subject: [llvm-commits] [llvm] r78576 - in /llvm/trunk:
include/llvm/MC/MCSection.h include/llvm/MC/MCSectionMachO.h
lib/MC/CMakeLists.txt lib/MC/MCAsmStreamer.cpp lib/MC/MCSection.cpp
lib/MC/MCSectionMachO.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/TargetLoweringObjectFile.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp tools/llvm-mc/AsmParser.cpp
tools/llvm-mc/llvm-mc.cpp
Message-ID: <200908101815.n7AIF2AV013731@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Aug 10 13:15:01 2009
New Revision: 78576
URL: http://llvm.org/viewvc/llvm-project?rev=78576&view=rev
Log:
split MachO section handling stuff out to its out .h/.cpp file.
Added:
llvm/trunk/include/llvm/MC/MCSectionMachO.h
llvm/trunk/lib/MC/MCSectionMachO.cpp
Modified:
llvm/trunk/include/llvm/MC/MCSection.h
llvm/trunk/lib/MC/CMakeLists.txt
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/lib/MC/MCSection.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Modified: llvm/trunk/include/llvm/MC/MCSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSection.h (original)
+++ llvm/trunk/include/llvm/MC/MCSection.h Mon Aug 10 13:15:01 2009
@@ -67,159 +67,6 @@
raw_ostream &OS) const;
};
-
- /// MCSectionMachO - This represents a section on a Mach-O system (used by
- /// Mac OS X). On a Mac system, these are also described in
- /// /usr/include/mach-o/loader.h.
- class MCSectionMachO : public MCSection {
- char SegmentName[16]; // Not necessarily null terminated!
- char SectionName[16]; // Not necessarily null terminated!
-
- /// TypeAndAttributes - This is the SECTION_TYPE and SECTION_ATTRIBUTES
- /// field of a section, drawn from the enums below.
- unsigned TypeAndAttributes;
-
- /// Reserved2 - The 'reserved2' field of a section, used to represent the
- /// size of stubs, for example.
- unsigned Reserved2;
-
- MCSectionMachO(const StringRef &Segment, const StringRef &Section,
- unsigned TAA, unsigned reserved2, SectionKind K)
- : MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
- assert(Segment.size() <= 16 && Section.size() <= 16 &&
- "Segment or section string too long");
- for (unsigned i = 0; i != 16; ++i) {
- if (i < Segment.size())
- SegmentName[i] = Segment[i];
- else
- SegmentName[i] = 0;
-
- if (i < Section.size())
- SectionName[i] = Section[i];
- else
- SectionName[i] = 0;
- }
- }
- public:
-
- static MCSectionMachO *Create(const StringRef &Segment,
- const StringRef &Section,
- unsigned TypeAndAttributes,
- unsigned Reserved2,
- SectionKind K, MCContext &Ctx);
-
- /// These are the section type and attributes fields. A MachO section can
- /// have only one Type, but can have any of the attributes specified.
- enum {
- // TypeAndAttributes bitmasks.
- SECTION_TYPE = 0x000000FFU,
- SECTION_ATTRIBUTES = 0xFFFFFF00U,
-
- // Valid section types.
-
- /// S_REGULAR - Regular section.
- S_REGULAR = 0x00U,
- /// S_ZEROFILL - Zero fill on demand section.
- S_ZEROFILL = 0x01U,
- /// S_CSTRING_LITERALS - Section with literal C strings.
- S_CSTRING_LITERALS = 0x02U,
- /// S_4BYTE_LITERALS - Section with 4 byte literals.
- S_4BYTE_LITERALS = 0x03U,
- /// S_8BYTE_LITERALS - Section with 8 byte literals.
- S_8BYTE_LITERALS = 0x04U,
- /// S_LITERAL_POINTERS - Section with pointers to literals.
- S_LITERAL_POINTERS = 0x05U,
- /// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
- S_NON_LAZY_SYMBOL_POINTERS = 0x06U,
- /// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
- S_LAZY_SYMBOL_POINTERS = 0x07U,
- /// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
- /// the Reserved2 field.
- S_SYMBOL_STUBS = 0x08U,
- /// S_SYMBOL_STUBS - Section with only function pointers for
- /// initialization.
- S_MOD_INIT_FUNC_POINTERS = 0x09U,
- /// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
- /// termination.
- S_MOD_TERM_FUNC_POINTERS = 0x0AU,
- /// S_COALESCED - Section contains symbols that are to be coalesced.
- S_COALESCED = 0x0BU,
- /// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
- /// gigabytes).
- S_GB_ZEROFILL = 0x0CU,
- /// S_INTERPOSING - Section with only pairs of function pointers for
- /// interposing.
- S_INTERPOSING = 0x0DU,
- /// S_16BYTE_LITERALS - Section with only 16 byte literals.
- S_16BYTE_LITERALS = 0x0EU,
- /// S_DTRACE_DOF - Section contains DTrace Object Format.
- S_DTRACE_DOF = 0x0FU,
- /// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
- /// lazy loaded dylibs.
- S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10U,
-
- LAST_KNOWN_SECTION_TYPE = S_LAZY_DYLIB_SYMBOL_POINTERS,
-
-
- // Valid section attributes.
-
- /// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
- /// instructions.
- S_ATTR_PURE_INSTRUCTIONS = 1U << 31,
- /// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
- /// in a ranlib table of contents.
- S_ATTR_NO_TOC = 1U << 30,
- /// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
- /// in files with the MY_DYLDLINK flag.
- S_ATTR_STRIP_STATIC_SYMS = 1U << 29,
- /// S_ATTR_NO_DEAD_STRIP - No dead stripping.
- S_ATTR_NO_DEAD_STRIP = 1U << 28,
- /// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
- S_ATTR_LIVE_SUPPORT = 1U << 27,
- /// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
- /// dyld.
- S_ATTR_SELF_MODIFYING_CODE = 1U << 26,
- /// S_ATTR_DEBUG - A debug section.
- S_ATTR_DEBUG = 1U << 25,
- /// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
- S_ATTR_SOME_INSTRUCTIONS = 1U << 10,
- /// S_ATTR_EXT_RELOC - Section has external relocation entries.
- S_ATTR_EXT_RELOC = 1U << 9,
- /// S_ATTR_LOC_RELOC - Section has local relocation entries.
- S_ATTR_LOC_RELOC = 1U << 8
- };
-
- StringRef getSegmentName() const {
- // SegmentName is not necessarily null terminated!
- if (SegmentName[15])
- return StringRef(SegmentName, 16);
- return StringRef(SegmentName);
- }
- StringRef getSectionName() const {
- // SectionName is not necessarily null terminated!
- if (SectionName[15])
- return StringRef(SectionName, 16);
- return StringRef(SectionName);
- }
-
- unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
-
-
- /// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
- /// This is a string that can appear after a .section directive in a mach-o
- /// flavored .s file. If successful, this fills in the specified Out
- /// parameters and returns an empty string. When an invalid section
- /// specifier is present, this returns a string indicating the problem.
- static std::string ParseSectionSpecifier(StringRef Spec, // In.
- StringRef &Segment, // Out.
- StringRef &Section, // Out.
- unsigned &TAA, // Out.
- unsigned &StubSize); // Out.
-
- virtual void PrintSwitchToSection(const TargetAsmInfo &TAI,
- raw_ostream &OS) const;
- };
-
class MCSectionCOFF : public MCSection {
std::string Name;
Added: llvm/trunk/include/llvm/MC/MCSectionMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionMachO.h?rev=78576&view=auto
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionMachO.h (added)
+++ llvm/trunk/include/llvm/MC/MCSectionMachO.h Mon Aug 10 13:15:01 2009
@@ -0,0 +1,175 @@
+//===- MCSectionMachO.h - MachO Machine Code Sections -----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the MCSectionMachO class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCSECTIONMACHO_H
+#define LLVM_MC_MCSECTIONMACHO_H
+
+#include "llvm/MC/MCSection.h"
+
+namespace llvm {
+
+/// MCSectionMachO - This represents a section on a Mach-O system (used by
+/// Mac OS X). On a Mac system, these are also described in
+/// /usr/include/mach-o/loader.h.
+class MCSectionMachO : public MCSection {
+ char SegmentName[16]; // Not necessarily null terminated!
+ char SectionName[16]; // Not necessarily null terminated!
+
+ /// TypeAndAttributes - This is the SECTION_TYPE and SECTION_ATTRIBUTES
+ /// field of a section, drawn from the enums below.
+ unsigned TypeAndAttributes;
+
+ /// Reserved2 - The 'reserved2' field of a section, used to represent the
+ /// size of stubs, for example.
+ unsigned Reserved2;
+
+ MCSectionMachO(const StringRef &Segment, const StringRef &Section,
+ unsigned TAA, unsigned reserved2, SectionKind K)
+ : MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
+ assert(Segment.size() <= 16 && Section.size() <= 16 &&
+ "Segment or section string too long");
+ for (unsigned i = 0; i != 16; ++i) {
+ if (i < Segment.size())
+ SegmentName[i] = Segment[i];
+ else
+ SegmentName[i] = 0;
+
+ if (i < Section.size())
+ SectionName[i] = Section[i];
+ else
+ SectionName[i] = 0;
+ }
+ }
+public:
+
+ static MCSectionMachO *Create(const StringRef &Segment,
+ const StringRef &Section,
+ unsigned TypeAndAttributes,
+ unsigned Reserved2,
+ SectionKind K, MCContext &Ctx);
+
+ /// These are the section type and attributes fields. A MachO section can
+ /// have only one Type, but can have any of the attributes specified.
+ enum {
+ // TypeAndAttributes bitmasks.
+ SECTION_TYPE = 0x000000FFU,
+ SECTION_ATTRIBUTES = 0xFFFFFF00U,
+
+ // Valid section types.
+
+ /// S_REGULAR - Regular section.
+ S_REGULAR = 0x00U,
+ /// S_ZEROFILL - Zero fill on demand section.
+ S_ZEROFILL = 0x01U,
+ /// S_CSTRING_LITERALS - Section with literal C strings.
+ S_CSTRING_LITERALS = 0x02U,
+ /// S_4BYTE_LITERALS - Section with 4 byte literals.
+ S_4BYTE_LITERALS = 0x03U,
+ /// S_8BYTE_LITERALS - Section with 8 byte literals.
+ S_8BYTE_LITERALS = 0x04U,
+ /// S_LITERAL_POINTERS - Section with pointers to literals.
+ S_LITERAL_POINTERS = 0x05U,
+ /// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
+ S_NON_LAZY_SYMBOL_POINTERS = 0x06U,
+ /// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
+ S_LAZY_SYMBOL_POINTERS = 0x07U,
+ /// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
+ /// the Reserved2 field.
+ S_SYMBOL_STUBS = 0x08U,
+ /// S_SYMBOL_STUBS - Section with only function pointers for
+ /// initialization.
+ S_MOD_INIT_FUNC_POINTERS = 0x09U,
+ /// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
+ /// termination.
+ S_MOD_TERM_FUNC_POINTERS = 0x0AU,
+ /// S_COALESCED - Section contains symbols that are to be coalesced.
+ S_COALESCED = 0x0BU,
+ /// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
+ /// gigabytes).
+ S_GB_ZEROFILL = 0x0CU,
+ /// S_INTERPOSING - Section with only pairs of function pointers for
+ /// interposing.
+ S_INTERPOSING = 0x0DU,
+ /// S_16BYTE_LITERALS - Section with only 16 byte literals.
+ S_16BYTE_LITERALS = 0x0EU,
+ /// S_DTRACE_DOF - Section contains DTrace Object Format.
+ S_DTRACE_DOF = 0x0FU,
+ /// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
+ /// lazy loaded dylibs.
+ S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10U,
+
+ LAST_KNOWN_SECTION_TYPE = S_LAZY_DYLIB_SYMBOL_POINTERS,
+
+
+ // Valid section attributes.
+
+ /// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
+ /// instructions.
+ S_ATTR_PURE_INSTRUCTIONS = 1U << 31,
+ /// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
+ /// in a ranlib table of contents.
+ S_ATTR_NO_TOC = 1U << 30,
+ /// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
+ /// in files with the MY_DYLDLINK flag.
+ S_ATTR_STRIP_STATIC_SYMS = 1U << 29,
+ /// S_ATTR_NO_DEAD_STRIP - No dead stripping.
+ S_ATTR_NO_DEAD_STRIP = 1U << 28,
+ /// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
+ S_ATTR_LIVE_SUPPORT = 1U << 27,
+ /// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
+ /// dyld.
+ S_ATTR_SELF_MODIFYING_CODE = 1U << 26,
+ /// S_ATTR_DEBUG - A debug section.
+ S_ATTR_DEBUG = 1U << 25,
+ /// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
+ S_ATTR_SOME_INSTRUCTIONS = 1U << 10,
+ /// S_ATTR_EXT_RELOC - Section has external relocation entries.
+ S_ATTR_EXT_RELOC = 1U << 9,
+ /// S_ATTR_LOC_RELOC - Section has local relocation entries.
+ S_ATTR_LOC_RELOC = 1U << 8
+ };
+
+ StringRef getSegmentName() const {
+ // SegmentName is not necessarily null terminated!
+ if (SegmentName[15])
+ return StringRef(SegmentName, 16);
+ return StringRef(SegmentName);
+ }
+ StringRef getSectionName() const {
+ // SectionName is not necessarily null terminated!
+ if (SectionName[15])
+ return StringRef(SectionName, 16);
+ return StringRef(SectionName);
+ }
+
+ unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
+
+
+ /// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
+ /// This is a string that can appear after a .section directive in a mach-o
+ /// flavored .s file. If successful, this fills in the specified Out
+ /// parameters and returns an empty string. When an invalid section
+ /// specifier is present, this returns a string indicating the problem.
+ static std::string ParseSectionSpecifier(StringRef Spec, // In.
+ StringRef &Segment, // Out.
+ StringRef &Section, // Out.
+ unsigned &TAA, // Out.
+ unsigned &StubSize); // Out.
+
+ virtual void PrintSwitchToSection(const TargetAsmInfo &TAI,
+ raw_ostream &OS) const;
+};
+
+} // end namespace llvm
+
+#endif
Modified: llvm/trunk/lib/MC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/MC/CMakeLists.txt (original)
+++ llvm/trunk/lib/MC/CMakeLists.txt Mon Aug 10 13:15:01 2009
@@ -4,6 +4,7 @@
MCAsmStreamer.cpp
MCContext.cpp
MCSection.cpp
+ MCSectionMachO.cpp
MCStreamer.cpp
TargetAsmParser.cpp
)
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Aug 10 13:15:01 2009
@@ -11,7 +11,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/lib/MC/MCSection.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSection.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSection.cpp (original)
+++ llvm/trunk/lib/MC/MCSection.cpp Mon Aug 10 13:15:01 2009
@@ -111,275 +111,6 @@
OS << '\n';
}
-//===----------------------------------------------------------------------===//
-// MCSectionMachO
-//===----------------------------------------------------------------------===//
-
-/// SectionTypeDescriptors - These are strings that describe the various section
-/// types. This *must* be kept in order with and stay synchronized with the
-/// section type list.
-static const struct {
- const char *AssemblerName, *EnumName;
-} SectionTypeDescriptors[MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1] = {
- { "regular", "S_REGULAR" }, // 0x00
- { 0, "S_ZEROFILL" }, // 0x01
- { "cstring_literals", "S_CSTRING_LITERALS" }, // 0x02
- { "4byte_literals", "S_4BYTE_LITERALS" }, // 0x03
- { "8byte_literals", "S_8BYTE_LITERALS" }, // 0x04
- { "literal_pointers", "S_LITERAL_POINTERS" }, // 0x05
- { "non_lazy_symbol_pointers", "S_NON_LAZY_SYMBOL_POINTERS" }, // 0x06
- { "lazy_symbol_pointers", "S_LAZY_SYMBOL_POINTERS" }, // 0x07
- { "symbol_stubs", "S_SYMBOL_STUBS" }, // 0x08
- { "mod_init_funcs", "S_MOD_INIT_FUNC_POINTERS" }, // 0x09
- { "mod_term_funcs", "S_MOD_TERM_FUNC_POINTERS" }, // 0x0A
- { "coalesced", "S_COALESCED" }, // 0x0B
- { 0, /*FIXME??*/ "S_GB_ZEROFILL" }, // 0x0C
- { "interposing", "S_INTERPOSING" }, // 0x0D
- { "16byte_literals", "S_16BYTE_LITERALS" }, // 0x0E
- { 0, /*FIXME??*/ "S_DTRACE_DOF" }, // 0x0F
- { 0, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" } // 0x10
-};
-
-
-/// SectionAttrDescriptors - This is an array of descriptors for section
-/// attributes. Unlike the SectionTypeDescriptors, this is not directly indexed
-/// by attribute, instead it is searched. The last entry has a zero AttrFlag
-/// value.
-static const struct {
- unsigned AttrFlag;
- const char *AssemblerName, *EnumName;
-} SectionAttrDescriptors[] = {
-#define ENTRY(ASMNAME, ENUM) \
- { MCSectionMachO::ENUM, ASMNAME, #ENUM },
-ENTRY("pure_instructions", S_ATTR_PURE_INSTRUCTIONS)
-ENTRY("no_toc", S_ATTR_NO_TOC)
-ENTRY("strip_static_syms", S_ATTR_STRIP_STATIC_SYMS)
-ENTRY("no_dead_strip", S_ATTR_NO_DEAD_STRIP)
-ENTRY("live_support", S_ATTR_LIVE_SUPPORT)
-ENTRY("self_modifying_code", S_ATTR_SELF_MODIFYING_CODE)
-ENTRY("debug", S_ATTR_DEBUG)
-ENTRY(0 /*FIXME*/, S_ATTR_SOME_INSTRUCTIONS)
-ENTRY(0 /*FIXME*/, S_ATTR_EXT_RELOC)
-ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
-#undef ENTRY
- { 0, "none", 0 }
-};
-
-
-MCSectionMachO *MCSectionMachO::
-Create(const StringRef &Segment, const StringRef &Section,
- unsigned TypeAndAttributes, unsigned Reserved2,
- SectionKind K, MCContext &Ctx) {
- // S_SYMBOL_STUBS must be set for Reserved2 to be non-zero.
- return new (Ctx) MCSectionMachO(Segment, Section, TypeAndAttributes,
- Reserved2, K);
-}
-
-void MCSectionMachO::PrintSwitchToSection(const TargetAsmInfo &TAI,
- raw_ostream &OS) const {
- OS << "\t.section\t" << getSegmentName() << ',' << getSectionName();
-
- // Get the section type and attributes.
- unsigned TAA = getTypeAndAttributes();
- if (TAA == 0) {
- OS << '\n';
- return;
- }
-
- OS << ',';
-
- unsigned SectionType = TAA & MCSectionMachO::SECTION_TYPE;
- assert(SectionType <= MCSectionMachO::LAST_KNOWN_SECTION_TYPE &&
- "Invalid SectionType specified!");
-
- if (SectionTypeDescriptors[SectionType].AssemblerName)
- OS << SectionTypeDescriptors[SectionType].AssemblerName;
- else
- OS << "<<" << SectionTypeDescriptors[SectionType].EnumName << ">>";
-
- // If we don't have any attributes, we're done.
- unsigned SectionAttrs = TAA & MCSectionMachO::SECTION_ATTRIBUTES;
- if (SectionAttrs == 0) {
- // If we have a S_SYMBOL_STUBS size specified, print it along with 'none' as
- // the attribute specifier.
- if (Reserved2 != 0)
- OS << ",none," << Reserved2;
- OS << '\n';
- return;
- }
-
- // Check each attribute to see if we have it.
- char Separator = ',';
- for (unsigned i = 0; SectionAttrDescriptors[i].AttrFlag; ++i) {
- // Check to see if we have this attribute.
- if ((SectionAttrDescriptors[i].AttrFlag & SectionAttrs) == 0)
- continue;
-
- // Yep, clear it and print it.
- SectionAttrs &= ~SectionAttrDescriptors[i].AttrFlag;
-
- OS << Separator;
- if (SectionAttrDescriptors[i].AssemblerName)
- OS << SectionAttrDescriptors[i].AssemblerName;
- else
- OS << "<<" << SectionAttrDescriptors[i].EnumName << ">>";
- Separator = '+';
- }
-
- assert(SectionAttrs == 0 && "Unknown section attributes!");
-
- // If we have a S_SYMBOL_STUBS size specified, print it.
- if (Reserved2 != 0)
- OS << ',' << Reserved2;
- OS << '\n';
-}
-
-/// StripSpaces - This removes leading and trailing spaces from the StringRef.
-static void StripSpaces(StringRef &Str) {
- while (!Str.empty() && isspace(Str[0]))
- Str = Str.substr(1);
- while (!Str.empty() && isspace(Str.back()))
- Str = Str.substr(0, Str.size()-1);
-}
-
-/// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
-/// This is a string that can appear after a .section directive in a mach-o
-/// flavored .s file. If successful, this fills in the specified Out
-/// parameters and returns an empty string. When an invalid section
-/// specifier is present, this returns a string indicating the problem.
-std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
- StringRef &Segment, // Out.
- StringRef &Section, // Out.
- unsigned &TAA, // Out.
- unsigned &StubSize) { // Out.
- // Find the first comma.
- std::pair Comma = Spec.split(',');
-
- // If there is no comma, we fail.
- if (Comma.second.empty())
- return "mach-o section specifier requires a segment and section "
- "separated by a comma";
-
- // Capture segment, remove leading and trailing whitespace.
- Segment = Comma.first;
- StripSpaces(Segment);
-
- // Verify that the segment is present and not too long.
- if (Segment.empty() || Segment.size() > 16)
- return "mach-o section specifier requires a segment whose length is "
- "between 1 and 16 characters";
-
- // Split the section name off from any attributes if present.
- Comma = Comma.second.split(',');
-
- // Capture section, remove leading and trailing whitespace.
- Section = Comma.first;
- StripSpaces(Section);
-
- // Verify that the section is present and not too long.
- if (Section.empty() || Section.size() > 16)
- return "mach-o section specifier requires a section whose length is "
- "between 1 and 16 characters";
-
- // If there is no comma after the section, we're done.
- TAA = 0;
- StubSize = 0;
- if (Comma.second.empty())
- return "";
-
- // Otherwise, we need to parse the section type and attributes.
- Comma = Comma.second.split(',');
-
- // Get the section type.
- StringRef SectionType = Comma.first;
- StripSpaces(SectionType);
-
- // Figure out which section type it is.
- unsigned TypeID;
- for (TypeID = 0; TypeID !=MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1; ++TypeID)
- if (SectionTypeDescriptors[TypeID].AssemblerName &&
- SectionType == SectionTypeDescriptors[TypeID].AssemblerName)
- break;
-
- // If we didn't find the section type, reject it.
- if (TypeID > MCSectionMachO::LAST_KNOWN_SECTION_TYPE)
- return "mach-o section specifier uses an unknown section type";
-
- // Remember the TypeID.
- TAA = TypeID;
-
- // If we have no comma after the section type, there are no attributes.
- if (Comma.second.empty()) {
- // S_SYMBOL_STUBS always require a symbol stub size specifier.
- if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
- return "mach-o section specifier of type 'symbol_stubs' requires a size "
- "specifier";
- return "";
- }
-
- // Otherwise, we do have some attributes. Split off the size specifier if
- // present.
- Comma = Comma.second.split(',');
- StringRef Attrs = Comma.first;
-
- // The attribute list is a '+' separated list of attributes.
- std::pair Plus = Attrs.split('+');
-
- while (1) {
- StringRef Attr = Plus.first;
- StripSpaces(Attr);
-
- // Look up the attribute.
- for (unsigned i = 0; ; ++i) {
- if (SectionAttrDescriptors[i].AttrFlag == 0)
- return "mach-o section specifier has invalid attribute";
-
- if (SectionAttrDescriptors[i].AssemblerName &&
- Attr == SectionAttrDescriptors[i].AssemblerName) {
- TAA |= SectionAttrDescriptors[i].AttrFlag;
- break;
- }
- }
-
- if (Plus.second.empty()) break;
- Plus = Plus.second.split('+');
- };
-
- // Okay, we've parsed the section attributes, see if we have a stub size spec.
- if (Comma.second.empty()) {
- // S_SYMBOL_STUBS always require a symbol stub size specifier.
- if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
- return "mach-o section specifier of type 'symbol_stubs' requires a size "
- "specifier";
- return "";
- }
-
- // If we have a stub size spec, we must have a sectiontype of S_SYMBOL_STUBS.
- if ((TAA & MCSectionMachO::SECTION_TYPE) != MCSectionMachO::S_SYMBOL_STUBS)
- return "mach-o section specifier cannot have a stub size specified because "
- "it does not have type 'symbol_stubs'";
-
- // Okay, if we do, it must be a number.
- StringRef StubSizeStr = Comma.second;
- StripSpaces(StubSizeStr);
-
- // Convert the a null terminated buffer for strtoul.
- char TmpBuffer[32];
- if (StubSizeStr.size() >= 32)
- return"mach-o section specifier has a stub size specifier that is too long";
-
- memcpy(TmpBuffer, StubSizeStr.data(), StubSizeStr.size());
- TmpBuffer[StubSizeStr.size()] = 0;
-
- char *EndPtr;
- StubSize = strtoul(TmpBuffer, &EndPtr, 0);
-
- if (EndPtr[0] != 0)
- return "mach-o section specifier has a malformed stub size";
-
- return "";
-}
-
//===----------------------------------------------------------------------===//
// MCSectionCOFF
Added: llvm/trunk/lib/MC/MCSectionMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionMachO.cpp?rev=78576&view=auto
==============================================================================
--- llvm/trunk/lib/MC/MCSectionMachO.cpp (added)
+++ llvm/trunk/lib/MC/MCSectionMachO.cpp Mon Aug 10 13:15:01 2009
@@ -0,0 +1,279 @@
+//===- lib/MC/MCSectionMachO.cpp - MachO Code Section Representation ------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCSectionMachO.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/Support/raw_ostream.h"
+using namespace llvm;
+
+/// SectionTypeDescriptors - These are strings that describe the various section
+/// types. This *must* be kept in order with and stay synchronized with the
+/// section type list.
+static const struct {
+ const char *AssemblerName, *EnumName;
+} SectionTypeDescriptors[MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1] = {
+ { "regular", "S_REGULAR" }, // 0x00
+ { 0, "S_ZEROFILL" }, // 0x01
+ { "cstring_literals", "S_CSTRING_LITERALS" }, // 0x02
+ { "4byte_literals", "S_4BYTE_LITERALS" }, // 0x03
+ { "8byte_literals", "S_8BYTE_LITERALS" }, // 0x04
+ { "literal_pointers", "S_LITERAL_POINTERS" }, // 0x05
+ { "non_lazy_symbol_pointers", "S_NON_LAZY_SYMBOL_POINTERS" }, // 0x06
+ { "lazy_symbol_pointers", "S_LAZY_SYMBOL_POINTERS" }, // 0x07
+ { "symbol_stubs", "S_SYMBOL_STUBS" }, // 0x08
+ { "mod_init_funcs", "S_MOD_INIT_FUNC_POINTERS" }, // 0x09
+ { "mod_term_funcs", "S_MOD_TERM_FUNC_POINTERS" }, // 0x0A
+ { "coalesced", "S_COALESCED" }, // 0x0B
+ { 0, /*FIXME??*/ "S_GB_ZEROFILL" }, // 0x0C
+ { "interposing", "S_INTERPOSING" }, // 0x0D
+ { "16byte_literals", "S_16BYTE_LITERALS" }, // 0x0E
+ { 0, /*FIXME??*/ "S_DTRACE_DOF" }, // 0x0F
+ { 0, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" } // 0x10
+};
+
+
+/// SectionAttrDescriptors - This is an array of descriptors for section
+/// attributes. Unlike the SectionTypeDescriptors, this is not directly indexed
+/// by attribute, instead it is searched. The last entry has a zero AttrFlag
+/// value.
+static const struct {
+ unsigned AttrFlag;
+ const char *AssemblerName, *EnumName;
+} SectionAttrDescriptors[] = {
+#define ENTRY(ASMNAME, ENUM) \
+ { MCSectionMachO::ENUM, ASMNAME, #ENUM },
+ENTRY("pure_instructions", S_ATTR_PURE_INSTRUCTIONS)
+ENTRY("no_toc", S_ATTR_NO_TOC)
+ENTRY("strip_static_syms", S_ATTR_STRIP_STATIC_SYMS)
+ENTRY("no_dead_strip", S_ATTR_NO_DEAD_STRIP)
+ENTRY("live_support", S_ATTR_LIVE_SUPPORT)
+ENTRY("self_modifying_code", S_ATTR_SELF_MODIFYING_CODE)
+ENTRY("debug", S_ATTR_DEBUG)
+ENTRY(0 /*FIXME*/, S_ATTR_SOME_INSTRUCTIONS)
+ENTRY(0 /*FIXME*/, S_ATTR_EXT_RELOC)
+ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
+#undef ENTRY
+ { 0, "none", 0 }
+};
+
+
+MCSectionMachO *MCSectionMachO::
+Create(const StringRef &Segment, const StringRef &Section,
+ unsigned TypeAndAttributes, unsigned Reserved2,
+ SectionKind K, MCContext &Ctx) {
+ // S_SYMBOL_STUBS must be set for Reserved2 to be non-zero.
+ return new (Ctx) MCSectionMachO(Segment, Section, TypeAndAttributes,
+ Reserved2, K);
+}
+
+void MCSectionMachO::PrintSwitchToSection(const TargetAsmInfo &TAI,
+ raw_ostream &OS) const {
+ OS << "\t.section\t" << getSegmentName() << ',' << getSectionName();
+
+ // Get the section type and attributes.
+ unsigned TAA = getTypeAndAttributes();
+ if (TAA == 0) {
+ OS << '\n';
+ return;
+ }
+
+ OS << ',';
+
+ unsigned SectionType = TAA & MCSectionMachO::SECTION_TYPE;
+ assert(SectionType <= MCSectionMachO::LAST_KNOWN_SECTION_TYPE &&
+ "Invalid SectionType specified!");
+
+ if (SectionTypeDescriptors[SectionType].AssemblerName)
+ OS << SectionTypeDescriptors[SectionType].AssemblerName;
+ else
+ OS << "<<" << SectionTypeDescriptors[SectionType].EnumName << ">>";
+
+ // If we don't have any attributes, we're done.
+ unsigned SectionAttrs = TAA & MCSectionMachO::SECTION_ATTRIBUTES;
+ if (SectionAttrs == 0) {
+ // If we have a S_SYMBOL_STUBS size specified, print it along with 'none' as
+ // the attribute specifier.
+ if (Reserved2 != 0)
+ OS << ",none," << Reserved2;
+ OS << '\n';
+ return;
+ }
+
+ // Check each attribute to see if we have it.
+ char Separator = ',';
+ for (unsigned i = 0; SectionAttrDescriptors[i].AttrFlag; ++i) {
+ // Check to see if we have this attribute.
+ if ((SectionAttrDescriptors[i].AttrFlag & SectionAttrs) == 0)
+ continue;
+
+ // Yep, clear it and print it.
+ SectionAttrs &= ~SectionAttrDescriptors[i].AttrFlag;
+
+ OS << Separator;
+ if (SectionAttrDescriptors[i].AssemblerName)
+ OS << SectionAttrDescriptors[i].AssemblerName;
+ else
+ OS << "<<" << SectionAttrDescriptors[i].EnumName << ">>";
+ Separator = '+';
+ }
+
+ assert(SectionAttrs == 0 && "Unknown section attributes!");
+
+ // If we have a S_SYMBOL_STUBS size specified, print it.
+ if (Reserved2 != 0)
+ OS << ',' << Reserved2;
+ OS << '\n';
+}
+
+/// StripSpaces - This removes leading and trailing spaces from the StringRef.
+static void StripSpaces(StringRef &Str) {
+ while (!Str.empty() && isspace(Str[0]))
+ Str = Str.substr(1);
+ while (!Str.empty() && isspace(Str.back()))
+ Str = Str.substr(0, Str.size()-1);
+}
+
+/// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
+/// This is a string that can appear after a .section directive in a mach-o
+/// flavored .s file. If successful, this fills in the specified Out
+/// parameters and returns an empty string. When an invalid section
+/// specifier is present, this returns a string indicating the problem.
+std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
+ StringRef &Segment, // Out.
+ StringRef &Section, // Out.
+ unsigned &TAA, // Out.
+ unsigned &StubSize) { // Out.
+ // Find the first comma.
+ std::pair Comma = Spec.split(',');
+
+ // If there is no comma, we fail.
+ if (Comma.second.empty())
+ return "mach-o section specifier requires a segment and section "
+ "separated by a comma";
+
+ // Capture segment, remove leading and trailing whitespace.
+ Segment = Comma.first;
+ StripSpaces(Segment);
+
+ // Verify that the segment is present and not too long.
+ if (Segment.empty() || Segment.size() > 16)
+ return "mach-o section specifier requires a segment whose length is "
+ "between 1 and 16 characters";
+
+ // Split the section name off from any attributes if present.
+ Comma = Comma.second.split(',');
+
+ // Capture section, remove leading and trailing whitespace.
+ Section = Comma.first;
+ StripSpaces(Section);
+
+ // Verify that the section is present and not too long.
+ if (Section.empty() || Section.size() > 16)
+ return "mach-o section specifier requires a section whose length is "
+ "between 1 and 16 characters";
+
+ // If there is no comma after the section, we're done.
+ TAA = 0;
+ StubSize = 0;
+ if (Comma.second.empty())
+ return "";
+
+ // Otherwise, we need to parse the section type and attributes.
+ Comma = Comma.second.split(',');
+
+ // Get the section type.
+ StringRef SectionType = Comma.first;
+ StripSpaces(SectionType);
+
+ // Figure out which section type it is.
+ unsigned TypeID;
+ for (TypeID = 0; TypeID !=MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1; ++TypeID)
+ if (SectionTypeDescriptors[TypeID].AssemblerName &&
+ SectionType == SectionTypeDescriptors[TypeID].AssemblerName)
+ break;
+
+ // If we didn't find the section type, reject it.
+ if (TypeID > MCSectionMachO::LAST_KNOWN_SECTION_TYPE)
+ return "mach-o section specifier uses an unknown section type";
+
+ // Remember the TypeID.
+ TAA = TypeID;
+
+ // If we have no comma after the section type, there are no attributes.
+ if (Comma.second.empty()) {
+ // S_SYMBOL_STUBS always require a symbol stub size specifier.
+ if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
+ return "mach-o section specifier of type 'symbol_stubs' requires a size "
+ "specifier";
+ return "";
+ }
+
+ // Otherwise, we do have some attributes. Split off the size specifier if
+ // present.
+ Comma = Comma.second.split(',');
+ StringRef Attrs = Comma.first;
+
+ // The attribute list is a '+' separated list of attributes.
+ std::pair Plus = Attrs.split('+');
+
+ while (1) {
+ StringRef Attr = Plus.first;
+ StripSpaces(Attr);
+
+ // Look up the attribute.
+ for (unsigned i = 0; ; ++i) {
+ if (SectionAttrDescriptors[i].AttrFlag == 0)
+ return "mach-o section specifier has invalid attribute";
+
+ if (SectionAttrDescriptors[i].AssemblerName &&
+ Attr == SectionAttrDescriptors[i].AssemblerName) {
+ TAA |= SectionAttrDescriptors[i].AttrFlag;
+ break;
+ }
+ }
+
+ if (Plus.second.empty()) break;
+ Plus = Plus.second.split('+');
+ };
+
+ // Okay, we've parsed the section attributes, see if we have a stub size spec.
+ if (Comma.second.empty()) {
+ // S_SYMBOL_STUBS always require a symbol stub size specifier.
+ if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
+ return "mach-o section specifier of type 'symbol_stubs' requires a size "
+ "specifier";
+ return "";
+ }
+
+ // If we have a stub size spec, we must have a sectiontype of S_SYMBOL_STUBS.
+ if ((TAA & MCSectionMachO::SECTION_TYPE) != MCSectionMachO::S_SYMBOL_STUBS)
+ return "mach-o section specifier cannot have a stub size specified because "
+ "it does not have type 'symbol_stubs'";
+
+ // Okay, if we do, it must be a number.
+ StringRef StubSizeStr = Comma.second;
+ StripSpaces(StubSizeStr);
+
+ // Convert the a null terminated buffer for strtoul.
+ char TmpBuffer[32];
+ if (StubSizeStr.size() >= 32)
+ return"mach-o section specifier has a stub size specifier that is too long";
+
+ memcpy(TmpBuffer, StubSizeStr.data(), StubSizeStr.size());
+ TmpBuffer[StubSizeStr.size()] = 0;
+
+ char *EndPtr;
+ StubSize = strtoul(TmpBuffer, &EndPtr, 0);
+
+ if (EndPtr[0] != 0)
+ return "mach-o section specifier has a malformed stub size";
+
+ return "";
+}
+
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug 10 13:15:01 2009
@@ -26,7 +26,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Aug 10 13:15:01 2009
@@ -31,7 +31,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegisterInfo.h"
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon Aug 10 13:15:01 2009
@@ -17,7 +17,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 10 13:15:01 2009
@@ -28,7 +28,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 10 13:15:01 2009
@@ -17,7 +17,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/SourceMgr.h"
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=78576&r1=78575&r2=78576&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Mon Aug 10 13:15:01 2009
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/CommandLine.h"
From resistor at mac.com Mon Aug 10 13:16:08 2009
From: resistor at mac.com (Owen Anderson)
Date: Mon, 10 Aug 2009 18:16:08 -0000
Subject: [llvm-commits] [llvm] r78577 - in /llvm/trunk:
include/llvm/Constants.h include/llvm/Metadata.h lib/VMCore/Constants.cpp
lib/VMCore/ConstantsContext.h lib/VMCore/LLVMContextImpl.h
lib/VMCore/Metadata.cpp
Message-ID: <200908101816.n7AIG8CS013899@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Aug 10 13:16:08 2009
New Revision: 78577
URL: http://llvm.org/viewvc/llvm-project?rev=78577&view=rev
Log:
Change the MDNode uniquing to a ValueMap, at Devang's request.
Modified:
llvm/trunk/include/llvm/Constants.h
llvm/trunk/include/llvm/Metadata.h
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/ConstantsContext.h
llvm/trunk/lib/VMCore/LLVMContextImpl.h
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=78577&r1=78576&r2=78577&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constants.h (original)
+++ llvm/trunk/include/llvm/Constants.h Mon Aug 10 13:16:08 2009
@@ -38,7 +38,7 @@
template
struct ConstantCreator;
template
-struct ConvertConstantType;
+struct ConvertType;
//===----------------------------------------------------------------------===//
/// This is the shared class of boolean and integer constants. This class
@@ -552,7 +552,7 @@
class ConstantExpr : public Constant {
friend struct ConstantCreator > >;
- friend struct ConvertConstantType;
+ friend struct ConvertType;
protected:
ConstantExpr(const Type *ty, unsigned Opcode, Use *Ops, unsigned NumOps)
Modified: llvm/trunk/include/llvm/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=78577&r1=78576&r2=78577&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Metadata.h (original)
+++ llvm/trunk/include/llvm/Metadata.h Mon Aug 10 13:16:08 2009
@@ -28,6 +28,8 @@
namespace llvm {
class Constant;
struct LLVMContext;
+template
+struct ConstantCreator;
//===----------------------------------------------------------------------===//
// MetadataBase - A base class for MDNode, MDString and NamedMDNode.
@@ -115,6 +117,8 @@
unsigned getNumOperands() { return User::getNumOperands(); }
SmallVector Node;
+
+ friend struct ConstantCreator >;
protected:
explicit MDNode(Value*const* Vals, unsigned NumVals);
public:
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=78577&r1=78576&r2=78577&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Aug 10 13:16:08 2009
@@ -1803,7 +1803,7 @@
pImpl->ArrayConstants.InsertOrGetItem(Lookup, Exists);
if (Exists) {
- Replacement = I->second;
+ Replacement = cast(I->second);
} else {
// Okay, the new shape doesn't exist in the system yet. Instead of
// creating a new constant array, inserting it, replaceallusesof'ing the
@@ -1890,7 +1890,7 @@
pImpl->StructConstants.InsertOrGetItem(Lookup, Exists);
if (Exists) {
- Replacement = I->second;
+ Replacement = cast(I->second);
} else {
// Okay, the new shape doesn't exist in the system yet. Instead of
// creating a new constant struct, inserting it, replaceallusesof'ing the
Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=78577&r1=78576&r2=78577&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
+++ llvm/trunk/lib/VMCore/ConstantsContext.h Mon Aug 10 13:16:08 2009
@@ -16,6 +16,7 @@
#define LLVM_CONSTANTSCONTEXT_H
#include "llvm/Instructions.h"
+#include "llvm/Metadata.h"
#include "llvm/Operator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -339,7 +340,7 @@
};
template
-struct ConvertConstantType {
+struct ConvertType {
static void convert(ConstantClass *OldC, const TypeClass *NewTy) {
llvm_unreachable("This type cannot be converted!");
}
@@ -390,7 +391,7 @@
};
template<>
-struct ConvertConstantType {
+struct ConvertType {
static void convert(ConstantExpr *OldC, const Type *NewTy) {
Constant *New;
switch (OldC->getOpcode()) {
@@ -443,7 +444,14 @@
};
template<>
-struct ConvertConstantType {
+struct ConstantCreator > {
+ static MDNode *create(const Type* Ty, const std::vector &V) {
+ return new MDNode(V.data(), V.size());
+ }
+};
+
+template<>
+struct ConvertType {
static void convert(ConstantVector *OldC, const VectorType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector C;
@@ -457,7 +465,7 @@
};
template<>
-struct ConvertConstantType {
+struct ConvertType {
static void convert(ConstantAggregateZero *OldC, const Type *NewTy) {
// Make everyone now use a constant of the new type...
Constant *New = ConstantAggregateZero::get(NewTy);
@@ -468,7 +476,7 @@
};
template<>
-struct ConvertConstantType {
+struct ConvertType {
static void convert(ConstantArray *OldC, const ArrayType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector C;
@@ -482,7 +490,7 @@
};
template<>
-struct ConvertConstantType {
+struct ConvertType {
static void convert(ConstantStruct *OldC, const StructType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector C;
@@ -505,7 +513,7 @@
};
template<>
-struct ConvertConstantType {
+struct ConvertType {
static void convert(ConstantPointerNull *OldC, const PointerType *NewTy) {
// Make everyone now use a constant of the new type...
Constant *New = ConstantPointerNull::get(NewTy);
@@ -524,7 +532,7 @@
};
template<>
-struct ConvertConstantType {
+struct ConvertType {
static void convert(UndefValue *OldC, const Type *NewTy) {
// Make everyone now use a constant of the new type.
Constant *New = UndefValue::get(NewTy);
@@ -539,8 +547,8 @@
class ValueMap : public AbstractTypeUser {
public:
typedef std::pair MapKey;
- typedef std::map MapTy;
- typedef std::map InverseMapTy;
+ typedef std::map MapTy;
+ typedef std::map InverseMapTy;
typedef std::map AbstractTypeMapTy;
private:
/// Map - This is the main map from the element descriptor to the Constants.
@@ -749,8 +757,7 @@
// leaving will remove() itself, causing the AbstractTypeMapEntry to be
// eliminated eventually.
do {
- ConvertConstantType::convert(
+ ConvertType::convert(
static_cast(I->second->second),
cast(NewTy));
Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=78577&r1=78576&r2=78577&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Aug 10 13:16:08 2009
@@ -103,9 +103,9 @@
StringMap MDStringCache;
- FoldingSet MDNodeSet;
-
ValueMap AggZeroConstants;
+
+ ValueMap, Type, MDNode> MDNodeSet;
typedef ValueMap, ArrayType,
ConstantArray, true /*largekey*/> ArrayConstantsTy;
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=78577&r1=78576&r2=78577&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Aug 10 13:16:08 2009
@@ -83,26 +83,12 @@
MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
LLVMContextImpl *pImpl = Context.pImpl;
- FoldingSetNodeID ID;
- for (unsigned i = 0; i != NumVals; ++i)
- ID.AddPointer(Vals[i]);
-
- pImpl->ConstantsLock.reader_acquire();
- void *InsertPoint;
- MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
- pImpl->ConstantsLock.reader_release();
+ std::vector V;
+ V.reserve(NumVals);
+ for (unsigned i = 0; i < NumVals; ++i)
+ V.push_back(Vals[i]);
- if (!N) {
- sys::SmartScopedWriter Writer(pImpl->ConstantsLock);
- N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
- if (!N) {
- // InsertPoint will have been set by the FindNodeOrInsertPos call.
- N = new MDNode(Vals, NumVals);
- pImpl->MDNodeSet.InsertNode(N, InsertPoint);
- }
- }
-
- return N;
+ return pImpl->MDNodeSet.getOrCreate(Type::MetadataTy, V);
}
/// dropAllReferences - Remove all uses and clear node vector.
From benny.kra at googlemail.com Mon Aug 10 13:27:34 2009
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 10 Aug 2009 18:27:34 -0000
Subject: [llvm-commits] [llvm] r78579 -
/llvm/trunk/lib/VMCore/ConstantsContext.h
Message-ID: <200908101827.n7AIRYnQ015599@zion.cs.uiuc.edu>
Author: d0k
Date: Mon Aug 10 13:27:33 2009
New Revision: 78579
URL: http://llvm.org/viewvc/llvm-project?rev=78579&view=rev
Log:
g++ 4.0 doesn't have std::vector::data.
Modified:
llvm/trunk/lib/VMCore/ConstantsContext.h
Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=78579&r1=78578&r2=78579&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
+++ llvm/trunk/lib/VMCore/ConstantsContext.h Mon Aug 10 13:27:33 2009
@@ -446,7 +446,7 @@
template<>
struct ConstantCreator > {
static MDNode *create(const Type* Ty, const std::vector &V) {
- return new MDNode(V.data(), V.size());
+ return new MDNode(&V[0], V.size());
}
};
From Alireza.Moshtaghi at microchip.com Mon Aug 10 13:27:32 2009
From: Alireza.Moshtaghi at microchip.com (Alireza.Moshtaghi at microchip.com)
Date: Mon, 10 Aug 2009 11:27:32 -0700
Subject: [llvm-commits] [llvm] r78354 -
in/llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h
PBQP/PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.hPBQP/GraphBase.hPBQP/GraphGenerator.h
PBQP/HeuristicSolver.hPBQP/Heuristics/PBQP/Heuristics/Briggs.h
PBQP/PBQPMath.h
In-Reply-To: <728927c70908101041t271ccb08p6bd9f78d25baf2bb@mail.gmail.com>
References: <728927c70908092228q7b654ba6j6c5f8cb6fb8de268@mail.gmail.com>
<728927c70908101041t271ccb08p6bd9f78d25baf2bb@mail.gmail.com>
Message-ID:
> The Briggs heuristic has been rewritten to eagerly evaluate
> colorability of RN nodes whenever one of their neighbours is removed.
> This may lead to the C++ solver finding different solutions than the C
> solver, however the cost of solutions found should, on average, be the
> same.
That explains why the resulted code has changed for us; because now that
you have brought colorability into the equations, since PIC16 only has
one register, all nodes are same color and effectively the new algorithm
will not behave as efficiently. For PIC16, the order of code generation
for each path from DAG and how data is flown from one path to the other
is the most important factor. Using solver to find the best solution is
the attractive part of PBQP for us. Do you think there is anything that
we can still use from PBQP? or we have to start thinking of writing our
own register allocator?
Thanks
Ali
>
> Cheers,
> Lang.
>
> On Mon, Aug 10, 2009 at 10:11 AM,
wrote:
> > Hi Lang,
> > I read the papers regarding PBQP and it seemed like it has the
potential
> > to be useful for the single register of PIC16, (maybe an overkill
but it
> > has been working fine so far). I was wondering if you can let me
know a
> > little bit about the nature of your modifications. I see that you
have
> > mainly refactored the code into C++ classes, but have you also made
> > algorithmic changes?
> >
> > Thanks
> > Ali
> >
> >> -----Original Message-----
> >> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> >> bounces at cs.uiuc.edu] On Behalf Of Lang Hames
> >> Sent: Sunday, August 09, 2009 10:29 PM
> >> To: Evan Cheng
> >> Cc: Commit Messages and Patches for LLVM
> >> Subject: Re: [llvm-commits] [llvm] r78354 - in
> >> /llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h PBQP/
> >> PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.h
> >> PBQP/GraphBase.hPBQP/GraphGenerator.h PBQP/HeuristicSolver.h
> >> PBQP/Heuristics/PBQP/Heuristics/Briggs.h PBQP/PBQPMath.h
> >>
> >> On Sun, Aug 9, 2009 at 9:52 PM, Evan Cheng
> > wrote:
> >> > I somehow doubt PBQP is very good fit for a single register
target.
> >>
> >> No I don't think so. I certainly appreciate the test case though.
Any
> >> feedback I can get as I try to improve the allocator is welcome.
> >> Thanks Sanjiv.
> >>
> >> Cheers,
> >> Lang.
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From dag at cray.com Mon Aug 10 13:40:35 2009
From: dag at cray.com (David Greene)
Date: Mon, 10 Aug 2009 13:40:35 -0500
Subject: [llvm-commits] [llvm] r78567 - in /llvm/trunk:
include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
In-Reply-To: <16FCDF19-368E-4D6E-8052-4249597CAC03@apple.com>
References: <200908101638.n7AGc8CB032679@zion.cs.uiuc.edu>
<16FCDF19-368E-4D6E-8052-4249597CAC03@apple.com>
Message-ID: <200908101340.36318.dag@cray.com>
On Monday 10 August 2009 13:11, Bill Wendling wrote:
> OStream is already a proper name in Support/Streams.h. This could lead
> to confusion, especially if you're #including Support/Debug.h before
> this. Could you rename the template argument?
Sure.
-Dave
From daniel at zuster.org Mon Aug 10 13:41:10 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 18:41:10 -0000
Subject: [llvm-commits] [llvm] r78581 - in /llvm/trunk:
include/llvm/Target/Target.td lib/Target/X86/X86Instr64bit.td
lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td
utils/TableGen/AsmMatcherEmitter.cpp
Message-ID: <200908101841.n7AIfBjC017472@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 13:41:10 2009
New Revision: 78581
URL: http://llvm.org/viewvc/llvm-project?rev=78581&view=rev
Log:
llvm-mc/AsmMatcher: Change assembler parser match classes to their own record
structure.
Modified:
llvm/trunk/include/llvm/Target/Target.td
llvm/trunk/lib/Target/X86/X86Instr64bit.td
llvm/trunk/lib/Target/X86/X86InstrInfo.td
llvm/trunk/lib/Target/X86/X86InstrSSE.td
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/include/llvm/Target/Target.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=78581&r1=78580&r2=78581&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/Target.td (original)
+++ llvm/trunk/include/llvm/Target/Target.td Mon Aug 10 13:41:10 2009
@@ -278,6 +278,32 @@
/// it to be resolved by inference in the context it is used.
def unknown;
+/// AsmOperandClass - Representation for the kinds of operands which the target
+/// specific parser can create and the assembly matcher may need to distinguish.
+///
+/// Operand classes are used to define the order in which instructions are
+/// matched, to ensure that the instruction which gets matched for any
+/// particular list of operands is deterministic.
+///
+/// The target specific parser must be able to classify a parsed operand into a
+/// unique class which does not partially overlap with any other classes. It can
+/// match a subset of some other class, in which case the super class field
+/// should be defined.
+class AsmOperandClass {
+ /// The name to use for this class, this should be usable as an enum value,
+ /// and will be used to generated the names for the methods to test whether a
+ /// particular target specific operand matches this class, and the method to
+ /// convert an operand of this class into an MCInst operand.
+ string Name = ?;
+
+ /// The super class of this operand.
+ AsmOperandClass SuperClass = ?;
+}
+
+def ImmAsmOperand : AsmOperandClass {
+ let Name = "Imm";
+}
+
/// Operand Types - These provide the built-in operand types that may be used
/// by a target. Targets can optionally provide their own operand types as
/// needed, though this should not be needed for RISC targets.
@@ -295,13 +321,7 @@
// into a unique class, which does not partially overlap with any other
// classes. It can match a subset of some other class, in which case
// ParserMatchSuperClass should be set to the name of that class.
- string ParserMatchClass = "Imm";
-
- // ParserMatchSuperClass - The enclosing super class for this operand (if
- // any). This operand *must* be a subset of the valid operands for the super
- // class; i.e., the match predicate for this super class must return true
- // for all instances of this class.
- string ParserMatchSuperClass = ?;
+ AsmOperandClass ParserMatchClass = ImmAsmOperand;
}
def i1imm : Operand;
Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=78581&r1=78580&r2=78581&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Mon Aug 10 13:41:10 2009
@@ -33,14 +33,14 @@
def lea64mem : Operand {
let PrintMethod = "printlea64mem";
let MIOperandInfo = (ops GR64, i8imm, GR64_NOSP, i32imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
def lea64_32mem : Operand {
let PrintMethod = "printlea64_32mem";
let AsmOperandLowerMethod = "lower_lea64_32mem";
let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=78581&r1=78580&r2=78581&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Aug 10 13:41:10 2009
@@ -170,10 +170,14 @@
// *mem - Operand definitions for the funky X86 addressing mode operands.
//
+def X86MemAsmOperand : AsmOperandClass {
+ let Name = "Mem";
+ let SuperClass = ImmAsmOperand;
+}
class X86MemOperand : Operand {
let PrintMethod = printMethod;
let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
def i8mem : X86MemOperand<"printi8mem">;
@@ -193,13 +197,13 @@
def i8mem_NOREX : Operand {
let PrintMethod = "printi8mem";
let MIOperandInfo = (ops GR64_NOREX, i8imm, GR64_NOREX_NOSP, i32imm, i8imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
def lea32mem : Operand {
let PrintMethod = "printlea32mem";
let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
def SSECC : Operand {
@@ -210,16 +214,19 @@
let PrintMethod = "printPICLabel";
}
+def ImmSExt8AsmOperand : AsmOperandClass {
+ let Name = "ImmSExt8";
+ let SuperClass = ImmAsmOperand;
+}
+
// A couple of more descriptive operand definitions.
// 16-bits but only 8 bits are significant.
def i16i8imm : Operand {
- let ParserMatchClass = "ImmSExt8";
- let ParserMatchSuperClass = "Imm";
+ let ParserMatchClass = ImmSExt8AsmOperand;
}
// 32-bits but only 8 bits are significant.
def i32i8imm : Operand {
- let ParserMatchClass = "ImmSExt8";
- let ParserMatchSuperClass = "Imm";
+ let ParserMatchClass = ImmSExt8AsmOperand;
}
// Branch targets have OtherVT type and print as pc-relative values.
Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=78581&r1=78580&r2=78581&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Aug 10 13:41:10 2009
@@ -87,12 +87,12 @@
def ssmem : Operand {
let PrintMethod = "printf32mem";
let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
def sdmem : Operand {
let PrintMethod = "printf64mem";
let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
- let ParserMatchClass = "Mem";
+ let ParserMatchClass = X86MemAsmOperand;
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=78581&r1=78580&r2=78581&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Aug 10 13:41:10 2009
@@ -87,11 +87,9 @@
#include
using namespace llvm;
-namespace {
static cl::opt
MatchPrefix("match-prefix", cl::init(""),
cl::desc("Only match instructions with the given prefix"));
-}
/// FlattenVariants - Flatten an .td file assembly string by selecting the
/// variant at index \arg N.
@@ -455,21 +453,16 @@
/// Map of token to class information which has already been constructed.
std::map TokenClasses;
- /// Map of operand name to class information which has already been
- /// constructed.
- std::map OperandClasses;
+ /// The ClassInfo instance for registers.
+ ClassInfo *TheRegisterClass;
- /// Map of user class names to kind value.
- std::map UserClasses;
+ /// Map of AsmOperandClass records to their class information.
+ std::map AsmOperandClasses;
private:
/// getTokenClass - Lookup or create the class for the given token.
ClassInfo *getTokenClass(const StringRef &Token);
- /// getUserClassKind - Lookup or create the kind value for the given class
- /// name.
- unsigned getUserClassKind(const StringRef &Name);
-
/// getOperandClass - Lookup or create the class for the given operand.
ClassInfo *getOperandClass(const StringRef &Token,
const CodeGenInstruction::OperandInfo &OI);
@@ -543,66 +536,68 @@
return Entry;
}
-unsigned AsmMatcherInfo::getUserClassKind(const StringRef &Name) {
- unsigned &Entry = UserClasses[Name];
-
- if (!Entry)
- Entry = ClassInfo::UserClass0 + UserClasses.size() - 1;
-
- return Entry;
-}
-
ClassInfo *
AsmMatcherInfo::getOperandClass(const StringRef &Token,
const CodeGenInstruction::OperandInfo &OI) {
- unsigned SuperClass = ClassInfo::Invalid;
- std::string ClassName;
- if (OI.Rec->isSubClassOf("RegisterClass")) {
- ClassName = "Reg";
- } else {
- try {
- ClassName = OI.Rec->getValueAsString("ParserMatchClass");
- assert(ClassName != "Reg" && "'Reg' class name is reserved!");
- } catch(...) {
- PrintError(OI.Rec->getLoc(), "operand has no match class!");
- ClassName = "Invalid";
- }
-
- // Determine the super class.
- try {
- std::string SuperClassName =
- OI.Rec->getValueAsString("ParserMatchSuperClass");
- SuperClass = getUserClassKind(SuperClassName);
- } catch(...) { }
+ if (OI.Rec->isSubClassOf("RegisterClass"))
+ return TheRegisterClass;
+
+ assert(OI.Rec->isSubClassOf("Operand") && "Unexpected operand!");
+ Record *MatchClass = OI.Rec->getValueAsDef("ParserMatchClass");
+ ClassInfo *CI = AsmOperandClasses[MatchClass];
+
+ if (!CI) {
+ PrintError(OI.Rec->getLoc(), "operand has no match class!");
+ throw std::string("ERROR: Missing match class!");
}
- ClassInfo *&Entry = OperandClasses[ClassName];
-
- if (!Entry) {
- Entry = new ClassInfo();
- if (ClassName == "Reg") {
- Entry->Kind = ClassInfo::Register;
- Entry->SuperClassKind = SuperClass;
+ return CI;
+}
+
+void AsmMatcherInfo::BuildInfo(CodeGenTarget &Target) {
+ // Build the assembly match class information.
+
+ // Construct the "Reg" class.
+ //
+ // FIXME: This needs to dice up the RegisterClass instances.
+ ClassInfo *RegClass = TheRegisterClass = new ClassInfo();
+ RegClass->Kind = ClassInfo::Register;
+ RegClass->SuperClassKind = ClassInfo::Invalid;
+ RegClass->ClassName = "Reg";
+ RegClass->Name = "MCK_Reg";
+ RegClass->ValueName = "";
+ RegClass->PredicateMethod = "isReg";
+ RegClass->RenderMethod = "addRegOperands";
+ Classes.push_back(RegClass);
+
+ // Build info for the user defined assembly operand classes.
+ std::vector AsmOperands;
+ AsmOperands = Records.getAllDerivedDefinitions("AsmOperandClass");
+ unsigned Index = 0;
+ for (std::vector::iterator it = AsmOperands.begin(),
+ ie = AsmOperands.end(); it != ie; ++it, ++Index) {
+ ClassInfo *CI = new ClassInfo();
+ CI->Kind = ClassInfo::UserClass0 + Index;
+
+ Init *Super = (*it)->getValueInit("SuperClass");
+ if (DefInit *DI = dynamic_cast(Super)) {
+ CI->SuperClass = AsmOperandClasses[DI->getDef()];
+ if (!CI->SuperClass)
+ PrintError((*it)->getLoc(), "Invalid super class reference!");
} else {
- Entry->Kind = getUserClassKind(ClassName);
- Entry->SuperClassKind = SuperClass;
+ assert(dynamic_cast(Super) && "Unexpected SuperClass field!");
+ CI->SuperClass = 0;
}
- Entry->ClassName = ClassName;
- Entry->Name = "MCK_" + ClassName;
- Entry->ValueName = OI.Rec->getName();
- Entry->PredicateMethod = "is" + ClassName;
- Entry->RenderMethod = "add" + ClassName + "Operands";
- Classes.push_back(Entry);
- } else {
- // Verify the super class matches.
- assert(SuperClass == Entry->SuperClassKind &&
- "Cannot redefine super class kind!");
+ CI->ClassName = (*it)->getValueAsString("Name");
+ CI->Name = "MCK_" + CI->ClassName;
+ CI->ValueName = (*it)->getName();
+ CI->PredicateMethod = "is" + CI->ClassName;
+ CI->RenderMethod = "add" + CI->ClassName + "Operands";
+ AsmOperandClasses[*it] = CI;
+ Classes.push_back(CI);
}
-
- return Entry;
-}
-void AsmMatcherInfo::BuildInfo(CodeGenTarget &Target) {
+ // Build the instruction information.
for (std::map::const_iterator
it = Target.getInstructions().begin(),
ie = Target.getInstructions().end();
From devang.patel at gmail.com Mon Aug 10 13:48:17 2009
From: devang.patel at gmail.com (Devang Patel)
Date: Mon, 10 Aug 2009 11:48:17 -0700
Subject: [llvm-commits] [llvm] r78577 - in /llvm/trunk:
include/llvm/Constants.h include/llvm/Metadata.h
lib/VMCore/Constants.cpp lib/VMCore/ConstantsContext.h
lib/VMCore/LLVMContextImpl.h lib/VMCore/Metadata.cpp
In-Reply-To: <200908101816.n7AIG8CS013899@zion.cs.uiuc.edu>
References: <200908101816.n7AIG8CS013899@zion.cs.uiuc.edu>
Message-ID: <352a1fb20908101148q450fb733j8b82c9ffe9448c1f@mail.gmail.com>
On Mon, Aug 10, 2009 at 11:16 AM, Owen Anderson wrote:
> Author: resistor
> Date: Mon Aug 10 13:16:08 2009
> New Revision: 78577
>
> URL: http://llvm.org/viewvc/llvm-project?rev=78577&view=rev
> Log:
> Change the MDNode uniquing to a ValueMap, at Devang's request.
Thanks!
-
Devang
From resistor at mac.com Mon Aug 10 13:57:00 2009
From: resistor at mac.com (Owen Anderson)
Date: Mon, 10 Aug 2009 18:57:00 -0000
Subject: [llvm-commits] [llvm] r78584 - in /llvm/trunk: include/llvm/Target/
lib/CodeGen/SelectionDAG/ lib/Target/Alpha/ lib/Target/Blackfin/
lib/Target/CellSPU/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/
lib/Target/X86/
Message-ID: <200908101857.n7AIv09Y019812@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Aug 10 13:56:59 2009
New Revision: 78584
URL: http://llvm.org/viewvc/llvm-project?rev=78584&view=rev
Log:
Start moving TargetLowering away from using full MVTs and towards SimpleValueType, which will simplify the privatization of IntegerType in the future.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h
llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp
llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
llvm/trunk/lib/Target/Mips/MipsISelLowering.h
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Aug 10 13:56:59 2009
@@ -111,8 +111,8 @@
bool isBigEndian() const { return !IsLittleEndian; }
bool isLittleEndian() const { return IsLittleEndian; }
- MVT getPointerTy() const { return PointerTy; }
- MVT getShiftAmountTy() const { return ShiftAmountTy; }
+ MVT::SimpleValueType getPointerTy() const { return PointerTy; }
+ MVT::SimpleValueType getShiftAmountTy() const { return ShiftAmountTy; }
/// usesGlobalOffsetTable - Return true if this target uses a GOT for PIC
/// codegen.
@@ -135,7 +135,8 @@
/// the condition operand of SELECT and BRCOND nodes. In the case of
/// BRCOND the argument passed is MVT::Other since there are no other
/// operands to get a type hint from.
- virtual MVT getSetCCResultType(MVT VT) const;
+ virtual
+ MVT::SimpleValueType getSetCCResultType(MVT VT) const;
/// getBooleanContents - For targets without i1 registers, this gives the
/// nature of the high-bits of boolean values held in types wider than i1.
@@ -152,7 +153,7 @@
/// getRegClassFor - Return the register class that should be used for the
/// specified value type. This may only be called on legal types.
TargetRegisterClass *getRegClassFor(MVT VT) const {
- assert((unsigned)VT.getSimpleVT() < array_lengthof(RegClassForVT));
+ assert(VT.isSimple() && "getRegClassFor called on illegal type!");
TargetRegisterClass *RC = RegClassForVT[VT.getSimpleVT()];
assert(RC && "This value type is not natively supported!");
return RC;
@@ -868,7 +869,7 @@
/// setShiftAmountType - Describe the type that should be used for shift
/// amounts. This type defaults to the pointer type.
- void setShiftAmountType(MVT VT) { ShiftAmountTy = VT; }
+ void setShiftAmountType(MVT::SimpleValueType VT) { ShiftAmountTy = VT; }
/// setBooleanContents - Specify how the target extends the result of a
/// boolean value from i1 to a wider type. See getBooleanContents.
@@ -1530,7 +1531,7 @@
/// PointerTy - The type to use for pointers, usually i32 or i64.
///
- MVT PointerTy;
+ MVT::SimpleValueType PointerTy;
/// IsLittleEndian - True if this is a little endian target.
///
@@ -1565,7 +1566,7 @@
/// ShiftAmountTy - The type to use for shift amounts, usually i8 or whatever
/// PointerTy is.
- MVT ShiftAmountTy;
+ MVT::SimpleValueType ShiftAmountTy;
/// BooleanContents - Information about the contents of the high-bits in
/// boolean values held in a type wider than i1. See getBooleanContents.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Aug 10 13:56:59 2009
@@ -261,7 +261,7 @@
return false;
const Type *Ty = I->getOperand(0)->getType();
- MVT::SimpleValueType VT = TLI.getPointerTy().getSimpleVT();
+ MVT::SimpleValueType VT = TLI.getPointerTy();
for (GetElementPtrInst::op_iterator OI = I->op_begin()+1, E = I->op_end();
OI != E; ++OI) {
Value *Idx = *OI;
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 10 13:56:59 2009
@@ -963,7 +963,8 @@
"Cannot set target flags on target-independent globals");
// Truncate (with sign-extension) the offset value to the pointer size.
- unsigned BitWidth = TLI.getPointerTy().getSizeInBits();
+ MVT PTy = TLI.getPointerTy();
+ unsigned BitWidth = PTy.getSizeInBits();
if (BitWidth < 64)
Offset = (Offset << (64 - BitWidth) >> (64 - BitWidth));
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Aug 10 13:56:59 2009
@@ -1911,7 +1911,8 @@
CaseRecVector& WorkList,
Value* SV,
MachineBasicBlock* Default){
- unsigned IntPtrBits = TLI.getPointerTy().getSizeInBits();
+ MVT PTy = TLI.getPointerTy();
+ unsigned IntPtrBits = PTy.getSizeInBits();
Case& FrontCase = *CR.Range.first;
Case& BackCase = *(CR.Range.second-1);
@@ -2187,24 +2188,26 @@
if (!isa(I.getType()) &&
Op2.getValueType() != TLI.getShiftAmountTy()) {
// If the operand is smaller than the shift count type, promote it.
- if (TLI.getShiftAmountTy().bitsGT(Op2.getValueType()))
+ MVT PTy = TLI.getPointerTy();
+ MVT STy = TLI.getShiftAmountTy();
+ if (STy.bitsGT(Op2.getValueType()))
Op2 = DAG.getNode(ISD::ANY_EXTEND, getCurDebugLoc(),
TLI.getShiftAmountTy(), Op2);
// If the operand is larger than the shift count type but the shift
// count type has enough bits to represent any shift value, truncate
// it now. This is a common case and it exposes the truncate to
// optimization early.
- else if (TLI.getShiftAmountTy().getSizeInBits() >=
+ else if (STy.getSizeInBits() >=
Log2_32_Ceil(Op2.getValueType().getSizeInBits()))
Op2 = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
TLI.getShiftAmountTy(), Op2);
// Otherwise we'll need to temporarily settle for some other
// convenient type; type legalization will make adjustments as
// needed.
- else if (TLI.getPointerTy().bitsLT(Op2.getValueType()))
+ else if (PTy.bitsLT(Op2.getValueType()))
Op2 = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
TLI.getPointerTy(), Op2);
- else if (TLI.getPointerTy().bitsGT(Op2.getValueType()))
+ else if (PTy.bitsGT(Op2.getValueType()))
Op2 = DAG.getNode(ISD::ANY_EXTEND, getCurDebugLoc(),
TLI.getPointerTy(), Op2);
}
@@ -2672,7 +2675,8 @@
uint64_t Offs =
TD->getTypeAllocSize(Ty)*cast(CI)->getSExtValue();
SDValue OffsVal;
- unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
+ MVT PTy = TLI.getPointerTy();
+ unsigned PtrBits = PTy.getSizeInBits();
if (PtrBits < 64) {
OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
TLI.getPointerTy(),
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Mon Aug 10 13:56:59 2009
@@ -496,7 +496,7 @@
IsLittleEndian = TD->isLittleEndian();
UsesGlobalOffsetTable = false;
- ShiftAmountTy = PointerTy = getValueType(TD->getIntPtrType());
+ ShiftAmountTy = PointerTy = getValueType(TD->getIntPtrType()).getSimpleVT();
memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*));
memset(TargetDAGCombineArray, 0, array_lengthof(TargetDAGCombineArray));
maxStoresPerMemset = maxStoresPerMemcpy = maxStoresPerMemmove = 8;
@@ -657,8 +657,8 @@
}
-MVT TargetLowering::getSetCCResultType(MVT VT) const {
- return getValueType(TD->getIntPtrType());
+MVT::SimpleValueType TargetLowering::getSetCCResultType(MVT VT) const {
+ return getValueType(TD->getIntPtrType()).getSimpleVT();
}
Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -168,7 +168,7 @@
computeRegisterProperties();
}
-MVT AlphaTargetLowering::getSetCCResultType(MVT VT) const {
+MVT::SimpleValueType AlphaTargetLowering::getSetCCResultType(MVT VT) const {
return MVT::i64;
}
Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Mon Aug 10 13:56:59 2009
@@ -67,7 +67,7 @@
explicit AlphaTargetLowering(TargetMachine &TM);
/// getSetCCResultType - Get the SETCC result ValueType
- virtual MVT getSetCCResultType(MVT VT) const;
+ virtual MVT::SimpleValueType getSetCCResultType(MVT VT) const;
/// LowerOperation - Provide custom lowering hooks for some operations.
///
Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -137,7 +137,7 @@
}
}
-MVT BlackfinTargetLowering::getSetCCResultType(MVT VT) const {
+MVT::SimpleValueType BlackfinTargetLowering::getSetCCResultType(MVT VT) const {
// SETCC always sets the CC register. Technically that is an i1 register, but
// that type is not legal, so we treat it as an i32 register.
return MVT::i32;
Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h (original)
+++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h Mon Aug 10 13:56:59 2009
@@ -33,7 +33,7 @@
int VarArgsFrameOffset; // Frame offset to start of varargs area.
public:
BlackfinTargetLowering(TargetMachine &TM);
- virtual MVT getSetCCResultType(MVT VT) const;
+ virtual MVT::SimpleValueType getSetCCResultType(MVT VT) const;
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
virtual void ReplaceNodeResults(SDNode *N,
SmallVectorImpl &Results,
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -539,9 +539,11 @@
// Return the Cell SPU's SETCC result type
//===----------------------------------------------------------------------===//
-MVT SPUTargetLowering::getSetCCResultType(MVT VT) const {
+MVT::SimpleValueType SPUTargetLowering::getSetCCResultType(MVT VT) const {
// i16 and i32 are valid SETCC result types
- return ((VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32) ? VT : MVT::i32);
+ return ((VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32) ?
+ VT.getSimpleVT() :
+ MVT::i32);
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Mon Aug 10 13:56:59 2009
@@ -109,7 +109,7 @@
virtual const char *getTargetNodeName(unsigned Opcode) const;
/// getSetCCResultType - Return the ValueType for ISD::SETCC
- virtual MVT getSetCCResultType(MVT VT) const;
+ virtual MVT::SimpleValueType getSetCCResultType(MVT VT) const;
//! Custom lowering hooks
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -165,7 +165,7 @@
computeRegisterProperties();
}
-MVT MipsTargetLowering::getSetCCResultType(MVT VT) const {
+MVT::SimpleValueType MipsTargetLowering::getSetCCResultType(MVT VT) const {
return MVT::i32;
}
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Mon Aug 10 13:56:59 2009
@@ -80,7 +80,7 @@
virtual const char *getTargetNodeName(unsigned Opcode) const;
/// getSetCCResultType - get the ISD::SETCC result ValueType
- MVT getSetCCResultType(MVT VT) const;
+ MVT::SimpleValueType getSetCCResultType(MVT VT) const;
/// getFunctionAlignment - Return the Log2 alignment of this function.
virtual unsigned getFunctionAlignment(const Function *F) const;
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -365,7 +365,8 @@
Results.push_back(N);
}
-MVT PIC16TargetLowering::getSetCCResultType(MVT ValType) const {
+MVT::SimpleValueType
+PIC16TargetLowering::getSetCCResultType(MVT ValType) const {
return MVT::i8;
}
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Mon Aug 10 13:56:59 2009
@@ -82,7 +82,7 @@
/// DAG node.
virtual const char *getTargetNodeName(unsigned Opcode) const;
/// getSetCCResultType - Return the ISD::SETCC ValueType
- virtual MVT getSetCCResultType(MVT ValType) const;
+ virtual MVT::SimpleValueType getSetCCResultType(MVT ValType) const;
SDValue LowerShift(SDValue Op, SelectionDAG &DAG);
SDValue LowerMUL(SDValue Op, SelectionDAG &DAG);
SDValue LowerADD(SDValue Op, SelectionDAG &DAG);
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -449,7 +449,7 @@
}
}
-MVT PPCTargetLowering::getSetCCResultType(MVT VT) const {
+MVT::SimpleValueType PPCTargetLowering::getSetCCResultType(MVT VT) const {
return MVT::i32;
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Mon Aug 10 13:56:59 2009
@@ -230,7 +230,7 @@
virtual const char *getTargetNodeName(unsigned Opcode) const;
/// getSetCCResultType - Return the ISD::SETCC ValueType
- virtual MVT getSetCCResultType(MVT VT) const;
+ virtual MVT::SimpleValueType getSetCCResultType(MVT VT) const;
/// getPreIndexedAddressParts - returns true by value, base pointer and
/// offset pointer and addressing mode by reference if the node's address
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 10 13:56:59 2009
@@ -959,7 +959,7 @@
}
-MVT X86TargetLowering::getSetCCResultType(MVT VT) const {
+MVT::SimpleValueType X86TargetLowering::getSetCCResultType(MVT VT) const {
return MVT::i8;
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=78584&r1=78583&r2=78584&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Aug 10 13:56:59 2009
@@ -411,7 +411,7 @@
virtual const char *getTargetNodeName(unsigned Opcode) const;
/// getSetCCResultType - Return the ISD::SETCC ValueType
- virtual MVT getSetCCResultType(MVT VT) const;
+ virtual MVT::SimpleValueType getSetCCResultType(MVT VT) const;
/// computeMaskedBitsForTargetNode - Determine which of the bits specified
/// in Mask are known to be either zero or one and return them in the
From dpatel at apple.com Mon Aug 10 13:59:08 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 10 Aug 2009 18:59:08 -0000
Subject: [llvm-commits] [llvm] r78585 - in /llvm/trunk:
include/llvm/Metadata.h lib/VMCore/Metadata.cpp
Message-ID: <200908101859.n7AIx84K020093@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Aug 10 13:59:07 2009
New Revision: 78585
URL: http://llvm.org/viewvc/llvm-project?rev=78585&view=rev
Log:
We are not using FoldingSet for metadata uniquing anymore.
Modified:
llvm/trunk/include/llvm/Metadata.h
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/include/llvm/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=78585&r1=78584&r2=78585&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Metadata.h (original)
+++ llvm/trunk/include/llvm/Metadata.h Mon Aug 10 13:59:07 2009
@@ -19,7 +19,6 @@
#include "llvm/User.h"
#include "llvm/Type.h"
#include "llvm/OperandTraits.h"
-#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/Support/ErrorHandling.h"
@@ -110,7 +109,7 @@
/// MDNode - a tuple of other values.
/// These contain a list of the values that represent the metadata.
/// MDNode is always unnamed.
-class MDNode : public MetadataBase, public FoldingSetNode {
+class MDNode : public MetadataBase {
MDNode(const MDNode &); // DO NOT IMPLEMENT
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
// getNumOperands - Make this only available for private uses.
@@ -170,10 +169,6 @@
return false;
}
- /// Profile - calculate a unique identifier for this MDNode to collapse
- /// duplicates
- void Profile(FoldingSetNodeID &ID) const;
-
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
llvm_unreachable("This should never be called because MDNodes have no ops");
}
@@ -287,10 +282,6 @@
return false;
}
- /// Profile - calculate a unique identifier for this MDNode to collapse
- /// duplicates
- void Profile(FoldingSetNodeID &ID) const;
-
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
llvm_unreachable(
"This should never be called because NamedMDNodes have no ops");
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=78585&r1=78584&r2=78585&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Aug 10 13:59:07 2009
@@ -76,11 +76,6 @@
}
}
-void MDNode::Profile(FoldingSetNodeID &ID) const {
- for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I)
- ID.AddPointer(*I);
-}
-
MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
LLVMContextImpl *pImpl = Context.pImpl;
std::vector V;
From lhames at gmail.com Mon Aug 10 14:02:12 2009
From: lhames at gmail.com (Lang Hames)
Date: Mon, 10 Aug 2009 12:02:12 -0700
Subject: [llvm-commits] [llvm] r78354 -
in/llvm/trunk/lib/CodeGen:PBQP.cpp PBQP.h
PBQP/PBQP/AnnotatedGraph.hPBQP/ExhaustiveSolver.hPBQP/GraphBase.hPBQP/GraphGenerator.h
PBQP/HeuristicSolver.hPBQP/Heuristics/PBQP/Heuristics/Briggs.h
PBQP/PBQPMath.h
In-Reply-To:
References: <728927c70908092228q7b654ba6j6c5f8cb6fb8de268@mail.gmail.com>
<728927c70908101041t271ccb08p6bd9f78d25baf2bb@mail.gmail.com>
Message-ID: <728927c70908101202t6ca05ec6j88e2b7e319851b72@mail.gmail.com>
> That explains why the resulted code has changed for us; because now that
> you have brought colorability into the equations, since PIC16 only has
> one register, all nodes are same color and effectively the new algorithm
> will not behave as efficiently. For PIC16, the order of code generation
> for each path from DAG and how data is flown from one path to the other
> is the most important factor. Using solver to find the best solution is
> the attractive part of PBQP for us. Do you think there is anything that
> we can still use from PBQP? or we have to start thinking of writing our
> own register allocator?
Hi Ali,
Colourability was always a component of the Briggs heuristic in the
PBQP allocator. Unless you modified the C solver it would have been
applied before.
If you are getting significantly different results with the new
allocator it may indicate an error in my spill cost calculations. I
will look into this over the next few days.
If PBQP was generating good results for you before I believe it should
do so again, once the kinks in the new solver are ironed out.
Cheers,
Lang.
From daniel at zuster.org Mon Aug 10 14:08:03 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 19:08:03 -0000
Subject: [llvm-commits] [llvm] r78587 -
/llvm/trunk/lib/Target/X86/X86InstrInfo.td
Message-ID: <200908101908.n7AJ83gf021414@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 14:08:02 2009
New Revision: 78587
URL: http://llvm.org/viewvc/llvm-project?rev=78587&view=rev
Log:
llvm-mc/AsmMatcher: Fix thinko, Mem isn't a subclass of Imm.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.td
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=78587&r1=78586&r2=78587&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Aug 10 14:08:02 2009
@@ -172,7 +172,7 @@
//
def X86MemAsmOperand : AsmOperandClass {
let Name = "Mem";
- let SuperClass = ImmAsmOperand;
+ let SuperClass = ?;
}
class X86MemOperand : Operand {
let PrintMethod = printMethod;
From daniel at zuster.org Mon Aug 10 14:08:50 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 19:08:50 -0000
Subject: [llvm-commits] [llvm] r78588 -
/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Message-ID: <200908101908.n7AJ8o8h021535@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 14:08:50 2009
New Revision: 78588
URL: http://llvm.org/viewvc/llvm-project?rev=78588&view=rev
Log:
llvm-mc/AsmMatcher: Remove some code which has been obsoleted by move to
explicit parser match classes.
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=78588&r1=78587&r2=78588&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Aug 10 14:08:50 2009
@@ -293,9 +293,6 @@
/// N) for the Nth user defined class.
unsigned Kind;
- /// SuperClassKind - The super class kind for user classes.
- unsigned SuperClassKind;
-
/// SuperClass - The super class, or 0.
ClassInfo *SuperClass;
@@ -525,6 +522,7 @@
if (!Entry) {
Entry = new ClassInfo();
Entry->Kind = ClassInfo::Token;
+ Entry->SuperClass = 0;
Entry->ClassName = "Token";
Entry->Name = "MCK_" + getEnumNameForToken(Token);
Entry->ValueName = Token;
@@ -562,7 +560,7 @@
// FIXME: This needs to dice up the RegisterClass instances.
ClassInfo *RegClass = TheRegisterClass = new ClassInfo();
RegClass->Kind = ClassInfo::Register;
- RegClass->SuperClassKind = ClassInfo::Invalid;
+ RegClass->SuperClass = 0;
RegClass->ClassName = "Reg";
RegClass->Name = "MCK_Reg";
RegClass->ValueName = "";
@@ -661,24 +659,6 @@
Instructions.push_back(II.take());
}
- // Bind user super classes.
- std::map UserClasses;
- for (unsigned i = 0, e = Classes.size(); i != e; ++i) {
- ClassInfo &CI = *Classes[i];
- if (CI.isUserClass())
- UserClasses[CI.Kind] = &CI;
- }
-
- for (unsigned i = 0, e = Classes.size(); i != e; ++i) {
- ClassInfo &CI = *Classes[i];
- if (CI.isUserClass() && CI.SuperClassKind != ClassInfo::Invalid) {
- CI.SuperClass = UserClasses[CI.SuperClassKind];
- assert(CI.SuperClass && "Missing super class definition!");
- } else {
- CI.SuperClass = 0;
- }
- }
-
// Reorder classes so that classes preceed super classes.
std::sort(Classes.begin(), Classes.end(), less_ptr());
}
@@ -863,8 +843,8 @@
OS << " assert(Operand." << CI.SuperClass->PredicateMethod
<< "() && \"Invalid class relationship!\");\n";
- OS << " return " << CI.Name << ";\n\n";
- OS << " }";
+ OS << " return " << CI.Name << ";\n";
+ OS << " }\n\n";
}
}
OS << " return InvalidMatchClass;\n";
From idadesub at users.sourceforge.net Mon Aug 10 14:44:53 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 19:44:53 -0000
Subject: [llvm-commits] [llvm] r78590 - in /llvm/trunk/include/llvm/Support:
DataTypes.h.cmake DataTypes.h.in
Message-ID: <200908101944.n7AJisJD026619@zion.cs.uiuc.edu>
Author: erickt
Date: Mon Aug 10 14:44:53 2009
New Revision: 78590
URL: http://llvm.org/viewvc/llvm-project?rev=78590&view=rev
Log:
Convert comments to C90-style so llvm-c can import DataTypes.h.
Modified:
llvm/trunk/include/llvm/Support/DataTypes.h.cmake
llvm/trunk/include/llvm/Support/DataTypes.h.in
Modified: llvm/trunk/include/llvm/Support/DataTypes.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.cmake?rev=78590&r1=78589&r2=78590&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DataTypes.h.cmake (original)
+++ llvm/trunk/include/llvm/Support/DataTypes.h.cmake Mon Aug 10 14:44:53 2009
@@ -1,22 +1,25 @@
-//===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains definitions to figure out the size of _HOST_ data types.
-// This file is important because different host OS's define different macros,
-// which makes portability tough. This file exports the following definitions:
-//
-// [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types
-// [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.
-//
-// No library is required when using these functinons.
-//
-//===----------------------------------------------------------------------===//
+/*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
+|* *|
+|* The LLVM Compiler Infrastructure *|
+|* *|
+|* This file is distributed under the University of Illinois Open Source *|
+|* License. See LICENSE.TXT for details. *|
+|* *|
+|*===----------------------------------------------------------------------===*|
+|* *|
+|* This file contains definitions to figure out the size of _HOST_ data types.*|
+|* This file is important because different host OS's define different macros,*|
+|* which makes portability tough. This file exports the following *|
+|* definitions: *|
+|* *|
+|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
+|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
+|* *|
+|* No library is required when using these functinons. *|
+|* *|
+|*===----------------------------------------------------------------------===*/
+
+/* Please leave this file C-compatible. */
#ifndef SUPPORT_DATATYPES_H
#define SUPPORT_DATATYPES_H
@@ -27,7 +30,7 @@
#undef HAVE_UINT64_T
#undef HAVE_U_INT64_T
-// FIXME: UGLY HACK (Added by Kevin)
+/* FIXME: UGLY HACK (Added by Kevin) */
#define HAVE_UINT64_T 1
#ifdef __cplusplus
@@ -38,10 +41,10 @@
#ifndef _MSC_VER
-// Note that this header's correct operation depends on __STDC_LIMIT_MACROS
-// being defined. We would define it here, but in order to prevent Bad Things
-// happening when system headers or C++ STL headers include stdint.h before
-// we define it here, we define it on the g++ command line (in Makefile.rules).
+/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
+ being defined. We would define it here, but in order to prevent Bad Things
+ happening when system headers or C++ STL headers include stdint.h before we
+ define it here, we define it on the g++ command line (in Makefile.rules). */
#if !defined(__STDC_LIMIT_MACROS)
# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
#endif
@@ -51,7 +54,7 @@
"#including Support/DataTypes.h"
#endif
-// Note that includes , if this is a C99 system.
+/* Note that includes , if this is a C99 system. */
#ifdef HAVE_SYS_TYPES_H
#include
#endif
@@ -68,7 +71,7 @@
#include "llvm/Support/AIXDataTypesFix.h"
#endif
-// Handle incorrect definition of uint64_t as u_int64_t
+/* Handle incorrect definition of uint64_t as u_int64_t */
#ifndef HAVE_UINT64_T
#ifdef HAVE_U_INT64_T
typedef u_int64_t uint64_t;
@@ -90,8 +93,8 @@
#endif
#else /* _MSC_VER */
-// Visual C++ doesn't provide standard integer headers, but it does provide
-// built-in data types.
+/* Visual C++ doesn't provide standard integer headers, but it does provide
+ built-in data types. */
#include
#include
#include
Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.in?rev=78590&r1=78589&r2=78590&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DataTypes.h.in (original)
+++ llvm/trunk/include/llvm/Support/DataTypes.h.in Mon Aug 10 14:44:53 2009
@@ -1,22 +1,25 @@
-//===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains definitions to figure out the size of _HOST_ data types.
-// This file is important because different host OS's define different macros,
-// which makes portability tough. This file exports the following definitions:
-//
-// [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types
-// [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.
-//
-// No library is required when using these functinons.
-//
-//===----------------------------------------------------------------------===//
+/*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
+|* *|
+|* The LLVM Compiler Infrastructure *|
+|* *|
+|* This file is distributed under the University of Illinois Open Source *|
+|* License. See LICENSE.TXT for details. *|
+|* *|
+|*===----------------------------------------------------------------------===*|
+|* *|
+|* This file contains definitions to figure out the size of _HOST_ data types.*|
+|* This file is important because different host OS's define different macros,*|
+|* which makes portability tough. This file exports the following *|
+|* definitions: *|
+|* *|
+|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
+|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
+|* *|
+|* No library is required when using these functinons. *|
+|* *|
+|*===----------------------------------------------------------------------===*/
+
+/* Please leave this file C-compatible. */
#ifndef SUPPORT_DATATYPES_H
#define SUPPORT_DATATYPES_H
@@ -35,10 +38,10 @@
#ifndef _MSC_VER
-// Note that this header's correct operation depends on __STDC_LIMIT_MACROS
-// being defined. We would define it here, but in order to prevent Bad Things
-// happening when system headers or C++ STL headers include stdint.h before
-// we define it here, we define it on the g++ command line (in Makefile.rules).
+/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
+ being defined. We would define it here, but in order to prevent Bad Things
+ happening when system headers or C++ STL headers include stdint.h before we
+ define it here, we define it on the g++ command line (in Makefile.rules). */
#if !defined(__STDC_LIMIT_MACROS)
# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
#endif
@@ -48,7 +51,7 @@
"#including Support/DataTypes.h"
#endif
-// Note that includes , if this is a C99 system.
+/* Note that includes , if this is a C99 system. */
#ifdef HAVE_SYS_TYPES_H
#include
#endif
@@ -65,7 +68,7 @@
#include "llvm/Support/AIXDataTypesFix.h"
#endif
-// Handle incorrect definition of uint64_t as u_int64_t
+/* Handle incorrect definition of uint64_t as u_int64_t */
#ifndef HAVE_UINT64_T
#ifdef HAVE_U_INT64_T
typedef u_int64_t uint64_t;
@@ -87,8 +90,8 @@
#endif
#else /* _MSC_VER */
-// Visual C++ doesn't provide standard integer headers, but it does provide
-// built-in data types.
+/* Visual C++ doesn't provide standard integer headers, but it does provide
+ built-in data types. */
#include
#include
#include
From idadesub at users.sourceforge.net Mon Aug 10 14:44:46 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 19:44:46 -0000
Subject: [llvm-commits] [llvm] r78589 -
/llvm/trunk/bindings/ocaml/llvm/llvm.mli
Message-ID: <200908101944.n7AJikZN026595@zion.cs.uiuc.edu>
Author: erickt
Date: Mon Aug 10 14:44:45 2009
New Revision: 78589
URL: http://llvm.org/viewvc/llvm-project?rev=78589&view=rev
Log:
Fix docstring for ocaml binding's const_float.
Modified:
llvm/trunk/bindings/ocaml/llvm/llvm.mli
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=78589&r1=78588&r2=78589&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Mon Aug 10 14:44:45 2009
@@ -470,7 +470,7 @@
= "llvm_const_of_int64"
(** [const_float ty n] returns the floating point constant of type [ty] and
- value [n]. See the method [llvm::ConstantInt::get]. *)
+ value [n]. See the method [llvm::ConstantFP::get]. *)
external const_float : lltype -> float -> llvalue = "llvm_const_float"
From idadesub at users.sourceforge.net Mon Aug 10 14:45:00 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 19:45:00 -0000
Subject: [llvm-commits] [llvm] r78591 -
/llvm/trunk/bindings/ocaml/llvm/llvm.mli
Message-ID: <200908101945.n7AJj0lx026663@zion.cs.uiuc.edu>
Author: erickt
Date: Mon Aug 10 14:45:00 2009
New Revision: 78591
URL: http://llvm.org/viewvc/llvm-project?rev=78591&view=rev
Log:
Fix comment in llvm.mli.
Modified:
llvm/trunk/bindings/ocaml/llvm/llvm.mli
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=78591&r1=78590&r2=78591&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Mon Aug 10 14:45:00 2009
@@ -325,8 +325,8 @@
array [tys]. See the method [llvm::StructType::get]. *)
external struct_type : lltype array -> lltype = "llvm_struct_type"
-(** [struct_type tys] returns the packed structure type containing in the types
- in the array [tys]. See the method [llvm::StructType::get]. *)
+(** [packed_struct_type tys] returns the packed structure type containing in the
+ types in the array [tys]. See the method [llvm::StructType::get]. *)
external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type"
(** [element_types sty] returns the constituent types of the struct type [sty].
From idadesub at users.sourceforge.net Mon Aug 10 14:45:05 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 19:45:05 -0000
Subject: [llvm-commits] [llvm] r78592 - /llvm/trunk/test/Makefile
Message-ID: <200908101945.n7AJj5Eu026684@zion.cs.uiuc.edu>
Author: erickt
Date: Mon Aug 10 14:45:05 2009
New Revision: 78592
URL: http://llvm.org/viewvc/llvm-project?rev=78592&view=rev
Log:
Fix ocaml "make check" tests, that wasn't finding the proper c++ compiler.
Modified:
llvm/trunk/test/Makefile
Modified: llvm/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=78592&r1=78591&r2=78592&view=diff
==============================================================================
--- llvm/trunk/test/Makefile (original)
+++ llvm/trunk/test/Makefile Mon Aug 10 14:45:05 2009
@@ -106,7 +106,7 @@
ifneq ($(OCAMLC),)
CC_FOR_OCAMLC := $(shell $(OCAMLC) -config | grep native_c_compiler | sed -e 's/native_c_compiler: //')
-CXX_FOR_OCAMLC := $(patsubst gcc,g++,$(CC_FOR_OCAMLC))
+CXX_FOR_OCAMLC := $(subst gcc,g++,$(CC_FOR_OCAMLC))
endif
FORCE:
From resistor at mac.com Mon Aug 10 15:18:47 2009
From: resistor at mac.com (Owen Anderson)
Date: Mon, 10 Aug 2009 20:18:47 -0000
Subject: [llvm-commits] [llvm] r78593 - in /llvm/trunk:
include/llvm/Target/TargetLowering.h lib/Target/ARM/ARMISelLowering.cpp
lib/Target/CellSPU/SPUISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200908102018.n7AKIlX7031626@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Aug 10 15:18:46 2009
New Revision: 78593
URL: http://llvm.org/viewvc/llvm-project?rev=78593&view=rev
Log:
Continue the SimpleValueType-ification.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=78593&r1=78592&r2=78593&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Aug 10 15:18:46 2009
@@ -944,11 +944,9 @@
/// setOperationAction - Indicate that the specified operation does not work
/// with the specified type and indicate what to do about it.
- void setOperationAction(unsigned Op, MVT VT,
+ void setOperationAction(unsigned Op, MVT::SimpleValueType VT,
LegalizeAction Action) {
- assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0][0])*8 &&
- Op < array_lengthof(OpActions[0]) && "Table isn't big enough!");
- unsigned I = (unsigned) VT.getSimpleVT();
+ unsigned I = (unsigned)VT;
unsigned J = I & 31;
I = I >> 5;
OpActions[I][Op] &= ~(uint64_t(3UL) << (J*2));
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=78593&r1=78592&r2=78593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 10 15:18:46 2009
@@ -61,35 +61,35 @@
void ARMTargetLowering::addTypeForNEON(MVT VT, MVT PromotedLdStVT,
MVT PromotedBitwiseVT) {
if (VT != PromotedLdStVT) {
- setOperationAction(ISD::LOAD, VT, Promote);
+ setOperationAction(ISD::LOAD, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::LOAD, VT, PromotedLdStVT);
- setOperationAction(ISD::STORE, VT, Promote);
+ setOperationAction(ISD::STORE, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::STORE, VT, PromotedLdStVT);
}
MVT ElemTy = VT.getVectorElementType();
if (ElemTy != MVT::i64 && ElemTy != MVT::f64)
- setOperationAction(ISD::VSETCC, VT, Custom);
+ setOperationAction(ISD::VSETCC, VT.getSimpleVT(), Custom);
if (ElemTy == MVT::i8 || ElemTy == MVT::i16)
- setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT, Custom);
- setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
- setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom);
- setOperationAction(ISD::SCALAR_TO_VECTOR, VT, Custom);
- setOperationAction(ISD::CONCAT_VECTORS, VT, Custom);
+ setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::BUILD_VECTOR, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::VECTOR_SHUFFLE, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::SCALAR_TO_VECTOR, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::CONCAT_VECTORS, VT.getSimpleVT(), Custom);
if (VT.isInteger()) {
- setOperationAction(ISD::SHL, VT, Custom);
- setOperationAction(ISD::SRA, VT, Custom);
- setOperationAction(ISD::SRL, VT, Custom);
+ setOperationAction(ISD::SHL, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::SRA, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::SRL, VT.getSimpleVT(), Custom);
}
// Promote all bit-wise operations.
if (VT.isInteger() && VT != PromotedBitwiseVT) {
- setOperationAction(ISD::AND, VT, Promote);
+ setOperationAction(ISD::AND, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::AND, VT, PromotedBitwiseVT);
- setOperationAction(ISD::OR, VT, Promote);
+ setOperationAction(ISD::OR, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::OR, VT, PromotedBitwiseVT);
- setOperationAction(ISD::XOR, VT, Promote);
+ setOperationAction(ISD::XOR, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::XOR, VT, PromotedBitwiseVT);
}
}
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=78593&r1=78592&r2=78593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Aug 10 15:18:46 2009
@@ -168,7 +168,7 @@
// SPU's loads and stores have to be custom lowered:
for (unsigned sctype = (unsigned) MVT::i8; sctype < (unsigned) MVT::i128;
++sctype) {
- MVT VT = (MVT::SimpleValueType)sctype;
+ MVT::SimpleValueType VT = (MVT::SimpleValueType)sctype;
setOperationAction(ISD::LOAD, VT, Custom);
setOperationAction(ISD::STORE, VT, Custom);
@@ -184,7 +184,7 @@
for (unsigned sctype = (unsigned) MVT::f32; sctype < (unsigned) MVT::f64;
++sctype) {
- MVT VT = (MVT::SimpleValueType) sctype;
+ MVT::SimpleValueType VT = (MVT::SimpleValueType) sctype;
setOperationAction(ISD::LOAD, VT, Custom);
setOperationAction(ISD::STORE, VT, Custom);
@@ -391,7 +391,7 @@
// appropriate instructions to materialize the address.
for (unsigned sctype = (unsigned) MVT::i8; sctype < (unsigned) MVT::f128;
++sctype) {
- MVT VT = (MVT::SimpleValueType)sctype;
+ MVT::SimpleValueType VT = (MVT::SimpleValueType)sctype;
setOperationAction(ISD::GlobalAddress, VT, Custom);
setOperationAction(ISD::ConstantPool, VT, Custom);
@@ -434,7 +434,7 @@
for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) {
- MVT VT = (MVT::SimpleValueType)i;
+ MVT::SimpleValueType VT = (MVT::SimpleValueType)i;
// add/sub are legal for all supported vector VT's.
setOperationAction(ISD::ADD, VT, Legal);
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=78593&r1=78592&r2=78593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Aug 10 15:18:46 2009
@@ -283,7 +283,7 @@
// will selectively turn on ones that can be effectively codegen'd.
for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) {
- MVT VT = (MVT::SimpleValueType)i;
+ MVT::SimpleValueType VT = (MVT::SimpleValueType)i;
// add/sub are legal for all supported vector VT's.
setOperationAction(ISD::ADD , VT, Legal);
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=78593&r1=78592&r2=78593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 10 15:18:46 2009
@@ -723,9 +723,9 @@
// Do not attempt to custom lower non-128-bit vectors
if (!VT.is128BitVector())
continue;
- setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
- setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom);
- setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT, Custom);
+ setOperationAction(ISD::BUILD_VECTOR, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::VECTOR_SHUFFLE, VT.getSimpleVT(), Custom);
+ setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT.getSimpleVT(), Custom);
}
setOperationAction(ISD::BUILD_VECTOR, MVT::v2f64, Custom);
@@ -748,15 +748,15 @@
if (!VT.is128BitVector()) {
continue;
}
- setOperationAction(ISD::AND, VT, Promote);
+ setOperationAction(ISD::AND, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::AND, VT, MVT::v2i64);
- setOperationAction(ISD::OR, VT, Promote);
+ setOperationAction(ISD::OR, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::OR, VT, MVT::v2i64);
- setOperationAction(ISD::XOR, VT, Promote);
+ setOperationAction(ISD::XOR, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::XOR, VT, MVT::v2i64);
- setOperationAction(ISD::LOAD, VT, Promote);
+ setOperationAction(ISD::LOAD, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::LOAD, VT, MVT::v2i64);
- setOperationAction(ISD::SELECT, VT, Promote);
+ setOperationAction(ISD::SELECT, VT.getSimpleVT(), Promote);
AddPromotedToType (ISD::SELECT, VT, MVT::v2i64);
}
From idadesub at users.sourceforge.net Mon Aug 10 15:25:01 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:01 -0700
Subject: [llvm-commits] Patch series to expose APInt and APFloat to llvm-c
and ocaml
Message-ID: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
Hello all,
It's been a while since I did any work on the ocaml bindings, so I want to
check with everyone first before I commit this. This series adds initial
support for APInt and APFloat, as well as adding support for creating constant
ints and constant reals using APInt and APFloat.
The only real question I have is on the ocaml side of things. Right now this is
embedding the creation of APInt and APFloat into the Llvm module, but I think
it could be nice to have a separate Llvm_support module that doesn't link in
the rest of llvm. What do you all think?
From idadesub at users.sourceforge.net Mon Aug 10 15:25:02 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:02 -0700
Subject: [llvm-commits] [PATCH 1/6] Expose APInt to llvm-c.
In-Reply-To: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
---
include/llvm-c/Support.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++
lib/Support/Support.cpp | 45 ++++++++++++++++++++++++
2 files changed, 130 insertions(+), 0 deletions(-)
create mode 100644 include/llvm-c/Support.h
create mode 100644 lib/Support/Support.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Expose-APInt-to-llvm-c.patch
Type: text/x-patch
Size: 5987 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090810/94d23a4b/attachment.bin
From idadesub at users.sourceforge.net Mon Aug 10 15:25:03 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:03 -0700
Subject: [llvm-commits] [PATCH 2/6] Expose APFloat to llvm-c.
In-Reply-To: <1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <1249935907-475-3-git-send-email-idadesub@users.sourceforge.net>
---
include/llvm-c/Support.h | 34 ++++++++++++++++++++++++++++++++++
lib/Support/Support.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 0 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Expose-APFloat-to-llvm-c.patch
Type: text/x-patch
Size: 3625 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090810/56c8b0ba/attachment.bin
From idadesub at users.sourceforge.net Mon Aug 10 15:25:04 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:04 -0700
Subject: [llvm-commits] [PATCH 3/6] Expose APInt and APFloat to ocaml
bindings.
In-Reply-To: <1249935907-475-3-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-3-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <1249935907-475-4-git-send-email-idadesub@users.sourceforge.net>
---
bindings/ocaml/llvm/llvm.ml | 50 +++++++++++++++++++
bindings/ocaml/llvm/llvm.mli | 67 ++++++++++++++++++++++++++
bindings/ocaml/llvm/llvm_ocaml.c | 98 ++++++++++++++++++++++++++++++++++++++
test/Bindings/Ocaml/support.ml | 73 ++++++++++++++++++++++++++++
4 files changed, 288 insertions(+), 0 deletions(-)
create mode 100644 test/Bindings/Ocaml/support.ml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Expose-APInt-and-APFloat-to-ocaml-bindings.patch
Type: text/x-patch
Size: 11681 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090810/aff8a819/attachment.bin
From idadesub at users.sourceforge.net Mon Aug 10 15:25:07 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:07 -0700
Subject: [llvm-commits] [PATCH 6/6] Add nums.cma to the ocaml tests.
In-Reply-To: <1249935907-475-6-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-3-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-4-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-5-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-6-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <1249935907-475-7-git-send-email-idadesub@users.sourceforge.net>
---
test/Bindings/Ocaml/analysis.ml | 2 +-
test/Bindings/Ocaml/bitreader.ml | 2 +-
test/Bindings/Ocaml/bitwriter.ml | 2 +-
test/Bindings/Ocaml/executionengine.ml | 2 +-
test/Bindings/Ocaml/scalar_opts.ml | 2 +-
test/Bindings/Ocaml/target.ml | 2 +-
test/Bindings/Ocaml/vmcore.ml | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Add-nums.cma-to-the-ocaml-tests.patch
Type: text/x-patch
Size: 3139 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090810/6d1aea9d/attachment.bin
From idadesub at users.sourceforge.net Mon Aug 10 15:25:05 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:05 -0700
Subject: [llvm-commits] [PATCH 4/6] Expose creating constant ints and reals
from APInt and APFloat to llvm-c.
In-Reply-To: <1249935907-475-4-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-3-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-4-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <1249935907-475-5-git-send-email-idadesub@users.sourceforge.net>
---
include/llvm-c/Core.h | 5 +++++
lib/VMCore/Core.cpp | 9 +++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Expose-creating-constant-ints-and-reals-from-APInt-a.patch
Type: text/x-patch
Size: 2175 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090810/a57ea519/attachment.bin
From idadesub at users.sourceforge.net Mon Aug 10 15:25:06 2009
From: idadesub at users.sourceforge.net (Erick Tryzelaar)
Date: Mon, 10 Aug 2009 13:25:06 -0700
Subject: [llvm-commits] [PATCH 5/6] Expose creating constant int and real
from APInt and APFloat to ocaml.
In-Reply-To: <1249935907-475-5-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-2-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-3-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-4-git-send-email-idadesub@users.sourceforge.net>
<1249935907-475-5-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <1249935907-475-6-git-send-email-idadesub@users.sourceforge.net>
---
bindings/ocaml/llvm/llvm.ml | 5 +++++
bindings/ocaml/llvm/llvm.mli | 12 ++++++++++++
bindings/ocaml/llvm/llvm_ocaml.c | 10 ++++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Expose-creating-constant-int-and-real-from-APInt-and.patch
Type: text/x-patch
Size: 2891 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090810/e29e906a/attachment.bin
From evan.cheng at apple.com Mon Aug 10 15:25:59 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 20:25:59 -0000
Subject: [llvm-commits] [llvm] r78594 - in /llvm/trunk:
lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
Message-ID: <200908102025.n7AKPx0U032705@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Aug 10 15:25:59 2009
New Revision: 78594
URL: http://llvm.org/viewvc/llvm-project?rev=78594&view=rev
Log:
Handle the constantfp created during post-legalization dag combiner phase.
Added:
llvm/trunk/test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
Modified:
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=78594&r1=78593&r2=78594&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Aug 10 15:25:59 2009
@@ -988,6 +988,24 @@
// Other cases are autogenerated.
break;
}
+ case ISD::ConstantFP: {
+ ConstantFPSDNode *CFP = cast(N);
+ MVT VT = CFP->getValueType(0);
+ ConstantFP *LLVMC = const_cast(CFP->getConstantFPValue());
+ SDValue CPIdx = CurDAG->getTargetConstantPool(LLVMC, TLI.getPointerTy());
+ SDNode *ResNode;
+ SDValue Ops[] = {
+ CPIdx,
+ CurDAG->getTargetConstant(0, MVT::i32),
+ getAL(CurDAG),
+ CurDAG->getRegister(0, MVT::i32),
+ CurDAG->getEntryNode()
+ };
+ unsigned Opc = (VT == MVT::f32) ? ARM::FLDS : ARM::FLDD;
+ ResNode=CurDAG->getTargetNode(Opc, dl, VT, MVT::Other, Ops, 5);
+ ReplaceUses(Op, SDValue(ResNode, 0));
+ return NULL;
+ }
case ISD::FrameIndex: {
// Selects to ADDri FI, 0 which in turn will become ADDri SP, imm.
int FI = cast(N)->getIndex();
Added: llvm/trunk/test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/2009-08-10-ISelBug.ll?rev=78594&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/2009-08-10-ISelBug.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb2/2009-08-10-ISelBug.ll Mon Aug 10 15:25:59 2009
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | llc -mtriple=thumbv7-apple-darwin -mattr=+vfp2
+
+define arm_apcscc float @t1(i32 %v0) nounwind {
+entry:
+ store i32 undef, i32* undef, align 4
+ %0 = load [4 x i8]** undef, align 4 ; <[4 x i8]*> [#uses=1]
+ %1 = load i8* undef, align 1 ; [#uses=1]
+ %2 = zext i8 %1 to i32 ; [#uses=1]
+ %3 = getelementptr [4 x i8]* %0, i32 %v0, i32 0 ; [#uses=1]
+ %4 = load i8* %3, align 1 ; [#uses=1]
+ %5 = zext i8 %4 to i32 ; [#uses=1]
+ %6 = sub i32 %5, %2 ; [#uses=1]
+ %7 = sitofp i32 %6 to float ; [#uses=1]
+ ret float %7
+}
From resistor at mac.com Mon Aug 10 15:46:16 2009
From: resistor at mac.com (Owen Anderson)
Date: Mon, 10 Aug 2009 20:46:16 -0000
Subject: [llvm-commits] [llvm] r78595 - in /llvm/trunk:
include/llvm/Target/TargetLowering.h lib/Target/ARM/ARMISelLowering.cpp
lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200908102046.n7AKkGgq003141@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Aug 10 15:46:15 2009
New Revision: 78595
URL: http://llvm.org/viewvc/llvm-project?rev=78595&view=rev
Log:
SimpleValueType-ify a few more methods on TargetLowering.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=78595&r1=78594&r2=78595&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Aug 10 15:46:15 2009
@@ -955,82 +955,80 @@
/// setLoadExtAction - Indicate that the specified load with extension does
/// not work with the with specified type and indicate what to do about it.
- void setLoadExtAction(unsigned ExtType, MVT VT,
+ void setLoadExtAction(unsigned ExtType, MVT::SimpleValueType VT,
LegalizeAction Action) {
- assert((unsigned)VT.getSimpleVT() < sizeof(LoadExtActions[0])*4 &&
+ assert((unsigned)VT < sizeof(LoadExtActions[0])*4 &&
ExtType < array_lengthof(LoadExtActions) &&
"Table isn't big enough!");
- LoadExtActions[ExtType] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2);
- LoadExtActions[ExtType] |= (uint64_t)Action << VT.getSimpleVT()*2;
+ LoadExtActions[ExtType] &= ~(uint64_t(3UL) << VT*2);
+ LoadExtActions[ExtType] |= (uint64_t)Action << VT*2;
}
/// setTruncStoreAction - Indicate that the specified truncating store does
/// not work with the with specified type and indicate what to do about it.
- void setTruncStoreAction(MVT ValVT, MVT MemVT,
+ void setTruncStoreAction(MVT::SimpleValueType ValVT,
+ MVT::SimpleValueType MemVT,
LegalizeAction Action) {
- assert((unsigned)ValVT.getSimpleVT() < array_lengthof(TruncStoreActions) &&
- (unsigned)MemVT.getSimpleVT() < sizeof(TruncStoreActions[0])*4 &&
+ assert((unsigned)ValVT < array_lengthof(TruncStoreActions) &&
+ (unsigned)MemVT < sizeof(TruncStoreActions[0])*4 &&
"Table isn't big enough!");
- TruncStoreActions[ValVT.getSimpleVT()] &= ~(uint64_t(3UL) <<
- MemVT.getSimpleVT()*2);
- TruncStoreActions[ValVT.getSimpleVT()] |= (uint64_t)Action <<
- MemVT.getSimpleVT()*2;
+ TruncStoreActions[ValVT] &= ~(uint64_t(3UL) << MemVT*2);
+ TruncStoreActions[ValVT] |= (uint64_t)Action << MemVT*2;
}
/// setIndexedLoadAction - Indicate that the specified indexed load does or
/// does not work with the with specified type and indicate what to do abort
/// it. NOTE: All indexed mode loads are initialized to Expand in
/// TargetLowering.cpp
- void setIndexedLoadAction(unsigned IdxMode, MVT VT,
+ void setIndexedLoadAction(unsigned IdxMode, MVT::SimpleValueType VT,
LegalizeAction Action) {
- assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE &&
+ assert((unsigned)VT < MVT::LAST_VALUETYPE &&
IdxMode < array_lengthof(IndexedModeActions[0][0]) &&
"Table isn't big enough!");
- IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode] = (uint8_t)Action;
+ IndexedModeActions[(unsigned)VT][0][IdxMode] = (uint8_t)Action;
}
/// setIndexedStoreAction - Indicate that the specified indexed store does or
/// does not work with the with specified type and indicate what to do about
/// it. NOTE: All indexed mode stores are initialized to Expand in
/// TargetLowering.cpp
- void setIndexedStoreAction(unsigned IdxMode, MVT VT,
+ void setIndexedStoreAction(unsigned IdxMode, MVT::SimpleValueType VT,
LegalizeAction Action) {
- assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE &&
+ assert((unsigned)VT < MVT::LAST_VALUETYPE &&
IdxMode < array_lengthof(IndexedModeActions[0][1] ) &&
"Table isn't big enough!");
- IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode] = (uint8_t)Action;
+ IndexedModeActions[(unsigned)VT][1][IdxMode] = (uint8_t)Action;
}
/// setConvertAction - Indicate that the specified conversion does or does
/// not work with the with specified type and indicate what to do about it.
- void setConvertAction(MVT FromVT, MVT ToVT,
+ void setConvertAction(MVT::SimpleValueType FromVT, MVT::SimpleValueType ToVT,
LegalizeAction Action) {
- assert((unsigned)FromVT.getSimpleVT() < array_lengthof(ConvertActions) &&
- (unsigned)ToVT.getSimpleVT() < sizeof(ConvertActions[0])*4 &&
+ assert((unsigned)FromVT < array_lengthof(ConvertActions) &&
+ (unsigned)ToVT < sizeof(ConvertActions[0])*4 &&
"Table isn't big enough!");
- ConvertActions[FromVT.getSimpleVT()] &= ~(uint64_t(3UL) <<
- ToVT.getSimpleVT()*2);
- ConvertActions[FromVT.getSimpleVT()] |= (uint64_t)Action <<
- ToVT.getSimpleVT()*2;
+ ConvertActions[FromVT] &= ~(uint64_t(3UL) << ToVT*2);
+ ConvertActions[FromVT] |= (uint64_t)Action << ToVT*2;
}
/// setCondCodeAction - Indicate that the specified condition code is or isn't
/// supported on the target and indicate what to do about it.
- void setCondCodeAction(ISD::CondCode CC, MVT VT, LegalizeAction Action) {
- assert((unsigned)VT.getSimpleVT() < sizeof(CondCodeActions[0])*4 &&
+ void setCondCodeAction(ISD::CondCode CC, MVT::SimpleValueType VT,
+ LegalizeAction Action) {
+ assert((unsigned)VT < sizeof(CondCodeActions[0])*4 &&
(unsigned)CC < array_lengthof(CondCodeActions) &&
"Table isn't big enough!");
- CondCodeActions[(unsigned)CC] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2);
- CondCodeActions[(unsigned)CC] |= (uint64_t)Action << VT.getSimpleVT()*2;
+ CondCodeActions[(unsigned)CC] &= ~(uint64_t(3UL) << VT*2);
+ CondCodeActions[(unsigned)CC] |= (uint64_t)Action << VT*2;
}
/// AddPromotedToType - If Opc/OrigVT is specified as being promoted, the
/// promotion code defaults to trying a larger integer/fp until it can find
/// one that works. If that default is insufficient, this method can be used
/// by the target to override the default.
- void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT) {
- PromoteToType[std::make_pair(Opc, OrigVT.getSimpleVT())] =
- DestVT.getSimpleVT();
+ void AddPromotedToType(unsigned Opc, MVT::SimpleValueType OrigVT,
+ MVT::SimpleValueType DestVT) {
+ PromoteToType[std::make_pair(Opc, OrigVT)] = DestVT;
}
/// addLegalFPImmediate - Indicate that this target can instruction select
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=78595&r1=78594&r2=78595&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 10 15:46:15 2009
@@ -62,10 +62,12 @@
MVT PromotedBitwiseVT) {
if (VT != PromotedLdStVT) {
setOperationAction(ISD::LOAD, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::LOAD, VT, PromotedLdStVT);
+ AddPromotedToType (ISD::LOAD, VT.getSimpleVT(),
+ PromotedLdStVT.getSimpleVT());
setOperationAction(ISD::STORE, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::STORE, VT, PromotedLdStVT);
+ AddPromotedToType (ISD::STORE, VT.getSimpleVT(),
+ PromotedLdStVT.getSimpleVT());
}
MVT ElemTy = VT.getVectorElementType();
@@ -86,11 +88,14 @@
// Promote all bit-wise operations.
if (VT.isInteger() && VT != PromotedBitwiseVT) {
setOperationAction(ISD::AND, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::AND, VT, PromotedBitwiseVT);
+ AddPromotedToType (ISD::AND, VT.getSimpleVT(),
+ PromotedBitwiseVT.getSimpleVT());
setOperationAction(ISD::OR, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::OR, VT, PromotedBitwiseVT);
+ AddPromotedToType (ISD::OR, VT.getSimpleVT(),
+ PromotedBitwiseVT.getSimpleVT());
setOperationAction(ISD::XOR, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::XOR, VT, PromotedBitwiseVT);
+ AddPromotedToType (ISD::XOR, VT.getSimpleVT(),
+ PromotedBitwiseVT.getSimpleVT());
}
}
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=78595&r1=78594&r2=78595&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Aug 10 15:46:15 2009
@@ -177,7 +177,7 @@
setLoadExtAction(ISD::SEXTLOAD, VT, Custom);
for (unsigned stype = sctype - 1; stype >= (unsigned) MVT::i8; --stype) {
- MVT StoreVT = (MVT::SimpleValueType) stype;
+ MVT::SimpleValueType StoreVT = (MVT::SimpleValueType) stype;
setTruncStoreAction(VT, StoreVT, Expand);
}
}
@@ -190,7 +190,7 @@
setOperationAction(ISD::STORE, VT, Custom);
for (unsigned stype = sctype - 1; stype >= (unsigned) MVT::f32; --stype) {
- MVT StoreVT = (MVT::SimpleValueType) stype;
+ MVT::SimpleValueType StoreVT = (MVT::SimpleValueType) stype;
setTruncStoreAction(VT, StoreVT, Expand);
}
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=78595&r1=78594&r2=78595&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 10 15:46:15 2009
@@ -742,22 +742,23 @@
// Promote v16i8, v8i16, v4i32 load, select, and, or, xor to v2i64.
for (unsigned i = (unsigned)MVT::v16i8; i != (unsigned)MVT::v2i64; i++) {
- MVT VT = (MVT::SimpleValueType)i;
+ MVT::SimpleValueType SVT = (MVT::SimpleValueType)i;
+ MVT VT = SVT;
// Do not attempt to promote non-128-bit vectors
if (!VT.is128BitVector()) {
continue;
}
- setOperationAction(ISD::AND, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::AND, VT, MVT::v2i64);
- setOperationAction(ISD::OR, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::OR, VT, MVT::v2i64);
- setOperationAction(ISD::XOR, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::XOR, VT, MVT::v2i64);
- setOperationAction(ISD::LOAD, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::LOAD, VT, MVT::v2i64);
- setOperationAction(ISD::SELECT, VT.getSimpleVT(), Promote);
- AddPromotedToType (ISD::SELECT, VT, MVT::v2i64);
+ setOperationAction(ISD::AND, SVT, Promote);
+ AddPromotedToType (ISD::AND, SVT, MVT::v2i64);
+ setOperationAction(ISD::OR, SVT, Promote);
+ AddPromotedToType (ISD::OR, SVT, MVT::v2i64);
+ setOperationAction(ISD::XOR, SVT, Promote);
+ AddPromotedToType (ISD::XOR, SVT, MVT::v2i64);
+ setOperationAction(ISD::LOAD, SVT, Promote);
+ AddPromotedToType (ISD::LOAD, SVT, MVT::v2i64);
+ setOperationAction(ISD::SELECT, SVT, Promote);
+ AddPromotedToType (ISD::SELECT, SVT, MVT::v2i64);
}
setTruncStoreAction(MVT::f64, MVT::f32, Expand);
From daniel at zuster.org Mon Aug 10 15:56:46 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 20:56:46 -0000
Subject: [llvm-commits] [llvm] r78596 - in /llvm/trunk:
include/llvm/Constants.h lib/VMCore/ConstantsContext.h
Message-ID: <200908102056.n7AKukuC004606@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 15:56:46 2009
New Revision: 78596
URL: http://llvm.org/viewvc/llvm-project?rev=78596&view=rev
Log:
Rename ConvertType to ConvertConstant to avoid a name conflict on llvm-gcc.
Modified:
llvm/trunk/include/llvm/Constants.h
llvm/trunk/lib/VMCore/ConstantsContext.h
Modified: llvm/trunk/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=78596&r1=78595&r2=78596&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constants.h (original)
+++ llvm/trunk/include/llvm/Constants.h Mon Aug 10 15:56:46 2009
@@ -38,7 +38,7 @@
template
struct ConstantCreator;
template
-struct ConvertType;
+struct ConvertConstant;
//===----------------------------------------------------------------------===//
/// This is the shared class of boolean and integer constants. This class
@@ -552,7 +552,7 @@
class ConstantExpr : public Constant {
friend struct ConstantCreator > >;
- friend struct ConvertType;
+ friend struct ConvertConstant;
protected:
ConstantExpr(const Type *ty, unsigned Opcode, Use *Ops, unsigned NumOps)
Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=78596&r1=78595&r2=78596&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
+++ llvm/trunk/lib/VMCore/ConstantsContext.h Mon Aug 10 15:56:46 2009
@@ -340,7 +340,7 @@
};
template
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantClass *OldC, const TypeClass *NewTy) {
llvm_unreachable("This type cannot be converted!");
}
@@ -391,7 +391,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantExpr *OldC, const Type *NewTy) {
Constant *New;
switch (OldC->getOpcode()) {
@@ -451,7 +451,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantVector *OldC, const VectorType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector C;
@@ -465,7 +465,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantAggregateZero *OldC, const Type *NewTy) {
// Make everyone now use a constant of the new type...
Constant *New = ConstantAggregateZero::get(NewTy);
@@ -476,7 +476,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantArray *OldC, const ArrayType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector C;
@@ -490,7 +490,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantStruct *OldC, const StructType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector C;
@@ -513,7 +513,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(ConstantPointerNull *OldC, const PointerType *NewTy) {
// Make everyone now use a constant of the new type...
Constant *New = ConstantPointerNull::get(NewTy);
@@ -532,7 +532,7 @@
};
template<>
-struct ConvertType {
+struct ConvertConstant {
static void convert(UndefValue *OldC, const Type *NewTy) {
// Make everyone now use a constant of the new type.
Constant *New = UndefValue::get(NewTy);
@@ -757,7 +757,7 @@
// leaving will remove() itself, causing the AbstractTypeMapEntry to be
// eliminated eventually.
do {
- ConvertType::convert(
+ ConvertConstant::convert(
static_cast(I->second->second),
cast(NewTy));
From gohman at apple.com Mon Aug 10 15:57:03 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 10 Aug 2009 13:57:03 -0700
Subject: [llvm-commits] Patch series to expose APInt and APFloat to
llvm-c and ocaml
In-Reply-To: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
References: <1249935907-475-1-git-send-email-idadesub@users.sourceforge.net>
Message-ID: <0EBB8F77-A5C0-49F0-AC6A-8A1864A386E2@apple.com>
Hi Erick,
Is APInt/APFloat really the right level of abstraction to expose to the
C API? Would it make more sense to just provide more flexible ways to
call
ConstantInt::get and ConstantFP::get from the C API? The C++ API could
also be extended, if it would help here. This would seem to be a more
convenient API to work with, and have the side benefit of being more
efficient.
Dan
On Aug 10, 2009, at 1:25 PM, Erick Tryzelaar wrote:
> Hello all,
>
> It's been a while since I did any work on the ocaml bindings, so I
> want to
> check with everyone first before I commit this. This series adds
> initial
> support for APInt and APFloat, as well as adding support for
> creating constant
> ints and constant reals using APInt and APFloat.
>
> The only real question I have is on the ocaml side of things. Right
> now this is
> embedding the creation of APInt and APFloat into the Llvm module,
> but I think
> it could be nice to have a separate Llvm_support module that doesn't
> link in
> the rest of llvm. What do you all think?
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From daniel at zuster.org Mon Aug 10 16:00:46 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 21:00:46 -0000
Subject: [llvm-commits] [llvm] r78597 - in /llvm/trunk:
include/llvm/Target/Target.td lib/Target/X86/AsmParser/X86AsmParser.cpp
utils/TableGen/AsmMatcherEmitter.cpp
Message-ID: <200908102100.n7AL0kSv005192@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 16:00:45 2009
New Revision: 78597
URL: http://llvm.org/viewvc/llvm-project?rev=78597&view=rev
Log:
llvm-mc/AsmParser: Allow .td users to redefine the names of the methods to call
on target specific operands for testing class membership and converting to
MCInst operands.
Modified:
llvm/trunk/include/llvm/Target/Target.td
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/include/llvm/Target/Target.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=78597&r1=78596&r2=78597&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/Target.td (original)
+++ llvm/trunk/include/llvm/Target/Target.td Mon Aug 10 16:00:45 2009
@@ -290,14 +290,25 @@
/// match a subset of some other class, in which case the super class field
/// should be defined.
class AsmOperandClass {
- /// The name to use for this class, this should be usable as an enum value,
- /// and will be used to generated the names for the methods to test whether a
- /// particular target specific operand matches this class, and the method to
- /// convert an operand of this class into an MCInst operand.
+ /// The name to use for this class, which should be usable as an enum value.
string Name = ?;
/// The super class of this operand.
AsmOperandClass SuperClass = ?;
+
+ /// The name of the method on the target specific operand to call to test
+ /// whether the operand is an instance of this class. If not set, this will
+ /// default to "isFoo", where Foo is the AsmOperandClass name. The method
+ /// signature should be:
+ /// bool isFoo() const;
+ string PredicateMethod = ?;
+
+ /// The name of the method on the target specific operand to call to add the
+ /// target specific operand to an MCInst. If not set, this will default to
+ /// "addFooOperands", where Foo is the AsmOperandClass name. The method
+ /// signature should be:
+ /// void addFooOperands(MCInst &Inst, unsigned N) const;
+ string RenderMethod = ?;
}
def ImmAsmOperand : AsmOperandClass {
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=78597&r1=78596&r2=78597&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Aug 10 16:00:45 2009
@@ -154,23 +154,23 @@
bool isReg() const { return Kind == Register; }
- void addRegOperands(MCInst &Inst, unsigned N) {
+ void addRegOperands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
Inst.addOperand(MCOperand::CreateReg(getReg()));
}
- void addImmOperands(MCInst &Inst, unsigned N) {
+ void addImmOperands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
Inst.addOperand(MCOperand::CreateMCValue(getImm()));
}
- void addImmSExt8Operands(MCInst &Inst, unsigned N) {
+ void addImmSExt8Operands(MCInst &Inst, unsigned N) const {
// FIXME: Support user customization of the render method.
assert(N == 1 && "Invalid number of operands!");
Inst.addOperand(MCOperand::CreateMCValue(getImm()));
}
- void addMemOperands(MCInst &Inst, unsigned N) {
+ void addMemOperands(MCInst &Inst, unsigned N) const {
assert((N == 4 || N == 5) && "Invalid number of operands!");
Inst.addOperand(MCOperand::CreateReg(getMemBaseReg()));
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=78597&r1=78596&r2=78597&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Aug 10 16:00:45 2009
@@ -589,8 +589,27 @@
CI->ClassName = (*it)->getValueAsString("Name");
CI->Name = "MCK_" + CI->ClassName;
CI->ValueName = (*it)->getName();
- CI->PredicateMethod = "is" + CI->ClassName;
- CI->RenderMethod = "add" + CI->ClassName + "Operands";
+
+ // Get or construct the predicate method name.
+ Init *PMName = (*it)->getValueInit("PredicateMethod");
+ if (StringInit *SI = dynamic_cast(PMName)) {
+ CI->PredicateMethod = SI->getValue();
+ } else {
+ assert(dynamic_cast(PMName) &&
+ "Unexpected PredicateMethod field!");
+ CI->PredicateMethod = "is" + CI->ClassName;
+ }
+
+ // Get or construct the render method name.
+ Init *RMName = (*it)->getValueInit("RenderMethod");
+ if (StringInit *SI = dynamic_cast(RMName)) {
+ CI->RenderMethod = SI->getValue();
+ } else {
+ assert(dynamic_cast(RMName) &&
+ "Unexpected RenderMethod field!");
+ CI->RenderMethod = "add" + CI->ClassName + "Operands";
+ }
+
AsmOperandClasses[*it] = CI;
Classes.push_back(CI);
}
From eli.friedman at gmail.com Mon Aug 10 16:00:58 2009
From: eli.friedman at gmail.com (Eli Friedman)
Date: Mon, 10 Aug 2009 14:00:58 -0700
Subject: [llvm-commits] [llvm] r78594 - in /llvm/trunk:
lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
In-Reply-To: <200908102025.n7AKPx0U032705@zion.cs.uiuc.edu>
References: <200908102025.n7AKPx0U032705@zion.cs.uiuc.edu>
Message-ID:
On Mon, Aug 10, 2009 at 1:25 PM, Evan Cheng wrote:
> Author: evancheng
> Date: Mon Aug 10 15:25:59 2009
> New Revision: 78594
>
> URL: http://llvm.org/viewvc/llvm-project?rev=78594&view=rev
> Log:
> Handle the constantfp created during post-legalization dag combiner phase.
AFAIK, dagcombine isn't supposed to create illegal constantfp nodes
post-legalize... perhaps it would be better to fix the issue there?
-Eli
From daniel at zuster.org Mon Aug 10 16:06:41 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 10 Aug 2009 21:06:41 -0000
Subject: [llvm-commits] [llvm] r78598 - in /llvm/trunk:
lib/Target/X86/X86Instr64bit.td test/MC/AsmParser/x86_instructions.s
Message-ID: <200908102106.n7AL6fqx006017@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Aug 10 16:06:41 2009
New Revision: 78598
URL: http://llvm.org/viewvc/llvm-project?rev=78598&view=rev
Log:
llvm-mc/AsmParser: Disambiguate i64i8imm.
Modified:
llvm/trunk/lib/Target/X86/X86Instr64bit.td
llvm/trunk/test/MC/AsmParser/x86_instructions.s
Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=78598&r1=78597&r2=78598&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Mon Aug 10 16:06:41 2009
@@ -28,7 +28,9 @@
// 64-bits but only 8 bits are significant.
-def i64i8imm : Operand;
+def i64i8imm : Operand {
+ let ParserMatchClass = ImmSExt8AsmOperand;
+}
def lea64mem : Operand {
let PrintMethod = "printlea64mem";
Modified: llvm/trunk/test/MC/AsmParser/x86_instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/x86_instructions.s?rev=78598&r1=78597&r2=78598&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/x86_instructions.s (original)
+++ llvm/trunk/test/MC/AsmParser/x86_instructions.s Mon Aug 10 16:06:41 2009
@@ -1,6 +1,6 @@
// FIXME: Switch back to FileCheck once we print actual instructions
-// RUN: llvm-mc -triple i386-unknown-unknown %s > %t
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s > %t
// RUN: grep {MCInst(opcode=.*, operands=.reg:2, reg:0, reg:2.)} %t
subb %al, %al
@@ -29,4 +29,10 @@
// RUN: grep {MCInst(opcode=.*, operands=.reg:19, reg:0, val:256.)} %t
subl $256, %eax
+// FIXME: Check that this matches XOR64ri8
+// RUN: grep {MCInst(opcode=.*, operands=.reg:19, reg:0, val:1.)} %t
+ xorq $1, %eax
+// FIXME: Check that this matches XOR64ri32
+// RUN: grep {MCInst(opcode=.*, operands=.reg:19, reg:0, val:256.)} %t
+ xorq $256, %eax
From evan.cheng at apple.com Mon Aug 10 16:38:42 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 14:38:42 -0700
Subject: [llvm-commits] [llvm] r78594 - in /llvm/trunk:
lib/Target/ARM/ARMISelDAGToDAG.cpp test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
In-Reply-To:
References: <200908102025.n7AKPx0U032705@zion.cs.uiuc.edu>
Message-ID:
On Aug 10, 2009, at 2:00 PM, Eli Friedman wrote:
> On Mon, Aug 10, 2009 at 1:25 PM, Evan Cheng
> wrote:
>> Author: evancheng
>> Date: Mon Aug 10 15:25:59 2009
>> New Revision: 78594
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=78594&view=rev
>> Log:
>> Handle the constantfp created during post-legalization dag combiner
>> phase.
>
> AFAIK, dagcombine isn't supposed to create illegal constantfp nodes
> post-legalize... perhaps it would be better to fix the issue there?
Yes and no. These transformations are somewhat essential so perhaps
the *right* solution is to emit loads from constantpool instead of
constantfp nodes. On the other hand, ARM isel is able to handle
constantfp nodes. So it seems perfectly ok to consider them legal.
Evan
>
> -Eli
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From echristo at apple.com Mon Aug 10 16:46:13 2009
From: echristo at apple.com (Eric Christopher)
Date: Mon, 10 Aug 2009 14:46:13 -0700
Subject: [llvm-commits] [llvm] r78508 - in /llvm/trunk:
lib/Target/X86/X86CodeEmitter.cpp lib/Target/X86/X86InstrFormats.td
lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h
lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse42.ll
In-Reply-To: <7743DDCD-5C38-4CDC-ACA0-FC4F06E2F9E7@me.com>
References: <200908082155.n78Lt93v018532@zion.cs.uiuc.edu>
<7743DDCD-5C38-4CDC-ACA0-FC4F06E2F9E7@me.com>
Message-ID: <3A0E7545-E53B-46B1-9249-A2456002B722@apple.com>
Resending as me this time :)
On Aug 10, 2009, at 2:38 PM, Eric Christopher wrote:
>
> On Aug 8, 2009, at 5:13 PM, Eli Friedman wrote:
>
>> On Sat, Aug 8, 2009 at 2:55 PM, Eric
>> Christopher wrote:
>>> + // TODO: These correspond to int_x86_sse42_crc32_8 but with a
>>> 64-bit src
>>> + // and dest, figure it out.
>>> + //def CRC64m8 : SS42FI<0xF1, MRMSrcMem, (outs GR64:$dst),
>>> + // (ins GR32:$src1, i8mem:$src2),
>>> + // "crc32 \t{$src2, $src1|$src1, $src2}",
>>> + // [(set GR64:$dst,
>>> + // (int_x86_sse42_crc32_8 GR64:$src1,
>>> + // (load addr:$src2)))]>,
>>> + // OpSize, REX_W;
>>> + //def CRC64r8 : SS42FI<0xF1, MRMSrcReg, (outs GR64:$dst),
>>> + // (ins GR64:$src1, GR8:$src2),
>>> + // "crc32 \t{$src2, $src1|$src1, $src2}",
>>> + // [(set GR64:$dst,
>>> + // (int_x86_sse42_crc32_8 GR32:$src1,
>>> GR8:$src2))]>,
>>> + // OpSize, REX_W;
>>> +}
>>
>> Hmm... if the encoding is correct, I'd suggest just getting rid of
>> the
>> pattern and uncommenting it. There isn't any situation where we
>> would
>> actually want to use these forms; the effect is exactly the same as
>> CRC32r/m8.
>
> Yeah, wasn't sure since the target register size is different, but
> seems reasonable.
-eric
From echristo at apple.com Mon Aug 10 16:48:58 2009
From: echristo at apple.com (Eric Christopher)
Date: Mon, 10 Aug 2009 21:48:58 -0000
Subject: [llvm-commits] [llvm] r78600 -
/llvm/trunk/lib/Target/X86/X86InstrSSE.td
Message-ID: <200908102148.n7ALmwFn011932@zion.cs.uiuc.edu>
Author: echristo
Date: Mon Aug 10 16:48:58 2009
New Revision: 78600
URL: http://llvm.org/viewvc/llvm-project?rev=78600&view=rev
Log:
Fix up whitespace, remove commented out code.
Modified:
llvm/trunk/lib/Target/X86/X86InstrSSE.td
Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=78600&r1=78599&r2=78600&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Aug 10 16:48:58 2009
@@ -69,7 +69,8 @@
def X86pcmpgtd : SDNode<"X86ISD::PCMPGTD", SDTIntBinOp>;
def X86pcmpgtq : SDNode<"X86ISD::PCMPGTQ", SDTIntBinOp>;
-def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>, SDTCisVT<1, v4f32>]>;
+def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>,
+ SDTCisVT<1, v4f32>]>;
def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>;
//===----------------------------------------------------------------------===//
@@ -3685,70 +3686,54 @@
// This set of instructions are only rm, the only difference is the size
// of r and m.
let Constraints = "$src1 = $dst" in {
- def CRC32m8 : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst),
+ def CRC32m8 : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst),
(ins GR32:$src1, i8mem:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR32:$dst,
(int_x86_sse42_crc32_8 GR32:$src1,
(load addr:$src2)))]>, OpSize;
- def CRC32r8 : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst),
+ def CRC32r8 : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst),
(ins GR32:$src1, GR8:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR32:$dst,
- (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>,
+ (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>,
OpSize;
- def CRC32m16 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst),
+ def CRC32m16 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst),
(ins GR32:$src1, i16mem:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR32:$dst,
(int_x86_sse42_crc32_16 GR32:$src1,
(load addr:$src2)))]>,
OpSize;
- def CRC32r16 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst),
+ def CRC32r16 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst),
(ins GR32:$src1, GR16:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR32:$dst,
- (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>,
+ (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>,
OpSize;
- def CRC32m32 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst),
+ def CRC32m32 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst),
(ins GR32:$src1, i32mem:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR32:$dst,
(int_x86_sse42_crc32_32 GR32:$src1,
(load addr:$src2)))]>, OpSize;
- def CRC32r32 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst),
+ def CRC32r32 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst),
(ins GR32:$src1, GR32:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR32:$dst,
- (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>,
+ (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>,
OpSize;
- def CRC64m64 : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst),
+ def CRC64m64 : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst),
(ins GR64:$src1, i64mem:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR64:$dst,
(int_x86_sse42_crc32_64 GR64:$src1,
(load addr:$src2)))]>,
OpSize, REX_W;
- def CRC64r64 : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst),
+ def CRC64r64 : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst),
(ins GR64:$src1, GR64:$src2),
"crc32 \t{$src2, $src1|$src1, $src2}",
[(set GR64:$dst,
- (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>,
+ (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>,
OpSize, REX_W;
-
- // TODO: These correspond to int_x86_sse42_crc32_8 but with a 64-bit src
- // and dest, figure it out.
- //def CRC64m8 : SS42FI<0xF1, MRMSrcMem, (outs GR64:$dst),
- // (ins GR32:$src1, i8mem:$src2),
- // "crc32 \t{$src2, $src1|$src1, $src2}",
- // [(set GR64:$dst,
- // (int_x86_sse42_crc32_8 GR64:$src1,
- // (load addr:$src2)))]>,
- // OpSize, REX_W;
- //def CRC64r8 : SS42FI<0xF1, MRMSrcReg, (outs GR64:$dst),
- // (ins GR64:$src1, GR8:$src2),
- // "crc32 \t{$src2, $src1|$src1, $src2}",
- // [(set GR64:$dst,
- // (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>,
- // OpSize, REX_W;
}
From resistor at mac.com Mon Aug 10 16:49:46 2009
From: resistor at mac.com (Owen Anderson)
Date: Mon, 10 Aug 2009 21:49:46 -0000
Subject: [llvm-commits] [llvm] r78601 -
/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
Message-ID: <200908102149.n7ALnkYO012050@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Aug 10 16:49:45 2009
New Revision: 78601
URL: http://llvm.org/viewvc/llvm-project?rev=78601&view=rev
Log:
Remove a bunch of debugging code that was slowing PBQP down by 25% or so.
Modified:
llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=78601&r1=78600&r2=78601&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Mon Aug 10 16:49:45 2009
@@ -690,51 +690,6 @@
// Clear the existing allocation.
vrm->clearAllVirt();
- CoalesceMap coalesces;//(findCoalesces());
-
- for (unsigned i = 0; i < node2LI.size(); ++i) {
- if (solution.getSelection(i) == 0) {
- continue;
- }
-
- unsigned iSel = solution.getSelection(i);
- unsigned iAlloc = allowedSets[i][iSel - 1];
-
- for (unsigned j = i + 1; j < node2LI.size(); ++j) {
-
- if (solution.getSelection(j) == 0) {
- continue;
- }
-
- unsigned jSel = solution.getSelection(j);
- unsigned jAlloc = allowedSets[j][jSel - 1];
-
- if ((iAlloc != jAlloc) && !tri->areAliases(iAlloc, jAlloc)) {
- continue;
- }
-
- if (node2LI[i]->overlaps(*node2LI[j])) {
- if (coalesces.find(RegPair(node2LI[i]->reg, node2LI[j]->reg)) == coalesces.end()) {
- DEBUG(errs() << "In round " << ++round << ":\n"
- << "Bogusness in " << mf->getFunction()->getName() << "!\n"
- << "Live interval " << i << " (reg" << node2LI[i]->reg << ") and\n"
- << "Live interval " << j << " (reg" << node2LI[j]->reg << ")\n"
- << " were allocated registers " << iAlloc << " (index " << iSel << ") and "
- << jAlloc << "(index " << jSel
- << ") respectively in a graph of " << solution.numNodes() << " nodes.\n"
- << "li[i]->empty() = " << node2LI[i]->empty() << "\n"
- << "li[j]->empty() = " << node2LI[j]->empty() << "\n"
- << "li[i]->overlaps(li[j]) = " << node2LI[i]->overlaps(*node2LI[j]) << "\n"
- << "coalesce = " << (coalesces.find(RegPair(node2LI[i]->reg, node2LI[j]->reg)) != coalesces.end()) << "\n");
-
- DEBUG(errs() << "solution.getCost() = " << solution.getCost() << "\n");
- exit(1);
- }
- }
- }
- }
-
-
// Iterate over the nodes mapping the PBQP solution to a register assignment.
for (unsigned node = 0; node < node2LI.size(); ++node) {
unsigned virtReg = node2LI[node]->reg,
From gohman at apple.com Mon Aug 10 17:02:02 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 10 Aug 2009 15:02:02 -0700
Subject: [llvm-commits] [llvm] r78594 - in /llvm/trunk:
lib/Target/ARM/ARMISelDAGToDAG.cpp test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
In-Reply-To:
References: <200908102025.n7AKPx0U032705@zion.cs.uiuc.edu>
Message-ID:
On Aug 10, 2009, at 2:38 PM, Evan Cheng wrote:
>
> On Aug 10, 2009, at 2:00 PM, Eli Friedman wrote:
>
>
>> On Mon, Aug 10, 2009 at 1:25 PM, Evan Cheng
>>
>> wrote:
>>
>>> Author: evancheng
>>>
>>> Date: Mon Aug 10 15:25:59 2009
>>>
>>> New Revision: 78594
>>>
>>>
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=78594&view=rev
>>>
>>> Log:
>>>
>>> Handle the constantfp created during post-legalization dag combiner
>>>
>>> phase.
>>>
>>
>>
>> AFAIK, dagcombine isn't supposed to create illegal constantfp nodes
>>
>> post-legalize... perhaps it would be better to fix the issue there?
>>
>
> Yes and no. These transformations are somewhat essential so perhaps
> the *right* solution is to emit loads from constantpool instead of
> constantfp nodes.
In the included testcase, the first DAGCombine run is missing an
opportunity to fold an "x-x", which gets exposed after some other nodes
get combined away. The second DAGCombine run then folds the "x-x" into
the 0, which is folded into the sint_to_fp to form the 0.0 node.
It seems that the bug here is that both instcombine and the first
dagcombine phase have missed a folding opportunity. If either of those
two did that, then it wouldn't be essential for the second phase to
break the rules just to do the fold.
> On the other hand, ARM isel is able to handle
> constantfp nodes. So it seems perfectly ok to consider them legal.
Not really. As of your patch, it handles them be manually legalizing
them,
which it shouldn't have to do.
Dan
From dpatel at apple.com Mon Aug 10 17:09:58 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 10 Aug 2009 22:09:58 -0000
Subject: [llvm-commits] [llvm] r78602 - in /llvm/trunk:
include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp
Message-ID: <200908102209.n7AM9wax014795@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Aug 10 17:09:58 2009
New Revision: 78602
URL: http://llvm.org/viewvc/llvm-project?rev=78602&view=rev
Log:
Keep track of DIType.
Modified:
llvm/trunk/include/llvm/Analysis/DebugInfo.h
llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=78602&r1=78601&r2=78602&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 10 17:09:58 2009
@@ -643,6 +643,9 @@
// addSubprogram - Add subprgoram into SPs.
bool addSubprogram(DISubprogram SP);
+ /// addType - Add type into Tys.
+ bool addType(DIType DT);
+
public:
typedef SmallVector::iterator iterator;
iterator compile_unit_begin() { return CUs.begin(); }
@@ -651,15 +654,19 @@
iterator subprogram_end() { return SPs.end(); }
iterator global_variable_begin() { return GVs.begin(); }
iterator global_variable_end() { return GVs.end(); }
+ iterator type_begin() { return TYs.begin(); }
+ iterator type_end() { return TYs.end(); }
unsigned compile_unit_count() { return CUs.size(); }
unsigned global_variable_count() { return GVs.size(); }
unsigned subprogram_count() { return SPs.size(); }
+ unsigned type_count() { return TYs.size(); }
private:
SmallVector CUs; // Compile Units
SmallVector SPs; // Subprograms
- SmallVector GVs; // Global Variables;
+ SmallVector GVs; // Global Variables
+ SmallVector TYs; // Types
SmallPtrSet NodesSeen;
};
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=78602&r1=78601&r2=78602&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 10 17:09:58 2009
@@ -955,9 +955,7 @@
/// processType - Process DIType.
void DebugInfoFinder::processType(DIType DT) {
- if (DT.isNull())
- return;
- if (!NodesSeen.insert(DT.getGV()))
+ if (!addType(DT))
return;
addCompileUnit(DT.getCompileUnit());
@@ -1028,6 +1026,18 @@
processType(DV.getType());
}
+/// addType - Add type into Tys.
+bool DebugInfoFinder::addType(DIType DT) {
+ if (DT.isNull())
+ return false;
+
+ if (!NodesSeen.insert(DT.getGV()))
+ return false;
+
+ TYs.push_back(DT.getGV());
+ return true;
+}
+
/// addCompileUnit - Add compile unit into CUs.
bool DebugInfoFinder::addCompileUnit(DICompileUnit CU) {
if (CU.isNull())
From dpatel at apple.com Mon Aug 10 17:11:20 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 10 Aug 2009 22:11:20 -0000
Subject: [llvm-commits] [llvm] r78603 - in /llvm/trunk/lib/Target/PIC16:
PIC16DebugInfo.cpp PIC16DebugInfo.h
Message-ID: <200908102211.n7AMBKIQ014998@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Aug 10 17:11:20 2009
New Revision: 78603
URL: http://llvm.org/viewvc/llvm-project?rev=78603&view=rev
Log:
Do not rely on magic "llvm.dbg.*" global variable name to find debug info.
PIC16 developers, please verify.
Modified:
llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp
llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h
Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=78603&r1=78602&r2=78603&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Mon Aug 10 17:11:20 2009
@@ -17,6 +17,7 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/FormattedStream.h"
+#include "llvm/ADT/SmallString.h"
using namespace llvm;
@@ -117,6 +118,8 @@
CTy.getName(TagName);
// UniqueSuffix is .number where number is obtained from
// llvm.dbg.composite.
+ // FIXME: This will break when composite type is not represented by
+ // llvm.dbg.composite* global variable. This is not supported.
std::string UniqueSuffix = "." + Ty.getGV()->getNameStr().substr(18);
TagName += UniqueSuffix;
unsigned short size = CTy.getSizeInBits()/8;
@@ -290,7 +293,7 @@
/// composite type.
///
void PIC16DbgInfo::EmitCompositeTypeElements (DICompositeType CTy,
- std::string UniqueSuffix) {
+ unsigned SuffixNo) {
unsigned long Value = 0;
DIArray Elements = CTy.getTypeArray();
for (unsigned i = 0, N = Elements.getNumElements(); i < N; i++) {
@@ -305,18 +308,19 @@
DITy.getName(ElementName);
unsigned short ElementSize = DITy.getSizeInBits()/8;
// Get mangleddd name for this structure/union element.
- std::string MangMemName = ElementName + UniqueSuffix;
+ SmallString<128> MangMemName(ElementName.begin(), ElementName.end());
+ MangMemName.append_uint_32(SuffixNo);
PopulateDebugInfo(DITy, TypeNo, HasAux, ElementAux, TagName);
short Class = 0;
if( CTy.getTag() == dwarf::DW_TAG_union_type)
Class = PIC16Dbg::C_MOU;
else if (CTy.getTag() == dwarf::DW_TAG_structure_type)
Class = PIC16Dbg::C_MOS;
- EmitSymbol(MangMemName, Class, TypeNo, Value);
+ EmitSymbol(MangMemName.c_str(), Class, TypeNo, Value);
if (CTy.getTag() == dwarf::DW_TAG_structure_type)
Value += ElementSize;
if (HasAux)
- EmitAuxEntry(MangMemName, ElementAux, PIC16Dbg::AuxSize, TagName);
+ EmitAuxEntry(MangMemName.c_str(), ElementAux, PIC16Dbg::AuxSize, TagName);
}
}
@@ -324,49 +328,49 @@
/// and union declarations.
///
void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) {
- for(iplist::iterator I = M.getGlobalList().begin(),
- E = M.getGlobalList().end(); I != E; I++) {
- // Structures and union declaration's debug info has llvm.dbg.composite
- // in its name.
- // FIXME: Checking and relying on llvm.dbg.composite name is not a good idea.
- if(I->getNameStr().find("llvm.dbg.composite") != std::string::npos) {
- GlobalVariable *GV = cast(I);
- DICompositeType CTy(GV);
- if (CTy.getTag() == dwarf::DW_TAG_union_type ||
- CTy.getTag() == dwarf::DW_TAG_structure_type ) {
- std::string name;
- CTy.getName(name);
- std::string DIVar = I->getName();
- // Get the number after llvm.dbg.composite and make UniqueSuffix from
- // it.
- std::string UniqueSuffix = "." + DIVar.substr(18);
- std::string MangledCTyName = name + UniqueSuffix;
- unsigned short size = CTy.getSizeInBits()/8;
- int Aux[PIC16Dbg::AuxSize] = {0};
- // 7th and 8th byte represent size of structure/union.
- Aux[6] = size & 0xff;
- Aux[7] = size >> 8;
- // Emit .def for structure/union tag.
- if( CTy.getTag() == dwarf::DW_TAG_union_type)
- EmitSymbol(MangledCTyName, PIC16Dbg::C_UNTAG);
- else if (CTy.getTag() == dwarf::DW_TAG_structure_type)
- EmitSymbol(MangledCTyName, PIC16Dbg::C_STRTAG);
-
- // Emit auxiliary debug information for structure/union tag.
- EmitAuxEntry(MangledCTyName, Aux, PIC16Dbg::AuxSize);
-
- // Emit members.
- EmitCompositeTypeElements (CTy, UniqueSuffix);
-
- // Emit mangled Symbol for end of structure/union.
- std::string EOSSymbol = ".eos" + UniqueSuffix;
- EmitSymbol(EOSSymbol, PIC16Dbg::C_EOS);
- EmitAuxEntry(EOSSymbol, Aux, PIC16Dbg::AuxSize, MangledCTyName);
- }
+ DebugInfoFinder DbgFinder;
+ DbgFinder.processModule(M);
+ unsigned SuffixNo = 0;
+ for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(),
+ E = DbgFinder.global_variable_end(); I != E; ++I) {
+ DICompositeType CTy(*I);
+ if (CTy.isNull())
+ continue;
+ if (CTy.getTag() == dwarf::DW_TAG_union_type ||
+ CTy.getTag() == dwarf::DW_TAG_structure_type ) {
+ std::string Name;
+ CTy.getName(Name);
+ SmallString<128> MangledCTyName(Name.begin(), Name.end());
+ MangledCTyName.append_uint_32(++SuffixNo);
+ unsigned short size = CTy.getSizeInBits()/8;
+ int Aux[PIC16Dbg::AuxSize] = {0};
+ // 7th and 8th byte represent size of structure/union.
+ Aux[6] = size & 0xff;
+ Aux[7] = size >> 8;
+ // Emit .def for structure/union tag.
+ if( CTy.getTag() == dwarf::DW_TAG_union_type)
+ EmitSymbol(MangledCTyName.c_str(), PIC16Dbg::C_UNTAG);
+ else if (CTy.getTag() == dwarf::DW_TAG_structure_type)
+ EmitSymbol(MangledCTyName.c_str(), PIC16Dbg::C_STRTAG);
+
+ // Emit auxiliary debug information for structure/union tag.
+ EmitAuxEntry(MangledCTyName.c_str(), Aux, PIC16Dbg::AuxSize);
+
+ // Emit members.
+ EmitCompositeTypeElements (CTy, SuffixNo);
+
+ // Emit mangled Symbol for end of structure/union.
+ SmallString<128> EOSSymbol(Name.begin(), Name.end());
+ EOSSymbol += ".eos";
+ EOSSymbol.append_uint_32(SuffixNo);
+ EmitSymbol(EOSSymbol.c_str(), PIC16Dbg::C_EOS);
+ EmitAuxEntry(EOSSymbol.c_str(), Aux, PIC16Dbg::AuxSize,
+ MangledCTyName.c_str());
}
}
}
+
/// EmitFunctBeginDI - Emit .bf for function.
///
void PIC16DbgInfo::EmitFunctBeginDI(const Function *F) {
Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h?rev=78603&r1=78602&r2=78603&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h Mon Aug 10 17:11:20 2009
@@ -145,8 +145,7 @@
short getStorageClass(DIGlobalVariable DIGV);
void EmitFunctBeginDI(const Function *F);
void EmitCompositeTypeDecls(Module &M);
- void EmitCompositeTypeElements (DICompositeType CTy,
- std::string UniqueSuffix);
+ void EmitCompositeTypeElements (DICompositeType CTy, unsigned Suffix);
void EmitFunctEndDI(const Function *F, unsigned Line);
void EmitAuxEntry(const std::string VarName, int Aux[],
int num = PIC16Dbg::AuxSize, std::string TagName = "");
From david_goodwin at apple.com Mon Aug 10 17:17:39 2009
From: david_goodwin at apple.com (David Goodwin)
Date: Mon, 10 Aug 2009 22:17:39 -0000
Subject: [llvm-commits] [llvm] r78604 - in /llvm/trunk:
lib/Target/ARM/ARMInstrFormats.td lib/Target/ARM/ARMInstrNEON.td
lib/Target/ARM/ARMInstrVFP.td test/CodeGen/ARM/fsitos.ll
test/CodeGen/ARM/ftosizs.ll test/CodeGen/ARM/ftouizs.ll
test/CodeGen/ARM/fuitos.ll
Message-ID: <200908102217.n7AMHdfM015866@zion.cs.uiuc.edu>
Author: david_goodwin
Date: Mon Aug 10 17:17:39 2009
New Revision: 78604
URL: http://llvm.org/viewvc/llvm-project?rev=78604&view=rev
Log:
Use NEON for single-precision int<->FP conversions.
Added:
llvm/trunk/test/CodeGen/ARM/fsitos.ll
llvm/trunk/test/CodeGen/ARM/ftosizs.ll
llvm/trunk/test/CodeGen/ARM/ftouizs.ll
llvm/trunk/test/CodeGen/ARM/fuitos.ll
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=78604&r1=78603&r2=78604&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Aug 10 17:17:39 2009
@@ -1118,7 +1118,7 @@
let Inst{7-4} = opcod3;
}
-// Single precision, unary if no NEON
+// Single precision unary, if no NEON
// Same as ASuI except not available if NEON is enabled
class ASuIn opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
InstrItinClass itin, string opc, string asm, list pattern>
@@ -1135,7 +1135,7 @@
let Inst{11-8} = 0b1010;
}
-// Single precision, binary if no NEON
+// Single precision binary, if no NEON
// Same as ASbI except not available if NEON is enabled
class ASbIn opcod, dag oops, dag iops, InstrItinClass itin,
string opc, string asm, list pattern>
@@ -1154,6 +1154,14 @@
let Inst{6} = 1;
}
+// VFP conversion instructions, if no NEON
+class AVConv1In opcod1, bits<4> opcod2, bits<4> opcod3,
+ dag oops, dag iops, InstrItinClass itin,
+ string opc, string asm, list pattern>
+ : AVConv1I {
+ list Predicates = [HasVFP2,DontUseNEONForFP];
+}
+
class AVConvXI opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
InstrItinClass itin,
string opc, string asm, list pattern>
Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=78604&r1=78603&r2=78604&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Aug 10 17:17:39 2009
@@ -324,6 +324,20 @@
(ins QPR:$src), NoItinerary, !strconcat(OpcodeStr, "\t$dst, $src"), "",
[(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
+// Basic 2-register operations, scalar single-precision.
+class N2VDs op24_23, bits<2> op21_20, bits<2> op19_18,
+ bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
+ ValueType ResTy, ValueType OpTy, SDNode OpNode>
+ : N2V;
+
+class N2VDsPat
+ : NEONFPPat<(ResTy (OpNode SPR:$a)),
+ (EXTRACT_SUBREG
+ (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
+ arm_ssubreg_0)>;
+
// Basic 2-register intrinsics, both double- and quad-register.
class N2VDInt op24_23, bits<2> op21_20, bits<2> op19_18,
bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
@@ -338,7 +352,7 @@
(ins QPR:$src), NoItinerary, !strconcat(OpcodeStr, "\t$dst, $src"), "",
[(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
-// Basic 2-register operations, scalar single-precision
+// Basic 2-register intrinsics, scalar single-precision
class N2VDInts op24_23, bits<2> op21_20, bits<2> op19_18,
bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
@@ -1981,6 +1995,11 @@
def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
def : N3VDsPat;
+// Vector Sub Operations used for single-precision FP
+let neverHasSideEffects = 1 in
+def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
+def : N3VDsPat;
+
// Vector Multiply Operations used for single-precision FP
let neverHasSideEffects = 1 in
def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
@@ -1989,31 +2008,46 @@
// Vector Multiply-Accumulate/Subtract used for single-precision FP
let neverHasSideEffects = 1 in
def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, "vmla.f32", v2f32,fmul,fadd>;
-def : N3VDMulOpsPat;
+def : N3VDMulOpsPat;
let neverHasSideEffects = 1 in
def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, "vmls.f32", v2f32,fmul,fsub>;
-def : N3VDMulOpsPat;
-
-// Vector Sub Operations used for single-precision FP
-let neverHasSideEffects = 1 in
-def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
-def : N3VDsPat;
+def : N3VDMulOpsPat;
-// Vector Absolute for single-precision FP
+// Vector Absolute used for single-precision FP
let neverHasSideEffects = 1 in
def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0, "vabs.f32",
v2f32, v2f32, int_arm_neon_vabsf>;
def : N2VDIntsPat;
-// Vector Negate for single-precision FP
-
+// Vector Negate used for single-precision FP
let neverHasSideEffects = 1 in
def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
- (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), NoItinerary,
- "vneg.f32\t$dst, $src", "", []>;
+ (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), NoItinerary,
+ "vneg.f32\t$dst, $src", "", []>;
def : N2VDIntsPat;
+// Vector Convert between single-precision FP and integer
+let neverHasSideEffects = 1 in
+def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
+ v2i32, v2f32, fp_to_sint>;
+def : N2VDsPat;
+
+let neverHasSideEffects = 1 in
+def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
+ v2i32, v2f32, fp_to_uint>;
+def : N2VDsPat;
+
+let neverHasSideEffects = 1 in
+def VCVTs2fd_sfp : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
+ v2f32, v2i32, sint_to_fp>;
+def : N2VDsPat;
+
+let neverHasSideEffects = 1 in
+def VCVTu2fd_sfp : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
+ v2f32, v2i32, uint_to_fp>;
+def : N2VDsPat;
+
//===----------------------------------------------------------------------===//
// Non-Instruction Patterns
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=78604&r1=78603&r2=78604&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Mon Aug 10 17:17:39 2009
@@ -263,7 +263,7 @@
let Inst{7} = 1;
}
-def FSITOS : AVConv1I<0b11101011, 0b1000, 0b1010, (outs SPR:$dst), (ins SPR:$a),
+def FSITOS : AVConv1In<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),(ins SPR:$a),
IIC_fpALU, "fsitos", " $dst, $a",
[(set SPR:$dst, (arm_sitof SPR:$a))]> {
let Inst{7} = 1;
@@ -273,7 +273,7 @@
IIC_fpALU, "fuitod", " $dst, $a",
[(set DPR:$dst, (arm_uitof SPR:$a))]>;
-def FUITOS : AVConv1I<0b11101011, 0b1000, 0b1010, (outs SPR:$dst), (ins SPR:$a),
+def FUITOS : AVConv1In<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),(ins SPR:$a),
IIC_fpALU, "fuitos", " $dst, $a",
[(set SPR:$dst, (arm_uitof SPR:$a))]>;
@@ -287,8 +287,8 @@
let Inst{7} = 1; // Z bit
}
-def FTOSIZS : AVConv1I<0b11101011, 0b1101, 0b1010,
- (outs SPR:$dst), (ins SPR:$a),
+def FTOSIZS : AVConv1In<0b11101011, 0b1101, 0b1010,
+ (outs SPR:$dst), (ins SPR:$a),
IIC_fpALU, "ftosizs", " $dst, $a",
[(set SPR:$dst, (arm_ftosi SPR:$a))]> {
let Inst{7} = 1; // Z bit
@@ -301,8 +301,8 @@
let Inst{7} = 1; // Z bit
}
-def FTOUIZS : AVConv1I<0b11101011, 0b1100, 0b1010,
- (outs SPR:$dst), (ins SPR:$a),
+def FTOUIZS : AVConv1In<0b11101011, 0b1100, 0b1010,
+ (outs SPR:$dst), (ins SPR:$a),
IIC_fpALU, "ftouizs", " $dst, $a",
[(set SPR:$dst, (arm_ftoui SPR:$a))]> {
let Inst{7} = 1; // Z bit
Added: llvm/trunk/test/CodeGen/ARM/fsitos.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fsitos.ll?rev=78604&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fsitos.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/fsitos.ll Mon Aug 10 17:17:39 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {fsitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E {vcvt.f32.s32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E {fsitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E {vcvt.f32.s32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E {fsitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+
+define float @test(i32 %a, i32 %b) {
+entry:
+ %0 = add i32 %a, %b
+ %1 = sitofp i32 %0 to float
+ ret float %1
+}
Added: llvm/trunk/test/CodeGen/ARM/ftosizs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ftosizs.ll?rev=78604&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ftosizs.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/ftosizs.ll Mon Aug 10 17:17:39 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {ftosizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E {vcvt.s32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E {ftosizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E {vcvt.s32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E {ftosizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+
+define i32 @test(float %a, float %b) {
+entry:
+ %0 = fadd float %a, %b
+ %1 = fptosi float %0 to i32
+ ret i32 %1
+}
Added: llvm/trunk/test/CodeGen/ARM/ftouizs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ftouizs.ll?rev=78604&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ftouizs.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/ftouizs.ll Mon Aug 10 17:17:39 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {ftouizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E {vcvt.u32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E {ftouizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E {vcvt.u32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E {ftouizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+
+define i32 @test(float %a, float %b) {
+entry:
+ %0 = fadd float %a, %b
+ %1 = fptoui float %0 to i32
+ ret i32 %1
+}
Added: llvm/trunk/test/CodeGen/ARM/fuitos.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fuitos.ll?rev=78604&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fuitos.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/fuitos.ll Mon Aug 10 17:17:39 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {fuitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E {vcvt.f32.u32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E {fuitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E {vcvt.f32.u32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
+; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E {fuitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
+
+define float @test(i32 %a, i32 %b) {
+entry:
+ %0 = add i32 %a, %b
+ %1 = uitofp i32 %0 to float
+ ret float %1
+}
From dpatel at apple.com Mon Aug 10 17:20:38 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 10 Aug 2009 22:20:38 -0000
Subject: [llvm-commits] [llvm] r78605 - /llvm/trunk/include/llvm/Module.h
Message-ID: <200908102220.n7AMKcGk016307@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Aug 10 17:20:38 2009
New Revision: 78605
URL: http://llvm.org/viewvc/llvm-project?rev=78605&view=rev
Log:
Align comments.
Modified:
llvm/trunk/include/llvm/Module.h
Modified: llvm/trunk/include/llvm/Module.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=78605&r1=78604&r2=78605&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Module.h (original)
+++ llvm/trunk/include/llvm/Module.h Mon Aug 10 17:20:38 2009
@@ -132,7 +132,7 @@
/// @name Member Variables
/// @{
private:
- LLVMContext& Context; ///< The LLVMContext from which types and
+ LLVMContext& Context; ///< The LLVMContext from which types and
///< constants are allocated.
GlobalListType GlobalList; ///< The Global Variables in the module
FunctionListType FunctionList; ///< The Functions in the module
From evan.cheng at apple.com Mon Aug 10 17:28:30 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 15:28:30 -0700
Subject: [llvm-commits] [llvm] r78604 - in /llvm/trunk:
lib/Target/ARM/ARMInstrFormats.td
lib/Target/ARM/ARMInstrNEON.td lib/Target/ARM/ARMInstrVFP.td
test/CodeGen/ARM/fsitos.ll test/CodeGen/ARM/ftosizs.ll
test/CodeGen/ARM/ftouizs.ll test/CodeGen/ARM/fuitos.ll
In-Reply-To: <200908102217.n7AMHdfM015866@zion.cs.uiuc.edu>
References: <200908102217.n7AMHdfM015866@zion.cs.uiuc.edu>
Message-ID: <4429C8D5-C5B4-485D-83C7-B4AD572E3522@apple.com>
Thanks David. Can you convert the tests to FileCheck ones? I am
converting a lot of existing ones to FileCheck as I intend to turn on
32-bit to 16-bit shrinkage pass?
Evan
On Aug 10, 2009, at 3:17 PM, David Goodwin wrote:
> Author: david_goodwin
> Date: Mon Aug 10 17:17:39 2009
> New Revision: 78604
>
> URL: http://llvm.org/viewvc/llvm-project?rev=78604&view=rev
> Log:
> Use NEON for single-precision int<->FP conversions.
>
> Added:
> llvm/trunk/test/CodeGen/ARM/fsitos.ll
> llvm/trunk/test/CodeGen/ARM/ftosizs.ll
> llvm/trunk/test/CodeGen/ARM/ftouizs.ll
> llvm/trunk/test/CodeGen/ARM/fuitos.ll
> Modified:
> llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
> llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
> llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
>
> Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=78604&r1=78603&r2=78604&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Aug 10 17:17:39
> 2009
> @@ -1118,7 +1118,7 @@
> let Inst{7-4} = opcod3;
> }
>
> -// Single precision, unary if no NEON
> +// Single precision unary, if no NEON
> // Same as ASuI except not available if NEON is enabled
> class ASuIn opcod1, bits<4> opcod2, bits<4> opcod3, dag
> oops, dag iops,
> InstrItinClass itin, string opc, string asm,
> list pattern>
> @@ -1135,7 +1135,7 @@
> let Inst{11-8} = 0b1010;
> }
>
> -// Single precision, binary if no NEON
> +// Single precision binary, if no NEON
> // Same as ASbI except not available if NEON is enabled
> class ASbIn opcod, dag oops, dag iops, InstrItinClass itin,
> string opc, string asm, list pattern>
> @@ -1154,6 +1154,14 @@
> let Inst{6} = 1;
> }
>
> +// VFP conversion instructions, if no NEON
> +class AVConv1In opcod1, bits<4> opcod2, bits<4> opcod3,
> + dag oops, dag iops, InstrItinClass itin,
> + string opc, string asm, list pattern>
> + : AVConv1I pattern> {
> + list Predicates = [HasVFP2,DontUseNEONForFP];
> +}
> +
> class AVConvXI opcod1, bits<4> opcod2, dag oops, dag iops,
> Format f,
> InstrItinClass itin,
> string opc, string asm, list pattern>
>
> Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=78604&r1=78603&r2=78604&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Aug 10 17:17:39 2009
> @@ -324,6 +324,20 @@
> (ins QPR:$src), NoItinerary, !strconcat(OpcodeStr, "\t$dst,
> $src"), "",
> [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
>
> +// Basic 2-register operations, scalar single-precision.
> +class N2VDs op24_23, bits<2> op21_20, bits<2> op19_18,
> + bits<2> op17_16, bits<5> op11_7, bit op4, string
> OpcodeStr,
> + ValueType ResTy, ValueType OpTy, SDNode OpNode>
> + : N2V + (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
> + NoItinerary, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
> +
> +class N2VDsPat NeonI Inst>
> + : NEONFPPat<(ResTy (OpNode SPR:$a)),
> + (EXTRACT_SUBREG
> + (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a,
> arm_ssubreg_0)),
> + arm_ssubreg_0)>;
> +
> // Basic 2-register intrinsics, both double- and quad-register.
> class N2VDInt op24_23, bits<2> op21_20, bits<2> op19_18,
> bits<2> op17_16, bits<5> op11_7, bit op4, string
> OpcodeStr,
> @@ -338,7 +352,7 @@
> (ins QPR:$src), NoItinerary, !strconcat(OpcodeStr, "\t$dst,
> $src"), "",
> [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
>
> -// Basic 2-register operations, scalar single-precision
> +// Basic 2-register intrinsics, scalar single-precision
> class N2VDInts op24_23, bits<2> op21_20, bits<2> op19_18,
> bits<2> op17_16, bits<5> op11_7, bit op4, string
> OpcodeStr,
> ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
> @@ -1981,6 +1995,11 @@
> def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32,
> v2f32, fadd,1>;
> def : N3VDsPat;
>
> +// Vector Sub Operations used for single-precision FP
> +let neverHasSideEffects = 1 in
> +def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32,
> v2f32, fsub,0>;
> +def : N3VDsPat;
> +
> // Vector Multiply Operations used for single-precision FP
> let neverHasSideEffects = 1 in
> def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32,
> v2f32, fmul,1>;
> @@ -1989,31 +2008,46 @@
> // Vector Multiply-Accumulate/Subtract used for single-precision FP
> let neverHasSideEffects = 1 in
> def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, "vmla.f32",
> v2f32,fmul,fadd>;
> -def : N3VDMulOpsPat;
> +def : N3VDMulOpsPat;
>
> let neverHasSideEffects = 1 in
> def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, "vmls.f32",
> v2f32,fmul,fsub>;
> -def : N3VDMulOpsPat;
> -
> -// Vector Sub Operations used for single-precision FP
> -let neverHasSideEffects = 1 in
> -def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32,
> v2f32, fsub,0>;
> -def : N3VDsPat;
> +def : N3VDMulOpsPat;
>
> -// Vector Absolute for single-precision FP
> +// Vector Absolute used for single-precision FP
> let neverHasSideEffects = 1 in
> def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
> "vabs.f32",
> v2f32, v2f32, int_arm_neon_vabsf>;
> def : N2VDIntsPat;
>
> -// Vector Negate for single-precision FP
> -
> +// Vector Negate used for single-precision FP
> let neverHasSideEffects = 1 in
> def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
> - (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
> NoItinerary,
> - "vneg.f32\t$dst, $src", "", []>;
> + (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
> NoItinerary,
> + "vneg.f32\t$dst, $src", "", []>;
> def : N2VDIntsPat;
>
> +// Vector Convert between single-precision FP and integer
> +let neverHasSideEffects = 1 in
> +def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0,
> "vcvt.s32.f32",
> + v2i32, v2f32, fp_to_sint>;
> +def : N2VDsPat;
> +
> +let neverHasSideEffects = 1 in
> +def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0,
> "vcvt.u32.f32",
> + v2i32, v2f32, fp_to_uint>;
> +def : N2VDsPat;
> +
> +let neverHasSideEffects = 1 in
> +def VCVTs2fd_sfp : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0,
> "vcvt.f32.s32",
> + v2f32, v2i32, sint_to_fp>;
> +def : N2VDsPat;
> +
> +let neverHasSideEffects = 1 in
> +def VCVTu2fd_sfp : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0,
> "vcvt.f32.u32",
> + v2f32, v2i32, uint_to_fp>;
> +def : N2VDsPat;
> +
> //
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> // Non-Instruction Patterns
> //
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
>
> Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=78604&r1=78603&r2=78604&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Mon Aug 10 17:17:39 2009
> @@ -263,7 +263,7 @@
> let Inst{7} = 1;
> }
>
> -def FSITOS : AVConv1I<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),
> (ins SPR:$a),
> +def FSITOS : AVConv1In<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),
> (ins SPR:$a),
> IIC_fpALU, "fsitos", " $dst, $a",
> [(set SPR:$dst, (arm_sitof SPR:$a))]> {
> let Inst{7} = 1;
> @@ -273,7 +273,7 @@
> IIC_fpALU, "fuitod", " $dst, $a",
> [(set DPR:$dst, (arm_uitof SPR:$a))]>;
>
> -def FUITOS : AVConv1I<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),
> (ins SPR:$a),
> +def FUITOS : AVConv1In<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),
> (ins SPR:$a),
> IIC_fpALU, "fuitos", " $dst, $a",
> [(set SPR:$dst, (arm_uitof SPR:$a))]>;
>
> @@ -287,8 +287,8 @@
> let Inst{7} = 1; // Z bit
> }
>
> -def FTOSIZS : AVConv1I<0b11101011, 0b1101, 0b1010,
> - (outs SPR:$dst), (ins SPR:$a),
> +def FTOSIZS : AVConv1In<0b11101011, 0b1101, 0b1010,
> + (outs SPR:$dst), (ins SPR:$a),
> IIC_fpALU, "ftosizs", " $dst, $a",
> [(set SPR:$dst, (arm_ftosi SPR:$a))]> {
> let Inst{7} = 1; // Z bit
> @@ -301,8 +301,8 @@
> let Inst{7} = 1; // Z bit
> }
>
> -def FTOUIZS : AVConv1I<0b11101011, 0b1100, 0b1010,
> - (outs SPR:$dst), (ins SPR:$a),
> +def FTOUIZS : AVConv1In<0b11101011, 0b1100, 0b1010,
> + (outs SPR:$dst), (ins SPR:$a),
> IIC_fpALU, "ftouizs", " $dst, $a",
> [(set SPR:$dst, (arm_ftoui SPR:$a))]> {
> let Inst{7} = 1; // Z bit
>
> Added: llvm/trunk/test/CodeGen/ARM/fsitos.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fsitos.ll?rev=78604&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/test/CodeGen/ARM/fsitos.ll (added)
> +++ llvm/trunk/test/CodeGen/ARM/fsitos.ll Mon Aug 10 17:17:39 2009
> @@ -0,0 +1,12 @@
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {fsitos\
> \W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E
> {vcvt.f32.s32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E
> {fsitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E
> {vcvt.f32.s32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E
> {fsitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +
> +define float @test(i32 %a, i32 %b) {
> +entry:
> + %0 = add i32 %a, %b
> + %1 = sitofp i32 %0 to float
> + ret float %1
> +}
>
> Added: llvm/trunk/test/CodeGen/ARM/ftosizs.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ftosizs.ll?rev=78604&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/test/CodeGen/ARM/ftosizs.ll (added)
> +++ llvm/trunk/test/CodeGen/ARM/ftosizs.ll Mon Aug 10 17:17:39 2009
> @@ -0,0 +1,12 @@
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {ftosizs
> \\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E
> {vcvt.s32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E
> {ftosizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E
> {vcvt.s32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E
> {ftosizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +
> +define i32 @test(float %a, float %b) {
> +entry:
> + %0 = fadd float %a, %b
> + %1 = fptosi float %0 to i32
> + ret i32 %1
> +}
>
> Added: llvm/trunk/test/CodeGen/ARM/ftouizs.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ftouizs.ll?rev=78604&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/test/CodeGen/ARM/ftouizs.ll (added)
> +++ llvm/trunk/test/CodeGen/ARM/ftouizs.ll Mon Aug 10 17:17:39 2009
> @@ -0,0 +1,12 @@
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {ftouizs
> \\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E
> {vcvt.u32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E
> {ftouizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E
> {vcvt.u32.f32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E
> {ftouizs\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +
> +define i32 @test(float %a, float %b) {
> +entry:
> + %0 = fadd float %a, %b
> + %1 = fptoui float %0 to i32
> + ret i32 %1
> +}
>
> Added: llvm/trunk/test/CodeGen/ARM/fuitos.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fuitos.ll?rev=78604&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/test/CodeGen/ARM/fuitos.ll (added)
> +++ llvm/trunk/test/CodeGen/ARM/fuitos.ll Mon Aug 10 17:17:39 2009
> @@ -0,0 +1,12 @@
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep -E {fuitos\
> \W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,+neonfp | grep -E
> {vcvt.f32.u32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon,-neonfp | grep -E
> {fuitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a8 | grep -E
> {vcvt.f32.u32\\W*d\[0-9\]+,\\W*d\[0-9\]+} | count 1
> +; RUN: llvm-as < %s | llc -march=arm -mcpu=cortex-a9 | grep -E
> {fuitos\\W*s\[0-9\]+,\\W*s\[0-9\]+} | count 1
> +
> +define float @test(i32 %a, i32 %b) {
> +entry:
> + %0 = add i32 %a, %b
> + %1 = uitofp i32 %0 to float
> + ret float %1
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From evan.cheng at apple.com Mon Aug 10 17:29:25 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 10 Aug 2009 15:29:25 -0700
Subject: [llvm-commits] [llvm] r78594 - in /llvm/trunk:
lib/Target/ARM/ARMISelDAGToDAG.cpp test/CodeGen/Thumb2/2009-08-10-ISelBug.ll
In-Reply-To:
References: <200908102025.n7AKPx0U032705@zion.cs.uiuc.edu>