[llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp
Changes in directory llvm/utils/TableGen: SubtargetEmitter.cpp updated: 1.8 -> 1.9 --- Log message: Add some commentary. --- Diffs of the changes: (+121 -21) SubtargetEmitter.cpp | 142 +++ 1 files changed, 121 insertions(+), 21 deletions(-) Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.8 llvm/utils/TableGen/SubtargetEmitter.cpp:1.9 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.8Thu Oct 27 20:43:09 2005 +++ llvm/utils/TableGen/SubtargetEmitter.cppFri Oct 28 10:20:43 2005 @@ -24,30 +24,57 @@ // typedef std::vector RecordList; -struct RecordListIter { - std::vector::iterator RI; - std::vector::iterator E; - +// +// RecordListIter - Simplify iterating through a std::vector of records. +// +class RecordListIter { + std::vector::iterator RI; // Currect cursor + std::vector::iterator E; // End point + +public: + + // + // Ctor. + // RecordListIter(RecordList &RL) : RI(RL.begin()), E(RL.end()) {} + + // + // isMore - Return true if more records are available. + // bool isMore() const { return RI != E; } + // + // next - Return the next record or NULL if none. + // Record *next() { return isMore() ? *RI++ : NULL; } }; +// +// DefListIter - Simplify iterating through a field which is a list of records. +// struct DefListIter { - ListInit *List; - unsigned N; - unsigned i; - + ListInit *List; // List of DefInit + unsigned N; // Number of elements in list + unsigned i; // Current index in list + + // + // Ctor - Lookup field and get list and length. + // DefListIter(Record *R, const std::string &Name) : List(R->getValueAsListInit(Name)), N(List->getSize()), i(0) {} + // + // isMore - Return true if more records are available. + // bool isMore() const { return i < N; } + // + // next - Return the next record or NULL if none. + // Record *next() { if (isMore()) { if (DefInit *DI = dynamic_cast(List->getElement(i++))) { @@ -82,25 +109,31 @@ void SubtargetEmitter::Enumeration(std::ostream &OS, const char *ClassName, bool isBits) { + // Get all records of class and sort RecordList Defs = Records.getAllDerivedDefinitions(ClassName); sort(Defs.begin(), Defs.end(), LessRecord()); + // Track position if isBits int i = 0; + // Open enumeration OS << "enum {\n"; + // For each record RecordListIter DI(Defs); while (Record *R = DI.next()) { -std::string Instance = R->getName(); -OS << " " - << Instance; -if (isBits) { - OS << " = " - << " 1 << " << i++; -} +// Get and emit name +std::string Name = R->getName(); +OS << " " << Name; + +// If bit flags then emit expression (1 << i) +if (isBits) OS << " = " << " 1 << " << i++; + +// Depending on if more in the list, emit comma and new line OS << (DI.isMore() ? ",\n" : "\n"); } + // Close enumeration OS << "};\n"; } @@ -109,24 +142,33 @@ // line. // void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) { + // Gather and sort all the features RecordList Features = Records.getAllDerivedDefinitions("SubtargetFeature"); sort(Features.begin(), Features.end(), LessRecord()); + // Begin feature table OS << "// Sorted (by key) array of values for CPU features.\n" << "static llvm::SubtargetFeatureKV FeatureKV[] = {\n"; + + // For each feature RecordListIter FI(Features); while (Record *R = FI.next()) { std::string Instance = R->getName(); std::string Name = R->getValueAsString("Name"); std::string Desc = R->getValueAsString("Desc"); + +// Emit as { "feature", "decription", feactureEnum } OS << " { " << "\"" << Name << "\", " << "\"" << Desc << "\", " << Instance << (FI.isMore() ? " },\n" : " }\n"); } + + // End feature table OS << "};\n"; + // Emit size of table OS<<"\nenum {\n"; OS<<" FeatureKVSize = sizeof(FeatureKV)/sizeof(llvm::SubtargetFeatureKV)\n"; OS<<"};\n"; @@ -137,16 +179,21 @@ // line. // void SubtargetEmitter::CPUKeyValues(std::ostream &OS) { + // Gather and sort processor information RecordList Processors = Records.getAllDerivedDefinitions("Processor"); sort(Processors.begin(), Processors.end(), LessRecordFieldName()); + // Begin processor table OS << "// Sorted (by key) array of values for CPU subtype.\n" << "static const llvm::SubtargetFeatureKV SubTypeKV[] = {\n"; + + // For each processor RecordListIter PI(Processors); while (Record *R = PI.next()) { std::string Name = R->getValueAsString("Name"); DefListIter FI(R, "Features"); +// Emit as { "cpu", "description", f1 | f2 | ... fn }, OS << " { " << "\"" << Name << "\", " << "\"Select the " << Name << " p
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.398 -> 1.399 --- Log message: Fix a bit of backwards logic that broke exptree and smg2000 --- Diffs of the changes: (+1 -1) InstructionCombining.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.398 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.399 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.398 Thu Oct 27 12:13:11 2005 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Oct 28 11:27:35 2005 @@ -3862,7 +3862,7 @@ Amt = ConstantUInt::get(Type::UIntTy, Scale); if (ConstantUInt *CI = dyn_cast(NumElements)) Amt = ConstantExpr::getMul(CI, cast(Amt)); - else if (cast(Amt)->getValue() == 1) { + else if (Scale != 1) { Instruction *Tmp = BinaryOperator::createMul(Amt, NumElements, "tmp"); Amt = InsertNewInstBefore(Tmp, AI); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/NightlyTest.gnuplot NightlyTest.pl NightlyTestTemplate.html
Changes in directory llvm/utils: NightlyTest.gnuplot updated: 1.13 -> 1.14 NightlyTest.pl updated: 1.97 -> 1.98 NightlyTestTemplate.html updated: 1.41 -> 1.42 --- Log message: The nightly tester report doesn't report JIT code size anymore, remove it from the olden graph. --- Diffs of the changes: (+4 -50) NightlyTest.gnuplot | 38 -- NightlyTest.pl |8 +++- NightlyTestTemplate.html |8 +--- 3 files changed, 4 insertions(+), 50 deletions(-) Index: llvm/utils/NightlyTest.gnuplot diff -u llvm/utils/NightlyTest.gnuplot:1.13 llvm/utils/NightlyTest.gnuplot:1.14 --- llvm/utils/NightlyTest.gnuplot:1.13 Sun Oct 2 16:51:38 2005 +++ llvm/utils/NightlyTest.gnuplot Fri Oct 28 11:35:18 2005 @@ -185,44 +185,6 @@ with lines -##--- Machine code size - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -set output "running_Olden_machcode.png" -set ylabel "Program machine code size (bytes)" -plot "running_Olden_machcode.txt" u 1:2 t '' with lines, \ - "running_Olden_machcode.txt" u 1:2 t "bh" with lines, \ - "running_Olden_machcode.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_machcode.txt" u 1:4 t "mst" with lines, \ - "running_Olden_machcode.txt" u 1:5 t "power" with lines, \ - "running_Olden_machcode.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_machcode.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_machcode.txt" u 1:8 t "health" with lines, \ - "running_Olden_machcode.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_machcode.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_machcode.txt" u 1:11 t "voronoi" \ - with lines - -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_Olden_machcode_large.png" -plot "running_Olden_machcode.txt" u 1:2 t '' with lines, \ - "running_Olden_machcode.txt" u 1:2 t "bh" with lines, \ - "running_Olden_machcode.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_machcode.txt" u 1:4 t "mst" with lines, \ - "running_Olden_machcode.txt" u 1:5 t "power" with lines, \ - "running_Olden_machcode.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_machcode.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_machcode.txt" u 1:8 t "health" with lines, \ - "running_Olden_machcode.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_machcode.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_machcode.txt" u 1:11 t "voronoi" \ - with lines - - ##--- Bytecode size set size .75,.75 Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.97 llvm/utils/NightlyTest.pl:1.98 --- llvm/utils/NightlyTest.pl:1.97 Mon Jun 6 14:17:05 2005 +++ llvm/utils/NightlyTest.pl Fri Oct 28 11:35:18 2005 @@ -410,7 +410,8 @@ # if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; } - system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1"; + my $EXTRAFLAGS = "--enable-spec2000=/Volumes/ProjectsDisk/cvs/benchmarks/speccpu2000-llvm/benchspec/ --enable-povray=/Volumes/ProjectsDisk/cvs/benchmarks/povray31 --enable-namd=/Volumes/ProjectsDisk/cvs/benchmarks/namd"; + system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1"; if ( $VERBOSE ) { print "BUILD STAGE\n"; } # Build the entire tree, capturing the output into $BuildLog @@ -720,7 +721,6 @@ my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec; my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec; my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec; -my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec; $NATTime .= " " . FormatTime($rNATTime); $CBETime .= " " . FormatTime($rCBETime); @@ -728,7 +728,6 @@ $JITTime .= " " . FormatTime($rJITTime); $OptTime .= " $rOptTime"; $BytecodeSize .= " $rBytecodeSize"; -$MachCodeSize .= " $rMachCodeSize"; } # Now that we have all of the numbers we want, add them to the running totals @@ -739,7 +738,6 @@ AddRecord($JITTime, "running_Olden_jit_time.txt"); AddRecord($OptTime, "running_Olden_opt_time.txt"); AddRecord($BytecodeSize, "running_Olden_bytecode.txt"); - AddRecord($MachCodeSize, "running_Olden_machcode.txt"); system "gzip -f $OldenTestsLog"; } @@ -765,7 +763,7 @@ # Make sure we don't get errors running the nightly tester the first time # because of files that don't exist. Touch ('running_build_time.txt', 'running_Olden_llc_time.txt', - 'running_loc.txt', 'running_Olden_machcode.txt', + 'running_loc.txt', 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt', 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt', 'running_Olden_jit_time.txt'); Index: llvm/utils/NightlyTestTemplate.html diff -u llvm/utils/NightlyTestTemplate.html:1.41 llvm/utils/Night
[llvm-commits] CVS: llvm-test/Makefile.programs
Changes in directory llvm-test: Makefile.programs updated: 1.173 -> 1.174 --- Log message: track the ia64 DAG->DAG instruction selector as llcbeta. --- Diffs of the changes: (+4 -1) Makefile.programs |5 - 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.173 llvm-test/Makefile.programs:1.174 --- llvm-test/Makefile.programs:1.173 Mon Oct 10 11:47:59 2005 +++ llvm-test/Makefile.programs Fri Oct 28 12:52:23 2005 @@ -193,7 +193,10 @@ LLCBETAOPTION := -enable-alpha-FTOI -enable-lsr-for-alpha #-enable-alpha-intfpdiv endif -ifeq ($(ARCH),x86) +ifeq ($(ARCH),IA64) +LLCBETAOPTION := -enable-ia64-dag-isel +endif +1ifeq ($(ARCH),x86) LLCBETAOPTION := -enable-x86-fastcc endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/Makefile.programs
Changes in directory llvm-test: Makefile.programs updated: 1.174 -> 1.175 --- Log message: As usual, Duraid is trying to use subversive techniques to kill x86. --- Diffs of the changes: (+1 -1) Makefile.programs |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.174 llvm-test/Makefile.programs:1.175 --- llvm-test/Makefile.programs:1.174 Fri Oct 28 12:52:23 2005 +++ llvm-test/Makefile.programs Fri Oct 28 13:23:28 2005 @@ -196,7 +196,7 @@ ifeq ($(ARCH),IA64) LLCBETAOPTION := -enable-ia64-dag-isel endif -1ifeq ($(ARCH),x86) +ifeq ($(ARCH),x86) LLCBETAOPTION := -enable-x86-fastcc endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/IA64: IA64ISelDAGToDAG.cpp updated: 1.1 -> 1.2 --- Log message: These are autogenerated --- Diffs of the changes: (+0 -33) IA64ISelDAGToDAG.cpp | 33 - 1 files changed, 33 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp diff -u llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.1 llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.2 --- llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.1 Fri Oct 28 12:46:36 2005 +++ llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp Fri Oct 28 13:26:52 2005 @@ -313,39 +313,6 @@ CurDAG->getTargetFrameIndex(FI, MVT::i64)); } - case ISD::TokenFactor: { -SDOperand New; -if (N->getNumOperands() == 2) { - SDOperand Op0 = Select(N->getOperand(0)); - SDOperand Op1 = Select(N->getOperand(1)); - New = CurDAG->getNode(ISD::TokenFactor, MVT::Other, Op0, Op1); -} else { - std::vector Ops; - for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) -Ops.push_back(Select(N->getOperand(i))); - New = CurDAG->getNode(ISD::TokenFactor, MVT::Other, Ops); -} - -CodeGenMap[Op] = New; -return New; - } - case ISD::CopyFromReg: { -SDOperand Chain = Select(N->getOperand(0)); -if (Chain == N->getOperand(0)) return Op; // No change -SDOperand New = CurDAG->getCopyFromReg(Chain, - cast(N->getOperand(1))->getReg(), N->getValueType(0)); -return New.getValue(Op.ResNo); - } - case ISD::CopyToReg: { -SDOperand Chain = Select(N->getOperand(0)); -SDOperand Reg = N->getOperand(1); -SDOperand Val = Select(N->getOperand(2)); -SDOperand New = CurDAG->getNode(ISD::CopyToReg, MVT::Other, -Chain, Reg, Val); -CodeGenMap[Op] = New; -return New; - } - case ISD::GlobalAddress: { GlobalValue *GV = cast(N)->getGlobal(); SDOperand GA = CurDAG->getTargetGlobalAddress(GV, MVT::i64); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.100 -> 1.101 --- Log message: Do not globalize internal symbols --- Diffs of the changes: (+2 -1) PPCAsmPrinter.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.100 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.101 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.100 Tue Oct 18 11:51:22 2005 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri Oct 28 13:44:07 2005 @@ -390,7 +390,8 @@ // Print out labels for the function. O << "\t.text\n"; emitAlignment(4); - O << "\t.globl\t" << CurrentFnName << "\n"; + if (!MF.getFunction()->hasInternalLinkage()) +O << "\t.globl\t" << CurrentFnName << "\n"; O << CurrentFnName << ":\n"; // Print out code for the function. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/isunord.ll
Changes in directory llvm/test/Regression/CodeGen/Generic: isunord.ll added (r1.1) --- Log message: New testcase. Probably many targets don't support this, so they should probably add themselves as xfails until they do (at least for the release). --- Diffs of the changes: (+8 -0) isunord.ll |8 1 files changed, 8 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/isunord.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/isunord.ll:1.1 *** /dev/null Fri Oct 28 14:52:12 2005 --- llvm/test/Regression/CodeGen/Generic/isunord.ll Fri Oct 28 14:52:02 2005 *** *** 0 --- 1,8 + ; RUN: llvm-as < %s | llc + + declare bool %llvm.isunordered(double, double) + + bool %test(double %X, double %Y) { + %tmp27 = call bool %llvm.isunordered( double %X, double %Y) + ret bool %tmp27 + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/isunord.ll
Changes in directory llvm/test/Regression/CodeGen/Generic: isunord.ll updated: 1.1 -> 1.2 --- Log message: add the xfail lines --- Diffs of the changes: (+2 -0) isunord.ll |2 ++ 1 files changed, 2 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/isunord.ll diff -u llvm/test/Regression/CodeGen/Generic/isunord.ll:1.1 llvm/test/Regression/CodeGen/Generic/isunord.ll:1.2 --- llvm/test/Regression/CodeGen/Generic/isunord.ll:1.1 Fri Oct 28 14:52:02 2005 +++ llvm/test/Regression/CodeGen/Generic/isunord.ll Fri Oct 28 14:57:55 2005 @@ -1,4 +1,6 @@ ; RUN: llvm-as < %s | llc +; XFAIL: alpha|ia64|sparcv8 + declare bool %llvm.isunordered(double, double) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCInstrInfo.td
Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.122 -> 1.123 PPCInstrInfo.td updated: 1.137 -> 1.138 --- Log message: add support for branch on ordered/unordered. --- Diffs of the changes: (+21 -0) PPCISelDAGToDAG.cpp | 17 + PPCInstrInfo.td |4 2 files changed, 21 insertions(+) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.122 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.123 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.122 Tue Oct 25 16:03:41 2005 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Oct 28 15:32:44 2005 @@ -489,6 +489,15 @@ case ISD::SETGT: return PPC::BGT; case ISD::SETUGE: case ISD::SETGE: return PPC::BGE; + + case ISD::SETO: return PPC::BUN; + case ISD::SETUO: return PPC::BNU; + case ISD::SETOEQ: + case ISD::SETOGT: + case ISD::SETOGE: + case ISD::SETOLT: + case ISD::SETOLE: + case ISD::SETONE: assert(0 && "Unknown condition!"); abort(); } return 0; } @@ -509,6 +518,14 @@ case ISD::SETLE: Inv = true; return 1; case ISD::SETEQ: Inv = false; return 2; case ISD::SETNE: Inv = true; return 2; + case ISD::SETO: Inv = true; return 3; + case ISD::SETUO: Inv = false; return 3; + case ISD::SETOEQ: + case ISD::SETOGT: + case ISD::SETOGE: + case ISD::SETOLT: + case ISD::SETOLE: + case ISD::SETONE: assert(0 && "Unknown condition!"); abort(); } return 0; } Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.137 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.138 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.137 Tue Oct 25 16:03:41 2005 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Fri Oct 28 15:32:44 2005 @@ -204,6 +204,10 @@ "bgt $crS, $block", BrB>; def BNE : BForm<16, 0, 0, 4, 2, (ops CRRC:$crS, target:$block), "bne $crS, $block", BrB>; + def BUN : BForm<16, 0, 0, 12, 3, (ops CRRC:$crS, target:$block), + "bun $crS, $block", BrB>; + def BNU : BForm<16, 0, 0, 4, 3, (ops CRRC:$crS, target:$block), + "bnu $crS, $block", BrB>; } let isCall = 1, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.123 -> 1.124 --- Log message: add a hack to get code with ordered comparisons working. This hack is tracked as PR642: http://llvm.cs.uiuc.edu/PR642 --- Diffs of the changes: (+12 -12) PPCISelDAGToDAG.cpp | 24 1 files changed, 12 insertions(+), 12 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.123 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.124 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.123 Fri Oct 28 15:32:44 2005 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Oct 28 15:49:47 2005 @@ -479,25 +479,25 @@ static unsigned getBCCForSetCC(ISD::CondCode CC) { switch (CC) { default: assert(0 && "Unknown condition!"); abort(); + case ISD::SETOEQ:// FIXME: This is incorrect see PR642. case ISD::SETEQ: return PPC::BEQ; + case ISD::SETONE:// FIXME: This is incorrect see PR642. case ISD::SETNE: return PPC::BNE; + case ISD::SETOLT:// FIXME: This is incorrect see PR642. case ISD::SETULT: case ISD::SETLT: return PPC::BLT; + case ISD::SETOLE:// FIXME: This is incorrect see PR642. case ISD::SETULE: case ISD::SETLE: return PPC::BLE; + case ISD::SETOGT:// FIXME: This is incorrect see PR642. case ISD::SETUGT: case ISD::SETGT: return PPC::BGT; + case ISD::SETOGE:// FIXME: This is incorrect see PR642. case ISD::SETUGE: case ISD::SETGE: return PPC::BGE; case ISD::SETO: return PPC::BUN; case ISD::SETUO: return PPC::BNU; - case ISD::SETOEQ: - case ISD::SETOGT: - case ISD::SETOGE: - case ISD::SETOLT: - case ISD::SETOLE: - case ISD::SETONE: assert(0 && "Unknown condition!"); abort(); } return 0; } @@ -508,24 +508,24 @@ static unsigned getCRIdxForSetCC(ISD::CondCode CC, bool& Inv) { switch (CC) { default: assert(0 && "Unknown condition!"); abort(); + case ISD::SETOLT: // FIXME: This is incorrect see PR642. case ISD::SETULT: case ISD::SETLT: Inv = false; return 0; + case ISD::SETOGE: // FIXME: This is incorrect see PR642. case ISD::SETUGE: case ISD::SETGE: Inv = true; return 0; + case ISD::SETOGT: // FIXME: This is incorrect see PR642. case ISD::SETUGT: case ISD::SETGT: Inv = false; return 1; + case ISD::SETOLE: // FIXME: This is incorrect see PR642. case ISD::SETULE: case ISD::SETLE: Inv = true; return 1; + case ISD::SETOEQ: // FIXME: This is incorrect see PR642. case ISD::SETEQ: Inv = false; return 2; + case ISD::SETONE: // FIXME: This is incorrect see PR642. case ISD::SETNE: Inv = true; return 2; case ISD::SETO: Inv = true; return 3; case ISD::SETUO: Inv = false; return 3; - case ISD::SETOEQ: - case ISD::SETOGT: - case ISD::SETOGE: - case ISD::SETOLT: - case ISD::SETOLE: - case ISD::SETONE: assert(0 && "Unknown condition!"); abort(); } return 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/Record.h Record.cpp
Changes in directory llvm/utils/TableGen: Record.h updated: 1.52 -> 1.53 Record.cpp updated: 1.45 -> 1.46 --- Log message: Added method to return a vector of records for a ListInit of Def field. This simplifies using list of records. --- Diffs of the changes: (+25 -0) Record.cpp | 19 +++ Record.h |6 ++ 2 files changed, 25 insertions(+) Index: llvm/utils/TableGen/Record.h diff -u llvm/utils/TableGen/Record.h:1.52 llvm/utils/TableGen/Record.h:1.53 --- llvm/utils/TableGen/Record.h:1.52 Tue Sep 13 16:44:28 2005 +++ llvm/utils/TableGen/Record.hFri Oct 28 16:46:31 2005 @@ -1000,6 +1000,12 @@ /// ListInit *getValueAsListInit(const std::string &FieldName) const; + /// getValueAsListDef - This method looks up the specified field and returns + /// its value as a vector of records, throwing an exception if the field does + /// not exist or if the value is not the right type. + /// + std::vector getValueAsListDef(const std::string &FieldName) const; + /// getValueAsDef - This method looks up the specified field and returns its /// value as a Record, throwing an exception if the field does not exist or if /// the value is not the right type. Index: llvm/utils/TableGen/Record.cpp diff -u llvm/utils/TableGen/Record.cpp:1.45 llvm/utils/TableGen/Record.cpp:1.46 --- llvm/utils/TableGen/Record.cpp:1.45 Tue Sep 13 16:44:28 2005 +++ llvm/utils/TableGen/Record.cpp Fri Oct 28 16:46:31 2005 @@ -709,6 +709,25 @@ "' does not have a list initializer!"; } +/// getValueAsListDef - This method looks up the specified field and returns +/// its value as a vector of records, throwing an exception if the field does +/// not exist or if the value is not the right type. +/// +std::vector Record::getValueAsListDef(const std::string &FieldName) + const { + ListInit *List = getValueAsListInit(FieldName); + std::vector Defs; + for (unsigned i = 0; i < List->getSize(); i++) { +if (DefInit *DI = dynamic_cast(List->getElement(i))) { + Defs.push_back(DI->getDef()); +} else { + throw "Record `" + getName() + "', field `" + FieldName + +"' list is not entirely DefInit!"; +} + } + return Defs; +} + /// getValueAsInt - This method looks up the specified field and returns its /// value as an int, throwing an exception if the field does not exist or if /// the value is not the right type. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.h SubtargetEmitter.cpp
Changes in directory llvm/utils/TableGen: SubtargetEmitter.h updated: 1.4 -> 1.5 SubtargetEmitter.cpp updated: 1.9 -> 1.10 --- Log message: Removed Mr. Smith from the code. --- Diffs of the changes: (+144 -172) SubtargetEmitter.cpp | 296 +++ SubtargetEmitter.h | 20 +-- 2 files changed, 144 insertions(+), 172 deletions(-) Index: llvm/utils/TableGen/SubtargetEmitter.h diff -u llvm/utils/TableGen/SubtargetEmitter.h:1.4 llvm/utils/TableGen/SubtargetEmitter.h:1.5 --- llvm/utils/TableGen/SubtargetEmitter.h:1.4 Thu Oct 27 14:47:21 2005 +++ llvm/utils/TableGen/SubtargetEmitter.h Fri Oct 28 16:47:29 2005 @@ -23,13 +23,6 @@ namespace llvm { -// -// Convenience types. -// -typedef std::map IntMap; -typedef std::vector IntineraryList; -typedef std::vector ProcessorList; - class SubtargetEmitter : public TableGenBackend { RecordKeeper &Records; @@ -38,12 +31,15 @@ void Enumeration(std::ostream &OS, const char *ClassName, bool isBits); void FeatureKeyValues(std::ostream &OS); void CPUKeyValues(std::ostream &OS); - unsigned CollectAllItinClasses(IntMap &ItinClassesMap); + unsigned CollectAllItinClasses(std::map + &ItinClassesMap); void FormItineraryString(Record *ItinData, std::string &ItinString, - unsigned &N); - void EmitStageData(std::ostream &OS, unsigned N, - IntMap &ItinClassesMap, ProcessorList &ProcList); - void EmitProcessData(std::ostream &OS, ProcessorList &ProcList); + unsigned &NStages); + void EmitStageData(std::ostream &OS, unsigned NItinClasses, + std::map &ItinClassesMap, + std::vector > &ProcList); + void EmitProcessData(std::ostream &OS, + std::vector > &ProcList); void EmitData(std::ostream &OS); void ParseFeaturesFunction(std::ostream &OS); Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.9 llvm/utils/TableGen/SubtargetEmitter.cpp:1.10 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.9Fri Oct 28 10:20:43 2005 +++ llvm/utils/TableGen/SubtargetEmitter.cppFri Oct 28 16:47:29 2005 @@ -20,72 +20,6 @@ using namespace llvm; // -// Convenience types. -// -typedef std::vector RecordList; - -// -// RecordListIter - Simplify iterating through a std::vector of records. -// -class RecordListIter { - std::vector::iterator RI; // Currect cursor - std::vector::iterator E; // End point - -public: - - // - // Ctor. - // - RecordListIter(RecordList &RL) - : RI(RL.begin()), E(RL.end()) - {} - - - // - // isMore - Return true if more records are available. - // - bool isMore() const { return RI != E; } - - // - // next - Return the next record or NULL if none. - // - Record *next() { return isMore() ? *RI++ : NULL; } -}; - -// -// DefListIter - Simplify iterating through a field which is a list of records. -// -struct DefListIter { - ListInit *List; // List of DefInit - unsigned N; // Number of elements in list - unsigned i; // Current index in list - - // - // Ctor - Lookup field and get list and length. - // - DefListIter(Record *R, const std::string &Name) - : List(R->getValueAsListInit(Name)), N(List->getSize()), i(0) - {} - - // - // isMore - Return true if more records are available. - // - bool isMore() const { return i < N; } - - // - // next - Return the next record or NULL if none. - // - Record *next() { -if (isMore()) { - if (DefInit *DI = dynamic_cast(List->getElement(i++))) { -return DI->getDef(); - } -} -return NULL; - } -}; - -// // Record sort by name function. // struct LessRecord { @@ -110,27 +44,28 @@ const char *ClassName, bool isBits) { // Get all records of class and sort - RecordList Defs = Records.getAllDerivedDefinitions(ClassName); - sort(Defs.begin(), Defs.end(), LessRecord()); + std::vector DefList = Records.getAllDerivedDefinitions(ClassName); + sort(DefList.begin(), DefList.end(), LessRecord()); - // Track position if isBits - int i = 0; - // Open enumeration OS << "enum {\n"; // For each record - RecordListIter DI(Defs); - while (Record *R = DI.next()) { + for (unsigned i = 0, N = DefList.size(); i < N;) { +// Next record +Record *Def = DefList[i]; + // Get and emit name -std::string Name = R->getName(); +std::string Name = Def->getName(); OS << " " << Name; // If bit flags then emit expression (1 << i) -if (isBits) OS << " = " << " 1 << " << i++; +if (isBits) OS << " = " << " 1 << " << i; -// Depending on if more in the list, emit comma and new line -OS << (DI.isMore() ? ",\n" : "\n"); +// Depending on if more in the list emit comma +if (++i < N) O
[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.68 -> 1.69 --- Log message: Use the new interface Jim added --- Diffs of the changes: (+7 -15) DAGISelEmitter.cpp | 22 +++--- 1 files changed, 7 insertions(+), 15 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.68 llvm/utils/TableGen/DAGISelEmitter.cpp:1.69 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.68 Wed Oct 26 12:02:02 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Oct 28 17:43:25 2005 @@ -228,16 +228,14 @@ // Parse the properties. Properties = 0; - ListInit *LI = R->getValueAsListInit("Properties"); - for (unsigned i = 0, e = LI->getSize(); i != e; ++i) { -DefInit *DI = dynamic_cast(LI->getElement(i)); -assert(DI && "Properties list must be list of defs!"); -if (DI->getDef()->getName() == "SDNPCommutative") { + std::vector PropList = R->getValueAsListDef("Properties"); + for (unsigned i = 0, e = PropList.size(); i != e; ++i) { +if (PropList[i]->getName() == "SDNPCommutative") { Properties |= 1 << SDNPCommutative; -} else if (DI->getDef()->getName() == "SDNPAssociative") { +} else if (PropList[i]->getName() == "SDNPAssociative") { Properties |= 1 << SDNPAssociative; } else { - std::cerr << "Unknown SD Node property '" << DI->getDef()->getName() + std::cerr << "Unknown SD Node property '" << PropList[i]->getName() << "' on node '" << R->getName() << "'!\n"; exit(1); } @@ -245,14 +243,8 @@ // Parse the type constraints. - ListInit *Constraints = TypeProfile->getValueAsListInit("Constraints"); - for (unsigned i = 0, e = Constraints->getSize(); i != e; ++i) { -assert(dynamic_cast(Constraints->getElement(i)) && - "Constraints list should contain constraint definitions!"); -Record *Constraint = - static_cast(Constraints->getElement(i))->getDef(); -TypeConstraints.push_back(Constraint); - } + std::vector ConstList =TypeProfile->getValueAsListDef("Constraints"); + TypeConstraints.assign(ConstList.begin(), ConstList.end()); } //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp DAGISelEmitter.cpp Record.cpp Record.h SubtargetEmitter.cpp
Changes in directory llvm/utils/TableGen: CodeGenTarget.cpp updated: 1.40 -> 1.41 DAGISelEmitter.cpp updated: 1.69 -> 1.70 Record.cpp updated: 1.46 -> 1.47 Record.h updated: 1.53 -> 1.54 SubtargetEmitter.cpp updated: 1.10 -> 1.11 --- Log message: Rename Record::getValueAsListDef to getValueAsListOfDefs, to more accurately reflect what it is. Convert some more code over to use it. --- Diffs of the changes: (+24 -34) CodeGenTarget.cpp| 28 DAGISelEmitter.cpp |7 --- Record.cpp |6 +++--- Record.h |8 SubtargetEmitter.cpp |9 + 5 files changed, 24 insertions(+), 34 deletions(-) Index: llvm/utils/TableGen/CodeGenTarget.cpp diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.40 llvm/utils/TableGen/CodeGenTarget.cpp:1.41 --- llvm/utils/TableGen/CodeGenTarget.cpp:1.40 Thu Oct 13 22:54:49 2005 +++ llvm/utils/TableGen/CodeGenTarget.cpp Fri Oct 28 17:49:02 2005 @@ -84,15 +84,8 @@ throw std::string("ERROR: Multiple subclasses of Target defined!"); TargetRec = Targets[0]; - // Read in all of the CalleeSavedRegisters... - ListInit *LI = TargetRec->getValueAsListInit("CalleeSavedRegisters"); - for (unsigned i = 0, e = LI->getSize(); i != e; ++i) -if (DefInit *DI = dynamic_cast(LI->getElement(i))) - CalleeSavedRegisters.push_back(DI->getDef()); -else - throw "Target: " + TargetRec->getName() + -" expected register definition in CalleeSavedRegisters list!"; - + // Read in all of the CalleeSavedRegisters. + CalleeSavedRegisters =TargetRec->getValueAsListOfDefs("CalleeSavedRegisters"); PointerType = getValueType(TargetRec->getValueAsDef("PointerType")); } @@ -108,12 +101,10 @@ /// getAsmWriter - Return the AssemblyWriter definition for this target. /// Record *CodeGenTarget::getAsmWriter() const { - ListInit *LI = TargetRec->getValueAsListInit("AssemblyWriters"); - if (AsmWriterNum >= LI->getSize()) + std::vector LI = TargetRec->getValueAsListOfDefs("AssemblyWriters"); + if (AsmWriterNum >= LI.size()) throw "Target does not have an AsmWriter #" + utostr(AsmWriterNum) + "!"; - DefInit *DI = dynamic_cast(LI->getElement(AsmWriterNum)); - if (!DI) throw std::string("AssemblyWriter list should be a list of defs!"); - return DI->getDef(); + return LI[AsmWriterNum]; } void CodeGenTarget::ReadRegisters() const { @@ -159,12 +150,9 @@ MethodBodies = R->getValueAsCode("MethodBodies"); MethodProtos = R->getValueAsCode("MethodProtos"); - ListInit *RegList = R->getValueAsListInit("MemberList"); - for (unsigned i = 0, e = RegList->getSize(); i != e; ++i) { -DefInit *RegDef = dynamic_cast(RegList->getElement(i)); -if (!RegDef) throw "Register class member is not a record!"; -Record *Reg = RegDef->getDef(); - + std::vector RegList = R->getValueAsListOfDefs("MemberList"); + for (unsigned i = 0, e = RegList.size(); i != e; ++i) { +Record *Reg = RegList[i]; if (!Reg->isSubClassOf("Register")) throw "Register Class member '" + Reg->getName() + "' does not derive from the Register class!"; Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.69 llvm/utils/TableGen/DAGISelEmitter.cpp:1.70 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.69 Fri Oct 28 17:43:25 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Oct 28 17:49:02 2005 @@ -228,7 +228,7 @@ // Parse the properties. Properties = 0; - std::vector PropList = R->getValueAsListDef("Properties"); + std::vector PropList = R->getValueAsListOfDefs("Properties"); for (unsigned i = 0, e = PropList.size(); i != e; ++i) { if (PropList[i]->getName() == "SDNPCommutative") { Properties |= 1 << SDNPCommutative; @@ -243,8 +243,9 @@ // Parse the type constraints. - std::vector ConstList =TypeProfile->getValueAsListDef("Constraints"); - TypeConstraints.assign(ConstList.begin(), ConstList.end()); + std::vector ConstraintList = +TypeProfile->getValueAsListOfDefs("Constraints"); + TypeConstraints.assign(ConstraintList.begin(), ConstraintList.end()); } //===--===// Index: llvm/utils/TableGen/Record.cpp diff -u llvm/utils/TableGen/Record.cpp:1.46 llvm/utils/TableGen/Record.cpp:1.47 --- llvm/utils/TableGen/Record.cpp:1.46 Fri Oct 28 16:46:31 2005 +++ llvm/utils/TableGen/Record.cpp Fri Oct 28 17:49:02 2005 @@ -709,12 +709,12 @@ "' does not have a list initializer!"; } -/// getValueAsListDef - This method looks up the specified field and returns +/// getValueAsListOfDefs - This method looks up the specified field and returns /// its value as a vector of records, throwing an exception if the field does /// not exist or if the value is not the right type. /// -std::vector Record::getValueAsListDef(const std::string &FieldName) -
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.124 -> 1.125 --- Log message: Don't emit "32" for unordered comparison --- Diffs of the changes: (+4 -2) PPCISelDAGToDAG.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.124 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.125 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.124 Fri Oct 28 15:49:47 2005 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Oct 28 17:58:07 2005 @@ -722,11 +722,13 @@ if (!Inv) { CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, IntCR, - getI32Imm(32-(3-Idx)), getI32Imm(31), getI32Imm(31)); + getI32Imm((32-(3-Idx)) & 31), + getI32Imm(31), getI32Imm(31)); } else { SDOperand Tmp = CurDAG->getTargetNode(PPC::RLWINM, MVT::i32, IntCR, - getI32Imm(32-(3-Idx)), getI32Imm(31),getI32Imm(31)); + getI32Imm((32-(3-Idx)) & 31), + getI32Imm(31),getI32Imm(31)); CurDAG->SelectNodeTo(N, PPC::XORI, MVT::i32, Tmp, getI32Imm(1)); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/InstrInfoEmitter.cpp InstrInfoEmitter.h RegisterInfoEmitter.cpp
Changes in directory llvm/utils/TableGen: InstrInfoEmitter.cpp updated: 1.28 -> 1.29 InstrInfoEmitter.h updated: 1.10 -> 1.11 RegisterInfoEmitter.cpp updated: 1.36 -> 1.37 --- Log message: Switch more code over to using getValueAsListOfDefs. Look at all the -'s. :) --- Diffs of the changes: (+25 -41) InstrInfoEmitter.cpp| 45 +++-- InstrInfoEmitter.h |2 +- RegisterInfoEmitter.cpp | 19 +-- 3 files changed, 25 insertions(+), 41 deletions(-) Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.28 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.29 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.28 Fri Aug 26 15:42:52 2005 +++ llvm/utils/TableGen/InstrInfoEmitter.cppFri Oct 28 17:59:53 2005 @@ -47,16 +47,6 @@ OS << "} // End llvm namespace \n"; } -static std::vector GetDefList(ListInit *LI, const std::string &Name) { - std::vector Result; - for (unsigned i = 0, e = LI->getSize(); i != e; ++i) -if (DefInit *DI = dynamic_cast(LI->getElement(i))) - Result.push_back(DI->getDef()); -else - throw "Illegal value in '" + Name + "' list!"; - return Result; -} - void InstrInfoEmitter::printDefList(const std::vector &Uses, unsigned Num, std::ostream &OS) const { OS << "static const unsigned ImplicitList" << Num << "[] = { "; @@ -99,26 +89,21 @@ // Keep track of all of the def lists we have emitted already. std::map, unsigned> EmittedLists; - std::map ListNumbers; unsigned ListNumber = 0; // Emit all of the instruction's implicit uses and defs. for (CodeGenTarget::inst_iterator II = Target.inst_begin(), E = Target.inst_end(); II != E; ++II) { Record *Inst = II->second.TheDef; -ListInit *LI = Inst->getValueAsListInit("Uses"); -if (LI->getSize()) { - std::vector Uses = GetDefList(LI, Inst->getName()); +std::vector Uses = Inst->getValueAsListOfDefs("Uses"); +if (!Uses.empty()) { unsigned &IL = EmittedLists[Uses]; if (!IL) printDefList(Uses, IL = ++ListNumber, OS); - ListNumbers[LI] = IL; } -LI = Inst->getValueAsListInit("Defs"); -if (LI->getSize()) { - std::vector Uses = GetDefList(LI, Inst->getName()); - unsigned &IL = EmittedLists[Uses]; - if (!IL) printDefList(Uses, IL = ++ListNumber, OS); - ListNumbers[LI] = IL; +std::vector Defs = Inst->getValueAsListOfDefs("Defs"); +if (!Defs.empty()) { + unsigned &IL = EmittedLists[Defs]; + if (!IL) printDefList(Defs, IL = ++ListNumber, OS); } } @@ -150,14 +135,14 @@ // OS << "\nstatic const TargetInstrDescriptor " << TargetName << "Insts[] = {\n"; - emitRecord(Target.getPHIInstruction(), 0, InstrInfo, ListNumbers, + emitRecord(Target.getPHIInstruction(), 0, InstrInfo, EmittedLists, OperandInfosEmitted, OS); unsigned i = 0; for (CodeGenTarget::inst_iterator II = Target.inst_begin(), E = Target.inst_end(); II != E; ++II) if (II->second.TheDef != PHI) - emitRecord(II->second, ++i, InstrInfo, ListNumbers, + emitRecord(II->second, ++i, InstrInfo, EmittedLists, OperandInfosEmitted, OS); OS << "};\n"; OS << "} // End llvm namespace \n"; @@ -165,7 +150,7 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, Record *InstrInfo, - std::map &ListNumbers, + std::map, unsigned> &EmittedLists, std::map, unsigned> &OpInfo, std::ostream &OS) { int NumOperands; @@ -215,17 +200,17 @@ OS << ", "; // Emit the implicit uses and defs lists... - LI = Inst.TheDef->getValueAsListInit("Uses"); - if (!LI->getSize()) + std::vector UseList = Inst.TheDef->getValueAsListOfDefs("Uses"); + if (UseList.empty()) OS << "EmptyImpList, "; else -OS << "ImplicitList" << ListNumbers[LI] << ", "; +OS << "ImplicitList" << EmittedLists[UseList] << ", "; - LI = Inst.TheDef->getValueAsListInit("Defs"); - if (!LI->getSize()) + std::vector DefList = Inst.TheDef->getValueAsListOfDefs("Defs"); + if (DefList.empty()) OS << "EmptyImpList, "; else -OS << "ImplicitList" << ListNumbers[LI] << ", "; +OS << "ImplicitList" << EmittedLists[DefList] << ", "; // Emit the operand info. std::vector OperandInfo = GetOperandInfo(Inst); Index: llvm/utils/TableGen/InstrInfoEmitter.h diff -u llvm/utils/TableGen/InstrInfoEmitter.h:1.10 llvm/utils/TableGen/InstrInfoEmitter.h:1.11 --- llvm/utils/TableGen/InstrInfoEmitter.h:1.10 Fri Aug 19 13:46:26 2005 +++ llvm/utils/TableGen/InstrInfoEmitter.h Fri Oct 28 17:59:53 2005 @@ -41,7 +41,7 @@ std::ostream &OS) const; void emitRecord(const CodeGenInstruction &Inst, unsigned Num, Record *InstrI
[llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt
Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.35 -> 1.36 --- Log message: New case to handle someday --- Diffs of the changes: (+17 -0) README.txt | 17 + 1 files changed, 17 insertions(+) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.35 llvm/lib/Target/PowerPC/README.txt:1.36 --- llvm/lib/Target/PowerPC/README.txt:1.35 Thu Oct 27 19:20:45 2005 +++ llvm/lib/Target/PowerPC/README.txt Fri Oct 28 18:26:57 2005 @@ -217,5 +217,22 @@ stw r2, 0(r3) blr +===-=== +Compile +int foo(int a) { return a * -2 + 63; } + +to + +_foo: +slwi r0,r3,1 +subfic r3,r0,63 +blr + +instead of: + +_foo: +mulli r2,r3,-2 +addi r3,r2,63 +blr ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.399 -> 1.400 --- Log message: Remove a special case, allowing the general case to handle it. No functionality change. --- Diffs of the changes: (+37 -49) InstructionCombining.cpp | 86 --- 1 files changed, 37 insertions(+), 49 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.399 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.400 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.399 Fri Oct 28 11:27:35 2005 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Oct 28 22:19:53 2005 @@ -3814,59 +3814,47 @@ uint64_t CastElTySize = TD->getTypeSize(CastElTy); if (CastElTySize == 0 || AllocElTySize == 0) return 0; - // If the allocation is for an even multiple of the cast type size + // See if we can satisfy the modulus by pulling a scale out of the array + // size argument. + unsigned ArraySizeScale = 1; + Value *NumElements = AI.getOperand(0); + + if (ConstantUInt *CI = dyn_cast(NumElements)) { +ArraySizeScale = CI->getValue(); +NumElements = ConstantUInt::get(Type::UIntTy, 1); + } else if (ShiftInst *SI = dyn_cast(NumElements)) { +if (SI->getOpcode() == Instruction::Shl) + if (ConstantUInt *CUI = dyn_cast(SI->getOperand(1))) { +// This is a value scaled by '1 << the shift amt'. +NumElements = SI->getOperand(0); +ArraySizeScale = 1U << CUI->getValue(); + } + } else if (isa(NumElements) && + cast(NumElements)->getOpcode() == Instruction::Mul){ +BinaryOperator *BO = cast(NumElements); +if (ConstantUInt *Scale = dyn_cast(BO->getOperand(1))) { + // This value is scaled by 'Scale'. + NumElements = BO->getOperand(0); + ArraySizeScale = Scale->getValue(); +} + } + + // If we can now satisfy the modulus, by using a non-1 scale, we really can + // do the xform. + if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0) return 0; + + unsigned Scale = (AllocElTySize*ArraySizeScale)/CastElTySize; Value *Amt = 0; - if (AllocElTySize % CastElTySize == 0) { -Amt = ConstantUInt::get(Type::UIntTy, AllocElTySize/CastElTySize); -if (ConstantUInt *CI = dyn_cast(AI.getOperand(0))) + if (Scale == 1) { +Amt = NumElements; + } else { +Amt = ConstantUInt::get(Type::UIntTy, Scale); +if (ConstantUInt *CI = dyn_cast(NumElements)) Amt = ConstantExpr::getMul(CI, cast(Amt)); -else { - // Perform an explicit scale. - Instruction *Tmp = BinaryOperator::createMul(Amt, AI.getOperand(0),"tmp"); +else if (Scale != 1) { + Instruction *Tmp = BinaryOperator::createMul(Amt, NumElements, "tmp"); Amt = InsertNewInstBefore(Tmp, AI); } - } else { -// See if we can satisfy the modulus by pulling a scale out of the array -// size argument. -unsigned ArraySizeScale = 1; -Value *NumElements = AI.getOperand(0); - -if (ConstantUInt *CI = dyn_cast(NumElements)) { - ArraySizeScale = CI->getValue(); - NumElements = ConstantUInt::get(Type::UIntTy, 1); -} else if (ShiftInst *SI = dyn_cast(NumElements)) { - if (SI->getOpcode() == Instruction::Shl) -if (ConstantUInt *CUI = dyn_cast(SI->getOperand(1))) { - // This is a value scaled by '1 << the shift amt'. - NumElements = SI->getOperand(0); - ArraySizeScale = 1U << CUI->getValue(); -} -} else if (isa(NumElements) && - cast(NumElements)->getOpcode() == Instruction::Mul){ - BinaryOperator *BO = cast(NumElements); - if (ConstantUInt *Scale = dyn_cast(BO->getOperand(1))) { -// This value is scaled by 'Scale'. -NumElements = BO->getOperand(0); -ArraySizeScale = Scale->getValue(); - } -} - -// If we can now satisfy the modulus, by using a non-1 scale, we really can -// do the xform. -if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0) return 0; - -unsigned Scale = (AllocElTySize*ArraySizeScale)/CastElTySize; -if (Scale == 1) { - Amt = NumElements; -} else { - Amt = ConstantUInt::get(Type::UIntTy, Scale); - if (ConstantUInt *CI = dyn_cast(NumElements)) -Amt = ConstantExpr::getMul(CI, cast(Amt)); - else if (Scale != 1) { -Instruction *Tmp = BinaryOperator::createMul(Amt, NumElements, "tmp"); -Amt = InsertNewInstBefore(Tmp, AI); - } -} } std::string Name = AI.getName(); AI.setName(""); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/IA64/2005-10-29-shladd.ll
Changes in directory llvm/test/Regression/CodeGen/IA64: 2005-10-29-shladd.ll added (r1.1) --- Log message: test for the formation of shladd --- Diffs of the changes: (+11 -0) 2005-10-29-shladd.ll | 11 +++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CodeGen/IA64/2005-10-29-shladd.ll diff -c /dev/null llvm/test/Regression/CodeGen/IA64/2005-10-29-shladd.ll:1.1 *** /dev/null Fri Oct 28 23:07:00 2005 --- llvm/test/Regression/CodeGen/IA64/2005-10-29-shladd.ll Fri Oct 28 23:06:50 2005 *** *** 0 --- 1,11 + ; this should turn into shladd + ; RUN: llvm-as < %s | llc -march=ia64 | grep 'shladd' + + implementation ; Functions: + + long %bogglesmoggle(long %X, long %Y) { + %A = shl long %X, ubyte 3 + %B = add long %A, %Y + ret long %B + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/IA64/IA64InstrInfo.td
Changes in directory llvm/lib/Target/IA64: IA64InstrInfo.td updated: 1.16 -> 1.17 --- Log message: add shladd --- Diffs of the changes: (+42 -42) IA64InstrInfo.td | 84 +++ 1 files changed, 42 insertions(+), 42 deletions(-) Index: llvm/lib/Target/IA64/IA64InstrInfo.td diff -u llvm/lib/Target/IA64/IA64InstrInfo.td:1.16 llvm/lib/Target/IA64/IA64InstrInfo.td:1.17 --- llvm/lib/Target/IA64/IA64InstrInfo.td:1.16 Fri Oct 28 12:46:36 2005 +++ llvm/lib/Target/IA64/IA64InstrInfo.td Fri Oct 28 23:13:40 2005 @@ -15,6 +15,7 @@ include "IA64InstrFormats.td" +def u2imm : Operand; def u6imm : Operand; def s8imm : Operand { let PrintMethod = "printS8ImmOperand"; @@ -41,6 +42,21 @@ /* new daggy action!!! */ +def is32ones : PatLeaf<(i64 imm), [{ + // is32ones predicate - True if the immediate is 0x + // Used to create ZXT4s appropriately + int64_t v = (int64_t)N->getValue(); + return (v == 0xLL); +}]>; + +def isSHLADDimm: PatLeaf<(i64 imm), [{ + // isSHLADDimm predicate - True if the immediate is exactly 1, 2, 3 or 4 + // - 0 is *not* okay. + // Used to create shladd instructions appropriately + int64_t v = (int64_t)N->getValue(); + return (v >= 1 && v <= 4); +}]>; + def immSExt14 : PatLeaf<(i64 imm), [{ // immSExt14 predicate - True if the immediate fits in a 14-bit sign extended // field. Used by instructions like 'adds'. @@ -54,6 +70,19 @@ return true; }]>; +def SXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src;;", + [(set GR:$dst, (sext_inreg GR:$src, i8))]>; +def ZXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt1 $dst = $src;;", + [(set GR:$dst, (and GR:$src, 255))]>; +def SXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt2 $dst = $src;;", + [(set GR:$dst, (sext_inreg GR:$src, i16))]>; +def ZXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt2 $dst = $src;;", + [(set GR:$dst, (and GR:$src, 65535))]>; +def SXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt4 $dst = $src;;", + [(set GR:$dst, (sext_inreg GR:$src, i32))]>; +def ZXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt4 $dst = $src;;", + [(set GR:$dst, (and GR:$src, is32ones))]>; + def ADD : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2), "add $dst = $src1, $src2;;", [(set GR:$dst, (add GR:$src1, GR:$src2))]>; @@ -107,6 +136,7 @@ // load constants of various sizes // FIXME: prettyprint -ve constants def : Pat<(i64 immSExt14:$imm), (ADDS r0, immSExt14:$imm)>; def : Pat<(i64 imm64:$imm), (MOVL imm64:$imm)>; +// TODO: def : Pat<(i1 1), (MOV p0)>; def AND : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2), "and $dst = $src1, $src2;;", @@ -159,10 +189,22 @@ "xor $dst = $src1, $src2;;", [(set GR:$dst, (xor GR:$src1, GR:$src2))]>; +def SHLADD: AForm_DAG<0x03, 0x0b, (ops GR:$dst,GR:$src1,s64imm:$imm,GR:$src2), + "shladd $dst = $src1, $imm, $src2;;", + [(set GR:$dst, (add GR:$src2, (shl GR:$src1, isSHLADDimm:$imm)))]>; + def SHL : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2), "shl $dst = $src1, $src2;;", [(set GR:$dst, (shl GR:$src1, GR:$src2))]>; +def SHRU : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2), + "shr.u $dst = $src1, $src2;;", + [(set GR:$dst, (srl GR:$src1, GR:$src2))]>; + +def SHRS : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2), + "shr $dst = $src1, $src2;;", + [(set GR:$dst, (sra GR:$src1, GR:$src2))]>; + /* def CMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2), "cmp.eq $dst, p0 = $src1, $src2;;">; @@ -219,22 +261,6 @@ "cmp.eq $dst, p0 = $src1, $src2;;", [(set PR:$dst, (setuge GR:$src1, GR:$src2))]>; -// FIXME: tabelgen doesn't know that zxt1 is cheaper on ia64 than "andi", -// need to fix this one day - -def SXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src;;", - [(set GR:$dst, (sext_inreg GR:$src, i8))]>; -def ZXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt1 $dst = $src;;", - [(set GR:$dst, (and GR:$src, 255))]>; -def SXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt2 $dst = $src;;", - [(set GR:$dst, (sext_inreg GR:$src, i16))]>; -def ZXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt2 $dst = $src;;", - [(set GR:$dst, (and GR:$src, 65535))]>; -def SXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt4 $dst = $src;;", - [(set GR:$dst, (sext_inreg GR:$src, i32))]>; -def ZXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt4 $dst = $src;;", - [(set GR:$dst, (and GR:$src, 1341835918))]>; // hehhehe NO - FIXME - // TODO: support postincrement (reg, imm9) loads+stores - this needs more // tablegen support @@ -298,44 +324,18 @@ def MOVLIMM64 : AForm<0x03, 0x0b
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.400 -> 1.401 --- Log message: Pull some code out into a function, give it the ability to see through +. This allows us to turn code like malloc(4*x+4) -> malloc int, (x+1) --- Diffs of the changes: (+59 -24) InstructionCombining.cpp | 83 +-- 1 files changed, 59 insertions(+), 24 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.400 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.401 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.400 Fri Oct 28 22:19:53 2005 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Oct 28 23:36:15 2005 @@ -3770,6 +3770,53 @@ return CI; } +/// DecomposeSimpleLinearExpr - Analyze 'Val', seeing if it is a simple linear +/// expression. If so, decompose it, returning some value X, such that Val is +/// X*Scale+Offset. +/// +static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale, +unsigned &Offset) { + assert(Val->getType() == Type::UIntTy && "Unexpected allocation size type!"); + if (ConstantUInt *CI = dyn_cast(Val)) { +Offset = CI->getValue(); +Scale = 1; +return ConstantUInt::get(Type::UIntTy, 0); + } else if (Instruction *I = dyn_cast(Val)) { +if (I->getNumOperands() == 2) { + if (ConstantUInt *CUI = dyn_cast(I->getOperand(1))) { +if (I->getOpcode() == Instruction::Shl) { + // This is a value scaled by '1 << the shift amt'. + Scale = 1U << CUI->getValue(); + Offset = 0; + return I->getOperand(0); +} else if (I->getOpcode() == Instruction::Mul) { + // This value is scaled by 'CUI'. + Scale = CUI->getValue(); + Offset = 0; + return I->getOperand(0); +} else if (I->getOpcode() == Instruction::Add) { + // We have X+C. Check to see if we really have (X*C2)+C1, where C1 is + // divisible by C2. + unsigned SubScale; + Value *SubVal = DecomposeSimpleLinearExpr(I->getOperand(0), SubScale, +Offset); + Offset += CUI->getValue(); + if (SubScale > 1 && (Offset % SubScale == 0)) { +Scale = SubScale; +return SubVal; + } +} + } +} + } + + // Otherwise, we can't look past this. + Scale = 1; + Offset = 0; + return Val; +} + + /// PromoteCastOfAllocation - If we find a cast of an allocation instruction, /// try to eliminate the cast by moving the type information into the alloc. Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI, @@ -3816,32 +3863,14 @@ // See if we can satisfy the modulus by pulling a scale out of the array // size argument. - unsigned ArraySizeScale = 1; - Value *NumElements = AI.getOperand(0); - - if (ConstantUInt *CI = dyn_cast(NumElements)) { -ArraySizeScale = CI->getValue(); -NumElements = ConstantUInt::get(Type::UIntTy, 1); - } else if (ShiftInst *SI = dyn_cast(NumElements)) { -if (SI->getOpcode() == Instruction::Shl) - if (ConstantUInt *CUI = dyn_cast(SI->getOperand(1))) { -// This is a value scaled by '1 << the shift amt'. -NumElements = SI->getOperand(0); -ArraySizeScale = 1U << CUI->getValue(); - } - } else if (isa(NumElements) && - cast(NumElements)->getOpcode() == Instruction::Mul){ -BinaryOperator *BO = cast(NumElements); -if (ConstantUInt *Scale = dyn_cast(BO->getOperand(1))) { - // This value is scaled by 'Scale'. - NumElements = BO->getOperand(0); - ArraySizeScale = Scale->getValue(); -} - } - + unsigned ArraySizeScale, ArrayOffset; + Value *NumElements = // See if the array size is a decomposable linear expr. +DecomposeSimpleLinearExpr(AI.getOperand(0), ArraySizeScale, ArrayOffset); + // If we can now satisfy the modulus, by using a non-1 scale, we really can // do the xform. - if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0) return 0; + if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0 || + (AllocElTySize*ArrayOffset ) % CastElTySize != 0) return 0; unsigned Scale = (AllocElTySize*ArraySizeScale)/CastElTySize; Value *Amt = 0; @@ -3857,6 +3886,12 @@ } } + if (unsigned Offset = (AllocElTySize*ArrayOffset)/CastElTySize) { +Value *Off = ConstantUInt::get(Type::UIntTy, Offset); +Instruction *Tmp = BinaryOperator::createAdd(Amt, Off, "tmp"); +Amt = InsertNewInstBefore(Tmp, AI); + } + std::string Name = AI.getName(); AI.setName(""); AllocationInst *New; if (isa(AI)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp
Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.107 -> 1.108 --- Log message: Now that instcombine does this xform, remove it from the -raise pass --- Diffs of the changes: (+0 -120) ExprTypeConvert.cpp | 120 1 files changed, 120 deletions(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.107 llvm/lib/Transforms/ExprTypeConvert.cpp:1.108 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.107 Tue Jul 26 11:38:28 2005 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Fri Oct 28 23:40:23 2005 @@ -16,7 +16,6 @@ #include "TransformInternals.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" -#include "llvm/Analysis/Expressions.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Debug.h" #include @@ -29,115 +28,6 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, ValueMapCache &VMC, const TargetData &TD); -// Peephole Malloc instructions: we take a look at the use chain of the -// malloc instruction, and try to find out if the following conditions hold: -// 1. The malloc is of the form: 'malloc [sbyte], uint ' -// 2. The only users of the malloc are cast & add instructions -// 3. Of the cast instructions, there is only one destination pointer type -// [RTy] where the size of the pointed to object is equal to the number -// of bytes allocated. -// -// If these conditions hold, we convert the malloc to allocate an [RTy] -// element. TODO: This comment is out of date WRT arrays -// -static bool MallocConvertibleToType(MallocInst *MI, const Type *Ty, -ValueTypeCache &CTMap, -const TargetData &TD) { - if (!isa(Ty)) return false; // Malloc always returns pointers - - // Deal with the type to allocate, not the pointer type... - Ty = cast(Ty)->getElementType(); - if (!Ty->isSized() || !MI->getType()->getElementType()->isSized()) -return false; // Can only alloc something with a size - - // Analyze the number of bytes allocated... - ExprType Expr = ClassifyExpr(MI->getArraySize()); - - // Get information about the base datatype being allocated, before & after - uint64_t ReqTypeSize = TD.getTypeSize(Ty); - if (ReqTypeSize == 0) return false; - uint64_t OldTypeSize = TD.getTypeSize(MI->getType()->getElementType()); - - // Must have a scale or offset to analyze it... - if (!Expr.Offset && !Expr.Scale && OldTypeSize == 1) return false; - - // Get the offset and scale of the allocation... - int64_t OffsetVal = Expr.Offset ? getConstantValue(Expr.Offset) : 0; - int64_t ScaleVal = Expr.Scale ? getConstantValue(Expr.Scale) :(Expr.Var != 0); - - // The old type might not be of unit size, take old size into consideration - // here... - uint64_t Offset = OffsetVal * OldTypeSize; - uint64_t Scale = ScaleVal * OldTypeSize; - - // In order to be successful, both the scale and the offset must be a multiple - // of the requested data type's size. - // - if (Offset/ReqTypeSize*ReqTypeSize != Offset || - Scale/ReqTypeSize*ReqTypeSize != Scale) -return false; // Nope. - - return true; -} - -static Instruction *ConvertMallocToType(MallocInst *MI, const Type *Ty, -const std::string &Name, -ValueMapCache &VMC, -const TargetData &TD){ - BasicBlock *BB = MI->getParent(); - BasicBlock::iterator It = BB->end(); - - // Analyze the number of bytes allocated... - ExprType Expr = ClassifyExpr(MI->getArraySize()); - - const PointerType *AllocTy = cast(Ty); - const Type *ElType = AllocTy->getElementType(); - - uint64_t DataSize = TD.getTypeSize(ElType); - uint64_t OldTypeSize = TD.getTypeSize(MI->getType()->getElementType()); - - // Get the offset and scale coefficients that we are allocating... - int64_t OffsetVal = (Expr.Offset ? getConstantValue(Expr.Offset) : 0); - int64_t ScaleVal = Expr.Scale ? getConstantValue(Expr.Scale) : (Expr.Var !=0); - - // The old type might not be of unit size, take old size into consideration - // here... - unsigned Offset = OffsetVal * OldTypeSize / DataSize; - unsigned Scale = ScaleVal * OldTypeSize / DataSize; - - // Locate the malloc instruction, because we may be inserting instructions - It = MI; - - // If we have a scale, apply it first... - if (Expr.Var) { -// Expr.Var is not necessarily unsigned right now, insert a cast now. -if (Expr.Var->getType() != Type::UIntTy) - Expr.Var = new CastInst(Expr.Var, Type::UIntTy, - Expr.Var->getName()+"-uint", It); - -if (Scale != 1) - Expr.Var = BinaryOperator::create(Instruction::Mul, Expr.Var, -ConstantUInt::get(Type::UIntTy, Scale), -Expr.Var->get
[llvm-commits] CVS: llvm/lib/Transforms/TransformInternals.cpp
Changes in directory llvm/lib/Transforms: TransformInternals.cpp updated: 1.49 -> 1.50 --- Log message: Remove dead #include --- Diffs of the changes: (+0 -1) TransformInternals.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/TransformInternals.cpp diff -u llvm/lib/Transforms/TransformInternals.cpp:1.49 llvm/lib/Transforms/TransformInternals.cpp:1.50 --- llvm/lib/Transforms/TransformInternals.cpp:1.49 Tue Jul 26 11:38:28 2005 +++ llvm/lib/Transforms/TransformInternals.cpp Fri Oct 28 23:41:30 2005 @@ -14,7 +14,6 @@ #include "TransformInternals.h" #include "llvm/Type.h" -#include "llvm/Analysis/Expressions.h" #include "llvm/Function.h" #include "llvm/Instructions.h" using namespace llvm; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Analysis/Expressions.h
Changes in directory llvm/include/llvm/Analysis: Expressions.h (r1.12) removed --- Log message: remove a dead header --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/Expressions.cpp
Changes in directory llvm/lib/Analysis: Expressions.cpp (r1.45) removed --- Log message: remove a dead file --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/Xcode/LLVM.xcodeproj/project.pbxproj
Changes in directory llvm/Xcode/LLVM.xcodeproj: project.pbxproj updated: 1.11 -> 1.12 --- Log message: Buh bye Expression.(cpp|h) --- Diffs of the changes: (+0 -4) project.pbxproj |4 1 files changed, 4 deletions(-) Index: llvm/Xcode/LLVM.xcodeproj/project.pbxproj diff -u llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.11 llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.12 --- llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.11 Thu Oct 27 12:39:48 2005 +++ llvm/Xcode/LLVM.xcodeproj/project.pbxproj Fri Oct 28 23:55:57 2005 @@ -173,7 +173,6 @@ DE66ECE908ABEC0700323D32 /* Printer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Printer.cpp; sourceTree = ""; }; DE66ECEA08ABEC0700323D32 /* Steensgaard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Steensgaard.cpp; sourceTree = ""; }; DE66ECEB08ABEC0700323D32 /* TopDownClosure.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TopDownClosure.cpp; sourceTree = ""; }; - DE66ED1608ABEC0800323D32 /* Expressions.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Expressions.cpp; sourceTree = ""; }; DE66ED1708ABEC0800323D32 /* InstCount.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InstCount.cpp; sourceTree = ""; }; DE66ED1808ABEC0800323D32 /* Interval.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Interval.cpp; sourceTree = ""; }; DE66ED1908ABEC0800323D32 /* IntervalPartition.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IntervalPartition.cpp; sourceTree = ""; }; @@ -602,7 +601,6 @@ DE66F20D08ABF03100323D32 /* DSNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DSNode.h; sourceTree = ""; }; DE66F20E08ABF03100323D32 /* DSSupport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DSSupport.h; sourceTree = ""; }; DE66F20F08ABF03100323D32 /* Dominators.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Dominators.h; sourceTree = ""; }; - DE66F21008ABF03100323D32 /* Expressions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Expressions.h; sourceTree = ""; }; DE66F21208ABF03100323D32 /* FindUsedTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FindUsedTypes.h; sourceTree = ""; }; DE66F21308ABF03100323D32 /* Interval.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Interval.h; sourceTree = ""; }; DE66F21408ABF03100323D32 /* IntervalIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IntervalIterator.h; sourceTree = ""; }; @@ -1027,7 +1025,6 @@ DE66ECC108ABEC0700323D32 /* AliasSetTracker.cpp */, DE66ECC208ABEC0700323D32 /* BasicAliasAnalysis.cpp */, DE66ECC308ABEC0700323D32 /* CFGPrinter.cpp */, - DE66ED1608ABEC0800323D32 /* Expressions.cpp */, DE66ED1708ABEC0800323D32 /* InstCount.cpp */, DE66ED1808ABEC0800323D32 /* Interval.cpp */, DE66ED1908ABEC0800323D32 /* IntervalPartition.cpp */, @@ -1823,7 +1820,6 @@ DE66F20808ABF03100323D32 /* ConstantsScanner.h */, DE66F20908ABF03100323D32 /* DataStructure */, DE66F20F08ABF03100323D32 /* Dominators.h */, - DE66F21008ABF03100323D32 /* Expressions.h */, DE66F21208ABF03100323D32 /* FindUsedTypes.h */, DE66F21308ABF03100323D32 /* Interval.h */, DE66F21408ABF03100323D32 /* IntervalIterator.h */, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/ReleaseNotes.html
Changes in directory llvm/docs: ReleaseNotes.html updated: 1.336 -> 1.337 --- Log message: Basic updates --- Diffs of the changes: (+3 -16) ReleaseNotes.html | 19 +++ 1 files changed, 3 insertions(+), 16 deletions(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.336 llvm/docs/ReleaseNotes.html:1.337 --- llvm/docs/ReleaseNotes.html:1.336 Mon Oct 24 11:36:36 2005 +++ llvm/docs/ReleaseNotes.html Sat Oct 29 00:14:01 2005 @@ -74,9 +74,6 @@ - - See LLVM 1.5 Release Notes - The JIT now uses mutexes to protect its internal data structures. This allows multi-threaded programs to be run from the JIT or interpreter without @@ -124,7 +121,7 @@ Sun UltraSPARC workstations running Solaris 8. Intel and AMD machines running on Win32 with the Cygwin libraries (limited support is available for native builds with Visual C++). -PowerPC-based Mac OS X systems, running 10.2 and above. +PowerPC and X86-based Mac OS X systems, running 10.2 and above. Alpha-based machines running Debian GNU/Linux. Itanium-based machines running Linux and HP-UX. @@ -186,10 +183,6 @@ In the JIT, dlsym() on a symbol compiled by the JIT will not work. - http://llvm.cs.uiuc.edu/PR240";>The lower-invoke pass does not -mark values live across a setjmp as volatile. This missing feature - only affects targets whose setjmp/longjmp libraries do not save and restore - the entire register file. @@ -498,8 +491,6 @@ On 21164s, some rare FP arithmetic sequences which may trap do not have the appropriate nops inserted to ensure restartability. -Defining vararg functions is not supported (but calling them is ok). - Due to the vararg problems, C++ exceptions do not work. Small changes are required to the CFE (which break correctness in the exception handler) to compile the exception handling library (and thus the C++ standard library). @@ -545,12 +536,8 @@ Many features are still missing (e.g. support for 64-bit integer -arithmetic). - -This backend needs to be updated to use the SelectionDAG instruction -selection framework. +arithmetic). This back-end is in pre-beta state. - @@ -586,7 +573,7 @@ src="http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!" /> http://llvm.cs.uiuc.edu";>The LLVM Compiler Infrastructure - Last modified: $Date: 2005/10/24 16:36:36 $ + Last modified: $Date: 2005/10/29 05:14:01 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp
Changes in directory llvm/lib/Target/SparcV8: SparcV8TargetMachine.cpp updated: 1.29 -> 1.30 --- Log message: remove reference to this pass --- Diffs of the changes: (+0 -4) SparcV8TargetMachine.cpp |4 1 files changed, 4 deletions(-) Index: llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp diff -u llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp:1.29 llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp:1.30 --- llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp:1.29 Thu Sep 1 16:38:21 2005 +++ llvm/lib/Target/SparcV8/SparcV8TargetMachine.cppSat Oct 29 00:28:34 2005 @@ -80,8 +80,6 @@ // FIXME: implement the invoke/unwind instructions! PM.add(createLowerInvokePass()); - PM.add(createLowerConstantExpressionsPass()); - // Make sure that no unreachable blocks are instruction selected. PM.add(createUnreachableBlockEliminationPass()); @@ -137,8 +135,6 @@ // FIXME: implement the invoke/unwind instructions! PM.add(createLowerInvokePass()); - PM.add(createLowerConstantExpressionsPass()); - // Make sure that no unreachable blocks are instruction selected. PM.add(createUnreachableBlockEliminationPass()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Scalar.h
Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.23 -> 1.24 Scalar.h updated: 1.56 -> 1.57 --- Log message: Remove the LowerConstantExpressionsPass pass --- Diffs of the changes: (+0 -6) LinkAllPasses.h |1 - Scalar.h|5 - 2 files changed, 6 deletions(-) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.23 llvm/include/llvm/Transforms/LinkAllPasses.h:1.24 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.23 Sun Oct 23 21:30:25 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.hSat Oct 29 00:32:20 2005 @@ -77,7 +77,6 @@ (void) llvm::createLoopUnrollPass(); (void) llvm::createLoopUnswitchPass(); (void) llvm::createLowerAllocationsPass(); - (void) llvm::createLowerConstantExpressionsPass(); (void) llvm::createLowerGCPass(); (void) llvm::createLowerInvokePass(); (void) llvm::createLowerPackedPass(); Index: llvm/include/llvm/Transforms/Scalar.h diff -u llvm/include/llvm/Transforms/Scalar.h:1.56 llvm/include/llvm/Transforms/Scalar.h:1.57 --- llvm/include/llvm/Transforms/Scalar.h:1.56 Thu Apr 21 15:57:32 2005 +++ llvm/include/llvm/Transforms/Scalar.h Sat Oct 29 00:32:20 2005 @@ -282,11 +282,6 @@ FunctionPass *createLowerGCPass(); //===--===// -// Returns a pass which converts all instances of ConstantExpression -// into regular LLVM instructions. -FunctionPass* createLowerConstantExpressionsPass(); - -//===--===// // This pass reorders basic blocks in order to increase the number of fall- // through conditional branches. FunctionPass *createBlockPlacementPass(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerConstantExprs.cpp
Changes in directory llvm/lib/Transforms/Scalar: LowerConstantExprs.cpp (r1.4) removed --- Log message: This pass is now obsolete since all targets have moved to the SelectionDAG infrastructure and the simple isels have been removed. --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/Xcode/LLVM.xcodeproj/project.pbxproj
Changes in directory llvm/Xcode/LLVM.xcodeproj: project.pbxproj updated: 1.12 -> 1.13 --- Log message: Remove the lowerconstantexprs pass --- Diffs of the changes: (+0 -2) project.pbxproj |2 -- 1 files changed, 2 deletions(-) Index: llvm/Xcode/LLVM.xcodeproj/project.pbxproj diff -u llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.12 llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.13 --- llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.12 Fri Oct 28 23:55:57 2005 +++ llvm/Xcode/LLVM.xcodeproj/project.pbxproj Sat Oct 29 00:34:40 2005 @@ -540,7 +540,6 @@ DE66F1A908ABEFB400323D32 /* LoopUnroll.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LoopUnroll.cpp; sourceTree = ""; }; DE66F1AA08ABEFB400323D32 /* LoopUnswitch.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LoopUnswitch.cpp; sourceTree = ""; }; DE66F1AB08ABEFB400323D32 /* LowerAllocations.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LowerAllocations.cpp; sourceTree = ""; }; - DE66F1AC08ABEFB400323D32 /* LowerConstantExprs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LowerConstantExprs.cpp; sourceTree = ""; }; DE66F1AD08ABEFB400323D32 /* LowerGC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LowerGC.cpp; sourceTree = ""; }; DE66F1AE08ABEFB400323D32 /* LowerInvoke.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LowerInvoke.cpp; sourceTree = ""; }; DE66F1AF08ABEFB400323D32 /* LowerPacked.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LowerPacked.cpp; sourceTree = ""; }; @@ -1694,7 +1693,6 @@ DE66F1A908ABEFB400323D32 /* LoopUnroll.cpp */, DE66F1AA08ABEFB400323D32 /* LoopUnswitch.cpp */, DE66F1AB08ABEFB400323D32 /* LowerAllocations.cpp */, - DE66F1AC08ABEFB400323D32 /* LowerConstantExprs.cpp */, DE66F1AD08ABEFB400323D32 /* LowerGC.cpp */, DE66F1AE08ABEFB400323D32 /* LowerInvoke.cpp */, DE66F1AF08ABEFB400323D32 /* LowerPacked.cpp */, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/OpenProjects.html
Changes in directory llvm-www: OpenProjects.html updated: 1.9 -> 1.10 --- Log message: remove a closed project --- Diffs of the changes: (+1 -2) OpenProjects.html |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm-www/OpenProjects.html diff -u llvm-www/OpenProjects.html:1.9 llvm-www/OpenProjects.html:1.10 --- llvm-www/OpenProjects.html:1.9 Fri Oct 21 15:29:32 2005 +++ llvm-www/OpenProjects.html Sat Oct 29 00:46:00 2005 @@ -290,7 +290,6 @@ algorithm for SSA form Implement a Dependence Analysis Infrastructure - Design some way to represent and query dep analysis -Implement a strength reduction pass Value range propagation pass @@ -376,7 +375,7 @@ src="http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!"> http://llvm.cs.uiuc.edu";>LLVM Compiler Infrastructure - Last modified: $Date: 2005/10/21 20:29:32 $ + Last modified: $Date: 2005/10/29 05:46:00 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/testresults/index.html
Changes in directory llvm-www/testresults: index.html updated: 1.35 -> 1.36 --- Log message: nuke two long-dead testers, update URL for Vladimir Merzliakov's tester. --- Diffs of the changes: (+1 -5) index.html |6 +- 1 files changed, 1 insertion(+), 5 deletions(-) Index: llvm-www/testresults/index.html diff -u llvm-www/testresults/index.html:1.35 llvm-www/testresults/index.html:1.36 --- llvm-www/testresults/index.html:1.35Sun May 1 22:02:05 2005 +++ llvm-www/testresults/index.html Sat Oct 29 00:44:50 2005 @@ -56,15 +56,11 @@ Linux (Dual P4 Xeon @ 3.06GHz) -- debug build - -Linux (Dual Athlon MP 2100+) -- release build http://illuvium.net/testresults/Optimized/";>Linux (Dual P4 Xeon @ 2.3GHz) -- release build -http://illuvium.net/testresults/Cygwin/";>Cygwin on Windows -2k, SP3 (Pentium 3 M @ 1.1Ghz) -- debug build -http://npt.cc.rsu.ru/testresults-X86-FreeBSD/";>FreeBSD 5.3 (Pentium +http://npt.cc.rsu.ru/testresults-X86-FreeBSD/index.html";>FreeBSD 6.0BETA (Pentium 3 @ 1.0Ghz) -- debug build http://kinoko.c.u-tokyo.ac.jp/~builddonkey/";>FreeBSD-CURRENT ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits