From tonic at nondot.org Mon Apr 21 00:02:41 2008 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 21 Apr 2008 05:02:41 -0000 Subject: [llvm-commits] [nightly-test-server] r50030 - in /nightly-test-server/trunk: AcceptTestResults.php NightlyTestAccept.php Message-ID: <200804210502.m3L52ffU021044@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Apr 21 00:02:41 2008 New Revision: 50030 URL: http://llvm.org/viewvc/llvm-project?rev=50030&view=rev Log: Fixed errors that were freeing non existant mysql results. Script no longer dies if it can not write build files. Modified new database layout and updated insert statements. Modified: nightly-test-server/trunk/AcceptTestResults.php nightly-test-server/trunk/NightlyTestAccept.php Modified: nightly-test-server/trunk/AcceptTestResults.php URL: http://llvm.org/viewvc/llvm-project/nightly-test-server/trunk/AcceptTestResults.php?rev=50030&r1=50029&r2=50030&view=diff ============================================================================== --- nightly-test-server/trunk/AcceptTestResults.php (original) +++ nightly-test-server/trunk/AcceptTestResults.php Mon Apr 21 00:02:41 2008 @@ -82,21 +82,25 @@ $dejagnuWallTime, $warnings, $warningsAdded, $warningsRemoved, $cvsUsersAdd, $cvsUsersCO, $cvsFilesAdded, $cvsFilesRemoved, $cvsFilesModified, - $buildStatus) { + $buildStatus, $dejagnuPASS, $dejagnuXPASS, + $dejagnuFAIL, $dejagnuXFAIL) { $sqlQuery = "INSERT into testRunInfo (runDateTime, machineId, machineUname," . " gccVersion, cvsCpuTime, cvsWallTime, configureCpuTime," . " configureWallTime, buildCpuTime, buildWallTime," . " dejagnuCpuTime, dejagnuWallTime, warnings, warningsAdded," . " warningsRemoved, cvsUsersAdd, cvsUsersCO, cvsFilesAdded," . - " cvsFilesRemoved, cvsFilesModified, buildStatus) VALUES (". + " cvsFilesRemoved, cvsFilesModified, buildStatus, dejagnuPass," . + " dejagnuFail, dejagnuXFail, dejagnuXPass) VALUES (". " \"$runDateTime\", \"$machineId\", \"$machineUname\"," . " \"$gccVersion\", \"$cvsCpuTime\", \"$cvsWallTime\"," . " \"$configureCpuTime\", \"$configureWallTime\", \"$buildCpuTime\"," . " \"$buildWallTime\", \"$dejagnuCpuTime\", \"$dejagnuWallTime\"," . " \"$warnings\", \"$warningsAdded\", \"$warningsRemoved\"," . " \"$cvsUsersAdd\", \"$cvsUsersCO\", \"$cvsFilesAdded\"," . - " \"$cvsFilesRemoved\", \"$cvsFilesModified\", \"$buildStatus\")"; + " \"$cvsFilesRemoved\", \"$cvsFilesModified\", \"$buildStatus\"," . + " \"$dejagnuPASS\", \"$dejagnuFAIL\", \"$dejagnuXFAIL\"," . + " \"$dejagnuXPASS\")"; mysql_query($sqlQuery) or die(mysql_error()); $id = mysql_insert_id() or die(mysql_error()); return $id; @@ -347,9 +351,10 @@ function acceptTestResults() { //print "content-type: text/text\n\n"; + global $print_debug; // Database connection info - $database = "llvmTestResults"; + $database = "llvmNightlyTestResults"; $loginname = "llvm"; $password = "ll2002vm"; @@ -388,6 +393,24 @@ shutdown($mysql_link); } +$dejagnutests_log = $_POST['dejagnutests_log']; +if (!isset($dejagnutests_log)) { + $dejagnutests_log = ""; +} + +$dejagnuPASS = matchOne("/\# of expected passes\s*([0-9]+)/", $dejagnutests_log, 0); +$dejagnuFAIL = matchOne("/unexpected failures\s*([0-9]+)/", $dejagnutests_log, 0); +$dejagnuXFAIL = matchOne("/\# of expected failures\s*([0-9]+)/", $dejagnutests_log, 0); +$dejagnuXPASS = matchOne("/\# of unexpected passes\s*([0-9]+)/", $dejagnutests_log, 0); + +if ($print_debug) { + print "PASS: $dejagnuPASS\n"; + print "FAIL: $dejagnuFAIL\n"; + print "XFAIL: $dejagnuXFAIL\n"; + print "XPASS: $dejagnuXPASS\n"; +} + + //Extract addition test run information, bail out if missing starttime if( !isset($_POST['starttime']) ) { shutdown($mysql_link); @@ -413,6 +436,18 @@ $warningsRemoved = $_POST['warnings_added']; $buildstatus = $_POST['buildstatus']; +if($buildstatus == "OK") { + $buildstatus = 1; +} +else if($buildstatus == "Error: compilation aborted") { + $buildstatus = 2; +} +else if($buildstatus == "Skipped by user") { + $buildstatus = 3; +} +else { + $buildstatus = 4; +} // Add new test run config $testRunConfigId = addTestRunConfig($runDateTime, $machineId, $uname, @@ -423,7 +458,8 @@ $dejagnuWallTime, $warnings, $warningsAdded, $warningsRemoved, $cvsUsersAdd, $cvsUsersCO, $cvsFilesAdded, $cvsFilesRemoved, $cvsFilesModified, - $buildStatus); + $buildstatus, $dejagnuPASS, $dejagnuXPASS, + $dejagnuFAIL, $dejagnuXFAIL); //Print data obtained so far @@ -435,17 +471,17 @@ print "Nickname: $nickname\n"; print "\n"; - print "Test Run Config ID: $testRunConfigID\n"; - print "Start Time: $runDateTime\n"; + print "Test Run Config ID: $testRunConfigId \n"; + print "Start Time: $runDateTime \n"; print "Uname: $uname\n"; - print "GCC Version: $gccVersion\n"; - print "Cvs Cpu Time: $cvsCpuTime\n"; + print "GCC Version: $gcc_version\n"; + print "Cvs Cpu Time: $cvsCpuTime \n"; print "Cvs Wall Time: $cvsWallTime\n"; print "Configure Cpu Time: $configureCpuTime\n"; print "Configure Wall Time: $configureWallTime\n"; print "Build Cpu Time: $buildCpuTime\n"; print "Build Wall Time: $buildWallTime\n"; - print "Dejagnu Cpu Time: $dejagnuCupTime\n"; + print "Dejagnu Cpu Time: $dejagnuCpuTime\n"; print "Dejagnu Wall Time: $dejagnuWallTime\n"; print "Warnings: $warnings\n"; print "Warnings Added: $warningsAdded\n"; @@ -455,7 +491,7 @@ print "Cvs Files Modified: $cvsFilesModified\n"; print "Cvs Users Commit: $cvsUsersAdd\n"; print "Cvs Users Checkout: $cvsUsersCO\n"; - print "Build Status: $buildStatus\n"; + print "Build Status: $buildstatus\n"; } Modified: nightly-test-server/trunk/NightlyTestAccept.php URL: http://llvm.org/viewvc/llvm-project/nightly-test-server/trunk/NightlyTestAccept.php?rev=50030&r1=50029&r2=50030&view=diff ============================================================================== --- nightly-test-server/trunk/NightlyTestAccept.php (original) +++ nightly-test-server/trunk/NightlyTestAccept.php Mon Apr 21 00:02:41 2008 @@ -110,9 +110,13 @@ * *******************************************************************************/ function WriteFile($filename, $contents) { - $file = fopen($filename, "w") or die("Could not open file $filename for writing"); - fwrite($file, $contents) or die("Could not write to file $filename"); - fclose($file); + + $file = fopen($filename, "w"); + + if($file) { + fwrite($file, $contents); + fclose($file); + } } /******************************************************************************* @@ -159,8 +163,7 @@ function AddMachine($uname, $hardware, $os, $name, $nickname, $gcc_version, $directory) { $query = "INSERT INTO machine (uname, hardware, os, name, nickname, gcc, directory) " . "VALUES (\"$uname\",\"$hardware\",\"$os\",\"$name\",\"$nickname\",\"$gcc_version\",\"$directory\")"; - $insert_query = mysql_query($query) or die(mysql_error()); - mysql_free_result($insert_query); + mysql_query($query) or die(mysql_error()); } /******************************************************************************* @@ -274,8 +277,7 @@ "\"$newly_failing_tests\", \"$new_tests\", \"$removed_tests\", \"$cvs_added\"," . "\"$cvs_removed\", \"$cvs_modified\", \"$cvs_usersadd\", \"$cvs_usersco\"" . ")"; - $insert_query = mysql_query($query) or die(mysql_error()); - mysql_free_result($insert_query); + mysql_query($query) or die(mysql_error()); $query = "SELECT id FROM night WHERE machine=$machine_id AND added=\"$added\""; $machine_query = mysql_query($query) or die(mysql_error()); @@ -320,8 +322,7 @@ if (!StringIsNull($program)) { $query = "INSERT INTO program (program, result, type, night) VALUES". " (\"$program\", \"$result\", \"$type\", $night)"; - $program_query = mysql_query($query) or die(mysql_error()); - mysql_free_result($program_query); + mysql_query($query) or die(mysql_error()); } } @@ -343,8 +344,7 @@ if (!StringIsNull($program)) { $query = "INSERT INTO tests (program, result, measure, night) VALUES". " (\"$program\", \"$result\", \"$measure\", $night)"; - $program_query = mysql_query($query) or die(mysql_error()); - mysql_free_result($program_query); + mysql_query($query) or die(mysql_error()); } } @@ -366,8 +366,7 @@ function AddFile($file, $size, $night, $type) { $query = "INSERT INTO file (file, size, night, type) VALUES". " (\"$file\", \"$size\", \"$night\", \"$type\")"; - $file_query = mysql_query($query) or die(mysql_error()); - mysql_free_result($file_query); + mysql_query($query) or die(mysql_error()); } /******************************************************************************* @@ -467,6 +466,8 @@ *******************************************************************************/ function acceptTest() { + global $print_debug; + // If no nickname is set, die here if (!isset($_POST['nickname'])) { return; @@ -677,7 +678,8 @@ $blank, $blank, $blank, // $expfail_tests, $TestsFixed, $TestsBroken, $blank, $blank, // $TestsAdded, $TestsRemoved, $cvsaddedfiles, $cvsremovedfiles, $cvsmodifiedfiles, - $cvsusercommitlist, $cvsuserupdatelist); + $cvsusercommitlist, $cvsuserupdatelist, + $blank, $blank); if ($print_debug) { print "db_date: $db_date\n"; @@ -949,37 +951,47 @@ * *******************************************************************************/ $cwd = getcwd(); - - if (!file_exists('machines')) { - mkdir('machines', 777); - } - chdir("$cwd/machines"); - - if (!file_exists("$machine_id")) { - mkdir("$machine_id", 777); - } - chdir("$cwd/machines/$machine_id"); - - WriteFile("$db_date-Build-Log.txt", $build_log); - - $sentdata=""; - foreach ($_GET as $key => $value) { - if(strpos($value, "\n") == 0) { - $sentdata .= "'$key' => \"$value\",\n"; - } else { - $sentdata .= "'$key' => < $value) { - if(strpos($value, "\n") == 0) { - $sentdata .= "'$key' => \"$value\",\n"; - } else { - $sentdata .= "'$key' => < $value) { + if(strpos($value, "\n") == 0) { + $sentdata .= "'$key' => \"$value\",\n"; + } else { + $sentdata .= "'$key' => < $value) { + if(strpos($value, "\n") == 0) { + $sentdata .= "'$key' => \"$value\",\n"; + } else { + $sentdata .= "'$key' => < Author: lattner Date: Mon Apr 21 01:12:55 2008 New Revision: 50031 URL: http://llvm.org/viewvc/llvm-project?rev=50031&view=rev Log: another bug introduced in r47802 by nicholas, for no apparent reason. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=50031&r1=50030&r2=50031&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Apr 21 01:12:55 2008 @@ -1131,7 +1131,7 @@ if (F->isDeclaration()) { Out << "\n"; } else { - Out << " {\n"; + Out << " {"; // Output all of its basic blocks... for the function for (Function::const_iterator I = F->begin(), E = F->end(); I != E; ++I) From sabre at nondot.org Mon Apr 21 01:19:02 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Apr 2008 06:19:02 -0000 Subject: [llvm-commits] [llvm] r50032 - /llvm/trunk/lib/VMCore/Dominators.cpp Message-ID: <200804210619.m3L6J2Ag023184@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 01:19:02 2008 New Revision: 50032 URL: http://llvm.org/viewvc/llvm-project?rev=50032&view=rev Log: don't print dominators every time it is computed with -debug. Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=50032&r1=50031&r2=50032&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Apr 21 01:19:02 2008 @@ -14,12 +14,9 @@ // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "domtree" - #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" -#include "llvm/Support/Debug.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/SmallPtrSet.h" @@ -61,7 +58,6 @@ bool DominatorTree::runOnFunction(Function &F) { DT->recalculate(F); - DEBUG(DT->dump()); return false; } From baldrick at free.fr Mon Apr 21 02:35:29 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Apr 2008 07:35:29 -0000 Subject: [llvm-commits] [llvm] r50033 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200804210735.m3L7ZTZU028282@zion.cs.uiuc.edu> Author: baldrick Date: Mon Apr 21 02:35:28 2008 New Revision: 50033 URL: http://llvm.org/viewvc/llvm-project?rev=50033&view=rev Log: Fix a "large integer implicitly truncated to unsigned type" warning. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=50033&r1=50032&r2=50033&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Apr 21 02:35:28 2008 @@ -264,7 +264,7 @@ CI != CE; ++CI) if (isa((*CI)->getType()) && ( getUnderlyingObject(*CI) == P || - alias(cast(CI), ~0UL, P, ~0UL) != NoAlias) ) + alias(cast(CI), ~0U, P, ~0U) != NoAlias) ) passedAsArg = true; if (!passedAsArg) From duncan.sands at math.u-psud.fr Mon Apr 21 02:40:57 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Mon, 21 Apr 2008 09:40:57 +0200 Subject: [llvm-commits] [llvm] r50006 - /llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp In-Reply-To: <200804202239.m3KMdgfs009664@zion.cs.uiuc.edu> References: <200804202239.m3KMdgfs009664@zion.cs.uiuc.edu> Message-ID: <200804210940.58224.duncan.sands@math.u-psud.fr> Hi Chris, > + // If the terminator of this block is branching on a constant, simplify the > + // terminator to an unconditional branch. This can occur do to threading in do to -> due to Ciao, Duncan. From duncan.sands at math.u-psud.fr Mon Apr 21 02:44:49 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Mon, 21 Apr 2008 09:44:49 +0200 Subject: [llvm-commits] [llvm] r50000 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/JumpThreading.cpp In-Reply-To: <200804202035.m3KKZ2wp006047@zion.cs.uiuc.edu> References: <200804202035.m3KKZ2wp006047@zion.cs.uiuc.edu> Message-ID: <200804210944.49478.duncan.sands@math.u-psud.fr> > Add a new Jump Threading pass, which will handle cases > such as those in PR2235. Right now the pass is not very > effective. :) But it is correct :) Ciao, Duncan. PS: Thanks for doing this. Now all that's needed is to add correlated expressions... ;) From resistor at mac.com Mon Apr 21 02:45:10 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 21 Apr 2008 07:45:10 -0000 Subject: [llvm-commits] [llvm] r50034 - in /llvm/trunk: lib/Transforms/Scalar/MemCpyOptimizer.cpp test/Transforms/MemCpyOpt/form-memset.ll test/Transforms/MemCpyOpt/form-memset2.ll Message-ID: <200804210745.m3L7jBq0001144@zion.cs.uiuc.edu> Author: resistor Date: Mon Apr 21 02:45:10 2008 New Revision: 50034 URL: http://llvm.org/viewvc/llvm-project?rev=50034&view=rev Log: Refactor memcpyopt based on Chris' suggestions. Consolidate several functions and simplify code that was fallout from the separation of memcpyopt and gvn. Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll llvm/trunk/test/Transforms/MemCpyOpt/form-memset2.ll Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=50034&r1=50033&r2=50034&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Apr 21 02:45:10 2008 @@ -14,23 +14,14 @@ #define DEBUG_TYPE "memcpyopt" #include "llvm/Transforms/Scalar.h" -#include "llvm/BasicBlock.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Function.h" #include "llvm/IntrinsicInst.h" #include "llvm/Instructions.h" #include "llvm/ParameterAttributes.h" -#include "llvm/Value.h" -#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" -#include "llvm/Support/CFG.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Target/TargetData.h" @@ -40,13 +31,6 @@ STATISTIC(NumMemCpyInstr, "Number of memcpy instructions deleted"); STATISTIC(NumMemSetInfer, "Number of memsets inferred"); -namespace { - cl::opt - FormMemSet("form-memset-from-stores", - cl::desc("Transform straight-line stores to memsets"), - cl::init(true), cl::Hidden); -} - /// isBytewiseValue - If the specified value can be set by repeating the same /// byte in memory, return the i8 value that it is represented with. This is /// true for all i8 values obviously, but is also true for i32 0, i32 -1, @@ -332,13 +316,9 @@ } // Helper fuctions - bool processInstruction(Instruction* I, - SmallVectorImpl &toErase); - bool processStore(StoreInst *SI, SmallVectorImpl &toErase); - bool processMemCpy(MemCpyInst* M, MemCpyInst* MDep, - SmallVectorImpl &toErase); - bool performCallSlotOptzn(MemCpyInst* cpy, CallInst* C, - SmallVectorImpl &toErase); + bool processStore(StoreInst *SI, BasicBlock::iterator& BBI); + bool processMemCpy(MemCpyInst* M); + bool performCallSlotOptzn(MemCpyInst* cpy, CallInst* C); bool iterateOnFunction(Function &F); }; @@ -357,8 +337,7 @@ /// some other patterns to fold away. In particular, this looks for stores to /// neighboring locations of memory. If it sees enough consequtive ones /// (currently 4) it attempts to merge them together into a memcpy/memset. -bool MemCpyOpt::processStore(StoreInst *SI, SmallVectorImpl &toErase) { - if (!FormMemSet) return false; +bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator& BBI) { if (SI->isVolatile()) return false; // There are two cases that are interesting for this code to handle: memcpy @@ -473,8 +452,13 @@ cerr << *Range.TheStores[i]; cerr << "With: " << *C); C=C; + // Don't invalidate the iterator + BBI = BI; + // Zap all the stores. - toErase.append(Range.TheStores.begin(), Range.TheStores.end()); + for (SmallVector::const_iterator SI = Range.TheStores.begin(), + SE = Range.TheStores.end(); SI != SE; ++SI) + (*SI)->eraseFromParent(); ++NumMemSetInfer; MadeChange = true; } @@ -486,8 +470,7 @@ /// performCallSlotOptzn - takes a memcpy and a call that it depends on, /// and checks for the possibility of a call slot optimization by having /// the call write its result directly into the destination of the memcpy. -bool MemCpyOpt::performCallSlotOptzn(MemCpyInst *cpy, CallInst *C, - SmallVectorImpl &toErase) { +bool MemCpyOpt::performCallSlotOptzn(MemCpyInst *cpy, CallInst *C) { // The general transformation to keep in mind is // // call @func(..., src, ...) @@ -612,7 +595,8 @@ // Remove the memcpy MD.removeInstruction(cpy); - toErase.push_back(cpy); + cpy->eraseFromParent(); + NumMemCpyInstr++; return true; } @@ -621,8 +605,23 @@ /// copies X to Y, and memcpy B which copies Y to Z, then we can rewrite B to be /// a memcpy from X to Z (or potentially a memmove, depending on circumstances). /// This allows later passes to remove the first memcpy altogether. -bool MemCpyOpt::processMemCpy(MemCpyInst* M, MemCpyInst* MDep, - SmallVectorImpl &toErase) { +bool MemCpyOpt::processMemCpy(MemCpyInst* M) { + MemoryDependenceAnalysis& MD = getAnalysis(); + + // The are two possible optimizations we can do for memcpy: + // a) memcpy-memcpy xform which exposes redundance for DSE + // b) call-memcpy xform for return slot optimization + Instruction* dep = MD.getDependency(M); + if (dep == MemoryDependenceAnalysis::None || + dep == MemoryDependenceAnalysis::NonLocal) + return false; + else if (CallInst* C = dyn_cast(dep)) + return performCallSlotOptzn(M, C); + else if (!isa(dep)) + return false; + + MemCpyInst* MDep = cast(dep); + // We can only transforms memcpy's where the dest of one is the source of the // other if (M->getSource() != MDep->getDest()) @@ -667,41 +666,16 @@ CallInst* C = CallInst::Create(MemCpyFun, args.begin(), args.end(), "", M); - MemoryDependenceAnalysis& MD = getAnalysis(); if (MD.getDependency(C) == MDep) { MD.dropInstruction(M); - toErase.push_back(M); + M->eraseFromParent(); return true; } MD.removeInstruction(C); - toErase.push_back(C); - return false; -} - -/// processInstruction - When calculating availability, handle an instruction -/// by inserting it into the appropriate sets -bool MemCpyOpt::processInstruction(Instruction *I, - SmallVectorImpl &toErase) { - if (StoreInst *SI = dyn_cast(I)) - return processStore(SI, toErase); - - if (MemCpyInst* M = dyn_cast(I)) { - MemoryDependenceAnalysis& MD = getAnalysis(); - - // The are two possible optimizations we can do for memcpy: - // a) memcpy-memcpy xform which exposes redundance for DSE - // b) call-memcpy xform for return slot optimization - Instruction* dep = MD.getDependency(M); - if (dep == MemoryDependenceAnalysis::None || - dep == MemoryDependenceAnalysis::NonLocal) - return false; - if (MemCpyInst *MemCpy = dyn_cast(dep)) - return processMemCpy(M, MemCpy, toErase); - if (CallInst* C = dyn_cast(dep)) - return performCallSlotOptzn(M, C, toErase); - return false; - } + C->eraseFromParent(); + + NumMemCpyInstr++; return false; } @@ -726,42 +700,20 @@ // MemCpyOpt::iterateOnFunction - Executes one iteration of GVN bool MemCpyOpt::iterateOnFunction(Function &F) { bool changed_function = false; - - DominatorTree &DT = getAnalysis(); - - SmallVector toErase; - - // Top-down walk of the dominator tree - for (df_iterator DI = df_begin(DT.getRootNode()), - E = df_end(DT.getRootNode()); DI != E; ++DI) { - BasicBlock* BB = DI->getBlock(); + // Walk all instruction in the function + for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB) { for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) { - changed_function |= processInstruction(BI, toErase); - if (toErase.empty()) { - ++BI; - continue; - } - - // If we need some instructions deleted, do it now. - NumMemCpyInstr += toErase.size(); + // Avoid invalidating the iterator + Instruction* I = BI++; - // Avoid iterator invalidation. - bool AtStart = BI == BB->begin(); - if (!AtStart) - --BI; - - for (SmallVector::iterator I = toErase.begin(), - E = toErase.end(); I != E; ++I) - (*I)->eraseFromParent(); - - if (AtStart) - BI = BB->begin(); - else - ++BI; - - toErase.clear(); + if (StoreInst *SI = dyn_cast(I)) + changed_function |= processStore(SI, BI); + + if (MemCpyInst* M = dyn_cast(I)) { + changed_function |= processMemCpy(M); + } } } Modified: llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll?rev=50034&r1=50033&r2=50034&view=diff ============================================================================== --- llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll (original) +++ llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll Mon Apr 21 02:45:10 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | not grep store -; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | grep {call.*llvm.memset} +; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep store +; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*llvm.memset} ; All the stores in this example should be merged into a single memset. Modified: llvm/trunk/test/Transforms/MemCpyOpt/form-memset2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/form-memset2.ll?rev=50034&r1=50033&r2=50034&view=diff ============================================================================== --- llvm/trunk/test/Transforms/MemCpyOpt/form-memset2.ll (original) +++ llvm/trunk/test/Transforms/MemCpyOpt/form-memset2.ll Mon Apr 21 02:45:10 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | not grep store -; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | grep {call.*llvm.memset} | count 3 +; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep store +; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*llvm.memset} | count 3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" From resistor at mac.com Mon Apr 21 02:47:38 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 21 Apr 2008 07:47:38 -0000 Subject: [llvm-commits] [llvm] r50035 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200804210747.m3L7ldxg001222@zion.cs.uiuc.edu> Author: resistor Date: Mon Apr 21 02:47:38 2008 New Revision: 50035 URL: http://llvm.org/viewvc/llvm-project?rev=50035&view=rev Log: Remove unneeded #include's. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=50035&r1=50034&r2=50035&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Apr 21 02:47:38 2008 @@ -18,9 +18,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" -#include "llvm/IntrinsicInst.h" #include "llvm/Instructions.h" -#include "llvm/ParameterAttributes.h" #include "llvm/Value.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DepthFirstIterator.h" @@ -32,11 +30,8 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/Target/TargetData.h" #include using namespace llvm; @@ -667,10 +662,8 @@ AU.addRequired(); AU.addRequired(); AU.addRequired(); - AU.addRequired(); AU.addPreserved(); AU.addPreserved(); - AU.addPreserved(); } // Helper fuctions From resistor at mac.com Mon Apr 21 02:51:08 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 21 Apr 2008 07:51:08 -0000 Subject: [llvm-commits] [llvm] r50036 - in /llvm/trunk/tools: lto/lto.cpp lto2/LTOCodeGenerator.cpp Message-ID: <200804210751.m3L7p8MK001334@zion.cs.uiuc.edu> Author: resistor Date: Mon Apr 21 02:51:07 2008 New Revision: 50036 URL: http://llvm.org/viewvc/llvm-project?rev=50036&view=rev Log: Use GVN in LTO instead of GCSE+LoadVN. Modified: llvm/trunk/tools/lto/lto.cpp llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=50036&r1=50035&r2=50036&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Mon Apr 21 02:51:07 2008 @@ -330,8 +330,7 @@ Passes.add(createGlobalsModRefPass()); // IP alias analysis Passes.add(createLICMPass()); // Hoist loop invariants - Passes.add(createLoadValueNumberingPass()); // GVN for load instrs - Passes.add(createGCSEPass()); // Remove common subexprs + Passes.add(createGVNPass()); // Remove common subexprs Passes.add(createDeadStoreEliminationPass()); // Nuke dead stores // Cleanup and simplify the code after the scalar optimizations. Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=50036&r1=50035&r2=50036&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Mon Apr 21 02:51:07 2008 @@ -377,8 +377,7 @@ passes.add(createGlobalsModRefPass()); // IP alias analysis passes.add(createLICMPass()); // Hoist loop invariants - passes.add(createLoadValueNumberingPass()); // GVN for load instrs - passes.add(createGCSEPass()); // Remove common subexprs + passes.add(createGVNPass()); // Remove common subexprs passes.add(createDeadStoreEliminationPass()); // Nuke dead stores // Cleanup and simplify the code after the scalar optimizations. From baldrick at free.fr Mon Apr 21 03:12:03 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Apr 2008 08:12:03 -0000 Subject: [llvm-commits] [llvm] r50037 - /llvm/trunk/test/CFrontend/2007-05-07-NestedStructReturn.c Message-ID: <200804210812.m3L8C35F001891@zion.cs.uiuc.edu> Author: baldrick Date: Mon Apr 21 03:12:03 2008 New Revision: 50037 URL: http://llvm.org/viewvc/llvm-project?rev=50037&view=rev Log: Make the struct bigger, to ensure it is returned by struct return. Modified: llvm/trunk/test/CFrontend/2007-05-07-NestedStructReturn.c Modified: llvm/trunk/test/CFrontend/2007-05-07-NestedStructReturn.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-05-07-NestedStructReturn.c?rev=50037&r1=50036&r2=50037&view=diff ============================================================================== --- llvm/trunk/test/CFrontend/2007-05-07-NestedStructReturn.c (original) +++ llvm/trunk/test/CFrontend/2007-05-07-NestedStructReturn.c Mon Apr 21 03:12:03 2008 @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -S -fnested-functions -o - | grep {sret *%agg.result} -struct X { int m, n, o, p; }; +struct X { long m, n, o, p; }; struct X p(int n) { struct X c(int m) { From baldrick at free.fr Mon Apr 21 03:17:05 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Apr 2008 08:17:05 -0000 Subject: [llvm-commits] [llvm] r50038 - in /llvm/trunk/test/CFrontend: sret.c sret2.c Message-ID: <200804210817.m3L8H5vn002046@zion.cs.uiuc.edu> Author: baldrick Date: Mon Apr 21 03:17:05 2008 New Revision: 50038 URL: http://llvm.org/viewvc/llvm-project?rev=50038&view=rev Log: Make these structs larger to ensure that they are returned by struct return. Modified: llvm/trunk/test/CFrontend/sret.c llvm/trunk/test/CFrontend/sret2.c Modified: llvm/trunk/test/CFrontend/sret.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/sret.c?rev=50038&r1=50037&r2=50038&view=diff ============================================================================== --- llvm/trunk/test/CFrontend/sret.c (original) +++ llvm/trunk/test/CFrontend/sret.c Mon Apr 21 03:17:05 2008 @@ -1,9 +1,9 @@ // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep sret | count 5 struct abc { - int a; - int b; - int c; + long a; + long b; + long c; }; struct abc foo1(void); Modified: llvm/trunk/test/CFrontend/sret2.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/sret2.c?rev=50038&r1=50037&r2=50038&view=diff ============================================================================== --- llvm/trunk/test/CFrontend/sret2.c (original) +++ llvm/trunk/test/CFrontend/sret2.c Mon Apr 21 03:17:05 2008 @@ -1,9 +1,9 @@ // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep sret | count 2 struct abc { - int a; - int b; - int c; + long a; + long b; + long c; }; struct abc foo2(){} From baldrick at free.fr Mon Apr 21 03:25:58 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Apr 2008 08:25:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50039 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200804210825.m3L8Pwcx002314@zion.cs.uiuc.edu> Author: baldrick Date: Mon Apr 21 03:25:57 2008 New Revision: 50039 URL: http://llvm.org/viewvc/llvm-project?rev=50039&view=rev Log: Fix PR2244. Run the inliner if flag_inline_trees is set, and not only if flag_inline_trees > 1. This copies the logic used by the gcc optimizers: only front-ends pay any attention to whether flag_inline_trees contains 1 or 2, the middle-end only cares whether it is 0 or not zero. While there, reposition the StripDeadPrototypes past so that it is run at the same point as in opt, and add a StripDeadTypes pass like in opt. Chris did suggest not bothering to run these passes because dead prototypes and types tend not to be generated by llvm-gcc in the first place, but for the moment let's try it this way. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=50039&r1=50038&r2=50039&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Apr 21 03:25:57 2008 @@ -356,14 +356,15 @@ if (flag_unit_at_a_time && flag_exceptions) PM->add(createPruneEHPass()); // Remove dead EH info + if (flag_inline_trees) // respect -fno-inline-functions + PM->add(createFunctionInliningPass()); // Inline small functions + if (optimize > 1) { - if (flag_inline_trees > 1) // respect -fno-inline-functions - PM->add(createFunctionInliningPass()); // Inline small functions if (flag_unit_at_a_time && !lang_hooks.flag_no_builtin()) PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations if (optimize > 2) - PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args + PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args } PM->add(createTailDuplicationPass()); // Simplify cfg by copying code @@ -396,10 +397,14 @@ PM->add(createDeadStoreEliminationPass()); // Delete dead stores PM->add(createAggressiveDCEPass()); // SSA based 'Aggressive DCE' PM->add(createCFGSimplificationPass()); // Merge & remove BBs - + + if (flag_unit_at_a_time) { + PM->add(createStripDeadPrototypesPass()); // Get rid of dead prototypes + PM->add(createDeadTypeEliminationPass()); // Eliminate dead types + } + if (optimize > 1 && flag_unit_at_a_time) PM->add(createConstantMergePass()); // Merge dup global constants - PM->add(createStripDeadPrototypesPass()); // Get rid of dead prototypes } if (emit_llvm_bc) { From baldrick at free.fr Mon Apr 21 05:57:21 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Apr 2008 10:57:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50040 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200804211057.m3LAvM6i007378@zion.cs.uiuc.edu> Author: baldrick Date: Mon Apr 21 05:57:15 2008 New Revision: 50040 URL: http://llvm.org/viewvc/llvm-project?rev=50040&view=rev Log: Fix the x86-64 Ada build. The problem was an aggregate to scalar view conversion. The source was of a variable-sized type which converted to i8. The target was an i16 scalar. The original code created a temporary using the source type (i8) which caused the 16 bit reads and writes to it to smash the following stack variable. Now the temporary is created using the target type. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=50040&r1=50039&r2=50040&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Apr 21 05:57:15 2008 @@ -2911,16 +2911,17 @@ tree Op = TREE_OPERAND(exp, 0); if (isAggregateTreeType(TREE_TYPE(Op))) { - const Type *OpTy = ConvertType(TREE_TYPE(Op)); MemRef Target; - if (DestLoc) { + if (DestLoc) // This is an aggregate-to-agg VIEW_CONVERT_EXPR, just evaluate in place. Target = *DestLoc; - Target.Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(OpTy)); - } else { + else // This is an aggregate-to-scalar VIEW_CONVERT_EXPR, evaluate, then load. - Target = CreateTempLoc(OpTy); - } + Target = CreateTempLoc(ConvertType(TREE_TYPE(exp))); + + // Make the destination look like the source type. + const Type *OpTy = ConvertType(TREE_TYPE(Op)); + Target.Ptr = BitCastToType(Target.Ptr, PointerType::getUnqual(OpTy)); // Needs to be in sync with EmitLV. switch (TREE_CODE(Op)) { From neil at daikokuya.co.uk Mon Apr 21 08:29:48 2008 From: neil at daikokuya.co.uk (Neil Booth) Date: Mon, 21 Apr 2008 22:29:48 +0900 Subject: [llvm-commits] [llvm] r49994 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: References: <200804201823.m3KINktj002167@zion.cs.uiuc.edu> <20080420230519.GO18285@daikokuya.co.uk> Message-ID: <20080421132948.GQ18285@daikokuya.co.uk> Dale Johannesen wrote:- > > On Apr 20, 2008, at 4:05 PM, Neil Booth wrote: > > > Dale Johannesen wrote:- > > > >> Author: johannes > >> Date: Sun Apr 20 13:23:46 2008 > >> New Revision: 49994 > >> > >> URL: http://llvm.org/viewvc/llvm-project?rev=49994&view=rev > >> Log: > >> Check we aren't trying to convert PPC long double. > >> This fixes the testsuite failure on ppcf128-4.ll. > > > > Converting to IEEE single and double should be fairly straightforward > > to implement, no? > > Yes, there just isn't much interest in having compile-time > optimizations on this type. OK, that's cool. I'll spend no more time thinking about it :) Neil. From nicolas.geoffray at lip6.fr Mon Apr 21 09:23:16 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 21 Apr 2008 14:23:16 -0000 Subject: [llvm-commits] [vmkit] r50041 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaJIT.cpp JavaJIT.h JavaJITInitialise.cpp JavaJITOpcodes.cpp JavaRuntimeJIT.cpp Message-ID: <200804211423.m3LENGQt015336@zion.cs.uiuc.edu> Author: geoffray Date: Mon Apr 21 09:23:15 2008 New Revision: 50041 URL: http://llvm.org/viewvc/llvm-project?rev=50041&view=rev Log: Do not resolve classes on readExceptionTable, and do not clinit classes on INSTANCEOF and CHECKCAST opcodes execution. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50041&r1=50040&r2=50041&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Apr 21 09:23:15 2008 @@ -381,7 +381,7 @@ compilingClass->isolate->module); compilingClass->isolate->protectModule->unlock(); - currentBlock = createBasicBlock("start"); + BasicBlock* startBlock = currentBlock = createBasicBlock("start"); endExceptionBlock = createBasicBlock("endExceptionBlock"); unifiedUnreachable = createBasicBlock("unifiedUnreachable"); @@ -404,6 +404,8 @@ unsigned nbe = readExceptionTable(reader); + currentBlock = startBlock; + for (int i = 0; i < maxLocals; i++) { intLocals.push_back(new AllocaInst(Type::Int32Ty, "", currentBlock)); doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "", currentBlock)); @@ -602,10 +604,11 @@ ex->endpc = reader->readU2(); ex->handlerpc = reader->readU2(); - uint16 catche = reader->readU2(); + ex->catche = reader->readU2(); - if (catche) { - ex->catchClass = (Class*)ctpInfo->loadClass(catche); + if (ex->catche) { + Class* cl = (Class*)(ctpInfo->getMethodClassIfLoaded(ex->catche)); + ex->catchClass = cl; } else { ex->catchClass = Classpath::newThrowable; } @@ -664,6 +667,8 @@ Exception* next = 0; BasicBlock* bbNext = 0; PHINode* nodeNext = 0; + currentExceptionBlock = opcodeInfos[cur->handlerpc].exceptionBlock; + if (i + 1 != e) { next = *(i + 1); if (!(cur->startpc >= next->startpc && cur->endpc <= next->endpc)) { @@ -695,17 +700,22 @@ } Module* M = compilingClass->isolate->module; - Value* cl = new LoadInst(cur->catchClass->llvmVar(M), "", cur->realTest); + Value* cl = 0; + currentBlock = cur->realTest; + if (cur->catchClass) + cl = new LoadInst(cur->catchClass->llvmVar(M), "", currentBlock); + else + cl = getResolvedClass(cur->catche, false); Value* cmp = llvm::CallInst::Create(compareExceptionLLVM, cl, "", - cur->realTest); - llvm::BranchInst::Create(cur->handler, bbNext, cmp, cur->realTest); + currentBlock); + llvm::BranchInst::Create(cur->handler, bbNext, cmp, currentBlock); if (nodeNext) - nodeNext->addIncoming(cur->exceptionPHI, cur->realTest); + nodeNext->addIncoming(cur->exceptionPHI, currentBlock); if (cur->handler->empty()) { cur->handlerPHI = llvm::PHINode::Create(mvm::jit::ptrType, "", cur->handler); - cur->handlerPHI->addIncoming(cur->exceptionPHI, cur->realTest); + cur->handlerPHI->addIncoming(cur->exceptionPHI, currentBlock); Value* exc = llvm::CallInst::Create(getJavaExceptionLLVM, "", cur->handler); llvm::CallInst::Create(clearExceptionLLVM, "", cur->handler); @@ -718,7 +728,7 @@ new StoreInst(exc, supplLocal, false, cur->handler); } else { Instruction* insn = cur->handler->begin(); - ((PHINode*)insn)->addIncoming(cur->exceptionPHI, cur->realTest); + ((PHINode*)insn)->addIncoming(cur->exceptionPHI, currentBlock); } } @@ -1298,7 +1308,7 @@ } } -Value* JavaJIT::getInitializedClass(uint16 index) { +Value* JavaJIT::getResolvedClass(uint16 index, bool clinit) { const Type* PtrTy = mvm::jit::ptrType; compilingClass->isolate->protectModule->lock(); GlobalVariable * gv = @@ -1331,6 +1341,11 @@ mvm::jit::unprotectConstants(); Args.push_back(CI); Args.push_back(gv); + if (clinit) { + Args.push_back(mvm::jit::constantOne); + } else { + Args.push_back(mvm::jit::constantZero); + } Value* res = invoke(newLookupLLVM, Args, "", currentBlock); node->addIncoming(res, currentBlock); @@ -1355,7 +1370,7 @@ #endif Value* val = 0; if (!cl || !cl->isReady()) { - Value* node = getInitializedClass(index); + Value* node = getResolvedClass(index, true); #ifndef MULTIPLE_VM val = invoke(doNewUnknownLLVM, node, "", currentBlock); #else Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h?rev=50041&r1=50040&r2=50041&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h Mon Apr 21 09:23:15 2008 @@ -48,7 +48,7 @@ uint32 startpc; uint32 endpc; uint32 handlerpc; - uint16 index; + uint16 catche; Class* catchClass; llvm::BasicBlock* test; llvm::BasicBlock* realTest; @@ -171,7 +171,7 @@ llvm::Value* ldResolved(uint16 index, bool stat, llvm::Value* object, const llvm::Type* fieldType, const llvm::Type* fieldTypePtr); - llvm::Value* getInitializedClass(uint16 index); + llvm::Value* getResolvedClass(uint16 index, bool clinit); // methods invoke void makeArgs(llvm::FunctionType::param_iterator it, Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp?rev=50041&r1=50040&r2=50041&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Mon Apr 21 09:23:15 2008 @@ -313,6 +313,7 @@ args.push_back(mvm::jit::ptrType); args.push_back(Type::Int32Ty); args.push_back(PointerType::getUnqual(mvm::jit::ptrType)); + args.push_back(Type::Int32Ty); const FunctionType* type = FunctionType::get(mvm::jit::ptrType, args, false); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=50041&r1=50040&r2=50041&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Mon Apr 21 09:23:15 2008 @@ -1852,7 +1852,7 @@ if (dcl && dcl->isReady()) { clVar = new LoadInst(dcl->llvmVar(compilingClass->isolate->module), "", ifFalse); } else { - clVar = getInitializedClass(index); + clVar = getResolvedClass(index, false); } std::vector args; args.push_back(obj); @@ -1889,7 +1889,7 @@ if (dcl && dcl->isReady()) { clVar = new LoadInst(dcl->llvmVar(compilingClass->isolate->module), "", currentBlock); } else { - clVar = getInitializedClass(index); + clVar = getResolvedClass(index, false); } std::vector args; args.push_back(pop()); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=50041&r1=50040&r2=50041&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Mon Apr 21 09:23:15 2008 @@ -228,10 +228,11 @@ p = (void*)&runtimeUTF8ToStr; } -extern "C" Class* newLookup(Class* caller, uint32 index, Class** toAlloc) { +extern "C" Class* newLookup(Class* caller, uint32 index, Class** toAlloc, + uint32 clinit) { JavaCtpInfo* ctpInfo = caller->ctpInfo; Class* cl = (Class*)ctpInfo->loadClass(index); - cl->resolveClass(true); + cl->resolveClass(clinit); *toAlloc = cl; return cl; From criswell at uiuc.edu Mon Apr 21 09:53:58 2008 From: criswell at uiuc.edu (John Criswell) Date: Mon, 21 Apr 2008 14:53:58 -0000 Subject: [llvm-commits] [poolalloc] r50042 - /poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Message-ID: <200804211453.m3LErxwp016673@zion.cs.uiuc.edu> Author: criswell Date: Mon Apr 21 09:53:58 2008 New Revision: 50042 URL: http://llvm.org/viewvc/llvm-project?rev=50042&view=rev Log: Added support for strdup(). Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=50042&r1=50041&r2=50042&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Apr 21 09:53:58 2008 @@ -259,6 +259,39 @@ // Update def-use info CI->replaceAllUsesWith(Casted); + } else if (CF && (CF->isDeclaration()) && (CF->getName() == "strdup")) { + // Associate the global pool decriptor with the DSNode + DSNode * Node = ECG.getNodeForValue(CI).getNode(); + FInfo.PoolDescriptors.insert(make_pair(Node,TheGlobalPool)); + + // Mark the realloc as an instruction to delete + toDelete.push_back(ii); + + // Insertion point - Instruction before which all our instructions go + Instruction *InsertPt = CI; + Value *OldPtr = CS.getArgument(0); + + // Ensure the size and pointer arguments are of the correct type + static Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); + if (OldPtr->getType() != VoidPtrTy) + OldPtr = CastInst::createPointerCast (OldPtr, + VoidPtrTy, + OldPtr->getName(), + InsertPt); + + std::string Name = CI->getName(); CI->setName(""); + Value* Opts[2] = {TheGlobalPool, OldPtr}; + Instruction *V = CallInst::Create (PoolStrdup, + Opts, + Opts + 3, + Name, + InsertPt); + Instruction *Casted = V; + if (V->getType() != CI->getType()) + Casted = CastInst::createPointerCast (V, CI->getType(), V->getName(), InsertPt); + + // Update def-use info + CI->replaceAllUsesWith(Casted); } } else if (FreeInst * FI = dyn_cast(ii)) { Type * VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); From gohman at apple.com Mon Apr 21 10:47:05 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Apr 2008 08:47:05 -0700 (PDT) Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: <200804211704.47056.Bart.Coppens@elis.ugent.be> References: <200804211704.47056.Bart.Coppens@elis.ugent.be> Message-ID: <43975.76.126.219.198.1208792825.squirrel@webmail.apple.com> On Fri, April 18, 2008 11:04 pm, Roman Levenstein wrote: > Hi Dan, Hi Evan, > > 2008/4/19, Dan Gohman : >> >> On Apr 16, 2008, at 9:19 AM, Roman Levenstein wrote: >> > >> >> > BTW, Dan, have you had any time to look at the patch introducing >> > queues instead of heaps in the target specific instruction selectors? >> >> >> Is this the ScheduleDAGRRList patch that changes std::priority_queue >> to std::set? I know you checked in part of those changes already; >> could you send me an updated patch with just the outstanding changes? > > No. I don't mean the ScheduleDAGRRList.pacth. For this one, I proposed > the remaining patch just with the outstanding patches yesterday (see > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080414/061236.html). > And it is also about using the std::set :-) Ok. Thanks for the reminder. > > The patch for instruction selectors was proposed by me here: > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080303/059215.html > It is related to the Select() and SelectRoot implementations inside > the target-specific code selectors generated by tablegen. > > Regarding my questions about std::set vs std;;multiset in the mentioned > patch: > Having looked into it again, I have the impression that std::set could > be used and there is no need for std::multiset. Basically, the this > code: > void AddToISelQueue(SDOperand N) DISABLE_INLINE { > int Id = N.Val->getNodeId(); > if (Id != -1 && !isQueued(Id)) { > ... > } > ensures that only one node with a given NodeId can be inserted into > the ISelQueue. > > One possible further improvement, I'm thinking about is the following: > Why do we use a sorted data structure (e.g. sorted vector, set) for > the ISelQueue at all? > > 1) If we look into the SelectRoot logic, it basically takes the node > with the SMALLEST NodeId from the pending selection queue. > 2) More over, it seems to me (please, confirm if it is true!) that the > next node taken for selection in the loop inside the SelectRoot, at > any point in time, has a NodeId that is GREATER than the NodeId of the > last selected node. > 3) Even if the selection of the node puts new nodes into the selection > queue, they ALWAYS have NodeIds GREATER than that of this node. > Therefore the property (2) is preserved. > > I checked (2) and (3) by adding some debug output to the SelectRoot. > Only one test of all llvm/test test-cases does not fulfill this > assumptions and even there it is not quite obvious if it is a > contradiction to (2) and (3) or a bug. > > So, assuming that properties (2) and (3) do hold, the following can be > probably done: > - We iterate over the NodeId numbers from 0 till the DAGSize. > - We check if a Node with a given NodeId (by looking into the > TopOrder???), if isQueued(NodeId) is true, i.e. this is in the queue > - We then check if isSelected(NodeId) is true or false and call > Select() for this node, if it is not selected yet. > - If a new node needs to be inserted into the queue, only > setQueued(NodeId) is called > > With these changes, no online sorting would be required at all, which > is a great improvement over the current approach. > > What do you think about it? Is it a correct analysis? It sounds plausible :-). I think you have to watch out for the case where nodes get created during the isel process. I'm aware of one place that does this, in X86ISelDAGToDAG.cpp around line 870. It appears to set the NodeId values for the new nodes, but it doesn't currently update TopOrder or call ReplaceAllUses; perhaps that could be fixed. Offhand, I don't know if there are any other places. I also don't know if the current code was written with grander plans in mind that would require a priority queue instead of just using the pre-computed topological ordering. Dan From romix.llvm at googlemail.com Mon Apr 21 10:48:54 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Mon, 21 Apr 2008 16:48:54 +0100 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <83CD954F-CD49-4D4B-950D-B6CB6CD1B32D@apple.com> <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> Message-ID: Hi, 2008/4/19, Roman Levenstein : > Hi Dan, Hi Evan, > > 2008/4/19, Dan Gohman : > > > > > On Apr 16, 2008, at 9:19 AM, Roman Levenstein wrote: > > > > > > > > BTW, Dan, have you had any time to look at the patch introducing > > > queues instead of heaps in the target specific instruction selectors? > > > > > > Is this the ScheduleDAGRRList patch that changes std::priority_queue > > to std::set? I know you checked in part of those changes already; > > could you send me an updated patch with just the outstanding changes? > > > No. I don't mean the ScheduleDAGRRList.pacth. For this one, I proposed > the remaining patch just with the outstanding patches yesterday (see > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080414/061236.html). > And it is also about using the std::set :-) > > The patch for instruction selectors was proposed by me here: > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080303/059215.html > It is related to the Select() and SelectRoot implementations inside > the target-specific code selectors generated by tablegen. > > Regarding my questions about std::set vs std;;multiset in the mentioned patch: > Having looked into it again, I have the impression that std::set could > be used and there is no need for std::multiset. Basically, the this > code: > void AddToISelQueue(SDOperand N) DISABLE_INLINE { > int Id = N.Val->getNodeId(); > if (Id != -1 && !isQueued(Id)) { > ... > } > ensures that only one node with a given NodeId can be inserted into > the ISelQueue. > > One possible further improvement, I'm thinking about is the following: > Why do we use a sorted data structure (e.g. sorted vector, set) for > the ISelQueue at all? > > 1) If we look into the SelectRoot logic, it basically takes the node > with the SMALLEST NodeId from the pending selection queue. > 2) More over, it seems to me (please, confirm if it is true!) that the > next node taken for selection in the loop inside the SelectRoot, at > any point in time, has a NodeId that is GREATER than the NodeId of the > last selected node. > 3) Even if the selection of the node puts new nodes into the selection > queue, they ALWAYS have NodeIds GREATER than that of this node. > Therefore the property (2) is preserved. > > I checked (2) and (3) by adding some debug output to the SelectRoot. > Only one test of all llvm/test test-cases does not fulfill this > assumptions and even there it is not quite obvious if it is a > contradiction to (2) and (3) or a bug. > > So, assuming that properties (2) and (3) do hold, the following can be > probably done: > - We iterate over the NodeId numbers from 0 till the DAGSize. > - We check if a Node with a given NodeId (by looking into the > TopOrder???), if isQueued(NodeId) is true, i.e. this is in the queue > - We then check if isSelected(NodeId) is true or false and call > Select() for this node, if it is not selected yet. > - If a new node needs to be inserted into the queue, only > setQueued(NodeId) is called > > With these changes, no online sorting would be required at all, which > is a great improvement over the current approach. > > What do you think about it? Is it a correct analysis? I created a working implementation based on these I ideas. Now all llvm/test test-cases pass it. Please find it in the attached patch. The patch is rather ugly and uses a lot of #ifdefs, but I think it is OK for a proof of concept. Short explanation for the macros: OLD - enables old-style selector queue, using heaps. Can be used to have a step-by-step comparison with std::set based approach. USE_QUEUE - enables std::set based approach NO_QUEUE - enables the implementation that does not use any special sorted queue at all, as outlined in the previous mail. (Note: USE_QUEUE should not be used at the same time as NO_QUEUE) Both USE_QUEUE and NO_QUEUE modes speed-up the instruction selection significantly (on my test compilation time goes down from 12 to 9 seconds). I'm very interested in your comments about this approach. -Roman From romix.llvm at googlemail.com Mon Apr 21 10:51:53 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Mon, 21 Apr 2008 16:51:53 +0100 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <83CD954F-CD49-4D4B-950D-B6CB6CD1B32D@apple.com> <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> Message-ID: Sorry, forgot to attach the patch ;-) 2008/4/21, Roman Levenstein : > Hi, > > 2008/4/19, Roman Levenstein : > > > Hi Dan, Hi Evan, > > > > 2008/4/19, Dan Gohman : > > > > > > > > On Apr 16, 2008, at 9:19 AM, Roman Levenstein wrote: > > > > > > > > > > > BTW, Dan, have you had any time to look at the patch introducing > > > > queues instead of heaps in the target specific instruction selectors? > > > > > > > > > Is this the ScheduleDAGRRList patch that changes std::priority_queue > > > to std::set? I know you checked in part of those changes already; > > > could you send me an updated patch with just the outstanding changes? > > > > > > No. I don't mean the ScheduleDAGRRList.pacth. For this one, I proposed > > the remaining patch just with the outstanding patches yesterday (see > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080414/061236.html). > > And it is also about using the std::set :-) > > > > The patch for instruction selectors was proposed by me here: > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080303/059215.html > > It is related to the Select() and SelectRoot implementations inside > > the target-specific code selectors generated by tablegen. > > > > Regarding my questions about std::set vs std;;multiset in the mentioned patch: > > Having looked into it again, I have the impression that std::set could > > be used and there is no need for std::multiset. Basically, the this > > code: > > void AddToISelQueue(SDOperand N) DISABLE_INLINE { > > int Id = N.Val->getNodeId(); > > if (Id != -1 && !isQueued(Id)) { > > ... > > } > > ensures that only one node with a given NodeId can be inserted into > > the ISelQueue. > > > > One possible further improvement, I'm thinking about is the following: > > Why do we use a sorted data structure (e.g. sorted vector, set) for > > the ISelQueue at all? > > > > 1) If we look into the SelectRoot logic, it basically takes the node > > with the SMALLEST NodeId from the pending selection queue. > > 2) More over, it seems to me (please, confirm if it is true!) that the > > next node taken for selection in the loop inside the SelectRoot, at > > any point in time, has a NodeId that is GREATER than the NodeId of the > > last selected node. > > 3) Even if the selection of the node puts new nodes into the selection > > queue, they ALWAYS have NodeIds GREATER than that of this node. > > Therefore the property (2) is preserved. > > > > I checked (2) and (3) by adding some debug output to the SelectRoot. > > Only one test of all llvm/test test-cases does not fulfill this > > assumptions and even there it is not quite obvious if it is a > > contradiction to (2) and (3) or a bug. > > > > So, assuming that properties (2) and (3) do hold, the following can be > > probably done: > > - We iterate over the NodeId numbers from 0 till the DAGSize. > > - We check if a Node with a given NodeId (by looking into the > > TopOrder???), if isQueued(NodeId) is true, i.e. this is in the queue > > - We then check if isSelected(NodeId) is true or false and call > > Select() for this node, if it is not selected yet. > > - If a new node needs to be inserted into the queue, only > > setQueued(NodeId) is called > > > > With these changes, no online sorting would be required at all, which > > is a great improvement over the current approach. > > > > What do you think about it? Is it a correct analysis? > > > I created a working implementation based on these I ideas. Now all > llvm/test test-cases pass it. Please find it in the attached patch. > The patch is rather ugly and uses a lot of #ifdefs, but I think it is > OK for a proof of concept. > > Short explanation for the macros: > OLD - enables old-style selector queue, using heaps. Can be used to > have a step-by-step comparison with std::set based approach. > USE_QUEUE - enables std::set based approach > NO_QUEUE - enables the implementation that does not use any special > sorted queue at all, as outlined in the previous mail. > (Note: USE_QUEUE should not be used at the same time as NO_QUEUE) > > Both USE_QUEUE and NO_QUEUE modes speed-up the instruction selection > significantly (on my test compilation time goes down from 12 to 9 > seconds). > > I'm very interested in your comments about this approach. > > > -Roman > -------------- next part -------------- A non-text attachment was scrubbed... Name: X86GenDAGISel.patch Type: text/x-patch Size: 9519 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080421/a1d42002/attachment.bin From sabre at nondot.org Mon Apr 21 11:24:16 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Apr 2008 16:24:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50043 - /llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Message-ID: <200804211624.m3LGOGbK020099@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 11:24:16 2008 New Revision: 50043 URL: http://llvm.org/viewvc/llvm-project?rev=50043&view=rev Log: Fix apple-style build. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=50043&r1=50042&r2=50043&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Mon Apr 21 11:24:16 2008 @@ -72,6 +72,7 @@ llvm::createCondPropagationPass(); llvm::createGlobalOptimizerPass(); llvm::createTailDuplicationPass(); + llvm::createJumpThreadingPass(); llvm::createFunctionInliningPass(); llvm::createRaiseAllocationsPass(); llvm::createSimplifyLibCallsPass(); From sabre at nondot.org Mon Apr 21 11:25:30 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Apr 2008 16:25:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50044 - /llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Message-ID: <200804211625.m3LGPUV5020175@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 11:25:30 2008 New Revision: 50044 URL: http://llvm.org/viewvc/llvm-project?rev=50044&view=rev Log: One more missing one. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=50044&r1=50043&r2=50044&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Mon Apr 21 11:25:30 2008 @@ -84,6 +84,7 @@ llvm::createIPConstantPropagationPass(); llvm::createStripDeadPrototypesPass(); llvm::createMemCpyOptPass(); + llvm::createDeadTypeEliminationPass(); } /* LLVM LOCAL end (ENTIRE FILE!) */ From criswell at uiuc.edu Mon Apr 21 11:35:16 2008 From: criswell at uiuc.edu (John Criswell) Date: Mon, 21 Apr 2008 16:35:16 -0000 Subject: [llvm-commits] [poolalloc] r50045 - /poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Message-ID: <200804211635.m3LGZGO8020571@zion.cs.uiuc.edu> Author: criswell Date: Mon Apr 21 11:35:16 2008 New Revision: 50045 URL: http://llvm.org/viewvc/llvm-project?rev=50045&view=rev Log: Pass the correct number of arguments to poolstrdup(). Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=50045&r1=50044&r2=50045&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Apr 21 11:35:16 2008 @@ -283,7 +283,7 @@ Value* Opts[2] = {TheGlobalPool, OldPtr}; Instruction *V = CallInst::Create (PoolStrdup, Opts, - Opts + 3, + Opts + 2, Name, InsertPt); Instruction *Casted = V; From baldrick at free.fr Mon Apr 21 11:49:09 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Apr 2008 16:49:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50046 - /llvm-gcc-4.2/trunk/gcc/ada/make.adb Message-ID: <200804211649.m3LGn9mQ020952@zion.cs.uiuc.edu> Author: baldrick Date: Mon Apr 21 11:49:08 2008 New Revision: 50046 URL: http://llvm.org/viewvc/llvm-project?rev=50046&view=rev Log: Fix PR2237: have gnatmake pass -emit-llvm to the compiler. Modified: llvm-gcc-4.2/trunk/gcc/ada/make.adb Modified: llvm-gcc-4.2/trunk/gcc/ada/make.adb URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ada/make.adb?rev=50046&r1=50045&r2=50046&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ada/make.adb (original) +++ llvm-gcc-4.2/trunk/gcc/ada/make.adb Mon Apr 21 11:49:08 2008 @@ -7384,6 +7384,14 @@ -- unless we are dealing with a debug switch (starts with 'd') -- or an extended gnatmake switch (starts with 'e'). + -- LLVM local begin + elsif Argv'Length >= 10 and then Argv (2 .. 10) = "emit-llvm" then + + -- Pass -emit-llvm and -emit-llvm-bc to the Compiler + + Add_Switch (Argv, Compiler, And_Save => And_Save); + + -- LLVM local end elsif Argv (2) /= 'd' and then Argv (2) /= 'e' and then Argv (2 .. Argv'Last) /= "C" From evan.cheng at apple.com Mon Apr 21 13:12:54 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Apr 2008 11:12:54 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <00FB5805-1FA5-4534-BBD0-E6E34EC17BF1@apple.com> <84648A85-6EB1-4FE5-96B4-749BD5A8D938@apple.com> <039F7990-10A9-4153-A91B-024551DF3541@apple.com> <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> Message-ID: <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> + if (left->NodeQueueId && right->NodeQueueId) + return (left->NodeQueueId < right->NodeQueueId); + return left->NodeNum < right->NodeNum; Why would NodeQueueId ever be zero? Nodes that are entered into the queue must have this field set, no? Evan On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > Hi Evan, > > 2008/4/2, Evan Cheng : >> >> On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: >> >>> 2008/4/2, Evan Cheng : >>>> >>>> On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: >>>> >>>>> Hi Evan, >>>>> >>>>> 2008/4/1, Evan Cheng : >>>>>> Please hold off checking it in for a bit. llvm tot is having some >>>>>> problems and I'd like to get to the bottom of it first. >>>>> >>>>> OK. >>>>> >>>>>> Also, the tie breaker is less than ideal. I think we need a tie- >>>>>> breaker that is "the SUnit that's added to the queue is >>>>>> preferred". >>>>>> That means it prefers nodes which are closer to the end of block. >>>>>> What >>>>>> do you think? >>>>> >>>>> Do you actually mean "the SUnit that's added to the queue LAST (or >>>>> FIRST) is preferred"? I'll think about it. >>>> >>>> >>>> Yep "first". Basically, if all else being equal, let the node >>>> that's >>>> ready first be scheduled first. We can add a order id to SUnit >>>> which >>>> gets set when it's pushed into the ready queue. What do you think? >>> >>> Makes sense. The queue should have a global "current id" counter. >>> Its >>> current value is assigned to each node being inserted into the ready >>> queue and then incremented. When the node is removed from the queue >>> for any reason, its queue order id is reset. It should be rather >>> easy >>> to implement. > >>> BTW, do you really want this queue order id in the SUnit or in a >>> separate array indexed by SUnit unique ids? >> >> >> It should be in SUnit since the sort functions don't have access to >> ScheduleDAG members. > > Please find and review the attached patch implementing: > - a proper tie-breaker as discussed above. > - and unmodified part for replacing the slow std::priority_queue by > std::set, as it I already did before. > > What do you think? > > -Roman > From clattner at apple.com Mon Apr 21 13:13:09 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Apr 2008 11:13:09 -0700 Subject: [llvm-commits] [llvm] r50034 - in /llvm/trunk: lib/Transforms/Scalar/MemCpyOptimizer.cpp test/Transforms/MemCpyOpt/form-memset.ll test/Transforms/MemCpyOpt/form-memset2.ll In-Reply-To: <200804210745.m3L7jBq0001144@zion.cs.uiuc.edu> References: <200804210745.m3L7jBq0001144@zion.cs.uiuc.edu> Message-ID: <9E6ED1AC-68CF-4436-B98A-72EA58A6D949@apple.com> On Apr 21, 2008, at 12:45 AM, Owen Anderson wrote: > Author: resistor > Date: Mon Apr 21 02:45:10 2008 > New Revision: 50034 > > URL: http://llvm.org/viewvc/llvm-project?rev=50034&view=rev > Log: > Refactor memcpyopt based on Chris' suggestions. Consolidate several > functions > and simplify code that was fallout from the separation of memcpyopt > and gvn. Thanks Owen! -Chris From sabre at nondot.org Mon Apr 21 13:25:01 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Apr 2008 18:25:01 -0000 Subject: [llvm-commits] [llvm] r50047 - /llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Message-ID: <200804211825.m3LIP1L2023819@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 13:25:01 2008 New Revision: 50047 URL: http://llvm.org/viewvc/llvm-project?rev=50047&view=rev Log: fix grammar-o, thanks to Duncan for noticing. Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50047&r1=50046&r2=50047&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Mon Apr 21 13:25:01 2008 @@ -142,7 +142,7 @@ return false; // Must be an invoke. // If the terminator of this block is branching on a constant, simplify the - // terminator to an unconditional branch. This can occur do to threading in + // terminator to an unconditional branch. This can occur due to threading in // other blocks. if (isa(Condition)) { DOUT << " In block '" << BB->getNameStart() From isanbard at gmail.com Mon Apr 21 13:42:08 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Apr 2008 18:42:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50048 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200804211842.m3LIg9sX024276@zion.cs.uiuc.edu> Author: void Date: Mon Apr 21 13:42:08 2008 New Revision: 50048 URL: http://llvm.org/viewvc/llvm-project?rev=50048&view=rev Log: Another case where LLVM is keeping array notation around and it was confusing the ObjC FE which expects such things to be done in pointer arithmetic. In this case, we had something like the following: @interface Bork : NSObject { @private CFMutableDictionaryRef _f1; __strong Info* __f2; } - (void) foo:(NSString*)name; @end @implementation Bork - (void)foo:(NSString*)name { __f2[0].name = [name copy]; } @end When compiled with -fobjc-gc, it would assign to __f2 instead of __f2[0].name. That is bad. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=50048&r1=50047&r2=50048&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Apr 21 13:42:08 2008 @@ -6498,6 +6498,36 @@ } /* This comment appeases the checklocal daemon. */ /* APPLE LOCAL end radar 4982951 */ +/* LLVM LOCAL - begin pointer arithmetic */ +/* llvm-gcc intentionally preserves array notation &array[i] and avoids + pointer arithmetic. + + Example 1: struct { int *a; } *b; b->a[2] = 42; + Example 2: struct { int a[42]; } *b; b->a[2] = 42; + + In both of this cases, expr is preserved as ARRAY_REF. Normally, gcc + would decomponse first example into a pointer arithmetic expression. + So in llvm mode, check expression's field type to ensure that this is really a + array reference or not. */ +static int objc_is_really_array_ref(tree expr) { + tree component = NULL_TREE; + tree field = NULL_TREE; + + if (TREE_CODE(expr) != ARRAY_REF) + return 0; + + component = TREE_OPERAND(expr, 0); + if (!component || TREE_CODE(component) != COMPONENT_REF) + return 0; + + field = TREE_OPERAND(component, 1); + if (!field || TREE_CODE(TREE_TYPE(field)) != ARRAY_TYPE) + return 0; + + return 1; +} +/* LLVM LOCAL - end pointer arithmetic */ + static tree objc_substitute_decl (tree expr, tree oldexpr, tree newexpr) { @@ -6512,11 +6542,9 @@ oldexpr, newexpr), DECL_NAME (TREE_OPERAND (expr, 1))); - case ARRAY_REF: - return build_array_ref (objc_substitute_decl (TREE_OPERAND (expr, 0), - oldexpr, - newexpr), - TREE_OPERAND (expr, 1)); + /* LLVM LOCAL - begin pointer arithmetic */ + /* Moved ARRAY_REF to "default" case */ + /* LLVM LOCAL - end pointer arithmetic */ case INDIRECT_REF: /* APPLE LOCAL begin radar 4982951 */ { @@ -6530,6 +6558,14 @@ oldexpr, newexpr), "->"); default: + /* LLVM LOCAL - begin pointer arithmetic */ + if (objc_is_really_array_ref(expr)) + return build_array_ref (objc_substitute_decl (TREE_OPERAND (expr, 0), + oldexpr, + newexpr), + TREE_OPERAND (expr, 1)); + /* LLVM LOCAL - end pointer arithmetic */ + return expr; } } @@ -6810,7 +6846,9 @@ expr = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (expr, 0), 0), 0); /* Zero in on the variable/parameter being assigned to. */ - while (TREE_CODE (expr) == COMPONENT_REF || TREE_CODE (expr) == ARRAY_REF) + /* LLVM LOCAL - begin pointer arithmetic */ + while (TREE_CODE (expr) == COMPONENT_REF || objc_is_really_array_ref(expr)) + /* LLVM LOCAL - end pointer arithmetic */ expr = TREE_OPERAND (expr, 0); /* Parameters and local variables (and their fields) are NOT GC-able. */ @@ -6859,34 +6897,6 @@ } /* APPLE LOCAL end radar 4591756 */ -/* LLVM LOCAL begin LLVM */ -/* llvm-gcc intentionally preserves array notation &array[i] and avoids - pointer arithmetic. - Example 1: struct { int *a; } b; b->a[2] = 42; - Example 2: struct { int a[42]; } b; b->a[2] = 42. - In both of this cases, expr is preserved as ARRAY_REF. Normally, gcc - would decomponse first example into a pointer arithmetic expression. - So in llvm mode, check expression's field type to ensure that this is really a - array reference or not. */ -static int objc_is_really_array_ref(tree expr) { - tree component = NULL_TREE; - tree field = NULL_TREE; - - if (TREE_CODE(expr) != ARRAY_REF) - return 0; - - component = TREE_OPERAND(expr, 0); - if (!component || TREE_CODE(component) != COMPONENT_REF) - return 0; - - field = TREE_OPERAND(component, 1); - if (!field || TREE_CODE(TREE_TYPE(field)) != ARRAY_TYPE) - return 0; - - return 1; -} -/* LLVM LOCAL end LLVM */ - static int objc_is_ivar_reference_p (tree expr) { @@ -6964,7 +6974,8 @@ /* APPLE LOCAL end radar 4591756 */ while (outer && (TREE_CODE (outer) == COMPONENT_REF - || TREE_CODE (outer) == ARRAY_REF)) + /* LLVM LOCAL pointer arithmetic */ + || objc_is_really_array_ref(outer))) outer = TREE_OPERAND (outer, 0); /* APPLE LOCAL objc2 */ From romix.llvm at googlemail.com Mon Apr 21 13:54:18 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Mon, 21 Apr 2008 22:54:18 +0400 Subject: [llvm-commits] Fwd: Speeding up instruction selection In-Reply-To: References: <039F7990-10A9-4153-A91B-024551DF3541@apple.com> <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> Message-ID: Hi Evan, Good point. This code is here due to the historical reasons ;-) I introduced it when I was experimenting with different alternatives and then forgot to remove it... The commit version will not contain it. Any further comments on this patch? Can I commit it or is it too early? - Roman 2008/4/21, Evan Cheng : > + if (left->NodeQueueId && right->NodeQueueId) > + return (left->NodeQueueId < right->NodeQueueId); > + return left->NodeNum < right->NodeNum; > > Why would NodeQueueId ever be zero? Nodes that are entered into the queue > must have this field set, no? > > Evan > > > On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > > > > > > Hi Evan, > > > > 2008/4/2, Evan Cheng : > > > > > > > > On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: > > > > > > > > > > 2008/4/2, Evan Cheng : > > > > > > > > > > > > > > On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: > > > > > > > > > > > > > > > > Hi Evan, > > > > > > > > > > > > 2008/4/1, Evan Cheng : > > > > > > > > > > > > > Please hold off checking it in for a bit. llvm tot is having > some > > > > > > > problems and I'd like to get to the bottom of it first. > > > > > > > > > > > > > > > > > > > OK. > > > > > > > > > > > > > > > > > > > Also, the tie breaker is less than ideal. I think we need a tie- > > > > > > > breaker that is "the SUnit that's added to the queue is > preferred". > > > > > > > That means it prefers nodes which are closer to the end of > block. > > > > > > > What > > > > > > > do you think? > > > > > > > > > > > > > > > > > > > Do you actually mean "the SUnit that's added to the queue LAST (or > > > > > > FIRST) is preferred"? I'll think about it. > > > > > > > > > > > > > > > > > > > > > Yep "first". Basically, if all else being equal, let the node > that's > > > > > ready first be scheduled first. We can add a order id to SUnit which > > > > > gets set when it's pushed into the ready queue. What do you think? > > > > > > > > > > > > > Makes sense. The queue should have a global "current id" counter. Its > > > > current value is assigned to each node being inserted into the ready > > > > queue and then incremented. When the node is removed from the queue > > > > for any reason, its queue order id is reset. It should be rather easy > > > > to implement. > > > > > > > > > > > > > > > > > > BTW, do you really want this queue order id in the SUnit or in a > > > > separate array indexed by SUnit unique ids? > > > > > > > > > > > > > It should be in SUnit since the sort functions don't have access to > > > ScheduleDAG members. > > > > > > > Please find and review the attached patch implementing: > > - a proper tie-breaker as discussed above. > > - and unmodified part for replacing the slow std::priority_queue by > > std::set, as it I already did before. > > > > What do you think? > > > > -Roman > > > > > > From evan.cheng at apple.com Mon Apr 21 14:44:35 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Apr 2008 12:44:35 -0700 Subject: [llvm-commits] Fwd: Speeding up instruction selection In-Reply-To: References: <039F7990-10A9-4153-A91B-024551DF3541@apple.com> <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> Message-ID: <2CE4D8B9-C950-493B-B97B-6D25FD90A2C0@apple.com> On Apr 21, 2008, at 11:54 AM, Roman Levenstein wrote: > Hi Evan, > > Good point. This code is here due to the historical reasons ;-) I > introduced it when I was experimenting with different alternatives and > then forgot to remove it... The commit version will not contain it. > > Any further comments on this patch? Can I commit it or is it too > early? Please hold off committing for a few days until I have a chance to evaluate the performance impact. Thanks. Evan > > > - Roman > > 2008/4/21, Evan Cheng : > >> + if (left->NodeQueueId && right->NodeQueueId) >> + return (left->NodeQueueId < right->NodeQueueId); >> + return left->NodeNum < right->NodeNum; >> >> Why would NodeQueueId ever be zero? Nodes that are entered into the >> queue >> must have this field set, no? >> >> Evan >> >> >> On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: >> >> >>> >>> Hi Evan, >>> >>> 2008/4/2, Evan Cheng : >>> >>>> >>>> On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: >>>> >>>> >>>>> 2008/4/2, Evan Cheng : >>>>> >>>>>> >>>>>> On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: >>>>>> >>>>>> >>>>>>> Hi Evan, >>>>>>> >>>>>>> 2008/4/1, Evan Cheng : >>>>>>> >>>>>>>> Please hold off checking it in for a bit. llvm tot is having >> some >>>>>>>> problems and I'd like to get to the bottom of it first. >>>>>>>> >>>>>>> >>>>>>> OK. >>>>>>> >>>>>>> >>>>>>>> Also, the tie breaker is less than ideal. I think we need a >>>>>>>> tie- >>>>>>>> breaker that is "the SUnit that's added to the queue is >> preferred". >>>>>>>> That means it prefers nodes which are closer to the end of >> block. >>>>>>>> What >>>>>>>> do you think? >>>>>>>> >>>>>>> >>>>>>> Do you actually mean "the SUnit that's added to the queue LAST >>>>>>> (or >>>>>>> FIRST) is preferred"? I'll think about it. >>>>>>> >>>>>> >>>>>> >>>>>> Yep "first". Basically, if all else being equal, let the node >> that's >>>>>> ready first be scheduled first. We can add a order id to SUnit >>>>>> which >>>>>> gets set when it's pushed into the ready queue. What do you >>>>>> think? >>>>>> >>>>> >>>>> Makes sense. The queue should have a global "current id" >>>>> counter. Its >>>>> current value is assigned to each node being inserted into the >>>>> ready >>>>> queue and then incremented. When the node is removed from the >>>>> queue >>>>> for any reason, its queue order id is reset. It should be rather >>>>> easy >>>>> to implement. >>>>> >>>> >>> >>> >>>> >>>>> BTW, do you really want this queue order id in the SUnit or in a >>>>> separate array indexed by SUnit unique ids? >>>>> >>>> >>>> >>>> It should be in SUnit since the sort functions don't have access to >>>> ScheduleDAG members. >>>> >>> >>> Please find and review the attached patch implementing: >>> - a proper tie-breaker as discussed above. >>> - and unmodified part for replacing the slow std::priority_queue by >>> std::set, as it I already did before. >>> >>> What do you think? >>> >>> -Roman >>> >>> >> >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Mon Apr 21 14:48:48 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Apr 2008 19:48:48 -0000 Subject: [llvm-commits] [llvm] r50051 - /llvm/trunk/lib/Analysis/AliasSetTracker.cpp Message-ID: <200804211948.m3LJmmAG026512@zion.cs.uiuc.edu> Author: djg Date: Mon Apr 21 14:48:48 2008 New Revision: 50051 URL: http://llvm.org/viewvc/llvm-project?rev=50051&view=rev Log: Fix the way AliasSet::print prints "may alias". Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=50051&r1=50050&r2=50051&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original) +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Mon Apr 21 14:48:48 2008 @@ -517,7 +517,7 @@ void AliasSet::print(std::ostream &OS) const { OS << " AliasSet[" << (void*)this << "," << RefCount << "] "; - OS << (AliasTy == MustAlias ? "must" : "may ") << " alias, "; + OS << (AliasTy == MustAlias ? "must" : "may") << " alias, "; switch (AccessTy) { case NoModRef: OS << "No access "; break; case Refs : OS << "Ref "; break; From isanbard at gmail.com Mon Apr 21 14:50:02 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Apr 2008 19:50:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50052 - /llvm-gcc-4.2/trunk/gcc/testsuite/llvm.objc/2008-04-21-StrongIvarAssignment.m Message-ID: <200804211950.m3LJo2BJ026559@zion.cs.uiuc.edu> Author: void Date: Mon Apr 21 14:50:02 2008 New Revision: 50052 URL: http://llvm.org/viewvc/llvm-project?rev=50052&view=rev Log: Testcase for r50048. Added: llvm-gcc-4.2/trunk/gcc/testsuite/llvm.objc/2008-04-21-StrongIvarAssignment.m Added: llvm-gcc-4.2/trunk/gcc/testsuite/llvm.objc/2008-04-21-StrongIvarAssignment.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/llvm.objc/2008-04-21-StrongIvarAssignment.m?rev=50052&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/llvm.objc/2008-04-21-StrongIvarAssignment.m (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/llvm.objc/2008-04-21-StrongIvarAssignment.m Mon Apr 21 14:50:02 2008 @@ -0,0 +1,48 @@ +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fobjc-gc -framework Foundation" } */ +#import +#import + +uintptr_t OldPointerVal; +uintptr_t NewPointerVal; + + at class Bork; + +typedef struct { + NSString *name; +} Info; + + at interface Bork : NSObject { + at private + CFMutableDictionaryRef _f1; + __strong Info* _f2; +} + +- (void) foo:(NSString*)name; + at end + + at implementation Bork +- (id)init { + _f2 = malloc(sizeof(Info) * 3); + + unsigned i; + for (i = 0; i < 3; ++i) + _f2[i].name = 0; +} + +- (void)foo:(NSString*)name { + OldPointerVal = (uintptr_t)_f2; + _f2[0].name = [name copy]; + NewPointerVal = (uintptr_t)_f2; +} + at end + +int main() { + Bork *NM = [Bork alloc]; + [NM init]; + NSString *Str = [NSString stringWithUTF8String: "Hello world"]; + [NM foo: Str]; + if (OldPointerVal != NewPointerVal) + abort(); + [NM release]; +} From gohman at apple.com Mon Apr 21 14:52:29 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Apr 2008 19:52:29 -0000 Subject: [llvm-commits] [llvm] r50053 - /llvm/trunk/lib/Target/X86/X86InstrMMX.td Message-ID: <200804211952.m3LJqTsR026833@zion.cs.uiuc.edu> Author: djg Date: Mon Apr 21 14:52:29 2008 New Revision: 50053 URL: http://llvm.org/viewvc/llvm-project?rev=50053&view=rev Log: Fix the encoding of the MMX movd that moves from MMX to 64-bit GPR. Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=50053&r1=50052&r2=50053&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Mon Apr 21 14:52:29 2008 @@ -167,7 +167,7 @@ "movd\t{$src, $dst|$dst, $src}", []>; let neverHasSideEffects = 1 in -def MMX_MOVD64from64rr : MMXRI<0x6E, MRMSrcReg, (outs GR64:$dst), (ins VR64:$src), +def MMX_MOVD64from64rr : MMXRI<0x7E, MRMSrcReg, (outs GR64:$dst), (ins VR64:$src), "movd\t{$src, $dst|$dst, $src}", []>; let neverHasSideEffects = 1 in From gohman at apple.com Mon Apr 21 15:07:31 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Apr 2008 20:07:31 -0000 Subject: [llvm-commits] [llvm] r50054 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200804212007.m3LK7VFE027337@zion.cs.uiuc.edu> Author: djg Date: Mon Apr 21 15:07:30 2008 New Revision: 50054 URL: http://llvm.org/viewvc/llvm-project?rev=50054&view=rev Log: Fix an out-of-bounds access in -view-sunit-dags in the case of an empty ScheduleDAG. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=50054&r1=50053&r2=50054&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Apr 21 15:07:30 2008 @@ -301,7 +301,8 @@ static void addCustomGraphFeatures(ScheduleDAG *G, GraphWriter &GW) { GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); - if (G->DAG.getRoot().Val) + if (G->DAG.getRoot().Val && + G->SUnitMap.find(G->DAG.getRoot().Val) != G->SUnitMap.end()) GW.emitEdge(0, -1, G->SUnitMap[G->DAG.getRoot().Val].front(), -1, ""); } }; From nicolas.geoffray at lip6.fr Mon Apr 21 16:24:53 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 21 Apr 2008 21:24:53 -0000 Subject: [llvm-commits] [vmkit] r50058 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.h JavaJIT.cpp JavaJIT.h JavaJITInitialise.cpp JavaRuntimeJIT.cpp Message-ID: <200804212124.m3LLOrRA029939@zion.cs.uiuc.edu> Author: geoffray Date: Mon Apr 21 16:24:53 2008 New Revision: 50058 URL: http://llvm.org/viewvc/llvm-project?rev=50058&view=rev Log: Place initialization barriers in a multi-vm environment. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=50058&r1=50057&r2=50058&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Mon Apr 21 16:24:53 2008 @@ -157,7 +157,9 @@ bool isReady(); void setReady(); #endif - + bool isResolved() { + return status >= resolved; + } }; class Class : public CommonClass { Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50058&r1=50057&r2=50058&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Apr 21 16:24:53 2008 @@ -794,7 +794,7 @@ } #endif - // TODO: put an initializer in here + // TODO: put an initialiser in here void* ptr = mvm::jit::executionEngine->getPointerToGlobal(gv); GenericValue Val = GenericValue(val); llvm::GenericValue * Ptr = (llvm::GenericValue*)ptr; @@ -1351,6 +1351,9 @@ llvm::BranchInst::Create(trueCl, currentBlock); currentBlock = trueCl; +#ifdef MULTIPLE_VM + invoke(initialisationCheckLLVM, node, "", currentBlock); +#endif return node; } @@ -1369,7 +1372,11 @@ } #endif Value* val = 0; - if (!cl || !cl->isReady()) { + if (!cl || !(cl->isResolved()) +#ifndef MULTIPLE_VM + || !cl->isReady() +#endif + ) { Value* node = getResolvedClass(index, true); #ifndef MULTIPLE_VM val = invoke(doNewUnknownLLVM, node, "", currentBlock); @@ -1380,6 +1387,11 @@ Value* load = new LoadInst(cl->llvmVar(compilingClass->isolate->module), "", currentBlock); #ifdef MULTIPLE_VM + if (cl->isolate == Jnjvm::bootstrapVM) { + Module* M = compilingClass->isolate->module; + Value* arg = new LoadInst(cl->llvmVar(M), "", currentBlock); + invoke(initialisationCheckLLVM, arg, "", currentBlock); + } val = invoke(doNewLLVM, load, isolateLocal, "", currentBlock); #else val = invoke(doNewLLVM, load, "", currentBlock); @@ -1425,12 +1437,21 @@ JavaCtpInfo* info = compilingClass->ctpInfo; JavaField* field = info->lookupField(index, stat); - if (field && field->classDef->isReady()) { + if (field && field->classDef->isResolved() +#ifndef MULTIPLE_VM + && field->classDef->isReady() +#endif + ) { Module* M = compilingClass->isolate->module; if (stat) object = field->classDef->staticVar(M, currentBlock); const Type* type = stat ? field->classDef->staticType : field->classDef->virtualType; - +#ifdef MULTIPLE_VM + if (stat && field->classDef->isolate == Jnjvm::bootstrapVM) { + Value* arg = new LoadInst(field->classDef->llvmVar(M), "", currentBlock); + invoke(initialisationCheckLLVM, arg, "", currentBlock); + } +#endif return fieldGetter(this, type, object, field->offset); } else { const Type* Pty = mvm::jit::arrayPtrType; @@ -1486,7 +1507,8 @@ Module* M = compilingClass->isolate->module; args.push_back(new LoadInst(compilingClass->llvmVar(M), "", currentBlock)); mvm::jit::protectConstants();//->lock(); - args.push_back(ConstantInt::get(Type::Int32Ty, index)); + Constant* CI = ConstantInt::get(Type::Int32Ty, index); + args.push_back(CI); mvm::jit::unprotectConstants();//->unlock(); args.push_back(stat ? mvm::jit::constantOne : mvm::jit::constantZero); args.push_back(gvStaticInstance); @@ -1496,6 +1518,15 @@ llvm::BranchInst::Create(endBlock, currentBlock); currentBlock = endBlock;; +#ifdef MULTIPLE_VM + if (stat) { + std::vector args; + Value* val = new LoadInst(compilingClass->llvmVar(M), "", currentBlock); + args.push_back(val); + args.push_back(CI); + invoke(initialisationCheckCtpLLVM, args, "", currentBlock); + } +#endif return new BitCastInst(node, fieldTypePtr, "", currentBlock); } } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h?rev=50058&r1=50057&r2=50058&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h Mon Apr 21 16:24:53 2008 @@ -248,7 +248,11 @@ static llvm::Function* jniProceedPendingExceptionLLVM; static llvm::Function* doNewLLVM; // this is when the type is not known at compile time (escape analysis) - static llvm::Function* doNewUnknownLLVM; + static llvm::Function* doNewUnknownLLVM; +#ifdef MULTIPLE_VM + static llvm::Function* initialisationCheckLLVM; + static llvm::Function* initialisationCheckCtpLLVM; +#endif static llvm::Function* initialiseObjectLLVM; static llvm::Function* newLookupLLVM; static llvm::Function* instanceOfLLVM; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp?rev=50058&r1=50057&r2=50058&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Mon Apr 21 16:24:53 2008 @@ -222,6 +222,33 @@ "_ZN5jnjvm9JavaArray12multiCallNewEPNS_10ClassArrayEjz", module); } + +#ifdef MULTIPLE_VM + // Create initialisationCheckLLVM + { + std::vector args; + args.push_back(mvm::jit::ptrType); + const FunctionType* type = FunctionType::get(Type::VoidTy, args, + false); + + initialisationCheckLLVM = Function::Create(type, GlobalValue::ExternalLinkage, + "initialisationCheck", + module); + } + + // Create initialisationCheckCtpLLVM + { + std::vector args; + args.push_back(mvm::jit::ptrType); + args.push_back(Type::Int32Ty); + const FunctionType* type = FunctionType::get(Type::VoidTy, args, + false); + + initialisationCheckCtpLLVM = Function::Create(type, GlobalValue::ExternalLinkage, + "initialisationCheckCtp", + module); + } +#endif Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=50058&r1=50057&r2=50058&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Mon Apr 21 16:24:53 2008 @@ -55,6 +55,10 @@ llvm::Function* JavaJIT::jniProceedPendingExceptionLLVM = 0; llvm::Function* JavaJIT::doNewLLVM = 0; llvm::Function* JavaJIT::doNewUnknownLLVM = 0; +#ifdef MULTIPLE_VM +llvm::Function* JavaJIT::initialisationCheckLLVM = 0; +llvm::Function* JavaJIT::initialisationCheckCtpLLVM = 0; +#endif llvm::Function* JavaJIT::initialiseObjectLLVM = 0; llvm::Function* JavaJIT::newLookupLLVM = 0; llvm::Function* JavaJIT::instanceOfLLVM = 0; @@ -237,3 +241,16 @@ *toAlloc = cl; return cl; } + +#ifdef MULTIPLE_VM +extern "C" void initialisationCheck(CommonClass* cl) { + cl->isolate->initialiseClass(cl); +} + +extern "C" void initialisationCheckCtp(Class* caller, uint16 index) { + JavaCtpInfo* ctpInfo = caller->ctpInfo; + JavaField* field = (JavaField*)(ctpInfo->ctpRes[index]); + assert(field && "checking without resolving?"); + field->classDef->isolate->initialiseClass(field->classDef); +} +#endif From nicolas.geoffray at lip6.fr Mon Apr 21 16:26:35 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 21 Apr 2008 21:26:35 -0000 Subject: [llvm-commits] [vmkit] r50059 - /vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Message-ID: <200804212126.m3LLQZKi030026@zion.cs.uiuc.edu> Author: geoffray Date: Mon Apr 21 16:26:35 2008 New Revision: 50059 URL: http://llvm.org/viewvc/llvm-project?rev=50059&view=rev Log: Add the service's GC in the memory manager map. Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp?rev=50059&r1=50058&r2=50059&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Mon Apr 21 16:26:35 2008 @@ -75,6 +75,10 @@ service->protectModule = mvm::Lock::allocNormal(); service->TheModuleProvider = new JnjvmModuleProvider(service->module, service->functions); + +#ifdef MULTIPLE_GC + mvm::jit::memoryManager->addGCForModule(service->module, service->GC); +#endif JavaJIT::initialiseJITIsolateVM(service); service->name = "service"; From nicolas.geoffray at lip6.fr Mon Apr 21 16:27:09 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 21 Apr 2008 21:27:09 -0000 Subject: [llvm-commits] [vmkit] r50060 - /vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Message-ID: <200804212127.m3LLR9Gx030056@zion.cs.uiuc.edu> Author: geoffray Date: Mon Apr 21 16:27:08 2008 New Revision: 50060 URL: http://llvm.org/viewvc/llvm-project?rev=50060&view=rev Log: Trace classes in a ServiceDomain. Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=50060&r1=50059&r2=50060&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Mon Apr 21 16:27:08 2008 @@ -357,5 +357,6 @@ #ifdef SERVICE_VM void ServiceDomain::TRACER { JavaIsolate::PARENT_TRACER; + classes->MARK_AND_TRACE; } #endif From nicolas.geoffray at lip6.fr Mon Apr 21 16:29:10 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 21 Apr 2008 21:29:10 -0000 Subject: [llvm-commits] [vmkit] r50061 - in /vmkit/trunk: configure.ac include/mvm/Object.h lib/Mvm/BoehmGC/MvmGC.h lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/GCMmap2/gc.cpp lib/Mvm/GCMmap2/gccollector.cpp lib/Mvm/GCMmap2/gccollector.h lib/Mvm/GCMmap2/gcinit.cpp lib/Mvm/GCMmap2/gcthread.h lib/Mvm/GCMmap2/main.cpp lib/Mvm/MvmMemoryManager.cpp lib/Mvm/Object.cpp Message-ID: <200804212129.m3LLTAaB030186@zion.cs.uiuc.edu> Author: geoffray Date: Mon Apr 21 16:29:09 2008 New Revision: 50061 URL: http://llvm.org/viewvc/llvm-project?rev=50061&view=rev Log: Improvements for a service environment. The configure script can now configure the vms to be in a single, mutli, or service environment. Modified: vmkit/trunk/configure.ac vmkit/trunk/include/mvm/Object.h vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h vmkit/trunk/lib/Mvm/GCMmap2/main.cpp vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp vmkit/trunk/lib/Mvm/Object.cpp Modified: vmkit/trunk/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure.ac?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/configure.ac (original) +++ vmkit/trunk/configure.ac Mon Apr 21 16:29:09 2008 @@ -217,6 +217,28 @@ AC_SUBST([GC_LIBS]) dnl ************************************************************************** +dnl Virtual Machine type +dnl ************************************************************************** +AC_ARG_WITH(vm-type, + [AS_HELP_STRING(--with-vm-type=something, + [VM type ('single' 'multi' or 'service')])], + [[vm=$withval]], + [[ echo Using single as vm type. + vm-type=single + ]] +) + +if test "x${vm-type}" = "xmulti"; then + CFLAGS="$CFLAGS -DMULTIPLE_VM" + CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM" +else + if test "x${vm-type}" = "xservice"; then + CFLAGS="$CFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM" + CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM" + fi +fi + +dnl ************************************************************************** dnl GNU CLASSPATH version dnl ************************************************************************** AC_ARG_WITH(gnu-classpath-version, Modified: vmkit/trunk/include/mvm/Object.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Object.h?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/include/mvm/Object.h (original) +++ vmkit/trunk/include/mvm/Object.h Mon Apr 21 16:29:09 2008 @@ -86,7 +86,7 @@ return popRoots(1); } - static void markAndTraceRoots(void); + static void markAndTraceRoots(void*); static void initialise(); }; Modified: vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h Mon Apr 21 16:29:09 2008 @@ -17,6 +17,10 @@ //#include "gc/gc_local_alloc.h" #include "gc/gc.h" +#define TRACER tracer() +#define PARENT_TRACER tracer() +#define MARK_AND_TRACE markAndTrace() + extern "C" void * GC_dlopen(const char *path, int mode) throw (); #include "mvm/GC/GC.h" @@ -71,7 +75,7 @@ class Collector { public: - typedef void (*markerFn)(void); + typedef void (*markerFn)(void*); static void initialise(markerFn mark, void *base_sp) { GC_INIT(); Modified: vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h Mon Apr 21 16:29:09 2008 @@ -64,7 +64,7 @@ class Collector { public: - typedef void (*markerFn)(void); + typedef void (*markerFn)(void*); static void initialise(markerFn mark, void *base_sp); STATIC void destroy(); Modified: vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp Mon Apr 21 16:29:09 2008 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#include #include #include "mvm/GC/GC.h" @@ -179,7 +180,18 @@ #endif } +#undef COLLECTOR void GCThread::waitCollection() { +#if defined(MULTIPLE_GC) +#if defined(SERVICE_GC) + GCCollector* GC = GCCollector::collectingGC; +#else + GCCollector* GC = ((GCCollector*)mvm::Thread::get()->GC); +#endif +#define COLLECTOR GC-> +#else +#define COLLECTOR GCCollector:: +#endif unsigned int cm = COLLECTOR current_mark; if(Thread::self() != collector_tid) { @@ -204,17 +216,16 @@ #else #define COLLECTOR GCCollector:: #endif - GCThreadCollector *loc = COLLECTOR threads->myloc(); - register unsigned int cm = COLLECTOR current_mark; - // jmp_buf buf; - - // setjmp(buf); + GCThreadCollector *loc = COLLECTOR threads->myloc(); + + jmp_buf buf; + setjmp(buf); COLLECTOR threads->stackLock(); if(!loc) /* a key is being destroyed */ COLLECTOR threads->another_mark(); - else if(loc->current_mark() != cm) { + else { register unsigned int **cur = (unsigned int **)&cur; register unsigned int **max = loc->base_sp(); @@ -228,7 +239,6 @@ } } - loc->current_mark(cm); COLLECTOR threads->another_mark(); COLLECTOR threads->waitCollection(); } Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Mon Apr 21 16:29:09 2008 @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "gccollector.h" -#include using namespace mvm; @@ -40,92 +39,94 @@ #ifdef SERVICE_GC GCCollector* GCCollector::collectingGC; +unsigned int GCCollector::current_mark; #endif void GCCollector::do_collect() { - //printf("----- do collect -----\n"); - jmp_buf buf; - setjmp(buf); - GCChunkNode *cur; - _since_last_collection = _collect_freq_auto; + //printf("----- do collect -----\n"); + GCChunkNode *cur; + _since_last_collection = _collect_freq_auto; - current_mark++; + current_mark++; - unused_nodes->attrape(used_nodes); + unused_nodes->attrape(used_nodes); #ifdef SERVICE_GC collectingGC = this; #endif #ifdef HAVE_PTHREAD - threads->synchronize(); + threads->synchronize(); #endif - for(cur=used_nodes->next(); cur!=used_nodes; cur=cur->next()) - trace(cur); - - if(_marker) - _marker(); + for(cur=used_nodes->next(); cur!=used_nodes; cur=cur->next()) + trace(cur); - status = stat_finalize; + if(_marker) +#ifdef MULTIPLE_GC + _marker(this); +#else + _marker(0); +#endif + status = stat_finalize; - /* finalize */ - GCChunkNode finalizable; - finalizable.attrape(unused_nodes); + /* finalize */ + GCChunkNode finalizable; + finalizable.attrape(unused_nodes); - status = stat_alloc; + status = stat_alloc; #ifdef HAVE_PTHREAD - threads->collectionFinished(); + threads->collectionFinished(); #endif - - /* kill everyone */ - GCChunkNode *next; - - for(cur=finalizable.next(); cur!=&finalizable; cur=next) { - register gc_header *c = cur->chunk(); - next = cur->next(); - - c->_2gc()->destroyer(real_nbb(cur)); - - //printf(" !!!! reject %p [%p]\n", cur->chunk()->_2gc(), cur); - allocator->reject_chunk(cur); - } + + /* kill everyone */ + GCChunkNode *next; + + for(cur=finalizable.next(); cur!=&finalizable; cur=next) { + register gc_header *c = cur->chunk(); + next = cur->next(); + + c->_2gc()->destroyer(real_nbb(cur)); + + //printf(" !!!! reject %p [%p]\n", cur->chunk()->_2gc(), cur); + allocator->reject_chunk(cur); + } used_nodes->alone(); } void GCCollector::collect_unprotect() { - if(_enable_collection && (status == stat_alloc)) { - status = stat_collect; - do_collect(); - } + if(_enable_collection && (status == stat_alloc)) { + status = stat_collect; + do_collect(); + } } #ifdef HAVE_PTHREAD void GCCollector::die_if_sigsegv_occured_during_collection(void *addr) { - if(!isStable(0, 0, 0, 0, 0, 0, 0, 0, 0)) { - printf("; ****************************************************** ;\n"); - printf("; SIGSEGV occured during a collection ;\n"); - printf("; I'm trying to let the allocator in a coherent stat ;\n"); - printf("; but the collector is DEAD and will never collect again ;\n"); - printf("; ****************************************************** ;\n"); - - status = stat_broken; /* Collection is finished and no other collection will happend */ - threads->cancel(); /* Emulates a full collection to unlock mutators */ - used_nodes->eat(unused_nodes); /* All nodes are uses. Finalized are lost */ - unlock_dont_recovery(); /* Unlocks the GC lock */ - //gcfatal("SIGSEGV occured during collection at %p", addr); - } + if(!isStable(0, 0, 0, 0, 0, 0, 0, 0, 0)) { + printf("; ****************************************************** ;\n"); + printf("; SIGSEGV occured during a collection ;\n"); + printf("; I'm trying to let the allocator in a coherent stat ;\n"); + printf("; but the collector is DEAD and will never collect again ;\n"); + printf("; ****************************************************** ;\n"); + + status = stat_broken; /* Collection is finished and no other collection will happend */ + threads->cancel(); /* Emulates a full collection to unlock mutators */ + used_nodes->eat(unused_nodes); /* All nodes are uses. Finalized are lost */ + unlock_dont_recovery(); /* Unlocks the GC lock */ + //gcfatal("SIGSEGV occured during collection at %p", addr); + } } #endif /* HAVE_PTHREAD */ void GCCollector::gcStats(size_t *_no, size_t *_nbb) { - register unsigned int n, tot; - register GCChunkNode *cur; - lock(); - for(n=0, tot=0, cur=used_nodes->next(); cur!=used_nodes; cur=cur->next(), n++) - tot += cur->nbb(); - unlock(); - *_no = n; - *_nbb = tot; + register unsigned int n, tot; + register GCChunkNode *cur; + lock(); + for(n=0, tot=0, cur=used_nodes->next(); cur!=used_nodes; cur=cur->next(), n++) + tot += cur->nbb(); + unlock(); + *_no = n; + *_nbb = tot; } Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h Mon Apr 21 16:29:09 2008 @@ -34,8 +34,11 @@ STATIC GCChunkNode *used_nodes; /* Used memory nodes */ STATIC GCChunkNode *unused_nodes; /* Unused memory nodes */ - +#ifdef SERVICE_GC + static unsigned int current_mark; +#else STATIC unsigned int current_mark; +#endif STATIC int _collect_freq_auto; /* Collection frequency in gcmalloc/gcrealloc */ STATIC int _collect_freq_maybe; /* Collection frequency in maybeCollect */ Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp Mon Apr 21 16:29:09 2008 @@ -12,21 +12,21 @@ using namespace mvm; -static const size_t def_collect_freq_auto = 4*1024*1024; +static const size_t def_collect_freq_auto = 4*1024*1024; static const size_t def_collect_freq_maybe = 512*1024; #if defined(__MACH__) -# define SIGGC SIGXCPU +# define SIGGC SIGXCPU #else -# define SIGGC SIGPWR +# define SIGGC SIGPWR #endif int GCCollector::siggc() { - return SIGGC; + return SIGGC; } void GCCollector::initialise(Collector::markerFn marker) { - + used_nodes = new GCChunkNode(); unused_nodes = new GCChunkNode(); #ifdef HAVE_PTHREAD @@ -41,81 +41,83 @@ #endif struct sigaction sa; - sigset_t mask; + sigset_t mask; #ifdef HAVE_PTHREAD - //on_fatal = unlock_dont_recovery; + //on_fatal = unlock_dont_recovery; #endif - sigaction(SIGGC, 0, &sa); - sigfillset(&mask); - sa.sa_mask = mask; - sa.sa_handler = siggc_handler; - sa.sa_flags |= SA_RESTART; - sigaction(SIGGC, &sa, 0); - - allocator = new GCAllocator(); -// GCCollector::GCCollector(void (*marker)(void *)) { - - _marker = marker; + sigaction(SIGGC, 0, &sa); + sigfillset(&mask); + sa.sa_mask = mask; + sa.sa_handler = siggc_handler; + sa.sa_flags |= SA_RESTART; + sigaction(SIGGC, &sa, 0); + + allocator = new GCAllocator(); + + _marker = marker; - used_nodes->alone(); + used_nodes->alone(); - current_mark = 0; +#ifdef SERVICE_GC + if (this == bootstrapGC) +#endif + current_mark = 0; - _collect_freq_auto = def_collect_freq_auto; - _collect_freq_maybe = def_collect_freq_maybe; - - _since_last_collection = _collect_freq_auto; + _collect_freq_auto = def_collect_freq_auto; + _collect_freq_maybe = def_collect_freq_maybe; + + _since_last_collection = _collect_freq_auto; - _enable_auto = 1; - _enable_collection = 1; - _enable_maybe = 1; + _enable_auto = 1; + _enable_collection = 1; + _enable_maybe = 1; - status = stat_alloc; + status = stat_alloc; } void GCCollector::destroy() { - delete allocator; - allocator = 0; + delete allocator; + allocator = 0; } static void *get_curr_fp(void) { - register void *fp; - asm( + register void *fp; + asm( # if defined(__ppc__) || defined(__PPC__) # if defined(__MACH__) - " mr %0, r1 " + "mr %0, r1" # else - " mr %0, 1 " + "mr %0, 1" # endif # elif defined(__i386__) - " movl %%ebp, %0 " + "movl %%ebp, %0" # elif defined(__amd64__) - " movq %%rbp, %0 " + "movq %%rbp, %0" # else # error: # error: I do not know how to read the frame pointer on this machine # error: # endif - :"=r"(fp):); - return fp; + :"=r"(fp):); + return fp; } static void *get_base_sp(void) { - void *fp= 0; - for (fp= get_curr_fp(); (*(void **)fp); fp= *(void **)fp); - return fp; + void *fp= 0; + for (fp= get_curr_fp(); (*(void **)fp); fp= *(void **)fp); + return fp; } #ifdef HAVE_PTHREAD void GCCollector::inject_my_thread(void *base_sp) { - if(!base_sp) - base_sp = get_base_sp(); - threads->inject(base_sp, current_mark); + if(!base_sp) + base_sp = get_base_sp(); + threads->inject(base_sp, current_mark); } #endif Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h Mon Apr 21 16:29:09 2008 @@ -22,14 +22,12 @@ class GCThreadCollector : public CircularBase { void *_base_sp; - int _cur_mark; int _tid; public: inline GCThreadCollector() {} inline GCThreadCollector(GCThreadCollector *pred, int t, void *p, int m) : CircularBase(pred) { _base_sp = p; - _cur_mark = m; _tid = t; } @@ -40,8 +38,6 @@ inline ~GCThreadCollector() {} inline int tid() { return _tid; } - inline unsigned int current_mark() { return _cur_mark; } - inline void current_mark(unsigned int m) { _cur_mark = m; } inline unsigned int **base_sp() { return (unsigned int **)_base_sp; } }; Modified: vmkit/trunk/lib/Mvm/GCMmap2/main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/main.cpp?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/main.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/main.cpp Mon Apr 21 16:29:09 2008 @@ -21,7 +21,7 @@ // printf("Trace %p\n", me); } -void marker(void) { +void marker(void*) { // printf("Marker...\n"); } Modified: vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp (original) +++ vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp Mon Apr 21 16:29:09 2008 @@ -40,9 +40,16 @@ unsigned Alignment) { size_t nbb = ((StubSize - 1) & -4) + 4 + sizeof(Method *); #ifdef MULTIPLE_GC - Collector* GC = GCMap[F->getParent()]; - Code *res = (Code *)gc::operator new(nbb, Code::VT, GC); - Method* meth = collector_new(Method, GC)(res, StubSize); + Code *res = 0; + Method* meth = 0; + if (GV) { + Collector* GC = GCMap[GV->getParent()]; + res = (Code *)gc::operator new(nbb, Code::VT, GC); + meth = collector_new(Method, GC)(res, StubSize); + } else { + res = (Code *)gc::operator new(nbb, Code::VT); + meth = gc_new(Method)(res, StubSize); + } #else Code *res = (Code *)gc::operator new(nbb, Code::VT); Method* meth = gc_new(Method)(res, StubSize); Modified: vmkit/trunk/lib/Mvm/Object.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Object.cpp?rev=50061&r1=50060&r2=50061&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Object.cpp (original) +++ vmkit/trunk/lib/Mvm/Object.cpp Mon Apr 21 16:29:09 2008 @@ -45,13 +45,14 @@ } -void Object::markAndTraceRoots(void) { - for (int i= 0; i < rootTableSize; ++i) +void Object::markAndTraceRoots(void* GC) { + for (int i= 0; i < rootTableSize; ++i) { #ifdef MULTIPLE_GC - rootTable[i]->markAndTrace(mvm::Thread::get()->GC); + rootTable[i]->markAndTrace((Collector*)GC); #else rootTable[i]->markAndTrace();; #endif + } } void Object::initialise() { From ggreif at gmail.com Mon Apr 21 16:31:55 2008 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 21 Apr 2008 21:31:55 -0000 Subject: [llvm-commits] [llvm] r50062 - /llvm/trunk/tools/llvm2cpp/CppWriter.cpp Message-ID: <200804212131.m3LLVted030277@zion.cs.uiuc.edu> Author: ggreif Date: Mon Apr 21 16:31:55 2008 New Revision: 50062 URL: http://llvm.org/viewvc/llvm-project?rev=50062&view=rev Log: fix some residual old API that fell thru the cracks of the conversion script, closes http://llvm.org/bugs/show_bug.cgi?id=2246 Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm2cpp/CppWriter.cpp?rev=50062&r1=50061&r2=50062&view=diff ============================================================================== --- llvm/trunk/tools/llvm2cpp/CppWriter.cpp (original) +++ llvm/trunk/tools/llvm2cpp/CppWriter.cpp Mon Apr 21 16:31:55 2008 @@ -1315,7 +1315,7 @@ case Instruction::PHI: { const PHINode* phi = cast(I); - Out << "PHINode* " << iName << " = new PHINode(" + Out << "PHINode* " << iName << " = PHINode::Create(" << getCppName(phi->getType()) << ", \""; printEscapedString(phi->getName()); Out << "\", " << bbname << ");"; From kremenek at apple.com Mon Apr 21 16:49:15 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 21 Apr 2008 21:49:15 -0000 Subject: [llvm-commits] [llvm] r50063 - /llvm/tags/checker/checker-0007/ Message-ID: <200804212149.m3LLnFbD030895@zion.cs.uiuc.edu> Author: kremenek Date: Mon Apr 21 16:49:15 2008 New Revision: 50063 URL: http://llvm.org/viewvc/llvm-project?rev=50063&view=rev Log: Tagging checker-0007. Added: llvm/tags/checker/checker-0007/ - copied from r50062, llvm/trunk/ From kremenek at apple.com Mon Apr 21 17:00:11 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 21 Apr 2008 22:00:11 -0000 Subject: [llvm-commits] [llvm] r50067 - /llvm/tags/checker/checker-0008/ Message-ID: <200804212200.m3LM0Br2031488@zion.cs.uiuc.edu> Author: kremenek Date: Mon Apr 21 17:00:11 2008 New Revision: 50067 URL: http://llvm.org/viewvc/llvm-project?rev=50067&view=rev Log: Tagging checker-0008. Added: llvm/tags/checker/checker-0008/ - copied from r50066, llvm/trunk/ From dpatel at apple.com Mon Apr 21 18:03:32 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Apr 2008 23:03:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50069 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200804212303.m3LN3We2001071@zion.cs.uiuc.edu> Author: dpatel Date: Mon Apr 21 18:03:31 2008 New Revision: 50069 URL: http://llvm.org/viewvc/llvm-project?rev=50069&view=rev Log: Use { <4 x float>, <4 x float> } to return struct { float[4]; }. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50069&r1=50068&r2=50069&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Apr 21 18:03:31 2008 @@ -1047,9 +1047,9 @@ ElementTypes.push_back(ATy->getElementType()); break; case 4: - // use { <4 x float> } for struct { float[4]; } - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 2)); - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 2)); + // use { <4 x float>, <4 x float> } for struct { float[4]; } + ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); + ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); break; default: assert (0 && "Unexpected floating point array size!"); @@ -1062,36 +1062,6 @@ return StructType::get(ElementTypes, STy->isPacked()); } -// llvm_x86_build_mrv_array_element - This is a helper function used by -// llvm_x6_build_multiple_return_value. -static Value *llvm_x86_build_mrv_array_element(const Type *STyFieldTy, - Value *RetVal, - unsigned FieldNo, - IRBuilder &Builder, - unsigned ArrayElemNo = 0) { - llvm::Value *Idxs[3]; - Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, FieldNo); - if (const VectorType *VTy = dyn_cast(STyFieldTy)) { - // Source field is a vector. Use insertelement. - Value *R1 = UndefValue::get(STyFieldTy); - unsigned ArraySize = VTy->getNumElements(); - for (unsigned i = ArrayElemNo; i < ArraySize; ++i) { - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, i); - Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv_gep"); - Value *ElemVal = Builder.CreateLoad(GEP, "mrv"); - R1 = Builder.CreateInsertElement(R1, ElemVal, - ConstantInt::get(llvm::Type::Int32Ty, i), - "mrv"); - } - return R1; - } else { - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, ArrayElemNo); - Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv_gep"); - return Builder.CreateLoad(GEP, "mrv"); - } -} - // llvm_x86_build_multiple_return_value - Function FN returns multiple value // where RETVAL points to the aggregate being returned. Build a RETVALS vector // of individual values from RETVAL aggregate. RETVALS will be used by @@ -1136,23 +1106,42 @@ } const ArrayType *ATy = cast(ElemType); unsigned ArraySize = ATy->getNumElements(); + // AElemNo keeps track of array elements. This may not match index (VElemNo) + // that tracks vector elements when Src field type is VectorType.. unsigned AElemNo = 0; while (AElemNo < ArraySize) { const Type *SElemTy = STy->getElementType(SNO); if (const VectorType *SVElemTy = dyn_cast(SElemTy)) { - // Build array elements from a vector. - unsigned VSize = SVElemTy->getNumElements(); - assert (ArraySize - AElemNo >= VSize - && "Invalid multiple return value type!"); - Value *R = llvm_x86_build_mrv_array_element(SVElemTy, RetVal, RNO, - Builder, AElemNo); + llvm::Value *Idxs[3]; + Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); + Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, RNO); + Value *R = Constant::getNullValue(SElemTy); + unsigned VElemNo = 0; + unsigned Size = AElemNo + SVElemTy->getNumElements(); + + // Only first two elements from <4 x float> are used, for example float[4] is + // transformed into two <4 x float> vectors. + if (SVElemTy->getElementType()->getTypeID() == Type::FloatTyID + && Size == 4) + Size = AElemNo + 2; + while (AElemNo < Size) { + Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, AElemNo); + Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv.av.gep"); + Value *ElemVal = Builder.CreateLoad(GEP, "mrv"); + R = Builder.CreateInsertElement(R, ElemVal, + ConstantInt::get(llvm::Type::Int32Ty, VElemNo++), + "mrv.av."); + AElemNo++; + } RetVals.push_back(R); - AElemNo += VSize; } else { - Value *R = llvm_x86_build_mrv_array_element(SElemTy, RetVal, RNO, - Builder, AElemNo); + llvm::Value *Idxs[3]; + Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); + Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, RNO); + Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, AElemNo++); + Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv.a.gep"); + Value *R = Builder.CreateLoad(GEP, "mrv.a"); RetVals.push_back(R); - ++AElemNo; } // Next Src field. ++SNO; @@ -1245,17 +1234,21 @@ unsigned ArraySize = ATy->getNumElements(); unsigned DElemNo = 0; // DestTy's DNO field's element number while (DElemNo < ArraySize) { - const VectorType *SElemTy = dyn_cast(STy->getElementType(SNO)); - if (!SElemTy) { - llvm_x86_extract_mrv_array_element(Src, Dest, SNO, 0, DNO, DElemNo, + unsigned i = 0; + unsigned Size = 1; + + if (const VectorType *SElemTy = + dyn_cast(STy->getElementType(SNO))) { + Size = SElemTy->getNumElements(); + if (SElemTy->getElementType()->getTypeID() == Type::FloatTyID + && Size == 4) + // Ignore last two <4 x float> elements. + Size = 2; + } + while (i < Size) { + llvm_x86_extract_mrv_array_element(Src, Dest, SNO, i++, + DNO, DElemNo++, Builder, isVolatile); - ++DElemNo; - } else { - for (unsigned i = 0; i < SElemTy->getNumElements(); ++i) { - llvm_x86_extract_mrv_array_element(Src, Dest, SNO, i, DNO, DElemNo, - Builder, isVolatile); - ++DElemNo; - } } // Consumed this src field. Try next one. ++SNO; From dpatel at apple.com Mon Apr 21 18:05:28 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Apr 2008 23:05:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50070 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200804212305.m3LN5Sku001127@zion.cs.uiuc.edu> Author: dpatel Date: Mon Apr 21 18:05:28 2008 New Revision: 50070 URL: http://llvm.org/viewvc/llvm-project?rev=50070&view=rev Log: Enable multiple value return. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50070&r1=50069&r2=50070&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Apr 21 18:05:28 2008 @@ -904,31 +904,20 @@ // should be returned using multiple value return instruction. bool llvm_x86_should_not_return_complex_in_memory(tree type) { - return false; -#if 0 if (!TARGET_64BIT) return false; - if (TREE_CODE(type) == COMPLEX_TYPE) + if (TREE_CODE(type) == COMPLEX_TYPE && + TREE_INT_CST_LOW(TYPE_SIZE_UNIT(type)) == 32) return true; - if (AGGREGATE_TYPE_P(type)) { - tree field = TYPE_FIELDS(type); - if (field && TREE_CHAIN(field) == NULL - && TREE_CODE(TREE_TYPE(field)) == COMPLEX_TYPE) - return true; - } return false; -#endif } // llvm_suitable_multiple_ret_value_type - Return TRUE if return value // of type TY should be returned using multiple value return instruction. static bool llvm_suitable_multiple_ret_value_type(const Type *Ty, tree TreeType) { - //NOTE: Work in progress. Do not open the flood gate yet. - return false; - if (!TARGET_64BIT) return false; From gohman at apple.com Mon Apr 21 18:59:07 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Apr 2008 23:59:07 -0000 Subject: [llvm-commits] [llvm] r50075 - in /llvm/trunk: lib/Target/X86/README-X86-64.txt lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86MachineFunctionInfo.h test/CodeGen/X86/x86-64-sret-return.ll Message-ID: <200804212359.m3LNx8Zd002898@zion.cs.uiuc.edu> Author: djg Date: Mon Apr 21 18:59:07 2008 New Revision: 50075 URL: http://llvm.org/viewvc/llvm-project?rev=50075&view=rev Log: Implement an x86-64 ABI detail of passing structs by hidden first argument. The x86-64 ABI requires the incoming value of %rdi to be copied to %rax on exit from a function that is returning a large C struct. Also, add a README-X86-64 entry detailing the missed optimization opportunity and proposing an alternative approach. Added: llvm/trunk/test/CodeGen/X86/x86-64-sret-return.ll Modified: llvm/trunk/lib/Target/X86/README-X86-64.txt llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h Modified: llvm/trunk/lib/Target/X86/README-X86-64.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-X86-64.txt?rev=50075&r1=50074&r2=50075&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-X86-64.txt (original) +++ llvm/trunk/lib/Target/X86/README-X86-64.txt Mon Apr 21 18:59:07 2008 @@ -236,3 +236,24 @@ //===---------------------------------------------------------------------===// +The x86-64 ABI for hidden-argument struct returns requires that the +incoming value of %rdi be copied into %rax by the callee upon return. + +The idea is that it saves callers from having to remember this value, +which would often require a callee-saved register. Callees usually +need to keep this value live for most of their body anyway, so it +doesn't add a significant burden on them. + +We currently implement this in codegen, however this is suboptimal +because it means that it would be quite awkward to implement the +optimization for callers. + +A better implementation would be to relax the LLVM IR rules for sret +arguments to allow a function with an sret argument to have a non-void +return type, and to have the front-end to set up the sret argument value +as the return value of the function. The front-end could more easily +emit uses of the returned struct value to be in terms of the function's +lowered return value, and it would free non-C frontends from a +complication only required by a C-based ABI. + +//===---------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=50075&r1=50074&r2=50075&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Apr 21 18:59:07 2008 @@ -875,6 +875,25 @@ Chain = DAG.getCopyToReg(Chain, VA.getLocReg(), ValToCopy, Flag); Flag = Chain.getValue(1); } + + // The x86-64 ABI for returning structs by value requires that we copy + // the sret argument into %rax for the return. We saved the argument into + // a virtual register in the entry block, so now we copy the value out + // and into %rax. + if (Subtarget->is64Bit() && + DAG.getMachineFunction().getFunction()->hasStructRetAttr()) { + MachineFunction &MF = DAG.getMachineFunction(); + X86MachineFunctionInfo *FuncInfo = MF.getInfo(); + unsigned Reg = FuncInfo->getSRetReturnReg(); + if (!Reg) { + Reg = MF.getRegInfo().createVirtualRegister(getRegClassFor(MVT::i64)); + FuncInfo->setSRetReturnReg(Reg); + } + SDOperand Val = DAG.getCopyFromReg(Chain, Reg, getPointerTy()); + + Chain = DAG.getCopyToReg(Chain, X86::RAX, Val, Flag); + Flag = Chain.getValue(1); + } RetOps[0] = Chain; // Update chain. @@ -1225,6 +1244,21 @@ } } + // The x86-64 ABI for returning structs by value requires that we copy + // the sret argument into %rax for the return. Save the argument into + // a virtual register so that we can access it from the return points. + if (Is64Bit && DAG.getMachineFunction().getFunction()->hasStructRetAttr()) { + MachineFunction &MF = DAG.getMachineFunction(); + X86MachineFunctionInfo *FuncInfo = MF.getInfo(); + unsigned Reg = FuncInfo->getSRetReturnReg(); + if (!Reg) { + Reg = MF.getRegInfo().createVirtualRegister(getRegClassFor(MVT::i64)); + FuncInfo->setSRetReturnReg(Reg); + } + SDOperand Copy = DAG.getCopyToReg(DAG.getEntryNode(), Reg, ArgValues[0]); + Root = DAG.getNode(ISD::TokenFactor, MVT::Other, Copy, Root); + } + unsigned StackSize = CCInfo.getNextStackOffset(); // align stack specially for tail calls if (CC == CallingConv::Fast) Modified: llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h?rev=50075&r1=50074&r2=50075&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h Mon Apr 21 18:59:07 2008 @@ -53,20 +53,27 @@ /// the returnaddr can be savely move to this area int TailCallReturnAddrDelta; + /// SRetReturnReg - Some subtargets require that sret lowering includes + /// returning the value of the returned struct in a register. This field + /// holds the virtual register into which the sret argument is passed. + unsigned SRetReturnReg; + public: X86MachineFunctionInfo() : ForceFramePointer(false), CalleeSavedFrameSize(0), BytesToPopOnReturn(0), DecorationStyle(None), ReturnAddrIndex(0), - TailCallReturnAddrDelta(0) {} + TailCallReturnAddrDelta(0), + SRetReturnReg(0) {} X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false), CalleeSavedFrameSize(0), BytesToPopOnReturn(0), DecorationStyle(None), ReturnAddrIndex(0), - TailCallReturnAddrDelta(0) {} + TailCallReturnAddrDelta(0), + SRetReturnReg(0) {} bool getForceFramePointer() const { return ForceFramePointer;} void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } @@ -85,6 +92,9 @@ int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; } void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;} + + unsigned getSRetReturnReg() const { return SRetReturnReg; } + void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } }; } // End llvm namespace Added: llvm/trunk/test/CodeGen/X86/x86-64-sret-return.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-64-sret-return.ll?rev=50075&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/x86-64-sret-return.ll (added) +++ llvm/trunk/test/CodeGen/X86/x86-64-sret-return.ll Mon Apr 21 18:59:07 2008 @@ -0,0 +1,54 @@ +; RUN: llvm-as < %s | llc | grep {movq %rdi, %rax} + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-apple-darwin8" + %struct.foo = type { [4 x i64] } + +define void @bar(%struct.foo* noalias sret %agg.result, %struct.foo* %d) nounwind { +entry: + %d_addr = alloca %struct.foo* ; <%struct.foo**> [#uses=2] + %memtmp = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store %struct.foo* %d, %struct.foo** %d_addr + %tmp = load %struct.foo** %d_addr, align 8 ; <%struct.foo*> [#uses=1] + %tmp1 = getelementptr %struct.foo* %agg.result, i32 0, i32 0 ; <[4 x i64]*> [#uses=4] + %tmp2 = getelementptr %struct.foo* %tmp, i32 0, i32 0 ; <[4 x i64]*> [#uses=4] + %tmp3 = getelementptr [4 x i64]* %tmp1, i32 0, i32 0 ; [#uses=1] + %tmp4 = getelementptr [4 x i64]* %tmp2, i32 0, i32 0 ; [#uses=1] + %tmp5 = load i64* %tmp4, align 8 ; [#uses=1] + store i64 %tmp5, i64* %tmp3, align 8 + %tmp6 = getelementptr [4 x i64]* %tmp1, i32 0, i32 1 ; [#uses=1] + %tmp7 = getelementptr [4 x i64]* %tmp2, i32 0, i32 1 ; [#uses=1] + %tmp8 = load i64* %tmp7, align 8 ; [#uses=1] + store i64 %tmp8, i64* %tmp6, align 8 + %tmp9 = getelementptr [4 x i64]* %tmp1, i32 0, i32 2 ; [#uses=1] + %tmp10 = getelementptr [4 x i64]* %tmp2, i32 0, i32 2 ; [#uses=1] + %tmp11 = load i64* %tmp10, align 8 ; [#uses=1] + store i64 %tmp11, i64* %tmp9, align 8 + %tmp12 = getelementptr [4 x i64]* %tmp1, i32 0, i32 3 ; [#uses=1] + %tmp13 = getelementptr [4 x i64]* %tmp2, i32 0, i32 3 ; [#uses=1] + %tmp14 = load i64* %tmp13, align 8 ; [#uses=1] + store i64 %tmp14, i64* %tmp12, align 8 + %tmp15 = getelementptr %struct.foo* %memtmp, i32 0, i32 0 ; <[4 x i64]*> [#uses=4] + %tmp16 = getelementptr %struct.foo* %agg.result, i32 0, i32 0 ; <[4 x i64]*> [#uses=4] + %tmp17 = getelementptr [4 x i64]* %tmp15, i32 0, i32 0 ; [#uses=1] + %tmp18 = getelementptr [4 x i64]* %tmp16, i32 0, i32 0 ; [#uses=1] + %tmp19 = load i64* %tmp18, align 8 ; [#uses=1] + store i64 %tmp19, i64* %tmp17, align 8 + %tmp20 = getelementptr [4 x i64]* %tmp15, i32 0, i32 1 ; [#uses=1] + %tmp21 = getelementptr [4 x i64]* %tmp16, i32 0, i32 1 ; [#uses=1] + %tmp22 = load i64* %tmp21, align 8 ; [#uses=1] + store i64 %tmp22, i64* %tmp20, align 8 + %tmp23 = getelementptr [4 x i64]* %tmp15, i32 0, i32 2 ; [#uses=1] + %tmp24 = getelementptr [4 x i64]* %tmp16, i32 0, i32 2 ; [#uses=1] + %tmp25 = load i64* %tmp24, align 8 ; [#uses=1] + store i64 %tmp25, i64* %tmp23, align 8 + %tmp26 = getelementptr [4 x i64]* %tmp15, i32 0, i32 3 ; [#uses=1] + %tmp27 = getelementptr [4 x i64]* %tmp16, i32 0, i32 3 ; [#uses=1] + %tmp28 = load i64* %tmp27, align 8 ; [#uses=1] + store i64 %tmp28, i64* %tmp26, align 8 + br label %return + +return: ; preds = %entry + ret void +} From gohman at apple.com Mon Apr 21 19:28:59 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Apr 2008 00:28:59 -0000 Subject: [llvm-commits] [llvm] r50076 - /llvm/tags/Apple/llvmCore-9999/ Message-ID: <200804220028.m3M0Sxqk003696@zion.cs.uiuc.edu> Author: djg Date: Mon Apr 21 19:28:59 2008 New Revision: 50076 URL: http://llvm.org/viewvc/llvm-project?rev=50076&view=rev Log: Creating llvmCore-9999 branch Added: llvm/tags/Apple/llvmCore-9999/ - copied from r50075, llvm/trunk/ From gohman at apple.com Mon Apr 21 19:29:05 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Apr 2008 00:29:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50077 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-9999/ Message-ID: <200804220029.m3M0T5qQ003708@zion.cs.uiuc.edu> Author: djg Date: Mon Apr 21 19:29:05 2008 New Revision: 50077 URL: http://llvm.org/viewvc/llvm-project?rev=50077&view=rev Log: Creating llvmgcc42-9999 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-9999/ - copied from r50076, llvm-gcc-4.2/trunk/ From dpatel at apple.com Mon Apr 21 19:30:00 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Apr 2008 17:30:00 -0700 Subject: [llvm-commits] [llvm] r50036 - in /llvm/trunk/tools: lto/lto.cpp lto2/LTOCodeGenerator.cpp In-Reply-To: <200804210751.m3L7p8MK001334@zion.cs.uiuc.edu> References: <200804210751.m3L7p8MK001334@zion.cs.uiuc.edu> Message-ID: <2C35BDDC-2A07-4A10-84C7-87F9D3224F80@apple.com> On Apr 21, 2008, at 12:51 AM, Owen Anderson wrote: > Author: resistor > Date: Mon Apr 21 02:51:07 2008 > New Revision: 50036 > > URL: http://llvm.org/viewvc/llvm-project?rev=50036&view=rev > Log: > Use GVN in LTO instead of GCSE+LoadVN. Thanks! Please add createMemCpyOptPass() also. - Devang From sabre at nondot.org Mon Apr 21 21:45:44 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 02:45:44 -0000 Subject: [llvm-commits] [llvm] r50078 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200804220245.m3M2jodO007408@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 21:45:44 2008 New Revision: 50078 URL: http://llvm.org/viewvc/llvm-project?rev=50078&view=rev Log: more fallout from Nicholas' asmprinter patch. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=50078&r1=50077&r2=50078&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Apr 21 21:45:44 2008 @@ -1185,28 +1185,24 @@ if (BB->getParent() == 0) Out << "\t\t; Error: Block without parent!"; - else { - if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block? - // Output predecessors for the block... - Out << "\t\t;"; - pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); - - if (PI == PE) { - Out << " No predecessors!"; - } else { - Out << " preds ="; + else if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block? + // Output predecessors for the block... + Out << "\t\t;"; + pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); + + if (PI == PE) { + Out << " No predecessors!"; + } else { + Out << " preds ="; + writeOperand(*PI, false); + for (++PI; PI != PE; ++PI) { + Out << ','; writeOperand(*PI, false); - for (++PI; PI != PE; ++PI) { - Out << ','; - writeOperand(*PI, false); - } } } } - if (BB->hasName() || !BB->use_empty() || BB->getUnwindDest() || - BB != &BB->getParent()->getEntryBlock()) - Out << "\n"; + Out << "\n"; if (AnnotationWriter) AnnotationWriter->emitBasicBlockStartAnnot(BB, Out); From sabre at nondot.org Mon Apr 21 21:53:33 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 02:53:33 -0000 Subject: [llvm-commits] [llvm] r50079 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/getelementptr-seteq.ll Message-ID: <200804220253.m3M2rXBJ007651@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 21:53:33 2008 New Revision: 50079 URL: http://llvm.org/viewvc/llvm-project?rev=50079&view=rev Log: optimize "p != gep p, ..." better. This allows us to compile getelementptr-seteq.ll into: define i1 @test(i64 %X, %S* %P) { %C = icmp eq i64 %X, -1 ; [#uses=1] ret i1 %C } instead of: define i1 @test(i64 %X, %S* %P) { %A.idx.mask = and i64 %X, 4611686018427387903 ; [#uses=1] %C = icmp eq i64 %A.idx.mask, 4611686018427387903 ; [#uses=1] ret i1 %C } And fixes the second half of PR2235. This speeds up the insertion sort case by 45%, from 1.12s to 0.77s. In practice, this will significantly speed up for loops structured like: for (double *P = Base + N; P != Base; --P) ... Which happens frequently for C++ iterators. Added: llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50079&r1=50078&r2=50079&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 21 21:53:33 2008 @@ -4873,7 +4873,7 @@ Value *Result = Constant::getNullValue(IntPtrTy); // Build a mask for high order bits. - unsigned IntPtrWidth = TD.getPointerSize()*8; + unsigned IntPtrWidth = TD.getPointerSizeInBits(); uint64_t PtrSizeMask = ~0ULL >> (64-IntPtrWidth); for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { @@ -4937,6 +4937,114 @@ return Result; } + +/// EvaluateGEPOffsetExpression - Return an value that can be used to compare of +/// the *offset* implied by GEP to zero. For example, if we have &A[i], we want +/// to return 'i' for "icmp ne i, 0". Note that, in general, indices can be +/// complex, and scales are involved. The above expression would also be legal +/// to codegen as "icmp ne (i*4), 0" (assuming A is a pointer to i32). This +/// later form is less amenable to optimization though, and we are allowed to +/// generate the first by knowing that pointer arithmetic doesn't overflow. +/// +/// If we can't emit an optimized form for this expression, this returns null. +/// +static Value *EvaluateGEPOffsetExpression(User *GEP, Instruction &I, + InstCombiner &IC) { +// return 0; + TargetData &TD = IC.getTargetData(); + gep_type_iterator GTI = gep_type_begin(GEP); + + // Check to see if this gep only has a single variable index. If so, and if + // any constant indices are a multiple of its scale, then we can compute this + // in terms of the scale of the variable index. For example, if the GEP + // implies an offset of "12 + i*4", then we can codegen this as "3 + i", + // because the expression will cross zero at the same point. + unsigned i, e = GEP->getNumOperands(); + int64_t Offset = 0; + for (i = 1; i != e; ++i, ++GTI) { + if (ConstantInt *CI = dyn_cast(GEP->getOperand(i))) { + // Compute the aggregate offset of constant indices. + if (CI->isZero()) continue; + + // Handle a struct index, which adds its field offset to the pointer. + if (const StructType *STy = dyn_cast(*GTI)) { + Offset += TD.getStructLayout(STy)->getElementOffset(CI->getZExtValue()); + } else { + uint64_t Size = TD.getABITypeSize(GTI.getIndexedType()); + Offset += Size*CI->getSExtValue(); + } + } else { + // Found our variable index. + break; + } + } + + // If there are no variable indices, we must have a constant offset, just + // evaluate it the general way. + if (i == e) return 0; + + Value *VariableIdx = GEP->getOperand(i); + // Determine the scale factor of the variable element. For example, this is + // 4 if the variable index is into an array of i32. + uint64_t VariableScale = TD.getABITypeSize(GTI.getIndexedType()); + + // Verify that there are no other variable indices. If so, emit the hard way. + for (++i, ++GTI; i != e; ++i, ++GTI) { + ConstantInt *CI = dyn_cast(GEP->getOperand(i)); + if (!CI) return 0; + + // Compute the aggregate offset of constant indices. + if (CI->isZero()) continue; + + // Handle a struct index, which adds its field offset to the pointer. + if (const StructType *STy = dyn_cast(*GTI)) { + Offset += TD.getStructLayout(STy)->getElementOffset(CI->getZExtValue()); + } else { + uint64_t Size = TD.getABITypeSize(GTI.getIndexedType()); + Offset += Size*CI->getSExtValue(); + } + } + + // Okay, we know we have a single variable index, which must be a + // pointer/array/vector index. If there is no offset, life is simple, return + // the index. + unsigned IntPtrWidth = TD.getPointerSizeInBits(); + if (Offset == 0) { + // Cast to intptrty in case a truncation occurs. If an extension is needed, + // we don't need to bother extending: the extension won't affect where the + // computation crosses zero. + if (VariableIdx->getType()->getPrimitiveSizeInBits() > IntPtrWidth) + VariableIdx = new TruncInst(VariableIdx, TD.getIntPtrType(), + VariableIdx->getNameStart(), &I); + return VariableIdx; + } + + // Otherwise, there is an index. The computation we will do will be modulo + // the pointer size, so get it. + uint64_t PtrSizeMask = ~0ULL >> (64-IntPtrWidth); + + Offset &= PtrSizeMask; + VariableScale &= PtrSizeMask; + + // To do this transformation, any constant index must be a multiple of the + // variable scale factor. For example, we can evaluate "12 + 4*i" as "3 + i", + // but we can't evaluate "10 + 3*i" in terms of i. Check that the offset is a + // multiple of the variable scale. + int64_t NewOffs = Offset / (int64_t)VariableScale; + if (Offset != NewOffs*(int64_t)VariableScale) + return 0; + + // Okay, we can do this evaluation. Start by converting the index to intptr. + const Type *IntPtrTy = TD.getIntPtrType(); + if (VariableIdx->getType() != IntPtrTy) + VariableIdx = CastInst::createIntegerCast(VariableIdx, IntPtrTy, + true /*SExt*/, + VariableIdx->getNameStart(), &I); + Constant *OffsetVal = ConstantInt::get(IntPtrTy, NewOffs); + return BinaryOperator::createAdd(VariableIdx, OffsetVal, "offset", &I); +} + + /// FoldGEPICmp - Fold comparisons between a GEP instruction and something /// else. At this point we know that the GEP is on the LHS of the comparison. Instruction *InstCombiner::FoldGEPICmp(User *GEPLHS, Value *RHS, @@ -4944,15 +5052,20 @@ Instruction &I) { assert(dyn_castGetElementPtr(GEPLHS) && "LHS is not a getelementptr!"); - if (CastInst *CI = dyn_cast(RHS)) - if (isa(CI->getOperand(0)->getType())) - RHS = CI->getOperand(0); + // Look through bitcasts. + if (BitCastInst *BCI = dyn_cast(RHS)) + RHS = BCI->getOperand(0); Value *PtrBase = GEPLHS->getOperand(0); if (PtrBase == RHS) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). - // This transformation is valid because we know pointers can't overflow. - Value *Offset = EmitGEPOffset(GEPLHS, I, *this); + // This transformation (ignoring the base and scales) is valid because we + // know pointers can't overflow. See if we can output an optimized form. + Value *Offset = EvaluateGEPOffsetExpression(GEPLHS, I, *this); + + // If not, synthesize the offset the hard way. + if (Offset == 0) + Offset = EmitGEPOffset(GEPLHS, I, *this); return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset, Constant::getNullValue(Offset->getType())); } else if (User *GEPRHS = dyn_castGetElementPtr(RHS)) { Added: llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll?rev=50079&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll Mon Apr 21 21:53:33 2008 @@ -0,0 +1,13 @@ +; Test folding of constantexpr geps into normal geps. +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i64 %X, -1} +; PR2235 + +%S = type { i32, [ 100 x i32] } + +define i1 @test(i64 %X, %S* %P) { + %A = getelementptr %S* %P, i32 0, i32 1, i64 %X + %B = getelementptr %S* %P, i32 0, i32 0 + %C = icmp eq i32* %A, %B + ret i1 %C +} + From sabre at nondot.org Mon Apr 21 22:21:49 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 03:21:49 -0000 Subject: [llvm-commits] [llvm] r50080 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200804220321.m3M3Lo9N008408@zion.cs.uiuc.edu> Author: lattner Date: Mon Apr 21 22:21:48 2008 New Revision: 50080 URL: http://llvm.org/viewvc/llvm-project?rev=50080&view=rev Log: remove dead code. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50080&r1=50079&r2=50080&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 21 22:21:48 2008 @@ -4950,7 +4950,6 @@ /// static Value *EvaluateGEPOffsetExpression(User *GEP, Instruction &I, InstCombiner &IC) { -// return 0; TargetData &TD = IC.getTargetData(); gep_type_iterator GTI = gep_type_begin(GEP); From resistor at mac.com Mon Apr 21 22:57:37 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 22 Apr 2008 03:57:37 -0000 Subject: [llvm-commits] [llvm] r50081 - in /llvm/trunk/tools: lto/lto.cpp lto2/LTOCodeGenerator.cpp Message-ID: <200804220357.m3M3vbac009352@zion.cs.uiuc.edu> Author: resistor Date: Mon Apr 21 22:57:36 2008 New Revision: 50081 URL: http://llvm.org/viewvc/llvm-project?rev=50081&view=rev Log: Add MemCpyOpt to LTO. Modified: llvm/trunk/tools/lto/lto.cpp llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=50081&r1=50080&r2=50081&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Mon Apr 21 22:57:36 2008 @@ -330,6 +330,7 @@ Passes.add(createGlobalsModRefPass()); // IP alias analysis Passes.add(createLICMPass()); // Hoist loop invariants + Passed.add(createMemCpyOptPass()); // Remove dead memcpy's Passes.add(createGVNPass()); // Remove common subexprs Passes.add(createDeadStoreEliminationPass()); // Nuke dead stores Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=50081&r1=50080&r2=50081&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Mon Apr 21 22:57:36 2008 @@ -377,6 +377,7 @@ passes.add(createGlobalsModRefPass()); // IP alias analysis passes.add(createLICMPass()); // Hoist loop invariants + passes.add(createMemCpyOptPass()); // Remove dead memcpy's passes.add(createGVNPass()); // Remove common subexprs passes.add(createDeadStoreEliminationPass()); // Nuke dead stores From clattner at apple.com Mon Apr 21 23:10:20 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Apr 2008 21:10:20 -0700 Subject: [llvm-commits] [llvm] r50081 - in /llvm/trunk/tools: lto/lto.cpp lto2/LTOCodeGenerator.cpp In-Reply-To: <200804220357.m3M3vbac009352@zion.cs.uiuc.edu> References: <200804220357.m3M3vbac009352@zion.cs.uiuc.edu> Message-ID: <7E9A0FB2-6B96-49B4-9B75-E7063C0B5866@apple.com> Shouldn't this be run after gvn like opt does? -Chris On Apr 21, 2008, at 8:57 PM, Owen Anderson wrote: > Author: resistor > Date: Mon Apr 21 22:57:36 2008 > New Revision: 50081 > > URL: http://llvm.org/viewvc/llvm-project?rev=50081&view=rev > Log: > Add MemCpyOpt to LTO. > > Modified: > llvm/trunk/tools/lto/lto.cpp > llvm/trunk/tools/lto2/LTOCodeGenerator.cpp > > Modified: llvm/trunk/tools/lto/lto.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=50081&r1=50080&r2=50081&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/lto/lto.cpp (original) > +++ llvm/trunk/tools/lto/lto.cpp Mon Apr 21 22:57:36 2008 > @@ -330,6 +330,7 @@ > Passes.add(createGlobalsModRefPass()); // IP alias analysis > > Passes.add(createLICMPass()); // Hoist loop invariants > + Passed.add(createMemCpyOptPass()); // Remove dead memcpy's > Passes.add(createGVNPass()); // Remove common subexprs > Passes.add(createDeadStoreEliminationPass()); // Nuke dead stores > > > Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=50081&r1=50080&r2=50081&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) > +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Mon Apr 21 22:57:36 > 2008 > @@ -377,6 +377,7 @@ > passes.add(createGlobalsModRefPass()); // IP alias analysis > > passes.add(createLICMPass()); // Hoist loop > invariants > + passes.add(createMemCpyOptPass()); // Remove dead memcpy's > passes.add(createGVNPass()); // Remove common > subexprs > passes.add(createDeadStoreEliminationPass()); // Nuke dead stores > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Mon Apr 21 23:41:59 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 21 Apr 2008 23:41:59 -0500 Subject: [llvm-commits] [llvm] r50081 - in /llvm/trunk/tools: lto/lto.cpp lto2/LTOCodeGenerator.cpp In-Reply-To: <7E9A0FB2-6B96-49B4-9B75-E7063C0B5866@apple.com> References: <200804220357.m3M3vbac009352@zion.cs.uiuc.edu> <7E9A0FB2-6B96-49B4-9B75-E7063C0B5866@apple.com> Message-ID: I don't know. I modelled it on llvm-ld, where it is run just before. --Owen On Apr 21, 2008, at 11:10 PM, Chris Lattner wrote: > Shouldn't this be run after gvn like opt does? > > -Chris > > On Apr 21, 2008, at 8:57 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Mon Apr 21 22:57:36 2008 >> New Revision: 50081 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=50081&view=rev >> Log: >> Add MemCpyOpt to LTO. >> >> Modified: >> llvm/trunk/tools/lto/lto.cpp >> llvm/trunk/tools/lto2/LTOCodeGenerator.cpp >> >> Modified: llvm/trunk/tools/lto/lto.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=50081&r1=50080&r2=50081&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/tools/lto/lto.cpp (original) >> +++ llvm/trunk/tools/lto/lto.cpp Mon Apr 21 22:57:36 2008 >> @@ -330,6 +330,7 @@ >> Passes.add(createGlobalsModRefPass()); // IP alias analysis >> >> Passes.add(createLICMPass()); // Hoist loop invariants >> + Passed.add(createMemCpyOptPass()); // Remove dead memcpy's >> Passes.add(createGVNPass()); // Remove common subexprs >> Passes.add(createDeadStoreEliminationPass()); // Nuke dead stores >> >> >> Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=50081&r1=50080&r2=50081&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) >> +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Mon Apr 21 22:57:36 >> 2008 >> @@ -377,6 +377,7 @@ >> passes.add(createGlobalsModRefPass()); // IP alias analysis >> >> passes.add(createLICMPass()); // Hoist loop >> invariants >> + passes.add(createMemCpyOptPass()); // Remove dead memcpy's >> passes.add(createGVNPass()); // Remove common >> subexprs >> passes.add(createDeadStoreEliminationPass()); // Nuke dead stores >> >> >> >> _______________________________________________ >> 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080421/bae1c3b2/attachment.bin From nicholas at mxc.ca Tue Apr 22 00:16:03 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Apr 2008 05:16:03 -0000 Subject: [llvm-commits] [llvm] r50086 - /llvm/trunk/test/Feature/unwindto.ll Message-ID: <200804220516.m3M5G3da011902@zion.cs.uiuc.edu> Author: nicholas Date: Tue Apr 22 00:16:02 2008 New Revision: 50086 URL: http://llvm.org/viewvc/llvm-project?rev=50086&view=rev Log: Start removing 'unwinds to' support from mainline in preparation for 2.3. Removed: llvm/trunk/test/Feature/unwindto.ll Removed: llvm/trunk/test/Feature/unwindto.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/unwindto.ll?rev=50085&view=auto ============================================================================== --- llvm/trunk/test/Feature/unwindto.ll (original) +++ llvm/trunk/test/Feature/unwindto.ll (removed) @@ -1,67 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis | llvm-as -disable-output -; PR1269 -; END -; http://nondot.org/sabre/LLVMNotes/ExceptionHandlingChanges.txt - -define i1 @test1(i8 %i, i8 %j) { -entry: unwinds to %target - %tmp = sub i8 %i, %j ; [#uses=1] - %b = icmp eq i8 %tmp, 0 ; [#uses=1] - ret i1 %b -target: - ret i1 false -} - -define i1 @test2(i8 %i, i8 %j) { -entry: - br label %0 -unwinds to %1 - %tmp = sub i8 %i, %j ; [#uses=1] - %b = icmp eq i8 %tmp, 0 ; [#uses=1] - ret i1 %b - ; No predecessors! - ret i1 false -} - -define i1 @test3(i8 %i, i8 %j) { -entry: - br label %0 -unwinds to %1 - %tmp = sub i8 %i, %j ; [#uses=1] - %b = icmp eq i8 %tmp, 0 ; [#uses=1] - ret i1 %b -unwinds to %0 - ret i1 false -} - -define i1 @test4(i8 %i, i8 %j) { - %tmp = sub i8 %i, %j ; [#uses=1] - %b = icmp eq i8 %tmp, 0 ; [#uses=1] - br label %1 -unwinds to %1 - ret i1 false -} - -define void @test5() { - unwind -} - -define void @test6() { -entry: - br label %unwind -unwind: unwinds to %unwind - unwind -} - -define i8 @test7(i1 %b) { -entry: unwinds to %cleanup - br i1 %b, label %cond_true, label %cond_false -cond_true: unwinds to %cleanup - br label %cleanup -cond_false: unwinds to %cleanup - br label %cleanup -cleanup: - %x = phi i8 [0, %entry], [1, %cond_true], [1, %cond_true], - [2, %cond_false], [2, %cond_false] - ret i8 %x -} From nicholas at mxc.ca Tue Apr 22 00:16:51 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Apr 2008 05:16:51 -0000 Subject: [llvm-commits] [llvm] r50087 - /llvm/trunk/include/llvm/Support/CFG.h Message-ID: <200804220516.m3M5Gppj011930@zion.cs.uiuc.edu> Author: nicholas Date: Tue Apr 22 00:16:51 2008 New Revision: 50087 URL: http://llvm.org/viewvc/llvm-project?rev=50087&view=rev Log: Reverse r47989. Part of removing 'unwinds to' support. Modified: llvm/trunk/include/llvm/Support/CFG.h Modified: llvm/trunk/include/llvm/Support/CFG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CFG.h?rev=50087&r1=50086&r2=50087&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CFG.h (original) +++ llvm/trunk/include/llvm/Support/CFG.h Tue Apr 22 00:16:51 2008 @@ -53,16 +53,13 @@ inline pointer operator*() const { assert(!It.atEnd() && "pred_iterator out of range!"); - if (isa(*It)) // not dyn_cast due to const-correctness - return cast(*It)->getParent(); - - return cast<_Ptr>(*It); + return cast(*It)->getParent(); } inline pointer *operator->() const { return &(operator*()); } inline _Self& operator++() { // Preincrement assert(!It.atEnd() && "pred_iterator out of range!"); - ++It; advancePastNonPreds(); + ++It; advancePastNonTerminators(); return *this; } @@ -106,8 +103,6 @@ inline SuccIterator(Term_ T, bool) // end iterator : Term(T), idx(Term->getNumSuccessors()) { assert(T && "getTerminator returned null!"); - if (Term->getParent()->getUnwindDest()) - ++idx; } inline const _Self &operator=(const _Self &I) { @@ -123,12 +118,7 @@ inline bool operator==(const _Self& x) const { return idx == x.idx; } inline bool operator!=(const _Self& x) const { return !operator==(x); } - inline pointer operator*() const { - if (idx == Term->getNumSuccessors()) - return Term->getParent()->getUnwindDest(); - - return Term->getSuccessor(idx); - } + inline pointer operator*() const { return Term->getSuccessor(idx); } inline pointer operator->() const { return operator*(); } inline _Self& operator++() { ++idx; return *this; } // Preincrement From nicholas at mxc.ca Tue Apr 22 00:20:06 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Apr 2008 05:20:06 -0000 Subject: [llvm-commits] [llvm] r50088 - /llvm/trunk/include/llvm/Support/CFG.h Message-ID: <200804220520.m3M5K6On012035@zion.cs.uiuc.edu> Author: nicholas Date: Tue Apr 22 00:20:06 2008 New Revision: 50088 URL: http://llvm.org/viewvc/llvm-project?rev=50088&view=rev Log: Whoops! Undo r50087, unbreak the build. Modified: llvm/trunk/include/llvm/Support/CFG.h Modified: llvm/trunk/include/llvm/Support/CFG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CFG.h?rev=50088&r1=50087&r2=50088&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CFG.h (original) +++ llvm/trunk/include/llvm/Support/CFG.h Tue Apr 22 00:20:06 2008 @@ -53,13 +53,16 @@ inline pointer operator*() const { assert(!It.atEnd() && "pred_iterator out of range!"); - return cast(*It)->getParent(); + if (isa(*It)) // not dyn_cast due to const-correctness + return cast(*It)->getParent(); + + return cast<_Ptr>(*It); } inline pointer *operator->() const { return &(operator*()); } inline _Self& operator++() { // Preincrement assert(!It.atEnd() && "pred_iterator out of range!"); - ++It; advancePastNonTerminators(); + ++It; advancePastNonPreds(); return *this; } @@ -103,6 +106,8 @@ inline SuccIterator(Term_ T, bool) // end iterator : Term(T), idx(Term->getNumSuccessors()) { assert(T && "getTerminator returned null!"); + if (Term->getParent()->getUnwindDest()) + ++idx; } inline const _Self &operator=(const _Self &I) { @@ -118,7 +123,12 @@ inline bool operator==(const _Self& x) const { return idx == x.idx; } inline bool operator!=(const _Self& x) const { return !operator==(x); } - inline pointer operator*() const { return Term->getSuccessor(idx); } + inline pointer operator*() const { + if (idx == Term->getNumSuccessors()) + return Term->getParent()->getUnwindDest(); + + return Term->getSuccessor(idx); + } inline pointer operator->() const { return operator*(); } inline _Self& operator++() { ++idx; return *this; } // Preincrement From evan.cheng at apple.com Tue Apr 22 01:19:07 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Apr 2008 23:19:07 -0700 Subject: [llvm-commits] [llvm] r50081 - in /llvm/trunk/tools: lto/lto.cpp lto2/LTOCodeGenerator.cpp In-Reply-To: References: <200804220357.m3M3vbac009352@zion.cs.uiuc.edu> <7E9A0FB2-6B96-49B4-9B75-E7063C0B5866@apple.com> Message-ID: Please fix llvm-ld as well then. :-) Evan On Apr 21, 2008, at 9:41 PM, Owen Anderson wrote: > I don't know. I modelled it on llvm-ld, where it is run just before. > > --Owen > > On Apr 21, 2008, at 11:10 PM, Chris Lattner wrote: > >> Shouldn't this be run after gvn like opt does? >> >> -Chris >> >> On Apr 21, 2008, at 8:57 PM, Owen Anderson wrote: >> >>> Author: resistor >>> Date: Mon Apr 21 22:57:36 2008 >>> New Revision: 50081 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=50081&view=rev >>> Log: >>> Add MemCpyOpt to LTO. >>> >>> Modified: >>> llvm/trunk/tools/lto/lto.cpp >>> llvm/trunk/tools/lto2/LTOCodeGenerator.cpp >>> >>> Modified: llvm/trunk/tools/lto/lto.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=50081&r1=50080&r2=50081&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/tools/lto/lto.cpp (original) >>> +++ llvm/trunk/tools/lto/lto.cpp Mon Apr 21 22:57:36 2008 >>> @@ -330,6 +330,7 @@ >>> Passes.add(createGlobalsModRefPass()); // IP alias analysis >>> >>> Passes.add(createLICMPass()); // Hoist loop invariants >>> + Passed.add(createMemCpyOptPass()); // Remove dead memcpy's >>> Passes.add(createGVNPass()); // Remove common subexprs >>> Passes.add(createDeadStoreEliminationPass()); // Nuke dead stores >>> >>> >>> Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=50081&r1=50080&r2=50081&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) >>> +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Mon Apr 21 22:57:36 >>> 2008 >>> @@ -377,6 +377,7 @@ >>> passes.add(createGlobalsModRefPass()); // IP alias analysis >>> >>> passes.add(createLICMPass()); // Hoist loop >>> invariants >>> + passes.add(createMemCpyOptPass()); // Remove dead memcpy's >>> passes.add(createGVNPass()); // Remove common >>> subexprs >>> passes.add(createDeadStoreEliminationPass()); // Nuke dead stores >>> >>> >>> >>> _______________________________________________ >>> 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 tonic at nondot.org Tue Apr 22 01:26:38 2008 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 22 Apr 2008 06:26:38 -0000 Subject: [llvm-commits] [nightly-test-server] r50092 - in /nightly-test-server/trunk: AcceptTestResults.php NightlyTestAccept.php Message-ID: <200804220626.m3M6QceW014347@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Apr 22 01:26:37 2008 New Revision: 50092 URL: http://llvm.org/viewvc/llvm-project?rev=50092&view=rev Log: Add build and send logs for new database. Modified: nightly-test-server/trunk/AcceptTestResults.php nightly-test-server/trunk/NightlyTestAccept.php Modified: nightly-test-server/trunk/AcceptTestResults.php URL: http://llvm.org/viewvc/llvm-project/nightly-test-server/trunk/AcceptTestResults.php?rev=50092&r1=50091&r2=50092&view=diff ============================================================================== --- nightly-test-server/trunk/AcceptTestResults.php (original) +++ nightly-test-server/trunk/AcceptTestResults.php Tue Apr 22 01:26:37 2008 @@ -341,7 +341,21 @@ mysql_close($mysql_link); } - +/******************************************************************************* +* +* Opens a file handle to the specified filename, then writes the contents out, +* and finally closes the filehandle. +* +*******************************************************************************/ +function WriteLogFile($filename, $contents) { + + $file = fopen($filename, "w"); + + if($file) { + fwrite($file, $contents); + fclose($file); + } +} /******************************************************************************* * @@ -449,6 +463,8 @@ $buildstatus = 4; } +$db_date = date("Y-m-d H:i:s"); + // Add new test run config $testRunConfigId = addTestRunConfig($runDateTime, $machineId, $uname, $gcc_version, $cvsCpuTime, $cvsWallTime, @@ -583,6 +599,47 @@ updateLLVMStats($runDateTime, $loc, $filesincvs, $dirsincvs, $testRunConfigId); } +$cwd = getcwd(); + +if($machineId) { + print $machineId; + if (!file_exists('machines-new')) { + mkdir('machines-new'); + } + + $machineDir = chdir("$cwd/machines-new"); + + if($machineDir) { + if (!file_exists("$machineId")) { + mkdir("$machineId"); + } + + $hasMachineDir = chdir("$cwd/machines-new/$machineId"); + + if($hasMachineDir) { + WriteLogFile("$db_date-Build-Log.txt", $build_log); + + $sentdata=""; + foreach ($_GET as $key => $value) { + if(strpos($value, "\n") == 0) { + $sentdata .= "'$key' => \"$value\",\n"; + } else { + $sentdata .= "'$key' => < $value) { + if(strpos($value, "\n") == 0) { + $sentdata .= "'$key' => \"$value\",\n"; + } else { + $sentdata .= "'$key' => < Author: lattner Date: Tue Apr 22 01:35:14 2008 New Revision: 50093 URL: http://llvm.org/viewvc/llvm-project?rev=50093&view=rev Log: add a basic testcase. Added: llvm/trunk/test/Transforms/JumpThreading/ llvm/trunk/test/Transforms/JumpThreading/basic.ll llvm/trunk/test/Transforms/JumpThreading/dg.exp Added: llvm/trunk/test/Transforms/JumpThreading/basic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/basic.ll?rev=50093&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/basic.ll (added) +++ llvm/trunk/test/Transforms/JumpThreading/basic.ll Tue Apr 22 01:35:14 2008 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | grep {ret i32 %v1} +; There should be no uncond branches left. +; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {br label} + +declare i32 @f1() +declare i32 @f2() +declare void @f3() + +define i32 @test(i1 %cond) { + br i1 %cond, label %T1, label %F1 + +T1: + %v1 = call i32 @f1() + br label %Merge + +F1: + %v2 = call i32 @f2() + br label %Merge + +Merge: + %A = phi i1 [true, %T1], [false, %F1] + %B = phi i32 [%v1, %T1], [%v2, %F1] + br i1 %A, label %T2, label %F2 + +T2: + call void @f3() + ret i32 %B + +F2: + ret i32 %B +} Added: llvm/trunk/test/Transforms/JumpThreading/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/dg.exp?rev=50093&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/dg.exp (added) +++ llvm/trunk/test/Transforms/JumpThreading/dg.exp Tue Apr 22 01:35:14 2008 @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]] From sabre at nondot.org Tue Apr 22 01:36:15 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 06:36:15 -0000 Subject: [llvm-commits] [llvm] r50094 - /llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Message-ID: <200804220636.m3M6aFZ6014622@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 01:36:15 2008 New Revision: 50094 URL: http://llvm.org/viewvc/llvm-project?rev=50094&view=rev Log: refactor some code, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50094&r1=50093&r2=50094&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Apr 22 01:36:15 2008 @@ -57,6 +57,8 @@ bool runOnFunction(Function &F); bool ThreadBlock(BasicBlock *BB); void ThreadEdge(BasicBlock *BB, BasicBlock *PredBB, BasicBlock *SuccBB); + + bool ProcessJumpOnPHI(PHINode *PN); }; char JumpThreading::ID = 0; RegisterPass X("jump-threading", "Jump Threading"); @@ -158,8 +160,17 @@ // See if this is a phi node in the current block. PHINode *PN = dyn_cast(Condition); - if (!PN || PN->getParent() != BB) return false; + if (PN && PN->getParent() == BB) + return ProcessJumpOnPHI(PN); + return false; +} + +/// ProcessJumpOnPHI - We have a conditional branch of switch on a PHI node in +/// the current block. See if there are any simplifications we can do based on +/// inputs to the phi node. +/// +bool JumpThreading::ProcessJumpOnPHI(PHINode *PN) { // See if the phi node has any constant values. If so, we can determine where // the corresponding predecessor will branch. unsigned PredNo = ~0U; @@ -177,6 +188,7 @@ return false; // See if the cost of duplicating this block is low enough. + BasicBlock *BB = PN->getParent(); unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB); if (JumpThreadCost > Threshold) { DOUT << " Not threading BB '" << BB->getNameStart() @@ -210,7 +222,6 @@ ".thr_comm", this); } - DOUT << " Threading edge from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost << ", across block:\n " From evan.cheng at apple.com Tue Apr 22 01:51:41 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Apr 2008 06:51:41 -0000 Subject: [llvm-commits] [llvm] r50095 - /llvm/trunk/tools/lli/lli.cpp Message-ID: <200804220651.m3M6pfBl015046@zion.cs.uiuc.edu> Author: evancheng Date: Tue Apr 22 01:51:41 2008 New Revision: 50095 URL: http://llvm.org/viewvc/llvm-project?rev=50095&view=rev Log: Added command line option -no-lazy to disable JIT lazy compilation. Modified: llvm/trunk/tools/lli/lli.cpp Modified: llvm/trunk/tools/lli/lli.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=50095&r1=50094&r2=50095&view=diff ============================================================================== --- llvm/trunk/tools/lli/lli.cpp (original) +++ llvm/trunk/tools/lli/lli.cpp Tue Apr 22 01:51:41 2008 @@ -52,6 +52,11 @@ cl::opt DisableCoreFiles("disable-core-files", cl::Hidden, cl::desc("Disable emission of core files if possible")); + + cl::opt + NoLazyCompilation("no-lazy", + cl::desc("Disable JIT lazy compilation"), + cl::init(false)); } static ExecutionEngine *EE = 0; @@ -76,8 +81,8 @@ // Load the bitcode... std::string ErrorMsg; - ModuleProvider *MP = 0; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){ + ModuleProvider *MP = NULL; + if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)) { MP = getBitcodeModuleProvider(Buffer, &ErrorMsg); if (!MP) delete Buffer; } @@ -89,18 +94,27 @@ } // Get the module as the MP could go away once EE takes over. - Module *Mod = MP->getModule(); + Module *Mod = NoLazyCompilation + ? MP->materializeModule(&ErrorMsg) : MP->getModule(); + if (!Mod) { + std::cerr << argv[0] << ": bitcode didn't read correctly.\n"; + std::cerr << "Reason: " << ErrorMsg << "\n"; + exit(1); + } // If we are supposed to override the target triple, do so now. if (!TargetTriple.empty()) Mod->setTargetTriple(TargetTriple); - + EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg); if (!EE && !ErrorMsg.empty()) { std::cerr << argv[0] << ":error creating EE: " << ErrorMsg << "\n"; exit(1); } + if (NoLazyCompilation) + EE->DisableLazyCompilation(); + // If the user specifically requested an argv[0] to pass into the program, // do it now. if (!FakeArgv0.empty()) { @@ -120,8 +134,8 @@ // using the contents of Args to determine argc & argv, and the contents of // EnvVars to determine envp. // - Function *Fn = Mod->getFunction("main"); - if (!Fn) { + Function *MainFn = Mod->getFunction("main"); + if (!MainFn) { std::cerr << "'main' function not found in module.\n"; return -1; } @@ -136,9 +150,17 @@ // Run static constructors. EE->runStaticConstructorsDestructors(false); - + + if (NoLazyCompilation) { + for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { + Function *Fn = &*I; + if (Fn != MainFn && !Fn->isDeclaration()) + EE->getPointerToFunction(Fn); + } + } + // Run main. - int Result = EE->runFunctionAsMain(Fn, InputArgv, envp); + int Result = EE->runFunctionAsMain(MainFn, InputArgv, envp); // Run static destructors. EE->runStaticConstructorsDestructors(true); From clattner at apple.com Tue Apr 22 01:55:50 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Apr 2008 23:55:50 -0700 Subject: [llvm-commits] [llvm] r50095 - /llvm/trunk/tools/lli/lli.cpp In-Reply-To: <200804220651.m3M6pfBl015046@zion.cs.uiuc.edu> References: <200804220651.m3M6pfBl015046@zion.cs.uiuc.edu> Message-ID: <2E0D47F4-84DA-4BAE-A78A-F327B740E985@apple.com> On Apr 21, 2008, at 11:51 PM, Evan Cheng wrote: > Log: > Added command line option -no-lazy to disable JIT lazy compilation. Nifty, how about naming the option '-disable-lazy-compilation'? :) -Chris From sabre at nondot.org Tue Apr 22 02:05:46 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 07:05:46 -0000 Subject: [llvm-commits] [llvm] r50096 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/and-cond.ll Message-ID: <200804220705.m3M75kRu015508@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 02:05:46 2008 New Revision: 50096 URL: http://llvm.org/viewvc/llvm-project?rev=50096&view=rev Log: Teach jump threading to thread through blocks like: br (and X, phi(Y, Z, false)), label L1, label L2 This triggers once on 252.eon and 6 times on 176.gcc. Blocks in question often look like this: bb262: ; preds = %bb261, %bb248 %iftmp.251.0 = phi i1 [ true, %bb261 ], [ false, %bb248 ] ; [#uses=4] %tmp270 = icmp eq %struct.rtx_def* %tmp.0.i, null ; [#uses=1] %bothcond = or i1 %iftmp.251.0, %tmp270 ; [#uses=1] br i1 %bothcond, label %bb288, label %bb273 In this case, it is clear that it doesn't matter if tmp.0.i is null when coming from bb261. When coming from bb248, it is all that matters. Another random example: check_asm_operands.exit: ; preds = %check_asm_operands.exit.thr_comm, %bb30.i, %bb12.i, %bb6.i413 %tmp.0.i420 = phi i1 [ true, %bb6.i413 ], [ true, %bb12.i ], [ true, %bb30.i ], [ false, %check_asm_operands.exit.thr_comm ; [#uses=1] call void @llvm.stackrestore( i8* %savedstack ) nounwind %tmp4389 = icmp eq i32 %added_sets_1.0, 0 ; [#uses=1] %tmp4394 = icmp eq i32 %added_sets_2.0, 0 ; [#uses=1] %bothcond80 = and i1 %tmp4389, %tmp4394 ; [#uses=1] %bothcond81 = and i1 %bothcond80, %tmp.0.i420 ; [#uses=1] br i1 %bothcond81, label %bb4398, label %bb4397 Here is the case from 252.eon: bb290.i.i: ; preds = %bb23.i57.i.i, %bb8.i39.i.i, %bb100.i.i, %bb100.i.i, %bb85.i.i110 %myEOF.1.i.i = phi i1 [ true, %bb100.i.i ], [ true, %bb100.i.i ], [ true, %bb85.i.i110 ], [ true, %bb8.i39.i.i ], [ false, %bb23.i57.i.i ] ; [#uses=2] %i.4.i.i = phi i32 [ %i.1.i.i, %bb85.i.i110 ], [ %i.0.i.i, %bb100.i.i ], [ %i.0.i.i, %bb100.i.i ], [ %i.3.i.i, %bb8.i39.i.i ], [ %i.3.i.i, %bb23.i57.i.i ] ; [#uses=3] %tmp292.i.i = load i8* %tmp16.i.i100, align 1 ; [#uses=1] %tmp293.not.i.i = icmp ne i8 %tmp292.i.i, 0 ; [#uses=1] %bothcond.i.i = and i1 %tmp293.not.i.i, %myEOF.1.i.i ; [#uses=1] br i1 %bothcond.i.i, label %bb202.i.i, label %bb301.i.i Factoring out 3 common predecessors. On the path from any blocks other than bb23.i57.i.i, the load and compare are dead. Added: llvm/trunk/test/Transforms/JumpThreading/and-cond.ll Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50096&r1=50095&r2=50096&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Apr 22 02:05:46 2008 @@ -57,8 +57,10 @@ bool runOnFunction(Function &F); bool ThreadBlock(BasicBlock *BB); void ThreadEdge(BasicBlock *BB, BasicBlock *PredBB, BasicBlock *SuccBB); - + BasicBlock *FactorCommonPHIPreds(PHINode *PN, Constant *CstVal); + bool ProcessJumpOnPHI(PHINode *PN); + bool ProcessJumpOnLogicalPHI(PHINode *PN, bool isAnd); }; char JumpThreading::ID = 0; RegisterPass X("jump-threading", "Jump Threading"); @@ -85,6 +87,29 @@ return EverChanged; } +/// FactorCommonPHIPreds - If there are multiple preds with the same incoming +/// value for the PHI, factor them together so we get one block to thread for +/// the whole group. +/// This is important for things like "phi i1 [true, true, false, true, x]" +/// where we only need to clone the block for the true blocks once. +/// +BasicBlock *JumpThreading::FactorCommonPHIPreds(PHINode *PN, Constant *CstVal) { + SmallVector CommonPreds; + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) + if (PN->getIncomingValue(i) == CstVal) + CommonPreds.push_back(PN->getIncomingBlock(i)); + + if (CommonPreds.size() == 1) + return CommonPreds[0]; + + DOUT << " Factoring out " << CommonPreds.size() + << " common predecessors.\n"; + return SplitBlockPredecessors(PN->getParent(), + &CommonPreds[0], CommonPreds.size(), + ".thr_comm", this); +} + + /// getJumpThreadDuplicationCost - Return the cost of duplicating this block to /// thread across it. static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB) { @@ -163,6 +188,23 @@ if (PN && PN->getParent() == BB) return ProcessJumpOnPHI(PN); + // If this is a conditional branch whose condition is and/or of a phi, try to + // simplify it. + if (BinaryOperator *CondI = dyn_cast(Condition)) { + if ((CondI->getOpcode() == Instruction::And || + CondI->getOpcode() == Instruction::Or) && + isa(BB->getTerminator())) { + if (PHINode *PN = dyn_cast(CondI->getOperand(0))) + if (PN->getParent() == BB && + ProcessJumpOnLogicalPHI(PN, CondI->getOpcode() == Instruction::And)) + return true; + if (PHINode *PN = dyn_cast(CondI->getOperand(1))) + if (PN->getParent() == BB && + ProcessJumpOnLogicalPHI(PN, CondI->getOpcode() == Instruction::And)) + return true; + } + } + return false; } @@ -196,9 +238,11 @@ return false; } - // If so, we can actually do this threading. Figure out which predecessor and - // which successor we are threading for. - BasicBlock *PredBB = PN->getIncomingBlock(PredNo); + // If so, we can actually do this threading. Merge any common predecessors + // that will act the same. + BasicBlock *PredBB = FactorCommonPHIPreds(PN, PredCst); + + // Next, figure out which successor we are threading to. BasicBlock *SuccBB; if (BranchInst *BI = dyn_cast(BB->getTerminator())) SuccBB = BI->getSuccessor(PredCst == ConstantInt::getFalse()); @@ -207,31 +251,73 @@ SuccBB = SI->getSuccessor(SI->findCaseValue(PredCst)); } - // If there are multiple preds with the same incoming value for the PHI, - // factor them together so we get one block to thread for the whole group. - // This is important for things like "phi i1 [true, true, false, true, x]" - // where we only need to clone the block for the true blocks once. - SmallVector CommonPreds; - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) - if (PN->getIncomingValue(i) == PredCst) - CommonPreds.push_back(PN->getIncomingBlock(i)); - if (CommonPreds.size() != 1) { - DOUT << " Factoring out " << CommonPreds.size() - << " common predecessors.\n"; - PredBB = SplitBlockPredecessors(BB, &CommonPreds[0], CommonPreds.size(), - ".thr_comm", this); - } - + // And finally, do it! DOUT << " Threading edge from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost << ", across block:\n " - << *BB; + << *BB << "\n"; ThreadEdge(BB, PredBB, SuccBB); ++NumThreads; return true; } +/// ProcessJumpOnLogicalPHI - PN's basic block contains a conditional branch +/// whose condition is an AND/OR where one side is PN. If PN has constant +/// operands that permit us to evaluate the condition for some operand, thread +/// through the block. For example with: +/// br (and X, phi(Y, Z, false)) +/// the predecessor corresponding to the 'false' will always jump to the false +/// destination of the branch. +/// +bool JumpThreading::ProcessJumpOnLogicalPHI(PHINode *PN, bool isAnd) { + + // We can only do the simplification for phi nodes of 'false' with AND or + // 'true' with OR. See if we have any entries in the phi for this. + unsigned PredNo = ~0U; + ConstantInt *PredCst = ConstantInt::get(Type::Int1Ty, !isAnd); + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { + if (PN->getIncomingValue(i) == PredCst) { + PredNo = i; + break; + } + } + + // If no match, bail out. + if (PredNo == ~0U) + return false; + + // See if the cost of duplicating this block is low enough. + BasicBlock *BB = PN->getParent(); + unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB); + if (JumpThreadCost > Threshold) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - Cost is too high: " << JumpThreadCost << "\n"; + return false; + } + + // If so, we can actually do this threading. Merge any common predecessors + // that will act the same. + BasicBlock *PredBB = FactorCommonPHIPreds(PN, PredCst); + + // Next, figure out which successor we are threading to. If this was an AND, + // the constant must be FALSE, and we must be targeting the 'false' block. + // If this is an OR, the constant must be TRUE, and we must be targeting the + // 'true' block. + BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(isAnd); + + // And finally, do it! + DOUT << " Threading edge through bool from '" << PredBB->getNameStart() + << "' to '" << SuccBB->getNameStart() << "' with cost: " + << JumpThreadCost << ", across block:\n " + << *BB << "\n"; + + ThreadEdge(BB, PredBB, SuccBB); + ++NumThreads; + return true; +} + + /// ThreadEdge - We have decided that it is safe and profitable to thread an /// edge from PredBB to SuccBB across BB. Transform the IR to reflect this /// change. Added: llvm/trunk/test/Transforms/JumpThreading/and-cond.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/and-cond.ll?rev=50096&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/and-cond.ll (added) +++ llvm/trunk/test/Transforms/JumpThreading/and-cond.ll Tue Apr 22 02:05:46 2008 @@ -0,0 +1,32 @@ +; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | grep {ret i32 %v1} +; There should be no uncond branches left. +; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | not grep {br label} + +declare i32 @f1() +declare i32 @f2() +declare void @f3() + +define i32 @test(i1 %cond, i1 %cond2) { + br i1 %cond, label %T1, label %F1 + +T1: + %v1 = call i32 @f1() + br label %Merge + +F1: + %v2 = call i32 @f2() + br label %Merge + +Merge: + %A = phi i1 [true, %T1], [false, %F1] + %B = phi i32 [%v1, %T1], [%v2, %F1] + %C = and i1 %A, %cond2 + br i1 %C, label %T2, label %F2 + +T2: + call void @f3() + ret i32 %B + +F2: + ret i32 %B +} From resistor at mac.com Tue Apr 22 02:12:26 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 22 Apr 2008 07:12:26 -0000 Subject: [llvm-commits] [llvm] r50097 - in /llvm/trunk/tools: llvm-ld/Optimize.cpp lto/lto.cpp lto2/LTOCodeGenerator.cpp Message-ID: <200804220712.m3M7CQ0H015696@zion.cs.uiuc.edu> Author: resistor Date: Tue Apr 22 02:12:26 2008 New Revision: 50097 URL: http://llvm.org/viewvc/llvm-project?rev=50097&view=rev Log: Move MemCpyOpt after GVN. Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp llvm/trunk/tools/lto/lto.cpp llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=50097&r1=50096&r2=50097&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Tue Apr 22 02:12:26 2008 @@ -169,8 +169,8 @@ addPass(Passes, createGlobalsModRefPass()); // IP alias analysis addPass(Passes, createLICMPass()); // Hoist loop invariants - addPass(Passes, createMemCpyOptPass()); // Remove dead memcpy's addPass(Passes, createGVNPass()); // Remove redundancies + addPass(Passes, createMemCpyOptPass()); // Remove dead memcpy's addPass(Passes, createDeadStoreEliminationPass()); // Nuke dead stores // Cleanup and simplify the code after the scalar optimizations. Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=50097&r1=50096&r2=50097&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Tue Apr 22 02:12:26 2008 @@ -330,8 +330,8 @@ Passes.add(createGlobalsModRefPass()); // IP alias analysis Passes.add(createLICMPass()); // Hoist loop invariants - Passed.add(createMemCpyOptPass()); // Remove dead memcpy's Passes.add(createGVNPass()); // Remove common subexprs + Passed.add(createMemCpyOptPass()); // Remove dead memcpy's Passes.add(createDeadStoreEliminationPass()); // Nuke dead stores // Cleanup and simplify the code after the scalar optimizations. Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=50097&r1=50096&r2=50097&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Tue Apr 22 02:12:26 2008 @@ -377,8 +377,8 @@ passes.add(createGlobalsModRefPass()); // IP alias analysis passes.add(createLICMPass()); // Hoist loop invariants - passes.add(createMemCpyOptPass()); // Remove dead memcpy's passes.add(createGVNPass()); // Remove common subexprs + passes.add(createMemCpyOptPass()); // Remove dead memcpy's passes.add(createDeadStoreEliminationPass()); // Nuke dead stores // Cleanup and simplify the code after the scalar optimizations. From evan.cheng at apple.com Tue Apr 22 02:31:23 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Apr 2008 00:31:23 -0700 Subject: [llvm-commits] [llvm] r50096 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/and-cond.ll In-Reply-To: <200804220705.m3M75kRu015508@zion.cs.uiuc.edu> References: <200804220705.m3M75kRu015508@zion.cs.uiuc.edu> Message-ID: On Apr 22, 2008, at 12:05 AM, Chris Lattner wrote: > Author: lattner > Date: Tue Apr 22 02:05:46 2008 > New Revision: 50096 > > URL: http://llvm.org/viewvc/llvm-project?rev=50096&view=rev > Log: > Teach jump threading to thread through blocks like: > > br (and X, phi(Y, Z, false)), label L1, label L2 > > This triggers once on 252.eon and 6 times on 176.gcc. Blocks > in question often look like this: > > bb262: ; preds = %bb261, %bb248 > %iftmp.251.0 = phi i1 [ true, %bb261 ], [ false, %bb248 ] ; > [#uses=4] > %tmp270 = icmp eq %struct.rtx_def* %tmp.0.i, null ; [#uses=1] > %bothcond = or i1 %iftmp.251.0, %tmp270 ; [#uses=1] > br i1 %bothcond, label %bb288, label %bb273 > > In this case, it is clear that it doesn't matter if tmp.0.i is null > when coming from bb261. When coming from bb248, it is all that > matters. Do you mean iftmp.251.0, not tmp.0.i? Evan > > > > Another random example: > > check_asm_operands.exit: ; preds = > %check_asm_operands.exit.thr_comm, %bb30.i, %bb12.i, %bb6.i413 > %tmp.0.i420 = phi i1 [ true, %bb6.i413 ], [ true, %bb12.i ], > [ true, %bb30.i ], [ false, %check_asm_operands.exit.thr_comm ; > [#uses=1] > call void @llvm.stackrestore( i8* %savedstack ) nounwind > %tmp4389 = icmp eq i32 %added_sets_1.0, 0 ; [#uses=1] > %tmp4394 = icmp eq i32 %added_sets_2.0, 0 ; [#uses=1] > %bothcond80 = and i1 %tmp4389, %tmp4394 ; [#uses=1] > %bothcond81 = and i1 %bothcond80, %tmp.0.i420 ; [#uses=1] > br i1 %bothcond81, label %bb4398, label %bb4397 > > Here is the case from 252.eon: > > bb290.i.i: ; preds = %bb23.i57.i.i, %bb8.i39.i.i, %bb100.i.i, > %bb100.i.i, %bb85.i.i110 > %myEOF.1.i.i = phi i1 [ true, %bb100.i.i ], [ true, %bb100.i.i ], > [ true, %bb85.i.i110 ], [ true, %bb8.i39.i.i ], [ false, > %bb23.i57.i.i ] ; [#uses=2] > %i.4.i.i = phi i32 [ %i.1.i.i, %bb85.i.i110 ], [ %i.0.i.i, > %bb100.i.i ], [ %i.0.i.i, %bb100.i.i ], [ %i.3.i.i, %bb8.i39.i.i ], > [ %i.3.i.i, %bb23.i57.i.i ] ; [#uses=3] > %tmp292.i.i = load i8* %tmp16.i.i100, align 1 ; [#uses=1] > %tmp293.not.i.i = icmp ne i8 %tmp292.i.i, 0 ; [#uses=1] > %bothcond.i.i = and i1 %tmp293.not.i.i, %myEOF.1.i.i ; > [#uses=1] > br i1 %bothcond.i.i, label %bb202.i.i, label %bb301.i.i > Factoring out 3 common predecessors. > > On the path from any blocks other than bb23.i57.i.i, the load and > compare > are dead. > > > Added: > llvm/trunk/test/Transforms/JumpThreading/and-cond.ll > Modified: > llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50096&r1=50095&r2=50096&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Apr 22 > 02:05:46 2008 > @@ -57,8 +57,10 @@ > bool runOnFunction(Function &F); > bool ThreadBlock(BasicBlock *BB); > void ThreadEdge(BasicBlock *BB, BasicBlock *PredBB, BasicBlock > *SuccBB); > - > + BasicBlock *FactorCommonPHIPreds(PHINode *PN, Constant *CstVal); > + > bool ProcessJumpOnPHI(PHINode *PN); > + bool ProcessJumpOnLogicalPHI(PHINode *PN, bool isAnd); > }; > char JumpThreading::ID = 0; > RegisterPass X("jump-threading", "Jump Threading"); > @@ -85,6 +87,29 @@ > return EverChanged; > } > > +/// FactorCommonPHIPreds - If there are multiple preds with the > same incoming > +/// value for the PHI, factor them together so we get one block to > thread for > +/// the whole group. > +/// This is important for things like "phi i1 [true, true, false, > true, x]" > +/// where we only need to clone the block for the true blocks once. > +/// > +BasicBlock *JumpThreading::FactorCommonPHIPreds(PHINode *PN, > Constant *CstVal) { > + SmallVector CommonPreds; > + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) > + if (PN->getIncomingValue(i) == CstVal) > + CommonPreds.push_back(PN->getIncomingBlock(i)); > + > + if (CommonPreds.size() == 1) > + return CommonPreds[0]; > + > + DOUT << " Factoring out " << CommonPreds.size() > + << " common predecessors.\n"; > + return SplitBlockPredecessors(PN->getParent(), > + &CommonPreds[0], CommonPreds.size(), > + ".thr_comm", this); > +} > + > + > /// getJumpThreadDuplicationCost - Return the cost of duplicating > this block to > /// thread across it. > static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB) { > @@ -163,6 +188,23 @@ > if (PN && PN->getParent() == BB) > return ProcessJumpOnPHI(PN); > > + // If this is a conditional branch whose condition is and/or of a > phi, try to > + // simplify it. > + if (BinaryOperator *CondI = dyn_cast(Condition)) { > + if ((CondI->getOpcode() == Instruction::And || > + CondI->getOpcode() == Instruction::Or) && > + isa(BB->getTerminator())) { > + if (PHINode *PN = dyn_cast(CondI->getOperand(0))) > + if (PN->getParent() == BB && > + ProcessJumpOnLogicalPHI(PN, CondI->getOpcode() == > Instruction::And)) > + return true; > + if (PHINode *PN = dyn_cast(CondI->getOperand(1))) > + if (PN->getParent() == BB && > + ProcessJumpOnLogicalPHI(PN, CondI->getOpcode() == > Instruction::And)) > + return true; > + } > + } > + > return false; > } > > @@ -196,9 +238,11 @@ > return false; > } > > - // If so, we can actually do this threading. Figure out which > predecessor and > - // which successor we are threading for. > - BasicBlock *PredBB = PN->getIncomingBlock(PredNo); > + // If so, we can actually do this threading. Merge any common > predecessors > + // that will act the same. > + BasicBlock *PredBB = FactorCommonPHIPreds(PN, PredCst); > + > + // Next, figure out which successor we are threading to. > BasicBlock *SuccBB; > if (BranchInst *BI = dyn_cast(BB->getTerminator())) > SuccBB = BI->getSuccessor(PredCst == ConstantInt::getFalse()); > @@ -207,31 +251,73 @@ > SuccBB = SI->getSuccessor(SI->findCaseValue(PredCst)); > } > > - // If there are multiple preds with the same incoming value for > the PHI, > - // factor them together so we get one block to thread for the > whole group. > - // This is important for things like "phi i1 [true, true, false, > true, x]" > - // where we only need to clone the block for the true blocks once. > - SmallVector CommonPreds; > - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) > - if (PN->getIncomingValue(i) == PredCst) > - CommonPreds.push_back(PN->getIncomingBlock(i)); > - if (CommonPreds.size() != 1) { > - DOUT << " Factoring out " << CommonPreds.size() > - << " common predecessors.\n"; > - PredBB = SplitBlockPredecessors(BB, &CommonPreds[0], > CommonPreds.size(), > - ".thr_comm", this); > - } > - > + // And finally, do it! > DOUT << " Threading edge from '" << PredBB->getNameStart() << "' > to '" > << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost > << ", across block:\n " > - << *BB; > + << *BB << "\n"; > > ThreadEdge(BB, PredBB, SuccBB); > ++NumThreads; > return true; > } > > +/// ProcessJumpOnLogicalPHI - PN's basic block contains a > conditional branch > +/// whose condition is an AND/OR where one side is PN. If PN has > constant > +/// operands that permit us to evaluate the condition for some > operand, thread > +/// through the block. For example with: > +/// br (and X, phi(Y, Z, false)) > +/// the predecessor corresponding to the 'false' will always jump > to the false > +/// destination of the branch. > +/// > +bool JumpThreading::ProcessJumpOnLogicalPHI(PHINode *PN, bool > isAnd) { > + > + // We can only do the simplification for phi nodes of 'false' > with AND or > + // 'true' with OR. See if we have any entries in the phi for this. > + unsigned PredNo = ~0U; > + ConstantInt *PredCst = ConstantInt::get(Type::Int1Ty, !isAnd); > + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { > + if (PN->getIncomingValue(i) == PredCst) { > + PredNo = i; > + break; > + } > + } > + > + // If no match, bail out. > + if (PredNo == ~0U) > + return false; > + > + // See if the cost of duplicating this block is low enough. > + BasicBlock *BB = PN->getParent(); > + unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB); > + if (JumpThreadCost > Threshold) { > + DOUT << " Not threading BB '" << BB->getNameStart() > + << "' - Cost is too high: " << JumpThreadCost << "\n"; > + return false; > + } > + > + // If so, we can actually do this threading. Merge any common > predecessors > + // that will act the same. > + BasicBlock *PredBB = FactorCommonPHIPreds(PN, PredCst); > + > + // Next, figure out which successor we are threading to. If this > was an AND, > + // the constant must be FALSE, and we must be targeting the > 'false' block. > + // If this is an OR, the constant must be TRUE, and we must be > targeting the > + // 'true' block. > + BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(isAnd); > + > + // And finally, do it! > + DOUT << " Threading edge through bool from '" << PredBB- > >getNameStart() > + << "' to '" << SuccBB->getNameStart() << "' with cost: " > + << JumpThreadCost << ", across block:\n " > + << *BB << "\n"; > + > + ThreadEdge(BB, PredBB, SuccBB); > + ++NumThreads; > + return true; > +} > + > + > /// ThreadEdge - We have decided that it is safe and profitable to > thread an > /// edge from PredBB to SuccBB across BB. Transform the IR to > reflect this > /// change. > > Added: llvm/trunk/test/Transforms/JumpThreading/and-cond.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/and-cond.ll?rev=50096&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/JumpThreading/and-cond.ll (added) > +++ llvm/trunk/test/Transforms/JumpThreading/and-cond.ll Tue Apr 22 > 02:05:46 2008 > @@ -0,0 +1,32 @@ > +; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine - > simplifycfg | llvm-dis | grep {ret i32 %v1} > +; There should be no uncond branches left. > +; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine - > simplifycfg | llvm-dis | not grep {br label} > + > +declare i32 @f1() > +declare i32 @f2() > +declare void @f3() > + > +define i32 @test(i1 %cond, i1 %cond2) { > + br i1 %cond, label %T1, label %F1 > + > +T1: > + %v1 = call i32 @f1() > + br label %Merge > + > +F1: > + %v2 = call i32 @f2() > + br label %Merge > + > +Merge: > + %A = phi i1 [true, %T1], [false, %F1] > + %B = phi i32 [%v1, %T1], [%v2, %F1] > + %C = and i1 %A, %cond2 > + br i1 %C, label %T2, label %F2 > + > +T2: > + call void @f3() > + ret i32 %B > + > +F2: > + ret i32 %B > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicolas.geoffray at lip6.fr Tue Apr 22 03:11:57 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 22 Apr 2008 08:11:57 -0000 Subject: [llvm-commits] [vmkit] r50099 - /vmkit/trunk/configure.ac Message-ID: <200804220811.m3M8BvWh025377@zion.cs.uiuc.edu> Author: geoffray Date: Tue Apr 22 03:11:57 2008 New Revision: 50099 URL: http://llvm.org/viewvc/llvm-project?rev=50099&view=rev Log: If only I knew autothings better... Modified: vmkit/trunk/configure.ac Modified: vmkit/trunk/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure.ac?rev=50099&r1=50098&r2=50099&view=diff ============================================================================== --- vmkit/trunk/configure.ac (original) +++ vmkit/trunk/configure.ac Tue Apr 22 03:11:57 2008 @@ -222,17 +222,17 @@ AC_ARG_WITH(vm-type, [AS_HELP_STRING(--with-vm-type=something, [VM type ('single' 'multi' or 'service')])], - [[vm=$withval]], + [[vmtype=$withval]], [[ echo Using single as vm type. - vm-type=single + vmtype=single ]] ) -if test "x${vm-type}" = "xmulti"; then +if test "x$vmtype" = "xmulti"; then CFLAGS="$CFLAGS -DMULTIPLE_VM" CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM" else - if test "x${vm-type}" = "xservice"; then + if test "x$vmtype" = "xservice"; then CFLAGS="$CFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM" CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM" fi From nicolas.geoffray at lip6.fr Tue Apr 22 03:23:59 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 22 Apr 2008 08:23:59 -0000 Subject: [llvm-commits] [vmkit] r50100 - /vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Message-ID: <200804220823.m3M8NxQb025755@zion.cs.uiuc.edu> Author: geoffray Date: Tue Apr 22 03:23:59 2008 New Revision: 50100 URL: http://llvm.org/viewvc/llvm-project?rev=50100&view=rev Log: Fix type of multiCallNewLLVM. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp?rev=50100&r1=50099&r2=50100&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Tue Apr 22 03:23:59 2008 @@ -212,9 +212,6 @@ std::vector args; args.push_back(mvm::jit::ptrType); args.push_back(Type::Int32Ty); -#ifdef MULTIPLE_VM - args.push_back(mvm::jit::ptrType); -#endif const FunctionType* type = FunctionType::get(JavaObject::llvmType, args, true); From baldrick at free.fr Tue Apr 22 03:35:59 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Apr 2008 10:35:59 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r50069 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp In-Reply-To: <200804212303.m3LN3We2001071@zion.cs.uiuc.edu> References: <200804212303.m3LN3We2001071@zion.cs.uiuc.edu> Message-ID: <200804221035.59582.baldrick@free.fr> Hi Devang, > Use { <4 x float>, <4 x float> } to return struct { float[4]; }. what is the idea here? I see 8 floats on the left and only 4 on the right... Confused, Duncan. From baldrick at free.fr Tue Apr 22 03:41:33 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Apr 2008 10:41:33 +0200 Subject: [llvm-commits] [llvm] r50075 - in /llvm/trunk: lib/Target/X86/README-X86-64.txt lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86MachineFunctionInfo.h test/CodeGen/X86/x86-64-sret-return.ll In-Reply-To: <200804212359.m3LNx8Zd002898@zion.cs.uiuc.edu> References: <200804212359.m3LNx8Zd002898@zion.cs.uiuc.edu> Message-ID: <200804221041.33937.baldrick@free.fr> Hi Dan, > +A better implementation would be to relax the LLVM IR rules for sret > +arguments to allow a function with an sret argument to have a non-void > +return type, and to have the front-end to set up the sret argument value > +as the return value of the function. The front-end could more easily > +emit uses of the returned struct value to be in terms of the function's > +lowered return value, and it would free non-C frontends from a > +complication only required by a C-based ABI. there is already some support for this in llvm-gcc, i.e. having a function return the "shadow" pointer. In llvm-abi.h (note the bit about RetPtr): /// HandleAggregateShadowArgument - This callback is invoked if the function /// returns an aggregate value by using a "shadow" first parameter, which is /// a pointer to the aggregate, of type PtrArgTy. If RetPtr is set to true, /// the pointer argument itself is returned from the function. void HandleAggregateShadowArgument(const PointerType *PtrArgTy, bool RetPtr){} Ciao, Duncan. From baldrick at free.fr Tue Apr 22 04:15:48 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Apr 2008 11:15:48 +0200 Subject: [llvm-commits] [llvm] r50079 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/getelementptr-seteq.ll In-Reply-To: <200804220253.m3M2rXBJ007651@zion.cs.uiuc.edu> References: <200804220253.m3M2rXBJ007651@zion.cs.uiuc.edu> Message-ID: <200804221115.48368.baldrick@free.fr> Hi Chris, > +static Value *EvaluateGEPOffsetExpression(User *GEP, Instruction &I, > + InstCombiner &IC) { > +// return 0; I guess this can go :) Ciao, Duncan. From nicolas.geoffray at lip6.fr Tue Apr 22 10:25:02 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 22 Apr 2008 15:25:02 -0000 Subject: [llvm-commits] [vmkit] r50101 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.cpp JavaClass.h JavaConstantPool.cpp JavaIsolate.cpp JavaJIT.cpp JavaMetaJIT.cpp JavaUpcalls.cpp Jnjvm.cpp Jnjvm.h JnjvmModuleProvider.cpp JnjvmModuleProvider.h LockedMap.h ServiceDomain.cpp VirtualTables.cpp Message-ID: <200804221525.m3MFP395006217@zion.cs.uiuc.edu> Author: geoffray Date: Tue Apr 22 10:25:01 2008 New Revision: 50101 URL: http://llvm.org/viewvc/llvm-project?rev=50101&view=rev Log: Implement C++-like virtual tables. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Tue Apr 22 10:25:01 2008 @@ -208,23 +208,18 @@ else { classDef->aquire(); if (code == 0) { - if (isStatic(access)) { - llvmType = signature->staticType; - } else { - llvmType = signature->virtualType; - } - if (!methPtr) { + if (llvmFunction->hasNotBeenReadFromBitcode()) { JavaJIT jit; jit.compilingClass = classDef; jit.compilingMethod = this; if (isNative(access)) { - methPtr = jit.nativeCompile(); + llvmFunction = jit.nativeCompile(); } else { - methPtr = jit.javaCompile(); + llvmFunction = jit.javaCompile(); } } // We can compile it, since if we're here, it's for a good reason - void* val = mvm::jit::executionEngine->getPointerToGlobal(methPtr); + void* val = mvm::jit::executionEngine->getPointerToGlobal(llvmFunction); #ifndef MULTIPLE_GC mvm::Code* temp = (mvm::Code*)(Collector::begOf(val)); #else Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Tue Apr 22 10:25:01 2008 @@ -104,7 +104,7 @@ JavaState status; unsigned int access; Jnjvm *isolate; - + unsigned int virtualTableSize; static const int MaxDisplay; static JavaObject* jnjvmClassLoader; @@ -240,7 +240,8 @@ class JavaMethod : public mvm::Object { public: static VirtualTable* VT; - llvm::Function* methPtr; + llvm::Function* llvmFunction; + llvm::ConstantInt* offset; unsigned int access; Signdef* signature; std::vector > attributs; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Tue Apr 22 10:25:01 2008 @@ -410,8 +410,11 @@ // lookup the method meth = cl->lookupMethodDontThrow(utf8, sign->keyName, isStatic(access), false); if (meth) { // don't throw if no meth, the exception will be thrown just in time - if (meth->methPtr) { - ctpRes[index] = (void*)meth->methPtr; + if (meth->llvmFunction) { + if (meth->llvmFunction->hasNotBeenReadFromBitcode()) { + meth->classDef->isolate->functionDefs->hash(meth->llvmFunction, meth); + } + ctpRes[index] = (void*)meth->llvmFunction; return (llvm::Function*)ctpRes[index]; } } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Tue Apr 22 10:25:01 2008 @@ -435,10 +435,12 @@ isolate->analyseClasspathEnv(isolate->bootClasspathEnv); isolate->functions = vm_new(isolate, FunctionMap)(); + isolate->functionDefs = vm_new(isolate, FunctionDefMap)(); isolate->module = new llvm::Module("Isolate JnJVM"); isolate->protectModule = mvm::Lock::allocNormal(); isolate->TheModuleProvider = new JnjvmModuleProvider(isolate->module, - isolate->functions); + isolate->functions, + isolate->functionDefs); JavaJIT::initialiseJITIsolateVM(isolate); isolate->bootstrapThread = vm_new(isolate, JavaThread)(); @@ -497,10 +499,12 @@ isolate->analyseClasspathEnv(isolate->bootClasspathEnv); isolate->functions = vm_new(isolate, FunctionMap)(); + isolate->functionDefs = vm_new(isolate, FunctionDefMap)(); isolate->protectModule = mvm::Lock::allocNormal(); isolate->module = new llvm::Module("Bootstrap JnJVM"); isolate->TheModuleProvider = new JnjvmModuleProvider(isolate->module, - isolate->functions); + isolate->functions, + isolate->functionDefs); JavaJIT::initialiseJITBootstrapVM(isolate); isolate->bootstrapThread = vm_new(isolate, JavaThread)(); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Tue Apr 22 10:25:01 2008 @@ -120,13 +120,7 @@ - compilingClass->isolate->protectModule->lock(); - Function* func = llvmFunction = - llvm::Function::Create(funcType, GlobalValue::ExternalLinkage, - compilingMethod->printString(), - compilingClass->isolate->module); - compilingClass->isolate->protectModule->unlock(); - + Function* func = llvmFunction = compilingMethod->llvmFunction; if (jnjvm) { mvm::jit::executionEngine->addGlobalMapping(func, natPtr); return llvmFunction; @@ -207,6 +201,8 @@ PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "end native compile %s\n", compilingMethod->printString()); + func->setLinkage(GlobalValue::ExternalLinkage); + return llvmFunction; } @@ -374,13 +370,8 @@ const FunctionType *funcType = compilingMethod->llvmType; returnType = funcType->getReturnType(); - compilingClass->isolate->protectModule->lock(); - Function* func = llvmFunction = - llvm::Function::Create(funcType, GlobalValue::ExternalLinkage, - compilingMethod->printString(), - compilingClass->isolate->module); - compilingClass->isolate->protectModule->unlock(); - + Function* func = llvmFunction = compilingMethod->llvmFunction; + BasicBlock* startBlock = currentBlock = createBasicBlock("start"); endExceptionBlock = createBasicBlock("endExceptionBlock"); unifiedUnreachable = createBasicBlock("unifiedUnreachable"); @@ -514,6 +505,7 @@ new UnreachableInst(unifiedUnreachable); } + func->setLinkage(GlobalValue::ExternalLinkage); mvm::jit::runPasses(llvmFunction, JavaThread::get()->perFunctionPasses); /* Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Tue Apr 22 10:25:01 2008 @@ -171,10 +171,50 @@ va_end(ap); } +VirtualTable* allocateVT(Class* cl, std::vector::iterator meths) { + if (meths == cl->virtualMethods.end()) { + uint64 size = cl->virtualTableSize; + VirtualTable* VT = (VirtualTable*)malloc(size * sizeof(void*)); + if (cl->super) { + memcpy(VT, cl->super->VT, cl->super->virtualTableSize * sizeof(void*)); + } else { + memcpy(VT, JavaObject::VT, VT_SIZE); + } + return VT; + } else { + JavaMethod* meth = *meths; + JavaMethod* parent = cl->super? + cl->super->lookupMethodDontThrow(meth->name, meth->type, false, true) : 0; + + uint64_t offset = 0; + if (!parent) { + offset = cl->virtualTableSize++; + mvm::jit::protectConstants(); + meth->offset = ConstantInt::get(Type::Int32Ty, offset); + mvm::jit::unprotectConstants(); + } else { + offset = parent->offset->getZExtValue(); + meth->offset = parent->offset; + } + VirtualTable* VT = allocateVT(cl, meths + 1); + Function* func = meth->llvmFunction; + ExecutionEngine* EE = mvm::jit::executionEngine; + ((void**)VT)[offset] = EE->getPointerToFunctionOrStub(func); + return VT; + } +} + + + VirtualTable* JavaJIT::makeVT(Class* cl, bool stat) { - VirtualTable * res = malloc(VT_SIZE); - memcpy(res, JavaObject::VT, VT_SIZE); + VirtualTable* res = 0; + if (stat) { + res = (VirtualTable*)malloc(VT_SIZE); + memcpy(res, JavaObject::VT, VT_SIZE); + } else { + res = allocateVT(cl, cl->virtualMethods.begin()); + } #ifdef WITH_TRACER const Type* type = stat ? cl->staticType : cl->virtualType; @@ -239,10 +279,10 @@ if (!stat) { cl->virtualTracer = func; - cl->codeVirtualTracer = (mvm::Code*)((unsigned*)codePtr - 1); + cl->codeVirtualTracer = mvm::Code::getCodeFromPointer(codePtr); } else { cl->staticTracer = func; - cl->codeStaticTracer = (mvm::Code*)((unsigned*)codePtr - 1); + cl->codeStaticTracer = mvm::Code::getCodeFromPointer(codePtr); } #endif return res; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Tue Apr 22 10:25:01 2008 @@ -227,7 +227,7 @@ const llvm::FunctionType* type = llvm::FunctionType::get(JavaObject::llvmType, args, false); - Classpath::getCallingClassLoader->methPtr = + Classpath::getCallingClassLoader->llvmFunction = llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, "_ZN5jnjvm7JavaJIT21getCallingClassLoaderEv", vm->module); @@ -244,7 +244,7 @@ const llvm::FunctionType* type = llvm::FunctionType::get(JavaObject::llvmType, args, false); - internString->methPtr = + internString->llvmFunction = llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, "internString", vm->module); @@ -260,7 +260,7 @@ #endif const llvm::FunctionType* type = llvm::FunctionType::get(llvm::Type::Int8Ty, args, false); - isArray->methPtr = + isArray->llvmFunction = llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, "isArray", vm->module); @@ -287,7 +287,7 @@ const llvm::FunctionType* type = llvm::FunctionType::get(JavaObject::llvmType, args, false); - getCallingClass->methPtr = + getCallingClass->llvmFunction = llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, "getCallingClass", vm->module); @@ -302,7 +302,7 @@ const llvm::FunctionType* type = llvm::FunctionType::get(JavaObject::llvmType, args, false); - getCallingClassLoader->methPtr = + getCallingClassLoader->llvmFunction = llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, "getCallingClassLoader", vm->module); Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Tue Apr 22 10:25:01 2008 @@ -176,10 +176,12 @@ if (super == 0) { cl->depth = 0; cl->display.push_back(cl); + cl->virtualTableSize = VT_SIZE; } else { cl->super = loadName(super, classLoader, true, false, true); int depth = cl->super->depth; cl->depth = depth + 1; + cl->virtualTableSize = cl->super->virtualTableSize; for (uint32 i = 0; i < cl->super->display.size(); ++i) { cl->display.push_back(cl->super->display[i]); } @@ -760,7 +762,7 @@ JavaField* Jnjvm::constructField(Class* cl, const UTF8* name, const UTF8* type, uint32 access){ - FieldCmp CC(name, cl, type); + FieldCmp CC(name, cl, type, 0); JavaField* f = loadedFields->lookupOrCreate(CC, this, fieldDup); f->access = access; f->offset = 0; @@ -769,7 +771,7 @@ JavaField* Jnjvm::lookupField(CommonClass* cl, const UTF8* name, const UTF8* type) { - FieldCmp CC(name, cl, type); + FieldCmp CC(name, cl, type, 0); JavaField* f = loadedFields->lookup(CC); return f; } @@ -780,16 +782,26 @@ method->type = cmp.type; method->classDef = (Class*)cmp.classDef; method->signature = (Signdef*)vm->constructType(method->type); - method->methPtr = 0; method->code = 0; + method->access = cmp.access; + if (isStatic(method->access)) { + method->llvmType =method->signature->staticType; + } else { + method->llvmType = method->signature->virtualType; + } + method->classDef->isolate->protectModule->lock(); + method->llvmFunction = + llvm::Function::Create(method->llvmType, llvm::GlobalValue::GhostLinkage, + method->printString(), + method->classDef->isolate->module); + method->classDef->isolate->protectModule->unlock(); return method; } JavaMethod* Jnjvm::constructMethod(Class* cl, const UTF8* name, const UTF8* type, uint32 access) { - FieldCmp CC(name, cl, type); + FieldCmp CC(name, cl, type, access); JavaMethod* f = loadedMethods->lookupOrCreate(CC, this, methodDup); - f->access = access; return f; } Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h Tue Apr 22 10:25:01 2008 @@ -53,6 +53,7 @@ class TypeMap; class FunctionMap; class FunctionDefMap; +class FunctionDefMap; class AllocationMap; @@ -263,6 +264,7 @@ llvm::Module* module; JnjvmModuleProvider* TheModuleProvider; FunctionMap* functions; + FunctionDefMap* functionDefs; #ifndef MULTIPLE_GC void* allocateObject(unsigned int sz, VirtualTable* VT) { Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Tue Apr 22 10:25:01 2008 @@ -40,7 +40,7 @@ meth->compiledPtr(); - ctpInfo->ctpRes[index] = meth->methPtr; + ctpInfo->ctpRes[index] = meth->llvmFunction; return meth; } @@ -48,21 +48,24 @@ bool JnjvmModuleProvider::materializeFunction(Function *F, std::string *ErrInfo) { - std::pair * p = functions->lookup(F); - if (!p) { - // VT methods + + if (mvm::jit::executionEngine->getPointerToGlobalIfAvailable(F)) + return false; + + if (!(F->hasNotBeenReadFromBitcode())) return false; - } else { - if (mvm::jit::executionEngine->getPointerToGlobalIfAvailable(F)) { - return false; - } else { - JavaMethod* meth = staticLookup(p->first, p->second); - void* val = meth->compiledPtr(); - if (F->isDeclaration()) - mvm::jit::executionEngine->updateGlobalMapping(F, val); - return false; - } + JavaMethod* meth = functionDefs->lookup(F); + + if (!meth) { + // It's a callback + std::pair * p = functions->lookup(F); + meth = staticLookup(p->first, p->second); } + + void* val = meth->compiledPtr(); + if (F->isDeclaration()) + mvm::jit::executionEngine->updateGlobalMapping(F, val); + return false; } Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h Tue Apr 22 10:25:01 2008 @@ -21,9 +21,11 @@ class JnjvmModuleProvider : public ModuleProvider { public: FunctionMap* functions; - JnjvmModuleProvider(Module *m, FunctionMap* fm) { + FunctionDefMap* functionDefs; + JnjvmModuleProvider(Module *m, FunctionMap* fm, FunctionDefMap* fdm) { TheModule = m; functions = fm; + functionDefs= fdm; } bool materializeFunction(Function *F, std::string *ErrInfo = 0); Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Tue Apr 22 10:25:01 2008 @@ -139,9 +139,10 @@ const UTF8* name; CommonClass* classDef; const UTF8* type; + uint32_t access; - FieldCmp(const UTF8* n, CommonClass* c, const UTF8* t) : name(n), classDef(c), - type(t) {} + FieldCmp(const UTF8* n, CommonClass* c, const UTF8* t, uint32 a) : name(n), classDef(c), + type(t), access(a) {} inline bool operator<(const FieldCmp &cmp) const { if (name < cmp.name) return true; Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Tue Apr 22 10:25:01 2008 @@ -71,10 +71,12 @@ #endif service->functions = vm_new(service, FunctionMap)(); + service->functionDefs = vm_new(service, FunctionDefMap)(); service->module = new llvm::Module("Service Domain"); service->protectModule = mvm::Lock::allocNormal(); service->TheModuleProvider = new JnjvmModuleProvider(service->module, - service->functions); + service->functions, + service->functionDefs); #ifdef MULTIPLE_GC mvm::jit::memoryManager->addGCForModule(service->module, service->GC); Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=50101&r1=50100&r2=50101&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Tue Apr 22 10:25:01 2008 @@ -244,6 +244,7 @@ TRACE_VECTOR(JavaObject*, gc_allocator, globalRefs); //globalRefsLock->MARK_AND_TRACE; functions->MARK_AND_TRACE; + functionDefs->MARK_AND_TRACE; #ifdef MULTIPLE_VM statics->MARK_AND_TRACE; delegatees->MARK_AND_TRACE; From pekka.jaaskelainen at tut.fi Tue Apr 22 10:39:15 2008 From: pekka.jaaskelainen at tut.fi (=?ISO-8859-15?Q?Pekka_J=E4=E4skel=E4inen?=) Date: Tue, 22 Apr 2008 18:39:15 +0300 Subject: [llvm-commits] [PATCH] a switch to allow using Bugpoint with an external execution command Message-ID: <480E06A3.20506@tut.fi> Hello, Here is a simple addition to the Bugpoint tool which enables to use it in a cross compiler environment. It adds two switches which can be used to define a custom "execution command" for the produced bitcode. In our case we use LLVM as a static compiler in a customizable processor design platform (http://tce.cs.tut.fi), thus the LLVM generated bitcodes cannot be run natively, but with a retargetable instruction set simulator after having scheduled for the target's resources. This modification allowed us to track a bug in our code generator which happened only with a certain LLVM optimization. It would be nice to have this feature merged in trunk so we don't have to have our separate branch of Bugpoint here just for this feature. I suspect this feature is useful for others using LLVM as a cross compiling environment. The patch attached. Best regards, -- Pekka -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-bugpoint-custom-execution-command.patch Type: text/x-patch Size: 6953 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080422/180422b5/attachment.bin From pekka.jaaskelainen at tut.fi Tue Apr 22 11:08:06 2008 From: pekka.jaaskelainen at tut.fi (=?ISO-8859-15?Q?Pekka_J=E4=E4skel=E4inen?=) Date: Tue, 22 Apr 2008 19:08:06 +0300 Subject: [llvm-commits] [PATCH] a switch to allow using Bugpoint with an external execution command In-Reply-To: <480E06A3.20506@tut.fi> References: <480E06A3.20506@tut.fi> Message-ID: <480E0D66.7020809@tut.fi> Here's an updated patch according to feedback from aKor at IRC: clarified the need for tokenization with a comment. -- Pekka -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-bugpoint-custom-execution-command.v2.patch Type: text/x-patch Size: 7226 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080422/df024494/attachment.bin From dpatel at apple.com Tue Apr 22 11:21:13 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Apr 2008 09:21:13 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r50069 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp In-Reply-To: <200804221035.59582.baldrick@free.fr> References: <200804212303.m3LN3We2001071@zion.cs.uiuc.edu> <200804221035.59582.baldrick@free.fr> Message-ID: On Apr 22, 2008, at 1:35 AM, Duncan Sands wrote: > Hi Devang, > >> Use { <4 x float>, <4 x float> } to return struct { float[4]; }. > > what is the idea here? I see 8 floats on the left and only 4 on > the right... The idea is to bring ABI designers and x86-64 code gen folks on the same page :) Here float[0] and float[1] goes into first two elements of first < 4 x float> vector and remaining float[2] and float[3] goes into first two elements of second <4 x float> vector. - Devang From clattner at apple.com Tue Apr 22 12:51:06 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Apr 2008 10:51:06 -0700 Subject: [llvm-commits] [llvm] r50096 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/and-cond.ll In-Reply-To: References: <200804220705.m3M75kRu015508@zion.cs.uiuc.edu> Message-ID: <1D17C23B-A124-45D8-ABE9-98907734A0D5@apple.com> On Apr 22, 2008, at 12:31 AM, Evan Cheng wrote: > > On Apr 22, 2008, at 12:05 AM, Chris Lattner wrote: > >> Author: lattner >> Date: Tue Apr 22 02:05:46 2008 >> New Revision: 50096 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=50096&view=rev >> Log: >> Teach jump threading to thread through blocks like: >> >> br (and X, phi(Y, Z, false)), label L1, label L2 >> >> This triggers once on 252.eon and 6 times on 176.gcc. Blocks >> in question often look like this: >> >> bb262: ; preds = %bb261, %bb248 >> %iftmp.251.0 = phi i1 [ true, %bb261 ], [ false, %bb248 ] ; >> [#uses=4] >> %tmp270 = icmp eq %struct.rtx_def* %tmp.0.i, null ; [#uses=1] >> %bothcond = or i1 %iftmp.251.0, %tmp270 ; [#uses=1] >> br i1 %bothcond, label %bb288, label %bb273 >> >> In this case, it is clear that it doesn't matter if tmp.0.i is null >> when coming from bb261. When coming from bb248, it is all that >> matters. > > Do you mean iftmp.251.0, not tmp.0.i? I meant tmp.0.i, which is an operand in the tmp270 icmp instruction. Regardless of whether tmp.0.i is null or not (i.e. regardless of the value of %tmp270), the bb261 predecessor will *always* take the branch to bb288. The pass now makes bb261 jump directly to bb288, eliminating the compare (and branch, and phi) on that path. Eliminating that path makes the other path through the block simpler, turning the phi node into 'false', and turning the 'bothcond' or into 'or false, tmp270'. This means that on the bb248 path, the phi and or is gone, but the comparison against null remains. -Chris From dpatel at apple.com Tue Apr 22 12:54:36 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Apr 2008 17:54:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50103 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200804221754.m3MHsaU7011051@zion.cs.uiuc.edu> Author: dpatel Date: Tue Apr 22 12:54:36 2008 New Revision: 50103 URL: http://llvm.org/viewvc/llvm-project?rev=50103&view=rev Log: Pass { i32 } using an i32, instead of i64. This fixes remaining test_passing_struct.c failures from gcc.target/x86-64/abi testsuite. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50103&r1=50102&r2=50103&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Apr 22 12:54:36 2008 @@ -758,7 +758,11 @@ int NumClasses = ix86_ClassifyArgument(Mode, TreeType, Class, 0); if (!NumClasses) return false; - + + if (NumClasses == 1 && Class[0] == X86_64_INTEGERSI_CLASS) + // This will fit in one i32 register. + return false; + for (int i = 0; i < NumClasses; ++i) { switch (Class[i]) { case X86_64_INTEGER_CLASS: From dpatel at apple.com Tue Apr 22 13:16:29 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Apr 2008 18:16:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50104 - /llvm-gcc-4.2/trunk/gcc/llvm-abi.h Message-ID: <200804221816.m3MIGTEF011665@zion.cs.uiuc.edu> Author: dpatel Date: Tue Apr 22 13:16:29 2008 New Revision: 50104 URL: http://llvm.org/viewvc/llvm-project?rev=50104&view=rev Log: By default _Complexes are returned in memory. Each target can override this hook. This fixes darwin-ppc bootstrap. Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=50104&r1=50103&r2=50104&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Tue Apr 22 13:16:29 2008 @@ -109,7 +109,7 @@ // multiple value return instruction. #ifndef LLVM_SHOULD_NOT_RETURN_COMPLEX_IN_MEMORY #define LLVM_SHOULD_NOT_RETURN_COMPLEX_IN_MEMORY(X) \ - true + false #endif // doNotUseShadowReturn - Return true if the specified GCC type From gohman at apple.com Tue Apr 22 13:34:30 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Apr 2008 11:34:30 -0700 Subject: [llvm-commits] [llvm] r50075 - in /llvm/trunk: lib/Target/X86/README-X86-64.txt lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86MachineFunctionInfo.h test/CodeGen/X86/x86-64-sret-return.ll In-Reply-To: <200804221041.33937.baldrick@free.fr> References: <200804212359.m3LNx8Zd002898@zion.cs.uiuc.edu> <200804221041.33937.baldrick@free.fr> Message-ID: <645BA852-9AAA-4883-A7DB-7D2F2DB7D74D@apple.com> On Apr 22, 2008, at 1:41 AM, Duncan Sands wrote: > Hi Dan, > >> +A better implementation would be to relax the LLVM IR rules for sret >> +arguments to allow a function with an sret argument to have a non- >> void >> +return type, and to have the front-end to set up the sret argument >> value >> +as the return value of the function. The front-end could more easily >> +emit uses of the returned struct value to be in terms of the >> function's >> +lowered return value, and it would free non-C frontends from a >> +complication only required by a C-based ABI. > > there is already some support for this in llvm-gcc, i.e. having a > function > return the "shadow" pointer. In llvm-abi.h (note the bit about > RetPtr): > > /// HandleAggregateShadowArgument - This callback is invoked if the > function > /// returns an aggregate value by using a "shadow" first parameter, > which is > /// a pointer to the aggregate, of type PtrArgTy. If RetPtr is set > to true, > /// the pointer argument itself is returned from the function. > void HandleAggregateShadowArgument(const PointerType *PtrArgTy, > bool RetPtr){} Ok, so the work remaining would be to actually implement this RetPtr argument :-). Well, that and updating StructRetPromotion and updating the various places around LLVM that assume/require functions with sret arguments to have a void return. Dan From sabre at nondot.org Tue Apr 22 15:46:09 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 20:46:09 -0000 Subject: [llvm-commits] [llvm] r50106 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/and-and-cond.ll Message-ID: <200804222046.m3MKk9Lt016043@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 15:46:09 2008 New Revision: 50106 URL: http://llvm.org/viewvc/llvm-project?rev=50106&view=rev Log: Dig through multiple levels of AND to thread jumps if needed. Added: llvm/trunk/test/Transforms/JumpThreading/and-and-cond.ll Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50106&r1=50105&r2=50106&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Apr 22 15:46:09 2008 @@ -60,7 +60,7 @@ BasicBlock *FactorCommonPHIPreds(PHINode *PN, Constant *CstVal); bool ProcessJumpOnPHI(PHINode *PN); - bool ProcessJumpOnLogicalPHI(PHINode *PN, bool isAnd); + bool ProcessBranchOnLogical(Value *V, BasicBlock *BB, bool isAnd); }; char JumpThreading::ID = 0; RegisterPass X("jump-threading", "Jump Threading"); @@ -193,16 +193,10 @@ if (BinaryOperator *CondI = dyn_cast(Condition)) { if ((CondI->getOpcode() == Instruction::And || CondI->getOpcode() == Instruction::Or) && - isa(BB->getTerminator())) { - if (PHINode *PN = dyn_cast(CondI->getOperand(0))) - if (PN->getParent() == BB && - ProcessJumpOnLogicalPHI(PN, CondI->getOpcode() == Instruction::And)) - return true; - if (PHINode *PN = dyn_cast(CondI->getOperand(1))) - if (PN->getParent() == BB && - ProcessJumpOnLogicalPHI(PN, CondI->getOpcode() == Instruction::And)) - return true; - } + isa(BB->getTerminator()) && + ProcessBranchOnLogical(CondI, BB, + CondI->getOpcode() == Instruction::And)) + return true; } return false; @@ -270,8 +264,23 @@ /// the predecessor corresponding to the 'false' will always jump to the false /// destination of the branch. /// -bool JumpThreading::ProcessJumpOnLogicalPHI(PHINode *PN, bool isAnd) { - +bool JumpThreading::ProcessBranchOnLogical(Value *V, BasicBlock *BB, + bool isAnd) { + // If this is a binary operator tree of the same AND/OR opcode, check the + // LHS/RHS. + if (BinaryOperator *BO = dyn_cast(V)) + if (isAnd && BO->getOpcode() == Instruction::And || + !isAnd && BO->getOpcode() == Instruction::Or) { + if (ProcessBranchOnLogical(BO->getOperand(0), BB, isAnd)) + return true; + if (ProcessBranchOnLogical(BO->getOperand(1), BB, isAnd)) + return true; + } + + // If this isn't a PHI node, we can't handle it. + PHINode *PN = dyn_cast(V); + if (!PN || PN->getParent() != BB) return false; + // We can only do the simplification for phi nodes of 'false' with AND or // 'true' with OR. See if we have any entries in the phi for this. unsigned PredNo = ~0U; @@ -288,7 +297,6 @@ return false; // See if the cost of duplicating this block is low enough. - BasicBlock *BB = PN->getParent(); unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB); if (JumpThreadCost > Threshold) { DOUT << " Not threading BB '" << BB->getNameStart() Added: llvm/trunk/test/Transforms/JumpThreading/and-and-cond.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/and-and-cond.ll?rev=50106&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/and-and-cond.ll (added) +++ llvm/trunk/test/Transforms/JumpThreading/and-and-cond.ll Tue Apr 22 15:46:09 2008 @@ -0,0 +1,33 @@ +; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | grep {ret i32 %v1} +; There should be no uncond branches left. +; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | not grep {br label} + +declare i32 @f1() +declare i32 @f2() +declare void @f3() + +define i32 @test(i1 %cond, i1 %cond2, i1 %cond3) { + br i1 %cond, label %T1, label %F1 + +T1: + %v1 = call i32 @f1() + br label %Merge + +F1: + %v2 = call i32 @f2() + br label %Merge + +Merge: + %A = phi i1 [true, %T1], [false, %F1] + %B = phi i32 [%v1, %T1], [%v2, %F1] + %C = and i1 %A, %cond2 + %D = and i1 %C, %cond3 + br i1 %D, label %T2, label %F2 + +T2: + call void @f3() + ret i32 %B + +F2: + ret i32 %B +} From dpatel at apple.com Tue Apr 22 16:03:42 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Apr 2008 21:03:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50107 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp testsuite/gcc.target/x86_64/abi/test_struct_returning.c Message-ID: <200804222103.m3ML3gGF016641@zion.cs.uiuc.edu> Author: dpatel Date: Tue Apr 22 16:03:42 2008 New Revision: 50107 URL: http://llvm.org/viewvc/llvm-project?rev=50107&view=rev Log: Return { float, float, float } as ret <4 x float>, float Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50107&r1=50106&r2=50107&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Apr 22 16:03:42 2008 @@ -922,6 +922,7 @@ // of type TY should be returned using multiple value return instruction. static bool llvm_suitable_multiple_ret_value_type(const Type *Ty, tree TreeType) { + if (!TARGET_64BIT) return false; @@ -1013,7 +1014,16 @@ ElementTypes.push_back(Type::X86_FP80Ty); return StructType::get(ElementTypes, STy->isPacked()); } - + + if (NumElements == 3 + && STy->getElementType(0)->getTypeID() == Type::FloatTyID + && STy->getElementType(1)->getTypeID() == Type::FloatTyID + && STy->getElementType(2)->getTypeID() == Type::FloatTyID) { + ElementTypes.push_back(VectorType::get(Type::FloatTy, 4)); + ElementTypes.push_back(Type::FloatTy); + return StructType::get(ElementTypes, STy->isPacked()); + } + for (unsigned i = 0; i < NumElements; ++i) { const Type *T = STy->getElementType(i); @@ -1031,12 +1041,12 @@ if (ATy->getElementType()->isFloatingPoint()) { switch (size) { case 2: - // use { <2 x float> } for struct { float[2]; } - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 2)); + // use { <4 x float> } for struct { float[2]; } + ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); break; case 3: - // use { <2 x float>, float } for struct { float[3]; } - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 2)); + // use { <4 x float>, float } for struct { float[3]; } + ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); ElementTypes.push_back(ATy->getElementType()); break; case 4: @@ -1072,6 +1082,30 @@ unsigned NumElements = RetSTy->getNumElements(); unsigned RNO = 0; unsigned SNO = 0; + + if (NumElements == 3 + && RetSTy->getElementType(0)->getTypeID() == Type::FloatTyID + && RetSTy->getElementType(1)->getTypeID() == Type::FloatTyID + && RetSTy->getElementType(2)->getTypeID() == Type::FloatTyID) { + Value *GEP0 = Builder.CreateStructGEP(RetVal, 0, "mrv_idx"); + Value *ElemVal0 = Builder.CreateLoad(GEP0, "mrv"); + Value *GEP1 = Builder.CreateStructGEP(RetVal, 1, "mrv_idx"); + Value *ElemVal1 = Builder.CreateLoad(GEP1, "mrv"); + Value *GEP2 = Builder.CreateStructGEP(RetVal, 2, "mrv_idx"); + Value *ElemVal2 = Builder.CreateLoad(GEP2, "mrv"); + + Value *R = Constant::getNullValue(STy->getElementType(0)); + R = Builder.CreateInsertElement(R, ElemVal0, + ConstantInt::get(llvm::Type::Int32Ty, 0), + "mrv.f."); + R = Builder.CreateInsertElement(R, ElemVal1, + ConstantInt::get(llvm::Type::Int32Ty, 1), + "mrv.f."); + RetVals.push_back(R); + RetVals.push_back(ElemVal2); + return; + } + while (RNO < NumElements) { const Type *ElemType = RetSTy->getElementType(RNO); if (ElemType->isFirstClassType()) { @@ -1081,7 +1115,8 @@ ++RNO; ++SNO; continue; - } + } + // Special treatement for _Complex. if (const StructType *ComplexType = dyn_cast(ElemType)) { llvm::Value *Idxs[3]; @@ -1188,6 +1223,32 @@ const StructType *DestTy = cast(PTy->getElementType()); unsigned SNO = 0; unsigned DNO = 0; + + if (DestTy->getNumElements() == 3 + && DestTy->getElementType(0)->getTypeID() == Type::FloatTyID + && DestTy->getElementType(1)->getTypeID() == Type::FloatTyID + && DestTy->getElementType(2)->getTypeID() == Type::FloatTyID) { + // DestTy is { float, float, float } + // STy is { <4 x float>, float > } + + GetResultInst *GR = Builder.CreateGetResult(Src, 0, "mrv_gr"); + + Value *E0Index = ConstantInt::get(Type::Int32Ty, 0); + Value *GR0 = Builder.CreateExtractElement(GR, E0Index, "mrv.v"); + Value *GEP0 = Builder.CreateStructGEP(Dest, 0, "mrv_gep"); + Builder.CreateStore(GR0, GEP0, isVolatile); + + Value *E1Index = ConstantInt::get(Type::Int32Ty, 1); + Value *GR1 = Builder.CreateExtractElement(GR, E1Index, "mrv.v"); + Value *GEP1 = Builder.CreateStructGEP(Dest, 1, "mrv_gep"); + Builder.CreateStore(GR1, GEP1, isVolatile); + + Value *GEP2 = Builder.CreateStructGEP(Dest, 2, "mrv_gep"); + GetResultInst *GR2 = Builder.CreateGetResult(Src, 1, "mrv_gr"); + Builder.CreateStore(GR2, GEP2, isVolatile); + return; + } + while (SNO < NumElements) { const Type *DestElemType = DestTy->getElementType(DNO); Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c?rev=50107&r1=50106&r2=50107&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c Tue Apr 22 16:03:42 2008 @@ -28,7 +28,10 @@ MEM, INT_SSE, SSE_INT, - SSE_F_V + /* LLVM LOCAL begin */ + SSE_F_V, + SSE_F_V3 + /* LLVM LOCAL end */ } Type; /* Structures which should be returned in INTEGER. */ @@ -165,6 +168,10 @@ #define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \ struct S_ ## I f_ ## I (void) { struct S_ ## I s; B; return s; } D(600,float f[4], SSE_F_V, s.f[0] = s.f[1] = s.f[2] = s.f[3] = 42) +/* LLVM LOCAL begin */ +D(601,float f[3], SSE_F_V3, s.f[0] = s.f[1] = s.f[2] = 42) +D(602,float f0;float f1; float f2, SSE_F_V3, s.f0 = s.f1 = s.f2 = 42) +/* LLVM LOCAL end */ #undef D void clear_all (void) @@ -181,6 +188,8 @@ case SSE_F: assert (xmm0f[0] == 42); break; case SSE_D: assert (xmm0d[0] == 42); break; case SSE_F_V: assert (xmm0f[0] == 42 && xmm0f[1]==42 && xmm1f[0] == 42 && xmm1f[1] == 42); break; + /* LLVM LOCAL */ + case SSE_F_V3: assert (xmm0f[0] == 42 && xmm0f[1]==42 && xmm1f[0] == 42); break; case X87: assert (x87_regs[0]._ldouble == 42); break; case INT_SSE: check_300(); break; case SSE_INT: check_400(); break; @@ -222,7 +231,9 @@ D(530) D(600) - if (num_failed) + /* LLVM LOCAL */ + D(601) D(602) + if (num_failed) abort (); return 0; From sabre at nondot.org Tue Apr 22 16:40:39 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 21:40:39 -0000 Subject: [llvm-commits] [llvm] r50110 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/compare.ll Message-ID: <200804222140.m3MLedkK017865@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 16:40:39 2008 New Revision: 50110 URL: http://llvm.org/viewvc/llvm-project?rev=50110&view=rev Log: Start doing the significantly useful part of jump threading: handle cases where a comparison has a phi input and that phi is a constant. For example, stuff like: Threading edge through bool from 'bb2149' to 'bb2231' with cost: 1, across block: bb2237: ; preds = %bb2231, %bb2149 %tmp2328.rle = phi i32 [ %tmp2232, %bb2231 ], [ %tmp2232439, %bb2149 ] ; [#uses=2] %done.0 = phi i32 [ %done.2, %bb2231 ], [ 0, %bb2149 ] ; [#uses=1] %tmp2239 = icmp eq i32 %done.0, 0 ; [#uses=1] br i1 %tmp2239, label %bb2231, label %bb2327 or bb38.i298: ; preds = %bb33.i295, %bb1693 %tmp39.i296.rle = phi %struct.ibox* [ null, %bb1693 ], [ %tmp39.i296.rle1109, %bb33.i295 ] ; <%struct.ibox*> [#uses=2] %minspan.1.i291.reg2mem.1 = phi i32 [ 32000, %bb1693 ], [ %minspan.0.i288, %bb33.i295 ] ; [#uses=1] %tmp40.i297 = icmp eq %struct.ibox* %tmp39.i296.rle, null ; [#uses=1] br i1 %tmp40.i297, label %implfeeds.exit311, label %bb43.i301 This triggers thousands of times in spec. Added: llvm/trunk/test/Transforms/JumpThreading/compare.ll Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50110&r1=50109&r2=50110&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Apr 22 16:40:39 2008 @@ -61,6 +61,7 @@ bool ProcessJumpOnPHI(PHINode *PN); bool ProcessBranchOnLogical(Value *V, BasicBlock *BB, bool isAnd); + bool ProcessBranchOnCompare(CmpInst *Cmp, BasicBlock *BB); }; char JumpThreading::ID = 0; RegisterPass X("jump-threading", "Jump Threading"); @@ -199,6 +200,14 @@ return true; } + // If we have "br (phi != 42)" and the phi node has any constant values as + // operands, we can thread through this block. + if (CmpInst *CondCmp = dyn_cast(Condition)) + if (isa(CondCmp->getOperand(0)) && + isa(CondCmp->getOperand(1)) && + ProcessBranchOnCompare(CondCmp, BB)) + return true; + return false; } @@ -209,18 +218,14 @@ bool JumpThreading::ProcessJumpOnPHI(PHINode *PN) { // See if the phi node has any constant values. If so, we can determine where // the corresponding predecessor will branch. - unsigned PredNo = ~0U; ConstantInt *PredCst = 0; - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { - if ((PredCst = dyn_cast(PN->getIncomingValue(i)))) { - PredNo = i; + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) + if ((PredCst = dyn_cast(PN->getIncomingValue(i)))) break; - } - } // If no incoming value has a constant, we don't know the destination of any // predecessors. - if (PredNo == ~0U) + if (PredCst == 0) return false; // See if the cost of duplicating this block is low enough. @@ -325,6 +330,77 @@ return true; } +/// ProcessBranchOnCompare - We found a branch on a comparison between a phi +/// node and a constant. If the PHI node contains any constants as inputs, we +/// can fold the compare for that edge and thread through it. +bool JumpThreading::ProcessBranchOnCompare(CmpInst *Cmp, BasicBlock *BB) { + PHINode *PN = cast(Cmp->getOperand(0)); + Constant *RHS = cast(Cmp->getOperand(1)); + + // If the phi isn't in the current block, an incoming edge to this block + // doesn't control the destination. + if (PN->getParent() != BB) + return false; + + // We can do this simplification if any comparisons fold to true or false. + // See if any do. + Constant *PredCst = 0; + bool TrueDirection = false; + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { + PredCst = dyn_cast(PN->getIncomingValue(i)); + if (PredCst == 0) continue; + + Constant *Res; + if (ICmpInst *ICI = dyn_cast(Cmp)) + Res = ConstantExpr::getICmp(ICI->getPredicate(), PredCst, RHS); + else + Res = ConstantExpr::getFCmp(cast(Cmp)->getPredicate(), + PredCst, RHS); + // If this folded to a constant expr, we can't do anything. + if (ConstantInt *ResC = dyn_cast(Res)) { + TrueDirection = ResC->getZExtValue(); + break; + } + // If this folded to undef, just go the false way. + if (isa(Res)) { + TrueDirection = false; + break; + } + + // Otherwise, we can't fold this input. + PredCst = 0; + } + + // If no match, bail out. + if (PredCst == 0) + return false; + + // See if the cost of duplicating this block is low enough. + unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB); + if (JumpThreadCost > Threshold) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - Cost is too high: " << JumpThreadCost << "\n"; + return false; + } + + // If so, we can actually do this threading. Merge any common predecessors + // that will act the same. + BasicBlock *PredBB = FactorCommonPHIPreds(PN, PredCst); + + // Next, get our successor. + BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(!TrueDirection); + + // And finally, do it! + DOUT << " Threading edge through bool from '" << PredBB->getNameStart() + << "' to '" << SuccBB->getNameStart() << "' with cost: " + << JumpThreadCost << ", across block:\n " + << *BB << "\n"; + + ThreadEdge(BB, PredBB, SuccBB); + ++NumThreads; + return true; +} + /// ThreadEdge - We have decided that it is safe and profitable to thread an /// edge from PredBB to SuccBB across BB. Transform the IR to reflect this Added: llvm/trunk/test/Transforms/JumpThreading/compare.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/compare.ll?rev=50110&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/compare.ll (added) +++ llvm/trunk/test/Transforms/JumpThreading/compare.ll Tue Apr 22 16:40:39 2008 @@ -0,0 +1,30 @@ +; There should be no phi nodes left. +; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {phi i32} + +declare i32 @f1() +declare i32 @f2() +declare void @f3() + +define i32 @test(i1 %cond) { + br i1 %cond, label %T1, label %F1 + +T1: + %v1 = call i32 @f1() + br label %Merge + +F1: + %v2 = call i32 @f2() + br label %Merge + +Merge: + %B = phi i32 [%v1, %T1], [12, %F1] + %A = icmp ne i32 %B, 42 + br i1 %A, label %T2, label %F2 + +T2: + call void @f3() + ret i32 1 + +F2: + ret i32 0 +} From criswell at uiuc.edu Tue Apr 22 16:50:39 2008 From: criswell at uiuc.edu (John Criswell) Date: Tue, 22 Apr 2008 21:50:39 -0000 Subject: [llvm-commits] [poolalloc] r50111 - /poolalloc/trunk/lib/DSA/Local.cpp Message-ID: <200804222150.m3MLodoe018219@zion.cs.uiuc.edu> Author: criswell Date: Tue Apr 22 16:50:39 2008 New Revision: 50111 URL: http://llvm.org/viewvc/llvm-project?rev=50111&view=rev Log: Added support for some of the LLVM exception handling intrinsics. Modified: poolalloc/trunk/lib/DSA/Local.cpp Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=50111&r1=50110&r2=50111&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Tue Apr 22 16:50:39 2008 @@ -577,6 +577,21 @@ if (DSNode *N = getValueDest(**CS.arg_begin()).getNode()) N->setModifiedMarker(); return true; + + case Intrinsic::eh_exception: { + DSNode * Node = createNode(); + Node->setIncompleteMarker(); + Node->foldNodeCompletely(); + setDestTo (*(CS.getInstruction()), Node); + return true; + } + + case Intrinsic::eh_selector_i32: + case Intrinsic::eh_selector_i64: + case Intrinsic::eh_typeid_for_i32: + case Intrinsic::eh_typeid_for_i64: + return true; + default: { //ignore pointer free intrinsics if (!isa(F->getReturnType())) { From dpatel at apple.com Tue Apr 22 17:38:33 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Apr 2008 22:38:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50114 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200804222238.m3MMcX37019750@zion.cs.uiuc.edu> Author: dpatel Date: Tue Apr 22 17:38:33 2008 New Revision: 50114 URL: http://llvm.org/viewvc/llvm-project?rev=50114&view=rev Log: Fix Benchmarks/McCat/09-vor/vor failures by restoring original behavior. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50114&r1=50113&r2=50114&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Apr 22 17:38:33 2008 @@ -954,6 +954,12 @@ if (!foundNonInt) return false; + // FIXME: Fix code generator. Causes Benchmarks/McCat/09-vor/vor failures. + if (STyElements == 2 + && STy->getElementType(0)->getTypeID() == Type::DoubleTyID + && STy->getElementType(1)->getTypeID() == Type::DoubleTyID) + return false; + // Let gcc specific routine answer the question. enum x86_64_reg_class Class[MAX_CLASSES]; enum machine_mode Mode = ix86_getNaturalModeForType(TreeType); From kremenek at apple.com Tue Apr 22 17:56:39 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 22 Apr 2008 22:56:39 -0000 Subject: [llvm-commits] [llvm] r50115 - /llvm/tags/checker/checker-0009/ Message-ID: <200804222256.m3MMudwb020316@zion.cs.uiuc.edu> Author: kremenek Date: Tue Apr 22 17:56:39 2008 New Revision: 50115 URL: http://llvm.org/viewvc/llvm-project?rev=50115&view=rev Log: Tagging checker-0009. Added: llvm/tags/checker/checker-0009/ - copied from r50114, llvm/trunk/ From evan.cheng at apple.com Tue Apr 22 19:38:06 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Apr 2008 00:38:06 -0000 Subject: [llvm-commits] [llvm] r50118 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/shl-icmp.ll Message-ID: <200804230038.m3N0c6Lb023137@zion.cs.uiuc.edu> Author: evancheng Date: Tue Apr 22 19:38:06 2008 New Revision: 50118 URL: http://llvm.org/viewvc/llvm-project?rev=50118&view=rev Log: Don't do: "(X & 4) >> 1 == 2 --> (X & 4) == 4" if there are more than one uses of the shift result. Added: llvm/trunk/test/Transforms/InstCombine/shl-icmp.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50118&r1=50117&r2=50118&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Apr 22 19:38:06 2008 @@ -6065,13 +6065,14 @@ // Otherwise, check to see if the bits shifted out are known to be zero. // If so, we can compare against the unshifted value: // (X & 4) >> 1 == 2 --> (X & 4) == 4. - if (MaskedValueIsZero(LHSI->getOperand(0), + if (LHSI->hasOneUse() && + MaskedValueIsZero(LHSI->getOperand(0), APInt::getLowBitsSet(Comp.getBitWidth(), ShAmtVal))) { return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0), ConstantExpr::getShl(RHS, ShAmt)); } - if (LHSI->hasOneUse() || RHSV == 0) { + if (LHSI->hasOneUse()) { // Otherwise strength reduce the shift into an and. APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); Constant *Mask = ConstantInt::get(Val); Added: llvm/trunk/test/Transforms/InstCombine/shl-icmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shl-icmp.ll?rev=50118&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/shl-icmp.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/shl-icmp.ll Tue Apr 22 19:38:06 2008 @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | opt -instcombine -stats -disable-output |& \ +; RUN: grep {Number of insts combined} | grep 5 + +define i8 @t1(i8 zeroext %x, i8 zeroext %y) zeroext nounwind { +entry: + %tmp1 = lshr i8 %x, 7 + %cond1 = icmp ne i8 %tmp1, 0 + br i1 %cond1, label %bb1, label %bb2 + +bb1: + ret i8 %tmp1 + +bb2: + %tmp2 = add i8 %tmp1, %y + ret i8 %tmp2 +} + +define i8 @t2(i8 zeroext %x) zeroext nounwind { +entry: + %tmp1 = lshr i8 %x, 7 + %cond1 = icmp ne i8 %tmp1, 0 + br i1 %cond1, label %bb1, label %bb2 + +bb1: + ret i8 0 + +bb2: + ret i8 1 +} From ggreif at gmail.com Tue Apr 22 19:52:30 2008 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 23 Apr 2008 00:52:30 -0000 Subject: [llvm-commits] [llvm] r50120 - /llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Message-ID: <200804230052.m3N0qUYB023563@zion.cs.uiuc.edu> Author: ggreif Date: Tue Apr 22 19:52:30 2008 New Revision: 50120 URL: http://llvm.org/viewvc/llvm-project?rev=50120&view=rev Log: less naive implementation: duplicate loop Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp?rev=50120&r1=50119&r2=50120&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Tue Apr 22 19:52:30 2008 @@ -20,29 +20,36 @@ //===----------------------------------------------------------------------===// const Use *Use::getImpliedUser() const { - bool StopEncountered = false; - ptrdiff_t Offset = 1; const Use *Current = this; while (true) { - unsigned Tag = extractTag(Current->Prev); + unsigned Tag = extractTag((Current++)->Prev); switch (Tag) { case zeroDigitTag: case oneDigitTag: - if (StopEncountered) - Offset = (Offset << 1) + Tag; - break; - case stopTag: - if (StopEncountered) - return Current + Offset; - StopEncountered = true; - Current += 2; continue; - case fullStopTag: - return Current + 1; + + case stopTag: { + ++Current; + ptrdiff_t Offset = 1; + while (true) { + unsigned Tag = extractTag((Current++)->Prev); + switch (Tag) { + case zeroDigitTag: + case oneDigitTag: + Offset = (Offset << 1) + Tag; + continue; + case stopTag: + return Current + Offset - 1; + case fullStopTag: + return Current; + } + } } - ++Current; + case fullStopTag: + return Current; + } } } From dalej at apple.com Tue Apr 22 20:03:05 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Apr 2008 01:03:05 -0000 Subject: [llvm-commits] [llvm] r50121 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200804230103.m3N135Qu023931@zion.cs.uiuc.edu> Author: johannes Date: Tue Apr 22 20:03:05 2008 New Revision: 50121 URL: http://llvm.org/viewvc/llvm-project?rev=50121&view=rev Log: Do not change the type of a ByVal argument to a type of a different size. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50121&r1=50120&r2=50121&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Apr 22 20:03:05 2008 @@ -8748,16 +8748,29 @@ const PointerType *PTy = cast(Callee->getType()); const FunctionType *FTy = cast(PTy->getElementType()); if (FTy->isVarArg()) { + int ix = FTy->getNumParams() + (isa(Callee) ? 3 : 1); // See if we can optimize any arguments passed through the varargs area of // the call. for (CallSite::arg_iterator I = CS.arg_begin()+FTy->getNumParams(), - E = CS.arg_end(); I != E; ++I) + E = CS.arg_end(); I != E; ++I, ++ix) if (CastInst *CI = dyn_cast(*I)) { - // If this cast does not effect the value passed through the varargs + // If this cast does not affect the value passed through the varargs // area, we can eliminate the use of the cast. - Value *Op = CI->getOperand(0); + const PointerType* SrcPTy, *DstPTy; if (CI->isLosslessCast()) { - *I = Op; + // The size of ByVal arguments is derived from the type, so we + // can't change to a type with a different size. If the size were + // passed explicitly we could avoid this check. + if (CS.paramHasAttr(ix, ParamAttr::ByVal) && + (SrcPTy = cast(CI->getOperand(0)->getType())) && + (DstPTy = cast(CI->getType()))) { + const Type* SrcTy = SrcPTy->getElementType(); + const Type* DstTy = DstPTy->getElementType(); + if (!SrcTy->isSized() || !DstTy->isSized() || + TD->getABITypeSize(SrcTy) != TD->getABITypeSize(DstTy)) + continue; + } + *I = CI->getOperand(0); Changed = true; } } From sabre at nondot.org Tue Apr 22 20:04:02 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 20:04:02 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2008-06-13-SPAA-STMDataPartitioning.html 2008-06-13-SPAA-STMDataPartitioning.pdf Message-ID: <200804230104.m3N142IK023984@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2008-06-13-SPAA-STMDataPartitioning.html added (r1.1) 2008-06-13-SPAA-STMDataPartitioning.pdf added (r1.1) --- Log message: add a new paper. --- Diffs of the changes: (+47 -0) 2008-06-13-SPAA-STMDataPartitioning.html | 47 +++++++++++++++++++++++++++++++ 2008-06-13-SPAA-STMDataPartitioning.pdf | 0 2 files changed, 47 insertions(+) Index: llvm-www/pubs/2008-06-13-SPAA-STMDataPartitioning.html diff -c /dev/null llvm-www/pubs/2008-06-13-SPAA-STMDataPartitioning.html:1.1 *** /dev/null Tue Apr 22 20:03:24 2008 --- llvm-www/pubs/2008-06-13-SPAA-STMDataPartitioning.html Tue Apr 22 20:03:13 2008 *************** *** 0 **** --- 1,47 ---- + + + + + + Automatic Data Partitioning in Software Transactional Memories + + + +
+ Automatic Data Partitioning in Software Transactional Memories +
+
+ Torvald Riegel, Christof Fetzer, and Pascal Felber +
+ +

Abstract:

+
+ We investigate to which extent data partitioning can help improve the performance of + software transactional memory (STM). Our main idea is that the access patterns of the + various data structures of an application might be sufficiently different so that it would + be beneficial to tune the behavior of the STM for individual data partitions. We evaluate + our approach using standard transactional memory benchmarks. We show that these + applications contain partitions with different characteristics and, despite the runtime + overhead introduced by partition tracking and dynamic tuning, that partitioning provides + significant performance improvements. +
+ +

Bibtex:

+
+ @inproceedings{Riegel2008partitioning,
+   author = {{T}orvald {R}iegel and {C}hristof {F}etzer and {P}ascal {F}elber},
+   title = {{A}utomatic {D}ata {P}artitioning in {S}oftware {T}ransactional {M}emories},
+   booktitle = {20th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA)},
+   year = {2008},
+ }
+ 
+ +

Download:

+ + + + Index: llvm-www/pubs/2008-06-13-SPAA-STMDataPartitioning.pdf From sabre at nondot.org Tue Apr 22 20:05:29 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Apr 2008 20:05:29 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html Message-ID: <200804230105.m3N15Trv024052@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: index.html updated: 1.66 -> 1.67 --- Log message: link to new paper. --- Diffs of the changes: (+5 -0) index.html | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.66 llvm-www/pubs/index.html:1.67 --- llvm-www/pubs/index.html:1.66 Tue Mar 25 18:14:34 2008 +++ llvm-www/pubs/index.html Tue Apr 22 20:05:11 2008 @@ -3,6 +3,11 @@
    +
  1. "Automatic Data Partitioning in Software +Transactional Memories"
    +Torvald Riegel, Christof Fetzer, and Pascal Felber
    +Proc. 20th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA'08), June, 2008
  2. +
  3. "Cycle-approximate Retargetable Performance Estimation at the Transaction Level"
    Y. Hwang, S. Abdi, and D. Gajski
    From ggreif at gmail.com Tue Apr 22 20:18:40 2008 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 23 Apr 2008 01:18:40 -0000 Subject: [llvm-commits] [llvm] r50122 - /llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Message-ID: <200804230118.m3N1IewL024426@zion.cs.uiuc.edu> Author: ggreif Date: Tue Apr 22 20:18:40 2008 New Revision: 50122 URL: http://llvm.org/viewvc/llvm-project?rev=50122&view=rev Log: further tweak Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp?rev=50122&r1=50121&r2=50122&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Tue Apr 22 20:18:40 2008 @@ -33,16 +33,15 @@ ++Current; ptrdiff_t Offset = 1; while (true) { - unsigned Tag = extractTag((Current++)->Prev); + unsigned Tag = extractTag(Current->Prev); switch (Tag) { case zeroDigitTag: case oneDigitTag: + ++Current; Offset = (Offset << 1) + Tag; continue; - case stopTag: - return Current + Offset - 1; - case fullStopTag: - return Current; + default: + return Current + Offset; } } } From dalej at apple.com Tue Apr 22 20:22:22 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Apr 2008 01:22:22 -0000 Subject: [llvm-commits] [llvm] r50123 - /llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Message-ID: <200804230122.m3N1MMaG024544@zion.cs.uiuc.edu> Author: johannes Date: Tue Apr 22 20:22:22 2008 New Revision: 50123 URL: http://llvm.org/viewvc/llvm-project?rev=50123&view=rev Log: new test Added: llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Added: llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll?rev=50123&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Tue Apr 22 20:22:22 2008 @@ -0,0 +1,21 @@ +;; The bitcast cannot be eliminated because byval arguments need +;; the correct type, or at least a type of the correct size. +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9" + %struct.NSRect = type { [4 x float] } + +define void @foo(i8* %context) nounwind { +entry: + %context_addr = alloca i8* ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i8* %context, i8** %context_addr + %tmp = load i8** %context_addr, align 4 ; [#uses=1] + %tmp1 = bitcast i8* %tmp to %struct.NSRect* ; <%struct.NSRect*> [#uses=1] + call void (i32, ...)* @bar( i32 3, %struct.NSRect* byval align 4 %tmp1 ) nounwind + br label %return +return: ; preds = %entry + ret void +} + +declare void @bar(i32, ...) From ggreif at gmail.com Tue Apr 22 20:45:39 2008 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 23 Apr 2008 01:45:39 -0000 Subject: [llvm-commits] [llvm] r50124 - /llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp Message-ID: <200804230145.m3N1jdjx025172@zion.cs.uiuc.edu> Author: ggreif Date: Tue Apr 22 20:45:39 2008 New Revision: 50124 URL: http://llvm.org/viewvc/llvm-project?rev=50124&view=rev Log: only zap the known number of operands, minor refactoring Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp?rev=50124&r1=50123&r2=50124&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp Tue Apr 22 20:45:39 2008 @@ -167,8 +167,9 @@ /// 3. If NumOps == NumOperands, trim the reserved space. /// void PHINode::resizeOperands(unsigned NumOps) { + unsigned e = getNumOperands(); if (NumOps == 0) { - NumOps = (getNumOperands())*3/2; + NumOps = e*3/2; if (NumOps < 4) NumOps = 4; // 4 op PHI nodes are VERY common. } else if (NumOps*2 > NumOperands) { // No resize needed. @@ -182,11 +183,11 @@ ReservedSpace = NumOps; Use *OldOps = OperandList; Use *NewOps = allocHungoffUses(NumOps); - for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + for (unsigned i = 0; i != e; ++i) { NewOps[i].init(OldOps[i], this); } - if (OldOps) dropHungoffUses(OldOps); OperandList = NewOps; + if (OldOps) Use::zap(OldOps, OldOps + e, true); } /// hasConstantValue - If the specified PHI node always merges together the same @@ -2716,13 +2717,14 @@ /// resizeOperands - resize operands - This adjusts the length of the operands /// list according to the following behavior: /// 1. If NumOps == 0, grow the operand list in response to a push_back style -/// of operation. This grows the number of ops by 1.5 times. +/// of operation. This grows the number of ops by 3 times. /// 2. If NumOps > NumOperands, reserve space for NumOps operands. /// 3. If NumOps == NumOperands, trim the reserved space. /// void SwitchInst::resizeOperands(unsigned NumOps) { + unsigned e = getNumOperands(); if (NumOps == 0) { - NumOps = getNumOperands()/2*6; + NumOps = e*3; } else if (NumOps*2 > NumOperands) { // No resize needed. if (ReservedSpace >= NumOps) return; @@ -2735,11 +2737,11 @@ ReservedSpace = NumOps; Use *NewOps = allocHungoffUses(NumOps); Use *OldOps = OperandList; - for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + for (unsigned i = 0; i != e; ++i) { NewOps[i].init(OldOps[i], this); } - if (OldOps) dropHungoffUses(OldOps); OperandList = NewOps; + if (OldOps) Use::zap(OldOps, OldOps + e, true); } From gohman at apple.com Tue Apr 22 21:43:20 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Apr 2008 19:43:20 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <83CD954F-CD49-4D4B-950D-B6CB6CD1B32D@apple.com> <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> Message-ID: <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> On Apr 21, 2008, at 8:51 AM, Roman Levenstein wrote: > Sorry, forgot to attach the patch ;-) > > 2008/4/21, Roman Levenstein : >> Hi, >> >> 2008/4/19, Roman Levenstein : >> >>> Hi Dan, Hi Evan, >>> >>> 2008/4/19, Dan Gohman : >>> >>>> >>>> On Apr 16, 2008, at 9:19 AM, Roman Levenstein wrote: >>>>> >>>> >>>>> BTW, Dan, have you had any time to look at the patch introducing >>>>> queues instead of heaps in the target specific instruction >>>>> selectors? >>>> >>>> >>>> Is this the ScheduleDAGRRList patch that changes >>>> std::priority_queue >>>> to std::set? I know you checked in part of those changes already; >>>> could you send me an updated patch with just the outstanding >>>> changes? >>> >>> >>> No. I don't mean the ScheduleDAGRRList.pacth. For this one, I >>> proposed >>> the remaining patch just with the outstanding patches yesterday (see >>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080414/061236.html) >>> . >>> And it is also about using the std::set :-) >>> >>> The patch for instruction selectors was proposed by me here: >>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080303/059215.html >>> It is related to the Select() and SelectRoot implementations inside >>> the target-specific code selectors generated by tablegen. >>> >>> Regarding my questions about std::set vs std;;multiset in the >>> mentioned patch: >>> Having looked into it again, I have the impression that std::set >>> could >>> be used and there is no need for std::multiset. Basically, the this >>> code: >>> void AddToISelQueue(SDOperand N) DISABLE_INLINE { >>> int Id = N.Val->getNodeId(); >>> if (Id != -1 && !isQueued(Id)) { >>> ... >>> } >>> ensures that only one node with a given NodeId can be inserted into >>> the ISelQueue. >>> >>> One possible further improvement, I'm thinking about is the >>> following: >>> Why do we use a sorted data structure (e.g. sorted vector, set) for >>> the ISelQueue at all? >>> >>> 1) If we look into the SelectRoot logic, it basically takes the node >>> with the SMALLEST NodeId from the pending selection queue. >>> 2) More over, it seems to me (please, confirm if it is true!) that >>> the >>> next node taken for selection in the loop inside the SelectRoot, at >>> any point in time, has a NodeId that is GREATER than the NodeId of >>> the >>> last selected node. >>> 3) Even if the selection of the node puts new nodes into the >>> selection >>> queue, they ALWAYS have NodeIds GREATER than that of this node. >>> Therefore the property (2) is preserved. >>> >>> I checked (2) and (3) by adding some debug output to the SelectRoot. >>> Only one test of all llvm/test test-cases does not fulfill this >>> assumptions and even there it is not quite obvious if it is a >>> contradiction to (2) and (3) or a bug. >>> >>> So, assuming that properties (2) and (3) do hold, the following >>> can be >>> probably done: >>> - We iterate over the NodeId numbers from 0 till the DAGSize. >>> - We check if a Node with a given NodeId (by looking into the >>> TopOrder???), if isQueued(NodeId) is true, i.e. this is in the queue >>> - We then check if isSelected(NodeId) is true or false and call >>> Select() for this node, if it is not selected yet. >>> - If a new node needs to be inserted into the queue, only >>> setQueued(NodeId) is called >>> >>> With these changes, no online sorting would be required at all, >>> which >>> is a great improvement over the current approach. >>> >>> What do you think about it? Is it a correct analysis? >> >> >> I created a working implementation based on these I ideas. Now all >> llvm/test test-cases pass it. Please find it in the attached patch. >> The patch is rather ugly and uses a lot of #ifdefs, but I think it is >> OK for a proof of concept. >> >> Short explanation for the macros: >> OLD - enables old-style selector queue, using heaps. Can be used to >> have a step-by-step comparison with std::set based approach. >> USE_QUEUE - enables std::set based approach >> NO_QUEUE - enables the implementation that does not use any special >> sorted queue at all, as outlined in the previous mail. >> (Note: USE_QUEUE should not be used at the same time as NO_QUEUE) >> >> Both USE_QUEUE and NO_QUEUE modes speed-up the instruction selection >> significantly (on my test compilation time goes down from 12 to 9 >> seconds). >> >> I'm very interested in your comments about this approach. This looks like a nice approach. Re-using and updating TopOrder instead of building up a std::set that ends up with the same contents is neat. I was a little concerned about the priority-queue code being removed since I don't know if there were future plans for it, however it looks like doing anything with ordering more specific than simple topological ordering would require a fair amount of work anyway, so I'm not worrying about it. Do you see any compile-time difference between using a std::set queue and the NO_QUEUE approach, out of curiosity? In addition to regular testing, since this patch doesn't modify any heuristics, it should be possible to compare assembly output between an unmodified compiler and one with this patch applied. Can you verify that this patch doesn't change any output on some interesting testcases? Thanks, Dan From sabre at nondot.org Tue Apr 22 22:03:43 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 03:03:43 -0000 Subject: [llvm-commits] [llvm] r50125 - /llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Message-ID: <200804230303.m3N33imX027313@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 22:03:42 2008 New Revision: 50125 URL: http://llvm.org/viewvc/llvm-project?rev=50125&view=rev Log: distill down the essense of this test. Modified: llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Modified: llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll?rev=50125&r1=50124&r2=50125&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Tue Apr 22 22:03:42 2008 @@ -7,14 +7,8 @@ define void @foo(i8* %context) nounwind { entry: - %context_addr = alloca i8* ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store i8* %context, i8** %context_addr - %tmp = load i8** %context_addr, align 4 ; [#uses=1] - %tmp1 = bitcast i8* %tmp to %struct.NSRect* ; <%struct.NSRect*> [#uses=1] + %tmp1 = bitcast i8* %context to %struct.NSRect* ; <%struct.NSRect*> [#uses=1] call void (i32, ...)* @bar( i32 3, %struct.NSRect* byval align 4 %tmp1 ) nounwind - br label %return -return: ; preds = %entry ret void } From clattner at apple.com Tue Apr 22 22:08:26 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Apr 2008 20:08:26 -0700 Subject: [llvm-commits] [llvm] r50121 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200804230103.m3N135Qu023931@zion.cs.uiuc.edu> References: <200804230103.m3N135Qu023931@zion.cs.uiuc.edu> Message-ID: <2B22D868-90CA-462E-B865-11C92E69F6DD@apple.com> On Apr 22, 2008, at 6:03 PM, Dale Johannesen wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=50121&view=rev > Log: > Do not change the type of a ByVal argument to a > type of a different size. Very nice Dale! > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue > Apr 22 20:03:05 2008 > @@ -8748,16 +8748,29 @@ > const PointerType *PTy = cast(Callee->getType()); > const FunctionType *FTy = cast(PTy->getElementType()); > if (FTy->isVarArg()) { > + int ix = FTy->getNumParams() + (isa(Callee) ? 3 : 1); > // See if we can optimize any arguments passed through the > varargs area of > // the call. > for (CallSite::arg_iterator I = CS.arg_begin()+FTy- > >getNumParams(), > - E = CS.arg_end(); I != E; ++I) > + E = CS.arg_end(); I != E; ++I, ++ix) > if (CastInst *CI = dyn_cast(*I)) { > - // If this cast does not effect the value passed through > the varargs > + // If this cast does not affect the value passed through > the varargs > // area, we can eliminate the use of the cast. > - Value *Op = CI->getOperand(0); > + const PointerType* SrcPTy, *DstPTy; > if (CI->isLosslessCast()) { > - *I = Op; > + // The size of ByVal arguments is derived from the type, > so we > + // can't change to a type with a different size. If the > size were > + // passed explicitly we could avoid this check. > + if (CS.paramHasAttr(ix, ParamAttr::ByVal) && > + (SrcPTy = cast(CI->getOperand(0)- > >getType())) && > + (DstPTy = cast(CI->getType()))) { > + const Type* SrcTy = SrcPTy->getElementType(); > + const Type* DstTy = DstPTy->getElementType(); > + if (!SrcTy->isSized() || !DstTy->isSized() || > + TD->getABITypeSize(SrcTy) != TD- > >getABITypeSize(DstTy)) > + continue; > + } > + *I = CI->getOperand(0); > Changed = true; > } > } This logic is pretty hairy. Please add a new static "isSafeToEliminateVarargsCast" predicate. This gives allows this to be written more naturally with early outs. Thanks for tracking this down! -Chris From tonic at nondot.org Tue Apr 22 22:30:01 2008 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 23 Apr 2008 03:30:01 -0000 Subject: [llvm-commits] [nightly-test-server] r50127 - /nightly-test-server/trunk/AcceptTestResults.php Message-ID: <200804230330.m3N3U2Mk028122@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Apr 22 22:30:01 2008 New Revision: 50127 URL: http://llvm.org/viewvc/llvm-project?rev=50127&view=rev Log: Fix build logs and record the date added to the database. Modified: nightly-test-server/trunk/AcceptTestResults.php Modified: nightly-test-server/trunk/AcceptTestResults.php URL: http://llvm.org/viewvc/llvm-project/nightly-test-server/trunk/AcceptTestResults.php?rev=50127&r1=50126&r2=50127&view=diff ============================================================================== --- nightly-test-server/trunk/AcceptTestResults.php (original) +++ nightly-test-server/trunk/AcceptTestResults.php Tue Apr 22 22:30:01 2008 @@ -83,7 +83,7 @@ $warningsRemoved, $cvsUsersAdd, $cvsUsersCO, $cvsFilesAdded, $cvsFilesRemoved, $cvsFilesModified, $buildStatus, $dejagnuPASS, $dejagnuXPASS, - $dejagnuFAIL, $dejagnuXFAIL) { + $dejagnuFAIL, $dejagnuXFAIL, $db_date) { $sqlQuery = "INSERT into testRunInfo (runDateTime, machineId, machineUname," . " gccVersion, cvsCpuTime, cvsWallTime, configureCpuTime," . @@ -91,7 +91,7 @@ " dejagnuCpuTime, dejagnuWallTime, warnings, warningsAdded," . " warningsRemoved, cvsUsersAdd, cvsUsersCO, cvsFilesAdded," . " cvsFilesRemoved, cvsFilesModified, buildStatus, dejagnuPass," . - " dejagnuFail, dejagnuXFail, dejagnuXPass) VALUES (". + " dejagnuFail, dejagnuXFail, dejagnuXPass, dateAdded) VALUES (". " \"$runDateTime\", \"$machineId\", \"$machineUname\"," . " \"$gccVersion\", \"$cvsCpuTime\", \"$cvsWallTime\"," . " \"$configureCpuTime\", \"$configureWallTime\", \"$buildCpuTime\"," . @@ -100,7 +100,7 @@ " \"$cvsUsersAdd\", \"$cvsUsersCO\", \"$cvsFilesAdded\"," . " \"$cvsFilesRemoved\", \"$cvsFilesModified\", \"$buildStatus\"," . " \"$dejagnuPASS\", \"$dejagnuFAIL\", \"$dejagnuXFAIL\"," . - " \"$dejagnuXPASS\")"; + " \"$dejagnuXPASS\", \"$db_date\")"; mysql_query($sqlQuery) or die(mysql_error()); $id = mysql_insert_id() or die(mysql_error()); return $id; @@ -449,6 +449,7 @@ $warningsAdded = $_POST['warnings_removed']; $warningsRemoved = $_POST['warnings_added']; $buildstatus = $_POST['buildstatus']; +$build_log = $_POST['build_data']; if($buildstatus == "OK") { $buildstatus = 1; @@ -475,7 +476,7 @@ $warningsRemoved, $cvsUsersAdd, $cvsUsersCO, $cvsFilesAdded, $cvsFilesRemoved, $cvsFilesModified, $buildstatus, $dejagnuPASS, $dejagnuXPASS, - $dejagnuFAIL, $dejagnuXFAIL); + $dejagnuFAIL, $dejagnuXFAIL, $db_date); //Print data obtained so far From sabre at nondot.org Tue Apr 22 22:49:32 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 03:49:32 -0000 Subject: [llvm-commits] [llvm] r50128 - /llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll Message-ID: <200804230349.m3N3nWkq028607@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 22:49:32 2008 New Revision: 50128 URL: http://llvm.org/viewvc/llvm-project?rev=50128&view=rev Log: make this test more interesting. Modified: llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll Modified: llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll?rev=50128&r1=50127&r2=50128&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll (original) +++ llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll Tue Apr 22 22:49:32 2008 @@ -1,12 +1,14 @@ -; RUN: llvm-as < %s | opt -ipsccp -disable-output +; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep {ret i32 36} +; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep {ret i32 18, i32 17} define internal {i32, i32} @bar(i32 %A) { - %X = add i32 1, 2 - ret i32 %A, i32 %A + %X = add i32 1, %A + ret i32 %X, i32 %A } define i32 @foo() { %X = call {i32, i32} @bar(i32 17) %Y = getresult {i32, i32} %X, 0 - ret i32 %Y + %Z = add i32 %Y, %Y + ret i32 %Z } From sabre at nondot.org Tue Apr 22 23:06:15 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 04:06:15 -0000 Subject: [llvm-commits] [llvm] r50129 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200804230406.m3N46GkY029046@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 23:06:15 2008 New Revision: 50129 URL: http://llvm.org/viewvc/llvm-project?rev=50129&view=rev Log: Verify that the operand of a getresult instruction is a call/invoke or undef. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=50129&r1=50128&r2=50129&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Apr 22 23:06:15 2008 @@ -1081,8 +1081,14 @@ } void Verifier::visitGetResultInst(GetResultInst &GRI) { - Assert1(GRI.isValidOperands(GRI.getAggregateValue(), GRI.getIndex()), + Assert1(GetResultInst::isValidOperands(GRI.getAggregateValue(), + GRI.getIndex()), "Invalid GetResultInst operands!", &GRI); + Assert1(isa(GRI.getAggregateValue()) || + isa(GRI.getAggregateValue()) || + isa(GRI.getAggregateValue()), + "GetResultInst operand must be a call/invoke/undef!", &GRI); + visitInstruction(GRI); } From sabre at nondot.org Tue Apr 22 23:06:52 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 04:06:52 -0000 Subject: [llvm-commits] [llvm] r50130 - /llvm/trunk/docs/LangRef.html Message-ID: <200804230406.m3N46qxw029081@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 23:06:52 2008 New Revision: 50130 URL: http://llvm.org/viewvc/llvm-project?rev=50130&view=rev Log: Allow undef as an operand to getresult. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=50130&r1=50129&r2=50130&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Tue Apr 22 23:06:52 2008 @@ -3925,9 +3925,10 @@
    Arguments:

    The 'getresult' instruction takes a call or invoke value as its -first argument. The value must have structure type. -The second argument is a constant unsigned index value which must be in range for -the number of values returned by the call.

    +first argument, or an undef value. The value must have structure type. The second argument is a constant +unsigned index value which must be in range for the number of values returned +by the call.

    Semantics:
    From sabre at nondot.org Tue Apr 22 23:59:35 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 04:59:35 -0000 Subject: [llvm-commits] [llvm] r50131 - /llvm/trunk/docs/LangRef.html Message-ID: <200804230459.m3N4xZUW030530@zion.cs.uiuc.edu> Author: lattner Date: Tue Apr 22 23:59:35 2008 New Revision: 50131 URL: http://llvm.org/viewvc/llvm-project?rev=50131&view=rev Log: fix description of 'ret' to be more correct with multiple return values. Clarify that it is impossible to 'multiply return' a struct with zero elements. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=50131&r1=50130&r2=50131&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Tue Apr 22 23:59:35 2008 @@ -1223,17 +1223,21 @@
    +
    Overview:
    +

    The function type can be thought of as a function signature. It consists of a return type and a list of formal parameter types. The -return type of a function type is a scalar type or a void type or a struct type. +return type of a function type is a scalar type, a void type, or a struct type. If the return type is a struct type then all struct elements must be of first -class types. Function types are usually used to build virtual function tables -(which are structures of pointers to functions), for indirect function -calls, and when defining a function.

    +class types, and the struct must have at least one element.

    Syntax:
    -
      <returntype list> (<parameter list>)
    + +
    +  <returntype list> (<parameter list>)
    +
    +

    ...where '<parameter list>' is a comma-separated list of type specifiers. Optionally, the parameter list may include a type ..., which indicates that the function takes a variable number of arguments. @@ -1241,6 +1245,7 @@ href="#int_varargs">variable argument handling intrinsic functions. '<returntype list>' is a comma-separated list of first class type specifiers.

    +
    Examples:
    @@ -1802,19 +1807,26 @@ ret void ; Return from void function ret <type> <value>, <type> <value> ; Return two values from a non-void function +
    Overview:
    +

    The 'ret' instruction is used to return control flow (and a value) from a function back to the caller.

    There are two forms of the 'ret' instruction: one that -returns a value and then causes control flow, and one that just causes +returns value(s) and then causes control flow, and one that just causes control flow to occur.

    +
    Arguments:
    -

    The 'ret' instruction may return one or multiple values. The -type of each return value must be a 'first class' - type. Note that a function is not well formed -if there exists a 'ret' instruction inside of the function that -returns values that do not match the return type of the function.

    + +

    The 'ret' instruction may return zero, one or multiple values. +The type of each return value must be a 'first +class' type. Note that a function is not well +formed if there exists a 'ret' instruction inside of the +function that returns values that do not match the return type of the +function.

    +
    Semantics:
    +

    When the 'ret' instruction is executed, control flow returns back to the calling function's context. If the caller is a "call" instruction, execution continues at @@ -1825,8 +1837,11 @@ return value. If the instruction returns multiple values then these values can only be accessed through a 'getresult ' instruction.

    +
    Example:
    -
      ret i32 5                       ; Return an integer value of 5
    +
    +
    +  ret i32 5                       ; Return an integer value of 5
       ret void                        ; Return from a void function
       ret i32 4, i8 2                 ; Return two values 4 and 2  
     
    From kremenek at apple.com Wed Apr 23 00:04:30 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 23 Apr 2008 05:04:30 -0000 Subject: [llvm-commits] [llvm] r50133 - /llvm/tags/checker/checker-0010/ Message-ID: <200804230504.m3N54UxE030686@zion.cs.uiuc.edu> Author: kremenek Date: Wed Apr 23 00:04:30 2008 New Revision: 50133 URL: http://llvm.org/viewvc/llvm-project?rev=50133&view=rev Log: Tagging checker-0010. Added: llvm/tags/checker/checker-0010/ - copied from r50132, llvm/trunk/ From sabre at nondot.org Wed Apr 23 00:29:14 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:29:14 -0000 Subject: [llvm-commits] [llvm] r50135 - /llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll Message-ID: <200804230529.m3N5TEQP031326@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:29:14 2008 New Revision: 50135 URL: http://llvm.org/viewvc/llvm-project?rev=50135&view=rev Log: returning an empty multiple return list is not valid. Modified: llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll Modified: llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll?rev=50135&r1=50134&r2=50135&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll (original) +++ llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll Wed Apr 23 00:29:14 2008 @@ -1,8 +1,8 @@ ; RUN: llvm-as < %s -o /dev/null -f define void @test() { - call {} @foo() + call {i32} @foo() ret void } -declare {} @foo() +declare {i32 } @foo() From sabre at nondot.org Wed Apr 23 00:36:05 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:36:05 -0000 Subject: [llvm-commits] [llvm] r50136 - /llvm/trunk/test/Transforms/LoopRotate/pr1154.ll Message-ID: <200804230536.m3N5a5dh031527@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:36:04 2008 New Revision: 50136 URL: http://llvm.org/viewvc/llvm-project?rev=50136&view=rev Log: remove this testcase. It isn't testing loop rotate, it is testing all of -std-compile-opts and is now failing because other passes are generating IR that looks different to input of loop rotate. Devang, please introduce a testcase that only runs loop rotate. Removed: llvm/trunk/test/Transforms/LoopRotate/pr1154.ll Removed: llvm/trunk/test/Transforms/LoopRotate/pr1154.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/pr1154.ll?rev=50135&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopRotate/pr1154.ll (original) +++ llvm/trunk/test/Transforms/LoopRotate/pr1154.ll (removed) @@ -1,127 +0,0 @@ -; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | \ -; RUN: %prcontext strstr 2 | grep -v declare | grep bb36.outer: - - at str = internal constant [68 x i8] c"Dot. date. datum. 123. Some more doubtful demonstration dummy data.\00" ; <[68 x i8]*> [#uses=1] - at str1 = internal constant [5 x i8] c"ummy\00" ; <[5 x i8]*> [#uses=1] - at str2 = internal constant [6 x i8] c" data\00" ; <[6 x i8]*> [#uses=1] - at str3 = internal constant [3 x i8] c"by\00" ; <[3 x i8]*> [#uses=1] - -define i32 @stringSearch_Clib(i32 %count) { -entry: - %count_addr = alloca i32 ; [#uses=2] - %retval = alloca i32, align 4 ; [#uses=2] - %tmp = alloca i32, align 4 ; [#uses=2] - %i = alloca i32, align 4 ; [#uses=5] - %c = alloca i32, align 4 ; [#uses=9] - %j = alloca i32, align 4 ; [#uses=4] - %p = alloca i8*, align 4 ; [#uses=6] - %b = alloca [68 x i8], align 16 ; <[68 x i8]*> [#uses=6] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store i32 %count, i32* %count_addr - store i32 0, i32* %c - %b1 = bitcast [68 x i8]* %b to i8* ; [#uses=1] - %tmp2 = getelementptr [68 x i8]* @str, i64 0, i64 0 ; [#uses=1] - call void @llvm.memcpy.i32( i8* %b1, i8* %tmp2, i32 68, i32 1 ) - store i32 0, i32* %j - br label %bb41 - -bb: ; preds = %bb41 - store i32 0, i32* %i - %tmp3 = load i32* %i ; [#uses=1] - store i32 %tmp3, i32* %c - br label %bb36 - -bb4: ; preds = %bb36 - %b5 = bitcast [68 x i8]* %b to i8* ; [#uses=1] - %tmp6 = getelementptr [5 x i8]* @str1, i64 0, i64 0 ; [#uses=1] - %tmp7 = call i8* @strstr( i8* %b5, i8* %tmp6 ) readonly ; [#uses=1] - store i8* %tmp7, i8** %p - %tmp8 = load i8** %p ; [#uses=1] - %ttmp8 = icmp ne i8* %tmp8, null ; [#uses=1] - %ttmp10 = zext i1 %ttmp8 to i8 ; [#uses=1] - %ttmp7 = icmp ne i8 %ttmp10, 0 ; [#uses=1] - br i1 %ttmp7, label %cond_true, label %cond_next - -cond_true: ; preds = %bb4 - %tmp9 = load i8** %p ; [#uses=1] - %tmp910 = ptrtoint i8* %tmp9 to i32 ; [#uses=1] - %b11 = bitcast [68 x i8]* %b to i8* ; [#uses=1] - %b1112 = ptrtoint i8* %b11 to i32 ; [#uses=1] - %tmp13 = sub i32 %tmp910, %b1112 ; [#uses=1] - %tmp14 = load i32* %c ; [#uses=1] - %tmp15 = add i32 %tmp13, %tmp14 ; [#uses=1] - store i32 %tmp15, i32* %c - br label %cond_next - -cond_next: ; preds = %cond_true, %bb4 - %b16 = bitcast [68 x i8]* %b to i8* ; [#uses=1] - %tmp17 = getelementptr [6 x i8]* @str2, i64 0, i64 0 ; [#uses=1] - %tmp18 = call i8* @strstr( i8* %b16, i8* %tmp17 ) readonly ; [#uses=1] - store i8* %tmp18, i8** %p - %tmp19 = load i8** %p ; [#uses=1] - %ttmp6 = icmp ne i8* %tmp19, null ; [#uses=1] - %ttmp9 = zext i1 %ttmp6 to i8 ; [#uses=1] - %ttmp4 = icmp ne i8 %ttmp9, 0 ; [#uses=1] - br i1 %ttmp4, label %cond_true20, label %cond_next28 - -cond_true20: ; preds = %cond_next - %tmp21 = load i8** %p ; [#uses=1] - %tmp2122 = ptrtoint i8* %tmp21 to i32 ; [#uses=1] - %b23 = bitcast [68 x i8]* %b to i8* ; [#uses=1] - %b2324 = ptrtoint i8* %b23 to i32 ; [#uses=1] - %tmp25 = sub i32 %tmp2122, %b2324 ; [#uses=1] - %tmp26 = load i32* %c ; [#uses=1] - %tmp27 = add i32 %tmp25, %tmp26 ; [#uses=1] - store i32 %tmp27, i32* %c - br label %cond_next28 - -cond_next28: ; preds = %cond_true20, %cond_next - %b29 = bitcast [68 x i8]* %b to i8* ; [#uses=1] - %tmp30 = getelementptr [3 x i8]* @str3, i64 0, i64 0 ; [#uses=1] - %tmp31 = call i32 @strcspn( i8* %b29, i8* %tmp30 ) readonly ; [#uses=1] - %tmp32 = load i32* %c ; [#uses=1] - %tmp33 = add i32 %tmp31, %tmp32 ; [#uses=1] - store i32 %tmp33, i32* %c - %tmp34 = load i32* %i ; [#uses=1] - %tmp35 = add i32 %tmp34, 1 ; [#uses=1] - store i32 %tmp35, i32* %i - br label %bb36 - -bb36: ; preds = %cond_next28, %bb - %tmp37 = load i32* %i ; [#uses=1] - %ttmp3 = icmp sle i32 %tmp37, 249 ; [#uses=1] - %ttmp12 = zext i1 %ttmp3 to i8 ; [#uses=1] - %ttmp1 = icmp ne i8 %ttmp12, 0 ; [#uses=1] - br i1 %ttmp1, label %bb4, label %bb38 - -bb38: ; preds = %bb36 - %tmp39 = load i32* %j ; [#uses=1] - %tmp40 = add i32 %tmp39, 1 ; [#uses=1] - store i32 %tmp40, i32* %j - br label %bb41 - -bb41: ; preds = %bb38, %entry - %tmp42 = load i32* %j ; [#uses=1] - %tmp43 = load i32* %count_addr ; [#uses=1] - %ttmp2 = icmp slt i32 %tmp42, %tmp43 ; [#uses=1] - %ttmp11 = zext i1 %ttmp2 to i8 ; [#uses=1] - %ttmp5 = icmp ne i8 %ttmp11, 0 ; [#uses=1] - br i1 %ttmp5, label %bb, label %bb44 - -bb44: ; preds = %bb41 - %tmp45 = load i32* %c ; [#uses=1] - store i32 %tmp45, i32* %tmp - %tmp46 = load i32* %tmp ; [#uses=1] - store i32 %tmp46, i32* %retval - br label %return - -return: ; preds = %bb44 - %retval47 = load i32* %retval ; [#uses=1] - ret i32 %retval47 -} - -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - -declare i8* @strstr(i8*, i8*) readonly - -declare i32 @strcspn(i8*, i8*) readonly From sabre at nondot.org Wed Apr 23 00:36:34 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:36:34 -0000 Subject: [llvm-commits] [llvm] r50137 - in /llvm/trunk: include/llvm/DerivedTypes.h lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp Message-ID: <200804230536.m3N5aY5R031550@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:36:34 2008 New Revision: 50137 URL: http://llvm.org/viewvc/llvm-project?rev=50137&view=rev Log: Enforce that multiple return values have to have at least one result. Modified: llvm/trunk/include/llvm/DerivedTypes.h llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/include/llvm/DerivedTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=50137&r1=50136&r2=50137&view=diff ============================================================================== --- llvm/trunk/include/llvm/DerivedTypes.h (original) +++ llvm/trunk/include/llvm/DerivedTypes.h Wed Apr 23 00:36:34 2008 @@ -154,6 +154,10 @@ const std::vector &Params, ///< The types of the parameters bool isVarArg ///< Whether this is a variable argument length function ); + + /// isValidReturnType - Return true if the specified type is valid as a return + /// type. + static bool isValidReturnType(const Type *RetTy); inline bool isVarArg() const { return isVarArgs; } inline const Type *getReturnType() const { return ContainedTys[0]; } Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=50137&r1=50136&r2=50137&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Wed Apr 23 00:36:34 2008 @@ -2691,7 +2691,7 @@ if (const StructType *STy = dyn_cast(Aggregate->getType())) { unsigned NumElements = STy->getNumElements(); - if (Index >= NumElements) + if (Index >= NumElements || NumElements == 0) return false; // getresult aggregate value's element types are restricted to Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=50137&r1=50136&r2=50137&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Wed Apr 23 00:36:34 2008 @@ -437,16 +437,35 @@ // Derived Type Constructors //===----------------------------------------------------------------------===// +/// isValidReturnType - Return true if the specified type is valid as a return +/// type. +bool FunctionType::isValidReturnType(const Type *RetTy) { + if (RetTy->isFirstClassType()) + return true; + if (RetTy == Type::VoidTy || isa(RetTy)) + return true; + + // If this is a multiple return case, verify that each return is a first class + // value and that there is at least one value. + const StructType *SRetTy = dyn_cast(RetTy); + if (SRetTy == 0 || SRetTy->getNumElements() == 0) + return false; + + for (unsigned i = 0, e = SRetTy->getNumElements(); i != e; ++i) + if (!SRetTy->getElementType(i)->isFirstClassType()) + return false; + return true; +} + FunctionType::FunctionType(const Type *Result, const std::vector &Params, bool IsVarArgs) : DerivedType(FunctionTyID), isVarArgs(IsVarArgs) { ContainedTys = reinterpret_cast(this+1); NumContainedTys = Params.size() + 1; // + 1 for result type - assert((Result->isFirstClassType() || Result == Type::VoidTy || - Result->getTypeID() == Type::StructTyID || - isa(Result)) && - "LLVM functions cannot return aggregates"); + assert(isValidReturnType(Result) && "invalid return type for function"); + + bool isAbstract = Result->isAbstract(); new (&ContainedTys[0]) PATypeHandle(Result, this); @@ -1091,9 +1110,8 @@ bool isVarArg) { FunctionValType VT(ReturnType, Params, isVarArg); FunctionType *FT = FunctionTypes->get(VT); - if (FT) { + if (FT) return FT; - } FT = (FunctionType*) new char[sizeof(FunctionType) + sizeof(PATypeHandle)*(Params.size()+1)]; From sabre at nondot.org Wed Apr 23 00:36:59 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:36:59 -0000 Subject: [llvm-commits] [llvm] r50138 - /llvm/trunk/lib/AsmParser/llvmAsmParser.y Message-ID: <200804230536.m3N5axQO031570@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:36:58 2008 New Revision: 50138 URL: http://llvm.org/viewvc/llvm-project?rev=50138&view=rev Log: Validate that the result of a function type is valid using shared logic with vmcore. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=50138&r1=50137&r2=50138&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Wed Apr 23 00:36:58 2008 @@ -1349,12 +1349,10 @@ | Types '(' ArgTypeListI ')' OptFuncAttrs { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. - const Type* RetTy = *$1; - if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy || - isa(RetTy) || - isa(RetTy))) - GEN_ERROR("LLVM Functions cannot return aggregates"); - + const Type *RetTy = *$1; + if (!FunctionType::isValidReturnType(RetTy)) + GEN_ERROR("Invalid result type for LLVM function"); + std::vector Params; TypeWithAttrsList::iterator I = $3->begin(), E = $3->end(); for (; I != E; ++I ) { @@ -2255,6 +2253,9 @@ if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($2)) GEN_ERROR("Reference to abstract result: "+ $2->get()->getDescription()); + if (!FunctionType::isValidReturnType(*$2)) + GEN_ERROR("Invalid result type for LLVM function"); + std::vector ParamTypeList; SmallVector Attrs; if ($7 != ParamAttr::None) @@ -2648,6 +2649,10 @@ GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } + + if (!FunctionType::isValidReturnType(*$3)) + GEN_ERROR("Invalid result type for LLVM function"); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } @@ -2972,6 +2977,10 @@ GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } + + if (!FunctionType::isValidReturnType(*$3)) + GEN_ERROR("Invalid result type for LLVM function"); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } From sabre at nondot.org Wed Apr 23 00:37:08 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:37:08 -0000 Subject: [llvm-commits] [llvm] r50139 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs Message-ID: <200804230537.m3N5b8te031587@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:37:08 2008 New Revision: 50139 URL: http://llvm.org/viewvc/llvm-project?rev=50139&view=rev Log: regenerate Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=50139&r1=50138&r2=50139&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Apr 23 00:37:08 2008 @@ -1843,24 +1843,24 @@ 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268, 1274, 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336, 1341, - 1349, 1380, 1405, 1410, 1420, 1430, 1434, 1444, 1451, 1460, - 1467, 1472, 1477, 1484, 1485, 1492, 1499, 1507, 1513, 1525, - 1553, 1569, 1596, 1624, 1650, 1670, 1696, 1716, 1728, 1735, - 1801, 1811, 1821, 1827, 1837, 1843, 1853, 1858, 1863, 1876, - 1888, 1910, 1918, 1924, 1935, 1940, 1945, 1951, 1957, 1966, - 1970, 1978, 1978, 1981, 1981, 1984, 1996, 2017, 2022, 2030, - 2031, 2035, 2035, 2039, 2039, 2042, 2045, 2069, 2081, 2080, - 2092, 2091, 2101, 2100, 2111, 2151, 2154, 2160, 2170, 2174, - 2179, 2181, 2186, 2191, 2200, 2210, 2221, 2225, 2234, 2243, - 2248, 2374, 2374, 2376, 2385, 2385, 2387, 2392, 2404, 2408, - 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445, 2470, - 2474, 2484, 2488, 2492, 2497, 2504, 2504, 2510, 2519, 2524, - 2529, 2533, 2542, 2551, 2560, 2564, 2568, 2573, 2580, 2587, - 2591, 2596, 2606, 2625, 2634, 2715, 2719, 2726, 2737, 2750, - 2760, 2771, 2781, 2792, 2800, 2810, 2817, 2820, 2821, 2828, - 2832, 2837, 2853, 2870, 2884, 2898, 2910, 2918, 2925, 2931, - 2937, 2943, 2958, 3044, 3049, 3053, 3060, 3067, 3075, 3082, - 3090, 3098, 3112, 3129, 3137 + 1349, 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449, 1458, + 1465, 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511, 1523, + 1551, 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726, 1733, + 1799, 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861, 1874, + 1886, 1908, 1916, 1922, 1933, 1938, 1943, 1949, 1955, 1964, + 1968, 1976, 1976, 1979, 1979, 1982, 1994, 2015, 2020, 2028, + 2029, 2033, 2033, 2037, 2037, 2040, 2043, 2067, 2079, 2078, + 2090, 2089, 2099, 2098, 2109, 2149, 2152, 2158, 2168, 2172, + 2177, 2179, 2184, 2189, 2198, 2208, 2219, 2223, 2232, 2241, + 2246, 2375, 2375, 2377, 2386, 2386, 2388, 2393, 2405, 2409, + 2414, 2418, 2422, 2426, 2430, 2434, 2438, 2442, 2446, 2471, + 2475, 2485, 2489, 2493, 2498, 2505, 2505, 2511, 2520, 2525, + 2530, 2534, 2543, 2552, 2561, 2565, 2569, 2574, 2581, 2588, + 2592, 2597, 2607, 2626, 2635, 2720, 2724, 2731, 2742, 2755, + 2765, 2776, 2786, 2797, 2805, 2815, 2822, 2825, 2826, 2833, + 2837, 2842, 2858, 2875, 2889, 2903, 2915, 2923, 2930, 2936, + 2942, 2948, 2963, 3053, 3058, 3062, 3069, 3076, 3084, 3091, + 3099, 3107, 3121, 3138, 3146 }; #endif @@ -4067,12 +4067,10 @@ { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. - const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal); - if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy || - isa(RetTy) || - isa(RetTy))) - GEN_ERROR("LLVM Functions cannot return aggregates"); - + const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal); + if (!FunctionType::isValidReturnType(RetTy)) + GEN_ERROR("Invalid result type for LLVM function"); + std::vector Params; TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); for (; I != E; ++I ) { @@ -4098,7 +4096,7 @@ break; case 151: -#line 1380 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1378 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4126,7 +4124,7 @@ break; case 152: -#line 1405 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1403 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); delete (yyvsp[(4) - (5)].TypeVal); @@ -4135,7 +4133,7 @@ break; case 153: -#line 1410 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1408 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) @@ -4149,7 +4147,7 @@ break; case 154: -#line 1420 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1418 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4163,7 +4161,7 @@ break; case 155: -#line 1430 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1428 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -4171,7 +4169,7 @@ break; case 156: -#line 1434 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1432 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4185,7 +4183,7 @@ break; case 157: -#line 1444 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1442 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR @@ -4193,7 +4191,7 @@ break; case 158: -#line 1451 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1449 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4203,7 +4201,7 @@ break; case 159: -#line 1460 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1458 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4214,14 +4212,14 @@ break; case 160: -#line 1467 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1465 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 161: -#line 1472 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1470 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4230,7 +4228,7 @@ break; case 162: -#line 1477 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1475 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR @@ -4238,7 +4236,7 @@ break; case 164: -#line 1485 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1483 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4249,7 +4247,7 @@ break; case 165: -#line 1492 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1490 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4260,7 +4258,7 @@ break; case 166: -#line 1499 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1497 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -4268,7 +4266,7 @@ break; case 167: -#line 1507 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1505 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4278,7 +4276,7 @@ break; case 168: -#line 1513 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1511 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4287,7 +4285,7 @@ break; case 169: -#line 1525 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1523 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4319,7 +4317,7 @@ break; case 170: -#line 1553 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1551 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4339,7 +4337,7 @@ break; case 171: -#line 1569 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1567 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4370,7 +4368,7 @@ break; case 172: -#line 1596 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1594 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4402,7 +4400,7 @@ break; case 173: -#line 1624 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1622 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4432,7 +4430,7 @@ break; case 174: -#line 1650 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1648 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4456,7 +4454,7 @@ break; case 175: -#line 1670 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1668 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4486,7 +4484,7 @@ break; case 176: -#line 1696 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1694 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4510,7 +4508,7 @@ break; case 177: -#line 1716 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1714 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4526,7 +4524,7 @@ break; case 178: -#line 1728 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1726 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4537,7 +4535,7 @@ break; case 179: -#line 1735 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1733 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4607,7 +4605,7 @@ break; case 180: -#line 1801 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1799 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4621,7 +4619,7 @@ break; case 181: -#line 1811 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1809 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4635,7 +4633,7 @@ break; case 182: -#line 1821 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1819 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4645,7 +4643,7 @@ break; case 183: -#line 1827 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1825 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4659,7 +4657,7 @@ break; case 184: -#line 1837 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1835 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4669,7 +4667,7 @@ break; case 185: -#line 1843 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1841 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4683,7 +4681,7 @@ break; case 186: -#line 1853 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1851 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getTrue(); @@ -4692,7 +4690,7 @@ break; case 187: -#line 1858 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1856 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getFalse(); @@ -4701,7 +4699,7 @@ break; case 188: -#line 1863 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1861 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4716,7 +4714,7 @@ break; case 189: -#line 1876 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1874 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4732,7 +4730,7 @@ break; case 190: -#line 1888 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1886 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4758,7 +4756,7 @@ break; case 191: -#line 1910 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1908 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4770,7 +4768,7 @@ break; case 192: -#line 1918 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1916 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -4780,7 +4778,7 @@ break; case 193: -#line 1924 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1922 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -4795,7 +4793,7 @@ break; case 194: -#line 1935 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1933 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -4804,7 +4802,7 @@ break; case 195: -#line 1940 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1938 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -4813,7 +4811,7 @@ break; case 196: -#line 1945 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1943 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -4823,7 +4821,7 @@ break; case 197: -#line 1951 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1949 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -4833,7 +4831,7 @@ break; case 198: -#line 1957 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1955 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -4843,7 +4841,7 @@ break; case 199: -#line 1966 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1964 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR @@ -4851,7 +4849,7 @@ break; case 200: -#line 1970 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1968 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -4860,27 +4858,27 @@ break; case 201: -#line 1978 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1976 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 202: -#line 1978 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1976 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 203: -#line 1981 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1979 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 204: -#line 1981 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1979 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 205: -#line 1984 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1982 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -4896,7 +4894,7 @@ break; case 206: -#line 1996 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1994 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -4912,7 +4910,7 @@ break; case 207: -#line 2017 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2015 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4921,7 +4919,7 @@ break; case 208: -#line 2022 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2020 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4930,12 +4928,12 @@ break; case 211: -#line 2035 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2033 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 212: -#line 2035 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2033 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -4943,26 +4941,26 @@ break; case 213: -#line 2039 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2037 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 214: -#line 2039 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2037 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 215: -#line 2042 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2040 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 216: -#line 2045 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2043 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -4990,7 +4988,7 @@ break; case 217: -#line 2069 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2067 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5005,7 +5003,7 @@ break; case 218: -#line 2081 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2079 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5017,14 +5015,14 @@ break; case 219: -#line 2088 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2086 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 220: -#line 2092 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2090 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5034,14 +5032,14 @@ break; case 221: -#line 2097 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2095 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 222: -#line 2101 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2099 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5052,7 +5050,7 @@ break; case 223: -#line 2107 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2105 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -5060,7 +5058,7 @@ break; case 224: -#line 2111 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2109 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5104,21 +5102,21 @@ break; case 225: -#line 2151 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 226: -#line 2154 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 227: -#line 2160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5131,7 +5129,7 @@ break; case 228: -#line 2170 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2168 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5139,7 +5137,7 @@ break; case 229: -#line 2174 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2172 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5147,7 +5145,7 @@ break; case 231: -#line 2181 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2179 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5156,7 +5154,7 @@ break; case 232: -#line 2186 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2184 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5165,14 +5163,14 @@ break; case 233: -#line 2191 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2189 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 234: -#line 2200 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2198 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5186,7 +5184,7 @@ break; case 235: -#line 2210 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2208 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5200,7 +5198,7 @@ break; case 236: -#line 2221 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2219 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR @@ -5208,7 +5206,7 @@ break; case 237: -#line 2225 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2223 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5221,7 +5219,7 @@ break; case 238: -#line 2234 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5234,7 +5232,7 @@ break; case 239: -#line 2243 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2241 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -5242,7 +5240,7 @@ break; case 240: -#line 2249 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! @@ -5252,6 +5250,9 @@ if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal))) GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription()); + if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal))) + GEN_ERROR("Invalid result type for LLVM function"); + std::vector ParamTypeList; SmallVector Attrs; if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) @@ -5370,7 +5371,7 @@ break; case 243: -#line 2376 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2377 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5382,7 +5383,7 @@ break; case 246: -#line 2387 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2388 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5390,7 +5391,7 @@ break; case 247: -#line 2392 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2393 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5401,7 +5402,7 @@ break; case 248: -#line 2404 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2405 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5409,7 +5410,7 @@ break; case 249: -#line 2408 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2409 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5417,7 +5418,7 @@ break; case 250: -#line 2413 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2414 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR @@ -5425,7 +5426,7 @@ break; case 251: -#line 2417 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2418 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR @@ -5433,7 +5434,7 @@ break; case 252: -#line 2421 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2422 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR @@ -5441,7 +5442,7 @@ break; case 253: -#line 2425 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2426 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -5449,7 +5450,7 @@ break; case 254: -#line 2429 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2430 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -5457,7 +5458,7 @@ break; case 255: -#line 2433 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2434 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -5465,7 +5466,7 @@ break; case 256: -#line 2437 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2438 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -5473,7 +5474,7 @@ break; case 257: -#line 2441 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2442 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -5481,7 +5482,7 @@ break; case 258: -#line 2445 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2446 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5510,7 +5511,7 @@ break; case 259: -#line 2470 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2471 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5518,7 +5519,7 @@ break; case 260: -#line 2474 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2475 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5528,7 +5529,7 @@ break; case 261: -#line 2484 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2485 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5536,7 +5537,7 @@ break; case 262: -#line 2488 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2489 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5544,7 +5545,7 @@ break; case 263: -#line 2492 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2493 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5553,7 +5554,7 @@ break; case 264: -#line 2497 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2498 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5562,7 +5563,7 @@ break; case 267: -#line 2510 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2511 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5573,7 +5574,7 @@ break; case 268: -#line 2519 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2520 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5582,7 +5583,7 @@ break; case 269: -#line 2524 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2525 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR @@ -5590,7 +5591,7 @@ break; case 270: -#line 2529 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2530 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5598,7 +5599,7 @@ break; case 271: -#line 2533 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2534 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5606,7 +5607,7 @@ break; case 272: -#line 2542 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2543 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -5618,7 +5619,7 @@ break; case 273: -#line 2551 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2552 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -5631,7 +5632,7 @@ break; case 274: -#line 2560 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2561 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0); CHECK_FOR_ERROR @@ -5639,7 +5640,7 @@ break; case 275: -#line 2564 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2565 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Only the unwind to block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal((yyvsp[(3) - (3)].ValIDVal))); CHECK_FOR_ERROR @@ -5647,7 +5648,7 @@ break; case 276: -#line 2568 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2569 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)), 0); delete (yyvsp[(1) - (1)].StrVal); @@ -5656,7 +5657,7 @@ break; case 277: -#line 2573 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2574 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (4)].StrVal)), getBBVal((yyvsp[(4) - (4)].ValIDVal))); delete (yyvsp[(1) - (4)].StrVal); @@ -5665,7 +5666,7 @@ break; case 278: -#line 2580 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2581 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -5676,7 +5677,7 @@ break; case 279: -#line 2587 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2588 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR @@ -5684,7 +5685,7 @@ break; case 280: -#line 2591 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2592 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -5693,7 +5694,7 @@ break; case 281: -#line 2596 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2597 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { assert(cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); @@ -5707,7 +5708,7 @@ break; case 282: -#line 2606 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2607 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -5730,7 +5731,7 @@ break; case 283: -#line 2625 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2626 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -5743,7 +5744,7 @@ break; case 284: -#line 2635 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2636 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -5760,6 +5761,10 @@ GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } + + if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal))) + GEN_ERROR("Invalid result type for LLVM function"); + Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } @@ -5827,7 +5832,7 @@ break; case 285: -#line 2715 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2720 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -5835,7 +5840,7 @@ break; case 286: -#line 2719 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2724 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -5843,7 +5848,7 @@ break; case 287: -#line 2726 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2731 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -5858,7 +5863,7 @@ break; case 288: -#line 2737 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2742 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -5874,7 +5879,7 @@ break; case 289: -#line 2750 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2755 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -5886,7 +5891,7 @@ break; case 290: -#line 2760 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2765 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -5901,7 +5906,7 @@ break; case 291: -#line 2771 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2776 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -5913,7 +5918,7 @@ break; case 292: -#line 2781 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2786 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -5928,7 +5933,7 @@ break; case 293: -#line 2792 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2797 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -5940,7 +5945,7 @@ break; case 294: -#line 2800 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2805 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -5954,7 +5959,7 @@ break; case 295: -#line 2810 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2815 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); @@ -5965,17 +5970,17 @@ break; case 296: -#line 2817 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2822 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 297: -#line 2820 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2825 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 298: -#line 2821 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2826 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -5984,7 +5989,7 @@ break; case 299: -#line 2828 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2833 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5992,7 +5997,7 @@ break; case 300: -#line 2832 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2837 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6000,7 +6005,7 @@ break; case 301: -#line 2837 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2842 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6020,7 +6025,7 @@ break; case 302: -#line 2853 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2858 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6041,7 +6046,7 @@ break; case 303: -#line 2870 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2875 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6059,7 +6064,7 @@ break; case 304: -#line 2884 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2889 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6077,7 +6082,7 @@ break; case 305: -#line 2898 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2903 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6093,7 +6098,7 @@ break; case 306: -#line 2910 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2915 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -6105,7 +6110,7 @@ break; case 307: -#line 2918 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2923 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6116,7 +6121,7 @@ break; case 308: -#line 2925 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2930 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6126,7 +6131,7 @@ break; case 309: -#line 2931 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2936 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6136,7 +6141,7 @@ break; case 310: -#line 2937 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2942 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6146,7 +6151,7 @@ break; case 311: -#line 2943 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2948 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6165,7 +6170,7 @@ break; case 312: -#line 2959 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2964 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6182,6 +6187,10 @@ GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } + + if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal))) + GEN_ERROR("Invalid result type for LLVM function"); + Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } @@ -6254,7 +6263,7 @@ break; case 313: -#line 3044 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3053 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6262,7 +6271,7 @@ break; case 314: -#line 3049 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3058 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6270,7 +6279,7 @@ break; case 315: -#line 3053 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3062 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6278,7 +6287,7 @@ break; case 316: -#line 3060 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3069 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6289,7 +6298,7 @@ break; case 317: -#line 3067 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3076 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6301,7 +6310,7 @@ break; case 318: -#line 3075 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3084 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6312,7 +6321,7 @@ break; case 319: -#line 3082 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3091 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6324,7 +6333,7 @@ break; case 320: -#line 3090 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3099 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6335,7 +6344,7 @@ break; case 321: -#line 3098 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3107 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6353,7 +6362,7 @@ break; case 322: -#line 3112 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3121 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6374,7 +6383,7 @@ break; case 323: -#line 3129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3138 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) @@ -6386,7 +6395,7 @@ break; case 324: -#line 3137 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3146 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6406,7 +6415,7 @@ /* Line 1267 of yacc.c. */ -#line 6410 "llvmAsmParser.tab.c" +#line 6419 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -6620,7 +6629,7 @@ } -#line 3154 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3163 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=50139&r1=50138&r2=50139&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Wed Apr 23 00:37:08 2008 @@ -1349,12 +1349,10 @@ | Types '(' ArgTypeListI ')' OptFuncAttrs { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. - const Type* RetTy = *$1; - if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy || - isa(RetTy) || - isa(RetTy))) - GEN_ERROR("LLVM Functions cannot return aggregates"); - + const Type *RetTy = *$1; + if (!FunctionType::isValidReturnType(RetTy)) + GEN_ERROR("Invalid result type for LLVM function"); + std::vector Params; TypeWithAttrsList::iterator I = $3->begin(), E = $3->end(); for (; I != E; ++I ) { @@ -2255,6 +2253,9 @@ if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($2)) GEN_ERROR("Reference to abstract result: "+ $2->get()->getDescription()); + if (!FunctionType::isValidReturnType(*$2)) + GEN_ERROR("Invalid result type for LLVM function"); + std::vector ParamTypeList; SmallVector Attrs; if ($7 != ParamAttr::None) @@ -2648,6 +2649,10 @@ GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } + + if (!FunctionType::isValidReturnType(*$3)) + GEN_ERROR("Invalid result type for LLVM function"); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } @@ -2972,6 +2977,10 @@ GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } + + if (!FunctionType::isValidReturnType(*$3)) + GEN_ERROR("Invalid result type for LLVM function"); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } From sabre at nondot.org Wed Apr 23 00:38:20 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:38:20 -0000 Subject: [llvm-commits] [llvm] r50140 - in /llvm/trunk: lib/Transforms/Scalar/SCCP.cpp test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll Message-ID: <200804230538.m3N5cK4a031637@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:38:20 2008 New Revision: 50140 URL: http://llvm.org/viewvc/llvm-project?rev=50140&view=rev Log: Rewrite multiple return value handling in SCCP. Before, the -sccp pass would turn every getresult instruction into undef. This helps with rdar://5778210 Added: llvm/trunk/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=50140&r1=50139&r2=50140&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Apr 23 00:38:20 2008 @@ -130,21 +130,6 @@ } }; -/// LatticeValIndex - LatticeVal and associated Index. This is used -/// to track individual operand Lattice values for multi value ret instructions. -class VISIBILITY_HIDDEN LatticeValIndexed { - public: - LatticeValIndexed(unsigned I = 0) { Index = I; } - LatticeVal &getLatticeVal() { return LV; } - unsigned getIndex() const { return Index; } - - void setLatticeVal(LatticeVal &L) { LV = L; } - void setIndex(unsigned I) { Index = I; } - - private: - LatticeVal LV; - unsigned Index; -}; //===----------------------------------------------------------------------===// // /// SCCPSolver - This class is a general purpose solver for Sparse Conditional @@ -167,7 +152,7 @@ /// TrackedMultipleRetVals - Same as TrackedRetVals, but used for functions /// that return multiple values. - std::multimap TrackedMultipleRetVals; + std::map, LatticeVal> TrackedMultipleRetVals; // The reason for two worklists is that overdefined is the lowest state // on the lattice, and moving things to overdefined as fast as possible @@ -220,11 +205,10 @@ // Add an entry, F -> undef. if (const StructType *STy = dyn_cast(F->getReturnType())) { for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) - TrackedMultipleRetVals.insert(std::pair - (F, LatticeValIndexed(i))); - } - else - TrackedRetVals[F]; + TrackedMultipleRetVals.insert(std::make_pair(std::make_pair(F, i), + LatticeVal())); + } else + TrackedRetVals.insert(std::make_pair(F, LatticeVal())); } /// Solve - Solve for constants and executable blocks. @@ -291,7 +275,6 @@ // markOverdefined - Make a value be marked as "overdefined". If the // value is not already overdefined, add it to the overdefined instruction // work list so that the users of the instruction are updated later. - inline void markOverdefined(LatticeVal &IV, Value *V) { if (IV.markOverdefined()) { DEBUG(DOUT << "markOverdefined: "; @@ -640,7 +623,7 @@ if (!F->hasInternalLinkage()) return; - if (!TrackedRetVals.empty()) { + if (!TrackedRetVals.empty() && I.getNumOperands() == 1) { DenseMap::iterator TFRVI = TrackedRetVals.find(F); if (TFRVI != TrackedRetVals.end() && @@ -651,15 +634,13 @@ } } - // Handle function that returns multiple values. - std::multimap::iterator It, E; - tie(It, E) = TrackedMultipleRetVals.equal_range(F); - if (It != E) { - for (; It != E; ++It) { - LatticeValIndexed &LV = It->second; - unsigned Idx = LV.getIndex(); - Value *V = I.getOperand(Idx); - mergeInValue(LV.getLatticeVal(), V, getValueState(V)); + // Handle functions that return multiple values. + if (!TrackedMultipleRetVals.empty() && I.getNumOperands() > 1) { + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { + std::map, LatticeVal>::iterator + It = TrackedMultipleRetVals.find(std::make_pair(F, i)); + if (It == TrackedMultipleRetVals.end()) break; + mergeInValue(It->second, F, getValueState(I.getOperand(i))); } } } @@ -687,28 +668,38 @@ } void SCCPSolver::visitGetResultInst(GetResultInst &GRI) { - unsigned Idx = GRI.getIndex(); Value *Aggr = GRI.getOperand(0); - Function *F = NULL; + + // If the operand to the getresult is an undef, the result is undef. + if (isa(Aggr)) + return; + + Function *F; if (CallInst *CI = dyn_cast(Aggr)) F = CI->getCalledFunction(); - else if (InvokeInst *II = dyn_cast(Aggr)) - F = II->getCalledFunction(); + else + F = cast(Aggr)->getCalledFunction(); - if (!F) + // TODO: If IPSCCP resolves the callee of this function, we could propagate a + // result back! + if (F == 0 || TrackedMultipleRetVals.empty()) { + markOverdefined(&GRI); return; - - std::multimap::iterator It, E; - tie(It, E) = TrackedMultipleRetVals.equal_range(F); - if (It == E) + } + + // See if we are tracking the result of the callee. + std::map, LatticeVal>::iterator + It = TrackedMultipleRetVals.find(std::make_pair(F, GRI.getIndex())); + + // If not tracking this function (for example, it is a declaration) just move + // to overdefined. + if (It == TrackedMultipleRetVals.end()) { + markOverdefined(&GRI); return; - - for (; It != E; ++It) { - LatticeValIndexed &LIV = It->second; - if (LIV.getIndex() == Idx) { - mergeInValue(&GRI, LIV.getLatticeVal()); - } } + + // Otherwise, the value will be merged in here as a result of CallSite + // handling. } void SCCPSolver::visitSelectInst(SelectInst &I) { @@ -1127,79 +1118,90 @@ void SCCPSolver::visitCallSite(CallSite CS) { Function *F = CS.getCalledFunction(); - - DenseMap::iterator TFRVI =TrackedRetVals.end(); - // If we are tracking this function, we must make sure to bind arguments as - // appropriate. - bool FirstCall = false; - if (F && F->hasInternalLinkage()) { - TFRVI = TrackedRetVals.find(F); - if (TFRVI != TrackedRetVals.end()) - FirstCall = true; - else { - std::multimap::iterator It, E; - tie(It, E) = TrackedMultipleRetVals.equal_range(F); - if (It != E) - FirstCall = true; - } - } - - if (FirstCall) { - // If this is the first call to the function hit, mark its entry block - // executable. - if (!BBExecutable.count(F->begin())) - MarkBlockExecutable(F->begin()); + Instruction *I = CS.getInstruction(); + + // The common case is that we aren't tracking the callee, either because we + // are not doing interprocedural analysis or the callee is indirect, or is + // external. Handle these cases first. + if (F == 0 || !F->hasInternalLinkage()) { +CallOverdefined: + // Void return and not tracking callee, just bail. + if (I->getType() == Type::VoidTy) return; - CallSite::arg_iterator CAI = CS.arg_begin(); - for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); - AI != E; ++AI, ++CAI) { - LatticeVal &IV = ValueState[AI]; - if (!IV.isOverdefined()) - mergeInValue(IV, AI, getValueState(*CAI)); + // Otherwise, if we have a single return value case, and if the function is + // a declaration, maybe we can constant fold it. + if (!isa(I->getType()) && F && F->isDeclaration() && + canConstantFoldCallTo(F)) { + + SmallVector Operands; + for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); + AI != E; ++AI) { + LatticeVal &State = getValueState(*AI); + if (State.isUndefined()) + return; // Operands are not resolved yet. + else if (State.isOverdefined()) { + markOverdefined(I); + return; + } + assert(State.isConstant() && "Unknown state!"); + Operands.push_back(State.getConstant()); + } + + // If we can constant fold this, mark the result of the call as a + // constant. + if (Constant *C = ConstantFoldCall(F, &Operands[0], Operands.size())) { + markConstant(I, C); + return; + } } - } - Instruction *I = CS.getInstruction(); - - if (!CS.doesNotThrow() && I->getParent()->getUnwindDest()) - markEdgeExecutable(I->getParent(), I->getParent()->getUnwindDest()); - - if (I->getType() == Type::VoidTy) return; - - LatticeVal &IV = ValueState[I]; - if (IV.isOverdefined()) return; - // Propagate the single return value of the function to the value of the - // instruction. - if (TFRVI != TrackedRetVals.end()) { - mergeInValue(IV, I, TFRVI->second); + // Otherwise, we don't know anything about this call, mark it overdefined. + markOverdefined(I); return; } - if (F == 0 || !F->isDeclaration() || !canConstantFoldCallTo(F)) { - markOverdefined(IV, I); - return; - } - - SmallVector Operands; - Operands.reserve(I->getNumOperands()-1); - - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) { - LatticeVal &State = getValueState(*AI); - if (State.isUndefined()) - return; // Operands are not resolved yet... - else if (State.isOverdefined()) { - markOverdefined(IV, I); - return; + // If this is a single/zero retval case, see if we're tracking the function. + const StructType *RetSTy = dyn_cast(I->getType()); + if (RetSTy == 0) { + // Check to see if we're tracking this callee, if not, handle it in the + // common path above. + DenseMap::iterator TFRVI = TrackedRetVals.find(F); + if (TFRVI == TrackedRetVals.end()) + goto CallOverdefined; + + // If so, propagate the return value of the callee into this call result. + mergeInValue(I, TFRVI->second); + } else { + // Check to see if we're tracking this callee, if not, handle it in the + // common path above. + std::map, LatticeVal>::iterator + TMRVI = TrackedMultipleRetVals.find(std::make_pair(F, 0)); + if (TMRVI == TrackedMultipleRetVals.end()) + goto CallOverdefined; + + // If we are tracking this callee, propagate the return values of the call + // into this call site. We do this by walking all the getresult uses. + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); + UI != E; ++UI) { + GetResultInst *GRI = cast(*UI); + mergeInValue(GRI, + TrackedMultipleRetVals[std::make_pair(F, GRI->getIndex())]); } - assert(State.isConstant() && "Unknown state!"); - Operands.push_back(State.getConstant()); } - - if (Constant *C = ConstantFoldCall(F, &Operands[0], Operands.size())) - markConstant(IV, I, C); - else - markOverdefined(IV, I); + + // Finally, if this is the first call to the function hit, mark its entry + // block executable. + if (!BBExecutable.count(F->begin())) + MarkBlockExecutable(F->begin()); + + // Propagate information from this call site into the callee. + CallSite::arg_iterator CAI = CS.arg_begin(); + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); + AI != E; ++AI, ++CAI) { + LatticeVal &IV = ValueState[AI]; + if (!IV.isOverdefined()) + mergeInValue(IV, AI, getValueState(*CAI)); + } } Added: llvm/trunk/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll?rev=50140&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll (added) +++ llvm/trunk/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll Wed Apr 23 00:38:20 2008 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i32 %Z} +; rdar://5778210 + +declare {i32, i32} @bar(i32 %A) + +define i32 @foo() { + %X = call {i32, i32} @bar(i32 17) + %Y = getresult {i32, i32} %X, 0 + %Z = add i32 %Y, %Y + ret i32 %Z +} From sabre at nondot.org Wed Apr 23 00:59:23 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 05:59:23 -0000 Subject: [llvm-commits] [llvm] r50141 - /llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Message-ID: <200804230559.m3N5xNqL032281@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 00:59:23 2008 New Revision: 50141 URL: http://llvm.org/viewvc/llvm-project?rev=50141&view=rev Log: Fix a number of bugs in ipconstantprop, simplify the code, fit in 80 cols, fix read after free bug (PR2238). Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=50141&r1=50140&r2=50141&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Wed Apr 23 00:59:23 2008 @@ -152,20 +152,20 @@ for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { - unsigned RetValsSize = RetVals.size(); - assert (RetValsSize == RI->getNumOperands() && "Invalid ReturnInst operands!"); - for (unsigned i = 0; i < RetValsSize; ++i) { - if (isa(RI->getOperand(i))) { - // Ignore - } else if (Constant *C = dyn_cast(RI->getOperand(i))) { - Value *RV = RetVals[i]; - if (RV == 0) - RetVals[i] = C; - else if (RV != C) - return false; // Does not return the same constant. - } else { + assert(RetVals.size() == RI->getNumOperands() && + "Invalid ReturnInst operands!"); + for (unsigned i = 0, e = RetVals.size(); i != e; ++i) { + if (isa(RI->getOperand(i))) + continue; // Ignore + Constant *C = dyn_cast(RI->getOperand(i)); + if (C == 0) return false; // Does not return a constant. - } + + Value *RV = RetVals[i]; + if (RV == 0) + RetVals[i] = C; + else if (RV != C) + return false; // Does not return the same constant. } } @@ -174,43 +174,41 @@ if (RetVals[i] == 0) RetVals[i] = UndefValue::get(STy->getElementType(i)); } else { - if (RetVals.size() == 1) - if (RetVals[0] == 0) - RetVals[0] = UndefValue::get(F.getReturnType()); + assert(RetVals.size() == 1); + if (RetVals[0] == 0) + RetVals[0] = UndefValue::get(F.getReturnType()); } // If we got here, the function returns a constant value. Loop over all // users, replacing any uses of the return value with the returned constant. bool ReplacedAllUsers = true; bool MadeChange = false; - for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) - if (!isa(*I)) + for (Value::use_iterator UI = F.use_begin(), E = F.use_end(); UI != E; ++UI) { + // Make sure this is an invoke or call and that the use is for the callee. + if (!(isa(*UI) || isa(*UI)) || + UI.getOperandNo() != 0) { ReplacedAllUsers = false; - else { - CallSite CS = CallSite::get(cast(*I)); - if (CS.getInstruction() == 0 || - CS.getCalledFunction() != &F) { - ReplacedAllUsers = false; - } else { - Instruction *Call = CS.getInstruction(); - if (!Call->use_empty()) { - if (RetVals.size() == 1) - Call->replaceAllUsesWith(RetVals[0]); - else { - for(Value::use_iterator CUI = Call->use_begin(), CUE = Call->use_end(); - CUI != CUE; ++CUI) { - GetResultInst *GR = cast(CUI); - if (RetVals[GR->getIndex()]) { - GR->replaceAllUsesWith(RetVals[GR->getIndex()]); - GR->eraseFromParent(); - } - } - } - MadeChange = true; - } - } + continue; } + + Instruction *Call = cast(*UI); + if (Call->use_empty()) + continue; + MadeChange = true; + + if (STy == 0) { + Call->replaceAllUsesWith(RetVals[0]); + continue; + } + + while (!Call->use_empty()) { + GetResultInst *GR = cast(Call->use_back()); + GR->replaceAllUsesWith(RetVals[GR->getIndex()]); + GR->eraseFromParent(); + } + } + // If we replace all users with the returned constant, and there can be no // other callers of the function, replace the constant being returned in the // function with an undef value. From sabre at nondot.org Wed Apr 23 01:16:28 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 06:16:28 -0000 Subject: [llvm-commits] [llvm] r50142 - /llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Message-ID: <200804230616.m3N6GSkd032760@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 01:16:27 2008 New Revision: 50142 URL: http://llvm.org/viewvc/llvm-project?rev=50142&view=rev Log: simplify code for propagation of constant arguments into callees. Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=50142&r1=50141&r2=50142&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Wed Apr 23 01:16:27 2008 @@ -76,61 +76,64 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) { if (F.arg_empty() || F.use_empty()) return false; // No arguments? Early exit. - std::vector > ArgumentConstants; + // For each argument, keep track of its constant value and whether it is a + // constant or not. The bool is driven to true when found to be non-constant. + SmallVector, 16> ArgumentConstants; ArgumentConstants.resize(F.arg_size()); unsigned NumNonconstant = 0; + for (Value::use_iterator UI = F.use_begin(), E = F.use_end(); UI != E; ++UI) { + // Used by a non-instruction, or not the callee of a function, do not + // transform. + if (UI.getOperandNo() != 0 || + (!isa(*UI) && !isa(*UI))) + return false; + + CallSite CS = CallSite::get(cast(*UI)); - for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) - if (!isa(*I)) - return false; // Used by a non-instruction, do not transform - else { - CallSite CS = CallSite::get(cast(*I)); - if (CS.getInstruction() == 0 || - CS.getCalledFunction() != &F) - return false; // Not a direct call site? - - // Check out all of the potentially constant arguments - CallSite::arg_iterator AI = CS.arg_begin(); - Function::arg_iterator Arg = F.arg_begin(); - for (unsigned i = 0, e = ArgumentConstants.size(); i != e; - ++i, ++AI, ++Arg) { - if (*AI == &F) return false; // Passes the function into itself - - if (!ArgumentConstants[i].second) { - if (Constant *C = dyn_cast(*AI)) { - if (!ArgumentConstants[i].first) - ArgumentConstants[i].first = C; - else if (ArgumentConstants[i].first != C) { - // Became non-constant - ArgumentConstants[i].second = true; - ++NumNonconstant; - if (NumNonconstant == ArgumentConstants.size()) return false; - } - } else if (*AI != &*Arg) { // Ignore recursive calls with same arg - // This is not a constant argument. Mark the argument as - // non-constant. - ArgumentConstants[i].second = true; - ++NumNonconstant; - if (NumNonconstant == ArgumentConstants.size()) return false; - } - } + // Check out all of the potentially constant arguments. Note that we don't + // inspect varargs here. + CallSite::arg_iterator AI = CS.arg_begin(); + Function::arg_iterator Arg = F.arg_begin(); + for (unsigned i = 0, e = ArgumentConstants.size(); i != e; + ++i, ++AI, ++Arg) { + + // If this argument is known non-constant, ignore it. + if (ArgumentConstants[i].second) + continue; + + Constant *C = dyn_cast(*AI); + if (C && ArgumentConstants[i].first == 0) { + ArgumentConstants[i].first = C; // First constant seen. + } else if (C && ArgumentConstants[i].first == C) { + // Still the constant value we think it is. + } else if (*AI == &*Arg) { + // Ignore recursive calls passing argument down. + } else { + // Argument became non-constant. If all arguments are non-constant now, + // give up on this function. + if (++NumNonconstant == ArgumentConstants.size()) + return false; + ArgumentConstants[i].second = true; } } + } // If we got to this point, there is a constant argument! assert(NumNonconstant != ArgumentConstants.size()); - Function::arg_iterator AI = F.arg_begin(); bool MadeChange = false; - for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) - // Do we have a constant argument!? - if (!ArgumentConstants[i].second && !AI->use_empty()) { - Value *V = ArgumentConstants[i].first; - if (V == 0) V = UndefValue::get(AI->getType()); - AI->replaceAllUsesWith(V); - ++NumArgumentsProped; - MadeChange = true; - } + Function::arg_iterator AI = F.arg_begin(); + for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) { + // Do we have a constant argument? + if (ArgumentConstants[i].second || AI->use_empty()) + continue; + + Value *V = ArgumentConstants[i].first; + if (V == 0) V = UndefValue::get(AI->getType()); + AI->replaceAllUsesWith(V); + ++NumArgumentsProped; + MadeChange = true; + } return MadeChange; } From isanbard at gmail.com Wed Apr 23 01:53:21 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Apr 2008 06:53:21 -0000 Subject: [llvm-commits] [llvm] r50143 - /llvm/tags/Apple/llvmCore-9999/ Message-ID: <200804230653.m3N6rLsj001358@zion.cs.uiuc.edu> Author: void Date: Wed Apr 23 01:53:21 2008 New Revision: 50143 URL: http://llvm.org/viewvc/llvm-project?rev=50143&view=rev Log: Accidentally tagged. Removed: llvm/tags/Apple/llvmCore-9999/ From isanbard at gmail.com Wed Apr 23 01:53:56 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Apr 2008 06:53:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50144 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-9999/ Message-ID: <200804230653.m3N6rud3001393@zion.cs.uiuc.edu> Author: void Date: Wed Apr 23 01:53:56 2008 New Revision: 50144 URL: http://llvm.org/viewvc/llvm-project?rev=50144&view=rev Log: Accidentally tagged. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-9999/ From isanbard at gmail.com Wed Apr 23 02:13:17 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Apr 2008 07:13:17 -0000 Subject: [llvm-commits] [llvm] r50145 - /llvm/trunk/tools/llvm2cpp/CppWriter.cpp Message-ID: <200804230713.m3N7DHMC002165@zion.cs.uiuc.edu> Author: void Date: Wed Apr 23 02:13:17 2008 New Revision: 50145 URL: http://llvm.org/viewvc/llvm-project?rev=50145&view=rev Log: Use the Create static method for some of these objects. They no longer have public constructors. This should fix PR2246. Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm2cpp/CppWriter.cpp?rev=50145&r1=50144&r2=50145&view=diff ============================================================================== --- llvm/trunk/tools/llvm2cpp/CppWriter.cpp (original) +++ llvm/trunk/tools/llvm2cpp/CppWriter.cpp Wed Apr 23 02:13:17 2008 @@ -1083,13 +1083,13 @@ switch (I->getOpcode()) { case Instruction::Ret: { const ReturnInst* ret = cast(I); - Out << "new ReturnInst(" + Out << "ReturnInst::Create(" << (ret->getReturnValue() ? opNames[0] + ", " : "") << bbname << ");"; break; } case Instruction::Br: { const BranchInst* br = cast(I); - Out << "new BranchInst(" ; + Out << "BranchInst::Create(" ; if (br->getNumOperands() == 3 ) { Out << opNames[0] << ", " << opNames[1] << ", " @@ -1105,7 +1105,7 @@ } case Instruction::Switch: { const SwitchInst* sw = cast(I); - Out << "SwitchInst* " << iName << " = new SwitchInst(" + Out << "SwitchInst* " << iName << " = SwitchInst::Create(" << opNames[0] << ", " << opNames[1] << ", " << sw->getNumCases() << ", " << bbname << ");"; @@ -1127,7 +1127,7 @@ << opNames[i] << ");"; nl(Out); } - Out << "InvokeInst *" << iName << " = new InvokeInst(" + Out << "InvokeInst *" << iName << " = InvokeInst::Create(" << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", " @@ -1291,7 +1291,7 @@ case Instruction::GetElementPtr: { const GetElementPtrInst* gep = cast(I); if (gep->getNumOperands() <= 2) { - Out << "GetElementPtrInst* " << iName << " = new GetElementPtrInst(" + Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create(" << opNames[0]; if (gep->getNumOperands() == 2) Out << ", " << opNames[1]; @@ -1303,7 +1303,7 @@ << opNames[i] << ");"; nl(Out); } - Out << "Instruction* " << iName << " = new GetElementPtrInst(" + Out << "Instruction* " << iName << " = GetElementPtrInst::Create(" << opNames[0] << ", " << iName << "_indices.begin(), " << iName << "_indices.end()"; } @@ -1382,14 +1382,14 @@ Out << iName << "_params.push_back(" << opNames[i] << ");"; nl(Out); } - Out << "CallInst* " << iName << " = new CallInst(" + Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0] << ", " << iName << "_params.begin(), " << iName << "_params.end(), \""; } else if (call->getNumOperands() == 2) { - Out << "CallInst* " << iName << " = new CallInst(" + Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0] << ", " << opNames[1] << ", \""; } else { - Out << "CallInst* " << iName << " = new CallInst(" << opNames[0] + Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0] << ", \""; } printEscapedString(call->getName()); @@ -1407,7 +1407,7 @@ } case Instruction::Select: { const SelectInst* sel = cast(I); - Out << "SelectInst* " << getCppName(sel) << " = new SelectInst("; + Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create("; Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \""; printEscapedString(sel->getName()); Out << "\", " << bbname << ");"; @@ -1439,7 +1439,7 @@ case Instruction::InsertElement: { const InsertElementInst* iei = cast(I); Out << "InsertElementInst* " << getCppName(iei) - << " = new InsertElementInst(" << opNames[0] + << " = InsertElementInst::Create(" << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \""; printEscapedString(iei->getName()); Out << "\", " << bbname << ");"; @@ -1550,7 +1550,7 @@ nl(Out) << "if (!" << getCppName(F) << ") {"; nl(Out) << getCppName(F); } - Out<< " = new Function("; + Out<< " = Function::Create("; nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ","; nl(Out) << "/*Linkage=*/"; printLinkageType(F->getLinkage()); @@ -1628,7 +1628,7 @@ for (Function::const_iterator BI = F->begin(), BE = F->end(); BI != BE; ++BI) { std::string bbname(getCppName(BI)); - Out << "BasicBlock* " << bbname << " = new BasicBlock(\""; + Out << "BasicBlock* " << bbname << " = BasicBlock::Create(\""; if (BI->hasName()) printEscapedString(BI->getName()); Out << "\"," << getCppName(BI->getParent()) << ",0);"; From romix.llvm at googlemail.com Wed Apr 23 02:35:46 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Wed, 23 Apr 2008 08:35:46 +0100 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> References: <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> Message-ID: Hi Dan, 2008/4/23, Dan Gohman : > > On Apr 21, 2008, at 8:51 AM, Roman Levenstein wrote: > > Sorry, forgot to attach the patch ;-) > > > > 2008/4/21, Roman Levenstein : > >> Hi, > >> > >> 2008/4/19, Roman Levenstein : > >> > >>> Hi Dan, Hi Evan, > >>> > >>> 2008/4/19, Dan Gohman : > >>> > >>>> > >>>> On Apr 16, 2008, at 9:19 AM, Roman Levenstein wrote: > >>>>> > >>>> > >>>>> BTW, Dan, have you had any time to look at the patch introducing > >>>>> queues instead of heaps in the target specific instruction > >>>>> selectors? > >>>> > >>>> > >>>> Is this the ScheduleDAGRRList patch that changes > >>>> std::priority_queue > >>>> to std::set? I know you checked in part of those changes already; > >>>> could you send me an updated patch with just the outstanding > >>>> changes? > >>> > >>> > >>> No. I don't mean the ScheduleDAGRRList.pacth. For this one, I > >>> proposed > >>> the remaining patch just with the outstanding patches yesterday (see > >>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080414/061236.html) > >>> . > >>> And it is also about using the std::set :-) > >>> > >>> The patch for instruction selectors was proposed by me here: > >>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080303/059215.html > >>> It is related to the Select() and SelectRoot implementations inside > >>> the target-specific code selectors generated by tablegen. > >>> > >>> Regarding my questions about std::set vs std;;multiset in the > >>> mentioned patch: > >>> Having looked into it again, I have the impression that std::set > >>> could > >>> be used and there is no need for std::multiset. Basically, the this > >>> code: > >>> void AddToISelQueue(SDOperand N) DISABLE_INLINE { > >>> int Id = N.Val->getNodeId(); > >>> if (Id != -1 && !isQueued(Id)) { > >>> ... > >>> } > >>> ensures that only one node with a given NodeId can be inserted into > >>> the ISelQueue. > >>> > >>> One possible further improvement, I'm thinking about is the > >>> following: > >>> Why do we use a sorted data structure (e.g. sorted vector, set) for > >>> the ISelQueue at all? > >>> > >>> 1) If we look into the SelectRoot logic, it basically takes the node > >>> with the SMALLEST NodeId from the pending selection queue. > >>> 2) More over, it seems to me (please, confirm if it is true!) that > >>> the > >>> next node taken for selection in the loop inside the SelectRoot, at > >>> any point in time, has a NodeId that is GREATER than the NodeId of > >>> the > >>> last selected node. > >>> 3) Even if the selection of the node puts new nodes into the > >>> selection > >>> queue, they ALWAYS have NodeIds GREATER than that of this node. > >>> Therefore the property (2) is preserved. > >>> > >>> I checked (2) and (3) by adding some debug output to the SelectRoot. > >>> Only one test of all llvm/test test-cases does not fulfill this > >>> assumptions and even there it is not quite obvious if it is a > >>> contradiction to (2) and (3) or a bug. > >>> > >>> So, assuming that properties (2) and (3) do hold, the following > >>> can be > >>> probably done: > >>> - We iterate over the NodeId numbers from 0 till the DAGSize. > >>> - We check if a Node with a given NodeId (by looking into the > >>> TopOrder???), if isQueued(NodeId) is true, i.e. this is in the queue > >>> - We then check if isSelected(NodeId) is true or false and call > >>> Select() for this node, if it is not selected yet. > >>> - If a new node needs to be inserted into the queue, only > >>> setQueued(NodeId) is called > >>> > >>> With these changes, no online sorting would be required at all, > >>> which > >>> is a great improvement over the current approach. > >>> > >>> What do you think about it? Is it a correct analysis? > >> > >> > >> I created a working implementation based on these I ideas. Now all > >> llvm/test test-cases pass it. Please find it in the attached patch. > >> The patch is rather ugly and uses a lot of #ifdefs, but I think it is > >> OK for a proof of concept. > >> > >> Short explanation for the macros: > >> OLD - enables old-style selector queue, using heaps. Can be used to > >> have a step-by-step comparison with std::set based approach. > >> USE_QUEUE - enables std::set based approach > >> NO_QUEUE - enables the implementation that does not use any special > >> sorted queue at all, as outlined in the previous mail. > >> (Note: USE_QUEUE should not be used at the same time as NO_QUEUE) > >> > >> Both USE_QUEUE and NO_QUEUE modes speed-up the instruction selection > >> significantly (on my test compilation time goes down from 12 to 9 > >> seconds). > >> > >> I'm very interested in your comments about this approach. > > > This looks like a nice approach. Re-using and updating TopOrder > instead of building up a std::set that ends up with the same contents > is neat. I was a little concerned about the priority-queue code being > removed since I don't know if there were future plans for it, however > it looks like doing anything with ordering more specific than > simple topological ordering would require a fair amount of work > anyway, so I'm not worrying about it. OK. > Do you see any compile-time difference between using a std::set > queue and the NO_QUEUE approach, out of curiosity? Well, the difference between using a std::set queue and the NO_QUEUE approach is rather small, especially on small and medium-sized testcases. I have the impression that it comes mainly from the fact that NO_QUEUE does not do any dynamic heap memory allocation. Both of these approaches are significantly faster than the current heap-sorting approach. > In addition to regular testing, since this patch doesn't modify any > heuristics, it should be possible to compare assembly output > between an unmodified compiler and one with this patch applied. > Can you verify that this patch doesn't change any output on some > interesting testcases? I tried it with Kimwitu, which is a very big and complex test-case. All approaches produce exactly the same assembler code. On my test-cases with very big BBs it also produces exactly the same results. For the sake of comparison, here are also some time statistics for the compilation of Kimwitu, measured by means of the Linux "time" command: Current LLVM approach: real 1m51.464s user 1m21.161s sys 0m8.529s std::set approach: real 1m37.938s (13% faster than current LLVM implementation) user 1m16.169s sys 0m7.732s NO_QUEUE approach: real 1m29.548s (20% faster than current LLVM implementation) user 1m14.949s sys 0m7.824s -Roman From nicolas.geoffray at lip6.fr Wed Apr 23 02:46:20 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 23 Apr 2008 09:46:20 +0200 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> Message-ID: <480EE94C.8060302@lip6.fr> Roman Levenstein wrote: > > I tried it with Kimwitu, which is a very big and complex test-case. > All approaches produce exactly the same assembler code. On my > test-cases with very big BBs it also produces exactly the same > results. > > For the sake of comparison, here are also some time statistics for the > compilation of Kimwitu, measured by means of the Linux "time" command: > > Current LLVM approach: > real 1m51.464s > user 1m21.161s > sys 0m8.529s > > std::set approach: > real 1m37.938s (13% faster than current LLVM implementation) > user 1m16.169s > sys 0m7.732s > > NO_QUEUE approach: > real 1m29.548s (20% faster than current LLVM implementation) > user 1m14.949s > sys 0m7.824s > > Impressive! I want this patch in! ;-) I'm using the JIT of LLVM, so I'm really looking forward on any kind of compilation time optimizations. Very nice work. Nicolas > -Roman > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From nicolas.geoffray at lip6.fr Wed Apr 23 03:19:08 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 23 Apr 2008 08:19:08 -0000 Subject: [llvm-commits] [vmkit] r50146 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaConstantPool.cpp JavaJIT.cpp JavaJIT.h JavaJITInitialise.cpp JavaJITOpcodes.cpp JavaMetaJIT.cpp JavaRuntimeJIT.cpp Jnjvm.cpp JnjvmModuleProvider.cpp Message-ID: <200804230819.m3N8J9qx011899@zion.cs.uiuc.edu> Author: geoffray Date: Wed Apr 23 03:19:08 2008 New Revision: 50146 URL: http://llvm.org/viewvc/llvm-project?rev=50146&view=rev Log: Use C++-like vtables. One can disable it with -DWITHOUT_VTABLE. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Wed Apr 23 03:19:08 2008 @@ -411,9 +411,6 @@ meth = cl->lookupMethodDontThrow(utf8, sign->keyName, isStatic(access), false); if (meth) { // don't throw if no meth, the exception will be thrown just in time if (meth->llvmFunction) { - if (meth->llvmFunction->hasNotBeenReadFromBitcode()) { - meth->classDef->isolate->functionDefs->hash(meth->llvmFunction, meth); - } ctpRes[index] = (void*)meth->llvmFunction; return (llvm::Function*)ctpRes[index]; } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Apr 23 03:19:08 2008 @@ -99,6 +99,94 @@ return stack.size(); } +void JavaJIT::invokeVirtual(uint16 index) { + + JavaCtpInfo* ctpInfo = compilingClass->ctpInfo; + CommonClass* cl = 0; + JavaMethod* meth = 0; + ctpInfo->infoOfMethod(index, ACC_VIRTUAL, cl, meth); + + if ((cl && isFinal(cl->access)) || + (meth && (isFinal(meth->access) || isPrivate(meth->access)))) + return invokeSpecial(index); + +#ifndef WITHOUT_VTABLE + Constant* zero = mvm::jit::constantZero; + Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index); + std::vector args; // size = [signature->nbIn + 3]; + + FunctionType::param_iterator it = signature->virtualType->param_end(); + makeArgs(it, index, args, signature->nbIn + 1); + + JITVerifyNull(args[0]); + + std::vector indexes; //[3]; + indexes.push_back(zero); + indexes.push_back(zero); + Value* VTPtr = GetElementPtrInst::Create(args[0], indexes.begin(), + indexes.end(), "", currentBlock); + + Value* VT = new LoadInst(VTPtr, "", currentBlock); + std::vector indexes2; //[3]; + if (meth) { + indexes2.push_back(meth->offset); + } else { + compilingClass->isolate->protectModule->lock(); + GlobalVariable* gv = + new GlobalVariable(Type::Int32Ty, false, GlobalValue::ExternalLinkage, + zero, "", compilingClass->isolate->module); + compilingClass->isolate->protectModule->unlock(); + + // set is volatile + Value* val = new LoadInst(gv, "", true, currentBlock); + Value * cmp = new ICmpInst(ICmpInst::ICMP_NE, val, zero, "", currentBlock); + BasicBlock* ifTrue = createBasicBlock("true vtable"); + BasicBlock* ifFalse = createBasicBlock("false vtable"); + BasicBlock* endBlock = createBasicBlock("end vtable"); + PHINode * node = llvm::PHINode::Create(Type::Int32Ty, "", endBlock); + llvm::BranchInst::Create(ifTrue, ifFalse, cmp, currentBlock); + + currentBlock = ifTrue; + node->addIncoming(val, currentBlock); + llvm::BranchInst::Create(endBlock, currentBlock); + + currentBlock = ifFalse; + std::vector Args; + Args.push_back(args[0]); + Module* M = compilingClass->isolate->module; + Args.push_back(new LoadInst(compilingClass->llvmVar(M), "", currentBlock)); + mvm::jit::protectConstants();//->lock(); + Constant* CI = ConstantInt::get(Type::Int32Ty, index); + Args.push_back(CI); + mvm::jit::unprotectConstants();//->unlock(); + Args.push_back(gv); + val = invoke(vtableLookupLLVM, Args, "", currentBlock); + node->addIncoming(val, currentBlock); + llvm::BranchInst::Create(endBlock, currentBlock); + + currentBlock = endBlock; + indexes2.push_back(node); + } + + Value* FuncPtr = GetElementPtrInst::Create(VT, indexes2.begin(), + indexes2.end(), "", + currentBlock); + + Value* Func = new LoadInst(FuncPtr, "", currentBlock); + Func = new BitCastInst(Func, signature->virtualTypePtr, "", currentBlock); + Value* val = invoke(Func, args, "", currentBlock); + const llvm::Type* retType = signature->virtualType->getReturnType(); + if (retType != Type::VoidTy) { + push(val, signature->ret->funcs); + if (retType == Type::DoubleTy || retType == Type::Int64Ty) { + push(mvm::jit::constantZero, AssessorDesc::dInt); + } + } +#else + return invokeInterfaceOrVirtual(index); +#endif +} + std::pair JavaJIT::popPair() { std::pair ret = stack.back(); stack.pop_back(); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h Wed Apr 23 03:19:08 2008 @@ -176,6 +176,7 @@ // methods invoke void makeArgs(llvm::FunctionType::param_iterator it, uint32 index, std::vector& result, uint32 nb); + void invokeVirtual(uint16 index); void invokeInterfaceOrVirtual(uint16 index); void invokeSpecial(uint16 index); void invokeStatic(uint16 index); @@ -255,6 +256,9 @@ #endif static llvm::Function* initialiseObjectLLVM; static llvm::Function* newLookupLLVM; +#ifndef WITHOUT_VTABLE + static llvm::Function* vtableLookupLLVM; +#endif static llvm::Function* instanceOfLLVM; static llvm::Function* aquireObjectLLVM; static llvm::Function* releaseObjectLLVM; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Wed Apr 23 03:19:08 2008 @@ -71,7 +71,8 @@ const llvm::Type* Pty = mvm::jit::ptrType; std::vector objectFields; - objectFields.push_back(Pty); // VT + objectFields.push_back( + PointerType::getUnqual(PointerType::getUnqual(Type::Int32Ty))); // VT objectFields.push_back(Pty); // Class objectFields.push_back(Pty); // Lock JavaObject::llvmType = @@ -345,6 +346,21 @@ "newLookup", module); } + +#ifndef WITHOUT_VTABLE + // Create vtableLookupLLVM + { + std::vector args; + args.push_back(JavaObject::llvmType); // obj + args.push_back(mvm::jit::ptrType); // cl + args.push_back(Type::Int32Ty); // index + args.push_back(PointerType::getUnqual(Type::Int32Ty)); // vtable index + const FunctionType* type = FunctionType::get(Type::Int32Ty, args, false); + + vtableLookupLLVM = Function::Create(type, GlobalValue::ExternalLinkage, + "vtableLookup", module); + } +#endif // Create fieldLookupLLVM { Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Wed Apr 23 03:19:08 2008 @@ -1724,14 +1724,7 @@ case INVOKEVIRTUAL : { uint16 index = readU2(bytecodes, i); - JavaCtpInfo* ctpInfo = compilingClass->ctpInfo; - CommonClass* cl = 0; - JavaMethod* meth = 0; - ctpInfo->infoOfMethod(index, ACC_VIRTUAL, cl, meth); - if ((cl && isFinal(cl->access)) || (meth && isFinal(meth->access))) - invokeSpecial(index); - else - invokeInterfaceOrVirtual(index); + invokeVirtual(index); break; } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Wed Apr 23 03:19:08 2008 @@ -171,12 +171,14 @@ va_end(ap); } +#ifndef WITHOUT_VTABLE VirtualTable* allocateVT(Class* cl, std::vector::iterator meths) { if (meths == cl->virtualMethods.end()) { uint64 size = cl->virtualTableSize; VirtualTable* VT = (VirtualTable*)malloc(size * sizeof(void*)); if (cl->super) { - memcpy(VT, cl->super->VT, cl->super->virtualTableSize * sizeof(void*)); + Class* super = (Class*)cl->super; + memcpy(VT, super->virtualVT, cl->super->virtualTableSize * sizeof(void*)); } else { memcpy(VT, JavaObject::VT, VT_SIZE); } @@ -203,18 +205,22 @@ return VT; } } - +#endif VirtualTable* JavaJIT::makeVT(Class* cl, bool stat) { VirtualTable* res = 0; +#ifndef WITHOUT_VTABLE if (stat) { +#endif res = (VirtualTable*)malloc(VT_SIZE); memcpy(res, JavaObject::VT, VT_SIZE); +#ifndef WITHOUT_VTABLE } else { res = allocateVT(cl, cl->virtualMethods.begin()); } +#endif #ifdef WITH_TRACER const Type* type = stat ? cl->staticType : cl->virtualType; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Wed Apr 23 03:19:08 2008 @@ -41,6 +41,9 @@ llvm::Function* JavaJIT::javaObjectTracerLLVM = 0; llvm::Function* JavaJIT::virtualLookupLLVM = 0; llvm::Function* JavaJIT::fieldLookupLLVM = 0; +#ifndef WITHOUT_VTABLE +llvm::Function* JavaJIT::vtableLookupLLVM = 0; +#endif llvm::Function* JavaJIT::UTF8AconsLLVM = 0; llvm::Function* JavaJIT::Int8AconsLLVM = 0; llvm::Function* JavaJIT::Int32AconsLLVM = 0; @@ -242,6 +245,27 @@ return cl; } +#ifndef WITHOUT_VTABLE +extern "C" uint32 vtableLookup(JavaObject* obj, Class* caller, uint32 index, + uint32* offset) { + CommonClass* cl = 0; + const UTF8* utf8 = 0; + Signdef* sign = 0; + + caller->ctpInfo->resolveInterfaceOrMethod(index, cl, utf8, sign); + JavaMethod* dmeth = cl->lookupMethodDontThrow(utf8, sign->keyName, false, + true); + if (!dmeth) { + // Arg, it should have been an invoke interface.... Perform the lookup + // on the object class and do not update offset. + dmeth = obj->classOf->lookupMethod(utf8, sign->keyName, false, true); + return (uint32)(dmeth->offset->getZExtValue()); + } + *offset = (uint32)(dmeth->offset->getZExtValue()); + return *offset; +} +#endif + #ifdef MULTIPLE_VM extern "C" void initialisationCheck(CommonClass* cl) { cl->isolate->initialiseClass(cl); Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Wed Apr 23 03:19:08 2008 @@ -176,7 +176,7 @@ if (super == 0) { cl->depth = 0; cl->display.push_back(cl); - cl->virtualTableSize = VT_SIZE; + cl->virtualTableSize = VT_SIZE / sizeof(void*); } else { cl->super = loadName(super, classLoader, true, false, true); int depth = cl->super->depth; @@ -795,6 +795,7 @@ method->printString(), method->classDef->isolate->module); method->classDef->isolate->protectModule->unlock(); + method->classDef->isolate->functionDefs->hash(method->llvmFunction, method); return method; } Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=50146&r1=50145&r2=50146&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Wed Apr 23 03:19:08 2008 @@ -22,7 +22,6 @@ using namespace llvm; using namespace jnjvm; -#include static JavaMethod* staticLookup(Class* caller, uint32 index) { JavaCtpInfo* ctpInfo = caller->ctpInfo; @@ -66,6 +65,12 @@ void* val = meth->compiledPtr(); if (F->isDeclaration()) mvm::jit::executionEngine->updateGlobalMapping(F, val); + + if (meth->offset) { + uint64_t offset = meth->offset->getZExtValue(); + ((void**)meth->classDef->virtualVT)[offset] = val; + } + return false; } From ggreif at gmail.com Wed Apr 23 05:56:21 2008 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 23 Apr 2008 10:56:21 -0000 Subject: [llvm-commits] [llvm] r50147 - /llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Message-ID: <200804231056.m3NAuMZl016799@zion.cs.uiuc.edu> Author: ggreif Date: Wed Apr 23 05:56:15 2008 New Revision: 50147 URL: http://llvm.org/viewvc/llvm-project?rev=50147&view=rev Log: remove horrible quadratic complexity when reallocating Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50147&r1=50146&r2=50147&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Wed Apr 23 05:56:15 2008 @@ -154,7 +154,7 @@ if (Desired > Capacity) { - Use *New = allocHungoffUses(Desired); + Use *New = allocHungoffUses(Desired*2+100); for (int i(getNumOperands() - 1); i >= 0; --i) New[i] = getOperand(i); Use *Old = OperandList; From ggreif at gmail.com Wed Apr 23 09:42:34 2008 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 23 Apr 2008 14:42:34 -0000 Subject: [llvm-commits] [llvm] r50148 - in /llvm/branches/ggreif/use-diet/lib/Bitcode/Reader: BitcodeReader.cpp BitcodeReader.h Message-ID: <200804231442.m3NEgZVn023001@zion.cs.uiuc.edu> Author: ggreif Date: Wed Apr 23 09:42:33 2008 New Revision: 50148 URL: http://llvm.org/viewvc/llvm-project?rev=50148&view=rev Log: keep capacity in member variable instead of recalculating it. avoid double overallocation. cleanups. Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50148&r1=50147&r2=50148&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Wed Apr 23 09:42:33 2008 @@ -147,19 +147,16 @@ } void BitcodeReaderValueList::resize(unsigned Desired) { - unsigned Capacity = 0; - if (OperandList) { - Capacity = OperandList->getImpliedUser() - OperandList; - } - if (Desired > Capacity) { - Use *New = allocHungoffUses(Desired*2+100); - for (int i(getNumOperands() - 1); i >= 0; --i) - New[i] = getOperand(i); + Capacity = Desired * 2 + 100; + Use *New = allocHungoffUses(Capacity); Use *Old = OperandList; + unsigned Ops = getNumOperands(); + for (int i(Ops - 1); i >= 0; --i) + New[i] = Old[i].get(); OperandList = New; - if (Old) dropHungoffUses(Old); + if (Old) Use::zap(Old, Old + Ops, true); } } @@ -167,8 +164,7 @@ const Type *Ty) { if (Idx >= size()) { // Insert a bunch of null values. - resize(Idx * 2 + 1); -// OperandList = &Uses[0]; + resize(Idx + 1); NumOperands = Idx+1; } @@ -186,8 +182,7 @@ Value *BitcodeReaderValueList::getValueFwdRef(unsigned Idx, const Type *Ty) { if (Idx >= size()) { // Insert a bunch of null values. - resize(Idx * 2 + 1); -// OperandList = &Uses[0]; + resize(Idx + 1); NumOperands = Idx+1; } Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h?rev=50148&r1=50147&r2=50148&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h (original) +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h Wed Apr 23 09:42:33 2008 @@ -31,9 +31,11 @@ //===----------------------------------------------------------------------===// class BitcodeReaderValueList : public User { + unsigned Capacity; public: - BitcodeReaderValueList() : User(Type::VoidTy, Value::ArgumentVal, 0, 0) {} - + BitcodeReaderValueList() : User(Type::VoidTy, Value::ArgumentVal, 0, 0) + , Capacity(0) {} + /// Provide fast operand accessors DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -44,11 +46,12 @@ unsigned OldOps(NumOperands), NewOps(NumOperands + 1); resize(NewOps); NumOperands = NewOps; - OperandList[OldOps].init(V, this); + OperandList[OldOps] = V; } void clear() { if (OperandList) dropHungoffUses(OperandList); + Capacity = 0; } Value *operator[](unsigned i) const { return getOperand(i); } From gohman at apple.com Wed Apr 23 11:03:08 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 09:03:08 -0700 (PDT) Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> Message-ID: <53768.76.126.219.198.1208966588.squirrel@webmail.apple.com> Hi Roman, On Wed, April 23, 2008 12:35 am, Roman Levenstein wrote: > Hi Dan, > > 2008/4/23, Dan Gohman : >> >> Do you see any compile-time difference between using a std::set >> queue and the NO_QUEUE approach, out of curiosity? > > Well, the difference between using a std::set queue and the NO_QUEUE > approach is rather small, especially on small and medium-sized > testcases. I have the impression that it comes mainly from the fact > that NO_QUEUE does not do any dynamic heap memory allocation. Both of > these approaches are significantly faster than the current > heap-sorting approach. Judging by your numbers below, overall compilation of Kimwuitu with NO_QUEUE is 9% faster than with std::set. Even if we're talking about larger-than-usual BBs resulting from LTO, that's a pretty big number. > > >> In addition to regular testing, since this patch doesn't modify any >> heuristics, it should be possible to compare assembly output >> between an unmodified compiler and one with this patch applied. >> Can you verify that this patch doesn't change any output on some >> interesting testcases? > > I tried it with Kimwitu, which is a very big and complex test-case. > All approaches produce exactly the same assembler code. On my > test-cases with very big BBs it also produces exactly the same > results. > > For the sake of comparison, here are also some time statistics for the > compilation of Kimwitu, measured by means of the Linux "time" command: > > Current LLVM approach: > real 1m51.464s > user 1m21.161s > sys 0m8.529s > > std::set approach: > real 1m37.938s (13% faster than current LLVM implementation) > user 1m16.169s > sys 0m7.732s > > NO_QUEUE approach: > real 1m29.548s (20% faster than current LLVM implementation) > user 1m14.949s > sys 0m7.824s This looks really good. Could you run a few other codes to help verify that Kimwitu isn't an anomaly? Thanks, Dan From evan.cheng at apple.com Wed Apr 23 11:53:12 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Apr 2008 09:53:12 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> Message-ID: <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> Very nice! Please run it through MultiSource and SingleSource tests. Dan and I will run it through External tests. If it shows no regression and llvm- gcc bootstrapping works. Then please check it in. Thanks, Evan On Apr 23, 2008, at 12:35 AM, Roman Levenstein wrote: > > >> In addition to regular testing, since this patch doesn't modify any >> heuristics, it should be possible to compare assembly output >> between an unmodified compiler and one with this patch applied. >> Can you verify that this patch doesn't change any output on some >> interesting testcases? > > I tried it with Kimwitu, which is a very big and complex test-case. > All approaches produce exactly the same assembler code. On my > test-cases with very big BBs it also produces exactly the same > results. > > For the sake of comparison, here are also some time statistics for the > compilation of Kimwitu, measured by means of the Linux "time" command: > > Current LLVM approach: > real 1m51.464s > user 1m21.161s > sys 0m8.529s > > std::set approach: > real 1m37.938s (13% faster than current LLVM implementation) > user 1m16.169s > sys 0m7.732s > > NO_QUEUE approach: > real 1m29.548s (20% faster than current LLVM implementation) > user 1m14.949s > sys 0m7.824s > > > -Roman > _______________________________________________ > 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 Wed Apr 23 12:08:49 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Apr 2008 10:08:49 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> References: <417E9823-6AF6-44B0-83FD-89F0CC079B6A@apple.com> <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> Message-ID: By the way "llc -time-passes" should give you a clearer idea how much isel is sped up. Evan On Apr 23, 2008, at 9:53 AM, Evan Cheng wrote: > Very nice! > > Please run it through MultiSource and SingleSource tests. Dan and I > will run it through External tests. If it shows no regression and > llvm- > gcc bootstrapping works. Then please check it in. > > Thanks, > > Evan > > On Apr 23, 2008, at 12:35 AM, Roman Levenstein wrote: > >> >> >>> In addition to regular testing, since this patch doesn't modify any >>> heuristics, it should be possible to compare assembly output >>> between an unmodified compiler and one with this patch applied. >>> Can you verify that this patch doesn't change any output on some >>> interesting testcases? >> >> I tried it with Kimwitu, which is a very big and complex test-case. >> All approaches produce exactly the same assembler code. On my >> test-cases with very big BBs it also produces exactly the same >> results. >> >> For the sake of comparison, here are also some time statistics for >> the >> compilation of Kimwitu, measured by means of the Linux "time" >> command: >> >> Current LLVM approach: >> real 1m51.464s >> user 1m21.161s >> sys 0m8.529s >> >> std::set approach: >> real 1m37.938s (13% faster than current LLVM implementation) >> user 1m16.169s >> sys 0m7.732s >> >> NO_QUEUE approach: >> real 1m29.548s (20% faster than current LLVM implementation) >> user 1m14.949s >> sys 0m7.824s >> >> >> -Roman >> _______________________________________________ >> 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 nicolas.geoffray at lip6.fr Wed Apr 23 12:13:15 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 23 Apr 2008 17:13:15 -0000 Subject: [llvm-commits] [vmkit] r50150 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaMetaJIT.cpp JavaObject.h Message-ID: <200804231713.m3NHDFni027116@zion.cs.uiuc.edu> Author: geoffray Date: Wed Apr 23 12:13:15 2008 New Revision: 50150 URL: http://llvm.org/viewvc/llvm-project?rev=50150&view=rev Log: Update array virtual tables when the java/lang/Object class is resolved. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=50150&r1=50149&r2=50150&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Wed Apr 23 12:13:15 2008 @@ -220,6 +220,28 @@ } else { res = allocateVT(cl, cl->virtualMethods.begin()); } + + if (!(cl->super)) { + // 12 = number of virtual methods in java/lang/Object (!!!) + uint32 size = 12 * sizeof(void*); +#define COPY(CLASS) \ + memcpy((void*)((unsigned)res + VT_SIZE), \ + (void*)((unsigned)CLASS::VT + VT_SIZE), size); + + COPY(ArrayUInt8) + COPY(ArraySInt8) + COPY(ArrayUInt16) + COPY(ArraySInt16) + COPY(ArrayUInt32) + COPY(ArraySInt32) + COPY(ArrayLong) + COPY(ArrayFloat) + COPY(ArrayDouble) + COPY(UTF8) + COPY(ArrayObject) + +#undef COPY + } #endif #ifdef WITH_TRACER Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h?rev=50150&r1=50149&r2=50150&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Wed Apr 23 12:13:15 2008 @@ -103,7 +103,22 @@ void operator()(JavaField* field, sint64 val); void operator()(JavaField* field, uint32 val); void operator()(JavaField* field, JavaObject* val); - + +#ifndef WITHOUT_VTABLE + // Some of these are final. I could probably remove them from the list. + virtual void JavaInit() {} + virtual void JavaEquals() {} + virtual void JavaHashCode() {} + virtual void JavaToString() {} + virtual void JavaFinalize() {} + virtual void JavaClone() {} + virtual void JavaGetClass() {} + virtual void JavaNotify() {} + virtual void JavaNotifyAll() {} + virtual void JavaWait() {} + virtual void JavaWait(sint64) {} + virtual void JavaWait(sint64, sint32) {} +#endif }; From evan.cheng at apple.com Wed Apr 23 12:17:48 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Apr 2008 10:17:48 -0700 Subject: [llvm-commits] Fwd: Speeding up instruction selection In-Reply-To: <2CE4D8B9-C950-493B-B97B-6D25FD90A2C0@apple.com> References: <039F7990-10A9-4153-A91B-024551DF3541@apple.com> <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> <2CE4D8B9-C950-493B-B97B-6D25FD90A2C0@apple.com> Message-ID: <734B123B-A348-4846-A718-DF9F94D6AB4B@apple.com> Hi Roman, Please do more testing on this patch. I am seeing failures: /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/burg.llvm.bc -o Output/burg.llc.s Assertion failed: (RemovedNum == 1 && "Not in queue!"), function remove, file ScheduleDAGRRList.cpp, line 1321. /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/sqlite3.llvm.bc -o Output/sqlite3.llc.s Assertion failed: (RemovedNum == 1 && "Not in queue!"), function remove, file ScheduleDAGRRList.cpp, line 1321. Thanks, Evan On Apr 21, 2008, at 12:44 PM, Evan Cheng wrote: > > On Apr 21, 2008, at 11:54 AM, Roman Levenstein wrote: > >> Hi Evan, >> >> Good point. This code is here due to the historical reasons ;-) I >> introduced it when I was experimenting with different alternatives >> and >> then forgot to remove it... The commit version will not contain it. >> >> Any further comments on this patch? Can I commit it or is it too >> early? > > Please hold off committing for a few days until I have a chance to > evaluate the performance impact. Thanks. > > Evan > >> >> >> - Roman >> >> 2008/4/21, Evan Cheng : >> >>> + if (left->NodeQueueId && right->NodeQueueId) >>> + return (left->NodeQueueId < right->NodeQueueId); >>> + return left->NodeNum < right->NodeNum; >>> >>> Why would NodeQueueId ever be zero? Nodes that are entered into the >>> queue >>> must have this field set, no? >>> >>> Evan >>> >>> >>> On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: >>> >>> >>>> >>>> Hi Evan, >>>> >>>> 2008/4/2, Evan Cheng : >>>> >>>>> >>>>> On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: >>>>> >>>>> >>>>>> 2008/4/2, Evan Cheng : >>>>>> >>>>>>> >>>>>>> On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: >>>>>>> >>>>>>> >>>>>>>> Hi Evan, >>>>>>>> >>>>>>>> 2008/4/1, Evan Cheng : >>>>>>>> >>>>>>>>> Please hold off checking it in for a bit. llvm tot is having >>> some >>>>>>>>> problems and I'd like to get to the bottom of it first. >>>>>>>>> >>>>>>>> >>>>>>>> OK. >>>>>>>> >>>>>>>> >>>>>>>>> Also, the tie breaker is less than ideal. I think we need a >>>>>>>>> tie- >>>>>>>>> breaker that is "the SUnit that's added to the queue is >>> preferred". >>>>>>>>> That means it prefers nodes which are closer to the end of >>> block. >>>>>>>>> What >>>>>>>>> do you think? >>>>>>>>> >>>>>>>> >>>>>>>> Do you actually mean "the SUnit that's added to the queue LAST >>>>>>>> (or >>>>>>>> FIRST) is preferred"? I'll think about it. >>>>>>>> >>>>>>> >>>>>>> >>>>>>> Yep "first". Basically, if all else being equal, let the node >>> that's >>>>>>> ready first be scheduled first. We can add a order id to SUnit >>>>>>> which >>>>>>> gets set when it's pushed into the ready queue. What do you >>>>>>> think? >>>>>>> >>>>>> >>>>>> Makes sense. The queue should have a global "current id" >>>>>> counter. Its >>>>>> current value is assigned to each node being inserted into the >>>>>> ready >>>>>> queue and then incremented. When the node is removed from the >>>>>> queue >>>>>> for any reason, its queue order id is reset. It should be rather >>>>>> easy >>>>>> to implement. >>>>>> >>>>> >>>> >>>> >>>>> >>>>>> BTW, do you really want this queue order id in the SUnit or in a >>>>>> separate array indexed by SUnit unique ids? >>>>>> >>>>> >>>>> >>>>> It should be in SUnit since the sort functions don't have access >>>>> to >>>>> ScheduleDAG members. >>>>> >>>> >>>> Please find and review the attached patch implementing: >>>> - a proper tie-breaker as discussed above. >>>> - and unmodified part for replacing the slow std::priority_queue by >>>> std::set, as it I already did before. >>>> >>>> What do you think? >>>> >>>> -Roman >>>> >>>> >>> >>> >> _______________________________________________ >> 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 romix.llvm at googlemail.com Wed Apr 23 12:27:04 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Wed, 23 Apr 2008 21:27:04 +0400 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> References: <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> Message-ID: Hi, 2008/4/23 Evan Cheng : > Very nice! > Please run it through MultiSource and SingleSource tests. Will do. > Dan and I will run it through External tests. Very nice. > If it shows no regression and llvm- gcc bootstrapping works. Then please check it in. Just to make it clear: This patch is applied currently to the output of Tablegen. But the proper patch will need to change the Tablegen to generate correct *.inc files. Thinking about it, I have a question: Right now, the beginning of the generrated instruction selector files is always the same, independent of the *.td file and target architecture. But it is generated by tablegen still and therefore cannot be substituted easily, without changing the tablegen. Question: May be it is better to define this common part in an include file, e.g. ISelHeader.h, and then tablegen would generate only the #include line. What do you think? -Roman > On Apr 23, 2008, at 12:35 AM, Roman Levenstein wrote: > > > > > > >> In addition to regular testing, since this patch doesn't modify any > >> heuristics, it should be possible to compare assembly output > >> between an unmodified compiler and one with this patch applied. > >> Can you verify that this patch doesn't change any output on some > >> interesting testcases? > > > > I tried it with Kimwitu, which is a very big and complex test-case. > > All approaches produce exactly the same assembler code. On my > > test-cases with very big BBs it also produces exactly the same > > results. > > > > For the sake of comparison, here are also some time statistics for the > > compilation of Kimwitu, measured by means of the Linux "time" command: > > > > Current LLVM approach: > > real 1m51.464s > > user 1m21.161s > > sys 0m8.529s > > > > std::set approach: > > real 1m37.938s (13% faster than current LLVM implementation) > > user 1m16.169s > > sys 0m7.732s > > > > NO_QUEUE approach: > > real 1m29.548s (20% faster than current LLVM implementation) > > user 1m14.949s > > sys 0m7.824s > > > > > > -Roman From romix.llvm at googlemail.com Wed Apr 23 12:32:17 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Wed, 23 Apr 2008 21:32:17 +0400 Subject: [llvm-commits] Fwd: Speeding up instruction selection In-Reply-To: <734B123B-A348-4846-A718-DF9F94D6AB4B@apple.com> References: <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> <2CE4D8B9-C950-493B-B97B-6D25FD90A2C0@apple.com> <734B123B-A348-4846-A718-DF9F94D6AB4B@apple.com> Message-ID: OK. I'll have a look at it. Looking at the error message, it seems to me that it happens with the USE_QUEUE version of the patch. What about the NO_QUEUE version? Does it also fail? Unfortunately, I cannot check it at the moment, because I don't have access to my development machine, but will do tomorrow. -Roman 2008/4/23 Evan Cheng : > Hi Roman, > > Please do more testing on this patch. I am seeing failures: > > /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/burg.llvm.bc -o > Output/burg.llc.s > Assertion failed: (RemovedNum == 1 && "Not in queue!"), function > remove, file ScheduleDAGRRList.cpp, line 1321. > > /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/sqlite3.llvm.bc -o > Output/sqlite3.llc.s > Assertion failed: (RemovedNum == 1 && "Not in queue!"), function > remove, file ScheduleDAGRRList.cpp, line 1321. > > Thanks, > > Evan > > > > On Apr 21, 2008, at 12:44 PM, Evan Cheng wrote: > > > > > On Apr 21, 2008, at 11:54 AM, Roman Levenstein wrote: > > > >> Hi Evan, > >> > >> Good point. This code is here due to the historical reasons ;-) I > >> introduced it when I was experimenting with different alternatives > >> and > >> then forgot to remove it... The commit version will not contain it. > >> > >> Any further comments on this patch? Can I commit it or is it too > >> early? > > > > Please hold off committing for a few days until I have a chance to > > evaluate the performance impact. Thanks. > > > > Evan > > > >> > >> > >> - Roman > >> > >> 2008/4/21, Evan Cheng : > >> > >>> + if (left->NodeQueueId && right->NodeQueueId) > >>> + return (left->NodeQueueId < right->NodeQueueId); > >>> + return left->NodeNum < right->NodeNum; > >>> > >>> Why would NodeQueueId ever be zero? Nodes that are entered into the > >>> queue > >>> must have this field set, no? > >>> > >>> Evan > >>> > >>> > >>> On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > >>> > >>> > >>>> > >>>> Hi Evan, > >>>> > >>>> 2008/4/2, Evan Cheng : > >>>> > >>>>> > >>>>> On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: > >>>>> > >>>>> > >>>>>> 2008/4/2, Evan Cheng : > >>>>>> > >>>>>>> > >>>>>>> On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: > >>>>>>> > >>>>>>> > >>>>>>>> Hi Evan, > >>>>>>>> > >>>>>>>> 2008/4/1, Evan Cheng : > >>>>>>>> > >>>>>>>>> Please hold off checking it in for a bit. llvm tot is having > >>> some > >>>>>>>>> problems and I'd like to get to the bottom of it first. > >>>>>>>>> > >>>>>>>> > >>>>>>>> OK. > >>>>>>>> > >>>>>>>> > >>>>>>>>> Also, the tie breaker is less than ideal. I think we need a > >>>>>>>>> tie- > >>>>>>>>> breaker that is "the SUnit that's added to the queue is > >>> preferred". > >>>>>>>>> That means it prefers nodes which are closer to the end of > >>> block. > >>>>>>>>> What > >>>>>>>>> do you think? > >>>>>>>>> > >>>>>>>> > >>>>>>>> Do you actually mean "the SUnit that's added to the queue LAST > >>>>>>>> (or > >>>>>>>> FIRST) is preferred"? I'll think about it. > >>>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Yep "first". Basically, if all else being equal, let the node > >>> that's > >>>>>>> ready first be scheduled first. We can add a order id to SUnit > >>>>>>> which > >>>>>>> gets set when it's pushed into the ready queue. What do you > >>>>>>> think? > >>>>>>> > >>>>>> > >>>>>> Makes sense. The queue should have a global "current id" > >>>>>> counter. Its > >>>>>> current value is assigned to each node being inserted into the > >>>>>> ready > >>>>>> queue and then incremented. When the node is removed from the > >>>>>> queue > >>>>>> for any reason, its queue order id is reset. It should be rather > >>>>>> easy > >>>>>> to implement. > >>>>>> > >>>>> > >>>> > >>>> > >>>>> > >>>>>> BTW, do you really want this queue order id in the SUnit or in a > >>>>>> separate array indexed by SUnit unique ids? > >>>>>> > >>>>> > >>>>> > >>>>> It should be in SUnit since the sort functions don't have access > >>>>> to > >>>>> ScheduleDAG members. > >>>>> > >>>> > >>>> Please find and review the attached patch implementing: > >>>> - a proper tie-breaker as discussed above. > >>>> - and unmodified part for replacing the slow std::priority_queue by > >>>> std::set, as it I already did before. > >>>> > >>>> What do you think? > >>>> > >>>> -Roman > >>>> > >>>> > >>> > >>> > >> _______________________________________________ > >> 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 romix.llvm at googlemail.com Wed Apr 23 12:38:54 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Wed, 23 Apr 2008 21:38:54 +0400 Subject: [llvm-commits] Fwd: Speeding up instruction selection In-Reply-To: References: <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> <2CE4D8B9-C950-493B-B97B-6D25FD90A2C0@apple.com> <734B123B-A348-4846-A718-DF9F94D6AB4B@apple.com> Message-ID: Oops. You mean a totally different patch, that happen to use std::set as well ;-) May be we should start using different subjects for different "speeding up" patches? This would make understanding of the conversation and following this thread a bit easier ;-) -Roman 2008/4/23 Roman Levenstein : > OK. I'll have a look at it. > > Looking at the error message, it seems to me that it happens with the > USE_QUEUE version of the patch. > What about the NO_QUEUE version? Does it also fail? > > Unfortunately, I cannot check it at the moment, because I don't have > access to my development machine, but will do tomorrow. > > -Roman > > 2008/4/23 Evan Cheng : > > > > Hi Roman, > > > > Please do more testing on this patch. I am seeing failures: > > > > /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/burg.llvm.bc -o > > Output/burg.llc.s > > Assertion failed: (RemovedNum == 1 && "Not in queue!"), function > > remove, file ScheduleDAGRRList.cpp, line 1321. > > > > /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/sqlite3.llvm.bc -o > > Output/sqlite3.llc.s > > Assertion failed: (RemovedNum == 1 && "Not in queue!"), function > > remove, file ScheduleDAGRRList.cpp, line 1321. > > > > Thanks, > > > > Evan > > > > > > > > On Apr 21, 2008, at 12:44 PM, Evan Cheng wrote: > > > > > > > > On Apr 21, 2008, at 11:54 AM, Roman Levenstein wrote: > > > > > >> Hi Evan, > > >> > > >> Good point. This code is here due to the historical reasons ;-) I > > >> introduced it when I was experimenting with different alternatives > > >> and > > >> then forgot to remove it... The commit version will not contain it. > > >> > > >> Any further comments on this patch? Can I commit it or is it too > > >> early? > > > > > > Please hold off committing for a few days until I have a chance to > > > evaluate the performance impact. Thanks. > > > > > > Evan > > > > > >> > > >> > > >> - Roman > > >> > > >> 2008/4/21, Evan Cheng : > > >> > > >>> + if (left->NodeQueueId && right->NodeQueueId) > > >>> + return (left->NodeQueueId < right->NodeQueueId); > > >>> + return left->NodeNum < right->NodeNum; > > >>> > > >>> Why would NodeQueueId ever be zero? Nodes that are entered into the > > >>> queue > > >>> must have this field set, no? > > >>> > > >>> Evan > > >>> > > >>> > > >>> On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > > >>> > > >>> > > >>>> > > >>>> Hi Evan, > > >>>> > > >>>> 2008/4/2, Evan Cheng : > > >>>> > > >>>>> > > >>>>> On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: > > >>>>> > > >>>>> > > >>>>>> 2008/4/2, Evan Cheng : > > >>>>>> > > >>>>>>> > > >>>>>>> On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: > > >>>>>>> > > >>>>>>> > > >>>>>>>> Hi Evan, > > >>>>>>>> > > >>>>>>>> 2008/4/1, Evan Cheng : > > >>>>>>>> > > >>>>>>>>> Please hold off checking it in for a bit. llvm tot is having > > >>> some > > >>>>>>>>> problems and I'd like to get to the bottom of it first. > > >>>>>>>>> > > >>>>>>>> > > >>>>>>>> OK. > > >>>>>>>> > > >>>>>>>> > > >>>>>>>>> Also, the tie breaker is less than ideal. I think we need a > > >>>>>>>>> tie- > > >>>>>>>>> breaker that is "the SUnit that's added to the queue is > > >>> preferred". > > >>>>>>>>> That means it prefers nodes which are closer to the end of > > >>> block. > > >>>>>>>>> What > > >>>>>>>>> do you think? > > >>>>>>>>> > > >>>>>>>> > > >>>>>>>> Do you actually mean "the SUnit that's added to the queue LAST > > >>>>>>>> (or > > >>>>>>>> FIRST) is preferred"? I'll think about it. > > >>>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> Yep "first". Basically, if all else being equal, let the node > > >>> that's > > >>>>>>> ready first be scheduled first. We can add a order id to SUnit > > >>>>>>> which > > >>>>>>> gets set when it's pushed into the ready queue. What do you > > >>>>>>> think? > > >>>>>>> > > >>>>>> > > >>>>>> Makes sense. The queue should have a global "current id" > > >>>>>> counter. Its > > >>>>>> current value is assigned to each node being inserted into the > > >>>>>> ready > > >>>>>> queue and then incremented. When the node is removed from the > > >>>>>> queue > > >>>>>> for any reason, its queue order id is reset. It should be rather > > >>>>>> easy > > >>>>>> to implement. > > >>>>>> > > >>>>> > > >>>> > > >>>> > > >>>>> > > >>>>>> BTW, do you really want this queue order id in the SUnit or in a > > >>>>>> separate array indexed by SUnit unique ids? > > >>>>>> > > >>>>> > > >>>>> > > >>>>> It should be in SUnit since the sort functions don't have access > > >>>>> to > > >>>>> ScheduleDAG members. > > >>>>> > > >>>> > > >>>> Please find and review the attached patch implementing: > > >>>> - a proper tie-breaker as discussed above. > > >>>> - and unmodified part for replacing the slow std::priority_queue by > > >>>> std::set, as it I already did before. > > >>>> > > >>>> What do you think? > > >>>> > > >>>> -Roman > > >>>> > > >>>> > > >>> > > >>> > > >> _______________________________________________ > > >> 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 gohman at apple.com Wed Apr 23 12:50:16 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 17:50:16 -0000 Subject: [llvm-commits] [llvm] r50151 - /llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200804231750.m3NHoGxf028274@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 12:50:15 2008 New Revision: 50151 URL: http://llvm.org/viewvc/llvm-project?rev=50151&view=rev Log: Fix some whitespace. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=50151&r1=50150&r2=50151&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Apr 23 12:50:15 2008 @@ -330,9 +330,9 @@ const Value *SrcSV, uint64_t SrcOff); SDOperand getMemmove(SDOperand Chain, SDOperand Dst, SDOperand Src, - SDOperand Size, unsigned Align, - const Value *DstSV, uint64_t DstOff, - const Value *SrcSV, uint64_t SrcOff); + SDOperand Size, unsigned Align, + const Value *DstSV, uint64_t DstOff, + const Value *SrcSV, uint64_t SrcOff); SDOperand getMemset(SDOperand Chain, SDOperand Dst, SDOperand Src, SDOperand Size, unsigned Align, From asl at math.spbu.ru Wed Apr 23 13:15:11 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:15:11 -0000 Subject: [llvm-commits] [llvm] r50152 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231815.m3NIFBii028976@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:15:11 2008 New Revision: 50152 URL: http://llvm.org/viewvc/llvm-project?rev=50152&view=rev Log: Whitespace cleanup Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50152&r1=50151&r2=50152&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:15:11 2008 @@ -257,7 +257,7 @@ MachineFrameInfo *MFI = MF.getFrameInfo(); MachineModuleInfo *MMI = MFI->getMachineModuleInfo(); - return (NoFramePointerElim || + return (NoFramePointerElim || MFI->hasVarSizedObjects() || MF.getInfo()->getForceFramePointer() || (MMI && MMI->callsUnwindInit())); @@ -350,7 +350,7 @@ int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; } - + MI.getOperand(i+3).ChangeToImmediate(Offset); } @@ -413,7 +413,7 @@ void mergeSPUpdatesUp(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes = NULL) { if (MBBI == MBB.begin()) return; - + MachineBasicBlock::iterator PI = prior(MBBI); unsigned Opc = PI->getOpcode(); if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 || @@ -437,12 +437,12 @@ MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes = NULL) { return; - + if (MBBI == MBB.end()) return; - + MachineBasicBlock::iterator NI = next(MBBI); if (NI == MBB.end()) return; - + unsigned Opc = NI->getOpcode(); if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 || Opc == X86::ADD32ri || Opc == X86::ADD32ri8) && @@ -462,12 +462,12 @@ } /// mergeSPUpdates - Checks the instruction before/after the passed -/// instruction. If it is an ADD/SUB instruction it is deleted +/// instruction. If it is an ADD/SUB instruction it is deleted /// argument and the stack adjustment is returned as a positive value for ADD -/// and a negative for SUB. +/// and a negative for SUB. static int mergeSPUpdates(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, - unsigned StackPtr, + unsigned StackPtr, bool doMergeWithPrevious) { if ((doMergeWithPrevious && MBBI == MBB.begin()) || @@ -491,7 +491,7 @@ Offset -= PI->getOperand(2).getImm(); MBB.erase(PI); if (!doMergeWithPrevious) MBBI = NI; - } + } return Offset; } @@ -504,18 +504,17 @@ MachineModuleInfo *MMI = MFI->getMachineModuleInfo(); X86MachineFunctionInfo *X86FI = MF.getInfo(); MachineBasicBlock::iterator MBBI = MBB.begin(); - bool needsFrameMoves = (MMI && MMI->hasDebugInfo()) || + bool needsFrameMoves = (MMI && MMI->hasDebugInfo()) || !Fn->doesNotThrow() || UnwindTablesMandatory; - // Prepare for frame info. unsigned FrameLabelId = 0; - + // Get the number of bytes to allocate from the FrameInfo. uint64_t StackSize = MFI->getStackSize(); // Add RETADDR move area to callee saved frame size. int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); - if (TailCallReturnAddrDelta < 0) + if (TailCallReturnAddrDelta < 0) X86FI->setCalleeSavedFrameSize( X86FI->getCalleeSavedFrameSize() +(-TailCallReturnAddrDelta)); uint64_t NumBytes = StackSize - X86FI->getCalleeSavedFrameSize(); @@ -524,7 +523,7 @@ // applies to tail call optimized functions where the callee argument stack // size is bigger than the callers. if (TailCallReturnAddrDelta < 0) { - BuildMI(MBB, MBBI, TII.get(Is64Bit? X86::SUB64ri32 : X86::SUB32ri), + BuildMI(MBB, MBBI, TII.get(Is64Bit? X86::SUB64ri32 : X86::SUB32ri), StackPtr).addReg(StackPtr).addImm(-TailCallReturnAddrDelta); } @@ -549,7 +548,7 @@ BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr), FramePtr) .addReg(StackPtr); } - + unsigned ReadyLabelId = 0; if (needsFrameMoves) { // Mark effective beginning of when frame pointer is ready. @@ -575,8 +574,8 @@ Reg == X86::AH || Reg == X86::AL); } - // Function prologue calls _alloca to probe the stack when allocating - // more than 4k bytes in one go. Touching the stack at 4K increments is + // Function prologue calls _alloca to probe the stack when allocating + // more than 4k bytes in one go. Touching the stack at 4K increments is // necessary to ensure that the guard pages used by the OS virtual memory // manager are allocated in correct sequence. if (!isEAXAlive) { @@ -604,7 +603,7 @@ // If there is an ADD32ri or SUB32ri of ESP immediately after this // instruction, merge the two instructions. mergeSPUpdatesDown(MBB, MBBI, StackPtr, &NumBytes); - + if (NumBytes) emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII); } @@ -639,13 +638,13 @@ MachineLocation SPSrc(StackPtr, stackGrowth); Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); } - + // Add callee saved registers to move list. const std::vector &CSI = MFI->getCalleeSavedInfo(); // FIXME: This is dirty hack. The code itself is pretty mess right now. // It should be rewritten from scratch and generalized sometimes. - + // Determine maximum offset (minumum due to stack growth) int64_t MaxOffset = 0; for (unsigned I = 0, E = CSI.size(); I!=E; ++I) @@ -662,14 +661,14 @@ MachineLocation CSSrc(Reg); Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc)); } - + if (hasFP(MF)) { // Save FP MachineLocation FPDst(MachineLocation::VirtualFP, 2*stackGrowth); MachineLocation FPSrc(FramePtr); Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc)); } - + MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr); MachineLocation FPSrc(MachineLocation::VirtualFP); Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc)); @@ -766,7 +765,7 @@ MachineOperand &DestAddr = MBBI->getOperand(0); assert(DestAddr.isRegister() && "Offset should be in register!"); BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr),StackPtr). - addReg(DestAddr.getReg()); + addReg(DestAddr.getReg()); // Tail call return: adjust the stack pointer and jump to callee } else if (RetOpcode == X86::TCRETURNri || RetOpcode == X86::TCRETURNdi || RetOpcode== X86::TCRETURNri64 || RetOpcode == X86::TCRETURNdi64) { @@ -774,7 +773,7 @@ MachineOperand &JumpTarget = MBBI->getOperand(0); MachineOperand &StackAdjust = MBBI->getOperand(1); assert( StackAdjust.isImmediate() && "Expecting immediate value."); - + // Adjust stack pointer. int StackAdj = StackAdjust.getImm(); int MaxTCDelta = X86FI->getTCReturnAddrDelta(); @@ -787,7 +786,7 @@ // Check for possible merge with preceeding ADD instruction. Offset += mergeSPUpdates(MBB, MBBI, StackPtr, true); emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, TII); - } + } // Jump to label or value in register. if (RetOpcode == X86::TCRETURNdi|| RetOpcode == X86::TCRETURNdi64) BuildMI(MBB, MBBI, TII.get(X86::TAILJMPd)). @@ -798,7 +797,7 @@ BuildMI(MBB, MBBI, TII.get(X86::TAILJMPr), JumpTarget.getReg()); // Delete the pseudo instruction TCRETURN. MBB.erase(MBBI); - } else if ((RetOpcode == X86::RET || RetOpcode == X86::RETI) && + } else if ((RetOpcode == X86::RET || RetOpcode == X86::RETI) && (X86FI->getTCReturnAddrDelta() < 0)) { // Add the return addr area delta back since we are not tail calling. int delta = -1*X86FI->getTCReturnAddrDelta(); @@ -1029,4 +1028,3 @@ } #include "X86GenRegisterInfo.inc" - From asl at math.spbu.ru Wed Apr 23 13:15:48 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:15:48 -0000 Subject: [llvm-commits] [llvm] r50153 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h Message-ID: <200804231815.m3NIFnME029003@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:15:48 2008 New Revision: 50153 URL: http://llvm.org/viewvc/llvm-project?rev=50153&view=rev Log: Provide convenient helpers for some operations Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50153&r1=50152&r2=50153&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:15:48 2008 @@ -258,11 +258,18 @@ MachineModuleInfo *MMI = MFI->getMachineModuleInfo(); return (NoFramePointerElim || + needsStackRealignment(MF) || MFI->hasVarSizedObjects() || MF.getInfo()->getForceFramePointer() || (MMI && MMI->callsUnwindInit())); } +bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const { + MachineFrameInfo *MFI = MF.getFrameInfo();; + + return (MFI->getMaxAlignment() > StackAlign); +} + bool X86RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { return !MF.getFrameInfo()->hasVarSizedObjects(); } @@ -496,6 +503,80 @@ return Offset; } +void X86RegisterInfo::emitFrameMoves(MachineFunction &MF, + unsigned FrameLabelId, + unsigned ReadyLabelId) const { + MachineFrameInfo *MFI = MF.getFrameInfo(); + MachineModuleInfo *MMI = MFI->getMachineModuleInfo(); + if (!MMI) + return; + + uint64_t StackSize = MFI->getStackSize(); + std::vector &Moves = MMI->getFrameMoves(); + const TargetData *TD = MF.getTarget().getTargetData(); + + // Calculate amount of bytes used for return address storing + int stackGrowth = + (MF.getTarget().getFrameInfo()->getStackGrowthDirection() == + TargetFrameInfo::StackGrowsUp ? + TD->getPointerSize() : -TD->getPointerSize()); + + if (StackSize) { + // Show update of SP. + if (hasFP(MF)) { + // Adjust SP + MachineLocation SPDst(MachineLocation::VirtualFP); + MachineLocation SPSrc(MachineLocation::VirtualFP, 2*stackGrowth); + Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); + } else { + MachineLocation SPDst(MachineLocation::VirtualFP); + MachineLocation SPSrc(MachineLocation::VirtualFP, + -StackSize+stackGrowth); + Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); + } + } else { + //FIXME: Verify & implement for FP + MachineLocation SPDst(StackPtr); + MachineLocation SPSrc(StackPtr, stackGrowth); + Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); + } + + // Add callee saved registers to move list. + const std::vector &CSI = MFI->getCalleeSavedInfo(); + + // FIXME: This is dirty hack. The code itself is pretty mess right now. + // It should be rewritten from scratch and generalized sometimes. + + // Determine maximum offset (minumum due to stack growth) + int64_t MaxOffset = 0; + for (unsigned I = 0, E = CSI.size(); I!=E; ++I) + MaxOffset = std::min(MaxOffset, + MFI->getObjectOffset(CSI[I].getFrameIdx())); + + // Calculate offsets + int64_t saveAreaOffset = (hasFP(MF) ? 3 : 2)*stackGrowth; + for (unsigned I = 0, E = CSI.size(); I!=E; ++I) { + int64_t Offset = MFI->getObjectOffset(CSI[I].getFrameIdx()); + unsigned Reg = CSI[I].getReg(); + Offset = (MaxOffset-Offset+saveAreaOffset); + MachineLocation CSDst(MachineLocation::VirtualFP, Offset); + MachineLocation CSSrc(Reg); + Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc)); + } + + if (hasFP(MF)) { + // Save FP + MachineLocation FPDst(MachineLocation::VirtualFP, 2*stackGrowth); + MachineLocation FPSrc(FramePtr); + Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc)); + } + + MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr); + MachineLocation FPSrc(MachineLocation::VirtualFP); + Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc)); +} + + void X86RegisterInfo::emitPrologue(MachineFunction &MF) const { MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB MachineFrameInfo *MFI = MF.getFrameInfo(); @@ -609,70 +690,8 @@ } } - if (needsFrameMoves) { - std::vector &Moves = MMI->getFrameMoves(); - const TargetData *TD = MF.getTarget().getTargetData(); - - // Calculate amount of bytes used for return address storing - int stackGrowth = - (MF.getTarget().getFrameInfo()->getStackGrowthDirection() == - TargetFrameInfo::StackGrowsUp ? - TD->getPointerSize() : -TD->getPointerSize()); - - if (StackSize) { - // Show update of SP. - if (hasFP(MF)) { - // Adjust SP - MachineLocation SPDst(MachineLocation::VirtualFP); - MachineLocation SPSrc(MachineLocation::VirtualFP, 2*stackGrowth); - Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); - } else { - MachineLocation SPDst(MachineLocation::VirtualFP); - MachineLocation SPSrc(MachineLocation::VirtualFP, - -StackSize+stackGrowth); - Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); - } - } else { - //FIXME: Verify & implement for FP - MachineLocation SPDst(StackPtr); - MachineLocation SPSrc(StackPtr, stackGrowth); - Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc)); - } - - // Add callee saved registers to move list. - const std::vector &CSI = MFI->getCalleeSavedInfo(); - - // FIXME: This is dirty hack. The code itself is pretty mess right now. - // It should be rewritten from scratch and generalized sometimes. - - // Determine maximum offset (minumum due to stack growth) - int64_t MaxOffset = 0; - for (unsigned I = 0, E = CSI.size(); I!=E; ++I) - MaxOffset = std::min(MaxOffset, - MFI->getObjectOffset(CSI[I].getFrameIdx())); - - // Calculate offsets - int64_t saveAreaOffset = (hasFP(MF) ? 3 : 2)*stackGrowth; - for (unsigned I = 0, E = CSI.size(); I!=E; ++I) { - int64_t Offset = MFI->getObjectOffset(CSI[I].getFrameIdx()); - unsigned Reg = CSI[I].getReg(); - Offset = (MaxOffset-Offset+saveAreaOffset); - MachineLocation CSDst(MachineLocation::VirtualFP, Offset); - MachineLocation CSSrc(Reg); - Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc)); - } - - if (hasFP(MF)) { - // Save FP - MachineLocation FPDst(MachineLocation::VirtualFP, 2*stackGrowth); - MachineLocation FPSrc(FramePtr); - Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc)); - } - - MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr); - MachineLocation FPSrc(MachineLocation::VirtualFP); - Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc)); - } + if (needsFrameMoves) + emitFrameMoves(MF, FrameLabelId, ReadyLabelId); // If it's main() on Cygwin\Mingw32 we should align stack as well if (Fn->hasExternalLinkage() && Fn->getName() == "main" && Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=50153&r1=50152&r2=50153&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Wed Apr 23 13:15:48 2008 @@ -115,6 +115,8 @@ bool hasFP(const MachineFunction &MF) const; + bool needsStackRealignment(const MachineFunction &MF) const; + bool hasReservedCallFrame(MachineFunction &MF) const; void eliminateCallFramePseudoInstr(MachineFunction &MF, @@ -129,6 +131,9 @@ void emitPrologue(MachineFunction &MF) const; void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; + void emitFrameMoves(MachineFunction &MF, + unsigned FrameLabelId, unsigned ReadyLabelId) const; + // Debug information queries. unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; From asl at math.spbu.ru Wed Apr 23 13:16:16 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:16:16 -0000 Subject: [llvm-commits] [llvm] r50154 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp Message-ID: <200804231816.m3NIGGDu029028@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:16:16 2008 New Revision: 50154 URL: http://llvm.org/viewvc/llvm-project?rev=50154&view=rev Log: Provide ABI-correct stack alignment Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=50154&r1=50153&r2=50154&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Wed Apr 23 13:16:16 2008 @@ -315,11 +315,9 @@ ? X86Subtarget::Intel : X86Subtarget::ATT; } - if (TargetType == isDarwin || - TargetType == isCygwin || - TargetType == isMingw || - TargetType == isWindows || - (TargetType == isELF && Is64Bit)) + // Stack alignment is 16 bytes on Darwin (both 32 and 64 bit) and for all 64 + // bit targets. + if (TargetType == isDarwin || Is64Bit) stackAlignment = 16; if (StackAlignment) From asl at math.spbu.ru Wed Apr 23 13:16:43 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:16:43 -0000 Subject: [llvm-commits] [llvm] r50155 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231816.m3NIGhQM029052@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:16:43 2008 New Revision: 50155 URL: http://llvm.org/viewvc/llvm-project?rev=50155&view=rev Log: Disable stack realignment for functions with dynamic-sized alloca's Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50155&r1=50154&r2=50155&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:16:43 2008 @@ -267,7 +267,10 @@ bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const { MachineFrameInfo *MFI = MF.getFrameInfo();; - return (MFI->getMaxAlignment() > StackAlign); + // FIXME: Currently we don't support stack realignment for functions with + // variable-sized allocas + return (MFI->getMaxAlignment() > StackAlign && + !MFI->hasVarSizedObjects()); } bool X86RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { From asl at math.spbu.ru Wed Apr 23 13:17:11 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:17:11 -0000 Subject: [llvm-commits] [llvm] r50156 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231817.m3NIHBhN029078@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:17:11 2008 New Revision: 50156 URL: http://llvm.org/viewvc/llvm-project?rev=50156&view=rev Log: Provide option for enabling-disabling stack realignment Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50156&r1=50155&r2=50156&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:17:11 2008 @@ -29,6 +29,7 @@ #include "llvm/CodeGen/MachineLocation.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" @@ -38,6 +39,10 @@ #include "llvm/ADT/STLExtras.h" using namespace llvm; +static cl::opt +RealignStack("realign-stack", cl::init(true), + cl::desc("Realign stack if needed")); + X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii) : X86GenRegisterInfo(X86::ADJCALLSTACKDOWN, X86::ADJCALLSTACKUP), @@ -269,8 +274,9 @@ // FIXME: Currently we don't support stack realignment for functions with // variable-sized allocas - return (MFI->getMaxAlignment() > StackAlign && - !MFI->hasVarSizedObjects()); + return (RealignStack && + (MFI->getMaxAlignment() > StackAlign && + !MFI->hasVarSizedObjects())); } bool X86RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { From asl at math.spbu.ru Wed Apr 23 13:18:10 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:18:10 -0000 Subject: [llvm-commits] [llvm] r50157 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/Target/TargetMachine.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Target/X86/X86Subtarget.cpp Message-ID: <200804231818.m3NIIBJW029120@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:18:10 2008 New Revision: 50157 URL: http://llvm.org/viewvc/llvm-project?rev=50157&view=rev Log: Make stack alignment options global for all targets Modified: llvm/trunk/include/llvm/Target/TargetOptions.h llvm/trunk/lib/Target/TargetMachine.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/include/llvm/Target/TargetOptions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=50157&r1=50156&r2=50157&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) +++ llvm/trunk/include/llvm/Target/TargetOptions.h Wed Apr 23 13:18:10 2008 @@ -86,6 +86,13 @@ /// OptimizeForSize - When this flag is set, the code generator avoids /// optimizations that increase size. extern bool OptimizeForSize; + + /// StackAlignment - Override default stack alignment for target. + extern unsigned StackAlignment; + + /// RealignStack - This flag indicates, whether stack should be automatically + /// realigned, if needed. + extern bool RealignStack; } // End llvm namespace #endif Modified: llvm/trunk/lib/Target/TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=50157&r1=50156&r2=50157&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/TargetMachine.cpp Wed Apr 23 13:18:10 2008 @@ -36,6 +36,8 @@ CodeModel::Model CMModel; bool PerformTailCallOpt; bool OptimizeForSize; + bool RealignStack; + unsigned StackAlignment; } namespace { cl::opt PrintCode("print-machineinstrs", @@ -135,6 +137,18 @@ cl::desc("Optimize for size."), cl::location(OptimizeForSize), cl::init(false)); + + cl::opt + EnableRealignStack("realign-stack", + cl::desc("Realign stack if needed"), + cl::location(RealignStack), + cl::init(true)); + + cl::opt + OverrideStackAlignment("stack-alignment", + cl::desc("Override default stack alignment"), + cl::location(StackAlignment), + cl::init(0)); } //--------------------------------------------------------------------------- Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50157&r1=50156&r2=50157&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:18:10 2008 @@ -29,7 +29,6 @@ #include "llvm/CodeGen/MachineLocation.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" @@ -39,10 +38,6 @@ #include "llvm/ADT/STLExtras.h" using namespace llvm; -static cl::opt -RealignStack("realign-stack", cl::init(true), - cl::desc("Realign stack if needed")); - X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii) : X86GenRegisterInfo(X86::ADJCALLSTACKDOWN, X86::ADJCALLSTACKUP), Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=50157&r1=50156&r2=50157&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Wed Apr 23 13:18:10 2008 @@ -16,6 +16,7 @@ #include "llvm/Module.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetOptions.h" using namespace llvm; cl::opt @@ -26,10 +27,6 @@ clEnumValN(X86Subtarget::Intel, "intel", " Emit Intel-style assembly"), clEnumValEnd)); -cl::opt -StackAlignment("stack-alignment", cl::init(0), - cl::desc("Override default stack alignment")); - /// True if accessing the GV requires an extra load. For Windows, dllimported /// symbols are indirect, loading the value at address GV rather then the From asl at math.spbu.ru Wed Apr 23 13:18:36 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:18:36 -0000 Subject: [llvm-commits] [llvm] r50158 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231818.m3NIIalV029142@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:18:36 2008 New Revision: 50158 URL: http://llvm.org/viewvc/llvm-project?rev=50158&view=rev Log: Simplify Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50158&r1=50157&r2=50158&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:18:36 2008 @@ -278,6 +278,20 @@ return !MF.getFrameInfo()->hasVarSizedObjects(); } +int +X86RegisterInfo::getFrameIndexOffset(MachineFunction &MF, int FI) const { + int Offset = MF.getFrameInfo()->getObjectOffset(FI) + SlotSize; + if (!hasFP(MF)) + return Offset + MF.getFrameInfo()->getStackSize(); + + Offset += SlotSize; // Skip the saved EBP + // Skip the RETADDR move area + X86MachineFunctionInfo *X86FI = MF.getInfo(); + int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); + if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; + return Offset; +} + void X86RegisterInfo:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { @@ -349,18 +363,8 @@ MI.getOperand(i).ChangeToRegister(hasFP(MF) ? FramePtr : StackPtr, false); // Now add the frame object offset to the offset from EBP. - int64_t Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) + - MI.getOperand(i+3).getImm()+SlotSize; - - if (!hasFP(MF)) - Offset += MF.getFrameInfo()->getStackSize(); - else { - Offset += SlotSize; // Skip the saved EBP - // Skip the RETADDR move area - X86MachineFunctionInfo *X86FI = MF.getInfo(); - int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); - if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; - } + int64_t Offset = getFrameIndexOffset(MF, FrameIndex) + + MI.getOperand(i+3).getImm(); MI.getOperand(i+3).ChangeToImmediate(Offset); } @@ -842,20 +846,6 @@ return hasFP(MF) ? FramePtr : StackPtr; } -int -X86RegisterInfo::getFrameIndexOffset(MachineFunction &MF, int FI) const { - int Offset = MF.getFrameInfo()->getObjectOffset(FI) + SlotSize; - if (!hasFP(MF)) - return Offset + MF.getFrameInfo()->getStackSize(); - - Offset += SlotSize; // Skip the saved EBP - // Skip the RETADDR move area - X86MachineFunctionInfo *X86FI = MF.getInfo(); - int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); - if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; - return Offset; -} - void X86RegisterInfo::getInitialFrameState(std::vector &Moves) const { // Calculate amount of bytes used for return address storing From asl at math.spbu.ru Wed Apr 23 13:19:23 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:19:23 -0000 Subject: [llvm-commits] [llvm] r50159 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231819.m3NIJNk1029185@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:19:23 2008 New Revision: 50159 URL: http://llvm.org/viewvc/llvm-project?rev=50159&view=rev Log: Cleanup Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50159&r1=50158&r2=50159&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:19:23 2008 @@ -284,7 +284,9 @@ if (!hasFP(MF)) return Offset + MF.getFrameInfo()->getStackSize(); - Offset += SlotSize; // Skip the saved EBP + // Skip the saved EBP + Offset += SlotSize; + // Skip the RETADDR move area X86MachineFunctionInfo *X86FI = MF.getInfo(); int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); From asl at math.spbu.ru Wed Apr 23 13:20:17 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:20:17 -0000 Subject: [llvm-commits] [llvm] r50161 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h Message-ID: <200804231820.m3NIKHBh029244@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:20:17 2008 New Revision: 50161 URL: http://llvm.org/viewvc/llvm-project?rev=50161&view=rev Log: Eastimate required stack alignment early, so we can decide, whether we will need frame pointer or not Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50161&r1=50160&r2=50161&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:20:17 2008 @@ -372,6 +372,25 @@ } void +X86RegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF, + RegScavenger *RS) const { + MachineFrameInfo *FFI = MF.getFrameInfo(); + + // Calculate and set max stack object alignment early, so we can decide + // whether we will need stack realignment (and thus FP). + unsigned MaxAlign = 0; + for (int i = FFI->getObjectIndexBegin(), + e = FFI->getObjectIndexEnd(); i != e; ++i) { + if (FFI->isDeadObjectIndex(i)) + continue; + unsigned Align = FFI->getObjectAlignment(i); + MaxAlign = std::max(MaxAlign, Align); + } + + FFI->setMaxAlignment(MaxAlign); +} + +void X86RegisterInfo::processFunctionBeforeFrameFinalized(MachineFunction &MF) const{ X86MachineFunctionInfo *X86FI = MF.getInfo(); int32_t TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=50161&r1=50160&r2=50161&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Wed Apr 23 13:20:17 2008 @@ -127,6 +127,8 @@ int SPAdj, RegScavenger *RS = NULL) const; void processFunctionBeforeFrameFinalized(MachineFunction &MF) const; + void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, + RegScavenger *RS = NULL) const; void emitPrologue(MachineFunction &MF) const; void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; From asl at math.spbu.ru Wed Apr 23 13:19:47 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:19:47 -0000 Subject: [llvm-commits] [llvm] r50160 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200804231819.m3NIJmJe029209@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:19:47 2008 New Revision: 50160 URL: http://llvm.org/viewvc/llvm-project?rev=50160&view=rev Log: Cleanup Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=50160&r1=50159&r2=50160&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Wed Apr 23 13:19:47 2008 @@ -68,7 +68,7 @@ // Allow the target machine to make final modifications to the function // before the frame layout is finalized. - Fn.getTarget().getRegisterInfo()->processFunctionBeforeFrameFinalized(Fn); + TRI->processFunctionBeforeFrameFinalized(Fn); // Calculate actual frame offsets for all of the abstract stack objects... calculateFrameObjectOffsets(Fn); @@ -484,14 +484,16 @@ /// prolog and epilog code to the function. /// void PEI::insertPrologEpilogCode(MachineFunction &Fn) { + const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo(); + // Add prologue to the function... - Fn.getTarget().getRegisterInfo()->emitPrologue(Fn); + TRI->emitPrologue(Fn); // Add epilogue to restore the callee-save registers in each exiting block for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) { // If last instruction is a return instruction, add an epilogue if (!I->empty() && I->back().getDesc().isReturn()) - Fn.getTarget().getRegisterInfo()->emitEpilogue(Fn, *I); + TRI->emitEpilogue(Fn, *I); } } From asl at math.spbu.ru Wed Apr 23 13:21:27 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:21:27 -0000 Subject: [llvm-commits] [llvm] r50163 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231821.m3NILRa2029299@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:21:27 2008 New Revision: 50163 URL: http://llvm.org/viewvc/llvm-project?rev=50163&view=rev Log: Do proper book-keeping of offsets and prologue/epilogue code for stack realignment Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50163&r1=50162&r2=50163&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:21:27 2008 @@ -249,6 +249,19 @@ // Stack Frame Processing methods //===----------------------------------------------------------------------===// +static unsigned calculateMaxStackAlignment(const MachineFrameInfo *FFI) { + unsigned MaxAlign = 0; + for (int i = FFI->getObjectIndexBegin(), + e = FFI->getObjectIndexEnd(); i != e; ++i) { + if (FFI->isDeadObjectIndex(i)) + continue; + unsigned Align = FFI->getObjectAlignment(i); + MaxAlign = std::max(MaxAlign, Align); + } + + return MaxAlign; +} + // hasFP - Return true if the specified function should have a dedicated frame // pointer register. This is true if the function has variable sized allocas or // if frame pointer elimination is disabled. @@ -267,10 +280,16 @@ bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const { MachineFrameInfo *MFI = MF.getFrameInfo();; + // FIXME: This is really really ugly, but it seems we need to decide, whether + // we will need stack realignment or not too early (during RA stage). + unsigned MaxAlign = MFI->getMaxAlignment(); + if (!MaxAlign) + MaxAlign = calculateMaxStackAlignment(MFI); + // FIXME: Currently we don't support stack realignment for functions with // variable-sized allocas return (RealignStack && - (MFI->getMaxAlignment() > StackAlign && + (MaxAlign > StackAlign && !MFI->hasVarSizedObjects())); } @@ -281,18 +300,24 @@ int X86RegisterInfo::getFrameIndexOffset(MachineFunction &MF, int FI) const { int Offset = MF.getFrameInfo()->getObjectOffset(FI) + SlotSize; + uint64_t StackSize = MF.getFrameInfo()->getStackSize(); if (needsStackRealignment(MF)) { if (FI < 0) // Skip the saved EBP Offset += SlotSize; - else - return Offset + MF.getFrameInfo()->getStackSize(); + else { + unsigned MaxAlign = MF.getFrameInfo()->getMaxAlignment(); + uint64_t FrameSize = + (StackSize - SlotSize + MaxAlign - 1)/MaxAlign*MaxAlign; + + return Offset + FrameSize - SlotSize; + } // FIXME: Support tail calls } else { if (!hasFP(MF)) - return Offset + MF.getFrameInfo()->getStackSize(); + return Offset + StackSize; // Skip the saved EBP Offset += SlotSize; @@ -397,14 +422,7 @@ // Calculate and set max stack object alignment early, so we can decide // whether we will need stack realignment (and thus FP). - unsigned MaxAlign = 0; - for (int i = FFI->getObjectIndexBegin(), - e = FFI->getObjectIndexEnd(); i != e; ++i) { - if (FFI->isDeadObjectIndex(i)) - continue; - unsigned Align = FFI->getObjectAlignment(i); - MaxAlign = std::max(MaxAlign, Align); - } + unsigned MaxAlign = calculateMaxStackAlignment(FFI); FFI->setMaxAlignment(MaxAlign); } @@ -641,12 +659,14 @@ // Get the number of bytes to allocate from the FrameInfo. uint64_t StackSize = MFI->getStackSize(); + // Get desired stack alignment + uint64_t MaxAlign = MFI->getMaxAlignment(); + // Add RETADDR move area to callee saved frame size. int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); if (TailCallReturnAddrDelta < 0) X86FI->setCalleeSavedFrameSize( X86FI->getCalleeSavedFrameSize() +(-TailCallReturnAddrDelta)); - uint64_t NumBytes = StackSize - X86FI->getCalleeSavedFrameSize(); // Insert stack pointer adjustment for later moving of return addr. Only // applies to tail call optimized functions where the callee argument stack @@ -656,16 +676,23 @@ StackPtr).addReg(StackPtr).addImm(-TailCallReturnAddrDelta); } + uint64_t NumBytes = 0; if (hasFP(MF)) { + // Calculate required stack adjustment + uint64_t FrameSize = StackSize - SlotSize; + if (needsStackRealignment(MF)) + FrameSize = (FrameSize + MaxAlign - 1)/MaxAlign*MaxAlign; + + NumBytes = FrameSize - X86FI->getCalleeSavedFrameSize(); + // Get the offset of the stack slot for the EBP register... which is // guaranteed to be the last slot by processFunctionBeforeFrameFinalized. // Update the frame offset adjustment. - MFI->setOffsetAdjustment(SlotSize-NumBytes); + MFI->setOffsetAdjustment(-NumBytes); // Save EBP into the appropriate stack slot... BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::PUSH64r : X86::PUSH32r)) .addReg(FramePtr); - NumBytes -= SlotSize; if (needsFrameMoves) { // Mark effective beginning of when frame pointer becomes valid. @@ -676,7 +703,14 @@ // Update EBP with the new base value... BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr), FramePtr) .addReg(StackPtr); - } + + // Realign stack + if (needsStackRealignment(MF)) + BuildMI(MBB, MBBI, + TII.get(Is64Bit ? X86::AND64ri32 : X86::AND32ri), + StackPtr).addReg(StackPtr).addImm(-MaxAlign); + } else + NumBytes = StackSize - X86FI->getCalleeSavedFrameSize(); unsigned ReadyLabelId = 0; if (needsFrameMoves) { @@ -740,25 +774,12 @@ if (needsFrameMoves) emitFrameMoves(MF, FrameLabelId, ReadyLabelId); - - // If it's main() on Cygwin\Mingw32 we should align stack as well - if (Fn->hasExternalLinkage() && Fn->getName() == "main" && - Subtarget->isTargetCygMing()) { - BuildMI(MBB, MBBI, TII.get(X86::AND32ri), X86::ESP) - .addReg(X86::ESP).addImm(-StackAlign); - - // Probe the stack - BuildMI(MBB, MBBI, TII.get(X86::MOV32ri), X86::EAX).addImm(StackAlign); - BuildMI(MBB, MBBI, TII.get(X86::CALLpcrel32)).addExternalSymbol("_alloca"); - } } void X86RegisterInfo::emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { const MachineFrameInfo *MFI = MF.getFrameInfo(); - const Function* Fn = MF.getFunction(); X86MachineFunctionInfo *X86FI = MF.getInfo(); - const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget(); MachineBasicBlock::iterator MBBI = prior(MBB.end()); unsigned RetOpcode = MBBI->getOpcode(); @@ -779,16 +800,25 @@ // Get the number of bytes to allocate from the FrameInfo uint64_t StackSize = MFI->getStackSize(); + uint64_t MaxAlign = MFI->getMaxAlignment(); unsigned CSSize = X86FI->getCalleeSavedFrameSize(); - uint64_t NumBytes = StackSize - CSSize; + uint64_t NumBytes = 0; if (hasFP(MF)) { + // Calculate required stack adjustment + uint64_t FrameSize = StackSize - SlotSize; + if (needsStackRealignment(MF)) + FrameSize = (FrameSize + MaxAlign - 1)/MaxAlign*MaxAlign; + + NumBytes = FrameSize - CSSize; + // pop EBP. BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::POP64r : X86::POP32r), FramePtr); - NumBytes -= SlotSize; - } + } else + NumBytes = StackSize - CSSize; // Skip the callee-saved pop instructions. + MachineBasicBlock::iterator LastCSPop = MBBI; while (MBBI != MBB.begin()) { MachineBasicBlock::iterator PI = prior(MBBI); unsigned Opc = PI->getOpcode(); @@ -804,14 +834,22 @@ mergeSPUpdatesUp(MBB, MBBI, StackPtr, &NumBytes); // If dynamic alloca is used, then reset esp to point to the last callee-saved - // slot before popping them off! Also, if it's main() on Cygwin/Mingw32 we - // aligned stack in the prologue, - revert stack changes back. Note: we're - // assuming, that frame pointer was forced for main() - if (MFI->hasVarSizedObjects() || - (Fn->hasExternalLinkage() && Fn->getName() == "main" && - Subtarget->isTargetCygMing())) { - unsigned Opc = Is64Bit ? X86::LEA64r : X86::LEA32r; + // slot before popping them off! Same applies for the case, when stack was + // realigned + if (needsStackRealignment(MF)) { + // We cannot use LEA here, because stack pointer was realigned. We need to + // deallocate local frame back + if (CSSize) { + emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, TII); + MBBI = prior(LastCSPop); + } + + BuildMI(MBB, MBBI, + TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr), + StackPtr).addReg(FramePtr); + } else if (MFI->hasVarSizedObjects()) { if (CSSize) { + unsigned Opc = Is64Bit ? X86::LEA64r : X86::LEA32r; MachineInstr *MI = addRegOffset(BuildMI(TII.get(Opc), StackPtr), FramePtr, -CSSize); MBB.insert(MBBI, MI); @@ -819,13 +857,12 @@ BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr),StackPtr). addReg(FramePtr); - NumBytes = 0; + } else { + // adjust stack pointer back: ESP += numbytes + if (NumBytes) + emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, TII); } - // adjust stack pointer back: ESP += numbytes - if (NumBytes) - emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, TII); - // We're returning from function via eh_return. if (RetOpcode == X86::EH_RETURN) { MBBI = prior(MBB.end()); From asl at math.spbu.ru Wed Apr 23 13:21:02 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:21:02 -0000 Subject: [llvm-commits] [llvm] r50162 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231821.m3NIL2vL029275@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:21:02 2008 New Revision: 50162 URL: http://llvm.org/viewvc/llvm-project?rev=50162&view=rev Log: If stack realignment is used - incoming args will use EBP as base register and locals - ESP Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50162&r1=50161&r2=50162&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:21:02 2008 @@ -281,16 +281,28 @@ int X86RegisterInfo::getFrameIndexOffset(MachineFunction &MF, int FI) const { int Offset = MF.getFrameInfo()->getObjectOffset(FI) + SlotSize; - if (!hasFP(MF)) - return Offset + MF.getFrameInfo()->getStackSize(); - // Skip the saved EBP - Offset += SlotSize; + if (needsStackRealignment(MF)) { + if (FI < 0) + // Skip the saved EBP + Offset += SlotSize; + else + return Offset + MF.getFrameInfo()->getStackSize(); + + // FIXME: Support tail calls + } else { + if (!hasFP(MF)) + return Offset + MF.getFrameInfo()->getStackSize(); + + // Skip the saved EBP + Offset += SlotSize; + + // Skip the RETADDR move area + X86MachineFunctionInfo *X86FI = MF.getInfo(); + int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); + if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; + } - // Skip the RETADDR move area - X86MachineFunctionInfo *X86FI = MF.getInfo(); - int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); - if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; return Offset; } @@ -360,9 +372,16 @@ } int FrameIndex = MI.getOperand(i).getIndex(); + + unsigned BasePtr; + if (needsStackRealignment(MF)) + BasePtr = (FrameIndex < 0 ? FramePtr : StackPtr); + else + BasePtr = (hasFP(MF) ? FramePtr : StackPtr); + // This must be part of a four operand memory reference. Replace the // FrameIndex with base register with EBP. Add an offset to the offset. - MI.getOperand(i).ChangeToRegister(hasFP(MF) ? FramePtr : StackPtr, false); + MI.getOperand(i).ChangeToRegister(BasePtr, false); // Now add the frame object offset to the offset from EBP. int64_t Offset = getFrameIndexOffset(MF, FrameIndex) + From asl at math.spbu.ru Wed Apr 23 13:21:50 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:21:50 -0000 Subject: [llvm-commits] [llvm] r50164 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200804231821.m3NILopX029318@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:21:50 2008 New Revision: 50164 URL: http://llvm.org/viewvc/llvm-project?rev=50164&view=rev Log: Use precomputed value, if any Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=50164&r1=50163&r2=50164&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Wed Apr 23 13:21:50 2008 @@ -313,7 +313,7 @@ // Loop over all of the stack objects, assigning sequential addresses... MachineFrameInfo *FFI = Fn.getFrameInfo(); - unsigned MaxAlign = 0; + unsigned MaxAlign = FFI->getMaxAlignment(); // Start at the beginning of the local area. // The Offset is the distance from the stack top in the direction From asl at math.spbu.ru Wed Apr 23 13:23:06 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:23:06 -0000 Subject: [llvm-commits] [llvm] r50166 - in /llvm/trunk/lib/Target/X86: X86.h X86RegisterInfo.cpp X86TargetMachine.cpp X86TargetMachine.h Message-ID: <200804231823.m3NIN6Qi029380@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:23:05 2008 New Revision: 50166 URL: http://llvm.org/viewvc/llvm-project?rev=50166&view=rev Log: Add X86 Maximal Stack Alignment Calculator Pass before RA Modified: llvm/trunk/lib/Target/X86/X86.h llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.h Modified: llvm/trunk/lib/Target/X86/X86.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=50166&r1=50165&r2=50166&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.h (original) +++ llvm/trunk/lib/Target/X86/X86.h Wed Apr 23 13:23:05 2008 @@ -51,6 +51,11 @@ /// FunctionPass *createEmitX86CodeToMemory(); +/// createX86MaxStackAlignmentCalculatorPass - This function returns a pass which +/// calculates maximal stack alignment required for function +/// +FunctionPass *createX86MaxStackAlignmentCalculatorPass(); + } // End llvm namespace // Defines symbolic names for X86 registers. This defines a mapping from Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50166&r1=50165&r2=50166&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:23:05 2008 @@ -36,6 +36,7 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Compiler.h" using namespace llvm; X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm, @@ -280,16 +281,10 @@ bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const { MachineFrameInfo *MFI = MF.getFrameInfo();; - // FIXME: This is really really ugly, but it seems we need to decide, whether - // we will need stack realignment or not too early (during RA stage). - unsigned MaxAlign = MFI->getMaxAlignment(); - if (!MaxAlign) - MaxAlign = calculateMaxStackAlignment(MFI); - // FIXME: Currently we don't support stack realignment for functions with // variable-sized allocas - return (RealignStack && - (MaxAlign > StackAlign && + return (MFI->getMaxAlignment() && + (MFI->getMaxAlignment() > StackAlign && !MFI->hasVarSizedObjects())); } @@ -1118,3 +1113,31 @@ } #include "X86GenRegisterInfo.inc" + +namespace { + struct VISIBILITY_HIDDEN MSAC : public MachineFunctionPass { + static char ID; + MSAC() : MachineFunctionPass((intptr_t)&ID) {} + + virtual bool runOnMachineFunction(MachineFunction &MF) { + MachineFrameInfo *FFI = MF.getFrameInfo(); + + // Calculate and set max stack object alignment early, so we can decide + // whether we will need stack realignment (and thus FP). + unsigned MaxAlign = calculateMaxStackAlignment(FFI); + + FFI->setMaxAlignment(MaxAlign); + + return false; + } + + virtual const char *getPassName() const { + return "X86 Maximal Stack Alignment Calculator"; + } + }; + + char MSAC::ID = 0; +} + +FunctionPass* +llvm::createX86MaxStackAlignmentCalculatorPass() { return new MSAC(); } Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=50166&r1=50165&r2=50166&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Wed Apr 23 13:23:05 2008 @@ -161,6 +161,11 @@ return false; } +bool X86TargetMachine::addPreRegAlloc(PassManagerBase &PM, bool Fast) { + PM.add(createX86MaxStackAlignmentCalculatorPass()); + return false; // -print-machineinstr shouldn't print after this. +} + bool X86TargetMachine::addPostRegAlloc(PassManagerBase &PM, bool Fast) { PM.add(createX86FloatingPointStackifierPass()); return true; // -print-machineinstr should print after this. Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=50166&r1=50165&r2=50166&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Wed Apr 23 13:23:05 2008 @@ -61,7 +61,8 @@ static unsigned getJITMatchQuality(); // Set up the pass pipeline. - virtual bool addInstSelector(PassManagerBase &PM, bool Fast); + virtual bool addInstSelector(PassManagerBase &PM, bool Fast); + virtual bool addPreRegAlloc(PassManagerBase &PM, bool Fast); virtual bool addPostRegAlloc(PassManagerBase &PM, bool Fast); virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, std::ostream &Out); From asl at math.spbu.ru Wed Apr 23 13:22:28 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:22:28 -0000 Subject: [llvm-commits] [llvm] r50165 - in /llvm/trunk: include/llvm/Target/TargetMachine.h lib/CodeGen/LLVMTargetMachine.cpp Message-ID: <200804231822.m3NIMSro029351@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:22:28 2008 New Revision: 50165 URL: http://llvm.org/viewvc/llvm-project?rev=50165&view=rev Log: Add facility for pre-RA passes Modified: llvm/trunk/include/llvm/Target/TargetMachine.h llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Modified: llvm/trunk/include/llvm/Target/TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=50165&r1=50164&r2=50165&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) +++ llvm/trunk/include/llvm/Target/TargetMachine.h Wed Apr 23 13:22:28 2008 @@ -280,7 +280,14 @@ virtual bool addInstSelector(PassManagerBase &PM, bool Fast) { return true; } - + + /// addPreRegAllocPasses - This method may be implemented by targets that want + /// to run passes immediately before register allocation. This should return + /// true if -print-machineinstrs should print after these passes. + virtual bool addPreRegAlloc(PassManagerBase &PM, bool Fast) { + return false; + } + /// addPostRegAllocPasses - This method may be implemented by targets that /// want to run passes after register allocation but before prolog-epilog /// insertion. This should return true if -print-machineinstrs should print Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=50165&r1=50164&r2=50165&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Apr 23 13:22:28 2008 @@ -94,6 +94,10 @@ if (EnableSinking) PM.add(createMachineSinkingPass()); + // Run pre-ra passes. + if (addPreRegAlloc(PM, Fast) && PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(cerr)); + // Perform register allocation to convert to a concrete x86 representation PM.add(createRegisterAllocator()); From asl at math.spbu.ru Wed Apr 23 13:23:50 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:23:50 -0000 Subject: [llvm-commits] [llvm] r50168 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231823.m3NINoeW029424@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:23:50 2008 New Revision: 50168 URL: http://llvm.org/viewvc/llvm-project?rev=50168&view=rev Log: Only allow increase of max alignment value Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50168&r1=50167&r2=50168&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:23:50 2008 @@ -417,7 +417,8 @@ // Calculate and set max stack object alignment early, so we can decide // whether we will need stack realignment (and thus FP). - unsigned MaxAlign = calculateMaxStackAlignment(FFI); + unsigned MaxAlign = std::max(FFI->getMaxAlignment(), + calculateMaxStackAlignment(FFI)); FFI->setMaxAlignment(MaxAlign); } From asl at math.spbu.ru Wed Apr 23 13:24:25 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:24:25 -0000 Subject: [llvm-commits] [llvm] r50169 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200804231824.m3NIOP3T029449@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:24:25 2008 New Revision: 50169 URL: http://llvm.org/viewvc/llvm-project?rev=50169&view=rev Log: Fix typo Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50169&r1=50168&r2=50169&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:24:25 2008 @@ -283,7 +283,7 @@ // FIXME: Currently we don't support stack realignment for functions with // variable-sized allocas - return (MFI->getMaxAlignment() && + return (RealignStack && (MFI->getMaxAlignment() > StackAlign && !MFI->hasVarSizedObjects())); } From asl at math.spbu.ru Wed Apr 23 13:23:30 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:23:30 -0000 Subject: [llvm-commits] [llvm] r50167 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86TargetMachine.cpp Message-ID: <200804231823.m3NINUjN029405@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:23:30 2008 New Revision: 50167 URL: http://llvm.org/viewvc/llvm-project?rev=50167&view=rev Log: Be over-conservative: scan for all used virtual registers and calculate maximal stack alignment in assumption, that there will be spill of vector register. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=50167&r1=50166&r2=50167&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 23 13:23:30 2008 @@ -1121,11 +1121,18 @@ virtual bool runOnMachineFunction(MachineFunction &MF) { MachineFrameInfo *FFI = MF.getFrameInfo(); + MachineRegisterInfo &RI = MF.getRegInfo(); - // Calculate and set max stack object alignment early, so we can decide - // whether we will need stack realignment (and thus FP). + // Calculate max stack alignment of all already allocated stack objects. unsigned MaxAlign = calculateMaxStackAlignment(FFI); + // Be over-conservative: scan over all vreg defs and find, whether vector + // registers are used. If yes - there is probability, that vector register + // will be spilled and thus stack needs to be aligned properly. + for (unsigned RegNum = TargetRegisterInfo::FirstVirtualRegister; + RegNum < RI.getLastVirtReg(); ++RegNum) + MaxAlign = std::max(MaxAlign, RI.getRegClass(RegNum)->getAlignment()); + FFI->setMaxAlignment(MaxAlign); return false; Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=50167&r1=50166&r2=50167&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Wed Apr 23 13:23:30 2008 @@ -162,6 +162,8 @@ } bool X86TargetMachine::addPreRegAlloc(PassManagerBase &PM, bool Fast) { + // Calculate and set max stack object alignment early, so we can decide + // whether we will need stack realignment (and thus FP). PM.add(createX86MaxStackAlignmentCalculatorPass()); return false; // -print-machineinstr shouldn't print after this. } From asl at math.spbu.ru Wed Apr 23 13:24:49 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:24:49 -0000 Subject: [llvm-commits] [llvm] r50170 - /llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll Message-ID: <200804231824.m3NIOn5j029470@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:24:48 2008 New Revision: 50170 URL: http://llvm.org/viewvc/llvm-project?rev=50170&view=rev Log: Fix test, instruction count is valid only if stack is not realigned Modified: llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll Modified: llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll?rev=50170&r1=50169&r2=50170&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll (original) +++ llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll Wed Apr 23 13:24:48 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |&\ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats -realign-stack=0 |&\ ; RUN: grep {asm-printer} | grep 32 target datalayout = "e-p:32:32" From asl at math.spbu.ru Wed Apr 23 13:25:45 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:25:45 -0000 Subject: [llvm-commits] [llvm] r50172 - in /llvm/trunk/test/CodeGen/X86: dagcombine-cse.ll vec_clear.ll vec_shuffle-11.ll vec_shuffle-16.ll Message-ID: <200804231825.m3NIPj63029520@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:25:44 2008 New Revision: 50172 URL: http://llvm.org/viewvc/llvm-project?rev=50172&view=rev Log: Disable stack realignment for these tests Modified: llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll llvm/trunk/test/CodeGen/X86/vec_clear.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll Modified: llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll?rev=50172&r1=50171&r2=50172&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll (original) +++ llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll Wed Apr 23 13:25:44 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |& grep asm-printer | grep 14 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 -stats |& grep asm-printer | grep 14 define i32 @t(i8* %ref_frame_ptr, i32 %ref_frame_stride, i32 %idxX, i32 %idxY) nounwind { entry: Modified: llvm/trunk/test/CodeGen/X86/vec_clear.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_clear.ll?rev=50172&r1=50171&r2=50172&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_clear.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_clear.ll Wed Apr 23 13:25:44 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep and +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 | not grep and define <4 x float> @test(<4 x float>* %v1) { %tmp = load <4 x float>* %v1 ; <<4 x float>> [#uses=1] Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll?rev=50172&r1=50171&r2=50172&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll Wed Apr 23 13:25:44 2008 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep mov +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 | not grep mov define <4 x i32> @test() { %tmp131 = call <2 x i64> @llvm.x86.sse2.psrl.dq( <2 x i64> < i64 -1, i64 -1 >, i32 96 ) ; <<2 x i64>> [#uses=1] Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll?rev=50172&r1=50171&r2=50172&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll Wed Apr 23 13:25:44 2008 @@ -1,8 +1,8 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 | grep shufps | count 4 -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 | grep mov | count 2 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 -realign-stack=0 | grep mov | count 2 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd | count 4 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep shufps -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep mov +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 | not grep mov define <4 x float> @t1(<4 x float> %a, <4 x float> %b) nounwind { %tmp1 = shufflevector <4 x float> %b, <4 x float> undef, <4 x i32> zeroinitializer From asl at math.spbu.ru Wed Apr 23 13:25:16 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:25:16 -0000 Subject: [llvm-commits] [llvm] r50171 - /llvm/trunk/test/CodeGen/X86/mingw-alloca.ll Message-ID: <200804231825.m3NIPHKe029492@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:25:16 2008 New Revision: 50171 URL: http://llvm.org/viewvc/llvm-project?rev=50171&view=rev Log: Fix test becase ABI stack alignment dropped to 'normal' value Modified: llvm/trunk/test/CodeGen/X86/mingw-alloca.ll Modified: llvm/trunk/test/CodeGen/X86/mingw-alloca.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mingw-alloca.ll?rev=50171&r1=50170&r2=50171&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/mingw-alloca.ll (original) +++ llvm/trunk/test/CodeGen/X86/mingw-alloca.ll Wed Apr 23 13:25:16 2008 @@ -1,8 +1,8 @@ ; RUN: llvm-as < %s | llc -o %t -f ; RUN: grep __alloca %t | count 2 -; RUN: grep 8028 %t +; RUN: grep 4294967288 %t ; RUN: grep {pushl %eax} %t -; RUN: grep 8024 %t | count 2 +; RUN: grep 8012 %t | count 2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "i386-mingw32" From asl at math.spbu.ru Wed Apr 23 13:26:03 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 18:26:03 -0000 Subject: [llvm-commits] [llvm] r50173 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Message-ID: <200804231826.m3NIQ3KL029537@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 13:26:03 2008 New Revision: 50173 URL: http://llvm.org/viewvc/llvm-project?rev=50173&view=rev Log: Unbreak JIT Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=50173&r1=50172&r2=50173&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Apr 23 13:26:03 2008 @@ -224,6 +224,10 @@ if (EnableSinking) PM.add(createMachineSinkingPass()); + // Run pre-ra passes. + if (addPreRegAlloc(PM, Fast) && PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(cerr)); + // Perform register allocation to convert to a concrete x86 representation PM.add(createRegisterAllocator()); From dalej at apple.com Wed Apr 23 13:34:37 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Apr 2008 18:34:37 -0000 Subject: [llvm-commits] [llvm] r50174 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> Author: johannes Date: Wed Apr 23 13:34:37 2008 New Revision: 50174 URL: http://llvm.org/viewvc/llvm-project?rev=50174&view=rev Log: Rewrite previous patch to suit Chris's preference. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50174&r1=50173&r2=50174&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Apr 23 13:34:37 2008 @@ -8694,6 +8694,31 @@ return visitCallSite(&II); } +// If this cast does not affect the value passed through the varargs +// area, we can eliminate the use of the cast. +static bool isSafeToEliminateVarargsCast(const CallSite CS, + const CastInst * const CI, + const TargetData * const TD, + const int ix) { + if (!CI->isLosslessCast()) + return false; + + // The size of ByVal arguments is derived from the type, so we + // can't change to a type with a different size. If the size were + // passed explicitly we could avoid this check. + if (!CS.paramHasAttr(ix, ParamAttr::ByVal)) + return true; + + const Type* SrcTy = + cast(CI->getOperand(0)->getType())->getElementType(); + const Type* DstTy = cast(CI->getType())->getElementType(); + if (!SrcTy->isSized() || !DstTy->isSized()) + return false; + if (TD->getABITypeSize(SrcTy) != TD->getABITypeSize(DstTy)) + return false; + return true; +} + // visitCallSite - Improvements for call and invoke instructions. // Instruction *InstCombiner::visitCallSite(CallSite CS) { @@ -8752,28 +8777,13 @@ // See if we can optimize any arguments passed through the varargs area of // the call. for (CallSite::arg_iterator I = CS.arg_begin()+FTy->getNumParams(), - E = CS.arg_end(); I != E; ++I, ++ix) - if (CastInst *CI = dyn_cast(*I)) { - // If this cast does not affect the value passed through the varargs - // area, we can eliminate the use of the cast. - const PointerType* SrcPTy, *DstPTy; - if (CI->isLosslessCast()) { - // The size of ByVal arguments is derived from the type, so we - // can't change to a type with a different size. If the size were - // passed explicitly we could avoid this check. - if (CS.paramHasAttr(ix, ParamAttr::ByVal) && - (SrcPTy = cast(CI->getOperand(0)->getType())) && - (DstPTy = cast(CI->getType()))) { - const Type* SrcTy = SrcPTy->getElementType(); - const Type* DstTy = DstPTy->getElementType(); - if (!SrcTy->isSized() || !DstTy->isSized() || - TD->getABITypeSize(SrcTy) != TD->getABITypeSize(DstTy)) - continue; - } - *I = CI->getOperand(0); - Changed = true; - } + E = CS.arg_end(); I != E; ++I, ++ix) { + CastInst *CI = dyn_cast(*I); + if (CI && isSafeToEliminateVarargsCast(CS, CI, TD, ix)) { + *I = CI->getOperand(0); + Changed = true; } + } } if (isa(Callee) && !CS.doesNotThrow()) { From gohman at apple.com Wed Apr 23 15:11:27 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 20:11:27 -0000 Subject: [llvm-commits] [llvm] r50175 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200804232011.m3NKBSVP000482@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 15:11:27 2008 New Revision: 50175 URL: http://llvm.org/viewvc/llvm-project?rev=50175&view=rev Log: Allow llvm-as to parse a getresult with an undef operand. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=50175&r1=50174&r2=50175&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Apr 23 15:11:27 2008 @@ -380,7 +380,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1337,7 +1337,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 950 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1821,7 +1821,7 @@ 200, 155, 11, 235, 194, -1, 113, 200, 194, -1, 113, 200, 155, 11, 235, 194, -1, 114, 236, -1, 249, 115, 200, 235, 194, -1, 249, 116, 236, 155, - 200, 235, 194, -1, 136, 200, 234, 155, 4, -1, + 200, 235, 194, -1, 136, 200, 235, 155, 4, -1, 117, 200, 235, 246, -1 }; @@ -2104,87 +2104,87 @@ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -524 +#define YYPACT_NINF -536 static const yytype_int16 yypact[] = { - 369, -524, -524, -524, -524, -524, -524, -524, 46, -130, - 11, -89, 62, -59, 258, -524, 135, 506, -524, 227, - 130, -12, 26, -524, -1, 180, -524, 1572, -524, -524, - -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, - 119, 119, 250, -524, -524, -524, -524, 119, -524, -524, - -524, -524, -524, 119, 39, -524, -2, 214, 221, 229, - -524, -524, -524, -524, -524, 59, -524, -524, -524, -524, - -524, -524, -524, -524, 262, 268, 8, 35, -524, -524, - -524, 9, -524, 195, 195, 244, -524, 162, 233, 233, - 186, 238, -524, 127, -524, -524, -524, -524, -524, -524, - -524, 50, 1126, -524, 133, 161, 815, 59, -524, 9, - -88, 172, 1126, 181, 162, 162, -524, -524, 1372, -524, - -524, 1612, 337, -524, -524, -524, -524, -524, 1652, -524, - -3, 314, 906, 1867, -524, 334, -524, -524, 9, -524, - 205, 208, 1692, 1692, 200, -64, 1692, -524, 359, 211, - -524, 1612, 1692, 59, 216, 9, 410, -524, 223, 357, - 361, 362, 363, 365, 275, 366, 1182, 329, -524, 97, - -524, -524, -524, 906, -524, -524, -524, -524, -524, -524, - -524, -524, 324, -524, -524, -524, -524, -524, -524, -524, - -524, -524, -524, -524, -524, -524, -524, -524, 511, 491, - 234, -524, -524, -524, -524, -524, -524, -524, -524, -524, - -524, -524, -524, 252, 253, 259, 260, 1612, 263, 267, - 271, -524, -524, -524, -524, -524, -524, 354, 1732, 68, - 374, 233, -524, -524, 511, 491, 1692, 1692, 1692, 1692, + 369, -536, -536, -536, -536, -536, -536, -536, 39, -128, + -20, -82, 67, -9, 258, -536, 177, 506, -536, 239, + 226, 57, 78, -536, 22, 214, -536, 1572, -536, -536, + -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, + -35, -35, 244, -536, -536, -536, -536, -35, -536, -536, + -536, -536, -536, -35, 15, -536, -2, 221, 232, 235, + -536, -536, -536, -536, -536, 99, -536, -536, -536, -536, + -536, -536, -536, -536, 262, 268, 8, 35, -536, -536, + -536, -26, -536, 225, 225, 265, -536, 128, 233, 233, + 208, 254, -536, 256, -536, -536, -536, -536, -536, -536, + -536, -22, 1126, -536, 161, 165, 815, 99, -536, -26, + -91, 174, 1126, 171, 128, 128, -536, -536, 1372, -536, + -536, 1612, 324, -536, -536, -536, -536, -536, 1652, -536, + -6, 293, 906, 1867, -536, 313, -536, -536, -26, -536, + 181, 184, 1692, 1692, 179, -84, 1692, -536, 338, 190, + -536, 1612, 1692, 99, 192, -26, 410, -536, 223, 336, + 343, 347, 351, 352, 204, 353, 1182, 309, -536, 126, + -536, -536, -536, 906, -536, -536, -536, -536, -536, -536, + -536, -536, 304, -536, -536, -536, -536, -536, -536, -536, + -536, -536, -536, -536, -536, -536, -536, -536, 511, 491, + 216, -536, -536, -536, -536, -536, -536, -536, -536, -536, + -536, -536, -536, 218, 219, 220, 222, 1612, 231, 234, + 238, -536, -536, -536, -536, -536, -536, 310, 1732, 50, + 364, 233, -536, -536, 511, 491, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, - -524, 233, -524, 197, -524, -524, 210, 1452, -524, -31, - 2, -524, 264, 9, 237, -524, 329, -25, 1372, -524, - -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, - 1412, 1772, 855, 403, -524, -524, -524, 279, -524, -524, - 405, -524, -524, -524, -524, -524, -524, -524, -524, -524, - -524, 284, -524, -524, -524, -524, -524, -524, -524, -524, - -524, -524, -524, -524, -524, -524, -524, -524, 285, 1612, - 1612, 1612, 1612, 1612, -524, -46, 1612, 1612, 1612, -524, - 59, 766, -524, 287, 906, 906, -524, 906, 1652, 1692, - 1692, 45, 51, -524, 766, 17, 290, 294, 295, 297, - 298, 299, 14, 766, 766, 417, 1652, 1692, 1692, 452, - -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, - -524, -524, 189, -524, -524, -524, -524, 189, -524, 181, - 421, -524, 102, 1080, -32, -524, -49, -524, 305, 1492, - 306, 1612, 1612, -524, 308, 311, 315, 316, 1612, -524, - 317, 318, 431, -524, 1692, 319, -524, 321, 906, 766, - 766, 24, -524, 28, -524, -524, 906, 320, 1692, 1692, - 1692, 1692, 1692, 322, 325, 327, 1692, 906, 766, 328, - -524, -524, -524, -524, -524, -524, -524, -524, 305, 305, - 1692, -524, 323, 1035, -17, -524, -524, 30, -524, -524, - 9, 331, 326, 462, 332, 333, 154, 1612, 1612, 1612, - 1612, -524, 1612, 1612, 1692, -524, 472, 473, 340, 339, - 341, 906, 493, 906, 347, 348, 906, 349, 9, -524, - 352, 353, 507, 906, 906, 9, 343, 360, 1692, -524, - -524, 38, -524, 371, 494, 515, -524, 305, 115, 1532, - -524, -524, 1612, 1612, -524, 1692, 367, 368, 372, 379, - 382, 385, 56, 906, 906, 1812, 906, 906, 360, -524, - 360, 906, 384, 1692, 1692, 1692, -524, -524, -524, 1812, - 487, -524, 766, -524, -524, -524, -524, -524, -524, -524, - -524, 9, -6, 388, 389, -524, 1612, -524, 1612, 1612, - -524, -524, -524, 390, 386, 33, 9, 166, -524, -524, - -524, -524, 383, 906, -524, -524, -524, 170, 360, 115, - -524, 495, -524, -524, 396, 397, 399, 536, 3, 623, - 623, -524, 1852, -524, 395, -524, -524, -524, 552, 411, - -524, -524, -524, 906, -524, 1323, 7, 412, 414, -524, - -524, 6, 33, 9, -524, 189, -524, 540, -524, -524, - 413, -524, 1323, 210, 210, 550, 623, 623, -524, 553, - 416, 906, -524, -524, 906, 555, 500, 210, 210, -524, - 906, 557, -524, 906, -524 + -536, 233, -536, 79, -536, -536, 210, 1452, -536, -25, + -31, -536, 242, -26, 252, -536, 309, 2, 1372, -536, + -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, + 1412, 1772, 855, 362, -536, -536, -536, 259, -536, -536, + 363, -536, -536, -536, -536, -536, -536, -536, -536, -536, + -536, 260, -536, -536, -536, -536, -536, -536, -536, -536, + -536, -536, -536, -536, -536, -536, -536, -536, 263, 1612, + 1612, 1612, 1612, 1612, -536, -42, 1612, 1612, 1612, -536, + 99, 766, -536, 255, 906, 906, -536, 906, 1652, 1692, + 1692, 20, 45, -536, 766, -29, 264, 270, 271, 272, + 276, 281, 766, 766, 766, 385, 1652, 1692, 1692, 433, + -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, + -536, -536, -37, -536, -536, -536, -536, -37, -536, 171, + 404, -536, -7, 1080, -30, -536, -66, -536, 290, 1492, + 294, 1612, 1612, -536, 295, 297, 298, 299, 1612, -536, + 300, 305, 421, -536, 1692, 306, -536, 308, 906, 766, + 766, 10, -536, 26, -536, -536, 906, 311, 1692, 1692, + 1692, 1692, 1692, 315, 316, 317, 1692, 906, 766, 318, + -536, -536, -536, -536, -536, -536, -536, -536, 290, 290, + 1692, -536, 312, 1035, -47, -536, -536, 42, -536, -536, + -26, 321, 325, 444, 322, 327, 133, 1612, 1612, 1612, + 1612, -536, 1612, 1612, 1692, -536, 462, 463, 331, 329, + 330, 906, 482, 906, 332, 333, 906, 334, -26, -536, + 335, 337, 490, 906, 906, -26, 344, 340, 1692, -536, + -536, 38, -536, 341, 475, 498, -536, 290, 115, 1532, + -536, -536, 1612, 1612, -536, 1692, 349, 354, 356, 360, + 355, 366, 53, 906, 906, 1812, 906, 906, 340, -536, + 340, 906, 361, 1692, 1692, 1692, -536, -536, -536, 1812, + 468, -536, 766, -536, -536, -536, -536, -536, -536, -536, + -536, -26, 5, 374, 380, -536, 1612, -536, 1612, 1612, + -536, -536, -536, 367, 376, 33, -26, 166, -536, -536, + -536, -536, 375, 906, -536, -536, -536, 170, 340, 115, + -536, 485, -536, -536, 386, 387, 388, 525, 3, 623, + 623, -536, 1852, -536, 383, -536, -536, -536, 540, 397, + -536, -536, -536, 906, -536, 1323, 7, 396, 398, -536, + -536, 27, 33, -26, -536, -37, -536, 527, -536, -536, + 400, -536, 1323, 210, 210, 535, 623, 623, -536, 536, + 401, 906, -536, -536, 906, 542, 489, 210, 210, -536, + 906, 547, -536, 906, -536 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -524, 443, 445, 446, 350, 346, -229, -524, 0, 16, - -141, 489, 13, -524, -524, -524, -524, 61, -524, -524, - -524, -190, -524, -444, -524, -263, -524, -524, -337, 41, - -524, -407, -524, -524, -24, 356, -108, -524, 474, 508, - -81, -150, -207, 228, 261, 351, -524, -524, 598, -524, - -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, - 527, -524, -524, -524, -524, -524, -524, -523, -70, 104, - -234, -524, -524, 566, -524, -524, -524, -524, -524, 94, - 209, -524, -524, -524, -524 + -536, 434, 435, 437, 339, 346, -229, -536, 0, -3, + -126, 478, 13, -536, -536, -536, -536, 28, -536, -536, + -536, -207, -536, -444, -536, -263, -536, -536, -337, 30, + -536, -407, -536, -536, -24, 319, -108, -536, 466, 473, + -81, -150, -247, 88, 229, 314, -536, -536, 557, -536, + -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, + 494, -536, -536, -536, -536, -536, -536, -535, -70, 104, + -234, -536, -536, 528, -536, -536, -536, -536, -536, 56, + 198, -536, -536, -536, -536 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -2196,67 +2196,67 @@ { 11, 337, 377, 81, 343, 414, 498, 347, 348, 349, 350, 351, 105, 13, 336, 355, 284, 11, 336, 90, - 169, 63, 64, 111, 24, 170, 286, 94, 494, 111, - 13, 489, 490, 1, 2, 471, 3, 4, 5, 473, - 167, 338, 63, 64, 615, 107, 66, 67, 68, 69, + 169, 471, 170, 111, 338, 111, 24, 94, 111, 111, + 13, 489, 490, 382, 384, 386, 90, 473, 25, 494, + 167, 286, 63, 64, 356, 107, 66, 67, 68, 69, 70, 71, 72, 109, 1, 2, 111, 3, 4, 5, - 90, 356, 223, 111, 494, 26, 91, 146, 111, 25, - 266, 111, 610, 382, 384, 386, 147, 472, 138, 334, - 27, 472, 109, 495, 73, 335, 269, -144, 138, 620, - 537, 146, 111, 11, 155, 28, 285, 569, 21, 111, - 262, 83, 84, 223, 155, 111, 398, 91, 88, 398, - 111, 579, 580, 22, 89, 446, 399, 2, 259, 260, - 4, 112, 263, 398, 429, 378, 379, 112, 267, 373, - 445, 431, 432, 433, 1, 43, 434, 3, 398, 5, - 435, 436, 57, 431, 432, 433, 1, 493, 434, 3, - 531, 5, 435, 436, 112, 613, 614, 59, 616, 617, - 171, 112, 95, 594, 374, -67, 112, 611, 359, 112, - 465, 106, 49, 50, 51, 416, 444, 52, 627, 628, - 58, 560, 287, 561, 477, -144, 479, 480, 481, -144, - 112, 533, 74, 75, 119, 120, 76, 112, 77, 108, - 411, -67, 61, 112, 331, 135, 413, -67, 112, 552, - 136, 102, 341, 342, 331, 344, 345, 331, 331, 331, + 610, 334, 223, 472, 146, 615, 91, 335, 83, 84, + 266, 146, 26, 147, 111, 88, 494, 620, 138, 472, + 262, 89, 109, 91, 73, 27, 269, -144, 138, 398, + 537, 21, 111, 11, 155, 495, 285, 569, 446, 111, + 431, 432, 433, 223, 155, 434, 22, 111, 398, 435, + 436, 579, 580, 398, 37, 38, 39, 493, 259, 260, + 399, 112, 263, 112, 429, 398, 112, 112, 267, 416, + -67, 374, 445, 135, 1, 373, 444, 3, 136, 5, + 378, 379, 431, 432, 433, 28, 2, 434, 398, 4, + 531, 435, 436, 441, 112, 613, 614, 171, 616, 617, + 119, 120, 95, 594, 431, 432, 433, 611, 359, 434, + 465, 106, 112, 435, 436, 411, -67, 43, 627, 628, + 59, 560, 287, 561, 477, -144, 479, 480, 481, -144, + 112, 533, 74, 75, 357, 358, 76, 112, 77, 108, + 413, -67, 151, 152, 331, 112, 552, 272, 273, 274, + 275, 57, 341, 342, 331, 344, 345, 331, 331, 331, 331, 331, 352, 353, 354, 331, -55, -55, -55, -55, - 408, 586, 86, 138, 360, 361, 98, 542, 393, 394, - 395, 396, 397, 99, 155, 400, 401, 402, 427, 270, - 271, 100, 362, 363, 131, 364, 365, 398, 366, 367, - 368, 223, 441, 359, 223, 223, 103, 223, 37, 38, - 39, 545, 104, 45, 223, 46, 132, 288, 272, 273, - 274, 275, 423, 223, 223, 85, 116, 86, 117, 564, - 565, 566, 142, 284, 122, 123, 124, 125, 126, 127, - 29, 30, 31, 32, 33, 34, 35, 504, 36, 505, - 454, 455, 357, 358, 155, 409, 410, 461, 601, 581, - 143, 582, 605, 585, 148, 582, 431, 432, 433, 360, - 361, 434, 155, 428, 331, 435, 436, 150, 223, 223, - 223, 168, 151, 152, 114, 115, 223, 362, 363, 595, - 364, 365, 173, 366, 367, 368, 255, 223, 223, 443, - 257, 258, 261, 264, 265, 450, -56, 612, 268, -208, - -57, -60, -59, 285, -58, 276, 506, 507, 508, 509, - 331, 510, 511, 111, 289, 336, 319, -69, 1, 2, - 376, 3, 4, 5, 331, 478, 331, 331, 331, 6, - 7, 223, 485, 223, 320, 321, 223, 37, 38, 39, - 329, 322, 323, 223, 223, 326, 491, 63, 64, 327, - 8, 543, 544, 328, 9, 387, 375, 390, 10, 1, - 2, 389, 3, 4, 5, 403, 391, 392, 405, 406, - 512, 407, 404, 223, 223, 417, 223, 223, 415, 418, - 419, 223, 420, 421, 422, 426, 430, 424, 425, 440, - 447, 453, 223, 457, 532, 574, 458, 575, 576, 464, - 459, 460, 462, 463, 466, 541, 467, 482, 476, 500, - 483, 331, 484, 488, 501, 492, 499, 502, 503, 513, - 514, 556, 515, 223, 516, 529, 517, 519, 538, 331, - 331, 331, 505, 521, 523, 556, -207, 524, 525, 223, - 223, 526, 468, 469, 470, 530, 535, 302, 303, 536, - 475, 547, 546, 223, -69, 1, 2, 548, 3, 4, - 5, 486, 487, 534, 549, 550, 6, 7, 551, 563, - 472, 572, 573, 583, 578, 577, 223, 223, 588, 590, - 591, 223, 592, 593, 223, 604, 606, 8, 603, 607, - 223, 9, 618, 223, -18, 10, -19, 621, 619, 538, - 624, 625, 630, 631, 633, 518, 247, 520, 248, 249, - 522, 340, 133, 570, 339, 587, 149, 527, 528, 304, + 408, 586, 58, 138, 360, 361, 61, 542, 393, 394, + 395, 396, 397, 98, 155, 400, 401, 402, 427, 270, + 271, 102, 362, 363, 99, 364, 365, 100, 366, 367, + 368, 223, 86, 359, 223, 223, 103, 223, 49, 50, + 51, 545, 104, 52, 223, 1, 131, 288, 3, 85, + 5, 86, 223, 223, 223, 45, 504, 46, 505, 564, + 565, 566, 132, 284, 122, 123, 124, 125, 126, 127, + 29, 30, 31, 32, 33, 34, 35, 116, 36, 117, + 454, 455, 114, 115, 155, 409, 410, 461, 601, 581, + 142, 582, 605, 585, 143, 582, 148, 150, 168, 360, + 361, 173, 155, 428, 331, 255, 257, 258, 223, 223, + 223, 261, 264, 265, 268, -56, 223, 362, 363, 595, + 364, 365, -57, 366, 367, 368, -60, 223, 223, 443, + -59, -58, 276, 111, 289, 450, 329, 612, 319, -208, + 320, 321, 322, 285, 323, 336, 506, 507, 508, 509, + 331, 510, 511, 326, 387, 390, 327, -69, 1, 2, + 328, 3, 4, 5, 331, 478, 331, 331, 331, 6, + 7, 223, 485, 223, 375, 376, 223, 37, 38, 39, + 404, 389, 391, 223, 223, 392, 491, 63, 64, 417, + 8, 543, 544, 426, 9, 418, 419, 420, 10, 1, + 2, 421, 3, 4, 5, 403, 422, 430, 405, 406, + 512, 407, 440, 223, 223, 447, 223, 223, 415, 453, + 457, 223, 458, 459, 460, 462, 423, 424, 425, 464, + 463, 466, 223, 467, 532, 574, 501, 575, 576, 476, + 482, 483, 484, 488, 492, 541, 499, 502, 500, 513, + 514, 331, 503, 515, 516, 517, 519, 505, 521, 523, + 524, 556, 525, 223, 526, 530, 529, 535, 538, 331, + 331, 331, 536, 534, 546, 556, -207, 547, 550, 223, + 223, 548, 468, 469, 470, 549, 563, 302, 303, 551, + 475, 472, 577, 223, -69, 1, 2, 572, 3, 4, + 5, 486, 487, 573, 578, 583, 6, 7, 588, 590, + 591, 592, 593, 604, 606, 607, 223, 223, -18, 618, + -19, 223, 621, 624, 223, 619, 625, 8, 603, 630, + 223, 9, 631, 223, 633, 10, 587, 247, 248, 538, + 249, 133, 570, 339, 44, 518, 371, 520, 149, 145, + 522, 340, 380, 130, 97, 567, 0, 527, 528, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 371, 145, 44, 130, 553, 554, 380, - 558, 559, 97, 567, 474, 562, 174, 175, 0, 0, + 298, 299, 300, 474, 0, 0, 0, 553, 554, 0, + 558, 559, 0, 0, 0, 562, 174, 175, 0, 0, 63, 64, 176, 0, 0, 0, 568, 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, 5, 177, 178, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2402,67 +2402,67 @@ { 0, 230, 265, 27, 238, 342, 450, 241, 242, 243, 244, 245, 4, 0, 11, 249, 166, 17, 11, 21, - 128, 7, 8, 54, 154, 28, 167, 29, 34, 54, - 17, 438, 439, 19, 20, 11, 22, 23, 24, 11, - 121, 231, 7, 8, 38, 10, 11, 12, 13, 14, + 128, 11, 28, 54, 231, 54, 154, 29, 54, 54, + 17, 438, 439, 280, 281, 282, 21, 11, 58, 34, + 121, 167, 7, 8, 251, 10, 11, 12, 13, 14, 15, 16, 17, 77, 19, 20, 54, 22, 23, 24, - 21, 251, 132, 54, 34, 154, 68, 155, 54, 58, - 151, 54, 595, 280, 281, 282, 164, 53, 102, 11, - 18, 53, 106, 53, 49, 17, 156, 54, 112, 612, - 497, 155, 54, 93, 118, 154, 166, 541, 52, 54, - 164, 40, 41, 173, 128, 54, 155, 68, 47, 155, - 54, 555, 556, 67, 53, 164, 162, 20, 142, 143, - 23, 152, 146, 155, 358, 266, 267, 152, 152, 160, - 162, 137, 138, 139, 19, 0, 142, 22, 155, 24, - 146, 147, 154, 137, 138, 139, 19, 164, 142, 22, - 487, 24, 146, 147, 152, 599, 600, 158, 602, 603, - 163, 152, 164, 160, 162, 156, 152, 160, 53, 152, - 404, 163, 42, 43, 44, 158, 383, 47, 622, 623, - 154, 518, 169, 520, 418, 152, 420, 421, 422, 156, - 152, 153, 157, 158, 32, 33, 161, 152, 163, 164, - 155, 156, 22, 152, 228, 155, 155, 156, 152, 153, - 160, 152, 236, 237, 238, 239, 240, 241, 242, 243, + 595, 11, 132, 53, 155, 38, 68, 17, 40, 41, + 151, 155, 154, 164, 54, 47, 34, 612, 102, 53, + 164, 53, 106, 68, 49, 18, 156, 54, 112, 155, + 497, 52, 54, 93, 118, 53, 166, 541, 164, 54, + 137, 138, 139, 173, 128, 142, 67, 54, 155, 146, + 147, 555, 556, 155, 149, 150, 151, 164, 142, 143, + 162, 152, 146, 152, 358, 155, 152, 152, 152, 158, + 156, 162, 162, 155, 19, 160, 383, 22, 160, 24, + 266, 267, 137, 138, 139, 154, 20, 142, 155, 23, + 487, 146, 147, 160, 152, 599, 600, 163, 602, 603, + 32, 33, 164, 160, 137, 138, 139, 160, 53, 142, + 404, 163, 152, 146, 147, 155, 156, 0, 622, 623, + 158, 518, 169, 520, 418, 152, 420, 421, 422, 156, + 152, 153, 157, 158, 115, 116, 161, 152, 163, 164, + 155, 156, 114, 115, 228, 152, 153, 3, 4, 5, + 6, 154, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 3, 4, 5, 6, - 338, 568, 37, 257, 119, 120, 22, 500, 319, 320, + 338, 568, 154, 257, 119, 120, 22, 500, 319, 320, 321, 322, 323, 22, 268, 326, 327, 328, 356, 26, - 27, 22, 137, 138, 68, 140, 141, 155, 143, 144, - 145, 331, 160, 53, 334, 335, 4, 337, 149, 150, - 151, 505, 4, 46, 344, 48, 38, 173, 3, 4, - 5, 6, 352, 353, 354, 35, 42, 37, 44, 523, - 524, 525, 159, 443, 61, 62, 63, 64, 65, 66, - 42, 43, 44, 45, 46, 47, 48, 153, 50, 155, - 391, 392, 115, 116, 338, 339, 340, 398, 581, 153, - 159, 155, 585, 153, 152, 155, 137, 138, 139, 119, - 120, 142, 356, 357, 358, 146, 147, 156, 408, 409, - 410, 4, 114, 115, 83, 84, 416, 137, 138, 578, - 140, 141, 38, 143, 144, 145, 22, 427, 428, 383, - 155, 153, 162, 4, 153, 389, 9, 596, 152, 0, - 9, 9, 9, 443, 9, 9, 457, 458, 459, 460, - 404, 462, 463, 54, 60, 11, 152, 18, 19, 20, - 153, 22, 23, 24, 418, 419, 420, 421, 422, 30, - 31, 471, 426, 473, 152, 152, 476, 149, 150, 151, - 56, 152, 152, 483, 484, 152, 440, 7, 8, 152, - 51, 502, 503, 152, 55, 22, 162, 22, 59, 19, - 20, 152, 22, 23, 24, 331, 152, 152, 334, 335, - 464, 337, 155, 513, 514, 155, 516, 517, 344, 155, - 155, 521, 155, 155, 155, 38, 4, 353, 354, 38, - 155, 155, 532, 155, 488, 546, 155, 548, 549, 38, - 155, 155, 155, 155, 155, 499, 155, 155, 158, 153, - 155, 505, 155, 155, 22, 162, 155, 155, 155, 17, - 17, 515, 152, 563, 155, 152, 155, 4, 498, 523, - 524, 525, 155, 155, 155, 529, 0, 155, 155, 579, - 580, 4, 408, 409, 410, 155, 22, 26, 27, 4, - 416, 153, 155, 593, 18, 19, 20, 155, 22, 23, - 24, 427, 428, 162, 155, 153, 30, 31, 153, 155, - 53, 153, 153, 160, 158, 155, 616, 617, 53, 153, - 153, 621, 153, 17, 624, 160, 4, 51, 582, 148, - 630, 55, 22, 633, 152, 59, 152, 17, 155, 569, - 17, 155, 17, 73, 17, 471, 133, 473, 133, 133, - 476, 235, 93, 542, 234, 569, 112, 483, 484, 98, + 27, 152, 137, 138, 22, 140, 141, 22, 143, 144, + 145, 331, 37, 53, 334, 335, 4, 337, 42, 43, + 44, 505, 4, 47, 344, 19, 68, 173, 22, 35, + 24, 37, 352, 353, 354, 46, 153, 48, 155, 523, + 524, 525, 38, 443, 61, 62, 63, 64, 65, 66, + 42, 43, 44, 45, 46, 47, 48, 42, 50, 44, + 391, 392, 83, 84, 338, 339, 340, 398, 581, 153, + 159, 155, 585, 153, 159, 155, 152, 156, 4, 119, + 120, 38, 356, 357, 358, 22, 155, 153, 408, 409, + 410, 162, 4, 153, 152, 9, 416, 137, 138, 578, + 140, 141, 9, 143, 144, 145, 9, 427, 428, 383, + 9, 9, 9, 54, 60, 389, 56, 596, 152, 0, + 152, 152, 152, 443, 152, 11, 457, 458, 459, 460, + 404, 462, 463, 152, 22, 22, 152, 18, 19, 20, + 152, 22, 23, 24, 418, 419, 420, 421, 422, 30, + 31, 471, 426, 473, 162, 153, 476, 149, 150, 151, + 155, 152, 152, 483, 484, 152, 440, 7, 8, 155, + 51, 502, 503, 38, 55, 155, 155, 155, 59, 19, + 20, 155, 22, 23, 24, 331, 155, 4, 334, 335, + 464, 337, 38, 513, 514, 155, 516, 517, 344, 155, + 155, 521, 155, 155, 155, 155, 352, 353, 354, 38, + 155, 155, 532, 155, 488, 546, 22, 548, 549, 158, + 155, 155, 155, 155, 162, 499, 155, 155, 153, 17, + 17, 505, 155, 152, 155, 155, 4, 155, 155, 155, + 155, 515, 155, 563, 4, 155, 152, 22, 498, 523, + 524, 525, 4, 162, 155, 529, 0, 153, 153, 579, + 580, 155, 408, 409, 410, 155, 155, 26, 27, 153, + 416, 53, 155, 593, 18, 19, 20, 153, 22, 23, + 24, 427, 428, 153, 158, 160, 30, 31, 53, 153, + 153, 153, 17, 160, 4, 148, 616, 617, 152, 22, + 152, 621, 17, 17, 624, 155, 155, 51, 582, 17, + 630, 55, 73, 633, 17, 59, 569, 133, 133, 569, + 133, 93, 542, 234, 17, 471, 257, 473, 112, 106, + 476, 235, 268, 89, 56, 529, -1, 483, 484, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 257, 106, 17, 89, 513, 514, 268, - 516, 517, 56, 529, 415, 521, 3, 4, -1, -1, + 99, 100, 101, 415, -1, -1, -1, 513, 514, -1, + 516, 517, -1, -1, -1, 521, 3, 4, -1, -1, 7, 8, 9, -1, -1, -1, 532, -1, -1, -1, -1, -1, 19, 20, -1, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -2650,7 +2650,7 @@ 22, 152, 152, 206, 206, 206, 206, 206, 155, 162, 206, 206, 206, 235, 155, 235, 235, 235, 202, 200, 200, 155, 194, 155, 194, 235, 158, 155, 155, 155, - 155, 155, 155, 234, 235, 235, 38, 202, 200, 236, + 155, 155, 155, 235, 235, 235, 38, 202, 200, 236, 4, 137, 138, 139, 142, 146, 147, 190, 218, 219, 38, 160, 164, 200, 208, 162, 164, 155, 197, 39, 200, 224, 225, 155, 206, 206, 246, 155, 155, 155, @@ -3486,152 +3486,152 @@ switch (yyn) { case 29: -#line 1118 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1118 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1119 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1119 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1120 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1120 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1121 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1121 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1122 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1122 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1126 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1126 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1127 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1127 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1128 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1128 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1130 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1130 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1131 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1131 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1132 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1132 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1133 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1134 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1143 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1145 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} break; case 67: -#line 1146 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=0; ;} break; case 68: -#line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3639,7 +3639,7 @@ break; case 69: -#line 1154 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3647,7 +3647,7 @@ break; case 73: -#line 1162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3655,7 +3655,7 @@ break; case 74: -#line 1167 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3663,152 +3663,152 @@ break; case 75: -#line 1173 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 76: -#line 1174 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 77: -#line 1175 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 78: -#line 1176 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 79: -#line 1177 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1177 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 80: -#line 1181 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 81: -#line 1182 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 82: -#line 1183 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 83: -#line 1187 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 84: -#line 1188 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 85: -#line 1189 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 86: -#line 1190 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 87: -#line 1194 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 88: -#line 1195 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 89: -#line 1196 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 90: -#line 1200 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1200 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 91: -#line 1201 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 92: -#line 1202 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 93: -#line 1203 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 94: -#line 1204 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 95: -#line 1208 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 96: -#line 1209 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 97: -#line 1210 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 98: -#line 1213 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 99: -#line 1214 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 100: -#line 1215 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 101: -#line 1216 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 102: -#line 1217 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 103: -#line 1218 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 104: -#line 1219 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -3818,129 +3818,129 @@ break; case 105: -#line 1226 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 106: -#line 1227 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 107: -#line 1228 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1228 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 108: -#line 1229 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 109: -#line 1230 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::InReg; ;} break; case 110: -#line 1231 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} break; case 111: -#line 1232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} break; case 112: -#line 1233 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} break; case 113: -#line 1234 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::Nest; ;} break; case 114: -#line 1235 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} break; case 115: -#line 1239 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; case 116: -#line 1240 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; case 117: -#line 1245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} break; case 118: -#line 1246 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} break; case 119: -#line 1247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 120: -#line 1248 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 121: -#line 1249 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} break; case 122: -#line 1250 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} break; case 123: -#line 1253 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; case 124: -#line 1254 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; case 125: -#line 1259 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1259 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 126: -#line 1260 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); ;} break; case 127: -#line 1267 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 128: -#line 1268 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3950,12 +3950,12 @@ break; case 129: -#line 1274 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 130: -#line 1275 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3965,7 +3965,7 @@ break; case 131: -#line 1284 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') @@ -3976,27 +3976,27 @@ break; case 132: -#line 1292 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1292 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 133: -#line 1293 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; case 134: -#line 1298 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1298 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 135: -#line 1299 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 136: -#line 1300 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -4005,7 +4005,7 @@ break; case 137: -#line 1305 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); @@ -4015,7 +4015,7 @@ break; case 145: -#line 1321 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1321 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -4023,7 +4023,7 @@ break; case 146: -#line 1325 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1325 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR @@ -4031,7 +4031,7 @@ break; case 147: -#line 1329 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1329 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -4042,7 +4042,7 @@ break; case 148: -#line 1336 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -4051,7 +4051,7 @@ break; case 149: -#line 1341 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1341 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -4063,7 +4063,7 @@ break; case 150: -#line 1349 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1349 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4096,7 +4096,7 @@ break; case 151: -#line 1378 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1378 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4124,7 +4124,7 @@ break; case 152: -#line 1403 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1403 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); delete (yyvsp[(4) - (5)].TypeVal); @@ -4133,7 +4133,7 @@ break; case 153: -#line 1408 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1408 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) @@ -4147,7 +4147,7 @@ break; case 154: -#line 1418 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1418 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4161,7 +4161,7 @@ break; case 155: -#line 1428 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1428 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -4169,7 +4169,7 @@ break; case 156: -#line 1432 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1432 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4183,7 +4183,7 @@ break; case 157: -#line 1442 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1442 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR @@ -4191,7 +4191,7 @@ break; case 158: -#line 1449 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4201,7 +4201,7 @@ break; case 159: -#line 1458 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1458 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4212,14 +4212,14 @@ break; case 160: -#line 1465 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 161: -#line 1470 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1470 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4228,7 +4228,7 @@ break; case 162: -#line 1475 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1475 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR @@ -4236,7 +4236,7 @@ break; case 164: -#line 1483 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1483 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4247,7 +4247,7 @@ break; case 165: -#line 1490 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4258,7 +4258,7 @@ break; case 166: -#line 1497 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -4266,7 +4266,7 @@ break; case 167: -#line 1505 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1505 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4276,7 +4276,7 @@ break; case 168: -#line 1511 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1511 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4285,7 +4285,7 @@ break; case 169: -#line 1523 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4317,7 +4317,7 @@ break; case 170: -#line 1551 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1551 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4337,7 +4337,7 @@ break; case 171: -#line 1567 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1567 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4368,7 +4368,7 @@ break; case 172: -#line 1594 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1594 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4400,7 +4400,7 @@ break; case 173: -#line 1622 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1622 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4430,7 +4430,7 @@ break; case 174: -#line 1648 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1648 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4454,7 +4454,7 @@ break; case 175: -#line 1668 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1668 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4484,7 +4484,7 @@ break; case 176: -#line 1694 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1694 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4508,7 +4508,7 @@ break; case 177: -#line 1714 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1714 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4524,7 +4524,7 @@ break; case 178: -#line 1726 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4535,7 +4535,7 @@ break; case 179: -#line 1733 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4605,7 +4605,7 @@ break; case 180: -#line 1799 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1799 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4619,7 +4619,7 @@ break; case 181: -#line 1809 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1809 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4633,7 +4633,7 @@ break; case 182: -#line 1819 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1819 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4643,7 +4643,7 @@ break; case 183: -#line 1825 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4657,7 +4657,7 @@ break; case 184: -#line 1835 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1835 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4667,7 +4667,7 @@ break; case 185: -#line 1841 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1841 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4681,7 +4681,7 @@ break; case 186: -#line 1851 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1851 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getTrue(); @@ -4690,7 +4690,7 @@ break; case 187: -#line 1856 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getFalse(); @@ -4699,7 +4699,7 @@ break; case 188: -#line 1861 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1861 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4714,7 +4714,7 @@ break; case 189: -#line 1874 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1874 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4730,7 +4730,7 @@ break; case 190: -#line 1886 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1886 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4756,7 +4756,7 @@ break; case 191: -#line 1908 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1908 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4768,7 +4768,7 @@ break; case 192: -#line 1916 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -4778,7 +4778,7 @@ break; case 193: -#line 1922 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -4793,7 +4793,7 @@ break; case 194: -#line 1933 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -4802,7 +4802,7 @@ break; case 195: -#line 1938 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1938 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -4811,7 +4811,7 @@ break; case 196: -#line 1943 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1943 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -4821,7 +4821,7 @@ break; case 197: -#line 1949 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -4831,7 +4831,7 @@ break; case 198: -#line 1955 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1955 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -4841,7 +4841,7 @@ break; case 199: -#line 1964 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR @@ -4849,7 +4849,7 @@ break; case 200: -#line 1968 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1968 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -4858,27 +4858,27 @@ break; case 201: -#line 1976 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 202: -#line 1976 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 203: -#line 1979 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 204: -#line 1979 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 205: -#line 1982 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1982 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -4894,7 +4894,7 @@ break; case 206: -#line 1994 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1994 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -4910,7 +4910,7 @@ break; case 207: -#line 2015 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4919,7 +4919,7 @@ break; case 208: -#line 2020 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4928,12 +4928,12 @@ break; case 211: -#line 2033 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 212: -#line 2033 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -4941,26 +4941,26 @@ break; case 213: -#line 2037 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 214: -#line 2037 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 215: -#line 2040 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2040 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 216: -#line 2043 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2043 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -4988,7 +4988,7 @@ break; case 217: -#line 2067 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5003,7 +5003,7 @@ break; case 218: -#line 2079 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2079 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5015,14 +5015,14 @@ break; case 219: -#line 2086 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2086 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 220: -#line 2090 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2090 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5032,14 +5032,14 @@ break; case 221: -#line 2095 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2095 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 222: -#line 2099 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2099 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5050,7 +5050,7 @@ break; case 223: -#line 2105 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2105 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -5058,7 +5058,7 @@ break; case 224: -#line 2109 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5102,21 +5102,21 @@ break; case 225: -#line 2149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 226: -#line 2152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 227: -#line 2158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2158 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5129,7 +5129,7 @@ break; case 228: -#line 2168 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5137,7 +5137,7 @@ break; case 229: -#line 2172 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2172 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5145,7 +5145,7 @@ break; case 231: -#line 2179 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5154,7 +5154,7 @@ break; case 232: -#line 2184 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5163,14 +5163,14 @@ break; case 233: -#line 2189 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 234: -#line 2198 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5184,7 +5184,7 @@ break; case 235: -#line 2208 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5198,7 +5198,7 @@ break; case 236: -#line 2219 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR @@ -5206,7 +5206,7 @@ break; case 237: -#line 2223 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5219,7 +5219,7 @@ break; case 238: -#line 2232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5232,7 +5232,7 @@ break; case 239: -#line 2241 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -5240,7 +5240,7 @@ break; case 240: -#line 2247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! @@ -5371,7 +5371,7 @@ break; case 243: -#line 2377 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2377 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5383,7 +5383,7 @@ break; case 246: -#line 2388 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2388 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5391,7 +5391,7 @@ break; case 247: -#line 2393 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2393 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5402,7 +5402,7 @@ break; case 248: -#line 2405 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2405 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5410,7 +5410,7 @@ break; case 249: -#line 2409 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2409 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5418,7 +5418,7 @@ break; case 250: -#line 2414 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2414 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR @@ -5426,7 +5426,7 @@ break; case 251: -#line 2418 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2418 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR @@ -5434,7 +5434,7 @@ break; case 252: -#line 2422 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR @@ -5442,7 +5442,7 @@ break; case 253: -#line 2426 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2426 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -5450,7 +5450,7 @@ break; case 254: -#line 2430 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2430 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -5458,7 +5458,7 @@ break; case 255: -#line 2434 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2434 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -5466,7 +5466,7 @@ break; case 256: -#line 2438 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2438 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -5474,7 +5474,7 @@ break; case 257: -#line 2442 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2442 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -5482,7 +5482,7 @@ break; case 258: -#line 2446 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2446 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5511,7 +5511,7 @@ break; case 259: -#line 2471 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2471 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5519,7 +5519,7 @@ break; case 260: -#line 2475 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2475 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5529,7 +5529,7 @@ break; case 261: -#line 2485 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2485 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5537,7 +5537,7 @@ break; case 262: -#line 2489 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2489 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5545,7 +5545,7 @@ break; case 263: -#line 2493 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2493 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5554,7 +5554,7 @@ break; case 264: -#line 2498 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5563,7 +5563,7 @@ break; case 267: -#line 2511 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2511 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5574,7 +5574,7 @@ break; case 268: -#line 2520 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2520 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5583,7 +5583,7 @@ break; case 269: -#line 2525 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2525 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR @@ -5591,7 +5591,7 @@ break; case 270: -#line 2530 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5599,7 +5599,7 @@ break; case 271: -#line 2534 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2534 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5607,7 +5607,7 @@ break; case 272: -#line 2543 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -5619,7 +5619,7 @@ break; case 273: -#line 2552 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2552 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -5632,7 +5632,7 @@ break; case 274: -#line 2561 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2561 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0); CHECK_FOR_ERROR @@ -5640,7 +5640,7 @@ break; case 275: -#line 2565 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2565 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Only the unwind to block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal((yyvsp[(3) - (3)].ValIDVal))); CHECK_FOR_ERROR @@ -5648,7 +5648,7 @@ break; case 276: -#line 2569 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2569 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)), 0); delete (yyvsp[(1) - (1)].StrVal); @@ -5657,7 +5657,7 @@ break; case 277: -#line 2574 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (4)].StrVal)), getBBVal((yyvsp[(4) - (4)].ValIDVal))); delete (yyvsp[(1) - (4)].StrVal); @@ -5666,7 +5666,7 @@ break; case 278: -#line 2581 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2581 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -5677,7 +5677,7 @@ break; case 279: -#line 2588 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2588 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR @@ -5685,7 +5685,7 @@ break; case 280: -#line 2592 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2592 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -5694,7 +5694,7 @@ break; case 281: -#line 2597 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2597 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { assert(cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); @@ -5708,7 +5708,7 @@ break; case 282: -#line 2607 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2607 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -5731,7 +5731,7 @@ break; case 283: -#line 2626 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2626 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -5744,7 +5744,7 @@ break; case 284: -#line 2636 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2636 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -5832,7 +5832,7 @@ break; case 285: -#line 2720 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2720 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -5840,7 +5840,7 @@ break; case 286: -#line 2724 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2724 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -5848,7 +5848,7 @@ break; case 287: -#line 2731 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2731 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -5863,7 +5863,7 @@ break; case 288: -#line 2742 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2742 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -5879,7 +5879,7 @@ break; case 289: -#line 2755 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2755 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -5891,7 +5891,7 @@ break; case 290: -#line 2765 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2765 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -5906,7 +5906,7 @@ break; case 291: -#line 2776 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2776 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -5918,7 +5918,7 @@ break; case 292: -#line 2786 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2786 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -5933,7 +5933,7 @@ break; case 293: -#line 2797 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2797 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -5945,7 +5945,7 @@ break; case 294: -#line 2805 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2805 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -5959,7 +5959,7 @@ break; case 295: -#line 2815 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2815 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); @@ -5970,17 +5970,17 @@ break; case 296: -#line 2822 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2822 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 297: -#line 2825 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 298: -#line 2826 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -5989,7 +5989,7 @@ break; case 299: -#line 2833 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2833 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5997,7 +5997,7 @@ break; case 300: -#line 2837 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2837 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6005,7 +6005,7 @@ break; case 301: -#line 2842 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6025,7 +6025,7 @@ break; case 302: -#line 2858 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6046,7 +6046,7 @@ break; case 303: -#line 2875 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6064,7 +6064,7 @@ break; case 304: -#line 2889 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2889 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6082,7 +6082,7 @@ break; case 305: -#line 2903 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2903 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6098,7 +6098,7 @@ break; case 306: -#line 2915 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2915 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -6110,7 +6110,7 @@ break; case 307: -#line 2923 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2923 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6121,7 +6121,7 @@ break; case 308: -#line 2930 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6131,7 +6131,7 @@ break; case 309: -#line 2936 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2936 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6141,7 +6141,7 @@ break; case 310: -#line 2942 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2942 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6151,7 +6151,7 @@ break; case 311: -#line 2948 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6170,7 +6170,7 @@ break; case 312: -#line 2964 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6263,7 +6263,7 @@ break; case 313: -#line 3053 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3053 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6271,7 +6271,7 @@ break; case 314: -#line 3058 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3058 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6279,7 +6279,7 @@ break; case 315: -#line 3062 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3062 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6287,7 +6287,7 @@ break; case 316: -#line 3069 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3069 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6298,7 +6298,7 @@ break; case 317: -#line 3076 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3076 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6310,7 +6310,7 @@ break; case 318: -#line 3084 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3084 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6321,7 +6321,7 @@ break; case 319: -#line 3091 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3091 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6333,7 +6333,7 @@ break; case 320: -#line 3099 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3099 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6344,7 +6344,7 @@ break; case 321: -#line 3107 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3107 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6362,7 +6362,7 @@ break; case 322: -#line 3121 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6383,7 +6383,7 @@ break; case 323: -#line 3138 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) @@ -6395,7 +6395,7 @@ break; case 324: -#line 3146 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6629,7 +6629,7 @@ } -#line 3163 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3163 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=50175&r1=50174&r2=50175&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Wed Apr 23 15:11:27 2008 @@ -346,7 +346,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 950 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y" +#line 950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=50175&r1=50174&r2=50175&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Wed Apr 23 15:11:27 2008 @@ -3135,7 +3135,7 @@ $$ = new StoreInst($3, tmpVal, $1, $7); delete $5; } -| GETRESULT Types SymbolicValueRef ',' EUINT64VAL { +| GETRESULT Types ValueRef ',' EUINT64VAL { Value *TmpVal = getVal($2->get(), $3); if (!GetResultInst::isValidOperands(TmpVal, $5)) GEN_ERROR("Invalid getresult operands"); Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=50175&r1=50174&r2=50175&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Wed Apr 23 15:11:27 2008 @@ -3135,7 +3135,7 @@ $$ = new StoreInst($3, tmpVal, $1, $7); delete $5; } -| GETRESULT Types SymbolicValueRef ',' EUINT64VAL { +| GETRESULT Types ValueRef ',' EUINT64VAL { Value *TmpVal = getVal($2->get(), $3); if (!GetResultInst::isValidOperands(TmpVal, $5)) GEN_ERROR("Invalid getresult operands"); From kremenek at apple.com Wed Apr 23 15:13:26 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 23 Apr 2008 20:13:26 -0000 Subject: [llvm-commits] [llvm] r50177 - /llvm/tags/checker/checker-0011/ Message-ID: <200804232013.m3NKDQcs000615@zion.cs.uiuc.edu> Author: kremenek Date: Wed Apr 23 15:13:25 2008 New Revision: 50177 URL: http://llvm.org/viewvc/llvm-project?rev=50177&view=rev Log: Tagging checker-0011. Added: llvm/tags/checker/checker-0011/ - copied from r50176, llvm/trunk/ From dpatel at apple.com Wed Apr 23 15:18:29 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Apr 2008 20:18:29 -0000 Subject: [llvm-commits] [llvm] r50179 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Message-ID: <200804232018.m3NKITsS000869@zion.cs.uiuc.edu> Author: dpatel Date: Wed Apr 23 15:18:29 2008 New Revision: 50179 URL: http://llvm.org/viewvc/llvm-project?rev=50179&view=rev Log: Check type instead of no. of operands. Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=50179&r1=50178&r2=50179&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Wed Apr 23 15:18:29 2008 @@ -456,7 +456,7 @@ // uses of the returned value. if (!TheCall->use_empty()) { ReturnInst *R = Returns[0]; - if (R->getNumOperands() > 1) { + if (isa(TheCall->getType())) { // Multiple return values. while (!TheCall->use_empty()) { GetResultInst *GR = cast(TheCall->use_back()); From gohman at apple.com Wed Apr 23 15:21:29 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 20:21:29 -0000 Subject: [llvm-commits] [llvm] r50180 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/Generic/getresult-undef.ll Message-ID: <200804232021.m3NKLTaD000971@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 15:21:29 2008 New Revision: 50180 URL: http://llvm.org/viewvc/llvm-project?rev=50180&view=rev Log: Add support to codegen for getresult instructions with undef operands. Added: llvm/trunk/test/CodeGen/Generic/getresult-undef.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50180&r1=50179&r2=50180&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 23 15:21:29 2008 @@ -3311,8 +3311,13 @@ void SelectionDAGLowering::visitGetResult(GetResultInst &I) { - SDOperand Call = getValue(I.getOperand(0)); - setValue(&I, SDOperand(Call.Val, I.getIndex())); + if (UndefValue *UV = dyn_cast(I.getOperand(0))) { + SDOperand Undef = DAG.getNode(ISD::UNDEF, TLI.getValueType(I.getType())); + setValue(&I, Undef); + } else { + SDOperand Call = getValue(I.getOperand(0)); + setValue(&I, SDOperand(Call.Val, I.getIndex())); + } } Added: llvm/trunk/test/CodeGen/Generic/getresult-undef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/getresult-undef.ll?rev=50180&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/getresult-undef.ll (added) +++ llvm/trunk/test/CodeGen/Generic/getresult-undef.ll Wed Apr 23 15:21:29 2008 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc + +define double @foo() { + %t = getresult {double, double} undef, 1 + ret double %t +} From gohman at apple.com Wed Apr 23 15:25:16 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 20:25:16 -0000 Subject: [llvm-commits] [llvm] r50181 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200804232025.m3NKPH0K001079@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 15:25:16 2008 New Revision: 50181 URL: http://llvm.org/viewvc/llvm-project?rev=50181&view=rev Log: Use isa instead of dyn_cast. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50181&r1=50180&r2=50181&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 23 15:25:16 2008 @@ -3311,7 +3311,7 @@ void SelectionDAGLowering::visitGetResult(GetResultInst &I) { - if (UndefValue *UV = dyn_cast(I.getOperand(0))) { + if (isa(I.getOperand(0))) { SDOperand Undef = DAG.getNode(ISD::UNDEF, TLI.getValueType(I.getType())); setValue(&I, Undef); } else { From sabre at nondot.org Wed Apr 23 15:33:42 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Apr 2008 20:33:42 -0000 Subject: [llvm-commits] [llvm] r50182 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200804232033.m3NKXgo2001317@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 15:33:41 2008 New Revision: 50182 URL: http://llvm.org/viewvc/llvm-project?rev=50182&view=rev Log: tighten up verifier checks which missed cases where return instrs operands didn't match up with function results. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=50182&r1=50181&r2=50182&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Apr 23 15:33:41 2008 @@ -592,22 +592,23 @@ void Verifier::visitReturnInst(ReturnInst &RI) { Function *F = RI.getParent()->getParent(); unsigned N = RI.getNumOperands(); - if (N == 0) - Assert2(F->getReturnType() == Type::VoidTy, + if (F->getReturnType() == Type::VoidTy) + Assert2(N == 0, "Found return instr that returns void in Function of non-void " "return type!", &RI, F->getReturnType()); else if (const StructType *STy = dyn_cast(F->getReturnType())) { - for (unsigned i = 0; i < N; i++) + Assert2(STy->getNumElements() == N, + "Incorrect number of return values in ret instruction!", + &RI, F->getReturnType()); + for (unsigned i = 0; i != N; ++i) Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(), "Function return type does not match operand " "type of return inst!", &RI, F->getReturnType()); - } - else if (N == 1) - Assert2(F->getReturnType() == RI.getOperand(0)->getType(), + } else { + Assert2(N == 1 && F->getReturnType() == RI.getOperand(0)->getType(), "Function return type does not match operand " "type of return inst!", &RI, F->getReturnType()); - else - Assert1(0, "Invalid return type!", &RI); + } // Check to make sure that the return value has necessary properties for // terminators... From edwintorok at gmail.com Wed Apr 23 15:58:44 2008 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Wed, 23 Apr 2008 23:58:44 +0300 Subject: [llvm-commits] Teach SCEV about {X,*,Y} recursions Message-ID: <480FA304.2060406@gmail.com> Hi, I have a patch that adds support for exponential recursions in loops. This is useful in static analysis tools, and also for code optimization. For example unsigned n = 15; unsigned p=1; while(n-- > 0) { p *= a; } can be turned into this code (which uses only 6 multiplications) entry: br label %bb4.i bb.i: ; preds = %bb4.i %tmp3.i = mul i32 %p.0.i, %a ; [#uses=1] %indvar.next = add i32 %indvar.i, 1 ; [#uses=1] br label %bb4.i bb4.i: ; preds = %bb.i, %entry %indvar.i = phi i32 [ 0, %entry ], [ %indvar.next, %bb.i ] ; [#uses=2] %p.0.i = phi i32 [ 1, %entry ], [ %tmp3.i, %bb.i ] ; [#uses=1] %exitcond = icmp eq i32 %indvar.i, 15 ; [#uses=1] br i1 %exitcond, label %naive_pow.exit, label %bb.i naive_pow.exit: ; preds = %bb4.i %tmp = mul i32 %a, %a ; [#uses=3] %tmp1 = mul i32 %a, %tmp ; [#uses=1] %tmp2 = mul i32 %tmp, %tmp ; [#uses=3] %tmp3 = mul i32 %tmp1, %tmp2 ; [#uses=1] %tmp4 = mul i32 %tmp2, %tmp2 ; [#uses=1] %tmp5 = mul i32 %tmp3, %tmp4 ; [#uses=1] br label %return return: ; preds = %naive_pow.exit ret i32 %tmp5 } The no. of multiplications is not optimal (it would be 5 in this case) but this algorithm works for any constant power. The patch is almost complete (I lack only codegen for non-constant powers), can you please review it, and send me feedback on it? P.S.: it currently fails test/Analysis/ScalarEvolution/mulrec_expand_bug.ll until I implement codegen for non-constant powers, so I don't intend to commit it until it is finished. Best regards, --Edwin -------------- next part -------------- A non-text attachment was scrubbed... Name: scev_mulrec.patch Type: text/x-diff Size: 28334 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080423/6ff10ea6/attachment.bin From criswell at uiuc.edu Wed Apr 23 16:16:02 2008 From: criswell at uiuc.edu (John Criswell) Date: Wed, 23 Apr 2008 21:16:02 -0000 Subject: [llvm-commits] [poolalloc] r50183 - in /poolalloc/trunk/lib/PoolAllocate: PASimple.cpp PoolAllocate.cpp Message-ID: <200804232116.m3NLG2Ti002708@zion.cs.uiuc.edu> Author: criswell Date: Wed Apr 23 16:16:02 2008 New Revision: 50183 URL: http://llvm.org/viewvc/llvm-project?rev=50183&view=rev Log: Qualify make_pair() with the namespace. Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=50183&r1=50182&r2=50183&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Wed Apr 23 16:16:02 2008 @@ -121,7 +121,7 @@ // Create a silly Function Info structure for this function. // FuncInfo FInfo(F); - FunctionInfo.insert (make_pair(&F, FInfo)); + FunctionInfo.insert (std::make_pair(&F, FInfo)); // // Get the DSGraph for this function. @@ -133,7 +133,7 @@ if (MallocInst * MI = dyn_cast(ii)) { // Associate the global pool decriptor with the DSNode DSNode * Node = ECG.getNodeForValue(MI).getNode(); - FInfo.PoolDescriptors.insert(make_pair(Node,TheGlobalPool)); + FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool)); // Mark the malloc as an instruction to delete toDelete.push_back(ii); @@ -161,7 +161,7 @@ } else if (AllocaInst * AI = dyn_cast(ii)) { #if 0 DSNode * Node = ECG.getNodeForValue(AI).getNode(); - FInfo.PoolDescriptors.insert(make_pair(Node,TheGlobalPool)); + FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool)); toDelete.push_back(ii); //Fixme: fixup size Value* args[] = {TheGlobalPool, ii->getOperand(0)}; @@ -179,7 +179,7 @@ if (CF && (CF->isDeclaration()) && (CF->getName() == "realloc")) { // Associate the global pool decriptor with the DSNode DSNode * Node = ECG.getNodeForValue(CI).getNode(); - FInfo.PoolDescriptors.insert(make_pair(Node,TheGlobalPool)); + FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool)); // Mark the realloc as an instruction to delete toDelete.push_back(ii); @@ -220,7 +220,7 @@ } else if (CF && (CF->isDeclaration()) && (CF->getName() == "calloc")) { // Associate the global pool decriptor with the DSNode DSNode * Node = ECG.getNodeForValue(CI).getNode(); - FInfo.PoolDescriptors.insert(make_pair(Node,TheGlobalPool)); + FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool)); // Mark the realloc as an instruction to delete toDelete.push_back(ii); @@ -262,7 +262,7 @@ } else if (CF && (CF->isDeclaration()) && (CF->getName() == "strdup")) { // Associate the global pool decriptor with the DSNode DSNode * Node = ECG.getNodeForValue(CI).getNode(); - FInfo.PoolDescriptors.insert(make_pair(Node,TheGlobalPool)); + FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool)); // Mark the realloc as an instruction to delete toDelete.push_back(ii); Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=50183&r1=50182&r2=50183&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Wed Apr 23 16:16:02 2008 @@ -40,9 +40,6 @@ using namespace llvm; using namespace PA; -#ifdef SAFECODE -using namespace CUA; -#endif char PoolAllocate::ID = 0; char PoolAllocatePassAllPools::ID = 0; @@ -111,11 +108,6 @@ bool PoolAllocate::runOnModule(Module &M) { if (M.begin() == M.end()) return false; -#ifdef SAFECODE -#if 0 - CUAPass = &getAnalysis(); -#endif -#endif CurModule = &M; ECGraphs = &getAnalysis(); // folded inlined CBU graphs if (UseTDResolve) From criswell at uiuc.edu Wed Apr 23 16:16:51 2008 From: criswell at uiuc.edu (John Criswell) Date: Wed, 23 Apr 2008 21:16:51 -0000 Subject: [llvm-commits] [poolalloc] r50184 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/DSA/Local.cpp Message-ID: <200804232116.m3NLGpoC002745@zion.cs.uiuc.edu> Author: criswell Date: Wed Apr 23 16:16:51 2008 New Revision: 50184 URL: http://llvm.org/viewvc/llvm-project?rev=50184&view=rev Log: Fixed inconsistent types. Removed inclusion of SAFECode header files. Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/DSA/Local.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=50184&r1=50183&r2=50184&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Wed Apr 23 16:16:51 2008 @@ -23,19 +23,13 @@ #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/ADT/hash_set" +#include "dsa/DataStructure.h" #include "poolalloc/Config/config.h" -#ifdef SAFECODE -#include "ConvertUnsafeAllocas.h" -#endif - - #include +#include namespace llvm { -#ifdef SAFECODE - using namespace CUA; -#endif class DSNode; class DSGraph; class Type; @@ -136,8 +130,8 @@ virtual Value * getGlobalPool (const DSNode * Node) {return 0;} - virtual CompleteBUDataStructures::callee_iterator callee_begin (CallInst *CI) { return ECGraphs->callee_begin(CI);} - virtual CompleteBUDataStructures::callee_iterator callee_end (CallInst *CI) { return ECGraphs->callee_end(CI);} + virtual CompleteBUDataStructures::callee_iterator callee_begin (Instruction *I) { return ECGraphs->callee_begin(I);} + virtual CompleteBUDataStructures::callee_iterator callee_end (Instruction *I) { return ECGraphs->callee_end(I);} }; /// PoolAllocate - The main pool allocation pass @@ -155,9 +149,6 @@ std::map CloneToOrigMap; public: -#ifdef SAFECODE - ConvertUnsafeAllocas *CUAPass; -#endif Constant *PoolInit, *PoolDestroy, *PoolAlloc, *PoolRealloc, *PoolMemAlign; Constant *PoolFree; Constant *PoolCalloc; @@ -273,13 +264,13 @@ } virtual CompleteBUDataStructures::callee_iterator - callee_begin (CallInst * CI) { - return ECGraphs->callee_begin(CI); + callee_begin (Instruction * I) { + return ECGraphs->callee_begin(I); } virtual CompleteBUDataStructures::callee_iterator - callee_end (CallInst * CI) { - return ECGraphs->callee_end(CI); + callee_end (Instruction * I) { + return ECGraphs->callee_end(I); } protected: @@ -371,7 +362,7 @@ /// it doesn't involve all of complex machinery of the original pool allocation /// implementation. class PoolAllocateSimple : public PoolAllocate { - GlobalValue* TheGlobalPool; + Value * TheGlobalPool; public: static char ID; PoolAllocateSimple() : PoolAllocate(false, (intptr_t)&ID) {} Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=50184&r1=50183&r2=50184&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Wed Apr 23 16:16:51 2008 @@ -580,7 +580,7 @@ case Intrinsic::eh_exception: { DSNode * Node = createNode(); - Node->setIncompleteMarker(); + //Node->setIncompleteMarker(); Node->foldNodeCompletely(); setDestTo (*(CS.getInstruction()), Node); return true; From criswell at uiuc.edu Wed Apr 23 16:24:38 2008 From: criswell at uiuc.edu (John Criswell) Date: Wed, 23 Apr 2008 21:24:38 -0000 Subject: [llvm-commits] [poolalloc] r50185 - in /poolalloc/trunk: Makefile.common.in autoconf/configure.ac configure Message-ID: <200804232124.m3NLOddp002989@zion.cs.uiuc.edu> Author: criswell Date: Wed Apr 23 16:24:38 2008 New Revision: 50185 URL: http://llvm.org/viewvc/llvm-project?rev=50185&view=rev Log: Spring cleaning: removed circular dependency on the SAFECode project when enabling the SAFECode defaults. The --with-safecodesrc related configure options are now gone. Modified: poolalloc/trunk/Makefile.common.in poolalloc/trunk/autoconf/configure.ac poolalloc/trunk/configure Modified: poolalloc/trunk/Makefile.common.in URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/Makefile.common.in?rev=50185&r1=50184&r2=50185&view=diff ============================================================================== --- poolalloc/trunk/Makefile.common.in (original) +++ poolalloc/trunk/Makefile.common.in Wed Apr 23 16:24:38 2008 @@ -19,16 +19,6 @@ # Set the root directory of this project's install prefix PROJ_INSTALL_ROOT := @prefix@ -# Location of SAFECode source tree -SAFECODE_SRC_ROOT := @SAFECODESRC@ -SAFECODE_OBJ_ROOT := @SAFECODEOBJ@ - -# All of the code should additionally look inside the pool allocation source -# code for include files -CFLAGS += -I$(SAFECODE_SRC_ROOT)/include -I$(SAFECODE_OBJ_ROOT)/include -CXXFLAGS += -I$(SAFECODE_SRC_ROOT)/include -I$(SAFECODE_OBJ_ROOT)/include -CPPFLAGS += -I$(SAFECODE_SRC_ROOT)/include -I$(SAFECODE_OBJ_ROOT)/include - # Include LLVM's Master Makefile. include $(LLVM_SRC_ROOT)/Makefile.common Modified: poolalloc/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/autoconf/configure.ac?rev=50185&r1=50184&r2=50185&view=diff ============================================================================== --- poolalloc/trunk/autoconf/configure.ac (original) +++ poolalloc/trunk/autoconf/configure.ac Wed Apr 23 16:24:38 2008 @@ -90,10 +90,6 @@ dnl * Set the location of various third-party software packages dnl ************************************************************************** -dnl Location of SAFECode -AC_ARG_WITH(safecodesrc,AS_HELP_STRING(--with-safecodesrc,Location of SAFECode Source Code),AC_SUBST(SAFECODESRC,[$withval]),AC_SUBST(SAFECODESRC,[`cd ../safecode; pwd`])) -AC_ARG_WITH(safecodeobj,AS_HELP_STRING(--with-safecodeobj,Location of SAFECode Object Code),AC_SUBST(SAFECODEOBJ,[$withval]),AC_SUBST(SAFECODEOBJ,[`cd ../safecode; pwd`])) - dnl ************************************************************************** dnl * Create the output files dnl ************************************************************************** Modified: poolalloc/trunk/configure URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/configure?rev=50185&r1=50184&r2=50185&view=diff ============================================================================== --- poolalloc/trunk/configure (original) +++ poolalloc/trunk/configure Wed Apr 23 16:24:38 2008 @@ -311,7 +311,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE SAFECODESRC SAFECODEOBJ LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -854,8 +854,6 @@ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-llvmsrc Location of LLVM Source Code --with-llvmobj Location of LLVM Object Code - --with-safecodesrc Location of SAFECode Source Code - --with-safecodeobj Location of SAFECode Object Code Some influential environment variables: CC C compiler command @@ -3665,27 +3663,6 @@ fi; - -# Check whether --with-safecodesrc or --without-safecodesrc was given. -if test "${with_safecodesrc+set}" = set; then - withval="$with_safecodesrc" - SAFECODESRC=$withval - -else - SAFECODESRC=`cd ../safecode; pwd` - -fi; - -# Check whether --with-safecodeobj or --without-safecodeobj was given. -if test "${with_safecodeobj+set}" = set; then - withval="$with_safecodeobj" - SAFECODEOBJ=$withval - -else - SAFECODEOBJ=`cd ../safecode; pwd` - -fi; - ac_config_headers="$ac_config_headers include/poolalloc/Config/config.h" @@ -4330,8 +4307,6 @@ s, at CPP@,$CPP,;t t s, at EGREP@,$EGREP,;t t s, at MMAP_FILE@,$MMAP_FILE,;t t -s, at SAFECODESRC@,$SAFECODESRC,;t t -s, at SAFECODEOBJ@,$SAFECODEOBJ,;t t s, at LIBOBJS@,$LIBOBJS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t CEOF From criswell at uiuc.edu Wed Apr 23 16:25:38 2008 From: criswell at uiuc.edu (John Criswell) Date: Wed, 23 Apr 2008 21:25:38 -0000 Subject: [llvm-commits] [poolalloc] r50186 - /poolalloc/trunk/lib/DSA/Local.cpp Message-ID: <200804232125.m3NLPcco003023@zion.cs.uiuc.edu> Author: criswell Date: Wed Apr 23 16:25:38 2008 New Revision: 50186 URL: http://llvm.org/viewvc/llvm-project?rev=50186&view=rev Log: Undo erroneous commit. Modified: poolalloc/trunk/lib/DSA/Local.cpp Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=50186&r1=50185&r2=50186&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Wed Apr 23 16:25:38 2008 @@ -580,7 +580,7 @@ case Intrinsic::eh_exception: { DSNode * Node = createNode(); - //Node->setIncompleteMarker(); + Node->setIncompleteMarker(); Node->foldNodeCompletely(); setDestTo (*(CS.getInstruction()), Node); return true; From clattner at apple.com Wed Apr 23 16:38:28 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Apr 2008 14:38:28 -0700 Subject: [llvm-commits] [llvm] r50174 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> References: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> Message-ID: <1B2779CA-848F-4DFB-8997-27FC12D8C740@apple.com> Very nice, thanks Dale! -Chris On Apr 23, 2008, at 11:34 AM, Dale Johannesen wrote: > Author: johannes > Date: Wed Apr 23 13:34:37 2008 > New Revision: 50174 > > URL: http://llvm.org/viewvc/llvm-project?rev=50174&view=rev > Log: > Rewrite previous patch to suit Chris's preference. > > > Modified: > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50174&r1=50173&r2=50174&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed > Apr 23 13:34:37 2008 > @@ -8694,6 +8694,31 @@ > return visitCallSite(&II); > } > > +// If this cast does not affect the value passed through the varargs > +// area, we can eliminate the use of the cast. > +static bool isSafeToEliminateVarargsCast(const CallSite CS, > + const CastInst * const CI, > + const TargetData * const TD, > + const int ix) { > + if (!CI->isLosslessCast()) > + return false; > + > + // The size of ByVal arguments is derived from the type, so we > + // can't change to a type with a different size. If the size were > + // passed explicitly we could avoid this check. > + if (!CS.paramHasAttr(ix, ParamAttr::ByVal)) > + return true; > + > + const Type* SrcTy = > + cast(CI->getOperand(0)->getType())- > >getElementType(); > + const Type* DstTy = cast(CI->getType())- > >getElementType(); > + if (!SrcTy->isSized() || !DstTy->isSized()) > + return false; > + if (TD->getABITypeSize(SrcTy) != TD->getABITypeSize(DstTy)) > + return false; > + return true; > +} > + > // visitCallSite - Improvements for call and invoke instructions. > // > Instruction *InstCombiner::visitCallSite(CallSite CS) { > @@ -8752,28 +8777,13 @@ > // See if we can optimize any arguments passed through the > varargs area of > // the call. > for (CallSite::arg_iterator I = CS.arg_begin()+FTy- > >getNumParams(), > - E = CS.arg_end(); I != E; ++I, ++ix) > - if (CastInst *CI = dyn_cast(*I)) { > - // If this cast does not affect the value passed through > the varargs > - // area, we can eliminate the use of the cast. > - const PointerType* SrcPTy, *DstPTy; > - if (CI->isLosslessCast()) { > - // The size of ByVal arguments is derived from the type, > so we > - // can't change to a type with a different size. If the > size were > - // passed explicitly we could avoid this check. > - if (CS.paramHasAttr(ix, ParamAttr::ByVal) && > - (SrcPTy = cast(CI->getOperand(0)- > >getType())) && > - (DstPTy = cast(CI->getType()))) { > - const Type* SrcTy = SrcPTy->getElementType(); > - const Type* DstTy = DstPTy->getElementType(); > - if (!SrcTy->isSized() || !DstTy->isSized() || > - TD->getABITypeSize(SrcTy) != TD- > >getABITypeSize(DstTy)) > - continue; > - } > - *I = CI->getOperand(0); > - Changed = true; > - } > + E = CS.arg_end(); I != E; ++I, ++ix) { > + CastInst *CI = dyn_cast(*I); > + if (CI && isSafeToEliminateVarargsCast(CS, CI, TD, ix)) { > + *I = CI->getOperand(0); > + Changed = true; > } > + } > } > > if (isa(Callee) && !CS.doesNotThrow()) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Apr 23 16:47:30 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Apr 2008 14:47:30 -0700 Subject: [llvm-commits] Teach SCEV about {X,*,Y} recursions In-Reply-To: <480FA304.2060406@gmail.com> References: <480FA304.2060406@gmail.com> Message-ID: <8860430B-8F9B-46FA-91AF-C3298A261183@apple.com> On Apr 23, 2008, at 1:58 PM, T?r?k Edwin wrote: > Hi, > > I have a patch that adds support for exponential recursions in loops. > This is useful in static analysis tools, and also for code > optimization. This is interesting, but a couple questions: 1) What sort of code does this really help with in practice? I'm a bit afraid of adding a bunch of complexity to SCEV analysis if it is unlikely to be useful for broad code. Do you see power sequences indexing arrays for example? 2) instead of having SCEVExpander::visitPowExpr emit multiplies, it should emit a call to llvm.powi. 3) It would be really nice to teach the code generator to lower llvm.powi nicer, particularly before something like this patch goes in. Our current lowering of powi is pretty naive. -Chris From gohman at apple.com Wed Apr 23 16:49:30 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 21:49:30 -0000 Subject: [llvm-commits] [llvm] r50187 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp Message-ID: <200804232149.m3NLnUus003965@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 16:49:29 2008 New Revision: 50187 URL: http://llvm.org/viewvc/llvm-project?rev=50187&view=rev Log: Initial CBE support for multiple return values. Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=50187&r1=50186&r2=50187&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Apr 23 16:49:29 2008 @@ -283,6 +283,7 @@ void visitInsertElementInst(InsertElementInst &I); void visitExtractElementInst(ExtractElementInst &I); void visitShuffleVectorInst(ShuffleVectorInst &SVI); + void visitGetResultInst(GetResultInst &GRI); void visitInstruction(Instruction &I) { cerr << "C Writer does not know about " << I; @@ -2174,6 +2175,24 @@ return; } + if (I.getNumOperands() > 1) { + Out << " {\n"; + Out << " "; + printType(Out, I.getParent()->getParent()->getReturnType()); + Out << " llvm_cbe_mrv_temp = {\n"; + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { + Out << " "; + writeOperand(I.getOperand(i)); + if (i != e - 1) + Out << ","; + Out << "\n"; + } + Out << " };\n"; + Out << " return llvm_cbe_mrv_temp;\n"; + Out << " }\n"; + return; + } + Out << " return"; if (I.getNumOperands()) { Out << ' '; @@ -3184,6 +3203,17 @@ Out << "}"; } +void CWriter::visitGetResultInst(GetResultInst &GRI) { + Out << "("; + if (isa(GRI.getOperand(0))) { + Out << "("; + printType(Out, GRI.getType()); + Out << ") 0/*UNDEF*/"; + } else { + Out << GetValueName(GRI.getOperand(0)) << ".field" << GRI.getIndex(); + } + Out << ")"; +} //===----------------------------------------------------------------------===// // External Interface declaration From dpatel at apple.com Wed Apr 23 17:01:33 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Apr 2008 15:01:33 -0700 Subject: [llvm-commits] [llvm] r50187 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp In-Reply-To: <200804232149.m3NLnUus003965@zion.cs.uiuc.edu> References: <200804232149.m3NLnUus003965@zion.cs.uiuc.edu> Message-ID: <5638CADC-51E7-45F6-9B29-8904FC204AEE@apple.com> Dan, Thanks! - Devang On Apr 23, 2008, at 2:49 PM, Dan Gohman wrote: > Author: djg > Date: Wed Apr 23 16:49:29 2008 > New Revision: 50187 > > URL: http://llvm.org/viewvc/llvm-project?rev=50187&view=rev > Log: > Initial CBE support for multiple return values. > > Modified: > llvm/trunk/lib/Target/CBackend/CBackend.cpp > > Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=50187&r1=50186&r2=50187&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) > +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Apr 23 16:49:29 > 2008 > @@ -283,6 +283,7 @@ > void visitInsertElementInst(InsertElementInst &I); > void visitExtractElementInst(ExtractElementInst &I); > void visitShuffleVectorInst(ShuffleVectorInst &SVI); > + void visitGetResultInst(GetResultInst &GRI); > > void visitInstruction(Instruction &I) { > cerr << "C Writer does not know about " << I; > @@ -2174,6 +2175,24 @@ > return; > } > > + if (I.getNumOperands() > 1) { > + Out << " {\n"; > + Out << " "; > + printType(Out, I.getParent()->getParent()->getReturnType()); > + Out << " llvm_cbe_mrv_temp = {\n"; > + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { > + Out << " "; > + writeOperand(I.getOperand(i)); > + if (i != e - 1) > + Out << ","; > + Out << "\n"; > + } > + Out << " };\n"; > + Out << " return llvm_cbe_mrv_temp;\n"; > + Out << " }\n"; > + return; > + } > + > Out << " return"; > if (I.getNumOperands()) { > Out << ' '; > @@ -3184,6 +3203,17 @@ > Out << "}"; > } > > +void CWriter::visitGetResultInst(GetResultInst &GRI) { > + Out << "("; > + if (isa(GRI.getOperand(0))) { > + Out << "("; > + printType(Out, GRI.getType()); > + Out << ") 0/*UNDEF*/"; > + } else { > + Out << GetValueName(GRI.getOperand(0)) << ".field" << > GRI.getIndex(); > + } > + Out << ")"; > +} > > // > = > = > = > ----------------------------------------------------------------------= > ==// > // External Interface declaration > > > _______________________________________________ > 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 Wed Apr 23 17:12:52 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Apr 2008 15:12:52 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> Message-ID: <5609D195-B9A0-4928-92EE-5F04C4387328@apple.com> On Apr 23, 2008, at 10:27 AM, Roman Levenstein wrote: > Hi, > > 2008/4/23 Evan Cheng : >> Very nice! > >> Please run it through MultiSource and SingleSource tests. > Will do. > >> Dan and I will run it through External tests. > Very nice. > >> If it shows no regression and llvm- gcc bootstrapping works. Then >> please check it in. > > Just to make it clear: > This patch is applied currently to the output of Tablegen. > But the proper patch will need to change the Tablegen to generate > correct *.inc files. > Thinking about it, I have a question: > Right now, the beginning of the generrated instruction selector files > is always the same, independent of the *.td file and target > architecture. > But it is generated by tablegen still and therefore cannot be > substituted easily, without changing the tablegen. > Question: May be it is better to define this common part in an include > file, e.g. ISelHeader.h, and then tablegen would generate only the > #include line. What do you think? That's a good idea. Evan > > > -Roman > >> On Apr 23, 2008, at 12:35 AM, Roman Levenstein wrote: >> >>> >>> >>>> In addition to regular testing, since this patch doesn't modify any >>>> heuristics, it should be possible to compare assembly output >>>> between an unmodified compiler and one with this patch applied. >>>> Can you verify that this patch doesn't change any output on some >>>> interesting testcases? >>> >>> I tried it with Kimwitu, which is a very big and complex test-case. >>> All approaches produce exactly the same assembler code. On my >>> test-cases with very big BBs it also produces exactly the same >>> results. >>> >>> For the sake of comparison, here are also some time statistics for >>> the >>> compilation of Kimwitu, measured by means of the Linux "time" >>> command: >>> >>> Current LLVM approach: >>> real 1m51.464s >>> user 1m21.161s >>> sys 0m8.529s >>> >>> std::set approach: >>> real 1m37.938s (13% faster than current LLVM implementation) >>> user 1m16.169s >>> sys 0m7.732s >>> >>> NO_QUEUE approach: >>> real 1m29.548s (20% faster than current LLVM implementation) >>> user 1m14.949s >>> sys 0m7.824s >>> >>> >>> -Roman > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicolas.geoffray at lip6.fr Wed Apr 23 17:24:08 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 23 Apr 2008 22:24:08 -0000 Subject: [llvm-commits] [vmkit] r50188 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaInitialise.cpp JavaMetaJIT.cpp JavaObject.h Message-ID: <200804232224.m3NMO9TV005040@zion.cs.uiuc.edu> Author: geoffray Date: Wed Apr 23 17:24:08 2008 New Revision: 50188 URL: http://llvm.org/viewvc/llvm-project?rev=50188&view=rev Log: Don't count on C++ to fake Java virtual table. Just use a custom allocated one. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=50188&r1=50187&r2=50188&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Wed Apr 23 17:24:08 2008 @@ -39,17 +39,6 @@ X::VT = ((void**)(void*)(&fake))[0]; } INIT(JavaArray); - INIT(ArrayUInt8); - INIT(ArraySInt8); - INIT(ArrayUInt16); - INIT(ArraySInt16); - INIT(ArrayUInt32); - INIT(ArraySInt32); - INIT(ArrayLong); - INIT(ArrayFloat); - INIT(ArrayDouble); - INIT(ArrayObject); - INIT(UTF8); INIT(Attribut); INIT(CommonClass); INIT(Class); @@ -82,6 +71,24 @@ INIT(Enveloppe); #undef INIT +#define INIT(X) { \ + X fake; \ + void* V = ((void**)(void*)(&fake))[0]; \ + X::VT = (VirtualTable*)malloc(12 * sizeof(void*) + VT_SIZE); \ + memcpy(X::VT, V, VT_SIZE); } + + INIT(ArrayUInt8); + INIT(ArraySInt8); + INIT(ArrayUInt16); + INIT(ArraySInt16); + INIT(ArrayUInt32); + INIT(ArraySInt32); + INIT(ArrayLong); + INIT(ArrayFloat); + INIT(ArrayDouble); + INIT(ArrayObject); + INIT(UTF8); +#undef INIT } static void initialiseStatics() { Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=50188&r1=50187&r2=50188&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Wed Apr 23 17:24:08 2008 @@ -219,28 +219,28 @@ #ifndef WITHOUT_VTABLE } else { res = allocateVT(cl, cl->virtualMethods.begin()); - } - - if (!(cl->super)) { - // 12 = number of virtual methods in java/lang/Object (!!!) - uint32 size = 12 * sizeof(void*); + + if (!(cl->super)) { + // 12 = number of virtual methods in java/lang/Object (!!!) + uint32 size = 12 * sizeof(void*); #define COPY(CLASS) \ - memcpy((void*)((unsigned)res + VT_SIZE), \ - (void*)((unsigned)CLASS::VT + VT_SIZE), size); + memcpy((void*)((unsigned)CLASS::VT + VT_SIZE), \ + (void*)((unsigned)res + VT_SIZE), size); - COPY(ArrayUInt8) - COPY(ArraySInt8) - COPY(ArrayUInt16) - COPY(ArraySInt16) - COPY(ArrayUInt32) - COPY(ArraySInt32) - COPY(ArrayLong) - COPY(ArrayFloat) - COPY(ArrayDouble) - COPY(UTF8) - COPY(ArrayObject) + COPY(ArrayUInt8) + COPY(ArraySInt8) + COPY(ArrayUInt16) + COPY(ArraySInt16) + COPY(ArrayUInt32) + COPY(ArraySInt32) + COPY(ArrayLong) + COPY(ArrayFloat) + COPY(ArrayDouble) + COPY(UTF8) + COPY(ArrayObject) #undef COPY + } } #endif Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h?rev=50188&r1=50187&r2=50188&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Wed Apr 23 17:24:08 2008 @@ -104,21 +104,6 @@ void operator()(JavaField* field, uint32 val); void operator()(JavaField* field, JavaObject* val); -#ifndef WITHOUT_VTABLE - // Some of these are final. I could probably remove them from the list. - virtual void JavaInit() {} - virtual void JavaEquals() {} - virtual void JavaHashCode() {} - virtual void JavaToString() {} - virtual void JavaFinalize() {} - virtual void JavaClone() {} - virtual void JavaGetClass() {} - virtual void JavaNotify() {} - virtual void JavaNotifyAll() {} - virtual void JavaWait() {} - virtual void JavaWait(sint64) {} - virtual void JavaWait(sint64, sint32) {} -#endif }; From asl at math.spbu.ru Wed Apr 23 17:29:25 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 22:29:25 -0000 Subject: [llvm-commits] [llvm] r50189 - in /llvm/trunk: autoconf/configure.ac configure lib/Target/CppBackend/ lib/Target/CppBackend/CPPBackend.cpp lib/Target/CppBackend/CPPTargetMachine.h lib/Target/CppBackend/Makefile tools/llc/llc.cpp Message-ID: <200804232229.m3NMTPsW005221@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 17:29:24 2008 New Revision: 50189 URL: http://llvm.org/viewvc/llvm-project?rev=50189&view=rev Log: First step of implementing PR1538: move llvm2cpp logic to new 'target' Added: llvm/trunk/lib/Target/CppBackend/ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h llvm/trunk/lib/Target/CppBackend/Makefile Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/tools/llc/llc.cpp Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=50189&r1=50188&r2=50189&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Wed Apr 23 17:29:24 2008 @@ -363,7 +363,7 @@ [Build specific host targets: all,host-only,{target-name} (default=all)]),, enableval=all) case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL CppBackend" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -391,6 +391,7 @@ spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; + cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; esac done Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=50189&r1=50188&r2=50189&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Wed Apr 23 17:29:24 2008 @@ -4743,7 +4743,7 @@ fi case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL CppBackend" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -4773,6 +4773,7 @@ spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; + cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; *) { { echo "$as_me:$LINENO: error: Unrecognized target $a_target" >&5 echo "$as_me: error: Unrecognized target $a_target" >&2;} { (exit 1); exit 1; }; } ;; Added: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=50189&view=auto ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (added) +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Wed Apr 23 17:29:24 2008 @@ -0,0 +1,1971 @@ +//===-- CPPBackend.cpp - Library for converting LLVM code to C++ code -----===// +// +// 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 writing of the LLVM IR as a set of C++ calls to the +// LLVM IR interface. The input module is assumed to be verified. +// +//===----------------------------------------------------------------------===// + +#include "CPPTargetMachine.h" +#include "llvm/CallingConv.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" +#include "llvm/InlineAsm.h" +#include "llvm/Instruction.h" +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/PassManager.h" +#include "llvm/TypeSymbolTable.h" +#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/CFG.h" +#include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/MathExtras.h" +#include "llvm/Config/config.h" +#include +#include +#include + +using namespace llvm; + +static cl::opt +FuncName("funcname", cl::desc("Specify the name of the generated function"), + cl::value_desc("function name")); + +enum WhatToGenerate { + GenProgram, + GenModule, + GenContents, + GenFunction, + GenFunctions, + GenInline, + GenVariable, + GenType +}; + +static cl::opt GenerationType(cl::Optional, + cl::desc("Choose what kind of output to generate"), + cl::init(GenProgram), + cl::values( + clEnumValN(GenProgram, "gen-program", "Generate a complete program"), + clEnumValN(GenModule, "gen-module", "Generate a module definition"), + clEnumValN(GenContents, "gen-contents", "Generate contents of a module"), + clEnumValN(GenFunction, "gen-function", "Generate a function definition"), + clEnumValN(GenFunctions,"gen-functions", "Generate all function definitions"), + clEnumValN(GenInline, "gen-inline", "Generate an inline function"), + clEnumValN(GenVariable, "gen-variable", "Generate a variable definition"), + clEnumValN(GenType, "gen-type", "Generate a type definition"), + clEnumValEnd + ) +); + +static cl::opt NameToGenerate("for", cl::Optional, + cl::desc("Specify the name of the thing to generate"), + cl::init("!bad!")); + +namespace { + // Register the target. + RegisterTarget X("cpp", " C++ backend"); + + typedef std::vector TypeList; + typedef std::map TypeMap; + typedef std::map ValueMap; + typedef std::set NameSet; + typedef std::set TypeSet; + typedef std::set ValueSet; + typedef std::map ForwardRefMap; + + /// CppWriter - This class is the main chunk of code that converts an LLVM + /// module to a C++ translation unit. + class CppWriter : public ModulePass { + const char* progname; + std::ostream &Out; + const Module *TheModule; + uint64_t uniqueNum; + TypeMap TypeNames; + ValueMap ValueNames; + TypeMap UnresolvedTypes; + TypeList TypeStack; + NameSet UsedNames; + TypeSet DefinedTypes; + ValueSet DefinedValues; + ForwardRefMap ForwardRefs; + bool is_inline; + + public: + static char ID; + explicit CppWriter(std::ostream &o) : ModulePass((intptr_t)&ID), Out(o) {} + + virtual const char *getPassName() const { return "C++ backend"; } + + bool runOnModule(Module &M); + + bool doInitialization(Module &M) { + uniqueNum = 0; + is_inline = false; + + TypeNames.clear(); + ValueNames.clear(); + UnresolvedTypes.clear(); + TypeStack.clear(); + UsedNames.clear(); + DefinedTypes.clear(); + DefinedValues.clear(); + ForwardRefs.clear(); + + return false; + } + + void printProgram(const std::string& fname, const std::string& modName ); + void printModule(const std::string& fname, const std::string& modName ); + void printContents(const std::string& fname, const std::string& modName ); + void printFunction(const std::string& fname, const std::string& funcName ); + void printFunctions(); + void printInline(const std::string& fname, const std::string& funcName ); + void printVariable(const std::string& fname, const std::string& varName ); + void printType(const std::string& fname, const std::string& typeName ); + + void error(const std::string& msg); + + private: + void printLinkageType(GlobalValue::LinkageTypes LT); + void printVisibilityType(GlobalValue::VisibilityTypes VisTypes); + void printCallingConv(unsigned cc); + void printEscapedString(const std::string& str); + void printCFP(const ConstantFP* CFP); + + std::string getCppName(const Type* val); + inline void printCppName(const Type* val); + + std::string getCppName(const Value* val); + inline void printCppName(const Value* val); + + void printParamAttrs(const PAListPtr &PAL, const std::string &name); + bool printTypeInternal(const Type* Ty); + inline void printType(const Type* Ty); + void printTypes(const Module* M); + + void printConstant(const Constant *CPV); + void printConstants(const Module* M); + + void printVariableUses(const GlobalVariable *GV); + void printVariableHead(const GlobalVariable *GV); + void printVariableBody(const GlobalVariable *GV); + + void printFunctionUses(const Function *F); + void printFunctionHead(const Function *F); + void printFunctionBody(const Function *F); + void printInstruction(const Instruction *I, const std::string& bbname); + std::string getOpName(Value*); + + void printModuleBody(); + }; + + static unsigned indent_level = 0; + inline std::ostream& nl(std::ostream& Out, int delta = 0) { + Out << "\n"; + if (delta >= 0 || indent_level >= unsigned(-delta)) + indent_level += delta; + for (unsigned i = 0; i < indent_level; ++i) + Out << " "; + return Out; + } + + inline void in() { indent_level++; } + inline void out() { if (indent_level >0) indent_level--; } + + inline void + sanitize(std::string& str) { + for (size_t i = 0; i < str.length(); ++i) + if (!isalnum(str[i]) && str[i] != '_') + str[i] = '_'; + } + + inline std::string + getTypePrefix(const Type* Ty ) { + switch (Ty->getTypeID()) { + case Type::VoidTyID: return "void_"; + case Type::IntegerTyID: + return std::string("int") + utostr(cast(Ty)->getBitWidth()) + + "_"; + case Type::FloatTyID: return "float_"; + case Type::DoubleTyID: return "double_"; + case Type::LabelTyID: return "label_"; + case Type::FunctionTyID: return "func_"; + case Type::StructTyID: return "struct_"; + case Type::ArrayTyID: return "array_"; + case Type::PointerTyID: return "ptr_"; + case Type::VectorTyID: return "packed_"; + case Type::OpaqueTyID: return "opaque_"; + default: return "other_"; + } + return "unknown_"; + } + + // Looks up the type in the symbol table and returns a pointer to its name or + // a null pointer if it wasn't found. Note that this isn't the same as the + // Mode::getTypeName function which will return an empty string, not a null + // pointer if the name is not found. + inline const std::string* + findTypeName(const TypeSymbolTable& ST, const Type* Ty) { + TypeSymbolTable::const_iterator TI = ST.begin(); + TypeSymbolTable::const_iterator TE = ST.end(); + for (;TI != TE; ++TI) + if (TI->second == Ty) + return &(TI->first); + return 0; + } + + void CppWriter::error(const std::string& msg) { + std::cerr << progname << ": " << msg << "\n"; + exit(2); + } + + // printCFP - Print a floating point constant .. very carefully :) + // This makes sure that conversion to/from floating yields the same binary + // result so that we don't lose precision. + void CppWriter::printCFP(const ConstantFP *CFP) { + APFloat APF = APFloat(CFP->getValueAPF()); // copy + if (CFP->getType() == Type::FloatTy) + APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven); + Out << "ConstantFP::get("; + if (CFP->getType() == Type::DoubleTy) + Out << "Type::DoubleTy, "; + else + Out << "Type::FloatTy, "; + Out << "APFloat("; +#if HAVE_PRINTF_A + char Buffer[100]; + sprintf(Buffer, "%A", APF.convertToDouble()); + if ((!strncmp(Buffer, "0x", 2) || + !strncmp(Buffer, "-0x", 3) || + !strncmp(Buffer, "+0x", 3)) && + APF.bitwiseIsEqual(APFloat(atof(Buffer)))) { + if (CFP->getType() == Type::DoubleTy) + Out << "BitsToDouble(" << Buffer << ")"; + else + Out << "BitsToFloat((float)" << Buffer << ")"; + Out << ")"; + } else { +#endif + std::string StrVal = ftostr(CFP->getValueAPF()); + + while (StrVal[0] == ' ') + StrVal.erase(StrVal.begin()); + + // Check to make sure that the stringized number is not some string like + // "Inf" or NaN. Check that the string matches the "[-+]?[0-9]" regex. + if (((StrVal[0] >= '0' && StrVal[0] <= '9') || + ((StrVal[0] == '-' || StrVal[0] == '+') && + (StrVal[1] >= '0' && StrVal[1] <= '9'))) && + (CFP->isExactlyValue(atof(StrVal.c_str())))) { + if (CFP->getType() == Type::DoubleTy) + Out << StrVal; + else + Out << StrVal << "f"; + } else if (CFP->getType() == Type::DoubleTy) + Out << "BitsToDouble(0x" << std::hex + << CFP->getValueAPF().convertToAPInt().getZExtValue() + << std::dec << "ULL) /* " << StrVal << " */"; + else + Out << "BitsToFloat(0x" << std::hex + << (uint32_t)CFP->getValueAPF().convertToAPInt().getZExtValue() + << std::dec << "U) /* " << StrVal << " */"; + Out << ")"; +#if HAVE_PRINTF_A + } +#endif + Out << ")"; + } + + void CppWriter::printCallingConv(unsigned cc){ + // Print the calling convention. + switch (cc) { + case CallingConv::C: Out << "CallingConv::C"; break; + case CallingConv::Fast: Out << "CallingConv::Fast"; break; + case CallingConv::Cold: Out << "CallingConv::Cold"; break; + case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break; + default: Out << cc; break; + } + } + + void CppWriter::printLinkageType(GlobalValue::LinkageTypes LT) { + switch (LT) { + case GlobalValue::InternalLinkage: + Out << "GlobalValue::InternalLinkage"; break; + case GlobalValue::LinkOnceLinkage: + Out << "GlobalValue::LinkOnceLinkage "; break; + case GlobalValue::WeakLinkage: + Out << "GlobalValue::WeakLinkage"; break; + case GlobalValue::AppendingLinkage: + Out << "GlobalValue::AppendingLinkage"; break; + case GlobalValue::ExternalLinkage: + Out << "GlobalValue::ExternalLinkage"; break; + case GlobalValue::DLLImportLinkage: + Out << "GlobalValue::DLLImportLinkage"; break; + case GlobalValue::DLLExportLinkage: + Out << "GlobalValue::DLLExportLinkage"; break; + case GlobalValue::ExternalWeakLinkage: + Out << "GlobalValue::ExternalWeakLinkage"; break; + case GlobalValue::GhostLinkage: + Out << "GlobalValue::GhostLinkage"; break; + } + } + + void CppWriter::printVisibilityType(GlobalValue::VisibilityTypes VisType) { + switch (VisType) { + default: assert(0 && "Unknown GVar visibility"); + case GlobalValue::DefaultVisibility: + Out << "GlobalValue::DefaultVisibility"; + break; + case GlobalValue::HiddenVisibility: + Out << "GlobalValue::HiddenVisibility"; + break; + case GlobalValue::ProtectedVisibility: + Out << "GlobalValue::ProtectedVisibility"; + break; + } + } + + // printEscapedString - Print each character of the specified string, escaping + // it if it is not printable or if it is an escape char. + void CppWriter::printEscapedString(const std::string &Str) { + for (unsigned i = 0, e = Str.size(); i != e; ++i) { + unsigned char C = Str[i]; + if (isprint(C) && C != '"' && C != '\\') { + Out << C; + } else { + Out << "\\x" + << (char) ((C/16 < 10) ? ( C/16 +'0') : ( C/16 -10+'A')) + << (char)(((C&15) < 10) ? ((C&15)+'0') : ((C&15)-10+'A')); + } + } + } + + std::string CppWriter::getCppName(const Type* Ty) { + // First, handle the primitive types .. easy + if (Ty->isPrimitiveType() || Ty->isInteger()) { + switch (Ty->getTypeID()) { + case Type::VoidTyID: return "Type::VoidTy"; + case Type::IntegerTyID: { + unsigned BitWidth = cast(Ty)->getBitWidth(); + return "IntegerType::get(" + utostr(BitWidth) + ")"; + } + case Type::FloatTyID: return "Type::FloatTy"; + case Type::DoubleTyID: return "Type::DoubleTy"; + case Type::LabelTyID: return "Type::LabelTy"; + default: + error("Invalid primitive type"); + break; + } + return "Type::VoidTy"; // shouldn't be returned, but make it sensible + } + + // Now, see if we've seen the type before and return that + TypeMap::iterator I = TypeNames.find(Ty); + if (I != TypeNames.end()) + return I->second; + + // Okay, let's build a new name for this type. Start with a prefix + const char* prefix = 0; + switch (Ty->getTypeID()) { + case Type::FunctionTyID: prefix = "FuncTy_"; break; + case Type::StructTyID: prefix = "StructTy_"; break; + case Type::ArrayTyID: prefix = "ArrayTy_"; break; + case Type::PointerTyID: prefix = "PointerTy_"; break; + case Type::OpaqueTyID: prefix = "OpaqueTy_"; break; + case Type::VectorTyID: prefix = "VectorTy_"; break; + default: prefix = "OtherTy_"; break; // prevent breakage + } + + // See if the type has a name in the symboltable and build accordingly + const std::string* tName = findTypeName(TheModule->getTypeSymbolTable(), Ty); + std::string name; + if (tName) + name = std::string(prefix) + *tName; + else + name = std::string(prefix) + utostr(uniqueNum++); + sanitize(name); + + // Save the name + return TypeNames[Ty] = name; + } + + void CppWriter::printCppName(const Type* Ty) { + printEscapedString(getCppName(Ty)); + } + + std::string CppWriter::getCppName(const Value* val) { + std::string name; + ValueMap::iterator I = ValueNames.find(val); + if (I != ValueNames.end() && I->first == val) + return I->second; + + if (const GlobalVariable* GV = dyn_cast(val)) { + name = std::string("gvar_") + + getTypePrefix(GV->getType()->getElementType()); + } else if (isa(val)) { + name = std::string("func_"); + } else if (const Constant* C = dyn_cast(val)) { + name = std::string("const_") + getTypePrefix(C->getType()); + } else if (const Argument* Arg = dyn_cast(val)) { + if (is_inline) { + unsigned argNum = std::distance(Arg->getParent()->arg_begin(), + Function::const_arg_iterator(Arg)) + 1; + name = std::string("arg_") + utostr(argNum); + NameSet::iterator NI = UsedNames.find(name); + if (NI != UsedNames.end()) + name += std::string("_") + utostr(uniqueNum++); + UsedNames.insert(name); + return ValueNames[val] = name; + } else { + name = getTypePrefix(val->getType()); + } + } else { + name = getTypePrefix(val->getType()); + } + name += (val->hasName() ? val->getName() : utostr(uniqueNum++)); + sanitize(name); + NameSet::iterator NI = UsedNames.find(name); + if (NI != UsedNames.end()) + name += std::string("_") + utostr(uniqueNum++); + UsedNames.insert(name); + return ValueNames[val] = name; + } + + void CppWriter::printCppName(const Value* val) { + printEscapedString(getCppName(val)); + } + + void CppWriter::printParamAttrs(const PAListPtr &PAL, + const std::string &name) { + Out << "PAListPtr " << name << "_PAL = 0;"; + nl(Out); + if (!PAL.isEmpty()) { + Out << '{'; in(); nl(Out); + Out << "SmallVector Attrs;"; nl(Out); + Out << "ParamAttrsWithIndex PAWI;"; nl(Out); + for (unsigned i = 0; i < PAL.getNumSlots(); ++i) { + uint16_t index = PAL.getSlot(i).Index; + ParameterAttributes attrs = PAL.getSlot(i).Attrs; + Out << "PAWI.index = " << index << "; PAWI.attrs = 0 "; + if (attrs & ParamAttr::SExt) + Out << " | ParamAttr::SExt"; + if (attrs & ParamAttr::ZExt) + Out << " | ParamAttr::ZExt"; + if (attrs & ParamAttr::StructRet) + Out << " | ParamAttr::StructRet"; + if (attrs & ParamAttr::InReg) + Out << " | ParamAttr::InReg"; + if (attrs & ParamAttr::NoReturn) + Out << " | ParamAttr::NoReturn"; + if (attrs & ParamAttr::NoUnwind) + Out << " | ParamAttr::NoUnwind"; + if (attrs & ParamAttr::ByVal) + Out << " | ParamAttr::ByVal"; + if (attrs & ParamAttr::NoAlias) + Out << " | ParamAttr::NoAlias"; + if (attrs & ParamAttr::Nest) + Out << " | ParamAttr::Nest"; + if (attrs & ParamAttr::ReadNone) + Out << " | ParamAttr::ReadNone"; + if (attrs & ParamAttr::ReadOnly) + Out << " | ParamAttr::ReadOnly"; + Out << ";"; + nl(Out); + Out << "Attrs.push_back(PAWI);"; + nl(Out); + } + Out << name << "_PAL = PAListPtr::get(Attrs.begin(), Attrs.end());"; + nl(Out); + out(); nl(Out); + Out << '}'; nl(Out); + } + } + + bool CppWriter::printTypeInternal(const Type* Ty) { + // We don't print definitions for primitive types + if (Ty->isPrimitiveType() || Ty->isInteger()) + return false; + + // If we already defined this type, we don't need to define it again. + if (DefinedTypes.find(Ty) != DefinedTypes.end()) + return false; + + // Everything below needs the name for the type so get it now. + std::string typeName(getCppName(Ty)); + + // Search the type stack for recursion. If we find it, then generate this + // as an OpaqueType, but make sure not to do this multiple times because + // the type could appear in multiple places on the stack. Once the opaque + // definition is issued, it must not be re-issued. Consequently we have to + // check the UnresolvedTypes list as well. + TypeList::const_iterator TI = std::find(TypeStack.begin(), TypeStack.end(), + Ty); + if (TI != TypeStack.end()) { + TypeMap::const_iterator I = UnresolvedTypes.find(Ty); + if (I == UnresolvedTypes.end()) { + Out << "PATypeHolder " << typeName << "_fwd = OpaqueType::get();"; + nl(Out); + UnresolvedTypes[Ty] = typeName; + } + return true; + } + + // We're going to print a derived type which, by definition, contains other + // types. So, push this one we're printing onto the type stack to assist with + // recursive definitions. + TypeStack.push_back(Ty); + + // Print the type definition + switch (Ty->getTypeID()) { + case Type::FunctionTyID: { + const FunctionType* FT = cast(Ty); + Out << "std::vector" << typeName << "_args;"; + nl(Out); + FunctionType::param_iterator PI = FT->param_begin(); + FunctionType::param_iterator PE = FT->param_end(); + for (; PI != PE; ++PI) { + const Type* argTy = static_cast(*PI); + bool isForward = printTypeInternal(argTy); + std::string argName(getCppName(argTy)); + Out << typeName << "_args.push_back(" << argName; + if (isForward) + Out << "_fwd"; + Out << ");"; + nl(Out); + } + bool isForward = printTypeInternal(FT->getReturnType()); + std::string retTypeName(getCppName(FT->getReturnType())); + Out << "FunctionType* " << typeName << " = FunctionType::get("; + in(); nl(Out) << "/*Result=*/" << retTypeName; + if (isForward) + Out << "_fwd"; + Out << ","; + nl(Out) << "/*Params=*/" << typeName << "_args,"; + nl(Out) << "/*isVarArg=*/" << (FT->isVarArg() ? "true" : "false") << ");"; + out(); + nl(Out); + break; + } + case Type::StructTyID: { + const StructType* ST = cast(Ty); + Out << "std::vector" << typeName << "_fields;"; + nl(Out); + StructType::element_iterator EI = ST->element_begin(); + StructType::element_iterator EE = ST->element_end(); + for (; EI != EE; ++EI) { + const Type* fieldTy = static_cast(*EI); + bool isForward = printTypeInternal(fieldTy); + std::string fieldName(getCppName(fieldTy)); + Out << typeName << "_fields.push_back(" << fieldName; + if (isForward) + Out << "_fwd"; + Out << ");"; + nl(Out); + } + Out << "StructType* " << typeName << " = StructType::get(" + << typeName << "_fields, /*isPacked=*/" + << (ST->isPacked() ? "true" : "false") << ");"; + nl(Out); + break; + } + case Type::ArrayTyID: { + const ArrayType* AT = cast(Ty); + const Type* ET = AT->getElementType(); + bool isForward = printTypeInternal(ET); + std::string elemName(getCppName(ET)); + Out << "ArrayType* " << typeName << " = ArrayType::get(" + << elemName << (isForward ? "_fwd" : "") + << ", " << utostr(AT->getNumElements()) << ");"; + nl(Out); + break; + } + case Type::PointerTyID: { + const PointerType* PT = cast(Ty); + const Type* ET = PT->getElementType(); + bool isForward = printTypeInternal(ET); + std::string elemName(getCppName(ET)); + Out << "PointerType* " << typeName << " = PointerType::get(" + << elemName << (isForward ? "_fwd" : "") + << ", " << utostr(PT->getAddressSpace()) << ");"; + nl(Out); + break; + } + case Type::VectorTyID: { + const VectorType* PT = cast(Ty); + const Type* ET = PT->getElementType(); + bool isForward = printTypeInternal(ET); + std::string elemName(getCppName(ET)); + Out << "VectorType* " << typeName << " = VectorType::get(" + << elemName << (isForward ? "_fwd" : "") + << ", " << utostr(PT->getNumElements()) << ");"; + nl(Out); + break; + } + case Type::OpaqueTyID: { + Out << "OpaqueType* " << typeName << " = OpaqueType::get();"; + nl(Out); + break; + } + default: + error("Invalid TypeID"); + } + + // If the type had a name, make sure we recreate it. + const std::string* progTypeName = + findTypeName(TheModule->getTypeSymbolTable(),Ty); + if (progTypeName) { + Out << "mod->addTypeName(\"" << *progTypeName << "\", " + << typeName << ");"; + nl(Out); + } + + // Pop us off the type stack + TypeStack.pop_back(); + + // Indicate that this type is now defined. + DefinedTypes.insert(Ty); + + // Early resolve as many unresolved types as possible. Search the unresolved + // types map for the type we just printed. Now that its definition is complete + // we can resolve any previous references to it. This prevents a cascade of + // unresolved types. + TypeMap::iterator I = UnresolvedTypes.find(Ty); + if (I != UnresolvedTypes.end()) { + Out << "cast(" << I->second + << "_fwd.get())->refineAbstractTypeTo(" << I->second << ");"; + nl(Out); + Out << I->second << " = cast<"; + switch (Ty->getTypeID()) { + case Type::FunctionTyID: Out << "FunctionType"; break; + case Type::ArrayTyID: Out << "ArrayType"; break; + case Type::StructTyID: Out << "StructType"; break; + case Type::VectorTyID: Out << "VectorType"; break; + case Type::PointerTyID: Out << "PointerType"; break; + case Type::OpaqueTyID: Out << "OpaqueType"; break; + default: Out << "NoSuchDerivedType"; break; + } + Out << ">(" << I->second << "_fwd.get());"; + nl(Out); nl(Out); + UnresolvedTypes.erase(I); + } + + // Finally, separate the type definition from other with a newline. + nl(Out); + + // We weren't a recursive type + return false; + } + + // Prints a type definition. Returns true if it could not resolve all the + // types in the definition but had to use a forward reference. + void CppWriter::printType(const Type* Ty) { + assert(TypeStack.empty()); + TypeStack.clear(); + printTypeInternal(Ty); + assert(TypeStack.empty()); + } + + void CppWriter::printTypes(const Module* M) { + // Walk the symbol table and print out all its types + const TypeSymbolTable& symtab = M->getTypeSymbolTable(); + for (TypeSymbolTable::const_iterator TI = symtab.begin(), TE = symtab.end(); + TI != TE; ++TI) { + + // For primitive types and types already defined, just add a name + TypeMap::const_iterator TNI = TypeNames.find(TI->second); + if (TI->second->isInteger() || TI->second->isPrimitiveType() || + TNI != TypeNames.end()) { + Out << "mod->addTypeName(\""; + printEscapedString(TI->first); + Out << "\", " << getCppName(TI->second) << ");"; + nl(Out); + // For everything else, define the type + } else { + printType(TI->second); + } + } + + // Add all of the global variables to the value table... + for (Module::const_global_iterator I = TheModule->global_begin(), + E = TheModule->global_end(); I != E; ++I) { + if (I->hasInitializer()) + printType(I->getInitializer()->getType()); + printType(I->getType()); + } + + // Add all the functions to the table + for (Module::const_iterator FI = TheModule->begin(), FE = TheModule->end(); + FI != FE; ++FI) { + printType(FI->getReturnType()); + printType(FI->getFunctionType()); + // Add all the function arguments + for (Function::const_arg_iterator AI = FI->arg_begin(), + AE = FI->arg_end(); AI != AE; ++AI) { + printType(AI->getType()); + } + + // Add all of the basic blocks and instructions + for (Function::const_iterator BB = FI->begin(), + E = FI->end(); BB != E; ++BB) { + printType(BB->getType()); + for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; + ++I) { + printType(I->getType()); + for (unsigned i = 0; i < I->getNumOperands(); ++i) + printType(I->getOperand(i)->getType()); + } + } + } + } + + + // printConstant - Print out a constant pool entry... + void CppWriter::printConstant(const Constant *CV) { + // First, if the constant is actually a GlobalValue (variable or function) + // or its already in the constant list then we've printed it already and we + // can just return. + if (isa(CV) || ValueNames.find(CV) != ValueNames.end()) + return; + + std::string constName(getCppName(CV)); + std::string typeName(getCppName(CV->getType())); + if (CV->isNullValue()) { + Out << "Constant* " << constName << " = Constant::getNullValue(" + << typeName << ");"; + nl(Out); + return; + } + if (isa(CV)) { + // Skip variables and functions, we emit them elsewhere + return; + } + if (const ConstantInt *CI = dyn_cast(CV)) { + Out << "ConstantInt* " << constName << " = ConstantInt::get(APInt(" + << cast(CI->getType())->getBitWidth() << ", " + << " \"" << CI->getValue().toStringSigned(10) << "\", 10));"; + } else if (isa(CV)) { + Out << "ConstantAggregateZero* " << constName + << " = ConstantAggregateZero::get(" << typeName << ");"; + } else if (isa(CV)) { + Out << "ConstantPointerNull* " << constName + << " = ConstanPointerNull::get(" << typeName << ");"; + } else if (const ConstantFP *CFP = dyn_cast(CV)) { + Out << "ConstantFP* " << constName << " = "; + printCFP(CFP); + Out << ";"; + } else if (const ConstantArray *CA = dyn_cast(CV)) { + if (CA->isString() && CA->getType()->getElementType() == Type::Int8Ty) { + Out << "Constant* " << constName << " = ConstantArray::get(\""; + std::string tmp = CA->getAsString(); + bool nullTerminate = false; + if (tmp[tmp.length()-1] == 0) { + tmp.erase(tmp.length()-1); + nullTerminate = true; + } + printEscapedString(tmp); + // Determine if we want null termination or not. + if (nullTerminate) + Out << "\", true"; // Indicate that the null terminator should be + // added. + else + Out << "\", false";// No null terminator + Out << ");"; + } else { + Out << "std::vector " << constName << "_elems;"; + nl(Out); + unsigned N = CA->getNumOperands(); + for (unsigned i = 0; i < N; ++i) { + printConstant(CA->getOperand(i)); // recurse to print operands + Out << constName << "_elems.push_back(" + << getCppName(CA->getOperand(i)) << ");"; + nl(Out); + } + Out << "Constant* " << constName << " = ConstantArray::get(" + << typeName << ", " << constName << "_elems);"; + } + } else if (const ConstantStruct *CS = dyn_cast(CV)) { + Out << "std::vector " << constName << "_fields;"; + nl(Out); + unsigned N = CS->getNumOperands(); + for (unsigned i = 0; i < N; i++) { + printConstant(CS->getOperand(i)); + Out << constName << "_fields.push_back(" + << getCppName(CS->getOperand(i)) << ");"; + nl(Out); + } + Out << "Constant* " << constName << " = ConstantStruct::get(" + << typeName << ", " << constName << "_fields);"; + } else if (const ConstantVector *CP = dyn_cast(CV)) { + Out << "std::vector " << constName << "_elems;"; + nl(Out); + unsigned N = CP->getNumOperands(); + for (unsigned i = 0; i < N; ++i) { + printConstant(CP->getOperand(i)); + Out << constName << "_elems.push_back(" + << getCppName(CP->getOperand(i)) << ");"; + nl(Out); + } + Out << "Constant* " << constName << " = ConstantVector::get(" + << typeName << ", " << constName << "_elems);"; + } else if (isa(CV)) { + Out << "UndefValue* " << constName << " = UndefValue::get(" + << typeName << ");"; + } else if (const ConstantExpr *CE = dyn_cast(CV)) { + if (CE->getOpcode() == Instruction::GetElementPtr) { + Out << "std::vector " << constName << "_indices;"; + nl(Out); + printConstant(CE->getOperand(0)); + for (unsigned i = 1; i < CE->getNumOperands(); ++i ) { + printConstant(CE->getOperand(i)); + Out << constName << "_indices.push_back(" + << getCppName(CE->getOperand(i)) << ");"; + nl(Out); + } + Out << "Constant* " << constName + << " = ConstantExpr::getGetElementPtr(" + << getCppName(CE->getOperand(0)) << ", " + << "&" << constName << "_indices[0], " + << constName << "_indices.size()" + << " );"; + } else if (CE->isCast()) { + printConstant(CE->getOperand(0)); + Out << "Constant* " << constName << " = ConstantExpr::getCast("; + switch (CE->getOpcode()) { + default: assert(0 && "Invalid cast opcode"); + case Instruction::Trunc: Out << "Instruction::Trunc"; break; + case Instruction::ZExt: Out << "Instruction::ZExt"; break; + case Instruction::SExt: Out << "Instruction::SExt"; break; + case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break; + case Instruction::FPExt: Out << "Instruction::FPExt"; break; + case Instruction::FPToUI: Out << "Instruction::FPToUI"; break; + case Instruction::FPToSI: Out << "Instruction::FPToSI"; break; + case Instruction::UIToFP: Out << "Instruction::UIToFP"; break; + case Instruction::SIToFP: Out << "Instruction::SIToFP"; break; + case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break; + case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break; + case Instruction::BitCast: Out << "Instruction::BitCast"; break; + } + Out << ", " << getCppName(CE->getOperand(0)) << ", " + << getCppName(CE->getType()) << ");"; + } else { + unsigned N = CE->getNumOperands(); + for (unsigned i = 0; i < N; ++i ) { + printConstant(CE->getOperand(i)); + } + Out << "Constant* " << constName << " = ConstantExpr::"; + switch (CE->getOpcode()) { + case Instruction::Add: Out << "getAdd("; break; + case Instruction::Sub: Out << "getSub("; break; + case Instruction::Mul: Out << "getMul("; break; + case Instruction::UDiv: Out << "getUDiv("; break; + case Instruction::SDiv: Out << "getSDiv("; break; + case Instruction::FDiv: Out << "getFDiv("; break; + case Instruction::URem: Out << "getURem("; break; + case Instruction::SRem: Out << "getSRem("; break; + case Instruction::FRem: Out << "getFRem("; break; + case Instruction::And: Out << "getAnd("; break; + case Instruction::Or: Out << "getOr("; break; + case Instruction::Xor: Out << "getXor("; break; + case Instruction::ICmp: + Out << "getICmp(ICmpInst::ICMP_"; + switch (CE->getPredicate()) { + case ICmpInst::ICMP_EQ: Out << "EQ"; break; + case ICmpInst::ICMP_NE: Out << "NE"; break; + case ICmpInst::ICMP_SLT: Out << "SLT"; break; + case ICmpInst::ICMP_ULT: Out << "ULT"; break; + case ICmpInst::ICMP_SGT: Out << "SGT"; break; + case ICmpInst::ICMP_UGT: Out << "UGT"; break; + case ICmpInst::ICMP_SLE: Out << "SLE"; break; + case ICmpInst::ICMP_ULE: Out << "ULE"; break; + case ICmpInst::ICMP_SGE: Out << "SGE"; break; + case ICmpInst::ICMP_UGE: Out << "UGE"; break; + default: error("Invalid ICmp Predicate"); + } + break; + case Instruction::FCmp: + Out << "getFCmp(FCmpInst::FCMP_"; + switch (CE->getPredicate()) { + case FCmpInst::FCMP_FALSE: Out << "FALSE"; break; + case FCmpInst::FCMP_ORD: Out << "ORD"; break; + case FCmpInst::FCMP_UNO: Out << "UNO"; break; + case FCmpInst::FCMP_OEQ: Out << "OEQ"; break; + case FCmpInst::FCMP_UEQ: Out << "UEQ"; break; + case FCmpInst::FCMP_ONE: Out << "ONE"; break; + case FCmpInst::FCMP_UNE: Out << "UNE"; break; + case FCmpInst::FCMP_OLT: Out << "OLT"; break; + case FCmpInst::FCMP_ULT: Out << "ULT"; break; + case FCmpInst::FCMP_OGT: Out << "OGT"; break; + case FCmpInst::FCMP_UGT: Out << "UGT"; break; + case FCmpInst::FCMP_OLE: Out << "OLE"; break; + case FCmpInst::FCMP_ULE: Out << "ULE"; break; + case FCmpInst::FCMP_OGE: Out << "OGE"; break; + case FCmpInst::FCMP_UGE: Out << "UGE"; break; + case FCmpInst::FCMP_TRUE: Out << "TRUE"; break; + default: error("Invalid FCmp Predicate"); + } + break; + case Instruction::Shl: Out << "getShl("; break; + case Instruction::LShr: Out << "getLShr("; break; + case Instruction::AShr: Out << "getAShr("; break; + case Instruction::Select: Out << "getSelect("; break; + case Instruction::ExtractElement: Out << "getExtractElement("; break; + case Instruction::InsertElement: Out << "getInsertElement("; break; + case Instruction::ShuffleVector: Out << "getShuffleVector("; break; + default: + error("Invalid constant expression"); + break; + } + Out << getCppName(CE->getOperand(0)); + for (unsigned i = 1; i < CE->getNumOperands(); ++i) + Out << ", " << getCppName(CE->getOperand(i)); + Out << ");"; + } + } else { + error("Bad Constant"); + Out << "Constant* " << constName << " = 0; "; + } + nl(Out); + } + + void CppWriter::printConstants(const Module* M) { + // Traverse all the global variables looking for constant initializers + for (Module::const_global_iterator I = TheModule->global_begin(), + E = TheModule->global_end(); I != E; ++I) + if (I->hasInitializer()) + printConstant(I->getInitializer()); + + // Traverse the LLVM functions looking for constants + for (Module::const_iterator FI = TheModule->begin(), FE = TheModule->end(); + FI != FE; ++FI) { + // Add all of the basic blocks and instructions + for (Function::const_iterator BB = FI->begin(), + E = FI->end(); BB != E; ++BB) { + for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; + ++I) { + for (unsigned i = 0; i < I->getNumOperands(); ++i) { + if (Constant* C = dyn_cast(I->getOperand(i))) { + printConstant(C); + } + } + } + } + } + } + + void CppWriter::printVariableUses(const GlobalVariable *GV) { + nl(Out) << "// Type Definitions"; + nl(Out); + printType(GV->getType()); + if (GV->hasInitializer()) { + Constant* Init = GV->getInitializer(); + printType(Init->getType()); + if (Function* F = dyn_cast(Init)) { + nl(Out)<< "/ Function Declarations"; nl(Out); + printFunctionHead(F); + } else if (GlobalVariable* gv = dyn_cast(Init)) { + nl(Out) << "// Global Variable Declarations"; nl(Out); + printVariableHead(gv); + } else { + nl(Out) << "// Constant Definitions"; nl(Out); + printConstant(gv); + } + if (GlobalVariable* gv = dyn_cast(Init)) { + nl(Out) << "// Global Variable Definitions"; nl(Out); + printVariableBody(gv); + } + } + } + + void CppWriter::printVariableHead(const GlobalVariable *GV) { + nl(Out) << "GlobalVariable* " << getCppName(GV); + if (is_inline) { + Out << " = mod->getGlobalVariable("; + printEscapedString(GV->getName()); + Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)"; + nl(Out) << "if (!" << getCppName(GV) << ") {"; + in(); nl(Out) << getCppName(GV); + } + Out << " = new GlobalVariable("; + nl(Out) << "/*Type=*/"; + printCppName(GV->getType()->getElementType()); + Out << ","; + nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false"); + Out << ","; + nl(Out) << "/*Linkage=*/"; + printLinkageType(GV->getLinkage()); + Out << ","; + nl(Out) << "/*Initializer=*/0, "; + if (GV->hasInitializer()) { + Out << "// has initializer, specified below"; + } + nl(Out) << "/*Name=*/\""; + printEscapedString(GV->getName()); + Out << "\","; + nl(Out) << "mod);"; + nl(Out); + + if (GV->hasSection()) { + printCppName(GV); + Out << "->setSection(\""; + printEscapedString(GV->getSection()); + Out << "\");"; + nl(Out); + } + if (GV->getAlignment()) { + printCppName(GV); + Out << "->setAlignment(" << utostr(GV->getAlignment()) << ");"; + nl(Out); + } + if (GV->getVisibility() != GlobalValue::DefaultVisibility) { + printCppName(GV); + Out << "->setVisibility("; + printVisibilityType(GV->getVisibility()); + Out << ");"; + nl(Out); + } + if (is_inline) { + out(); Out << "}"; nl(Out); + } + } + + void CppWriter::printVariableBody(const GlobalVariable *GV) { + if (GV->hasInitializer()) { + printCppName(GV); + Out << "->setInitializer("; + Out << getCppName(GV->getInitializer()) << ");"; + nl(Out); + } + } + + std::string CppWriter::getOpName(Value* V) { + if (!isa(V) || DefinedValues.find(V) != DefinedValues.end()) + return getCppName(V); + + // See if its alread in the map of forward references, if so just return the + // name we already set up for it + ForwardRefMap::const_iterator I = ForwardRefs.find(V); + if (I != ForwardRefs.end()) + return I->second; + + // This is a new forward reference. Generate a unique name for it + std::string result(std::string("fwdref_") + utostr(uniqueNum++)); + + // Yes, this is a hack. An Argument is the smallest instantiable value that + // we can make as a placeholder for the real value. We'll replace these + // Argument instances later. + Out << "Argument* " << result << " = new Argument(" + << getCppName(V->getType()) << ");"; + nl(Out); + ForwardRefs[V] = result; + return result; + } + + // printInstruction - This member is called for each Instruction in a function. + void CppWriter::printInstruction(const Instruction *I, + const std::string& bbname) { + std::string iName(getCppName(I)); + + // Before we emit this instruction, we need to take care of generating any + // forward references. So, we get the names of all the operands in advance + std::string* opNames = new std::string[I->getNumOperands()]; + for (unsigned i = 0; i < I->getNumOperands(); i++) { + opNames[i] = getOpName(I->getOperand(i)); + } + + switch (I->getOpcode()) { + case Instruction::Ret: { + const ReturnInst* ret = cast(I); + Out << "ReturnInst::Create(" + << (ret->getReturnValue() ? opNames[0] + ", " : "") << bbname << ");"; + break; + } + case Instruction::Br: { + const BranchInst* br = cast(I); + Out << "BranchInst::Create(" ; + if (br->getNumOperands() == 3 ) { + Out << opNames[0] << ", " + << opNames[1] << ", " + << opNames[2] << ", "; + + } else if (br->getNumOperands() == 1) { + Out << opNames[0] << ", "; + } else { + error("Branch with 2 operands?"); + } + Out << bbname << ");"; + break; + } + case Instruction::Switch: { + const SwitchInst* sw = cast(I); + Out << "SwitchInst* " << iName << " = SwitchInst::Create(" + << opNames[0] << ", " + << opNames[1] << ", " + << sw->getNumCases() << ", " << bbname << ");"; + nl(Out); + for (unsigned i = 2; i < sw->getNumOperands(); i += 2 ) { + Out << iName << "->addCase(" + << opNames[i] << ", " + << opNames[i+1] << ");"; + nl(Out); + } + break; + } + case Instruction::Invoke: { + const InvokeInst* inv = cast(I); + Out << "std::vector " << iName << "_params;"; + nl(Out); + for (unsigned i = 3; i < inv->getNumOperands(); ++i) { + Out << iName << "_params.push_back(" + << opNames[i] << ");"; + nl(Out); + } + Out << "InvokeInst *" << iName << " = InvokeInst::Create(" + << opNames[0] << ", " + << opNames[1] << ", " + << opNames[2] << ", " + << iName << "_params.begin(), " << iName << "_params.end(), \""; + printEscapedString(inv->getName()); + Out << "\", " << bbname << ");"; + nl(Out) << iName << "->setCallingConv("; + printCallingConv(inv->getCallingConv()); + Out << ");"; + printParamAttrs(inv->getParamAttrs(), iName); + Out << iName << "->setParamAttrs(" << iName << "_PAL);"; + nl(Out); + break; + } + case Instruction::Unwind: { + Out << "new UnwindInst(" + << bbname << ");"; + break; + } + case Instruction::Unreachable:{ + Out << "new UnreachableInst(" + << bbname << ");"; + break; + } + case Instruction::Add: + case Instruction::Sub: + case Instruction::Mul: + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: + case Instruction::And: + case Instruction::Or: + case Instruction::Xor: + case Instruction::Shl: + case Instruction::LShr: + case Instruction::AShr:{ + Out << "BinaryOperator* " << iName << " = BinaryOperator::create("; + switch (I->getOpcode()) { + case Instruction::Add: Out << "Instruction::Add"; break; + case Instruction::Sub: Out << "Instruction::Sub"; break; + case Instruction::Mul: Out << "Instruction::Mul"; break; + case Instruction::UDiv:Out << "Instruction::UDiv"; break; + case Instruction::SDiv:Out << "Instruction::SDiv"; break; + case Instruction::FDiv:Out << "Instruction::FDiv"; break; + case Instruction::URem:Out << "Instruction::URem"; break; + case Instruction::SRem:Out << "Instruction::SRem"; break; + case Instruction::FRem:Out << "Instruction::FRem"; break; + case Instruction::And: Out << "Instruction::And"; break; + case Instruction::Or: Out << "Instruction::Or"; break; + case Instruction::Xor: Out << "Instruction::Xor"; break; + case Instruction::Shl: Out << "Instruction::Shl"; break; + case Instruction::LShr:Out << "Instruction::LShr"; break; + case Instruction::AShr:Out << "Instruction::AShr"; break; + default: Out << "Instruction::BadOpCode"; break; + } + Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; + printEscapedString(I->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::FCmp: { + Out << "FCmpInst* " << iName << " = new FCmpInst("; + switch (cast(I)->getPredicate()) { + case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break; + case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break; + case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break; + case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break; + case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break; + case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break; + case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break; + case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break; + case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break; + case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break; + case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break; + case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break; + case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break; + case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break; + case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break; + case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break; + default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break; + } + Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; + printEscapedString(I->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::ICmp: { + Out << "ICmpInst* " << iName << " = new ICmpInst("; + switch (cast(I)->getPredicate()) { + case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break; + case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break; + case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break; + case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break; + case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break; + case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break; + case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break; + case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break; + case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break; + case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break; + default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break; + } + Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; + printEscapedString(I->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::Malloc: { + const MallocInst* mallocI = cast(I); + Out << "MallocInst* " << iName << " = new MallocInst(" + << getCppName(mallocI->getAllocatedType()) << ", "; + if (mallocI->isArrayAllocation()) + Out << opNames[0] << ", " ; + Out << "\""; + printEscapedString(mallocI->getName()); + Out << "\", " << bbname << ");"; + if (mallocI->getAlignment()) + nl(Out) << iName << "->setAlignment(" + << mallocI->getAlignment() << ");"; + break; + } + case Instruction::Free: { + Out << "FreeInst* " << iName << " = new FreeInst(" + << getCppName(I->getOperand(0)) << ", " << bbname << ");"; + break; + } + case Instruction::Alloca: { + const AllocaInst* allocaI = cast(I); + Out << "AllocaInst* " << iName << " = new AllocaInst(" + << getCppName(allocaI->getAllocatedType()) << ", "; + if (allocaI->isArrayAllocation()) + Out << opNames[0] << ", "; + Out << "\""; + printEscapedString(allocaI->getName()); + Out << "\", " << bbname << ");"; + if (allocaI->getAlignment()) + nl(Out) << iName << "->setAlignment(" + << allocaI->getAlignment() << ");"; + break; + } + case Instruction::Load:{ + const LoadInst* load = cast(I); + Out << "LoadInst* " << iName << " = new LoadInst(" + << opNames[0] << ", \""; + printEscapedString(load->getName()); + Out << "\", " << (load->isVolatile() ? "true" : "false" ) + << ", " << bbname << ");"; + break; + } + case Instruction::Store: { + const StoreInst* store = cast(I); + Out << "StoreInst* " << iName << " = new StoreInst(" + << opNames[0] << ", " + << opNames[1] << ", " + << (store->isVolatile() ? "true" : "false") + << ", " << bbname << ");"; + break; + } + case Instruction::GetElementPtr: { + const GetElementPtrInst* gep = cast(I); + if (gep->getNumOperands() <= 2) { + Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create(" + << opNames[0]; + if (gep->getNumOperands() == 2) + Out << ", " << opNames[1]; + } else { + Out << "std::vector " << iName << "_indices;"; + nl(Out); + for (unsigned i = 1; i < gep->getNumOperands(); ++i ) { + Out << iName << "_indices.push_back(" + << opNames[i] << ");"; + nl(Out); + } + Out << "Instruction* " << iName << " = GetElementPtrInst::Create(" + << opNames[0] << ", " << iName << "_indices.begin(), " + << iName << "_indices.end()"; + } + Out << ", \""; + printEscapedString(gep->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::PHI: { + const PHINode* phi = cast(I); + + Out << "PHINode* " << iName << " = PHINode::Create(" + << getCppName(phi->getType()) << ", \""; + printEscapedString(phi->getName()); + Out << "\", " << bbname << ");"; + nl(Out) << iName << "->reserveOperandSpace(" + << phi->getNumIncomingValues() + << ");"; + nl(Out); + for (unsigned i = 0; i < phi->getNumOperands(); i+=2) { + Out << iName << "->addIncoming(" + << opNames[i] << ", " << opNames[i+1] << ");"; + nl(Out); + } + break; + } + case Instruction::Trunc: + case Instruction::ZExt: + case Instruction::SExt: + case Instruction::FPTrunc: + case Instruction::FPExt: + case Instruction::FPToUI: + case Instruction::FPToSI: + case Instruction::UIToFP: + case Instruction::SIToFP: + case Instruction::PtrToInt: + case Instruction::IntToPtr: + case Instruction::BitCast: { + const CastInst* cst = cast(I); + Out << "CastInst* " << iName << " = new "; + switch (I->getOpcode()) { + case Instruction::Trunc: Out << "TruncInst"; break; + case Instruction::ZExt: Out << "ZExtInst"; break; + case Instruction::SExt: Out << "SExtInst"; break; + case Instruction::FPTrunc: Out << "FPTruncInst"; break; + case Instruction::FPExt: Out << "FPExtInst"; break; + case Instruction::FPToUI: Out << "FPToUIInst"; break; + case Instruction::FPToSI: Out << "FPToSIInst"; break; + case Instruction::UIToFP: Out << "UIToFPInst"; break; + case Instruction::SIToFP: Out << "SIToFPInst"; break; + case Instruction::PtrToInt: Out << "PtrToIntInst"; break; + case Instruction::IntToPtr: Out << "IntToPtrInst"; break; + case Instruction::BitCast: Out << "BitCastInst"; break; + default: assert(!"Unreachable"); break; + } + Out << "(" << opNames[0] << ", " + << getCppName(cst->getType()) << ", \""; + printEscapedString(cst->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::Call:{ + const CallInst* call = cast(I); + if (InlineAsm* ila = dyn_cast(call->getOperand(0))) { + Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get(" + << getCppName(ila->getFunctionType()) << ", \"" + << ila->getAsmString() << "\", \"" + << ila->getConstraintString() << "\"," + << (ila->hasSideEffects() ? "true" : "false") << ");"; + nl(Out); + } + if (call->getNumOperands() > 2) { + Out << "std::vector " << iName << "_params;"; + nl(Out); + for (unsigned i = 1; i < call->getNumOperands(); ++i) { + Out << iName << "_params.push_back(" << opNames[i] << ");"; + nl(Out); + } + Out << "CallInst* " << iName << " = CallInst::Create(" + << opNames[0] << ", " << iName << "_params.begin(), " + << iName << "_params.end(), \""; + } else if (call->getNumOperands() == 2) { + Out << "CallInst* " << iName << " = CallInst::Create(" + << opNames[0] << ", " << opNames[1] << ", \""; + } else { + Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0] + << ", \""; + } + printEscapedString(call->getName()); + Out << "\", " << bbname << ");"; + nl(Out) << iName << "->setCallingConv("; + printCallingConv(call->getCallingConv()); + Out << ");"; + nl(Out) << iName << "->setTailCall(" + << (call->isTailCall() ? "true":"false"); + Out << ");"; + printParamAttrs(call->getParamAttrs(), iName); + Out << iName << "->setParamAttrs(" << iName << "_PAL);"; + nl(Out); + break; + } + case Instruction::Select: { + const SelectInst* sel = cast(I); + Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create("; + Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \""; + printEscapedString(sel->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::UserOp1: + /// FALL THROUGH + case Instruction::UserOp2: { + /// FIXME: What should be done here? + break; + } + case Instruction::VAArg: { + const VAArgInst* va = cast(I); + Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst(" + << opNames[0] << ", " << getCppName(va->getType()) << ", \""; + printEscapedString(va->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::ExtractElement: { + const ExtractElementInst* eei = cast(I); + Out << "ExtractElementInst* " << getCppName(eei) + << " = new ExtractElementInst(" << opNames[0] + << ", " << opNames[1] << ", \""; + printEscapedString(eei->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::InsertElement: { + const InsertElementInst* iei = cast(I); + Out << "InsertElementInst* " << getCppName(iei) + << " = InsertElementInst::Create(" << opNames[0] + << ", " << opNames[1] << ", " << opNames[2] << ", \""; + printEscapedString(iei->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::ShuffleVector: { + const ShuffleVectorInst* svi = cast(I); + Out << "ShuffleVectorInst* " << getCppName(svi) + << " = new ShuffleVectorInst(" << opNames[0] + << ", " << opNames[1] << ", " << opNames[2] << ", \""; + printEscapedString(svi->getName()); + Out << "\", " << bbname << ");"; + break; + } + } + DefinedValues.insert(I); + nl(Out); + delete [] opNames; +} + + // Print out the types, constants and declarations needed by one function + void CppWriter::printFunctionUses(const Function* F) { + nl(Out) << "// Type Definitions"; nl(Out); + if (!is_inline) { + // Print the function's return type + printType(F->getReturnType()); + + // Print the function's function type + printType(F->getFunctionType()); + + // Print the types of each of the function's arguments + for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + AI != AE; ++AI) { + printType(AI->getType()); + } + } + + // Print type definitions for every type referenced by an instruction and + // make a note of any global values or constants that are referenced + SmallPtrSet gvs; + SmallPtrSet consts; + for (Function::const_iterator BB = F->begin(), BE = F->end(); + BB != BE; ++BB){ + for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); + I != E; ++I) { + // Print the type of the instruction itself + printType(I->getType()); + + // Print the type of each of the instruction's operands + for (unsigned i = 0; i < I->getNumOperands(); ++i) { + Value* operand = I->getOperand(i); + printType(operand->getType()); + + // If the operand references a GVal or Constant, make a note of it + if (GlobalValue* GV = dyn_cast(operand)) { + gvs.insert(GV); + if (GlobalVariable *GVar = dyn_cast(GV)) + if (GVar->hasInitializer()) + consts.insert(GVar->getInitializer()); + } else if (Constant* C = dyn_cast(operand)) + consts.insert(C); + } + } + } + + // Print the function declarations for any functions encountered + nl(Out) << "// Function Declarations"; nl(Out); + for (SmallPtrSet::iterator I = gvs.begin(), E = gvs.end(); + I != E; ++I) { + if (Function* Fun = dyn_cast(*I)) { + if (!is_inline || Fun != F) + printFunctionHead(Fun); + } + } + + // Print the global variable declarations for any variables encountered + nl(Out) << "// Global Variable Declarations"; nl(Out); + for (SmallPtrSet::iterator I = gvs.begin(), E = gvs.end(); + I != E; ++I) { + if (GlobalVariable* F = dyn_cast(*I)) + printVariableHead(F); + } + + // Print the constants found + nl(Out) << "// Constant Definitions"; nl(Out); + for (SmallPtrSet::iterator I = consts.begin(), + E = consts.end(); I != E; ++I) { + printConstant(*I); + } + + // Process the global variables definitions now that all the constants have + // been emitted. These definitions just couple the gvars with their constant + // initializers. + nl(Out) << "// Global Variable Definitions"; nl(Out); + for (SmallPtrSet::iterator I = gvs.begin(), E = gvs.end(); + I != E; ++I) { + if (GlobalVariable* GV = dyn_cast(*I)) + printVariableBody(GV); + } + } + + void CppWriter::printFunctionHead(const Function* F) { + nl(Out) << "Function* " << getCppName(F); + if (is_inline) { + Out << " = mod->getFunction(\""; + printEscapedString(F->getName()); + Out << "\", " << getCppName(F->getFunctionType()) << ");"; + nl(Out) << "if (!" << getCppName(F) << ") {"; + nl(Out) << getCppName(F); + } + Out<< " = Function::Create("; + nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ","; + nl(Out) << "/*Linkage=*/"; + printLinkageType(F->getLinkage()); + Out << ","; + nl(Out) << "/*Name=*/\""; + printEscapedString(F->getName()); + Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : ""); + nl(Out,-1); + printCppName(F); + Out << "->setCallingConv("; + printCallingConv(F->getCallingConv()); + Out << ");"; + nl(Out); + if (F->hasSection()) { + printCppName(F); + Out << "->setSection(\"" << F->getSection() << "\");"; + nl(Out); + } + if (F->getAlignment()) { + printCppName(F); + Out << "->setAlignment(" << F->getAlignment() << ");"; + nl(Out); + } + if (F->getVisibility() != GlobalValue::DefaultVisibility) { + printCppName(F); + Out << "->setVisibility("; + printVisibilityType(F->getVisibility()); + Out << ");"; + nl(Out); + } + if (F->hasCollector()) { + printCppName(F); + Out << "->setCollector(\"" << F->getCollector() << "\");"; + nl(Out); + } + if (is_inline) { + Out << "}"; + nl(Out); + } + printParamAttrs(F->getParamAttrs(), getCppName(F)); + printCppName(F); + Out << "->setParamAttrs(" << getCppName(F) << "_PAL);"; + nl(Out); + } + + void CppWriter::printFunctionBody(const Function *F) { + if (F->isDeclaration()) + return; // external functions have no bodies. + + // Clear the DefinedValues and ForwardRefs maps because we can't have + // cross-function forward refs + ForwardRefs.clear(); + DefinedValues.clear(); + + // Create all the argument values + if (!is_inline) { + if (!F->arg_empty()) { + Out << "Function::arg_iterator args = " << getCppName(F) + << "->arg_begin();"; + nl(Out); + } + for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + AI != AE; ++AI) { + Out << "Value* " << getCppName(AI) << " = args++;"; + nl(Out); + if (AI->hasName()) { + Out << getCppName(AI) << "->setName(\"" << AI->getName() << "\");"; + nl(Out); + } + } + } + + // Create all the basic blocks + nl(Out); + for (Function::const_iterator BI = F->begin(), BE = F->end(); + BI != BE; ++BI) { + std::string bbname(getCppName(BI)); + Out << "BasicBlock* " << bbname << " = BasicBlock::Create(\""; + if (BI->hasName()) + printEscapedString(BI->getName()); + Out << "\"," << getCppName(BI->getParent()) << ",0);"; + nl(Out); + } + + // Output all of its basic blocks... for the function + for (Function::const_iterator BI = F->begin(), BE = F->end(); + BI != BE; ++BI) { + std::string bbname(getCppName(BI)); + nl(Out) << "// Block " << BI->getName() << " (" << bbname << ")"; + nl(Out); + + // Output all of the instructions in the basic block... + for (BasicBlock::const_iterator I = BI->begin(), E = BI->end(); + I != E; ++I) { + printInstruction(I,bbname); + } + } + + // Loop over the ForwardRefs and resolve them now that all instructions + // are generated. + if (!ForwardRefs.empty()) { + nl(Out) << "// Resolve Forward References"; + nl(Out); + } + + while (!ForwardRefs.empty()) { + ForwardRefMap::iterator I = ForwardRefs.begin(); + Out << I->second << "->replaceAllUsesWith(" + << getCppName(I->first) << "); delete " << I->second << ";"; + nl(Out); + ForwardRefs.erase(I); + } + } + + void CppWriter::printInline(const std::string& fname, + const std::string& func) { + const Function* F = TheModule->getFunction(func); + if (!F) { + error(std::string("Function '") + func + "' not found in input module"); + return; + } + if (F->isDeclaration()) { + error(std::string("Function '") + func + "' is external!"); + return; + } + nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *" + << getCppName(F); + unsigned arg_count = 1; + for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + AI != AE; ++AI) { + Out << ", Value* arg_" << arg_count; + } + Out << ") {"; + nl(Out); + is_inline = true; + printFunctionUses(F); + printFunctionBody(F); + is_inline = false; + Out << "return " << getCppName(F->begin()) << ";"; + nl(Out) << "}"; + nl(Out); + } + + void CppWriter::printModuleBody() { + // Print out all the type definitions + nl(Out) << "// Type Definitions"; nl(Out); + printTypes(TheModule); + + // Functions can call each other and global variables can reference them so + // define all the functions first before emitting their function bodies. + nl(Out) << "// Function Declarations"; nl(Out); + for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); + I != E; ++I) + printFunctionHead(I); + + // Process the global variables declarations. We can't initialze them until + // after the constants are printed so just print a header for each global + nl(Out) << "// Global Variable Declarations\n"; nl(Out); + for (Module::const_global_iterator I = TheModule->global_begin(), + E = TheModule->global_end(); I != E; ++I) { + printVariableHead(I); + } + + // Print out all the constants definitions. Constants don't recurse except + // through GlobalValues. All GlobalValues have been declared at this point + // so we can proceed to generate the constants. + nl(Out) << "// Constant Definitions"; nl(Out); + printConstants(TheModule); + + // Process the global variables definitions now that all the constants have + // been emitted. These definitions just couple the gvars with their constant + // initializers. + nl(Out) << "// Global Variable Definitions"; nl(Out); + for (Module::const_global_iterator I = TheModule->global_begin(), + E = TheModule->global_end(); I != E; ++I) { + printVariableBody(I); + } + + // Finally, we can safely put out all of the function bodies. + nl(Out) << "// Function Definitions"; nl(Out); + for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); + I != E; ++I) { + if (!I->isDeclaration()) { + nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I) + << ")"; + nl(Out) << "{"; + nl(Out,1); + printFunctionBody(I); + nl(Out,-1) << "}"; + nl(Out); + } + } + } + + void CppWriter::printProgram(const std::string& fname, + const std::string& mName) { + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n"; + Out << "#include \n\n"; + Out << "using namespace llvm;\n\n"; + Out << "Module* " << fname << "();\n\n"; + Out << "int main(int argc, char**argv) {\n"; + Out << " Module* Mod = " << fname << "();\n"; + Out << " verifyModule(*Mod, PrintMessageAction);\n"; + Out << " std::cerr.flush();\n"; + Out << " std::cout.flush();\n"; + Out << " PassManager PM;\n"; + Out << " PM.add(new PrintModulePass(&llvm::cout));\n"; + Out << " PM.run(*Mod);\n"; + Out << " return 0;\n"; + Out << "}\n\n"; + printModule(fname,mName); + } + + void CppWriter::printModule(const std::string& fname, + const std::string& mName) { + nl(Out) << "Module* " << fname << "() {"; + nl(Out,1) << "// Module Construction"; + nl(Out) << "Module* mod = new Module(\"" << mName << "\");"; + if (!TheModule->getTargetTriple().empty()) { + nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");"; + } + if (!TheModule->getTargetTriple().empty()) { + nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple() + << "\");"; + } + + if (!TheModule->getModuleInlineAsm().empty()) { + nl(Out) << "mod->setModuleInlineAsm(\""; + printEscapedString(TheModule->getModuleInlineAsm()); + Out << "\");"; + } + nl(Out); + + // Loop over the dependent libraries and emit them. + Module::lib_iterator LI = TheModule->lib_begin(); + Module::lib_iterator LE = TheModule->lib_end(); + while (LI != LE) { + Out << "mod->addLibrary(\"" << *LI << "\");"; + nl(Out); + ++LI; + } + printModuleBody(); + nl(Out) << "return mod;"; + nl(Out,-1) << "}"; + nl(Out); + } + + void CppWriter::printContents(const std::string& fname, + const std::string& mName) { + Out << "\nModule* " << fname << "(Module *mod) {\n"; + Out << "\nmod->setModuleIdentifier(\"" << mName << "\");\n"; + printModuleBody(); + Out << "\nreturn mod;\n"; + Out << "\n}\n"; + } + + void CppWriter::printFunction(const std::string& fname, + const std::string& funcName) { + const Function* F = TheModule->getFunction(funcName); + if (!F) { + error(std::string("Function '") + funcName + "' not found in input module"); + return; + } + Out << "\nFunction* " << fname << "(Module *mod) {\n"; + printFunctionUses(F); + printFunctionHead(F); + printFunctionBody(F); + Out << "return " << getCppName(F) << ";\n"; + Out << "}\n"; + } + + void CppWriter::printFunctions() { + const Module::FunctionListType &funcs = TheModule->getFunctionList(); + Module::const_iterator I = funcs.begin(); + Module::const_iterator IE = funcs.end(); + + for (; I != IE; ++I) { + const Function &func = *I; + if (!func.isDeclaration()) { + std::string name("define_"); + name += func.getName(); + printFunction(name, func.getName()); + } + } + } + + void CppWriter::printVariable(const std::string& fname, + const std::string& varName) { + const GlobalVariable* GV = TheModule->getNamedGlobal(varName); + + if (!GV) { + error(std::string("Variable '") + varName + "' not found in input module"); + return; + } + Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n"; + printVariableUses(GV); + printVariableHead(GV); + printVariableBody(GV); + Out << "return " << getCppName(GV) << ";\n"; + Out << "}\n"; + } + + void CppWriter::printType(const std::string& fname, + const std::string& typeName) { + const Type* Ty = TheModule->getTypeByName(typeName); + if (!Ty) { + error(std::string("Type '") + typeName + "' not found in input module"); + return; + } + Out << "\nType* " << fname << "(Module *mod) {\n"; + printType(Ty); + Out << "return " << getCppName(Ty) << ";\n"; + Out << "}\n"; + } + + bool CppWriter::runOnModule(Module &M) { + TheModule = &M; + + // Emit a header + Out << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n"; + + // Get the name of the function we're supposed to generate + std::string fname = FuncName.getValue(); + + // Get the name of the thing we are to generate + std::string tgtname = NameToGenerate.getValue(); + if (GenerationType == GenModule || + GenerationType == GenContents || + GenerationType == GenProgram || + GenerationType == GenFunctions) { + if (tgtname == "!bad!") { + if (M.getModuleIdentifier() == "-") + tgtname = ""; + else + tgtname = M.getModuleIdentifier(); + } + } else if (tgtname == "!bad!") + error("You must use the -for option with -gen-{function,variable,type}"); + + switch (WhatToGenerate(GenerationType)) { + case GenProgram: + if (fname.empty()) + fname = "makeLLVMModule"; + printProgram(fname,tgtname); + break; + case GenModule: + if (fname.empty()) + fname = "makeLLVMModule"; + printModule(fname,tgtname); + break; + case GenContents: + if (fname.empty()) + fname = "makeLLVMModuleContents"; + printContents(fname,tgtname); + break; + case GenFunction: + if (fname.empty()) + fname = "makeLLVMFunction"; + printFunction(fname,tgtname); + break; + case GenFunctions: + printFunctions(); + break; + case GenInline: + if (fname.empty()) + fname = "makeLLVMInline"; + printInline(fname,tgtname); + break; + case GenVariable: + if (fname.empty()) + fname = "makeLLVMVariable"; + printVariable(fname,tgtname); + break; + case GenType: + if (fname.empty()) + fname = "makeLLVMType"; + printType(fname,tgtname); + break; + default: + error("Invalid generation option"); + } + + return false; + } +} + +char CppWriter::ID = 0; + +//===----------------------------------------------------------------------===// +// External Interface declaration +//===----------------------------------------------------------------------===// + +bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM, + std::ostream &o, + CodeGenFileType FileType, + bool Fast) { + if (FileType != TargetMachine::AssemblyFile) return true; + PM.add(new CppWriter(o)); + return false; +} Added: llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h?rev=50189&view=auto ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h (added) +++ llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h Wed Apr 23 17:29:24 2008 @@ -0,0 +1,41 @@ +//===-- CPPTargetMachine.h - TargetMachine for the C++ backend --*- 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 TargetMachine that is used by the C++ backend. +// +//===----------------------------------------------------------------------===// + +#ifndef CPPTARGETMACHINE_H +#define CPPTARGETMACHINE_H + +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetData.h" + +namespace llvm { + +struct CPPTargetMachine : public TargetMachine { + const TargetData DataLayout; // Calculates type size & alignment + + CPPTargetMachine(const Module &M, const std::string &FS) + : DataLayout(&M) {} + + virtual bool WantsWholeFile() const { return true; } + virtual bool addPassesToEmitWholeFile(PassManager &PM, std::ostream &Out, + CodeGenFileType FileType, bool Fast); + + // This class always works, but shouldn't be the default in most cases. + static unsigned getModuleMatchQuality(const Module &M) { return 1; } + + virtual const TargetData *getTargetData() const { return &DataLayout; } +}; + +} // End llvm namespace + + +#endif Added: llvm/trunk/lib/Target/CppBackend/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/Makefile?rev=50189&view=auto ============================================================================== --- llvm/trunk/lib/Target/CppBackend/Makefile (added) +++ llvm/trunk/lib/Target/CppBackend/Makefile Wed Apr 23 17:29:24 2008 @@ -0,0 +1,14 @@ +##===- lib/Target/CppBackend/Makefile --- ------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../../.. +LIBRARYNAME = LLVMCppBackend +include $(LEVEL)/Makefile.common + +CompileCommonOpts += -Wno-format Modified: llvm/trunk/tools/llc/llc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=50189&r1=50188&r2=50189&view=diff ============================================================================== --- llvm/trunk/tools/llc/llc.cpp (original) +++ llvm/trunk/tools/llc/llc.cpp Wed Apr 23 17:29:24 2008 @@ -134,10 +134,15 @@ switch (FileType) { case TargetMachine::AssemblyFile: - if (MArch->Name[0] != 'c' || MArch->Name[1] != 0) // not CBE + if (MArch->Name[0] == 'c') { + if (MArch->Name[1] == 0) + OutputFilename += ".cbe.c"; + else if (MArch->Name[1] == 'p' && MArch->Name[2] == 'p') + OutputFilename += ".cpp"; + else + OutputFilename += ".s"; + } else OutputFilename += ".s"; - else - OutputFilename += ".cbe.c"; break; case TargetMachine::ObjectFile: OutputFilename += ".o"; From gohman at apple.com Wed Apr 23 17:31:48 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 15:31:48 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> Message-ID: On Apr 23, 2008, at 10:27 AM, Roman Levenstein wrote: > > Just to make it clear: > This patch is applied currently to the output of Tablegen. > But the proper patch will need to change the Tablegen to generate > correct *.inc files. > Thinking about it, I have a question: > Right now, the beginning of the generrated instruction selector files > is always the same, independent of the *.td file and target > architecture. > But it is generated by tablegen still and therefore cannot be > substituted easily, without changing the tablegen. > Question: May be it is better to define this common part in an include > file, e.g. ISelHeader.h, and then tablegen would generate only the > #include line. What do you think? Another option is to move common code into the SelectionDAGISel parent class, which is a common base class for each of the targets' DAGToDAGISel classes. Dan From asl at math.spbu.ru Wed Apr 23 17:37:04 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 22:37:04 -0000 Subject: [llvm-commits] [llvm] r50190 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Message-ID: <200804232237.m3NMb4E5005508@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 17:37:03 2008 New Revision: 50190 URL: http://llvm.org/viewvc/llvm-project?rev=50190&view=rev Log: Adjust option names for C++ backend Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=50190&r1=50189&r2=50190&view=diff ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original) +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Wed Apr 23 17:37:03 2008 @@ -39,7 +39,7 @@ using namespace llvm; static cl::opt -FuncName("funcname", cl::desc("Specify the name of the generated function"), +FuncName("cppfname", cl::desc("Specify the name of the generated function"), cl::value_desc("function name")); enum WhatToGenerate { @@ -53,23 +53,23 @@ GenType }; -static cl::opt GenerationType(cl::Optional, +static cl::opt GenerationType("cppgen", cl::Optional, cl::desc("Choose what kind of output to generate"), cl::init(GenProgram), cl::values( - clEnumValN(GenProgram, "gen-program", "Generate a complete program"), - clEnumValN(GenModule, "gen-module", "Generate a module definition"), - clEnumValN(GenContents, "gen-contents", "Generate contents of a module"), - clEnumValN(GenFunction, "gen-function", "Generate a function definition"), - clEnumValN(GenFunctions,"gen-functions", "Generate all function definitions"), - clEnumValN(GenInline, "gen-inline", "Generate an inline function"), - clEnumValN(GenVariable, "gen-variable", "Generate a variable definition"), - clEnumValN(GenType, "gen-type", "Generate a type definition"), + clEnumValN(GenProgram, "program", "Generate a complete program"), + clEnumValN(GenModule, "module", "Generate a module definition"), + clEnumValN(GenContents, "contents", "Generate contents of a module"), + clEnumValN(GenFunction, "function", "Generate a function definition"), + clEnumValN(GenFunctions,"functions", "Generate all function definitions"), + clEnumValN(GenInline, "inline", "Generate an inline function"), + clEnumValN(GenVariable, "variable", "Generate a variable definition"), + clEnumValN(GenType, "type", "Generate a type definition"), clEnumValEnd ) ); -static cl::opt NameToGenerate("for", cl::Optional, +static cl::opt NameToGenerate("cppfor", cl::Optional, cl::desc("Specify the name of the thing to generate"), cl::init("!bad!")); From asl at math.spbu.ru Wed Apr 23 17:41:53 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 22:41:53 -0000 Subject: [llvm-commits] [llvm] r50191 - in /llvm/trunk/test: Other/2007-06-16-Funcname.ll lib/llvm2cpp.exp Message-ID: <200804232241.m3NMfr9p005656@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 17:41:53 2008 New Revision: 50191 URL: http://llvm.org/viewvc/llvm-project?rev=50191&view=rev Log: Fix tests due to llvm2cpp move to llc target Modified: llvm/trunk/test/Other/2007-06-16-Funcname.ll llvm/trunk/test/lib/llvm2cpp.exp Modified: llvm/trunk/test/Other/2007-06-16-Funcname.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2007-06-16-Funcname.ll?rev=50191&r1=50190&r2=50191&view=diff ============================================================================== --- llvm/trunk/test/Other/2007-06-16-Funcname.ll (original) +++ llvm/trunk/test/Other/2007-06-16-Funcname.ll Wed Apr 23 17:41:53 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm2cpp -funcname=WAKKA | not grep makeLLVMModule +; RUN: llvm-as < %s | llc -march=cpp -cppfname=WAKKA | not grep makeLLVMModule ; PR1515 define void @foo() { Modified: llvm/trunk/test/lib/llvm2cpp.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm2cpp.exp?rev=50191&r1=50190&r2=50191&view=diff ============================================================================== --- llvm/trunk/test/lib/llvm2cpp.exp (original) +++ llvm/trunk/test/lib/llvm2cpp.exp Wed Apr 23 17:41:53 2008 @@ -9,7 +9,7 @@ global subdir llvmtoolsdir llvmlibsdir objdir srcdir objroot srcroot set timeout 30 set path [file join $objdir $subdir] - set llvm2cpp [file join $llvmtoolsdir llvm2cpp ] + set llc [file join $llvmtoolsdir llc ] set llvmas [file join $llvmtoolsdir llvm-as ] set llvmdis [file join $llvmtoolsdir llvm-dis ] @@ -65,7 +65,7 @@ } set retval [ catch { - exec -keepnewline $llvm2cpp -f -o $generated < $bytecode 2>/dev/null } msg] + exec -keepnewline $llc -march=cpp -f -o $generated < $bytecode 2>/dev/null } msg] if { $retval != 0 } { fail "$test: llvm2cpp returned $retval\n$msg" From asl at math.spbu.ru Wed Apr 23 17:44:03 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 22:44:03 -0000 Subject: [llvm-commits] [llvm] r50192 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Message-ID: <200804232244.m3NMi3Nt005817@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 17:44:03 2008 New Revision: 50192 URL: http://llvm.org/viewvc/llvm-project?rev=50192&view=rev Log: Drop dead includes Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=50192&r1=50191&r2=50192&view=diff ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original) +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Wed Apr 23 17:44:03 2008 @@ -28,9 +28,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/CFG.h" -#include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Config/config.h" #include #include From asl at math.spbu.ru Wed Apr 23 17:46:25 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 23 Apr 2008 22:46:25 -0000 Subject: [llvm-commits] [llvm] r50193 - /llvm/trunk/tools/Makefile Message-ID: <200804232246.m3NMkPEw005921@zion.cs.uiuc.edu> Author: asl Date: Wed Apr 23 17:46:24 2008 New Revision: 50193 URL: http://llvm.org/viewvc/llvm-project?rev=50193&view=rev Log: Disable building of llvm2cpp. The directory will be removed before 2.3 release. Modified: llvm/trunk/tools/Makefile Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=50193&r1=50192&r2=50193&view=diff ============================================================================== --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Wed Apr 23 17:46:24 2008 @@ -15,7 +15,7 @@ opt llvm-as llvm-dis \ llc llvm-ranlib llvm-ar llvm-nm \ llvm-ld llvm-prof llvm-link \ - lli gccas gccld llvm-extract llvm-db llvm2cpp \ + lli gccas gccld llvm-extract llvm-db \ bugpoint llvm-bcanalyzer llvm-stub llvmc2 From lattner at apple.com Wed Apr 23 17:50:07 2008 From: lattner at apple.com (Tanya Lattner) Date: Wed, 23 Apr 2008 15:50:07 -0700 Subject: [llvm-commits] [llvm] r50174 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> References: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> Message-ID: Dale, Can you use the doxygen style comments (///) for this function? > > +// If this cast does not affect the value passed through the varargs > +// area, we can eliminate the use of the cast. > +static bool isSafeToEliminateVarargsCast(const CallSite CS, > + const CastInst * const CI, > + const TargetData * const TD, > + const int ix) { > Thanks, Tanya From evan.cheng at apple.com Wed Apr 23 17:51:36 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Apr 2008 15:51:36 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <3F534552-8033-40A3-8E0A-733516299939@apple.com> <46F54225-290F-47D6-979B-2817F6FA429B@apple.com> <42DA8789-6C67-438B-B51E-9609F25B2A36@apple.com> <6B1AB7F5-E6F9-46CA-B07A-D706477A5484@apple.com> Message-ID: <7BBF954B-F862-4614-AAE6-C4EB09BAC50F@apple.com> Yes, moving it out of tblegen is a good idea. I don't have strong preference as to where it is moved to. Evan On Apr 23, 2008, at 3:31 PM, Dan Gohman wrote: > > On Apr 23, 2008, at 10:27 AM, Roman Levenstein wrote: >> >> Just to make it clear: >> This patch is applied currently to the output of Tablegen. >> But the proper patch will need to change the Tablegen to generate >> correct *.inc files. >> Thinking about it, I have a question: >> Right now, the beginning of the generrated instruction selector files >> is always the same, independent of the *.td file and target >> architecture. >> But it is generated by tablegen still and therefore cannot be >> substituted easily, without changing the tablegen. >> Question: May be it is better to define this common part in an >> include >> file, e.g. ISelHeader.h, and then tablegen would generate only the >> #include line. What do you think? > > Another option is to move common code into the > SelectionDAGISel parent class, which is a common base class > for each of the targets' DAGToDAGISel classes. > > Dan > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Wed Apr 23 18:13:08 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 16:13:08 -0700 Subject: [llvm-commits] [llvm] r50189 - in /llvm/trunk: autoconf/configure.ac configure lib/Target/CppBackend/ lib/Target/CppBackend/CPPBackend.cpp lib/Target/CppBackend/CPPTargetMachine.h lib/Target/CppBackend/Makefile tools/llc/llc.cpp In-Reply-To: <200804232229.m3NMTPsW005221@zion.cs.uiuc.edu> References: <200804232229.m3NMTPsW005221@zion.cs.uiuc.edu> Message-ID: Aha, this will bring us one step closer to having a universal 'llvm' command. ;-) Dan On Apr 23, 2008, at 3:29 PM, Anton Korobeynikov wrote: > Author: asl > Date: Wed Apr 23 17:29:24 2008 > New Revision: 50189 > > URL: http://llvm.org/viewvc/llvm-project?rev=50189&view=rev > Log: > First step of implementing PR1538: move llvm2cpp logic to new 'target' > > Added: > llvm/trunk/lib/Target/CppBackend/ > llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp > llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h > llvm/trunk/lib/Target/CppBackend/Makefile > Modified: > llvm/trunk/autoconf/configure.ac > llvm/trunk/configure > llvm/trunk/tools/llc/llc.cpp > > From gohman at apple.com Wed Apr 23 18:15:23 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 23:15:23 -0000 Subject: [llvm-commits] [llvm] r50196 - in /llvm/trunk/lib: Debugger/SourceLanguage-Unknown.cpp Support/Debug.cpp Support/Timer.cpp Target/TargetMachine.cpp Message-ID: <200804232315.m3NNFN8p006755@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 18:15:23 2008 New Revision: 50196 URL: http://llvm.org/viewvc/llvm-project?rev=50196&view=rev Log: Make these variables static. Modified: llvm/trunk/lib/Debugger/SourceLanguage-Unknown.cpp llvm/trunk/lib/Support/Debug.cpp llvm/trunk/lib/Support/Timer.cpp llvm/trunk/lib/Target/TargetMachine.cpp Modified: llvm/trunk/lib/Debugger/SourceLanguage-Unknown.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/SourceLanguage-Unknown.cpp?rev=50196&r1=50195&r2=50196&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/SourceLanguage-Unknown.cpp (original) +++ llvm/trunk/lib/Debugger/SourceLanguage-Unknown.cpp Wed Apr 23 18:15:23 2008 @@ -59,7 +59,7 @@ // namespace { - struct SLU : public SourceLanguage { + static struct SLU : public SourceLanguage { //===------------------------------------------------------------------===// // Implement the miscellaneous methods... // Modified: llvm/trunk/lib/Support/Debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Debug.cpp?rev=50196&r1=50195&r2=50196&view=diff ============================================================================== --- llvm/trunk/lib/Support/Debug.cpp (original) +++ llvm/trunk/lib/Support/Debug.cpp Wed Apr 23 18:15:23 2008 @@ -33,19 +33,19 @@ #ifndef NDEBUG // -debug - Command line option to enable the DEBUG statements in the passes. // This flag may only be enabled in debug builds. - cl::opt + static cl::opt Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag)); - std::string CurrentDebugType; - struct DebugOnlyOpt { + static std::string CurrentDebugType; + static struct DebugOnlyOpt { void operator=(const std::string &Val) const { DebugFlag |= !Val.empty(); CurrentDebugType = Val; } } DebugOnlyOptLoc; - cl::opt > + static cl::opt > DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"), cl::Hidden, cl::value_desc("debug string"), cl::location(DebugOnlyOptLoc), cl::ValueRequired); Modified: llvm/trunk/lib/Support/Timer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=50196&r1=50195&r2=50196&view=diff ============================================================================== --- llvm/trunk/lib/Support/Timer.cpp (original) +++ llvm/trunk/lib/Support/Timer.cpp Wed Apr 23 18:15:23 2008 @@ -39,12 +39,12 @@ } namespace { - cl::opt + static cl::opt TrackSpace("track-memory", cl::desc("Enable -time-passes memory " "tracking (this may be slow)"), cl::Hidden); - cl::opt + static cl::opt InfoOutputFilename("info-output-file", cl::value_desc("filename"), cl::desc("File to append -stats and -timer output to"), cl::Hidden, cl::location(getLibSupportInfoOutputFilename())); Modified: llvm/trunk/lib/Target/TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=50196&r1=50195&r2=50196&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/TargetMachine.cpp Wed Apr 23 18:15:23 2008 @@ -40,59 +40,59 @@ unsigned StackAlignment; } namespace { - cl::opt PrintCode("print-machineinstrs", + static cl::opt PrintCode("print-machineinstrs", cl::desc("Print generated machine code"), cl::location(PrintMachineCode), cl::init(false)); - cl::opt + static cl::opt DisableFPElim("disable-fp-elim", cl::desc("Disable frame pointer elimination optimization"), cl::location(NoFramePointerElim), cl::init(false)); - cl::opt + static cl::opt DisableExcessPrecision("disable-excess-fp-precision", cl::desc("Disable optimizations that may increase FP precision"), cl::location(NoExcessFPPrecision), cl::init(false)); - cl::opt + static cl::opt EnableUnsafeFPMath("enable-unsafe-fp-math", cl::desc("Enable optimizations that may decrease FP precision"), cl::location(UnsafeFPMath), cl::init(false)); - cl::opt + static cl::opt EnableFiniteOnlyFPMath("enable-finite-only-fp-math", cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"), cl::location(FiniteOnlyFPMathOption), cl::init(false)); - cl::opt + static cl::opt EnableHonorSignDependentRoundingFPMath(cl::Hidden, "enable-sign-dependent-rounding-fp-math", cl::desc("Force codegen to assume rounding mode can change dynamically"), cl::location(HonorSignDependentRoundingFPMathOption), cl::init(false)); - cl::opt + static cl::opt GenerateSoftFloatCalls("soft-float", cl::desc("Generate software floating point library calls"), cl::location(UseSoftFloat), cl::init(false)); - cl::opt + static cl::opt DontPlaceZerosInBSS("nozero-initialized-in-bss", cl::desc("Don't place zero-initialized symbols into bss section"), cl::location(NoZerosInBSS), cl::init(false)); - cl::opt + static cl::opt EnableExceptionHandling("enable-eh", cl::desc("Emit DWARF exception handling (default if target supports)"), cl::location(ExceptionHandling), cl::init(false)); - cl::opt + static cl::opt EnableUnwindTables("unwind-tables", cl::desc("Generate unwinding tables for all functions"), cl::location(UnwindTablesMandatory), cl::init(false)); - cl::opt + static cl::opt DefRelocationModel( "relocation-model", cl::desc("Choose relocation model"), @@ -108,7 +108,7 @@ clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", " Relocatable external references, non-relocatable code"), clEnumValEnd)); - cl::opt + static cl::opt DefCodeModel( "code-model", cl::desc("Choose code model"), @@ -127,12 +127,12 @@ " Large code model"), clEnumValEnd)); - cl::opt + static cl::opt EnablePerformTailCallOpt("tailcallopt", cl::desc("Turn on tail call optimization."), cl::location(PerformTailCallOpt), cl::init(false)); - cl::opt + static cl::opt EnableOptimizeForSize("optimize-size", cl::desc("Optimize for size."), cl::location(OptimizeForSize), From dpatel at apple.com Wed Apr 23 18:50:58 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Apr 2008 23:50:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50198 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp llvm-convert.cpp Message-ID: <200804232350.m3NNowLr007768@zion.cs.uiuc.edu> Author: dpatel Date: Wed Apr 23 18:50:58 2008 New Revision: 50198 URL: http://llvm.org/viewvc/llvm-project?rev=50198&view=rev Log: Use bitcast to connect aggreate return value with actual return registers. Now struct bar { double f; int a; char b, c, d, e; }; is returned as { double, i64 } Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50198&r1=50197&r2=50198&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Wed Apr 23 18:50:58 2008 @@ -934,7 +934,6 @@ return true; // llvm only accepts first class types for multiple values in ret instruction. - bool foundNonInt = false; bool foundInt = false; unsigned STyElements = STy->getNumElements(); for (unsigned i = 0; i < STyElements; ++i) { @@ -943,22 +942,9 @@ ETy = ATy->getElementType(); if (!ETy->isFirstClassType() && ETy->getTypeID() != Type::X86_FP80TyID) return false; - if (!ETy->isInteger()) - foundNonInt = true; - else + if (ETy->isInteger()) foundInt = true; } - // FIXME. llvm x86-64 code generator does not handle all cases of - // multiple value return. Remove this when the code generator restriction - // is removed. - if (!foundNonInt) - return false; - - // FIXME: Fix code generator. Causes Benchmarks/McCat/09-vor/vor failures. - if (STyElements == 2 - && STy->getElementType(0)->getTypeID() == Type::DoubleTyID - && STy->getElementType(1)->getTypeID() == Type::DoubleTyID) - return false; // Let gcc specific routine answer the question. enum x86_64_reg_class Class[MAX_CLASSES]; @@ -1003,6 +989,114 @@ return NULL; } +void +llvm_x86_64_get_multiple_return_reg_classes(tree TreeType, const Type *Ty, + std::vector &Elts){ + enum x86_64_reg_class Class[MAX_CLASSES]; + enum machine_mode Mode = ix86_getNaturalModeForType(TreeType); + HOST_WIDE_INT Bytes = + (Mode == BLKmode) ? int_size_in_bytes(TreeType) : (int) GET_MODE_SIZE(Mode); + int NumClasses = ix86_ClassifyArgument(Mode, TreeType, Class, 0); + if (!NumClasses) + assert(0 && "This type does not need multiple return registers!"); + + if (NumClasses == 1 && Class[0] == X86_64_INTEGERSI_CLASS) + // This will fit in one i32 register. + assert(0 && "This type does not need multiple return registers!"); + + if (NumClasses == 1 && Class[0] == X86_64_INTEGER_CLASS) + assert(0 && "This type does not need multiple return registers!"); + + + for (int i = 0; i < NumClasses; ++i) { + switch (Class[i]) { + case X86_64_INTEGER_CLASS: + case X86_64_INTEGERSI_CLASS: + Elts.push_back(Type::Int64Ty); + Bytes -= 8; + break; + case X86_64_SSE_CLASS: + // If it's a SSE class argument, then one of the followings are possible: + // 1. 1 x SSE, size is 8: 1 x Double. + // 2. 1 x SSE + 1 x SSEUP, size is 16: 1 x <4 x i32>, <4 x f32>, + // <2 x i64>, or <2 x f64>. + // 3. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float. + // 4. 2 x SSE, size is 16: 2 x Double. + if ((NumClasses-i) == 1) { + if (Bytes == 8) { + Elts.push_back(Type::DoubleTy); + Bytes -= 8; + } else + assert(0 && "Not yet handled!"); + } else if ((NumClasses-i) == 2) { + if (Class[i+1] == X86_64_SSEUP_CLASS) { + const Type *Ty = ConvertType(TreeType); + if (const StructType *STy = dyn_cast(Ty)) + // Look pass the struct wrapper. + if (STy->getNumElements() == 1) + Ty = STy->getElementType(0); + if (const VectorType *VTy = dyn_cast(Ty)) { + if (VTy->getNumElements() == 2) { + if (VTy->getElementType()->isInteger()) + Elts.push_back(VectorType::get(Type::Int64Ty, 2)); + else + Elts.push_back(VectorType::get(Type::DoubleTy, 2)); + Bytes -= 8; + } else { + assert(VTy->getNumElements() == 4); + if (VTy->getElementType()->isInteger()) + Elts.push_back(VectorType::get(Type::Int32Ty, 4)); + else + Elts.push_back(VectorType::get(Type::FloatTy, 4)); + Bytes -= 4; + } + } else if (llvm_x86_is_all_integer_types(Ty)) { + Elts.push_back(VectorType::get(Type::Int32Ty, 4)); + Bytes -= 4; + } else { + Elts.push_back(VectorType::get(Type::FloatTy, 4)); + Bytes -= 4; + } + } else if (Class[i+1] == X86_64_SSESF_CLASS) { + assert(Bytes == 12 && "Not yet handled!"); + Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::FloatTy); + Bytes -= 12; + } else if (Class[i+1] == X86_64_SSE_CLASS) { + Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::DoubleTy); + Bytes -= 16; + } else if (Class[i+1] == X86_64_SSEDF_CLASS && Bytes == 16) { + Elts.push_back(VectorType::get(Type::FloatTy, 2)); + Elts.push_back(Type::DoubleTy); + } else if (Class[i+1] == X86_64_INTEGER_CLASS) { + Elts.push_back(VectorType::get(Type::FloatTy, 2)); + Elts.push_back(Type::Int64Ty); + } else + assert(0 && "Not yet handled!"); + ++i; // Already handled the next one. + } else + assert(0 && "Not yet handled!"); + break; + case X86_64_SSESF_CLASS: + Elts.push_back(Type::FloatTy); + Bytes -= 4; + break; + case X86_64_SSEDF_CLASS: + Elts.push_back(Type::DoubleTy); + Bytes -= 8; + break; + case X86_64_X87_CLASS: + case X86_64_X87UP_CLASS: + case X86_64_COMPLEX_X87_CLASS: + assert(0 && "Not yet handled!"); + case X86_64_NO_CLASS: + assert(0 && "Not yet handled!"); + default: assert(0 && "Unexpected register class!"); + } + } +} + // Return LLVM Type if TYPE can be returned as an aggregate, // otherwise return NULL. const Type *llvm_x86_aggr_type_for_struct_return(tree type) { @@ -1021,54 +1115,10 @@ return StructType::get(ElementTypes, STy->isPacked()); } - if (NumElements == 3 - && STy->getElementType(0)->getTypeID() == Type::FloatTyID - && STy->getElementType(1)->getTypeID() == Type::FloatTyID - && STy->getElementType(2)->getTypeID() == Type::FloatTyID) { - ElementTypes.push_back(VectorType::get(Type::FloatTy, 4)); - ElementTypes.push_back(Type::FloatTy); - return StructType::get(ElementTypes, STy->isPacked()); - } + std::vector GCCElts; + llvm_x86_64_get_multiple_return_reg_classes(type, Ty, GCCElts); + return StructType::get(GCCElts, STy->isPacked()); - for (unsigned i = 0; i < NumElements; ++i) { - const Type *T = STy->getElementType(i); - - if (T->isFirstClassType()) { - ElementTypes.push_back(T); - continue; - } - - const ArrayType *ATy = dyn_cast(T); - assert (ATy && "Unexpected struct element type!"); - assert (ATy->getElementType()->isFirstClassType() - && "Unexpected ArrayType element type!"); - - unsigned size = ATy->getNumElements(); - if (ATy->getElementType()->isFloatingPoint()) { - switch (size) { - case 2: - // use { <4 x float> } for struct { float[2]; } - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); - break; - case 3: - // use { <4 x float>, float } for struct { float[3]; } - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); - ElementTypes.push_back(ATy->getElementType()); - break; - case 4: - // use { <4 x float>, <4 x float> } for struct { float[4]; } - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); - ElementTypes.push_back(VectorType::get(ATy->getElementType(), 4)); - break; - default: - assert (0 && "Unexpected floating point array size!"); - } - } else { - for (unsigned j = 0; j < size; ++j) - ElementTypes.push_back(ATy->getElementType()); - } - } - return StructType::get(ElementTypes, STy->isPacked()); } // llvm_x86_build_multiple_return_value - Function FN returns multiple value @@ -1082,6 +1132,17 @@ const PointerType *PTy = cast(RetVal->getType()); const StructType *RetSTy = cast(PTy->getElementType()); + llvm::Value *Idxs[3]; + Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); + Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, 0); + Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, 0); + Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv_gep"); + Value *E = Builder.CreateLoad(GEP, "mrv"); + Value *R = Builder.CreateBitCast(E, STy->getElementType(0), "tmp"); + + + + // Walk RetSTy elements and populate RetVals vector. Note, STy and RetSTy // may not match. For example, when STy is { <2 x float> } the RetSTy is // { float[2]; } @@ -1227,6 +1288,7 @@ const PointerType *PTy = cast(Dest->getType()); const StructType *DestTy = cast(PTy->getElementType()); + unsigned SNO = 0; unsigned DNO = 0; Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=50198&r1=50197&r2=50198&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Apr 23 18:50:58 2008 @@ -760,8 +760,16 @@ } else { Value *RetVal = DECL_LLVM(DECL_RESULT(FnDecl)); if (const StructType *STy = dyn_cast(Fn->getReturnType())) { - // Handle multiple return values - LLVM_BUILD_MULTIPLE_RETURN_VALUE(Fn,RetVal,RetVals,Builder); + Value *R1 = BitCastToType(RetVal, PointerType::getUnqual(STy)); + + llvm::Value *Idxs[2]; + Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); + for (unsigned ri = 0; ri < STy->getNumElements(); ++ri) { + Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, ri); + Value *GEP = Builder.CreateGEP(R1, Idxs, Idxs+2, "mrv_gep"); + Value *E = Builder.CreateLoad(GEP, "mrv"); + RetVals.push_back(E); + } } else { // Otherwise, this aggregate result must be something that is returned in // a scalar register for this target. We must bit convert the aggregate @@ -2641,7 +2649,9 @@ Call->setName("tmp"); if (Client.isAggrReturn()) { - LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Call,DestLoc->Ptr,DestLoc->Volatile,Builder); + Value *Dest = BitCastToType(DestLoc->Ptr, + PointerType::getUnqual(Call->getType())); + LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Call,Dest,DestLoc->Volatile,Builder); return 0; } From sabre at nondot.org Wed Apr 23 19:01:20 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Apr 2008 00:01:20 -0000 Subject: [llvm-commits] [llvm] r50199 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll Message-ID: <200804240001.m3O01KsW008077@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 19:01:19 2008 New Revision: 50199 URL: http://llvm.org/viewvc/llvm-project?rev=50199&view=rev Log: Split some code out of the main SimplifyCFG loop into its own function. Fix said code to handle merging return instructions together correctly when handling multiple return values. Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=50199&r1=50198&r2=50199&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Apr 23 19:01:19 2008 @@ -1165,6 +1165,105 @@ return true; } +/// SimplifyCondBranchToTwoReturns - If we found a conditional branch that goes +/// to two returning blocks, try to merge them together into one return, +/// introducing a select if the return values disagree. +static bool SimplifyCondBranchToTwoReturns(BranchInst *BI) { + assert(BI->isConditional() && "Must be a conditional branch"); + BasicBlock *TrueSucc = BI->getSuccessor(0); + BasicBlock *FalseSucc = BI->getSuccessor(1); + ReturnInst *TrueRet = cast(TrueSucc->getTerminator()); + ReturnInst *FalseRet = cast(FalseSucc->getTerminator()); + + // Check to ensure both blocks are empty (just a return) or optionally empty + // with PHI nodes. If there are other instructions, merging would cause extra + // computation on one path or the other. + BasicBlock::iterator BBI = TrueRet; + if (BBI != TrueSucc->begin() && !isa(--BBI)) + return false; // Not empty with optional phi nodes. + BBI = FalseRet; + if (BBI != FalseSucc->begin() && !isa(--BBI)) + return false; // Not empty with optional phi nodes. + + // Okay, we found a branch that is going to two return nodes. If + // there is no return value for this function, just change the + // branch into a return. + if (FalseRet->getNumOperands() == 0) { + TrueSucc->removePredecessor(BI->getParent()); + FalseSucc->removePredecessor(BI->getParent()); + ReturnInst::Create(0, BI); + BI->eraseFromParent(); + return true; + } + + // Otherwise, build up the result values for the new return. + SmallVector TrueResult; + SmallVector FalseResult; + + for (unsigned i = 0, e = TrueRet->getNumOperands(); i != e; ++i) { + // Otherwise, figure out what the true and false return values are + // so we can insert a new select instruction. + Value *TrueValue = TrueRet->getOperand(i); + Value *FalseValue = FalseRet->getOperand(i); + + // Unwrap any PHI nodes in the return blocks. + if (PHINode *TVPN = dyn_cast(TrueValue)) + if (TVPN->getParent() == TrueSucc) + TrueValue = TVPN->getIncomingValueForBlock(BI->getParent()); + if (PHINode *FVPN = dyn_cast(FalseValue)) + if (FVPN->getParent() == FalseSucc) + FalseValue = FVPN->getIncomingValueForBlock(BI->getParent()); + + // In order for this transformation to be safe, we must be able to + // unconditionally execute both operands to the return. This is + // normally the case, but we could have a potentially-trapping + // constant expression that prevents this transformation from being + // safe. + if (ConstantExpr *TCV = dyn_cast(TrueValue)) + if (TCV->canTrap()) + return false; + if (ConstantExpr *FCV = dyn_cast(FalseValue)) + if (FCV->canTrap()) + return false; + + TrueResult.push_back(TrueValue); + FalseResult.push_back(FalseValue); + } + + // Okay, we collected all the mapped values and checked them for sanity, and + // defined to really do this transformation. First, update the CFG. + TrueSucc->removePredecessor(BI->getParent()); + FalseSucc->removePredecessor(BI->getParent()); + + // Insert select instructions where needed. + Value *BrCond = BI->getCondition(); + for (unsigned i = 0, e = TrueRet->getNumOperands(); i != e; ++i) { + // Insert a select if the results differ. + if (TrueResult[i] == FalseResult[i] || isa(FalseResult[i])) + continue; + if (isa(TrueResult[i])) { + TrueResult[i] = FalseResult[i]; + continue; + } + + TrueResult[i] = SelectInst::Create(BrCond, TrueResult[i], + FalseResult[i], "retval", BI); + } + + Value *RI = ReturnInst::Create(&TrueResult[0], TrueResult.size(), BI); + + DOUT << "\nCHANGING BRANCH TO TWO RETURNS INTO SELECT:" + << "\n " << *BI << "NewRet = " << *RI + << "TRUEBLOCK: " << *TrueSucc << "FALSEBLOCK: "<< *FalseSucc; + + BI->eraseFromParent(); + + if (Instruction *BrCondI = dyn_cast(BrCond)) + ErasePossiblyDeadInstructionTree(BrCondI); + return true; +} + + namespace { /// ConstantIntOrdering - This class implements a stable ordering of constant /// integers that does not depend on their address. This is important for @@ -1292,73 +1391,12 @@ while (!CondBranchPreds.empty()) { BranchInst *BI = CondBranchPreds.back(); CondBranchPreds.pop_back(); - BasicBlock *TrueSucc = BI->getSuccessor(0); - BasicBlock *FalseSucc = BI->getSuccessor(1); - BasicBlock *OtherSucc = TrueSucc == BB ? FalseSucc : TrueSucc; // Check to see if the non-BB successor is also a return block. - if (isa(OtherSucc->getTerminator())) { - // Check to see if there are only PHI instructions in this block. - BasicBlock::iterator OSI = OtherSucc->getTerminator(); - if (OSI == OtherSucc->begin() || isa(--OSI)) { - // Okay, we found a branch that is going to two return nodes. If - // there is no return value for this function, just change the - // branch into a return. - if (RI->getNumOperands() == 0) { - TrueSucc->removePredecessor(BI->getParent()); - FalseSucc->removePredecessor(BI->getParent()); - ReturnInst::Create(0, BI); - BI->getParent()->getInstList().erase(BI); - return true; - } - - // Otherwise, figure out what the true and false return values are - // so we can insert a new select instruction. - Value *TrueValue = TrueSucc->getTerminator()->getOperand(0); - Value *FalseValue = FalseSucc->getTerminator()->getOperand(0); - - // Unwrap any PHI nodes in the return blocks. - if (PHINode *TVPN = dyn_cast(TrueValue)) - if (TVPN->getParent() == TrueSucc) - TrueValue = TVPN->getIncomingValueForBlock(BI->getParent()); - if (PHINode *FVPN = dyn_cast(FalseValue)) - if (FVPN->getParent() == FalseSucc) - FalseValue = FVPN->getIncomingValueForBlock(BI->getParent()); - - // In order for this transformation to be safe, we must be able to - // unconditionally execute both operands to the return. This is - // normally the case, but we could have a potentially-trapping - // constant expression that prevents this transformation from being - // safe. - if ((!isa(TrueValue) || - !cast(TrueValue)->canTrap()) && - (!isa(TrueValue) || - !cast(TrueValue)->canTrap())) { - TrueSucc->removePredecessor(BI->getParent()); - FalseSucc->removePredecessor(BI->getParent()); - - // Insert a new select instruction. - Value *NewRetVal; - Value *BrCond = BI->getCondition(); - if (TrueValue != FalseValue) - NewRetVal = SelectInst::Create(BrCond, TrueValue, - FalseValue, "retval", BI); - else - NewRetVal = TrueValue; - - DOUT << "\nCHANGING BRANCH TO TWO RETURNS INTO SELECT:" - << "\n " << *BI << "Select = " << *NewRetVal - << "TRUEBLOCK: " << *TrueSucc << "FALSEBLOCK: "<< *FalseSucc; - - ReturnInst::Create(NewRetVal, BI); - BI->eraseFromParent(); - if (Instruction *BrCondI = dyn_cast(BrCond)) - if (isInstructionTriviallyDead(BrCondI)) - BrCondI->eraseFromParent(); - return true; - } - } - } + if (isa(BI->getSuccessor(0)->getTerminator()) && + isa(BI->getSuccessor(1)->getTerminator()) && + SimplifyCondBranchToTwoReturns(BI)) + return true; } } } else if (isa(BB->begin())) { Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll?rev=50199&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll Wed Apr 23 19:01:19 2008 @@ -0,0 +1,43 @@ +; RUN: llvm-as < %s | opt -simplifycfg -disable-output +; rdar://5882392 +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-apple-darwin9" + %struct.Py_complex = type { double, double } + +define %struct.Py_complex @_Py_c_pow(double %a.0, double %a.1, double %b.0, double %b.1) nounwind { +entry: + %tmp7 = fcmp une double %b.0, 0.000000e+00 ; [#uses=1] + %tmp11 = fcmp une double %b.1, 0.000000e+00 ; [#uses=1] + %bothcond = or i1 %tmp7, %tmp11 ; [#uses=1] + br i1 %bothcond, label %bb15, label %bb53 + +bb15: ; preds = %entry + %tmp18 = fcmp une double %a.0, 0.000000e+00 ; [#uses=1] + %tmp24 = fcmp une double %a.1, 0.000000e+00 ; [#uses=1] + %bothcond1 = or i1 %tmp18, %tmp24 ; [#uses=1] + br i1 %bothcond1, label %bb29, label %bb27 + +bb27: ; preds = %bb15 + %tmp28 = call i32* @__error( ) nounwind ; [#uses=1] + store i32 33, i32* %tmp28, align 4 + ret double undef, double undef + +bb29: ; preds = %bb15 + %tmp36 = fcmp une double %b.1, 0.000000e+00 ; [#uses=1] + br i1 %tmp36, label %bb39, label %bb47 + +bb39: ; preds = %bb29 + br label %bb47 + +bb47: ; preds = %bb39, %bb29 + ret double undef, double undef + +bb53: ; preds = %entry + ret double undef, double undef +} + +declare i32* @__error() + +declare double @pow(double, double) nounwind readonly + +declare double @cos(double) nounwind readonly From gohman at apple.com Wed Apr 23 19:11:32 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 24 Apr 2008 00:11:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50200 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s Message-ID: <200804240011.m3O0BXt1008394@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 19:11:32 2008 New Revision: 50200 URL: http://llvm.org/viewvc/llvm-project?rev=50200&view=rev Log: Fix the darwin snapshot_ret to keep %rsp 16-byte aligned. This is pretty obscure, but it turns out that LLVM's -regalloc=local occasionally finds a way to need xmm spills in some of these trivial ABI testcases, and the code for that requires proper stack alignment. This fixes a memory trap in gcc.target/x86_64/abi/test_struct_returning.c. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s?rev=50200&r1=50199&r2=50200&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s Wed Apr 23 19:11:32 2008 @@ -41,6 +41,8 @@ .p2align 4,,15 .globl _snapshot_ret _snapshot_ret: + pushq %rbp + movq %rsp, %rbp movq %rdi, _rdi(%rip) call *_callthis(%rip) movq %rax, _rax(%rip) @@ -51,6 +53,7 @@ fstpt _x87_regs+16(%rip) fldt _x87_regs+16(%rip) fldt _x87_regs(%rip) + leave ret .comm _callthis,8 From sabre at nondot.org Wed Apr 23 19:16:28 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Apr 2008 00:16:28 -0000 Subject: [llvm-commits] [llvm] r50201 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200804240016.m3O0GSV6008541@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 19:16:28 2008 New Revision: 50201 URL: http://llvm.org/viewvc/llvm-project?rev=50201&view=rev Log: code cleanup, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=50201&r1=50200&r2=50201&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Apr 23 19:16:28 2008 @@ -1516,25 +1516,27 @@ // for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; - if (Inst->getType() != Type::VoidTy) { - LatticeVal &IV = Values[Inst]; - if ((IV.isConstant() || IV.isUndefined()) && - !isa(Inst)) { - Constant *Const = IV.isConstant() - ? IV.getConstant() : UndefValue::get(Inst->getType()); - DOUT << " Constant: " << *Const << " = " << *Inst; - - // Replaces all of the uses of a variable with uses of the constant. - Inst->replaceAllUsesWith(Const); - - // Delete the instruction. - BB->getInstList().erase(Inst); - - // Hey, we just changed something! - MadeChanges = true; - ++NumInstRemoved; - } - } + if (Inst->getType() == Type::VoidTy || + isa(Inst)) + continue; + + LatticeVal &IV = Values[Inst]; + if (!IV.isConstant() && !IV.isUndefined()) + continue; + + Constant *Const = IV.isConstant() + ? IV.getConstant() : UndefValue::get(Inst->getType()); + DOUT << " Constant: " << *Const << " = " << *Inst; + + // Replaces all of the uses of a variable with uses of the constant. + Inst->replaceAllUsesWith(Const); + + // Delete the instruction. + Inst->eraseFromParent(); + + // Hey, we just changed something! + MadeChanges = true; + ++NumInstRemoved; } } From sabre at nondot.org Wed Apr 23 19:19:54 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Apr 2008 00:19:54 -0000 Subject: [llvm-commits] [llvm] r50202 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200804240019.m3O0JssQ008659@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 19:19:54 2008 New Revision: 50202 URL: http://llvm.org/viewvc/llvm-project?rev=50202&view=rev Log: Don't replace multiple result of calls with undef, sccp tracks getresult values, not call values in this case. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=50202&r1=50201&r2=50202&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Apr 23 19:19:54 2008 @@ -1516,7 +1516,8 @@ // for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; - if (Inst->getType() == Type::VoidTy || + if (Inst->getType() == Type::VoidTy || + isa(Inst->getType()) || isa(Inst)) continue; @@ -1692,7 +1693,8 @@ } else { for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; - if (Inst->getType() != Type::VoidTy) { + if (Inst->getType() != Type::VoidTy && + !isa(Inst->getType())) { LatticeVal &IV = Values[Inst]; if (IV.isConstant() || (IV.isUndefined() && !isa(Inst))) { From sabre at nondot.org Wed Apr 23 19:21:50 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Apr 2008 00:21:50 -0000 Subject: [llvm-commits] [llvm] r50203 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200804240021.m3O0LoQ4008735@zion.cs.uiuc.edu> Author: lattner Date: Wed Apr 23 19:21:50 2008 New Revision: 50203 URL: http://llvm.org/viewvc/llvm-project?rev=50203&view=rev Log: code restructuring, not functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=50203&r1=50202&r2=50203&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Apr 23 19:21:50 2008 @@ -1693,28 +1693,30 @@ } else { for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; - if (Inst->getType() != Type::VoidTy && - !isa(Inst->getType())) { - LatticeVal &IV = Values[Inst]; - if (IV.isConstant() || - (IV.isUndefined() && !isa(Inst))) { - Constant *Const = IV.isConstant() - ? IV.getConstant() : UndefValue::get(Inst->getType()); - DOUT << " Constant: " << *Const << " = " << *Inst; - - // Replaces all of the uses of a variable with uses of the - // constant. - Inst->replaceAllUsesWith(Const); - - // Delete the instruction. - if (!isa(Inst) && !isa(Inst)) - BB->getInstList().erase(Inst); - - // Hey, we just changed something! - MadeChanges = true; - ++IPNumInstRemoved; - } - } + if (Inst->getType() == Type::VoidTy || + isa(Inst->getType()) || + isa(Inst)) + continue; + + LatticeVal &IV = Values[Inst]; + if (!IV.isConstant() && !IV.isUndefined()) + continue; + + Constant *Const = IV.isConstant() + ? IV.getConstant() : UndefValue::get(Inst->getType()); + DOUT << " Constant: " << *Const << " = " << *Inst; + + // Replaces all of the uses of a variable with uses of the + // constant. + Inst->replaceAllUsesWith(Const); + + // Delete the instruction. + if (!isa(Inst)) + Inst->eraseFromParent(); + + // Hey, we just changed something! + MadeChanges = true; + ++IPNumInstRemoved; } } From clattner at apple.com Wed Apr 23 19:35:04 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Apr 2008 17:35:04 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r50200 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s In-Reply-To: <200804240011.m3O0BXt1008394@zion.cs.uiuc.edu> References: <200804240011.m3O0BXt1008394@zion.cs.uiuc.edu> Message-ID: On Apr 23, 2008, at 5:11 PM, Dan Gohman wrote: > Author: djg > Date: Wed Apr 23 19:11:32 2008 > New Revision: 50200 > > URL: http://llvm.org/viewvc/llvm-project?rev=50200&view=rev > Log: > Fix the darwin snapshot_ret to keep %rsp 16-byte aligned. This is > pretty obscure, but it turns out that LLVM's -regalloc=local > occasionally finds a way to need xmm spills in some of these trivial > ABI testcases, and the code for that requires proper stack alignment. Whoa. What the heck is snapshot_ret used for? -Chris > > > This fixes a memory trap in gcc.target/x86_64/abi/ > test_struct_returning.c. > > Modified: > llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm- > support-darwin.s > > Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm- > support-darwin.s > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s?rev=50200&r1=50199&r2=50200&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm- > support-darwin.s (original) > +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm- > support-darwin.s Wed Apr 23 19:11:32 2008 > @@ -41,6 +41,8 @@ > .p2align 4,,15 > .globl _snapshot_ret > _snapshot_ret: > + pushq %rbp > + movq %rsp, %rbp > movq %rdi, _rdi(%rip) > call *_callthis(%rip) > movq %rax, _rax(%rip) > @@ -51,6 +53,7 @@ > fstpt _x87_regs+16(%rip) > fldt _x87_regs+16(%rip) > fldt _x87_regs(%rip) > + leave > ret > > .comm _callthis,8 > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Wed Apr 23 19:39:31 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 24 Apr 2008 00:39:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50204 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support.s Message-ID: <200804240039.m3O0dVfR009226@zion.cs.uiuc.edu> Author: djg Date: Wed Apr 23 19:39:31 2008 New Revision: 50204 URL: http://llvm.org/viewvc/llvm-project?rev=50204&view=rev Log: Fix the regular snapshot_ret to keep %rsp 16-byte aligned too. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support.s Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support.s URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support.s?rev=50204&r1=50203&r2=50204&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support.s (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support.s Wed Apr 23 19:39:31 2008 @@ -45,6 +45,8 @@ .globl snapshot_ret .type snapshot_ret, @function snapshot_ret: + pushq %rbp + movq %rsp, %rbp movq %rdi, rdi(%rip) call *callthis(%rip) movq %rax, rax(%rip) @@ -55,6 +57,7 @@ fstpt x87_regs+16(%rip) fldt x87_regs+16(%rip) fldt x87_regs(%rip) + leave ret .size snapshot_ret, .-snapshot_ret From clattner at apple.com Wed Apr 23 19:44:22 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Apr 2008 17:44:22 -0700 Subject: [llvm-commits] [llvm] r50190 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp In-Reply-To: <200804232237.m3NMb4E5005508@zion.cs.uiuc.edu> References: <200804232237.m3NMb4E5005508@zion.cs.uiuc.edu> Message-ID: <37238D9E-39E6-4549-A09C-A4895DC03547@apple.com> On Apr 23, 2008, at 3:37 PM, Anton Korobeynikov wrote: > Author: asl > Date: Wed Apr 23 17:37:03 2008 > New Revision: 50190 > > URL: http://llvm.org/viewvc/llvm-project?rev=50190&view=rev > Log: > Adjust option names for C++ backend Hey Anton, Maybe instead of having lots of options for llvm2cpp it should just emit one big dump file with #ifdefs around each piece. Users can copy/ paste the code they want (if using llvm2cpp for pedagogic purposes), or #include the generated file with specific #defines set. This is similar to how the tblgen intrinsic info emitter works. Would that be reasonable/interesting? -Chris From gohman at apple.com Wed Apr 23 19:45:38 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 17:45:38 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r50200 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s In-Reply-To: References: <200804240011.m3O0BXt1008394@zion.cs.uiuc.edu> Message-ID: On Apr 23, 2008, at 5:35 PM, Chris Lattner wrote: > > On Apr 23, 2008, at 5:11 PM, Dan Gohman wrote: > >> Author: djg >> Date: Wed Apr 23 19:11:32 2008 >> New Revision: 50200 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=50200&view=rev >> Log: >> Fix the darwin snapshot_ret to keep %rsp 16-byte aligned. This is >> pretty obscure, but it turns out that LLVM's -regalloc=local >> occasionally finds a way to need xmm spills in some of these trivial >> ABI testcases, and the code for that requires proper stack alignment. > > Whoa. What the heck is snapshot_ret used for? It's used by the ABI tests to wrap calls to functions with interesting return values. It "snapshots" the interesting register state immediately after the call for subsequent verification. Dan From clattner at apple.com Wed Apr 23 19:48:23 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Apr 2008 17:48:23 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r50200 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s In-Reply-To: References: <200804240011.m3O0BXt1008394@zion.cs.uiuc.edu> Message-ID: <5A51F69E-63F1-458A-8CAD-562FF93AA084@apple.com> On Apr 23, 2008, at 5:45 PM, Dan Gohman wrote: > > On Apr 23, 2008, at 5:35 PM, Chris Lattner wrote: >> >> On Apr 23, 2008, at 5:11 PM, Dan Gohman wrote: >> >>> Author: djg >>> Date: Wed Apr 23 19:11:32 2008 >>> New Revision: 50200 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=50200&view=rev >>> Log: >>> Fix the darwin snapshot_ret to keep %rsp 16-byte aligned. This is >>> pretty obscure, but it turns out that LLVM's -regalloc=local >>> occasionally finds a way to need xmm spills in some of these trivial >>> ABI testcases, and the code for that requires proper stack >>> alignment. >> >> Whoa. What the heck is snapshot_ret used for? > > It's used by the ABI tests to wrap calls to functions > with interesting return values. It "snapshots" the > interesting register state immediately after the call > for subsequent verification. Ah, interesting. Great catch. -Chris From dalej at apple.com Wed Apr 23 20:13:26 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Apr 2008 18:13:26 -0700 Subject: [llvm-commits] [llvm] r50174 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: References: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> Message-ID: <479EBA8F-AB8A-4BED-9540-DC2B34E86406@apple.com> On Apr 23, 2008, at 3:50 PM, Tanya Lattner wrote: > Dale, > > Can you use the doxygen style comments (///) for this function? I could. The function I split it out from doesn't do that, though. >> +// If this cast does not affect the value passed through the varargs >> +// area, we can eliminate the use of the cast. >> +static bool isSafeToEliminateVarargsCast(const CallSite CS, >> + const CastInst * const CI, >> + const TargetData * const >> TD, >> + const int ix) { >> > > Thanks, > Tanya > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Wed Apr 23 20:43:55 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Apr 2008 18:43:55 -0700 Subject: [llvm-commits] [llvm] r50147 - /llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp In-Reply-To: <200804231056.m3NAuMZl016799@zion.cs.uiuc.edu> References: <200804231056.m3NAuMZl016799@zion.cs.uiuc.edu> Message-ID: <78B0DAE8-0131-4319-B519-954559CC1F71@gmail.com> On Apr 23, 2008, at 3:56 AM, Gabor Greif wrote: > Author: ggreif > Date: Wed Apr 23 05:56:15 2008 > New Revision: 50147 > > URL: http://llvm.org/viewvc/llvm-project?rev=50147&view=rev > Log: > remove horrible quadratic complexity when reallocating > > Modified: > llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp > > Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/ > BitcodeReader.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50147&r1=50146&r2=50147&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/ > BitcodeReader.cpp (original) > +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/ > BitcodeReader.cpp Wed Apr 23 05:56:15 2008 > @@ -154,7 +154,7 @@ > > if (Desired > Capacity) > { > - Use *New = allocHungoffUses(Desired); > + Use *New = allocHungoffUses(Desired*2+100); Magic numbers? :-) Could you put a comment in there describing why you're using 2 and 100? -bw From gohman at apple.com Wed Apr 23 21:11:07 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Apr 2008 19:11:07 -0700 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> References: <00FB5805-1FA5-4534-BBD0-E6E34EC17BF1@apple.com> <84648A85-6EB1-4FE5-96B4-749BD5A8D938@apple.com> <039F7990-10A9-4153-A91B-024551DF3541@apple.com> <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> Message-ID: Hi Roman, I have a few more comments for the ScheduleDAGRRList.cpp queue patch: > - virtual void updateNode(const SUnit *SU) {} > + virtual void updateNode(const SUnit *SU) { > + remove((SUnit *)SU); > + push((SUnit *)SU); > + } updateNode is overridden in both subclasses, so this code isn't ever executed. And, it doesn't need to be. > - // FIXME: No strict ordering. > - return false; > + if (left->NodeQueueId && right->NodeQueueId) > + return (left->NodeQueueId < right->NodeQueueId); > + return left->NodeNum < right->NodeNum; In addition to Evan's comment, please change the NodeQueueId comparison to use > instead of <. This is somewhat arbitrary, but in some ad-hoc testing it seemed to give better results. In particular, there are three regression tests which fail without this change due to inferior scheduling. Dan On Apr 21, 2008, at 11:12 AM, Evan Cheng wrote: > + if (left->NodeQueueId && right->NodeQueueId) > + return (left->NodeQueueId < right->NodeQueueId); > + return left->NodeNum < right->NodeNum; > > Why would NodeQueueId ever be zero? Nodes that are entered into the > queue must have this field set, no? > > Evan > > On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > >> Hi Evan, >> >> 2008/4/2, Evan Cheng : >>> >>> On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: >>> >>>> 2008/4/2, Evan Cheng : >>>>> >>>>> On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: >>>>> >>>>>> Hi Evan, >>>>>> >>>>>> 2008/4/1, Evan Cheng : >>>>>>> Please hold off checking it in for a bit. llvm tot is having >>>>>>> some >>>>>>> problems and I'd like to get to the bottom of it first. >>>>>> >>>>>> OK. >>>>>> >>>>>>> Also, the tie breaker is less than ideal. I think we need a tie- >>>>>>> breaker that is "the SUnit that's added to the queue is >>>>>>> preferred". >>>>>>> That means it prefers nodes which are closer to the end of >>>>>>> block. >>>>>>> What >>>>>>> do you think? >>>>>> >>>>>> Do you actually mean "the SUnit that's added to the queue LAST >>>>>> (or >>>>>> FIRST) is preferred"? I'll think about it. >>>>> >>>>> >>>>> Yep "first". Basically, if all else being equal, let the node >>>>> that's >>>>> ready first be scheduled first. We can add a order id to SUnit >>>>> which >>>>> gets set when it's pushed into the ready queue. What do you think? >>>> >>>> Makes sense. The queue should have a global "current id" counter. >>>> Its >>>> current value is assigned to each node being inserted into the >>>> ready >>>> queue and then incremented. When the node is removed from the queue >>>> for any reason, its queue order id is reset. It should be rather >>>> easy >>>> to implement. >> >>>> BTW, do you really want this queue order id in the SUnit or in a >>>> separate array indexed by SUnit unique ids? >>> >>> >>> It should be in SUnit since the sort functions don't have access to >>> ScheduleDAG members. >> >> Please find and review the attached patch implementing: >> - a proper tie-breaker as discussed above. >> - and unmodified part for replacing the slow std::priority_queue by >> std::set, as it I already did before. >> >> What do you think? >> >> -Roman >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Apr 24 00:59:59 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Apr 2008 05:59:59 -0000 Subject: [llvm-commits] [llvm] r50205 - in /llvm/trunk/docs: GarbageCollection.html LangRef.html Message-ID: <200804240559.m3O5xxbr018080@zion.cs.uiuc.edu> Author: lattner Date: Thu Apr 24 00:59:56 2008 New Revision: 50205 URL: http://llvm.org/viewvc/llvm-project?rev=50205&view=rev Log: Doc updates/edits, contributed by Terence Parr! Modified: llvm/trunk/docs/GarbageCollection.html llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=50205&r1=50204&r2=50205&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Thu Apr 24 00:59:56 2008 @@ -151,7 +151,7 @@

    LLVM's intermediate representation provides garbage -collection intrinsics which offer support for a broad class of +collection intrinsics that offer support for a broad class of collector models. For instance, the intrinsics permit:

      @@ -280,8 +280,8 @@
      -

      The SemiSpace runtime implements with the suggested -runtime interface and is compatible the ShadowStack backend.

      +

      The SemiSpace runtime implements the suggested +runtime interface and is compatible with the ShadowStack backend.

      SemiSpace is a very simple copying collector. When it starts up, it allocates two blocks of memory for the heap. It uses a simple bump-pointer @@ -321,7 +321,7 @@

      @@ -351,12 +351,12 @@

      The gc function attribute is used to specify the desired collector -algorithm to the compiler. It is equivalent to specify the collector name +algorithm to the compiler. It is equivalent to specifying the collector name programmatically using the setCollector method of Function.

      Specifying the collector on a per-function basis allows LLVM to link together -programs which use different garbage collection algorithms.

      +programs that use different garbage collection algorithms.

      @@ -372,7 +372,7 @@

      The llvm.gcroot intrinsic is used to inform LLVM of a pointer -variable on the stack. The first argument must be an alloca instruction +variable on the stack. The first argument must be a value referring to an alloca instruction or a bitcast of an alloca. The second contains a pointer to metadata that should be associated with the pointer, and must be a constant or global value address. If your target collector uses tags, use a null pointer for @@ -399,7 +399,7 @@ ;; Tell LLVM that the stack space is a stack root. ;; Java has type-tags on objects, so we pass null as metadata. %tmp = bitcast %Object** %X to i8** - call void %llvm.gcroot(%i8** %X, i8* null) + call void %llvm.gcroot(i8** %X, i8* null) ... ;; "CodeBlock" is the block corresponding to the start @@ -439,16 +439,16 @@ for completeness. In this snippet, %object is the object pointer, and %derived is the derived pointer:

      -
          ;; An array type.
      +
      +    ;; An array type.
           %class.Array = type { %class.Object, i32, [0 x %class.Object*] }
      -...
      +    ...
       
           ;; Load the object pointer from a gcroot.
           %object = load %class.Array** %object_addr
       
           ;; Compute the derived pointer.
      -    %derived = getelementptr %obj, i32 0, i32 2, i32 %n
      + %derived = getelementptr %object, i32 0, i32 2, i32 %n
      @@ -594,7 +594,7 @@ generator that iterates through all of the GC roots on the stack, calling the specified function pointer with each record. For each GC root, the address of the pointer and the meta-data (from the llvm.gcroot intrinsic) are provided. +href="#gcroot">llvm.gcroot intrinsic) are provided.

      @@ -1329,7 +1329,7 @@ llvm_gc_collect functions. To do this, it will probably have to trace through the roots from the stack and understand the GC descriptors -for heap objects. Luckily, there are some example +for heap objects. Luckily, there are some example implementations available.

    @@ -1366,7 +1366,7 @@

    The LLVM garbage collectors are capable of supporting all of these styles of language, including ones that mix various implementations. To do this, it allows the source-language to associate meta-data with the stack roots, and the heap tracing routines can propagate the +href="#gcroot">stack roots, and the heap tracing routines can propagate the information. In addition, LLVM allows the front-end to extract GC information in any form from a specific object pointer (this supports situations #1 and #3).

    Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=50205&r1=50204&r2=50205&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Thu Apr 24 00:59:56 2008 @@ -3020,8 +3020,8 @@ 'getelementptr' instruction is used to index down through the type levels of a structure or to a specific index in an array. When indexing into a structure, only i32 integer constants are allowed. When indexing -into an array or pointer, only integers of 32 or 64 bits are allowed, and will -be sign extended to 64-bit values.

    +into an array or pointer, only integers of 32 or 64 bits are allowed; 32-bit +values will be sign extended to 64-bits if required.

    For example, let's consider a C code fragment and how it gets compiled to LLVM:

    @@ -3096,7 +3096,7 @@

    Note that it is undefined to access an array out of bounds: array and pointer indexes must always be within the defined bounds of the array type. -The one exception for this rules is zero length arrays. These arrays are +The one exception for this rule is zero length arrays. These arrays are defined to be accessible as variable length arrays, which requires access beyond the zero'th element.

    @@ -4207,7 +4207,7 @@
    Semantics:
    -

    At runtime, a call to this intrinsics stores a null pointer into the "ptrloc" +

    At runtime, a call to this intrinsic stores a null pointer into the "ptrloc" location. At compile-time, the code generator generates information to allow the runtime to find the pointer at GC safe points. The 'llvm.gcroot' intrinsic may only be used in a function which specifies a GC From sabre at nondot.org Thu Apr 24 01:00:30 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Apr 2008 06:00:30 -0000 Subject: [llvm-commits] [llvm] r50206 - /llvm/trunk/docs/GarbageCollection.html Message-ID: <200804240600.m3O60UXj018110@zion.cs.uiuc.edu> Author: lattner Date: Thu Apr 24 01:00:30 2008 New Revision: 50206 URL: http://llvm.org/viewvc/llvm-project?rev=50206&view=rev Log: % -> @ Modified: llvm/trunk/docs/GarbageCollection.html Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=50206&r1=50205&r2=50206&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Thu Apr 24 01:00:30 2008 @@ -366,7 +366,7 @@

    @@ -399,7 +399,7 @@ ;; Tell LLVM that the stack space is a stack root. ;; Java has type-tags on objects, so we pass null as metadata. %tmp = bitcast %Object** %X to i8** - call void %llvm.gcroot(i8** %X, i8* null) + call void @llvm.gcroot(i8** %X, i8* null) ... ;; "CodeBlock" is the block corresponding to the start From romix.llvm at googlemail.com Thu Apr 24 01:18:21 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Thu, 24 Apr 2008 10:18:21 +0400 Subject: [llvm-commits] Speeding up instruction selection In-Reply-To: References: <039F7990-10A9-4153-A91B-024551DF3541@apple.com> <6878E8F2-B19D-430F-ADCF-DA84A7F3B742@apple.com> <10B3207F-7E14-4AB0-B5DD-88BB6D5D4BF5@apple.com> Message-ID: Hi Dan, 2008/4/24 Dan Gohman : > Hi Roman, > > I have a few more comments for the ScheduleDAGRRList.cpp queue patch: > > > - virtual void updateNode(const SUnit *SU) {} > > + virtual void updateNode(const SUnit *SU) { > > + remove((SUnit *)SU); > > + push((SUnit *)SU); > > + } > > updateNode is overridden in both subclasses, so this code > isn't ever executed. And, it doesn't need to be. OK. Will do. > > - // FIXME: No strict ordering. > > - return false; > > > + if (left->NodeQueueId && right->NodeQueueId) > > + return (left->NodeQueueId < right->NodeQueueId); > > + return left->NodeNum < right->NodeNum; > > In addition to Evan's comment, please change the NodeQueueId > comparison to use > instead of <. This is somewhat arbitrary, but in > some ad-hoc testing it seemed to give better results. In particular, > there are three regression tests which fail without this change due > to inferior scheduling. This is a very good point. I was not quite sure about the sign also ;-) But does your comment mean that this change fixes some failures (e.g. burg) that were reported by Evan? Does it pass all the tests wih this change now? Or do I need yet to investigate the problems that Evan reported? -Roman > On Apr 21, 2008, at 11:12 AM, Evan Cheng wrote: > > > > > > > > > + if (left->NodeQueueId && right->NodeQueueId) > > + return (left->NodeQueueId < right->NodeQueueId); > > + return left->NodeNum < right->NodeNum; > > > > Why would NodeQueueId ever be zero? Nodes that are entered into the > > queue must have this field set, no? > > > > Evan > > > > On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > > > > > > > Hi Evan, > > > > > > 2008/4/2, Evan Cheng : > > > > > > > > > > > On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: > > > > > > > > > > > > > 2008/4/2, Evan Cheng : > > > > > > > > > > > > > > > > > On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: > > > > > > > > > > > > > > > > > > > Hi Evan, > > > > > > > > > > > > > > 2008/4/1, Evan Cheng : > > > > > > > > > > > > > > > Please hold off checking it in for a bit. llvm tot is having > some > > > > > > > > problems and I'd like to get to the bottom of it first. > > > > > > > > > > > > > > > > > > > > > > OK. > > > > > > > > > > > > > > > > > > > > > > Also, the tie breaker is less than ideal. I think we need a > tie- > > > > > > > > breaker that is "the SUnit that's added to the queue is > > > > > > > > preferred". > > > > > > > > That means it prefers nodes which are closer to the end of > block. > > > > > > > > What > > > > > > > > do you think? > > > > > > > > > > > > > > > > > > > > > > Do you actually mean "the SUnit that's added to the queue LAST > (or > > > > > > > FIRST) is preferred"? I'll think about it. > > > > > > > > > > > > > > > > > > > > > > > > > Yep "first". Basically, if all else being equal, let the node > > > > > > that's > > > > > > ready first be scheduled first. We can add a order id to SUnit > > > > > > which > > > > > > gets set when it's pushed into the ready queue. What do you think? > > > > > > > > > > > > > > > > Makes sense. The queue should have a global "current id" counter. > > > > > Its > > > > > current value is assigned to each node being inserted into the ready > > > > > queue and then incremented. When the node is removed from the queue > > > > > for any reason, its queue order id is reset. It should be rather > > > > > easy > > > > > to implement. > > > > > > > > > > > > > > > > > > > > > > > > BTW, do you really want this queue order id in the SUnit or in a > > > > > separate array indexed by SUnit unique ids? > > > > > > > > > > > > > > > > > It should be in SUnit since the sort functions don't have access to > > > > ScheduleDAG members. > > > > > > > > > > Please find and review the attached patch implementing: > > > - a proper tie-breaker as discussed above. > > > - and unmodified part for replacing the slow std::priority_queue by > > > std::set, as it I already did before. > > > > > > What do you think? > > > > > > -Roman > > > > > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > From edwintorok at gmail.com Thu Apr 24 02:52:13 2008 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Apr 2008 10:52:13 +0300 Subject: [llvm-commits] Teach SCEV about {X,*,Y} recursions In-Reply-To: <8860430B-8F9B-46FA-91AF-C3298A261183@apple.com> References: <480FA304.2060406@gmail.com> <8860430B-8F9B-46FA-91AF-C3298A261183@apple.com> Message-ID: <48103C2D.1060804@gmail.com> Chris Lattner wrote: > > On Apr 23, 2008, at 1:58 PM, T?r?k Edwin wrote: > >> Hi, >> >> I have a patch that adds support for exponential recursions in loops. >> This is useful in static analysis tools, and also for code optimization. > > This is interesting, but a couple questions: > > 1) What sort of code does this really help with in practice? I'm a > bit afraid of adding a bunch of complexity to SCEV analysis if it is > unlikely to be useful for broad code. Do you see power sequences > indexing arrays for example? It is useful if we can compute the loop exit value of a variable without actually executing the loop (e.g. compute a^1980 w/o looping 1980 times), and thus the variable can be moved out of the loop, and we can possibly delete the loop entirely. If that variable is used for something else inside the loop (indexing an array), then we get no advantage, we still need to loop N times, and actually it is better to keep the original mul in this case. I see that powexpr got generated for at least these: pifft, consumer-lame, telecomm-fft, voronoi, np, scimark2. I'll try to see if performance is actually improved in a real situation. On the (stupid) testcase I wrote in test/Analysis/ScalarEvolution/mulrec.ll the difference is 0.4 seconds vs. 0.002 seconds (even if I move the test() func in a different file to prevent computing the result at compile-time). > > 2) instead of having SCEVExpander::visitPowExpr emit multiplies, it > should emit a call to llvm.powi. I would need a powi that takes an integer argument as a base. I don't want to introduce FP code where there wasn't any before. Also it would currently force us to link the resulting code with -lm, right? Should I add a powi that takes an integer base? > > 3) It would be really nice to teach the code generator to lower > llvm.powi nicer, particularly before something like this patch goes > in. Our current lowering of powi is pretty naive. AFAICT it is just transformed into a libcall. Would you like me to move the constant-power codegen code there? Best regards, --Edwin From nicolas.geoffray at lip6.fr Thu Apr 24 03:47:12 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 24 Apr 2008 08:47:12 -0000 Subject: [llvm-commits] [vmkit] r50207 - /vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Message-ID: <200804240847.m3O8lDQg030623@zion.cs.uiuc.edu> Author: geoffray Date: Thu Apr 24 03:47:11 2008 New Revision: 50207 URL: http://llvm.org/viewvc/llvm-project?rev=50207&view=rev Log: JVM Specification does not require implemented interfaces to be clinited. Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=50207&r1=50206&r2=50207&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Thu Apr 24 03:47:11 2008 @@ -318,9 +318,7 @@ if (cl->super) { cl->super->initialiseClass(); } - for (uint32 i = 0; i < cl->interfaces.size(); i++) { - cl->interfaces[i]->initialiseClass(); - } + cl->status = inClinit; JavaMethod* meth = cl->lookupMethodDontThrow(clinitName, clinitType, true, false); From nicolas.geoffray at lip6.fr Thu Apr 24 03:48:11 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 24 Apr 2008 08:48:11 -0000 Subject: [llvm-commits] [vmkit] r50208 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathVMStackWalker.cpp VMCore/JavaBacktrace.cpp VMCore/JavaUpcalls.cpp Message-ID: <200804240848.m3O8mBDC030661@zion.cs.uiuc.edu> Author: geoffray Date: Thu Apr 24 03:48:11 2008 New Revision: 50208 URL: http://llvm.org/viewvc/llvm-project?rev=50208&view=rev Log: Correct signature of getCallingClass and getCallingClassLoader. Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp?rev=50208&r1=50207&r2=50208&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp Thu Apr 24 03:48:11 2008 @@ -8,12 +8,14 @@ // //===----------------------------------------------------------------------===// +#include #include #include "types.h" #include "JavaArray.h" #include "JavaClass.h" +#include "JavaJIT.h" #include "JavaObject.h" #include "JavaTypes.h" #include "JavaThread.h" @@ -21,8 +23,6 @@ #include "Jnjvm.h" #include "NativeUtil.h" -#include - using namespace jnjvm; extern "C" JavaMethod* ip_to_meth(int* ip); @@ -80,37 +80,13 @@ } extern "C" JavaObject* getCallingClass() { - int* ips[10]; - int real_size = backtrace((void**)(void*)ips, 100); - int n = 0; - int i = 0; - - while (i < real_size) { - JavaMethod* meth = ip_to_meth(ips[i++]); - if (meth) { - ++n; - if (n == 1) return meth->classDef->getClassDelegatee(); - } - } - + Class* cl = JavaJIT::getCallingClass(); + if (cl) return cl->getClassDelegatee(); return 0; } extern "C" JavaObject* getCallingClassLoader() { - int* ips[10]; - int real_size = backtrace((void**)(void*)ips, 100); - int n = 0; - int i = 0; - - while (i < real_size) { - JavaMethod* meth = ip_to_meth(ips[i++]); - if (meth) { - ++n; - if (n == 1) return meth->classDef->classLoader; - } - } - - return 0; + return JavaJIT::getCallingClassLoader(); } } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp?rev=50208&r1=50207&r2=50208&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp Thu Apr 24 03:48:11 2008 @@ -80,10 +80,12 @@ if (code) { mvm::Method* m = code->method(); mvm::Object* meth = m->definition(); - if (meth && meth->getVirtualTable() == JavaMethod::VT && i == 0) { - return ((JavaMethod*)meth)->classDef; - } else { - ++i; + if (meth && meth->getVirtualTable() == JavaMethod::VT) { + if (i == 1) { + return ((JavaMethod*)meth)->classDef; + } else { + ++i; + } } } } @@ -100,9 +102,13 @@ if (code) { mvm::Method* m = code->method(); mvm::Object* meth = m->definition(); - if (meth && meth->getVirtualTable() == JavaMethod::VT && i == 1) { - return ((JavaMethod*)meth)->classDef; - } else ++i; + if (meth && meth->getVirtualTable() == JavaMethod::VT) { + if (i == 1) { + return ((JavaMethod*)meth)->classDef; + } else { + ++i; + } + } } } return 0; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp?rev=50208&r1=50207&r2=50208&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Thu Apr 24 03:48:11 2008 @@ -216,54 +216,18 @@ loadInClassLoader = UPCALL_METHOD(vm, "java/lang/ClassLoader", "loadClass", "(Ljava/lang/String;Z)Ljava/lang/Class;", ACC_VIRTUAL); - getCallingClassLoader = UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClassLoader", "()Ljava/lang/ClassLoader;", ACC_STATIC); - - // Create getCallingClassLoader - { - std::vector args; -#ifdef MULTIPLE_VM - args.push_back(mvm::jit::ptrType); -#endif - const llvm::FunctionType* type = - llvm::FunctionType::get(JavaObject::llvmType, args, false); - - Classpath::getCallingClassLoader->llvmFunction = - llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, - "_ZN5jnjvm7JavaJIT21getCallingClassLoaderEv", - vm->module); - } - JavaMethod* internString = UPCALL_METHOD(vm, "java/lang/VMString", "intern", "(Ljava/lang/String;)Ljava/lang/String;", ACC_STATIC); // Create intern { - std::vector args; - args.push_back(JavaObject::llvmType); -#ifdef MULTIPLE_VM - args.push_back(mvm::jit::ptrType); -#endif - const llvm::FunctionType* type = - llvm::FunctionType::get(JavaObject::llvmType, args, false); - - internString->llvmFunction = - llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, - "internString", - vm->module); + internString->llvmFunction->setName("internString"); + internString->llvmFunction->setLinkage(llvm::GlobalValue::ExternalLinkage); } JavaMethod* isArray = UPCALL_METHOD(vm, "java/lang/Class", "isArray", "()Z", ACC_VIRTUAL); // Create intern { - std::vector args; - args.push_back(JavaObject::llvmType); -#ifdef MULTIPLE_VM - args.push_back(mvm::jit::ptrType); -#endif - const llvm::FunctionType* type = - llvm::FunctionType::get(llvm::Type::Int8Ty, args, false); - isArray->llvmFunction = - llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, - "isArray", - vm->module); + isArray->llvmFunction->setName("isArray"); + isArray->llvmFunction->setLinkage(llvm::GlobalValue::ExternalLinkage); } ClasspathThread::initialise(vm); @@ -278,34 +242,16 @@ true, false); COMPILE_METHODS(object) - JavaMethod* getCallingClass = UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClass", "()Ljava/lang/Object;", ACC_STATIC); + JavaMethod* getCallingClass = UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClass", "()Ljava/lang/Class;", ACC_STATIC); { - std::vector args; -#ifdef MULTIPLE_VM - args.push_back(mvm::jit::ptrType); -#endif - const llvm::FunctionType* type = - llvm::FunctionType::get(JavaObject::llvmType, args, false); - - getCallingClass->llvmFunction = - llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, - "getCallingClass", - vm->module); + getCallingClass->llvmFunction->setName("getCallingClass"); + getCallingClass->llvmFunction->setLinkage(llvm::GlobalValue::ExternalLinkage); } - JavaMethod* getCallingClassLoader = UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClassLoader", "()Ljava/lang/Object;", ACC_STATIC); + JavaMethod* getCallingClassLoader = UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClassLoader", "()Ljava/lang/ClassLoader;", ACC_STATIC); { - std::vector args; -#ifdef MULTIPLE_VM - args.push_back(mvm::jit::ptrType); -#endif - const llvm::FunctionType* type = - llvm::FunctionType::get(JavaObject::llvmType, args, false); - - getCallingClassLoader->llvmFunction = - llvm::Function::Create(type, llvm::GlobalValue::ExternalLinkage, - "getCallingClassLoader", - vm->module); + getCallingClassLoader->llvmFunction->setName("getCallingClassLoader"); + getCallingClassLoader->llvmFunction->setLinkage(llvm::GlobalValue::ExternalLinkage); } } From evan.cheng at apple.com Thu Apr 24 04:06:33 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Apr 2008 09:06:33 -0000 Subject: [llvm-commits] [llvm] r50209 - in /llvm/trunk: include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200804240906.m3O96XHY031591@zion.cs.uiuc.edu> Author: evancheng Date: Thu Apr 24 04:06:33 2008 New Revision: 50209 URL: http://llvm.org/viewvc/llvm-project?rev=50209&view=rev Log: - Check if a register is livein before removing it. It may have already been removed. - Do not iterate over SmallPtrSet, the order of iteration is not deterministic. Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=50209&r1=50208&r2=50209&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Thu Apr 24 04:06:33 2008 @@ -176,6 +176,10 @@ /// void removeLiveIn(unsigned Reg); + /// isLiveIn - Return true if the specified register is in the live in set. + /// + bool isLiveIn(unsigned Reg) const; + // Iteration support for live in sets. These sets are kept in sorted // order by their register number. typedef std::vector::iterator livein_iterator; Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=50209&r1=50208&r2=50209&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Thu Apr 24 04:06:33 2008 @@ -205,6 +205,11 @@ LiveIns.erase(I); } +bool MachineBasicBlock::isLiveIn(unsigned Reg) const { + const_livein_iterator I = std::find(livein_begin(), livein_end(), Reg); + return I != livein_end(); +} + void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) { MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList(); getParent()->getBasicBlockList().splice(NewAfter, BBList, this); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=50209&r1=50208&r2=50209&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Apr 24 04:06:33 2008 @@ -639,7 +639,8 @@ // first instruction index starts at > 0 value. assert(TargetRegisterInfo::isPhysicalRegister(li.reg)); // Live-in to the function but dead. Remove it from entry live-in set. - mf_->begin()->removeLiveIn(li.reg); + if (mf_->begin()->isLiveIn(li.reg)) + mf_->begin()->removeLiveIn(li.reg); const LiveRange *LR = li.getLiveRangeContaining(CopyIdx); removeRange(li, LR->start, LR->end, li_, tri_); return removeIntervalIfEmpty(li, li_, tri_); @@ -2002,27 +2003,6 @@ I->second.print(DOUT, tri_); DOUT << "\n"; } - - // Delete all coalesced copies. - for (SmallPtrSet::iterator I = JoinedCopies.begin(), - E = JoinedCopies.end(); I != E; ++I) { - MachineInstr *CopyMI = *I; - unsigned SrcReg, DstReg; - if (!tii_->isMoveInstr(*CopyMI, SrcReg, DstReg)) { - assert((CopyMI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || - CopyMI->getOpcode() == TargetInstrInfo::INSERT_SUBREG) && - "Unrecognized copy instruction"); - DstReg = CopyMI->getOperand(0).getReg(); - } - if (CopyMI->registerDefIsDead(DstReg)) { - LiveInterval &li = li_->getInterval(DstReg); - if (!ShortenDeadCopySrcLiveRange(li, CopyMI)) - ShortenDeadCopyLiveRange(li, CopyMI); - } - li_->RemoveMachineInstrFromMaps(*I); - (*I)->eraseFromParent(); - ++numPeep; - } } // Perform a final pass over the instructions and compute spill weights @@ -2034,15 +2014,35 @@ for (MachineBasicBlock::iterator mii = mbb->begin(), mie = mbb->end(); mii != mie; ) { - // if the move will be an identity move delete it - unsigned srcReg, dstReg; - bool isMove = tii_->isMoveInstr(*mii, srcReg, dstReg); - if (isMove && srcReg == dstReg) { - if (li_->hasInterval(srcReg)) { - LiveInterval &RegInt = li_->getInterval(srcReg); + MachineInstr *MI = mii; + unsigned SrcReg, DstReg; + if (JoinedCopies.count(MI)) { + // Delete all coalesced copies. + if (!tii_->isMoveInstr(*MI, SrcReg, DstReg)) { + assert((MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || + MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG) && + "Unrecognized copy instruction"); + DstReg = MI->getOperand(0).getReg(); + } + if (MI->registerDefIsDead(DstReg)) { + LiveInterval &li = li_->getInterval(DstReg); + if (!ShortenDeadCopySrcLiveRange(li, MI)) + ShortenDeadCopyLiveRange(li, MI); + } + li_->RemoveMachineInstrFromMaps(MI); + mii = mbbi->erase(mii); + ++numPeep; + continue; + } + + // If the move will be an identity move delete it + bool isMove = tii_->isMoveInstr(*mii, SrcReg, DstReg); + if (isMove && SrcReg == DstReg) { + if (li_->hasInterval(SrcReg)) { + LiveInterval &RegInt = li_->getInterval(SrcReg); // If def of this move instruction is dead, remove its live range // from the dstination register's live interval. - if (mii->registerDefIsDead(dstReg)) { + if (mii->registerDefIsDead(DstReg)) { if (!ShortenDeadCopySrcLiveRange(RegInt, mii)) ShortenDeadCopyLiveRange(RegInt, mii); } @@ -2050,7 +2050,7 @@ li_->RemoveMachineInstrFromMaps(mii); mii = mbbi->erase(mii); ++numPeep; - } else if (!isMove || !TurnCopyIntoImpDef(mii, mbb, dstReg, srcReg)) { + } else if (!isMove || !TurnCopyIntoImpDef(mii, mbb, DstReg, SrcReg)) { SmallSet UniqueUses; for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) { const MachineOperand &mop = mii->getOperand(i); From ggreif at gmail.com Thu Apr 24 04:47:00 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 24 Apr 2008 09:47:00 -0000 Subject: [llvm-commits] [llvm] r50210 - /llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Message-ID: <200804240947.m3O9l0tZ032712@zion.cs.uiuc.edu> Author: ggreif Date: Thu Apr 24 04:46:58 2008 New Revision: 50210 URL: http://llvm.org/viewvc/llvm-project?rev=50210&view=rev Log: document the magic numbers Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50210&r1=50209&r2=50210&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Thu Apr 24 04:46:58 2008 @@ -149,6 +149,16 @@ void BitcodeReaderValueList::resize(unsigned Desired) { if (Desired > Capacity) { + // Since we expect many values + // to come from the bitcode file + // we better allocate the double + // amount, so that the array size + // grows exponentially at each + // reallocation. Also, add a small + // amount of 100 extra elements + // each time, to reallocate less + // frequently when the array + // is still small. Capacity = Desired * 2 + 100; Use *New = allocHungoffUses(Capacity); Use *Old = OperandList; From romix.llvm at googlemail.com Thu Apr 24 08:07:02 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Thu, 24 Apr 2008 14:07:02 +0100 Subject: [llvm-commits] Speeding up instruction selection (ScheduleDAGRRList) Message-ID: Hi Evan, Hi Dan, 2008/4/24, Dan Gohman : > Hi Roman, > > I have a few more comments for the ScheduleDAGRRList.cpp queue patch: > > > - virtual void updateNode(const SUnit *SU) {} > > + virtual void updateNode(const SUnit *SU) { > > + remove((SUnit *)SU); > > + push((SUnit *)SU); > > + } > > updateNode is overridden in both subclasses, so this code > isn't ever executed. And, it doesn't need to be. Done. > > - // FIXME: No strict ordering. > > - return false; > > + if (left->NodeQueueId && right->NodeQueueId) > > + return (left->NodeQueueId < right->NodeQueueId); > > + return left->NodeNum < right->NodeNum; > > In addition to Evan's comment, please change the NodeQueueId > comparison to use > instead of <. This is somewhat arbitrary, but in > some ad-hoc testing it seemed to give better results. In particular, > there are three regression tests which fail without this change due > to inferior scheduling. Done. > Dan > > > On Apr 21, 2008, at 11:12 AM, Evan Cheng wrote: > > > > > + if (left->NodeQueueId && right->NodeQueueId) > > + return (left->NodeQueueId < right->NodeQueueId); > > + return left->NodeNum < right->NodeNum; > > > > Why would NodeQueueId ever be zero? Nodes that are entered into the > > queue must have this field set, no? Fixed. Done. Evan wrote: > Please do more testing on this patch. I am seeing failures: > /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/burg.llvm.bc -o > Output/burg.llc.s > Assertion failed: (RemovedNum == 1 && "Not in queue!"), function > remove, file ScheduleDAGRRList.cpp, line 1321. > /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/sqlite3.llvm.bc -o > Output/sqlite3.llc.s > Assertion failed: (RemovedNum == 1 && "Not in queue!"), function > remove, file ScheduleDAGRRList.cpp, line 1321. Fixed. This was a bug related to the CapturePred function. It was updating the state of the SUnit before removing it. As a result, the comparison operators were working incorrectly and this SUnit could not be removed properly. With this patch, everything compiles without any problems on my machine. The new patch is attached. -Roman > > > > On Apr 18, 2008, at 4:31 AM, Roman Levenstein wrote: > > > > > > > Hi Evan, > > > > > > 2008/4/2, Evan Cheng : > > > > > > > > > > > On Apr 2, 2008, at 1:57 AM, Roman Levenstein wrote: > > > > > > > > > > > > > 2008/4/2, Evan Cheng : > > > > > > > > > > > > > > > > > On Apr 2, 2008, at 12:55 AM, Roman Levenstein wrote: > > > > > > > > > > > > > > > > > > > Hi Evan, > > > > > > > > > > > > > > 2008/4/1, Evan Cheng : > > > > > > > > > > > > > > > Please hold off checking it in for a bit. llvm tot is having > some > > > > > > > > problems and I'd like to get to the bottom of it first. > > > > > > > > > > > > > > > > > > > > > > OK. > > > > > > > > > > > > > > > > > > > > > > Also, the tie breaker is less than ideal. I think we need a > tie- > > > > > > > > breaker that is "the SUnit that's added to the queue is > > > > > > > > preferred". > > > > > > > > That means it prefers nodes which are closer to the end of > block. > > > > > > > > What > > > > > > > > do you think? > > > > > > > > > > > > > > > > > > > > > > Do you actually mean "the SUnit that's added to the queue LAST > (or > > > > > > > FIRST) is preferred"? I'll think about it. > > > > > > > > > > > > > > > > > > > > > > > > > Yep "first". Basically, if all else being equal, let the node > > > > > > that's > > > > > > ready first be scheduled first. We can add a order id to SUnit > > > > > > which > > > > > > gets set when it's pushed into the ready queue. What do you think? > > > > > > > > > > > > > > > > Makes sense. The queue should have a global "current id" counter. > > > > > Its > > > > > current value is assigned to each node being inserted into the ready > > > > > queue and then incremented. When the node is removed from the queue > > > > > for any reason, its queue order id is reset. It should be rather > > > > > easy > > > > > to implement. > > > > > > > > > > > > > > > > > > > > > > > > BTW, do you really want this queue order id in the SUnit or in a > > > > > separate array indexed by SUnit unique ids? > > > > > > > > > > > > > > > > > It should be in SUnit since the sort functions don't have access to > > > > ScheduleDAG members. > > > > > > > > > > Please find and review the attached patch implementing: > > > - a proper tie-breaker as discussed above. > > > - and unmodified part for replacing the slow std::priority_queue by > > > std::set, as it I already did before. > > > > > > What do you think? > > > > > > -Roman > > > > > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: ScheduleDAGRRList.patch1 Type: application/octet-stream Size: 6444 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080424/4adb19a1/attachment.obj From ggreif at gmail.com Thu Apr 24 10:48:40 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 24 Apr 2008 15:48:40 -0000 Subject: [llvm-commits] [llvm] r50211 - in /llvm/branches/ggreif/use-diet: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/Linker/ lib/Transforms/IPO/ lib/Transforms/Instrumentation/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llvm2cpp/ Message-ID: <200804241548.m3OFmfEx011815@zion.cs.uiuc.edu> Author: ggreif Date: Thu Apr 24 10:48:39 2008 New Revision: 50211 URL: http://llvm.org/viewvc/llvm-project?rev=50211&view=rev Log: undo the API change that was needed in the interim. Modified: llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp llvm/branches/ggreif/use-diet/include/llvm/GlobalVariable.h llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.h.cvs llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y.cvs llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp Modified: llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp (original) +++ llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp Thu Apr 24 10:48:39 2008 @@ -124,7 +124,7 @@ Constant *msg_0 = ConstantArray:: get("Error: The head has left the tape.", true); - GlobalVariable *aberrormsg = GlobalVariable::Create( + GlobalVariable *aberrormsg = new GlobalVariable( msg_0->getType(), true, GlobalValue::InternalLinkage, Modified: llvm/branches/ggreif/use-diet/include/llvm/GlobalVariable.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/GlobalVariable.h?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/include/llvm/GlobalVariable.h (original) +++ llvm/branches/ggreif/use-diet/include/llvm/GlobalVariable.h Thu Apr 24 10:48:39 2008 @@ -33,6 +33,7 @@ class GlobalVariable : public GlobalValue { friend class SymbolTableListTraits; + void *operator new(size_t, unsigned); // Do not implement void operator=(const GlobalVariable &); // Do not implement GlobalVariable(const GlobalVariable &); // Do not implement @@ -45,39 +46,23 @@ bool isConstantGlobal : 1; // Is this a global constant? bool isThreadLocalSymbol : 1; // Is this symbol "Thread Local"? -private: - /// GlobalVariable ctor - for internal use. - GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage, - Constant *Initializer, const std::string &Name, - Module *Parent, bool ThreadLocal, unsigned AddressSpace); - /// GlobalVariable ctor - for internal use. - GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage, - Constant *Initializer, const std::string &Name, - GlobalVariable *InsertBefore, bool ThreadLocal, - unsigned AddressSpace); - public: - /// GlobalVariable creator - If a parent module is specified, the global is - /// automatically inserted into the end of the specified modules global list. - static GlobalVariable *Create(const Type *Ty, bool isConstant, LinkageTypes Linkage, - Constant *Initializer = 0, const std::string &Name = "", - Module *Parent = 0, bool ThreadLocal = false, - unsigned AddressSpace = 0) { - return new (1) GlobalVariable(Ty, isConstant, Linkage, - Initializer, Name, Parent, - ThreadLocal, AddressSpace); + // allocate space for exactly one operand + void *operator new(size_t s) { + return User::operator new(s, 1); } - - /// GlobalVariable creator - This creates a global and inserts it before the + /// GlobalVariable ctor - If a parent module is specified, the global is + /// automatically inserted into the end of the specified modules global list. + GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage, + Constant *Initializer = 0, const std::string &Name = "", + Module *Parent = 0, bool ThreadLocal = false, + unsigned AddressSpace = 0); + /// GlobalVariable ctor - This creates a global and inserts it before the /// specified other global. - static GlobalVariable *Create(const Type *Ty, bool isConstant, LinkageTypes Linkage, - Constant *Initializer, const std::string &Name, - GlobalVariable *InsertBefore, bool ThreadLocal = false, - unsigned AddressSpace = 0) { - return new (1) GlobalVariable(Ty, isConstant, Linkage, - Initializer, Name, InsertBefore, - ThreadLocal, AddressSpace); - } + GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage, + Constant *Initializer, const std::string &Name, + GlobalVariable *InsertBefore, bool ThreadLocal = false, + unsigned AddressSpace = 0); ~GlobalVariable() { NumOperands = 1; // FIXME: needed by operator delete Modified: llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.cpp.cvs Thu Apr 24 10:48:39 2008 @@ -1,167 +1,386 @@ +/* A Bison parser, made by GNU Bison 2.3. */ -/* A Bison parser, made from /Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y - by GNU Bison version 1.28 */ +/* Skeleton implementation for Bison's Yacc-like parsers in C -#define YYBISON 1 /* Identify Bison output. */ + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + +/* Substitute the variable and function names. */ #define yyparse llvmAsmparse -#define yylex llvmAsmlex +#define yylex llvmAsmlex #define yyerror llvmAsmerror -#define yylval llvmAsmlval -#define yychar llvmAsmchar +#define yylval llvmAsmlval +#define yychar llvmAsmchar #define yydebug llvmAsmdebug #define yynerrs llvmAsmnerrs -#define ESINT64VAL 257 -#define EUINT64VAL 258 -#define ESAPINTVAL 259 -#define EUAPINTVAL 260 -#define LOCALVAL_ID 261 -#define GLOBALVAL_ID 262 -#define FPVAL 263 -#define VOID 264 -#define INTTYPE 265 -#define FLOAT 266 -#define DOUBLE 267 -#define X86_FP80 268 -#define FP128 269 -#define PPC_FP128 270 -#define LABEL 271 -#define TYPE 272 -#define LOCALVAR 273 -#define GLOBALVAR 274 -#define LABELSTR 275 -#define STRINGCONSTANT 276 -#define ATSTRINGCONSTANT 277 -#define PCTSTRINGCONSTANT 278 -#define ZEROINITIALIZER 279 -#define TRUETOK 280 -#define FALSETOK 281 -#define BEGINTOK 282 -#define ENDTOK 283 -#define DECLARE 284 -#define DEFINE 285 -#define GLOBAL 286 -#define CONSTANT 287 -#define SECTION 288 -#define ALIAS 289 -#define VOLATILE 290 -#define THREAD_LOCAL 291 -#define TO 292 -#define DOTDOTDOT 293 -#define NULL_TOK 294 -#define UNDEF 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define EXTERNAL 304 -#define TARGET 305 -#define TRIPLE 306 -#define ALIGN 307 -#define ADDRSPACE 308 -#define DEPLIBS 309 -#define CALL 310 -#define TAIL 311 -#define ASM_TOK 312 -#define MODULE 313 -#define SIDEEFFECT 314 -#define CC_TOK 315 -#define CCC_TOK 316 -#define FASTCC_TOK 317 -#define COLDCC_TOK 318 -#define X86_STDCALLCC_TOK 319 -#define X86_FASTCALLCC_TOK 320 -#define DATALAYOUT 321 -#define UNWINDS 322 -#define RET 323 -#define BR 324 -#define SWITCH 325 -#define INVOKE 326 -#define UNWIND 327 -#define UNREACHABLE 328 -#define ADD 329 -#define SUB 330 -#define MUL 331 -#define UDIV 332 -#define SDIV 333 -#define FDIV 334 -#define UREM 335 -#define SREM 336 -#define FREM 337 -#define AND 338 -#define OR 339 -#define XOR 340 -#define SHL 341 -#define LSHR 342 -#define ASHR 343 -#define ICMP 344 -#define FCMP 345 -#define EQ 346 -#define NE 347 -#define SLT 348 -#define SGT 349 -#define SLE 350 -#define SGE 351 -#define ULT 352 -#define UGT 353 -#define ULE 354 -#define UGE 355 -#define OEQ 356 -#define ONE 357 -#define OLT 358 -#define OGT 359 -#define OLE 360 -#define OGE 361 -#define ORD 362 -#define UNO 363 -#define UEQ 364 -#define UNE 365 -#define MALLOC 366 -#define ALLOCA 367 -#define FREE 368 -#define LOAD 369 -#define STORE 370 -#define GETELEMENTPTR 371 -#define TRUNC 372 -#define ZEXT 373 -#define SEXT 374 -#define FPTRUNC 375 -#define FPEXT 376 -#define BITCAST 377 -#define UITOFP 378 -#define SITOFP 379 -#define FPTOUI 380 -#define FPTOSI 381 -#define INTTOPTR 382 -#define PTRTOINT 383 -#define PHI_TOK 384 -#define SELECT 385 -#define VAARG 386 -#define EXTRACTELEMENT 387 -#define INSERTELEMENT 388 -#define SHUFFLEVECTOR 389 -#define GETRESULT 390 -#define SIGNEXT 391 -#define ZEROEXT 392 -#define NORETURN 393 -#define INREG 394 -#define SRET 395 -#define NOUNWIND 396 -#define NOALIAS 397 -#define BYVAL 398 -#define NEST 399 -#define READNONE 400 -#define READONLY 401 -#define GC 402 -#define DEFAULT 403 -#define HIDDEN 404 -#define PROTECTED 405 -#line 14 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ESINT64VAL = 258, + EUINT64VAL = 259, + ESAPINTVAL = 260, + EUAPINTVAL = 261, + LOCALVAL_ID = 262, + GLOBALVAL_ID = 263, + FPVAL = 264, + VOID = 265, + INTTYPE = 266, + FLOAT = 267, + DOUBLE = 268, + X86_FP80 = 269, + FP128 = 270, + PPC_FP128 = 271, + LABEL = 272, + TYPE = 273, + LOCALVAR = 274, + GLOBALVAR = 275, + LABELSTR = 276, + STRINGCONSTANT = 277, + ATSTRINGCONSTANT = 278, + PCTSTRINGCONSTANT = 279, + ZEROINITIALIZER = 280, + TRUETOK = 281, + FALSETOK = 282, + BEGINTOK = 283, + ENDTOK = 284, + DECLARE = 285, + DEFINE = 286, + GLOBAL = 287, + CONSTANT = 288, + SECTION = 289, + ALIAS = 290, + VOLATILE = 291, + THREAD_LOCAL = 292, + TO = 293, + DOTDOTDOT = 294, + NULL_TOK = 295, + UNDEF = 296, + INTERNAL = 297, + LINKONCE = 298, + WEAK = 299, + APPENDING = 300, + DLLIMPORT = 301, + DLLEXPORT = 302, + EXTERN_WEAK = 303, + OPAQUE = 304, + EXTERNAL = 305, + TARGET = 306, + TRIPLE = 307, + ALIGN = 308, + ADDRSPACE = 309, + DEPLIBS = 310, + CALL = 311, + TAIL = 312, + ASM_TOK = 313, + MODULE = 314, + SIDEEFFECT = 315, + CC_TOK = 316, + CCC_TOK = 317, + FASTCC_TOK = 318, + COLDCC_TOK = 319, + X86_STDCALLCC_TOK = 320, + X86_FASTCALLCC_TOK = 321, + DATALAYOUT = 322, + UNWINDS = 323, + RET = 324, + BR = 325, + SWITCH = 326, + INVOKE = 327, + UNWIND = 328, + UNREACHABLE = 329, + ADD = 330, + SUB = 331, + MUL = 332, + UDIV = 333, + SDIV = 334, + FDIV = 335, + UREM = 336, + SREM = 337, + FREM = 338, + AND = 339, + OR = 340, + XOR = 341, + SHL = 342, + LSHR = 343, + ASHR = 344, + ICMP = 345, + FCMP = 346, + EQ = 347, + NE = 348, + SLT = 349, + SGT = 350, + SLE = 351, + SGE = 352, + ULT = 353, + UGT = 354, + ULE = 355, + UGE = 356, + OEQ = 357, + ONE = 358, + OLT = 359, + OGT = 360, + OLE = 361, + OGE = 362, + ORD = 363, + UNO = 364, + UEQ = 365, + UNE = 366, + MALLOC = 367, + ALLOCA = 368, + FREE = 369, + LOAD = 370, + STORE = 371, + GETELEMENTPTR = 372, + TRUNC = 373, + ZEXT = 374, + SEXT = 375, + FPTRUNC = 376, + FPEXT = 377, + BITCAST = 378, + UITOFP = 379, + SITOFP = 380, + FPTOUI = 381, + FPTOSI = 382, + INTTOPTR = 383, + PTRTOINT = 384, + PHI_TOK = 385, + SELECT = 386, + VAARG = 387, + EXTRACTELEMENT = 388, + INSERTELEMENT = 389, + SHUFFLEVECTOR = 390, + GETRESULT = 391, + SIGNEXT = 392, + ZEROEXT = 393, + NORETURN = 394, + INREG = 395, + SRET = 396, + NOUNWIND = 397, + NOALIAS = 398, + BYVAL = 399, + NEST = 400, + READNONE = 401, + READONLY = 402, + GC = 403, + DEFAULT = 404, + HIDDEN = 405, + PROTECTED = 406 + }; +#endif +/* Tokens. */ +#define ESINT64VAL 258 +#define EUINT64VAL 259 +#define ESAPINTVAL 260 +#define EUAPINTVAL 261 +#define LOCALVAL_ID 262 +#define GLOBALVAL_ID 263 +#define FPVAL 264 +#define VOID 265 +#define INTTYPE 266 +#define FLOAT 267 +#define DOUBLE 268 +#define X86_FP80 269 +#define FP128 270 +#define PPC_FP128 271 +#define LABEL 272 +#define TYPE 273 +#define LOCALVAR 274 +#define GLOBALVAR 275 +#define LABELSTR 276 +#define STRINGCONSTANT 277 +#define ATSTRINGCONSTANT 278 +#define PCTSTRINGCONSTANT 279 +#define ZEROINITIALIZER 280 +#define TRUETOK 281 +#define FALSETOK 282 +#define BEGINTOK 283 +#define ENDTOK 284 +#define DECLARE 285 +#define DEFINE 286 +#define GLOBAL 287 +#define CONSTANT 288 +#define SECTION 289 +#define ALIAS 290 +#define VOLATILE 291 +#define THREAD_LOCAL 292 +#define TO 293 +#define DOTDOTDOT 294 +#define NULL_TOK 295 +#define UNDEF 296 +#define INTERNAL 297 +#define LINKONCE 298 +#define WEAK 299 +#define APPENDING 300 +#define DLLIMPORT 301 +#define DLLEXPORT 302 +#define EXTERN_WEAK 303 +#define OPAQUE 304 +#define EXTERNAL 305 +#define TARGET 306 +#define TRIPLE 307 +#define ALIGN 308 +#define ADDRSPACE 309 +#define DEPLIBS 310 +#define CALL 311 +#define TAIL 312 +#define ASM_TOK 313 +#define MODULE 314 +#define SIDEEFFECT 315 +#define CC_TOK 316 +#define CCC_TOK 317 +#define FASTCC_TOK 318 +#define COLDCC_TOK 319 +#define X86_STDCALLCC_TOK 320 +#define X86_FASTCALLCC_TOK 321 +#define DATALAYOUT 322 +#define UNWINDS 323 +#define RET 324 +#define BR 325 +#define SWITCH 326 +#define INVOKE 327 +#define UNWIND 328 +#define UNREACHABLE 329 +#define ADD 330 +#define SUB 331 +#define MUL 332 +#define UDIV 333 +#define SDIV 334 +#define FDIV 335 +#define UREM 336 +#define SREM 337 +#define FREM 338 +#define AND 339 +#define OR 340 +#define XOR 341 +#define SHL 342 +#define LSHR 343 +#define ASHR 344 +#define ICMP 345 +#define FCMP 346 +#define EQ 347 +#define NE 348 +#define SLT 349 +#define SGT 350 +#define SLE 351 +#define SGE 352 +#define ULT 353 +#define UGT 354 +#define ULE 355 +#define UGE 356 +#define OEQ 357 +#define ONE 358 +#define OLT 359 +#define OGT 360 +#define OLE 361 +#define OGE 362 +#define ORD 363 +#define UNO 364 +#define UEQ 365 +#define UNE 366 +#define MALLOC 367 +#define ALLOCA 368 +#define FREE 369 +#define LOAD 370 +#define STORE 371 +#define GETELEMENTPTR 372 +#define TRUNC 373 +#define ZEXT 374 +#define SEXT 375 +#define FPTRUNC 376 +#define FPEXT 377 +#define BITCAST 378 +#define UITOFP 379 +#define SITOFP 380 +#define FPTOUI 381 +#define FPTOSI 382 +#define INTTOPTR 383 +#define PTRTOINT 384 +#define PHI_TOK 385 +#define SELECT 386 +#define VAARG 387 +#define EXTRACTELEMENT 388 +#define INSERTELEMENT 389 +#define SHUFFLEVECTOR 390 +#define GETRESULT 391 +#define SIGNEXT 392 +#define ZEROEXT 393 +#define NORETURN 394 +#define INREG 395 +#define SRET 396 +#define NOUNWIND 397 +#define NOALIAS 398 +#define BYVAL 399 +#define NEST 400 +#define READNONE 401 +#define READONLY 402 +#define GC 403 +#define DEFAULT 404 +#define HIDDEN 405 +#define PROTECTED 406 + + + + +/* Copy the first part of user declarations. */ +#line 14 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -647,7 +866,7 @@ V = Function::Create(FTy, GlobalValue::ExternalLinkage); else V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", - (Module*)0, false, PTy->getAddressSpace()); + (Module*)0, false, PTy->getAddressSpace()); break; } default: @@ -936,7 +1155,7 @@ // Otherwise there is no existing GV to use, create one now. GlobalVariable *GV = new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, - CurModule.CurrentModule, IsThreadLocal, AddressSpace); + CurModule.CurrentModule, IsThreadLocal, AddressSpace); GV->setVisibility(Visibility); InsertValue(GV, CurModule.Values); return GV; @@ -1097,8 +1316,29 @@ } -#line 950 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -typedef union { + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 950 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" +{ llvm::Module *ModuleVal; llvm::Function *FunctionVal; llvm::BasicBlock *BasicBlockVal; @@ -1143,1227 +1383,1913 @@ llvm::Instruction::OtherOps OtherOpVal; llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; -} YYSTYPE; -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif +} +/* Line 187 of yacc.c. */ +#line 1389 "llvmAsmParser.tab.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif -#define YYFINAL 635 -#define YYFLAG -32768 -#define YYNTBASE 166 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 405 ? yytranslate[x] : 250) - -static const short yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 152, - 153, 156, 2, 155, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 161, - 154, 162, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 158, 157, 160, 2, 2, 2, 2, 2, 165, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 159, - 2, 2, 163, 2, 164, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151 -}; +/* Copy the second part of user declarations. */ -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, - 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, - 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, - 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, - 120, 122, 124, 126, 127, 132, 133, 136, 137, 139, - 141, 143, 144, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 164, 166, 168, 170, 171, 173, 175, 176, - 178, 180, 182, 184, 185, 187, 189, 190, 192, 194, - 196, 198, 200, 203, 205, 207, 209, 211, 213, 215, - 217, 219, 221, 224, 225, 228, 230, 232, 234, 236, - 238, 240, 241, 244, 245, 248, 249, 252, 253, 257, - 260, 261, 263, 264, 268, 270, 273, 275, 277, 279, - 281, 283, 285, 287, 289, 291, 295, 297, 300, 306, - 312, 318, 324, 328, 331, 337, 342, 345, 347, 349, - 351, 355, 357, 361, 363, 364, 366, 370, 375, 379, - 383, 388, 393, 397, 404, 410, 413, 416, 419, 422, - 425, 428, 431, 434, 437, 440, 443, 446, 453, 459, - 468, 475, 482, 490, 498, 505, 514, 523, 527, 529, - 531, 533, 535, 536, 539, 546, 548, 549, 551, 554, - 555, 559, 560, 564, 568, 572, 576, 577, 586, 587, - 597, 598, 608, 614, 617, 621, 623, 627, 631, 635, - 639, 641, 642, 648, 652, 654, 658, 660, 661, 672, - 674, 676, 681, 683, 685, 688, 692, 693, 695, 697, - 699, 701, 703, 705, 707, 709, 711, 715, 717, 723, - 725, 727, 729, 731, 733, 735, 738, 740, 744, 747, - 750, 754, 757, 758, 762, 764, 769, 772, 775, 779, - 789, 799, 808, 823, 825, 827, 834, 840, 843, 850, - 858, 863, 868, 875, 882, 883, 884, 888, 891, 893, - 899, 905, 912, 919, 924, 931, 936, 941, 948, 955, - 958, 967, 969, 971, 972, 976, 983, 987, 994, 997, - 1003, 1011, 1017 -}; -static const short yyrhs[] = { 75, - 0, 76, 0, 77, 0, 78, 0, 79, 0, 80, - 0, 81, 0, 82, 0, 83, 0, 87, 0, 88, - 0, 89, 0, 84, 0, 85, 0, 86, 0, 118, - 0, 119, 0, 120, 0, 121, 0, 122, 0, 123, - 0, 124, 0, 125, 0, 126, 0, 127, 0, 128, - 0, 129, 0, 92, 0, 93, 0, 94, 0, 95, - 0, 96, 0, 97, 0, 98, 0, 99, 0, 100, - 0, 101, 0, 102, 0, 103, 0, 104, 0, 105, - 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, - 0, 111, 0, 98, 0, 99, 0, 100, 0, 101, - 0, 26, 0, 27, 0, 11, 0, 12, 0, 13, - 0, 16, 0, 15, 0, 14, 0, 19, 0, 22, - 0, 24, 0, 173, 0, 0, 54, 152, 4, 153, - 0, 0, 173, 154, 0, 0, 20, 0, 23, 0, - 179, 0, 0, 177, 154, 0, 42, 0, 44, 0, - 43, 0, 45, 0, 47, 0, 46, 0, 48, 0, - 50, 0, 0, 149, 0, 150, 0, 151, 0, 0, - 46, 0, 48, 0, 0, 42, 0, 43, 0, 44, - 0, 47, 0, 0, 44, 0, 42, 0, 0, 62, - 0, 63, 0, 64, 0, 65, 0, 66, 0, 61, - 4, 0, 138, 0, 119, 0, 137, 0, 120, 0, - 140, 0, 141, 0, 143, 0, 144, 0, 145, 0, - 53, 4, 0, 0, 188, 187, 0, 139, 0, 142, - 0, 138, 0, 137, 0, 146, 0, 147, 0, 0, - 190, 189, 0, 0, 148, 22, 0, 0, 53, 4, - 0, 0, 155, 53, 4, 0, 34, 22, 0, 0, - 194, 0, 0, 155, 197, 196, 0, 194, 0, 53, - 4, 0, 11, 0, 12, 0, 13, 0, 16, 0, - 15, 0, 14, 0, 17, 0, 49, 0, 198, 0, - 199, 175, 156, 0, 233, 0, 157, 4, 0, 199, - 152, 203, 153, 190, 0, 10, 152, 203, 153, 190, - 0, 158, 4, 159, 199, 160, 0, 161, 4, 159, - 199, 162, 0, 163, 204, 164, 0, 163, 164, 0, - 161, 163, 204, 164, 162, 0, 161, 163, 164, 162, - 0, 199, 188, 0, 199, 0, 10, 0, 200, 0, - 202, 155, 200, 0, 202, 0, 202, 155, 39, 0, - 39, 0, 0, 199, 0, 204, 155, 199, 0, 199, - 158, 207, 160, 0, 199, 158, 160, 0, 199, 165, - 22, 0, 199, 161, 207, 162, 0, 199, 163, 207, - 164, 0, 199, 163, 164, 0, 199, 161, 163, 207, - 164, 162, 0, 199, 161, 163, 164, 162, 0, 199, - 40, 0, 199, 41, 0, 199, 233, 0, 199, 206, - 0, 199, 25, 0, 171, 3, 0, 171, 5, 0, - 171, 4, 0, 171, 6, 0, 11, 26, 0, 11, - 27, 0, 172, 9, 0, 168, 152, 205, 38, 199, - 153, 0, 117, 152, 205, 245, 153, 0, 131, 152, - 205, 155, 205, 155, 205, 153, 0, 166, 152, 205, - 155, 205, 153, 0, 167, 152, 205, 155, 205, 153, - 0, 90, 169, 152, 205, 155, 205, 153, 0, 91, - 170, 152, 205, 155, 205, 153, 0, 133, 152, 205, - 155, 205, 153, 0, 134, 152, 205, 155, 205, 155, - 205, 153, 0, 135, 152, 205, 155, 205, 155, 205, - 153, 0, 207, 155, 205, 0, 205, 0, 32, 0, - 33, 0, 37, 0, 0, 201, 233, 0, 123, 152, - 210, 38, 199, 153, 0, 212, 0, 0, 213, 0, - 212, 213, 0, 0, 31, 214, 229, 0, 0, 30, - 215, 230, 0, 59, 58, 219, 0, 176, 18, 199, - 0, 176, 18, 10, 0, 0, 178, 182, 209, 208, - 205, 175, 216, 196, 0, 0, 178, 180, 182, 209, - 208, 205, 175, 217, 196, 0, 0, 178, 181, 182, - 209, 208, 199, 175, 218, 196, 0, 178, 182, 35, - 185, 210, 0, 51, 220, 0, 55, 154, 221, 0, - 22, 0, 52, 154, 22, 0, 67, 154, 22, 0, - 158, 222, 160, 0, 222, 155, 22, 0, 22, 0, - 0, 223, 155, 199, 188, 174, 0, 199, 188, 174, - 0, 223, 0, 223, 155, 39, 0, 39, 0, 0, - 186, 201, 177, 152, 224, 153, 190, 195, 192, 191, - 0, 28, 0, 163, 0, 184, 182, 225, 226, 0, - 29, 0, 164, 0, 237, 228, 0, 183, 182, 225, - 0, 0, 60, 0, 3, 0, 4, 0, 9, 0, - 26, 0, 27, 0, 40, 0, 41, 0, 25, 0, - 161, 207, 162, 0, 206, 0, 58, 231, 22, 155, - 22, 0, 7, 0, 8, 0, 173, 0, 177, 0, - 233, 0, 232, 0, 199, 234, 0, 235, 0, 236, - 155, 235, 0, 237, 238, 0, 227, 238, 0, 239, - 176, 240, 0, 239, 242, 0, 0, 68, 38, 234, - 0, 21, 0, 21, 68, 38, 234, 0, 69, 236, - 0, 69, 10, 0, 70, 17, 234, 0, 70, 11, - 234, 155, 17, 234, 155, 17, 234, 0, 71, 171, - 234, 155, 17, 234, 158, 241, 160, 0, 71, 171, - 234, 155, 17, 234, 158, 160, 0, 72, 186, 201, - 234, 152, 244, 153, 190, 38, 17, 234, 73, 17, - 234, 0, 73, 0, 74, 0, 241, 171, 232, 155, - 17, 234, 0, 171, 232, 155, 17, 234, 0, 176, - 247, 0, 199, 158, 234, 155, 234, 160, 0, 243, - 155, 158, 234, 155, 234, 160, 0, 199, 188, 234, - 188, 0, 17, 188, 234, 188, 0, 244, 155, 199, - 188, 234, 188, 0, 244, 155, 17, 188, 234, 188, - 0, 0, 0, 245, 155, 235, 0, 57, 56, 0, - 56, 0, 166, 199, 234, 155, 234, 0, 167, 199, - 234, 155, 234, 0, 90, 169, 199, 234, 155, 234, - 0, 91, 170, 199, 234, 155, 234, 0, 168, 235, - 38, 199, 0, 131, 235, 155, 235, 155, 235, 0, - 132, 235, 155, 199, 0, 133, 235, 155, 235, 0, - 134, 235, 155, 235, 155, 235, 0, 135, 235, 155, - 235, 155, 235, 0, 130, 243, 0, 246, 186, 201, - 234, 152, 244, 153, 190, 0, 249, 0, 36, 0, - 0, 112, 199, 193, 0, 112, 199, 155, 11, 234, - 193, 0, 113, 199, 193, 0, 113, 199, 155, 11, - 234, 193, 0, 114, 235, 0, 248, 115, 199, 234, - 193, 0, 248, 116, 235, 155, 199, 234, 193, 0, - 136, 199, 233, 155, 4, 0, 117, 199, 234, 245, - 0 -}; +/* Line 216 of yacc.c. */ +#line 1402 "llvmAsmParser.tab.c" +#ifdef short +# undef short #endif -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1113, - 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, - 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1118, 1118, 1119, - 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126, 1126, 1127, - 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132, - 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140, 1140, 1142, - 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154, 1159, 1159, - 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177, 1181, 1182, - 1183, 1187, 1188, 1189, 1190, 1194, 1195, 1196, 1200, 1201, - 1202, 1203, 1204, 1208, 1209, 1210, 1213, 1213, 1214, 1215, - 1216, 1217, 1218, 1226, 1227, 1228, 1229, 1230, 1231, 1232, - 1233, 1234, 1235, 1239, 1240, 1245, 1246, 1247, 1248, 1249, - 1250, 1253, 1254, 1259, 1260, 1267, 1267, 1274, 1274, 1284, - 1292, 1292, 1298, 1298, 1300, 1305, 1318, 1318, 1318, 1318, - 1318, 1318, 1318, 1321, 1325, 1329, 1336, 1341, 1349, 1379, - 1404, 1409, 1419, 1429, 1433, 1443, 1450, 1459, 1466, 1471, - 1476, 1483, 1484, 1491, 1498, 1506, 1512, 1524, 1552, 1568, - 1595, 1623, 1649, 1669, 1695, 1715, 1727, 1734, 1800, 1810, - 1820, 1826, 1836, 1842, 1852, 1857, 1862, 1875, 1887, 1909, - 1917, 1923, 1934, 1939, 1944, 1950, 1956, 1965, 1969, 1977, - 1977, 1980, 1980, 1983, 1995, 2016, 2021, 2029, 2030, 2034, - 2034, 2038, 2038, 2041, 2044, 2068, 2079, 2087, 2090, 2096, - 2099, 2106, 2110, 2150, 2153, 2159, 2169, 2173, 2178, 2180, - 2185, 2190, 2199, 2209, 2220, 2224, 2233, 2242, 2247, 2373, - 2373, 2375, 2384, 2384, 2386, 2391, 2403, 2407, 2412, 2416, - 2420, 2424, 2428, 2432, 2436, 2440, 2444, 2469, 2473, 2483, - 2487, 2491, 2496, 2503, 2503, 2509, 2518, 2523, 2528, 2532, - 2541, 2550, 2559, 2563, 2567, 2572, 2578, 2586, 2590, 2595, - 2605, 2624, 2633, 2714, 2718, 2725, 2736, 2749, 2759, 2770, - 2780, 2791, 2799, 2809, 2816, 2819, 2820, 2827, 2831, 2836, - 2852, 2869, 2883, 2897, 2909, 2917, 2924, 2930, 2936, 2942, - 2957, 3043, 3048, 3052, 3059, 3066, 3074, 3081, 3089, 3097, - 3111, 3128, 3136 -}; +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; #endif +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif -static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", -"EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL", -"VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE", -"LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT", -"ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE", -"GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT", -"NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT", -"EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","ADDRSPACE","DEPLIBS", -"CALL","TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK", -"COLDCC_TOK","X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","UNWINDS", -"RET","BR","SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV", -"SDIV","FDIV","UREM","SREM","FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP", -"FCMP","EQ","NE","SLT","SGT","SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE", -"OLT","OGT","OLE","OGE","ORD","UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD", -"STORE","GETELEMENTPTR","TRUNC","ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP", -"SITOFP","FPTOUI","FPTOSI","INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG", -"EXTRACTELEMENT","INSERTELEMENT","SHUFFLEVECTOR","GETRESULT","SIGNEXT","ZEROEXT", -"NORETURN","INREG","SRET","NOUNWIND","NOALIAS","BYVAL","NEST","READNONE","READONLY", -"GC","DEFAULT","HIDDEN","PROTECTED","'('","')'","'='","','","'*'","'\\\\'","'['", -"'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps","CastOps", -"IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName","OptAddrSpace", -"OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage", -"GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage", -"AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs", -"OptGC","OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes", -"GlobalVarAttribute","PrimType","Types","ArgType","ResultTypes","ArgTypeList", -"ArgTypeListI","TypeListI","ConstVal","ConstExpr","ConstVector","GlobalType", -"ThreadLocal","AliaseeRef","Module","DefinitionList","Definition","@1","@2", -"@3","@4","@5","AsmBlock","TargetDefinition","LibrariesDefinition","LibList", -"ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END","Function", -"FunctionProto","OptSideEffect","ConstValueRef","SymbolicValueRef","ValueRef", -"ResolvedVal","ReturnedVal","BasicBlockList","BasicBlock","InstructionList", -"BBTerminatorInst","JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall", -"InstVal","OptVolatile","MemoryInst", NULL -}; +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; #endif -static const short yyr1[] = { 0, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 167, - 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 171, 172, 172, 172, 172, 172, 173, - 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, - 178, 178, 179, 180, 180, 180, 180, 180, 181, 181, - 181, 182, 182, 182, 182, 183, 183, 183, 184, 184, - 184, 184, 184, 185, 185, 185, 186, 186, 186, 186, - 186, 186, 186, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 188, 188, 189, 189, 189, 189, 189, - 189, 190, 190, 191, 191, 192, 192, 193, 193, 194, - 195, 195, 196, 196, 197, 197, 198, 198, 198, 198, - 198, 198, 198, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 200, 201, 201, 202, - 202, 203, 203, 203, 203, 204, 204, 205, 205, 205, - 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 205, 205, 205, 205, 205, 205, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 207, 207, 208, - 208, 209, 209, 210, 210, 211, 211, 212, 212, 214, - 213, 215, 213, 213, 213, 213, 216, 213, 217, 213, - 218, 213, 213, 213, 213, 219, 220, 220, 221, 222, - 222, 222, 223, 223, 224, 224, 224, 224, 225, 226, - 226, 227, 228, 228, 229, 230, 231, 231, 232, 232, - 232, 232, 232, 232, 232, 232, 232, 232, 232, 233, - 233, 233, 233, 234, 234, 235, 236, 236, 237, 237, - 238, 239, 239, 239, 239, 239, 240, 240, 240, 240, - 240, 240, 240, 240, 240, 241, 241, 242, 243, 243, - 244, 244, 244, 244, 244, 245, 245, 246, 246, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 248, 248, 249, 249, 249, 249, 249, 249, - 249, 249, 249 -}; +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif -static const short yyr2[] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 4, 0, 2, 0, 1, 1, - 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, - 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 0, 2, 1, 1, 1, 1, 1, - 1, 0, 2, 0, 2, 0, 2, 0, 3, 2, - 0, 1, 0, 3, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 2, 5, 5, - 5, 5, 3, 2, 5, 4, 2, 1, 1, 1, - 3, 1, 3, 1, 0, 1, 3, 4, 3, 3, - 4, 4, 3, 6, 5, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 6, 5, 8, - 6, 6, 7, 7, 6, 8, 8, 3, 1, 1, - 1, 1, 0, 2, 6, 1, 0, 1, 2, 0, - 3, 0, 3, 3, 3, 3, 0, 8, 0, 9, - 0, 9, 5, 2, 3, 1, 3, 3, 3, 3, - 1, 0, 5, 3, 1, 3, 1, 0, 10, 1, - 1, 4, 1, 1, 2, 3, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 1, 5, 1, - 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, - 3, 2, 0, 3, 1, 4, 2, 2, 3, 9, - 9, 8, 14, 1, 1, 6, 5, 2, 6, 7, - 4, 4, 6, 6, 0, 0, 3, 2, 1, 5, - 5, 6, 6, 4, 6, 4, 4, 6, 6, 2, - 8, 1, 1, 0, 3, 6, 3, 6, 2, 5, - 7, 5, 4 -}; +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif -static const short yydefact[] = { 72, - 60, 69, 61, 70, 62, 212, 210, 0, 0, 0, - 0, 0, 0, 82, 71, 72, 208, 86, 89, 0, - 0, 224, 0, 0, 67, 0, 73, 74, 76, 75, - 77, 79, 78, 80, 81, 83, 84, 85, 82, 82, - 203, 209, 87, 88, 82, 213, 90, 91, 92, 93, - 82, 273, 211, 273, 0, 0, 232, 225, 226, 214, - 260, 261, 216, 137, 138, 139, 142, 141, 140, 143, - 144, 0, 0, 0, 0, 262, 263, 145, 215, 147, - 203, 203, 94, 202, 0, 97, 97, 275, 0, 270, - 68, 243, 244, 245, 269, 227, 228, 231, 0, 165, - 148, 0, 0, 0, 0, 154, 166, 0, 0, 165, - 0, 0, 0, 96, 95, 0, 200, 201, 0, 0, - 98, 99, 100, 101, 102, 0, 246, 0, 0, 0, - 314, 272, 0, 229, 164, 114, 160, 162, 0, 0, - 0, 0, 0, 0, 153, 0, 0, 146, 0, 0, - 159, 0, 158, 0, 223, 137, 138, 139, 142, 141, - 140, 0, 0, 66, 66, 103, 0, 240, 241, 242, - 0, 249, 250, 251, 256, 252, 253, 254, 255, 247, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, - 14, 15, 10, 11, 12, 0, 0, 0, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 0, 0, 0, 0, 0, 0, 0, 0, 258, 265, - 264, 274, 313, 299, 0, 0, 0, 0, 97, 284, - 285, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 271, 97, 288, - 0, 312, 230, 157, 0, 122, 66, 66, 156, 0, - 167, 0, 122, 66, 66, 0, 204, 185, 186, 181, - 183, 182, 184, 187, 180, 176, 177, 0, 0, 0, - 0, 179, 178, 217, 0, 276, 248, 0, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 0, 52, - 53, 48, 49, 50, 51, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 0, 0, 0, 0, 0, - 0, 199, 0, 0, 0, 0, 298, 278, 66, 267, - 277, 0, 0, 54, 0, 0, 0, 0, 128, 128, - 319, 66, 66, 310, 0, 0, 0, 0, 0, 66, - 66, 66, 0, 0, 0, 0, 0, 105, 107, 106, - 104, 108, 109, 110, 111, 112, 115, 163, 161, 150, - 151, 152, 155, 65, 149, 219, 221, 0, 169, 0, - 0, 0, 173, 0, 170, 133, 238, 0, 0, 0, - 296, 0, 0, 0, 0, 0, 257, 0, 0, 0, - 266, 0, 0, 279, 0, 0, 66, 66, 0, 315, - 0, 317, 296, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 66, 0, 113, 119, 118, - 116, 117, 120, 121, 123, 133, 133, 0, 168, 154, - 166, 0, 171, 172, 0, 218, 237, 114, 235, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 198, 0, - 0, 0, 268, 0, 0, 0, 0, 0, 0, 0, - 0, 323, 0, 0, 0, 306, 307, 0, 0, 0, - 0, 0, 304, 0, 128, 0, 220, 222, 66, 175, - 0, 0, 0, 135, 133, 64, 0, 122, 259, 0, - 0, 189, 0, 0, 0, 0, 0, 0, 0, 66, - 0, 0, 295, 0, 0, 128, 129, 128, 0, 0, - 0, 0, 0, 322, 300, 301, 295, 0, 320, 66, - 205, 174, 130, 136, 134, 63, 234, 236, 114, 131, - 0, 0, 297, 0, 195, 0, 0, 191, 192, 188, - 0, 0, 114, 114, 0, 302, 303, 316, 318, 0, - 0, 305, 308, 309, 0, 128, 64, 132, 126, 193, - 194, 0, 0, 0, 0, 0, 0, 0, 122, 0, - 289, 0, 122, 321, 233, 0, 124, 190, 196, 197, - 0, 282, 0, 0, 105, 107, 114, 114, 0, 114, - 114, 290, 311, 127, 0, 239, 280, 0, 281, 0, - 292, 291, 0, 0, 0, 125, 0, 0, 0, 114, - 114, 0, 0, 0, 294, 293, 287, 0, 0, 286, - 0, 283, 0, 0, 0 -}; +#if ! defined yyoverflow || YYERROR_VERBOSE -static const short yydefgoto[] = { 216, - 217, 218, 299, 316, 162, 163, 76, 537, 111, 12, - 77, 14, 15, 39, 40, 41, 45, 51, 116, 126, - 367, 254, 435, 370, 606, 587, 410, 494, 569, 446, - 495, 78, 164, 137, 154, 138, 139, 108, 322, 219, - 323, 119, 85, 155, 633, 16, 17, 19, 18, 386, - 436, 437, 60, 22, 58, 99, 449, 450, 127, 170, - 52, 94, 53, 46, 288, 220, 80, 222, 330, 331, - 54, 90, 91, 248, 594, 132, 344, 555, 454, 249, - 250, 251, 252 +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 43 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 2015 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 166 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 85 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 324 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 635 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 406 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 152, 153, 156, 2, 155, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 161, 154, 162, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 158, 157, 160, 2, 2, 2, 2, 2, 165, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 159, 2, 2, 163, 2, 164, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151 }; -static const short yypact[] = { 504, --32768,-32768,-32768,-32768,-32768,-32768,-32768, -13, -126, -26, - -90, 107, -69, 256,-32768, 633,-32768, 126, 205, 19, - 29,-32768, 31, 125,-32768, 1570,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 174, 174, - 190,-32768,-32768,-32768, 174,-32768,-32768,-32768,-32768,-32768, - 174, 1,-32768, -2, 178, 202, 212,-32768,-32768,-32768, --32768,-32768, 83,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, 251, 257, 8, 33,-32768,-32768,-32768, 74,-32768, - 223, 223, 253,-32768, 82, 255, 255, 200, 235,-32768, - 245,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -88, 1124, --32768, 128, 137, 813, 83,-32768, 74, -65, 134, 1124, - 154, 82, 82,-32768,-32768, 1370,-32768,-32768, 1610, 307, --32768,-32768,-32768,-32768,-32768, 1650,-32768, -7, 289, 904, - 1865,-32768, 306,-32768,-32768, 74,-32768, 179, 176, 1690, - 1690, 177, -55, 1690,-32768, 338, 198,-32768, 1610, 1690, - 83, 191, 74, 365,-32768, 342, 344, 345, 351, 361, - 372, 273, 373, 1180, 332,-32768, 162,-32768,-32768,-32768, - 904,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 323, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 329, 489, 238,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 239, 246, 250, 258, 1610, 261, 263, 264,-32768,-32768, --32768,-32768,-32768,-32768, 341, 1730, 102, 392, 255,-32768, --32768, 329, 489, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - 1690, 1690, 1690, 1690, 1690, 1690, 1690,-32768, 255,-32768, - 45,-32768,-32768, 221, 1450,-32768, 7, -29,-32768, 247, - 74, 265,-32768, 332, -30, 1370,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 1410, 1770, 853, - 386,-32768,-32768,-32768, 279,-32768,-32768, 395,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 280,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 282, 1610, 1610, 1610, 1610, - 1610,-32768, -67, 1610, 1610, 1610,-32768, 83, 764,-32768, - 285, 904, 904,-32768, 904, 1650, 1690, 1690, 43, 49, --32768, 764, -31, 288, 292, 293, 295, 296, 297, 51, - 764, 764, 397, 1650, 1690, 1690, 449,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 146, --32768,-32768,-32768,-32768, 146,-32768, 154, 416,-32768, -62, - 1078, -10,-32768, -15,-32768, 302, 1490, 303, 1610, 1610, --32768, 304, 309, 312, 313, 1610,-32768, 314, 315, 423, --32768, 1690, 316,-32768, 317, 904, 764, 764, 25,-32768, - 26,-32768,-32768, 904, 318, 1690, 1690, 1690, 1690, 1690, - 319, 320, 322, 1690, 904, 764, 325,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 302, 302, 1690,-32768, 321, - 1033, -11,-32768,-32768, 28,-32768,-32768, 74, 326, 331, - 456, 327, 330, 152, 1610, 1610, 1610, 1610,-32768, 1610, - 1610, 1690,-32768, 469, 470, 336, 335, 337, 904, 490, - 904, 340, 346, 904, 347, 74,-32768, 350, 354, 496, - 904, 904, 74, 362, 358, 1690,-32768,-32768, 23,-32768, - 355, 471, 502,-32768, 302, 113, 1530,-32768,-32768, 1610, - 1610,-32768, 1690, 364, 367, 370, 376, 379, 380, 54, - 904, 904, 1810, 904, 904, 358,-32768, 358, 904, 381, - 1690, 1690, 1690,-32768,-32768,-32768, 1810, 484,-32768, 764, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 74, -8, - 385, 387,-32768, 1610,-32768, 1610, 1610,-32768,-32768,-32768, - 384, 383, 114, 74, 180,-32768,-32768,-32768,-32768, 382, - 904,-32768,-32768,-32768, 197, 358, 113,-32768, 493,-32768, --32768, 390, 394, 398, 531, 3, 621, 621,-32768, 1850, --32768, 393,-32768,-32768,-32768, 546, 406,-32768,-32768,-32768, - 904,-32768, 1321, 9, 405, 408,-32768,-32768, 4, 114, - 74,-32768, 146,-32768, 540,-32768,-32768, 409,-32768, 1321, - 221, 221, 548, 621, 621,-32768, 549, 413, 904,-32768, --32768, 904, 552, 497, 221, 221,-32768, 904, 554,-32768, - 904,-32768, 572, 574,-32768 +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, + 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, + 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, + 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, + 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, + 119, 121, 123, 125, 127, 129, 130, 135, 136, 139, + 140, 142, 144, 146, 147, 150, 152, 154, 156, 158, + 160, 162, 164, 166, 167, 169, 171, 173, 174, 176, + 178, 179, 181, 183, 185, 187, 188, 190, 192, 193, + 195, 197, 199, 201, 203, 206, 208, 210, 212, 214, + 216, 218, 220, 222, 224, 227, 228, 231, 233, 235, + 237, 239, 241, 243, 244, 247, 248, 251, 252, 255, + 256, 260, 263, 264, 266, 267, 271, 273, 276, 278, + 280, 282, 284, 286, 288, 290, 292, 294, 298, 300, + 303, 309, 315, 321, 327, 331, 334, 340, 345, 348, + 350, 352, 354, 358, 360, 364, 366, 367, 369, 373, + 378, 382, 386, 391, 396, 400, 407, 413, 416, 419, + 422, 425, 428, 431, 434, 437, 440, 443, 446, 449, + 456, 462, 471, 478, 485, 493, 501, 508, 517, 526, + 530, 532, 534, 536, 538, 539, 542, 549, 551, 552, + 554, 557, 558, 562, 563, 567, 571, 575, 579, 580, + 589, 590, 600, 601, 611, 617, 620, 624, 626, 630, + 634, 638, 642, 644, 645, 651, 655, 657, 661, 663, + 664, 675, 677, 679, 684, 686, 688, 691, 695, 696, + 698, 700, 702, 704, 706, 708, 710, 712, 714, 718, + 720, 726, 728, 730, 732, 734, 736, 738, 741, 743, + 747, 750, 753, 757, 760, 761, 765, 767, 772, 775, + 778, 782, 792, 802, 811, 826, 828, 830, 837, 843, + 846, 853, 861, 866, 871, 878, 885, 886, 887, 891, + 894, 896, 902, 908, 915, 922, 927, 934, 939, 944, + 951, 958, 961, 970, 972, 974, 975, 979, 986, 990, + 997, 1000, 1006, 1014, 1020 }; -static const short yypgoto[] = { 445, - 446, 448, 348, 349, -227,-32768, 0, 14, -100, 492, - 13,-32768,-32768,-32768,-32768, 67,-32768,-32768,-32768, -166, --32768, -443,-32768, -257,-32768,-32768, -337, 44,-32768, -406, --32768,-32768, -24, 352, -108,-32768, 491, 498, -81, -147, - -245, 80, 127, 339,-32768,-32768, 587,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 517,-32768, --32768,-32768,-32768,-32768,-32768, -506, -70, 104, -232,-32768, --32768, 555,-32768,-32768,-32768,-32768,-32768, 79, 195,-32768, --32768,-32768,-32768 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 212, 0, -1, 75, -1, 76, -1, 77, -1, 78, + -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, + -1, 87, -1, 88, -1, 89, -1, 84, -1, 85, + -1, 86, -1, 118, -1, 119, -1, 120, -1, 121, + -1, 122, -1, 123, -1, 124, -1, 125, -1, 126, + -1, 127, -1, 128, -1, 129, -1, 92, -1, 93, + -1, 94, -1, 95, -1, 96, -1, 97, -1, 98, + -1, 99, -1, 100, -1, 101, -1, 102, -1, 103, + -1, 104, -1, 105, -1, 106, -1, 107, -1, 108, + -1, 109, -1, 110, -1, 111, -1, 98, -1, 99, + -1, 100, -1, 101, -1, 26, -1, 27, -1, 11, + -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, + -1, 19, -1, 22, -1, 24, -1, 174, -1, -1, + 54, 152, 4, 153, -1, -1, 174, 154, -1, -1, + 20, -1, 23, -1, 180, -1, -1, 178, 154, -1, + 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, + 46, -1, 48, -1, 50, -1, -1, 149, -1, 150, + -1, 151, -1, -1, 46, -1, 48, -1, -1, 42, + -1, 43, -1, 44, -1, 47, -1, -1, 44, -1, + 42, -1, -1, 62, -1, 63, -1, 64, -1, 65, + -1, 66, -1, 61, 4, -1, 138, -1, 119, -1, + 137, -1, 120, -1, 140, -1, 141, -1, 143, -1, + 144, -1, 145, -1, 53, 4, -1, -1, 189, 188, + -1, 139, -1, 142, -1, 138, -1, 137, -1, 146, + -1, 147, -1, -1, 191, 190, -1, -1, 148, 22, + -1, -1, 53, 4, -1, -1, 155, 53, 4, -1, + 34, 22, -1, -1, 195, -1, -1, 155, 198, 197, + -1, 195, -1, 53, 4, -1, 11, -1, 12, -1, + 13, -1, 16, -1, 15, -1, 14, -1, 17, -1, + 49, -1, 199, -1, 200, 176, 156, -1, 234, -1, + 157, 4, -1, 200, 152, 204, 153, 191, -1, 10, + 152, 204, 153, 191, -1, 158, 4, 159, 200, 160, + -1, 161, 4, 159, 200, 162, -1, 163, 205, 164, + -1, 163, 164, -1, 161, 163, 205, 164, 162, -1, + 161, 163, 164, 162, -1, 200, 189, -1, 200, -1, + 10, -1, 201, -1, 203, 155, 201, -1, 203, -1, + 203, 155, 39, -1, 39, -1, -1, 200, -1, 205, + 155, 200, -1, 200, 158, 208, 160, -1, 200, 158, + 160, -1, 200, 165, 22, -1, 200, 161, 208, 162, + -1, 200, 163, 208, 164, -1, 200, 163, 164, -1, + 200, 161, 163, 208, 164, 162, -1, 200, 161, 163, + 164, 162, -1, 200, 40, -1, 200, 41, -1, 200, + 234, -1, 200, 207, -1, 200, 25, -1, 172, 3, + -1, 172, 5, -1, 172, 4, -1, 172, 6, -1, + 11, 26, -1, 11, 27, -1, 173, 9, -1, 169, + 152, 206, 38, 200, 153, -1, 117, 152, 206, 246, + 153, -1, 131, 152, 206, 155, 206, 155, 206, 153, + -1, 167, 152, 206, 155, 206, 153, -1, 168, 152, + 206, 155, 206, 153, -1, 90, 170, 152, 206, 155, + 206, 153, -1, 91, 171, 152, 206, 155, 206, 153, + -1, 133, 152, 206, 155, 206, 153, -1, 134, 152, + 206, 155, 206, 155, 206, 153, -1, 135, 152, 206, + 155, 206, 155, 206, 153, -1, 208, 155, 206, -1, + 206, -1, 32, -1, 33, -1, 37, -1, -1, 202, + 234, -1, 123, 152, 211, 38, 200, 153, -1, 213, + -1, -1, 214, -1, 213, 214, -1, -1, 31, 215, + 230, -1, -1, 30, 216, 231, -1, 59, 58, 220, + -1, 177, 18, 200, -1, 177, 18, 10, -1, -1, + 179, 183, 210, 209, 206, 176, 217, 197, -1, -1, + 179, 181, 183, 210, 209, 206, 176, 218, 197, -1, + -1, 179, 182, 183, 210, 209, 200, 176, 219, 197, + -1, 179, 183, 35, 186, 211, -1, 51, 221, -1, + 55, 154, 222, -1, 22, -1, 52, 154, 22, -1, + 67, 154, 22, -1, 158, 223, 160, -1, 223, 155, + 22, -1, 22, -1, -1, 224, 155, 200, 189, 175, + -1, 200, 189, 175, -1, 224, -1, 224, 155, 39, + -1, 39, -1, -1, 187, 202, 178, 152, 225, 153, + 191, 196, 193, 192, -1, 28, -1, 163, -1, 185, + 183, 226, 227, -1, 29, -1, 164, -1, 238, 229, + -1, 184, 183, 226, -1, -1, 60, -1, 3, -1, + 4, -1, 9, -1, 26, -1, 27, -1, 40, -1, + 41, -1, 25, -1, 161, 208, 162, -1, 207, -1, + 58, 232, 22, 155, 22, -1, 7, -1, 8, -1, + 174, -1, 178, -1, 234, -1, 233, -1, 200, 235, + -1, 236, -1, 237, 155, 236, -1, 238, 239, -1, + 228, 239, -1, 240, 177, 241, -1, 240, 243, -1, + -1, 68, 38, 235, -1, 21, -1, 21, 68, 38, + 235, -1, 69, 237, -1, 69, 10, -1, 70, 17, + 235, -1, 70, 11, 235, 155, 17, 235, 155, 17, + 235, -1, 71, 172, 235, 155, 17, 235, 158, 242, + 160, -1, 71, 172, 235, 155, 17, 235, 158, 160, + -1, 72, 187, 202, 235, 152, 245, 153, 191, 38, + 17, 235, 73, 17, 235, -1, 73, -1, 74, -1, + 242, 172, 233, 155, 17, 235, -1, 172, 233, 155, + 17, 235, -1, 177, 248, -1, 200, 158, 235, 155, + 235, 160, -1, 244, 155, 158, 235, 155, 235, 160, + -1, 200, 189, 235, 189, -1, 17, 189, 235, 189, + -1, 245, 155, 200, 189, 235, 189, -1, 245, 155, + 17, 189, 235, 189, -1, -1, -1, 246, 155, 236, + -1, 57, 56, -1, 56, -1, 167, 200, 235, 155, + 235, -1, 168, 200, 235, 155, 235, -1, 90, 170, + 200, 235, 155, 235, -1, 91, 171, 200, 235, 155, + 235, -1, 169, 236, 38, 200, -1, 131, 236, 155, + 236, 155, 236, -1, 132, 236, 155, 200, -1, 133, + 236, 155, 236, -1, 134, 236, 155, 236, 155, 236, + -1, 135, 236, 155, 236, 155, 236, -1, 130, 244, + -1, 247, 187, 202, 235, 152, 245, 153, 191, -1, + 250, -1, 36, -1, -1, 112, 200, 194, -1, 112, + 200, 155, 11, 235, 194, -1, 113, 200, 194, -1, + 113, 200, 155, 11, 235, 194, -1, 114, 236, -1, + 249, 115, 200, 235, 194, -1, 249, 116, 236, 155, + 200, 235, 194, -1, 136, 200, 234, 155, 4, -1, + 117, 200, 235, 246, -1 }; +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, + 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114, + 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118, + 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126, + 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131, + 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140, + 1140, 1142, 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154, + 1159, 1159, 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177, + 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195, 1196, + 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213, 1214, + 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229, 1230, + 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1245, 1246, 1247, + 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268, 1274, + 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318, 1318, + 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336, 1341, + 1349, 1379, 1404, 1409, 1419, 1429, 1433, 1443, 1450, 1459, + 1466, 1471, 1476, 1483, 1484, 1491, 1498, 1506, 1512, 1524, + 1552, 1568, 1595, 1623, 1649, 1669, 1695, 1715, 1727, 1734, + 1800, 1810, 1820, 1826, 1836, 1842, 1852, 1857, 1862, 1875, + 1887, 1909, 1917, 1923, 1934, 1939, 1944, 1950, 1956, 1965, + 1969, 1977, 1977, 1980, 1980, 1983, 1995, 2016, 2021, 2029, + 2030, 2034, 2034, 2038, 2038, 2041, 2044, 2068, 2080, 2079, + 2091, 2090, 2100, 2099, 2110, 2150, 2153, 2159, 2169, 2173, + 2178, 2180, 2185, 2190, 2199, 2209, 2220, 2224, 2233, 2242, + 2247, 2373, 2373, 2375, 2384, 2384, 2386, 2391, 2403, 2407, + 2412, 2416, 2420, 2424, 2428, 2432, 2436, 2440, 2444, 2469, + 2473, 2483, 2487, 2491, 2496, 2503, 2503, 2509, 2518, 2523, + 2528, 2532, 2541, 2550, 2559, 2563, 2567, 2572, 2579, 2586, + 2590, 2595, 2605, 2624, 2633, 2714, 2718, 2725, 2736, 2749, + 2759, 2770, 2780, 2791, 2799, 2809, 2816, 2819, 2820, 2827, + 2831, 2836, 2852, 2869, 2883, 2897, 2909, 2917, 2924, 2930, + 2936, 2942, 2957, 3043, 3048, 3052, 3059, 3066, 3074, 3081, + 3089, 3097, 3111, 3128, 3136 +}; +#endif -#define YYLAST 2013 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", + "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", + "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", + "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", + "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", + "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", + "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", + "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", + "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", + "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", + "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", + "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", + "DATALAYOUT", "UNWINDS", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", + "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", + "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", + "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", + "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", + "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", + "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", + "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", + "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", + "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", + "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC", + "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'", + "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", + "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", + "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName", + "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign", + "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage", + "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", + "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs", + "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign", + "SectionString", "OptSection", "GlobalVarAttributes", + "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", + "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", + "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", + "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", + "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", + "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", + "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", + "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal", + "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", + "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall", + "InstVal", "OptVolatile", "MemoryInst", 0 +}; +#endif +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 40, 41, 61, 44, 42, 92, 91, 120, + 93, 60, 62, 123, 125, 99 +}; +# endif -static const short yytable[] = { 11, - 335, 79, 412, 341, 496, 375, 345, 346, 347, 348, - 349, 103, 13, 334, 353, 11, 282, 167, 88, 334, - 168, 88, 109, 109, 109, 492, 92, 23, 13, 487, - 488, 24, 380, 382, 384, 469, 471, 165, 20, 61, - 62, 613, 105, 64, 65, 66, 67, 68, 69, 70, - 107, 1, 2, 21, 3, 4, 5, 61, 62, 221, - 109, 492, 336, 25, 284, 89, 133, 264, 89, 1, - 2, 134, 3, 4, 5, 136, 109, 470, 470, 107, - 493, 71, 354, 267, 27, 136, 608, 396, 535, 144, - 11, 153, 396, 283, 397, 567, 109, 439, 145, 144, - 221, 153, 109, 618, 109, 81, 82, 109, 260, 577, - 578, 86, 332, 117, 118, 257, 258, 87, 333, 261, - 110, 110, 110, 427, 26, 265, 414, 109, 429, 430, - 431, 1, 372, 432, 3, 442, 5, 433, 434, 396, - 429, 430, 431, 396, 396, 432, 59, 529, 444, 433, - 434, 443, 491, 611, 612, 169, 614, 615, 110, 355, - 356, 93, 592, 376, 377, 357, 371, -143, 609, 463, - 104, 43, 55, 44, 110, 531, 625, 626, 558, 285, - 559, 2, 56, 475, 4, 477, 478, 479, 57, 72, - 73, 149, 150, 74, 110, 75, 106, 409, -66, 96, - 110, 329, 110, 411, -66, 110, 550, 112, 113, 339, - 340, 329, 342, 343, 329, 329, 329, 329, 329, 350, - 351, 352, 329, 97, 83, 110, 84, 406, 584, -66, - 136, 358, 359, 98, 100, 391, 392, 393, 394, 395, - 540, 153, 398, 399, 400, 425, 47, 48, 49, 360, - 361, 50, 362, 363, 101, 364, 365, 366, 221, 84, - 102, 221, 221, 1, 221, -143, 3, 129, 5, -143, - 543, 221, 130, 357, 286, 270, 271, 272, 273, 421, - 221, 221, 429, 430, 431, 146, 140, 432, 562, 563, - 564, 433, 434, 282, 114, 141, 115, 28, 29, 30, - 31, 32, 33, 34, 502, 35, 503, 452, 453, 148, - 166, 153, 407, 408, 459, 120, 121, 122, 123, 124, - 125, 599, 36, 37, 38, 603, 171, 253, 256, 153, - 426, 329, 579, 255, 580, 221, 221, 221, 259, 358, - 359, 262, 266, 221, -54, -54, -54, -54, 593, 583, - 263, 580, -55, -56, 221, 221, 441, 360, 361, -59, - 362, 363, 448, 364, 365, 366, 610, 268, 269, -58, - 283, 61, 62, 504, 505, 506, 507, 329, 508, 509, - -57, 274, 287, 1, 2, 109, 3, 4, 5, 317, - 318, 329, 476, 329, 329, 329, 327, 319, 221, 483, - 221, 320, 334, 221, 36, 37, 38, 385, 373, 321, - 221, 221, 324, 489, 325, 326, 388, 374, 541, 542, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 387, 389, 401, 390, 424, 403, 404, 510, 405, 402, - 221, 221, 415, 221, 221, 413, 416, 417, 221, 418, - 419, 420, 428, 438, 422, 423, 445, 451, 455, 221, - 462, 530, 572, 456, 573, 574, 457, 458, 460, 461, - 464, 465, 539, 480, 481, 474, 482, 499, 329, 486, - 497, 500, 490, 498, 501, 511, 512, 513, 554, 514, - 221, 515, 533, 517, 503, 536, 329, 329, 329, 524, - 519, 521, 554, -207, 522, 534, 221, 221, 523, 466, - 467, 468, 528, 527, 300, 301, 532, 473, 544, 545, - 221, -68, 1, 2, 546, 3, 4, 5, 484, 485, - 547, 548, 549, 6, 7, 561, 470, 570, 575, 571, - 576, 581, 588, 221, 221, 586, 589, 591, 221, 604, - 590, 221, 602, 605, 8, 601, -17, 221, 9, -18, - 221, 616, 10, 617, 619, 622, 536, 623, 628, 629, - 631, 634, 516, 635, 518, 245, 246, 520, 247, 337, - 585, 338, 131, 568, 525, 526, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 147, 143, 42, 128, 378, 565, 369, 472, 95, 0, - 0, 0, 0, 0, 551, 552, 0, 556, 557, 0, - 0, 0, 560, 172, 173, 0, 0, 61, 62, 174, - 0, 0, -206, 566, 0, 0, 0, 0, 0, 1, - 2, 0, 3, 4, 5, 175, 176, 177, 0, 0, - -68, 1, 2, 0, 3, 4, 5, 0, 0, 0, - 178, 179, 6, 7, 582, 0, 0, 0, 0, 0, - 0, 0, 0, 357, 0, 0, 0, 0, 180, 0, - 597, 598, 0, 8, 0, 0, 0, 9, 0, 0, - 0, 10, 0, 0, 607, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 0, 0, 0, 0, 0, 620, 621, 0, - 0, 0, 624, 0, 0, 627, 0, 0, 0, 0, - 0, 630, 0, 0, 632, 0, 0, 198, 199, 595, - 596, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 0, 211, 0, 212, 213, 214, 0, 360, 361, 0, - 362, 363, 0, 364, 365, 366, 172, 173, 0, 0, - 61, 62, 174, 0, 0, 0, 0, 0, 0, 0, - 0, 215, 1, 2, 0, 3, 4, 5, 175, 176, - 177, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 178, 179, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 109, 0, 61, - 62, 180, 105, 64, 65, 66, 67, 68, 69, 70, - 0, 1, 2, 0, 3, 4, 5, 0, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 0, 0, 0, 0, 61, - 62, 71, 105, 156, 157, 158, 159, 160, 161, 70, - 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 0, 211, 0, 212, 213, 214, 0, - 0, 71, 0, 0, 0, 0, 172, 173, 0, 0, - 61, 62, 174, 0, 0, 110, 0, 0, 0, 0, - 0, 0, 1, 2, 215, 3, 4, 5, 175, 176, - 177, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 178, 179, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 180, 0, 0, 0, 0, 0, 0, 0, 72, - 73, 0, 0, 74, 0, 75, 142, 0, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, - 73, 0, 0, 74, 0, 75, 383, 0, 0, 0, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 0, 211, 0, 212, 213, 214, 61, - 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 2, 0, 3, 4, 5, 275, 0, 0, - 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, - 0, 0, 276, 277, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 61, 62, 109, 105, 156, 157, - 158, 159, 160, 161, 70, 0, 1, 2, 0, 3, - 4, 5, 0, 0, 0, 0, 0, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 0, 0, 71, 0, 0, 0, - 61, 62, 0, 105, 64, 65, 66, 67, 68, 69, - 70, 0, 1, 2, 0, 3, 4, 5, 0, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 135, 211, 0, 212, 213, 214, 0, 0, - 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 110, 0, 61, 62, -66, 0, - 278, 0, 0, 279, 0, 280, 0, 281, 1, 2, - 0, 3, 4, 5, 275, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 276, - 277, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 109, 72, 73, 0, 0, 74, 0, - 75, 440, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 72, 73, 0, 0, 74, 0, 75, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 0, - 211, 0, 212, 213, 214, 0, 0, 0, 0, 0, - 0, 0, 0, 172, 173, 0, 0, 0, 0, 174, - 0, 110, 0, 0, 0, 0, 0, 278, 0, 0, - 279, 0, 280, 0, 281, 175, 176, 177, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 178, 179, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 61, 62, 180, 151, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 0, 0, 0, 0, 61, 62, 71, 105, - 156, 157, 158, 159, 160, 161, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 0, 211, 0, 212, 213, 214, 61, 62, 71, 105, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 215, 0, 0, 0, 0, 0, 0, 368, 0, - 0, 0, 152, 0, 0, 0, 61, 62, 71, 105, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 447, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 105, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 538, 379, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 63, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 105, - 156, 157, 158, 159, 160, 161, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 151, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 105, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 328, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 105, - 156, 157, 158, 159, 160, 161, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 105, - 64, 65, 66, 67, 68, 69, 553, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 61, 62, 71, 105, - 64, 65, 66, 67, 68, 69, 600, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 0, 0, 71, 0, - 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 224, 225, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 381, 226, 227, 228, 229, 230, 231, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 232, 233, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75, 0, 0, 0, 234, 235, 236, 0, - 0, 237, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 238, 239, 240, 241, 242, 243, - 244, 0, 0, 0, 0, 0, 72, 73, 0, 0, - 74, 0, 75 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 166, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 168, 168, 168, 168, 168, 168, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 172, 173, 173, 173, 173, + 173, 174, 174, 174, 175, 175, 176, 176, 177, 177, + 178, 178, 179, 179, 180, 181, 181, 181, 181, 181, + 182, 182, 182, 183, 183, 183, 183, 184, 184, 184, + 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, + 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 189, 189, 190, 190, 190, + 190, 190, 190, 191, 191, 192, 192, 193, 193, 194, + 194, 195, 196, 196, 197, 197, 198, 198, 199, 199, + 199, 199, 199, 199, 199, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 201, 202, + 202, 203, 203, 204, 204, 204, 204, 205, 205, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 207, + 207, 207, 207, 207, 207, 207, 207, 207, 207, 208, + 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, + 213, 215, 214, 216, 214, 214, 214, 214, 217, 214, + 218, 214, 219, 214, 214, 214, 214, 220, 221, 221, + 222, 223, 223, 223, 224, 224, 225, 225, 225, 225, + 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 234, 234, 234, 234, 235, 235, 236, 237, 237, + 238, 238, 239, 240, 240, 240, 240, 240, 241, 241, + 241, 241, 241, 241, 241, 241, 241, 242, 242, 243, + 244, 244, 245, 245, 245, 245, 245, 246, 246, 247, + 247, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 249, 249, 250, 250, 250, 250, + 250, 250, 250, 250, 250 }; -static const short yycheck[] = { 0, - 228, 26, 340, 236, 448, 263, 239, 240, 241, 242, - 243, 4, 0, 11, 247, 16, 164, 126, 21, 11, - 28, 21, 54, 54, 54, 34, 29, 154, 16, 436, - 437, 58, 278, 279, 280, 11, 11, 119, 52, 7, - 8, 38, 10, 11, 12, 13, 14, 15, 16, 17, - 75, 19, 20, 67, 22, 23, 24, 7, 8, 130, - 54, 34, 229, 154, 165, 68, 155, 149, 68, 19, - 20, 160, 22, 23, 24, 100, 54, 53, 53, 104, - 53, 49, 249, 154, 154, 110, 593, 155, 495, 155, - 91, 116, 155, 164, 162, 539, 54, 160, 164, 155, - 171, 126, 54, 610, 54, 39, 40, 54, 164, 553, - 554, 45, 11, 32, 33, 140, 141, 51, 17, 144, - 152, 152, 152, 356, 18, 150, 158, 54, 137, 138, - 139, 19, 162, 142, 22, 381, 24, 146, 147, 155, - 137, 138, 139, 155, 155, 142, 22, 485, 164, 146, - 147, 162, 164, 597, 598, 163, 600, 601, 152, 115, - 116, 164, 160, 264, 265, 53, 160, 54, 160, 402, - 163, 46, 154, 48, 152, 153, 620, 621, 516, 167, - 518, 20, 154, 416, 23, 418, 419, 420, 158, 157, - 158, 112, 113, 161, 152, 163, 164, 155, 156, 22, - 152, 226, 152, 155, 156, 152, 153, 81, 82, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 22, 35, 152, 37, 336, 566, 156, - 255, 119, 120, 22, 152, 317, 318, 319, 320, 321, - 498, 266, 324, 325, 326, 354, 42, 43, 44, 137, - 138, 47, 140, 141, 4, 143, 144, 145, 329, 37, - 4, 332, 333, 19, 335, 152, 22, 68, 24, 156, - 503, 342, 38, 53, 171, 3, 4, 5, 6, 350, - 351, 352, 137, 138, 139, 152, 159, 142, 521, 522, - 523, 146, 147, 441, 42, 159, 44, 42, 43, 44, - 45, 46, 47, 48, 153, 50, 155, 389, 390, 156, - 4, 336, 337, 338, 396, 61, 62, 63, 64, 65, - 66, 579, 149, 150, 151, 583, 38, 22, 153, 354, - 355, 356, 153, 155, 155, 406, 407, 408, 162, 119, - 120, 4, 152, 414, 3, 4, 5, 6, 576, 153, - 153, 155, 9, 9, 425, 426, 381, 137, 138, 9, - 140, 141, 387, 143, 144, 145, 594, 26, 27, 9, - 441, 7, 8, 455, 456, 457, 458, 402, 460, 461, - 9, 9, 60, 19, 20, 54, 22, 23, 24, 152, - 152, 416, 417, 418, 419, 420, 56, 152, 469, 424, - 471, 152, 11, 474, 149, 150, 151, 22, 162, 152, - 481, 482, 152, 438, 152, 152, 22, 153, 500, 501, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 152, 152, 329, 152, 38, 332, 333, 462, 335, 155, - 511, 512, 155, 514, 515, 342, 155, 155, 519, 155, - 155, 155, 4, 38, 351, 352, 155, 155, 155, 530, - 38, 486, 544, 155, 546, 547, 155, 155, 155, 155, - 155, 155, 497, 155, 155, 158, 155, 22, 503, 155, - 155, 155, 162, 153, 155, 17, 17, 152, 513, 155, - 561, 155, 22, 4, 155, 496, 521, 522, 523, 4, - 155, 155, 527, 0, 155, 4, 577, 578, 155, 406, - 407, 408, 155, 152, 26, 27, 162, 414, 155, 153, - 591, 18, 19, 20, 155, 22, 23, 24, 425, 426, - 155, 153, 153, 30, 31, 155, 53, 153, 155, 153, - 158, 160, 153, 614, 615, 53, 153, 17, 619, 4, - 153, 622, 160, 148, 51, 580, 152, 628, 55, 152, - 631, 22, 59, 155, 17, 17, 567, 155, 17, 73, - 17, 0, 469, 0, 471, 131, 131, 474, 131, 232, - 567, 233, 91, 540, 481, 482, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 110, 104, 16, 87, 266, 527, 255, 413, 54, -1, - -1, -1, -1, -1, 511, 512, -1, 514, 515, -1, - -1, -1, 519, 3, 4, -1, -1, 7, 8, 9, - -1, -1, 0, 530, -1, -1, -1, -1, -1, 19, - 20, -1, 22, 23, 24, 25, 26, 27, -1, -1, - 18, 19, 20, -1, 22, 23, 24, -1, -1, -1, - 40, 41, 30, 31, 561, -1, -1, -1, -1, -1, - -1, -1, -1, 53, -1, -1, -1, -1, 58, -1, - 577, 578, -1, 51, -1, -1, -1, 55, -1, -1, - -1, 59, -1, -1, 591, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, -1, -1, -1, -1, -1, 614, 615, -1, - -1, -1, 619, -1, -1, 622, -1, -1, -1, -1, - -1, 628, -1, -1, 631, -1, -1, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - -1, 131, -1, 133, 134, 135, -1, 137, 138, -1, - 140, 141, -1, 143, 144, 145, 3, 4, -1, -1, - 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, - -1, 161, 19, 20, -1, 22, 23, 24, 25, 26, - 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 54, -1, 7, - 8, 58, 10, 11, 12, 13, 14, 15, 16, 17, - -1, 19, 20, -1, 22, 23, 24, -1, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, -1, -1, -1, -1, 7, - 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, - -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, -1, 131, -1, 133, 134, 135, -1, - -1, 49, -1, -1, -1, -1, 3, 4, -1, -1, - 7, 8, 9, -1, -1, 152, -1, -1, -1, -1, - -1, -1, 19, 20, 161, 22, 23, 24, 25, 26, - 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 58, -1, -1, -1, -1, -1, -1, -1, 157, - 158, -1, -1, 161, -1, 163, 164, -1, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, - 158, -1, -1, 161, -1, 163, 164, -1, -1, -1, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, -1, 131, -1, 133, 134, 135, 7, - 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, -1, 22, 23, 24, 25, -1, -1, - -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, - -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 7, 8, 54, 10, 11, 12, - 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, - 23, 24, -1, -1, -1, -1, -1, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, -1, -1, 49, -1, -1, -1, - 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, -1, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 39, 131, -1, 133, 134, 135, -1, -1, - -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 152, -1, 7, 8, 156, -1, - 158, -1, -1, 161, -1, 163, -1, 165, 19, 20, - -1, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, - 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 54, 157, 158, -1, -1, 161, -1, - 163, 164, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 157, 158, -1, -1, 161, -1, 163, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, -1, - 131, -1, 133, 134, 135, -1, -1, -1, -1, -1, - -1, -1, -1, 3, 4, -1, -1, -1, -1, 9, - -1, 152, -1, -1, -1, -1, -1, 158, -1, -1, - 161, -1, 163, -1, 165, 25, 26, 27, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 7, 8, 58, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, -1, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - -1, 131, -1, 133, 134, 135, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, 161, -1, -1, -1, -1, -1, -1, 39, -1, - -1, -1, 123, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, 39, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, 39, 160, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, -1, -1, 49, -1, - 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 56, 57, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163, -1, -1, -1, 112, 113, 114, -1, - -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, -1, -1, -1, -1, -1, 157, 158, -1, -1, - 161, -1, 163 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 4, 0, 2, 0, + 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, + 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 0, 2, 1, 1, 1, + 1, 1, 1, 0, 2, 0, 2, 0, 2, 0, + 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, + 5, 5, 5, 5, 3, 2, 5, 4, 2, 1, + 1, 1, 3, 1, 3, 1, 0, 1, 3, 4, + 3, 3, 4, 4, 3, 6, 5, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, + 5, 8, 6, 6, 7, 7, 6, 8, 8, 3, + 1, 1, 1, 1, 0, 2, 6, 1, 0, 1, + 2, 0, 3, 0, 3, 3, 3, 3, 0, 8, + 0, 9, 0, 9, 5, 2, 3, 1, 3, 3, + 3, 3, 1, 0, 5, 3, 1, 3, 1, 0, + 10, 1, 1, 4, 1, 1, 2, 3, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 5, 1, 1, 1, 1, 1, 1, 2, 1, 3, + 2, 2, 3, 2, 0, 3, 1, 4, 2, 2, + 3, 9, 9, 8, 14, 1, 1, 6, 5, 2, + 6, 7, 4, 4, 6, 6, 0, 0, 3, 2, + 1, 5, 5, 6, 6, 4, 6, 4, 4, 6, + 6, 2, 8, 1, 1, 0, 3, 6, 3, 6, + 2, 5, 7, 5, 4 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" -/* This file comes from bison-1.28. */ -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 73, 61, 70, 62, 71, 63, 213, 211, 0, 0, + 0, 0, 0, 0, 83, 72, 0, 73, 209, 87, + 90, 0, 0, 225, 0, 0, 68, 0, 74, 75, + 77, 76, 78, 80, 79, 81, 82, 84, 85, 86, + 83, 83, 204, 1, 210, 88, 89, 83, 214, 91, + 92, 93, 94, 83, 274, 212, 274, 0, 0, 233, + 226, 227, 215, 261, 262, 217, 138, 139, 140, 143, + 142, 141, 144, 145, 0, 0, 0, 0, 263, 264, + 146, 216, 148, 204, 204, 95, 203, 0, 98, 98, + 276, 0, 271, 69, 244, 245, 246, 270, 228, 229, + 232, 0, 166, 149, 0, 0, 0, 0, 155, 167, + 0, 0, 166, 0, 0, 0, 97, 96, 0, 201, + 202, 0, 0, 99, 100, 101, 102, 103, 0, 247, + 0, 0, 0, 315, 273, 0, 230, 165, 115, 161, + 163, 0, 0, 0, 0, 0, 0, 154, 0, 0, + 147, 0, 0, 160, 0, 159, 0, 224, 138, 139, + 140, 143, 142, 141, 0, 0, 67, 67, 104, 0, + 241, 242, 243, 0, 250, 251, 252, 257, 253, 254, + 255, 256, 248, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 14, 15, 16, 11, 12, 13, 0, 0, + 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, + 0, 259, 266, 265, 275, 314, 300, 0, 0, 0, + 0, 98, 285, 286, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 272, 98, 289, 0, 313, 231, 158, 0, 123, 67, + 67, 157, 0, 168, 0, 123, 67, 67, 0, 205, + 186, 187, 182, 184, 183, 185, 188, 181, 177, 178, + 0, 0, 0, 0, 180, 179, 218, 0, 277, 249, + 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 0, 53, 54, 49, 50, 51, 52, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, + 0, 0, 0, 0, 200, 0, 0, 0, 0, 299, + 279, 67, 268, 278, 0, 0, 55, 0, 0, 0, + 0, 129, 129, 320, 67, 67, 311, 0, 0, 0, + 0, 0, 67, 67, 67, 0, 0, 0, 0, 0, + 106, 108, 107, 105, 109, 110, 111, 112, 113, 116, + 164, 162, 151, 152, 153, 156, 66, 150, 220, 222, + 0, 170, 0, 0, 0, 174, 0, 171, 134, 239, + 0, 0, 0, 297, 0, 0, 0, 0, 0, 258, + 0, 0, 0, 267, 0, 0, 280, 0, 0, 67, + 67, 0, 316, 0, 318, 297, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, + 114, 120, 119, 117, 118, 121, 122, 124, 134, 134, + 0, 169, 155, 167, 0, 172, 173, 0, 219, 238, + 115, 236, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 199, 0, 0, 0, 269, 0, 0, 0, 0, + 0, 0, 0, 0, 324, 0, 0, 0, 307, 308, + 0, 0, 0, 0, 0, 305, 0, 129, 0, 221, + 223, 67, 176, 0, 0, 0, 136, 134, 65, 0, + 123, 260, 0, 0, 190, 0, 0, 0, 0, 0, + 0, 0, 67, 0, 0, 296, 0, 0, 129, 130, + 129, 0, 0, 0, 0, 0, 323, 301, 302, 296, + 0, 321, 67, 206, 175, 131, 137, 135, 64, 235, + 237, 115, 132, 0, 0, 298, 0, 196, 0, 0, + 192, 193, 189, 0, 0, 115, 115, 0, 303, 304, + 317, 319, 0, 0, 306, 309, 310, 0, 129, 65, + 133, 127, 194, 195, 0, 0, 0, 0, 0, 0, + 0, 123, 0, 290, 0, 123, 322, 234, 0, 125, + 191, 197, 198, 0, 283, 0, 0, 106, 108, 115, + 115, 0, 115, 115, 291, 312, 128, 0, 240, 281, + 0, 282, 0, 293, 292, 0, 0, 0, 126, 0, + 0, 0, 115, 115, 0, 0, 0, 295, 294, 288, + 0, 0, 287, 0, 284 +}; - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 218, 219, 220, 301, 318, 164, 165, 78, 539, + 113, 12, 79, 14, 15, 40, 41, 42, 47, 53, + 118, 128, 369, 256, 437, 372, 608, 589, 412, 496, + 571, 448, 497, 80, 166, 139, 156, 140, 141, 110, + 324, 221, 325, 121, 87, 157, 16, 17, 18, 20, + 19, 388, 438, 439, 62, 23, 60, 101, 451, 452, + 129, 172, 54, 96, 55, 48, 290, 222, 82, 224, + 332, 333, 56, 92, 93, 250, 596, 134, 346, 557, + 456, 251, 252, 253, 254 +}; - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -524 +static const yytype_int16 yypact[] = +{ + 369, -524, -524, -524, -524, -524, -524, -524, 46, -130, + 11, -89, 62, -59, 258, -524, 135, 506, -524, 227, + 130, -12, 26, -524, -1, 180, -524, 1572, -524, -524, + -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, + 119, 119, 250, -524, -524, -524, -524, 119, -524, -524, + -524, -524, -524, 119, 39, -524, -2, 214, 221, 229, + -524, -524, -524, -524, -524, 59, -524, -524, -524, -524, + -524, -524, -524, -524, 262, 268, 8, 35, -524, -524, + -524, 9, -524, 195, 195, 244, -524, 162, 233, 233, + 186, 238, -524, 127, -524, -524, -524, -524, -524, -524, + -524, 50, 1126, -524, 133, 161, 815, 59, -524, 9, + -88, 172, 1126, 181, 162, 162, -524, -524, 1372, -524, + -524, 1612, 337, -524, -524, -524, -524, -524, 1652, -524, + -3, 314, 906, 1867, -524, 334, -524, -524, 9, -524, + 205, 208, 1692, 1692, 200, -64, 1692, -524, 359, 211, + -524, 1612, 1692, 59, 216, 9, 410, -524, 223, 357, + 361, 362, 363, 365, 275, 366, 1182, 329, -524, 97, + -524, -524, -524, 906, -524, -524, -524, -524, -524, -524, + -524, -524, 324, -524, -524, -524, -524, -524, -524, -524, + -524, -524, -524, -524, -524, -524, -524, -524, 511, 491, + 234, -524, -524, -524, -524, -524, -524, -524, -524, -524, + -524, -524, -524, 252, 253, 259, 260, 1612, 263, 267, + 271, -524, -524, -524, -524, -524, -524, 354, 1732, 68, + 374, 233, -524, -524, 511, 491, 1692, 1692, 1692, 1692, + 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + -524, 233, -524, 197, -524, -524, 210, 1452, -524, -31, + 2, -524, 264, 9, 237, -524, 329, -25, 1372, -524, + -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, + 1412, 1772, 855, 403, -524, -524, -524, 279, -524, -524, + 405, -524, -524, -524, -524, -524, -524, -524, -524, -524, + -524, 284, -524, -524, -524, -524, -524, -524, -524, -524, + -524, -524, -524, -524, -524, -524, -524, -524, 285, 1612, + 1612, 1612, 1612, 1612, -524, -46, 1612, 1612, 1612, -524, + 59, 766, -524, 287, 906, 906, -524, 906, 1652, 1692, + 1692, 45, 51, -524, 766, 17, 290, 294, 295, 297, + 298, 299, 14, 766, 766, 417, 1652, 1692, 1692, 452, + -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, + -524, -524, 189, -524, -524, -524, -524, 189, -524, 181, + 421, -524, 102, 1080, -32, -524, -49, -524, 305, 1492, + 306, 1612, 1612, -524, 308, 311, 315, 316, 1612, -524, + 317, 318, 431, -524, 1692, 319, -524, 321, 906, 766, + 766, 24, -524, 28, -524, -524, 906, 320, 1692, 1692, + 1692, 1692, 1692, 322, 325, 327, 1692, 906, 766, 328, + -524, -524, -524, -524, -524, -524, -524, -524, 305, 305, + 1692, -524, 323, 1035, -17, -524, -524, 30, -524, -524, + 9, 331, 326, 462, 332, 333, 154, 1612, 1612, 1612, + 1612, -524, 1612, 1612, 1692, -524, 472, 473, 340, 339, + 341, 906, 493, 906, 347, 348, 906, 349, 9, -524, + 352, 353, 507, 906, 906, 9, 343, 360, 1692, -524, + -524, 38, -524, 371, 494, 515, -524, 305, 115, 1532, + -524, -524, 1612, 1612, -524, 1692, 367, 368, 372, 379, + 382, 385, 56, 906, 906, 1812, 906, 906, 360, -524, + 360, 906, 384, 1692, 1692, 1692, -524, -524, -524, 1812, + 487, -524, 766, -524, -524, -524, -524, -524, -524, -524, + -524, 9, -6, 388, 389, -524, 1612, -524, 1612, 1612, + -524, -524, -524, 390, 386, 33, 9, 166, -524, -524, + -524, -524, 383, 906, -524, -524, -524, 170, 360, 115, + -524, 495, -524, -524, 396, 397, 399, 536, 3, 623, + 623, -524, 1852, -524, 395, -524, -524, -524, 552, 411, + -524, -524, -524, 906, -524, 1323, 7, 412, 414, -524, + -524, 6, 33, 9, -524, 189, -524, 540, -524, -524, + 413, -524, 1323, 210, 210, 550, 623, 623, -524, 553, + 416, 906, -524, -524, 906, 555, 500, 210, 210, -524, + 906, 557, -524, 906, -524 +}; - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -524, 443, 445, 446, 350, 346, -229, -524, 0, 16, + -141, 489, 13, -524, -524, -524, -524, 61, -524, -524, + -524, -190, -524, -444, -524, -263, -524, -524, -337, 41, + -524, -407, -524, -524, -24, 356, -108, -524, 474, 508, + -81, -150, -207, 228, 261, 351, -524, -524, 598, -524, + -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, + 527, -524, -524, -524, -524, -524, -524, -523, -70, 104, + -234, -524, -524, 566, -524, -524, -524, -524, -524, 94, + 209, -524, -524, -524, -524 +}; -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible at ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -209 +static const yytype_int16 yytable[] = +{ + 11, 337, 377, 81, 343, 414, 498, 347, 348, 349, + 350, 351, 105, 13, 336, 355, 284, 11, 336, 90, + 169, 63, 64, 111, 24, 170, 286, 94, 494, 111, + 13, 489, 490, 1, 2, 471, 3, 4, 5, 473, + 167, 338, 63, 64, 615, 107, 66, 67, 68, 69, + 70, 71, 72, 109, 1, 2, 111, 3, 4, 5, + 90, 356, 223, 111, 494, 26, 91, 146, 111, 25, + 266, 111, 610, 382, 384, 386, 147, 472, 138, 334, + 27, 472, 109, 495, 73, 335, 269, -144, 138, 620, + 537, 146, 111, 11, 155, 28, 285, 569, 21, 111, + 262, 83, 84, 223, 155, 111, 398, 91, 88, 398, + 111, 579, 580, 22, 89, 446, 399, 2, 259, 260, + 4, 112, 263, 398, 429, 378, 379, 112, 267, 373, + 445, 431, 432, 433, 1, 43, 434, 3, 398, 5, + 435, 436, 57, 431, 432, 433, 1, 493, 434, 3, + 531, 5, 435, 436, 112, 613, 614, 59, 616, 617, + 171, 112, 95, 594, 374, -67, 112, 611, 359, 112, + 465, 106, 49, 50, 51, 416, 444, 52, 627, 628, + 58, 560, 287, 561, 477, -144, 479, 480, 481, -144, + 112, 533, 74, 75, 119, 120, 76, 112, 77, 108, + 411, -67, 61, 112, 331, 135, 413, -67, 112, 552, + 136, 102, 341, 342, 331, 344, 345, 331, 331, 331, + 331, 331, 352, 353, 354, 331, -55, -55, -55, -55, + 408, 586, 86, 138, 360, 361, 98, 542, 393, 394, + 395, 396, 397, 99, 155, 400, 401, 402, 427, 270, + 271, 100, 362, 363, 131, 364, 365, 398, 366, 367, + 368, 223, 441, 359, 223, 223, 103, 223, 37, 38, + 39, 545, 104, 45, 223, 46, 132, 288, 272, 273, + 274, 275, 423, 223, 223, 85, 116, 86, 117, 564, + 565, 566, 142, 284, 122, 123, 124, 125, 126, 127, + 29, 30, 31, 32, 33, 34, 35, 504, 36, 505, + 454, 455, 357, 358, 155, 409, 410, 461, 601, 581, + 143, 582, 605, 585, 148, 582, 431, 432, 433, 360, + 361, 434, 155, 428, 331, 435, 436, 150, 223, 223, + 223, 168, 151, 152, 114, 115, 223, 362, 363, 595, + 364, 365, 173, 366, 367, 368, 255, 223, 223, 443, + 257, 258, 261, 264, 265, 450, -56, 612, 268, -208, + -57, -60, -59, 285, -58, 276, 506, 507, 508, 509, + 331, 510, 511, 111, 289, 336, 319, -69, 1, 2, + 376, 3, 4, 5, 331, 478, 331, 331, 331, 6, + 7, 223, 485, 223, 320, 321, 223, 37, 38, 39, + 329, 322, 323, 223, 223, 326, 491, 63, 64, 327, + 8, 543, 544, 328, 9, 387, 375, 390, 10, 1, + 2, 389, 3, 4, 5, 403, 391, 392, 405, 406, + 512, 407, 404, 223, 223, 417, 223, 223, 415, 418, + 419, 223, 420, 421, 422, 426, 430, 424, 425, 440, + 447, 453, 223, 457, 532, 574, 458, 575, 576, 464, + 459, 460, 462, 463, 466, 541, 467, 482, 476, 500, + 483, 331, 484, 488, 501, 492, 499, 502, 503, 513, + 514, 556, 515, 223, 516, 529, 517, 519, 538, 331, + 331, 331, 505, 521, 523, 556, -207, 524, 525, 223, + 223, 526, 468, 469, 470, 530, 535, 302, 303, 536, + 475, 547, 546, 223, -69, 1, 2, 548, 3, 4, + 5, 486, 487, 534, 549, 550, 6, 7, 551, 563, + 472, 572, 573, 583, 578, 577, 223, 223, 588, 590, + 591, 223, 592, 593, 223, 604, 606, 8, 603, 607, + 223, 9, 618, 223, -18, 10, -19, 621, 619, 538, + 624, 625, 630, 631, 633, 518, 247, 520, 248, 249, + 522, 340, 133, 570, 339, 587, 149, 527, 528, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 371, 145, 44, 130, 553, 554, 380, + 558, 559, 97, 567, 474, 562, 174, 175, 0, 0, + 63, 64, 176, 0, 0, 0, 568, 0, 0, 0, + 0, 0, 1, 2, 0, 3, 4, 5, 177, 178, + 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 180, 181, 0, 0, 584, 0, 0, + 0, 0, 0, 0, 0, 0, 359, 0, 0, 0, + 0, 182, 0, 599, 600, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 609, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 0, 0, 0, 0, 0, + 622, 623, 0, 0, 0, 626, 0, 0, 629, 0, + 0, 0, 0, 0, 632, 0, 0, 634, 0, 0, + 200, 201, 597, 598, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 0, 213, 0, 214, 215, 216, 0, + 362, 363, 0, 364, 365, 0, 366, 367, 368, 174, + 175, 0, 0, 63, 64, 176, 0, 0, 0, 0, + 0, 0, 0, 0, 217, 1, 2, 0, 3, 4, + 5, 177, 178, 179, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 180, 181, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 111, 0, 63, 64, 182, 107, 66, 67, 68, 69, + 70, 71, 72, 0, 1, 2, 0, 3, 4, 5, + 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 0, 0, + 0, 0, 63, 64, 73, 107, 158, 159, 160, 161, + 162, 163, 72, 0, 1, 2, 0, 3, 4, 5, + 0, 0, 0, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 0, 213, 0, 214, + 215, 216, 0, 0, 73, 0, 0, 0, 0, 174, + 175, 0, 0, 63, 64, 176, 0, 0, 112, 0, + 0, 0, 0, 0, 0, 1, 2, 217, 3, 4, + 5, 177, 178, 179, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 180, 181, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 182, 0, 0, 0, 0, 0, + 0, 0, 74, 75, 0, 0, 76, 0, 77, 144, + 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 74, 75, 0, 0, 76, 0, 77, 385, + 0, 0, 0, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 0, 213, 0, 214, + 215, 216, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 2, 0, 3, 4, 5, + 277, 0, 0, 0, 0, 0, 0, 217, 0, 0, + 0, 0, 0, 0, 0, 278, 279, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 63, 64, 111, + 107, 158, 159, 160, 161, 162, 163, 72, 0, 1, + 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 0, 0, 73, + 0, 0, 0, 63, 64, 0, 107, 66, 67, 68, + 69, 70, 71, 72, 0, 1, 2, 0, 3, 4, + 5, 0, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 137, 213, 0, 214, 215, + 216, 0, 0, 0, 0, 73, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 112, 0, 63, + 64, -67, 0, 280, 0, 0, 281, 0, 282, 0, + 283, 1, 2, 0, 3, 4, 5, 277, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 278, 279, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 111, 74, 75, 0, + 0, 76, 0, 77, 442, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 75, 0, 0, 76, 0, 77, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 0, 213, 0, 214, 215, 216, 0, 0, + 0, 0, 0, 0, 0, 0, 174, 175, 0, 0, + 0, 0, 176, 0, 112, 0, 0, 0, 0, 0, + 280, 0, 0, 281, 0, 282, 0, 283, 177, 178, + 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 180, 181, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, + 64, 182, 153, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 0, 0, 0, 0, 63, + 64, 73, 107, 158, 159, 160, 161, 162, 163, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 0, 213, 0, 214, 215, 216, 63, + 64, 73, 107, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 217, 0, 0, 0, 0, 0, + 0, 370, 0, 0, 0, 154, 0, 0, 0, 63, + 64, 73, 107, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 449, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 107, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 540, 381, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 65, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 107, 158, 159, 160, 161, 162, 163, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 153, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 107, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 330, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 107, 158, 159, 160, 161, 162, 163, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 107, 66, 67, 68, 69, 70, 71, 555, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 63, + 64, 73, 107, 66, 67, 68, 69, 70, 71, 602, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 0, + 0, 73, 0, 225, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 226, 227, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 383, 228, 229, 230, 231, + 232, 233, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 234, 235, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77, 0, 0, 0, 236, + 237, 238, 0, 0, 239, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 240, 241, 242, + 243, 244, 245, 246, 0, 0, 0, 0, 0, 74, + 75, 0, 0, 76, 0, 77 +}; -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif +static const yytype_int16 yycheck[] = +{ + 0, 230, 265, 27, 238, 342, 450, 241, 242, 243, + 244, 245, 4, 0, 11, 249, 166, 17, 11, 21, + 128, 7, 8, 54, 154, 28, 167, 29, 34, 54, + 17, 438, 439, 19, 20, 11, 22, 23, 24, 11, + 121, 231, 7, 8, 38, 10, 11, 12, 13, 14, + 15, 16, 17, 77, 19, 20, 54, 22, 23, 24, + 21, 251, 132, 54, 34, 154, 68, 155, 54, 58, + 151, 54, 595, 280, 281, 282, 164, 53, 102, 11, + 18, 53, 106, 53, 49, 17, 156, 54, 112, 612, + 497, 155, 54, 93, 118, 154, 166, 541, 52, 54, + 164, 40, 41, 173, 128, 54, 155, 68, 47, 155, + 54, 555, 556, 67, 53, 164, 162, 20, 142, 143, + 23, 152, 146, 155, 358, 266, 267, 152, 152, 160, + 162, 137, 138, 139, 19, 0, 142, 22, 155, 24, + 146, 147, 154, 137, 138, 139, 19, 164, 142, 22, + 487, 24, 146, 147, 152, 599, 600, 158, 602, 603, + 163, 152, 164, 160, 162, 156, 152, 160, 53, 152, + 404, 163, 42, 43, 44, 158, 383, 47, 622, 623, + 154, 518, 169, 520, 418, 152, 420, 421, 422, 156, + 152, 153, 157, 158, 32, 33, 161, 152, 163, 164, + 155, 156, 22, 152, 228, 155, 155, 156, 152, 153, + 160, 152, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 3, 4, 5, 6, + 338, 568, 37, 257, 119, 120, 22, 500, 319, 320, + 321, 322, 323, 22, 268, 326, 327, 328, 356, 26, + 27, 22, 137, 138, 68, 140, 141, 155, 143, 144, + 145, 331, 160, 53, 334, 335, 4, 337, 149, 150, + 151, 505, 4, 46, 344, 48, 38, 173, 3, 4, + 5, 6, 352, 353, 354, 35, 42, 37, 44, 523, + 524, 525, 159, 443, 61, 62, 63, 64, 65, 66, + 42, 43, 44, 45, 46, 47, 48, 153, 50, 155, + 391, 392, 115, 116, 338, 339, 340, 398, 581, 153, + 159, 155, 585, 153, 152, 155, 137, 138, 139, 119, + 120, 142, 356, 357, 358, 146, 147, 156, 408, 409, + 410, 4, 114, 115, 83, 84, 416, 137, 138, 578, + 140, 141, 38, 143, 144, 145, 22, 427, 428, 383, + 155, 153, 162, 4, 153, 389, 9, 596, 152, 0, + 9, 9, 9, 443, 9, 9, 457, 458, 459, 460, + 404, 462, 463, 54, 60, 11, 152, 18, 19, 20, + 153, 22, 23, 24, 418, 419, 420, 421, 422, 30, + 31, 471, 426, 473, 152, 152, 476, 149, 150, 151, + 56, 152, 152, 483, 484, 152, 440, 7, 8, 152, + 51, 502, 503, 152, 55, 22, 162, 22, 59, 19, + 20, 152, 22, 23, 24, 331, 152, 152, 334, 335, + 464, 337, 155, 513, 514, 155, 516, 517, 344, 155, + 155, 521, 155, 155, 155, 38, 4, 353, 354, 38, + 155, 155, 532, 155, 488, 546, 155, 548, 549, 38, + 155, 155, 155, 155, 155, 499, 155, 155, 158, 153, + 155, 505, 155, 155, 22, 162, 155, 155, 155, 17, + 17, 515, 152, 563, 155, 152, 155, 4, 498, 523, + 524, 525, 155, 155, 155, 529, 0, 155, 155, 579, + 580, 4, 408, 409, 410, 155, 22, 26, 27, 4, + 416, 153, 155, 593, 18, 19, 20, 155, 22, 23, + 24, 427, 428, 162, 155, 153, 30, 31, 153, 155, + 53, 153, 153, 160, 158, 155, 616, 617, 53, 153, + 153, 621, 153, 17, 624, 160, 4, 51, 582, 148, + 630, 55, 22, 633, 152, 59, 152, 17, 155, 569, + 17, 155, 17, 73, 17, 471, 133, 473, 133, 133, + 476, 235, 93, 542, 234, 569, 112, 483, 484, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 257, 106, 17, 89, 513, 514, 268, + 516, 517, 56, 529, 415, 521, 3, 4, -1, -1, + 7, 8, 9, -1, -1, -1, 532, -1, -1, -1, + -1, -1, 19, 20, -1, 22, 23, 24, 25, 26, + 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 40, 41, -1, -1, 563, -1, -1, + -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, + -1, 58, -1, 579, 580, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 593, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, -1, -1, -1, -1, -1, + 616, 617, -1, -1, -1, 621, -1, -1, 624, -1, + -1, -1, -1, -1, 630, -1, -1, 633, -1, -1, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, -1, 131, -1, 133, 134, 135, -1, + 137, 138, -1, 140, 141, -1, 143, 144, 145, 3, + 4, -1, -1, 7, 8, 9, -1, -1, -1, -1, + -1, -1, -1, -1, 161, 19, 20, -1, 22, 23, + 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 54, -1, 7, 8, 58, 10, 11, 12, 13, 14, + 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, + -1, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, -1, -1, + -1, -1, 7, 8, 49, 10, 11, 12, 13, 14, + 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, + -1, -1, -1, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, -1, 131, -1, 133, + 134, 135, -1, -1, 49, -1, -1, -1, -1, 3, + 4, -1, -1, 7, 8, 9, -1, -1, 152, -1, + -1, -1, -1, -1, -1, 19, 20, 161, 22, 23, + 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, + -1, -1, 157, 158, -1, -1, 161, -1, 163, 164, + -1, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 157, 158, -1, -1, 161, -1, 163, 164, + -1, -1, -1, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, -1, 131, -1, 133, + 134, 135, 7, 8, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 19, 20, -1, 22, 23, 24, + 25, -1, -1, -1, -1, -1, -1, 161, -1, -1, + -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 7, 8, 54, + 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, + 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, -1, -1, 49, + -1, -1, -1, 7, 8, -1, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, -1, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 39, 131, -1, 133, 134, + 135, -1, -1, -1, -1, 49, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 152, -1, 7, + 8, 156, -1, 158, -1, -1, 161, -1, 163, -1, + 165, 19, 20, -1, 22, 23, 24, 25, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 54, 157, 158, -1, + -1, 161, -1, 163, 164, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 157, 158, -1, -1, 161, -1, 163, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, -1, 131, -1, 133, 134, 135, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, -1, -1, + -1, -1, 9, -1, 152, -1, -1, -1, -1, -1, + 158, -1, -1, 161, -1, 163, -1, 165, 25, 26, + 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, + 8, 58, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, -1, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, -1, 131, -1, 133, 134, 135, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, + -1, 39, -1, -1, -1, 123, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, 39, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, 39, 160, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, -1, + -1, 49, -1, 36, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 56, 57, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163, -1, -1, -1, 112, + 113, 114, -1, -1, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, -1, -1, -1, -1, -1, 157, + 158, -1, -1, 161, -1, 163 +}; -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 19, 20, 22, 23, 24, 30, 31, 51, 55, + 59, 174, 177, 178, 179, 180, 212, 213, 214, 216, + 215, 52, 67, 221, 154, 58, 154, 18, 154, 42, + 43, 44, 45, 46, 47, 48, 50, 149, 150, 151, + 181, 182, 183, 0, 214, 46, 48, 184, 231, 42, + 43, 44, 47, 185, 228, 230, 238, 154, 154, 158, + 222, 22, 220, 7, 8, 10, 11, 12, 13, 14, + 15, 16, 17, 49, 157, 158, 161, 163, 174, 178, + 199, 200, 234, 183, 183, 35, 37, 210, 183, 183, + 21, 68, 239, 240, 29, 164, 229, 239, 22, 22, + 22, 223, 152, 4, 4, 4, 163, 10, 164, 200, + 205, 54, 152, 176, 210, 210, 42, 44, 186, 32, + 33, 209, 61, 62, 63, 64, 65, 66, 187, 226, + 226, 68, 38, 177, 243, 155, 160, 39, 200, 201, + 203, 204, 159, 159, 164, 205, 155, 164, 152, 204, + 156, 209, 209, 10, 123, 200, 202, 211, 11, 12, + 13, 14, 15, 16, 172, 173, 200, 206, 4, 202, + 28, 163, 227, 38, 3, 4, 9, 25, 26, 27, + 40, 41, 58, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 131, 133, 134, 135, 161, 167, 168, + 169, 207, 233, 234, 235, 36, 56, 57, 69, 70, + 71, 72, 73, 74, 90, 91, 112, 113, 114, 117, + 130, 131, 132, 133, 134, 135, 136, 167, 168, 169, + 241, 247, 248, 249, 250, 22, 189, 155, 153, 200, + 200, 162, 164, 200, 4, 153, 206, 200, 152, 234, + 26, 27, 3, 4, 5, 6, 9, 25, 40, 41, + 158, 161, 163, 165, 207, 234, 176, 178, 235, 60, + 232, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 170, 26, 27, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 171, 152, + 152, 152, 152, 152, 206, 208, 152, 152, 152, 56, + 10, 200, 236, 237, 11, 17, 11, 172, 187, 170, + 171, 200, 200, 236, 200, 200, 244, 236, 236, 236, + 236, 236, 200, 200, 200, 236, 187, 115, 116, 53, + 119, 120, 137, 138, 140, 141, 143, 144, 145, 188, + 39, 201, 191, 160, 162, 162, 153, 191, 176, 176, + 211, 160, 208, 163, 208, 164, 208, 22, 217, 152, + 22, 152, 152, 206, 206, 206, 206, 206, 155, 162, + 206, 206, 206, 235, 155, 235, 235, 235, 202, 200, + 200, 155, 194, 155, 194, 235, 158, 155, 155, 155, + 155, 155, 155, 234, 235, 235, 38, 202, 200, 236, + 4, 137, 138, 139, 142, 146, 147, 190, 218, 219, + 38, 160, 164, 200, 208, 162, 164, 155, 197, 39, + 200, 224, 225, 155, 206, 206, 246, 155, 155, 155, + 155, 206, 155, 155, 38, 236, 155, 155, 235, 235, + 235, 11, 53, 11, 246, 235, 158, 236, 200, 236, + 236, 236, 155, 155, 155, 200, 235, 235, 155, 197, + 197, 200, 162, 164, 34, 53, 195, 198, 189, 155, + 153, 22, 155, 155, 153, 155, 206, 206, 206, 206, + 206, 206, 200, 17, 17, 152, 155, 155, 235, 4, + 235, 155, 235, 155, 155, 155, 4, 235, 235, 152, + 155, 194, 200, 153, 162, 22, 4, 197, 174, 175, + 39, 200, 191, 206, 206, 236, 155, 153, 155, 155, + 153, 153, 153, 235, 235, 17, 200, 245, 235, 235, + 194, 194, 235, 155, 236, 236, 236, 245, 235, 189, + 195, 196, 153, 153, 206, 206, 206, 155, 158, 189, + 189, 153, 155, 160, 235, 153, 194, 175, 53, 193, + 153, 153, 153, 17, 160, 172, 242, 119, 120, 235, + 235, 191, 17, 200, 160, 191, 4, 148, 192, 235, + 233, 160, 172, 189, 189, 38, 189, 189, 22, 155, + 233, 17, 235, 235, 17, 155, 235, 189, 189, 235, + 17, 73, 235, 17, 235 +}; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 + #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif -#else /* not YYLSP_NEEDED */ + + +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +# define YYLEX yylex (YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +# define YYLEX yylex () #endif -#endif /* not YYLSP_NEEDED */ + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; #endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ -/* If nonreentrant, generate the variables here */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); -#ifndef YYPURE + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; #endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } +} -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + +/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif { - register char *f = from; - register char *t = to; - register int i = count; + char *yyd = yydest; + const char *yys = yysrc; - while (i-- > 0) - *t++ = *f++; + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; } +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; -#else /* __cplusplus */ + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - register char *t = to; - register char *f = from; - register int i = count; + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; - while (i-- > 0) - *t++ = *f++; + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } } +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; #endif -#endif - -#line 217 "/usr/share/bison.simple" +{ + YYUSE (yyvaluep); -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ #ifdef YYPARSE_PARAM -int yyparse (void *); +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); #else -int yyparse (void); +int yyparse (); #endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); #endif +#endif /* ! YYPARSE_PARAM */ -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) + +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) #else -#define YYPOPSTACK (yyvsp--, yyssp--) +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; #endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; #endif #endif +{ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. - int yylen; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -2375,732 +3301,779 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: + goto yysetstate; - *++yyssp = yystate; +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif + yysetstate: + *yyssp = yystate; + if (yyss + yystacksize - 1 <= yyssp) + { /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ +/*-----------. +| yybackup. | +`-----------*/ +yybackup: - /* First try to decide what to do without reference to lookahead token. */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* Not known => get a look-ahead token if don't already have one. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the token being shifted unless it is eof. */ + /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; + yystate = yyn; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; goto yynewstate; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; -/* Do a reduction. yyn is the number of a rule to reduce with. */ + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (yydebug) + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) { - int i; + case 29: +#line 1118 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} + break; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 28: -#line 1118 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_EQ; ; - break;} -case 29: -#line 1118 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_NE; ; - break;} -case 30: -#line 1119 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_SLT; ; - break;} -case 31: -#line 1119 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_SGT; ; - break;} -case 32: -#line 1120 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_SLE; ; - break;} -case 33: -#line 1120 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_SGE; ; - break;} -case 34: -#line 1121 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_ULT; ; - break;} -case 35: -#line 1121 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_UGT; ; - break;} -case 36: -#line 1122 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_ULE; ; - break;} -case 37: -#line 1122 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.IPredicate = ICmpInst::ICMP_UGE; ; - break;} -case 38: -#line 1126 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_OEQ; ; - break;} -case 39: -#line 1126 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_ONE; ; - break;} -case 40: -#line 1127 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_OLT; ; - break;} -case 41: -#line 1127 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_OGT; ; - break;} -case 42: -#line 1128 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_OLE; ; - break;} -case 43: -#line 1128 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_OGE; ; - break;} -case 44: -#line 1129 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_ORD; ; - break;} -case 45: -#line 1129 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_UNO; ; - break;} -case 46: -#line 1130 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_UEQ; ; - break;} -case 47: -#line 1130 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_UNE; ; - break;} -case 48: -#line 1131 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_ULT; ; - break;} -case 49: -#line 1131 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_UGT; ; - break;} -case 50: -#line 1132 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_ULE; ; - break;} -case 51: -#line 1132 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_UGE; ; - break;} -case 52: -#line 1133 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_TRUE; ; - break;} -case 53: -#line 1134 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.FPredicate = FCmpInst::FCMP_FALSE; ; - break;} -case 64: -#line 1143 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 65: -#line 1145 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal=yyvsp[-1].UInt64Val; ; - break;} -case 66: -#line 1146 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal=0; ; - break;} -case 67: -#line 1150 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = yyvsp[-1].StrVal; + case 30: +#line 1118 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} + break; + + case 31: +#line 1119 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} + break; + + case 32: +#line 1119 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} + break; + + case 33: +#line 1120 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} + break; + + case 34: +#line 1120 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} + break; + + case 35: +#line 1121 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} + break; + + case 36: +#line 1121 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} + break; + + case 37: +#line 1122 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} + break; + + case 38: +#line 1122 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} + break; + + case 39: +#line 1126 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} + break; + + case 40: +#line 1126 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} + break; + + case 41: +#line 1127 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} + break; + + case 42: +#line 1127 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} + break; + + case 43: +#line 1128 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} + break; + + case 44: +#line 1128 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} + break; + + case 45: +#line 1129 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} + break; + + case 46: +#line 1129 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} + break; + + case 47: +#line 1130 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} + break; + + case 48: +#line 1130 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} + break; + + case 49: +#line 1131 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} + break; + + case 50: +#line 1131 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} + break; + + case 51: +#line 1132 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} + break; + + case 52: +#line 1132 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} + break; + + case 53: +#line 1133 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} + break; + + case 54: +#line 1134 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} + break; + + case 65: +#line 1143 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 66: +#line 1145 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} + break; + + case 67: +#line 1146 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal)=0; ;} + break; + + case 68: +#line 1150 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR - ; - break;} -case 68: -#line 1154 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = 0; + ;} + break; + + case 69: +#line 1154 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = 0; CHECK_FOR_ERROR - ; - break;} -case 72: -#line 1162 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = 0; + ;} + break; + + case 73: +#line 1162 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = 0; CHECK_FOR_ERROR - ; - break;} -case 73: -#line 1167 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = yyvsp[-1].StrVal; + ;} + break; + + case 74: +#line 1167 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR - ; - break;} -case 74: -#line 1173 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::InternalLinkage; ; - break;} -case 75: -#line 1174 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::WeakLinkage; ; - break;} -case 76: -#line 1175 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; - break;} -case 77: -#line 1176 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::AppendingLinkage; ; - break;} -case 78: -#line 1177 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; - break;} -case 79: -#line 1181 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; - break;} -case 80: -#line 1182 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; - break;} -case 81: -#line 1183 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalLinkage; ; - break;} -case 82: -#line 1187 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Visibility = GlobalValue::DefaultVisibility; ; - break;} -case 83: -#line 1188 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Visibility = GlobalValue::DefaultVisibility; ; - break;} -case 84: -#line 1189 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Visibility = GlobalValue::HiddenVisibility; ; - break;} -case 85: -#line 1190 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Visibility = GlobalValue::ProtectedVisibility; ; - break;} -case 86: -#line 1194 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalLinkage; ; - break;} -case 87: -#line 1195 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; - break;} -case 88: -#line 1196 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; - break;} -case 89: -#line 1200 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalLinkage; ; - break;} -case 90: -#line 1201 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::InternalLinkage; ; - break;} -case 91: -#line 1202 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; - break;} -case 92: -#line 1203 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::WeakLinkage; ; - break;} -case 93: -#line 1204 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; - break;} -case 94: -#line 1208 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalLinkage; ; - break;} -case 95: -#line 1209 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::WeakLinkage; ; - break;} -case 96: -#line 1210 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::InternalLinkage; ; - break;} -case 97: -#line 1213 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::C; ; - break;} -case 98: -#line 1214 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::C; ; - break;} -case 99: -#line 1215 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::Fast; ; - break;} -case 100: -#line 1216 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::Cold; ; - break;} -case 101: -#line 1217 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::X86_StdCall; ; - break;} -case 102: -#line 1218 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::X86_FastCall; ; - break;} -case 103: -#line 1219 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) + ;} + break; + + case 75: +#line 1173 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} + break; + + case 76: +#line 1174 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} + break; + + case 77: +#line 1175 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} + break; + + case 78: +#line 1176 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} + break; + + case 79: +#line 1177 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} + break; + + case 80: +#line 1181 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} + break; + + case 81: +#line 1182 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} + break; + + case 82: +#line 1183 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} + break; + + case 83: +#line 1187 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} + break; + + case 84: +#line 1188 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} + break; + + case 85: +#line 1189 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} + break; + + case 86: +#line 1190 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} + break; + + case 87: +#line 1194 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} + break; + + case 88: +#line 1195 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} + break; + + case 89: +#line 1196 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} + break; + + case 90: +#line 1200 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} + break; + + case 91: +#line 1201 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} + break; + + case 92: +#line 1202 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} + break; + + case 93: +#line 1203 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} + break; + + case 94: +#line 1204 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} + break; + + case 95: +#line 1208 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} + break; + + case 96: +#line 1209 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} + break; + + case 97: +#line 1210 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} + break; + + case 98: +#line 1213 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} + break; + + case 99: +#line 1214 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} + break; + + case 100: +#line 1215 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Fast; ;} + break; + + case 101: +#line 1216 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Cold; ;} + break; + + case 102: +#line 1217 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} + break; + + case 103: +#line 1218 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} + break; + + case 104: +#line 1219 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); - yyval.UIntVal = yyvsp[0].UInt64Val; + (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); CHECK_FOR_ERROR - ; - break;} -case 104: -#line 1226 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::ZExt; ; - break;} -case 105: -#line 1227 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::ZExt; ; - break;} -case 106: -#line 1228 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::SExt; ; - break;} -case 107: -#line 1229 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::SExt; ; - break;} -case 108: -#line 1230 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::InReg; ; - break;} -case 109: -#line 1231 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::StructRet; ; - break;} -case 110: -#line 1232 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::NoAlias; ; - break;} -case 111: -#line 1233 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::ByVal; ; - break;} -case 112: -#line 1234 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::Nest; ; - break;} -case 113: -#line 1235 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = - ParamAttr::constructAlignmentFromInt(yyvsp[0].UInt64Val); ; - break;} -case 114: -#line 1239 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::None; ; - break;} -case 115: -#line 1240 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; - ; - break;} -case 116: -#line 1245 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::NoReturn; ; - break;} -case 117: -#line 1246 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::NoUnwind; ; - break;} -case 118: -#line 1247 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::ZExt; ; - break;} -case 119: -#line 1248 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::SExt; ; - break;} -case 120: -#line 1249 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::ReadNone; ; - break;} -case 121: -#line 1250 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::ReadOnly; ; - break;} -case 122: -#line 1253 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamAttrs = ParamAttr::None; ; - break;} -case 123: -#line 1254 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; - ; - break;} -case 124: -#line 1259 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 125: -#line 1260 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = yyvsp[0].StrVal; - ; - break;} -case 126: -#line 1267 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = 0; ; - break;} -case 127: -#line 1268 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) + ;} + break; + + case 105: +#line 1226 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} + break; + + case 106: +#line 1227 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} + break; + + case 107: +#line 1228 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::SExt; ;} + break; + + case 108: +#line 1229 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::SExt; ;} + break; + + case 109: +#line 1230 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::InReg; ;} + break; + + case 110: +#line 1231 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} + break; + + case 111: +#line 1232 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} + break; + + case 112: +#line 1233 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} + break; + + case 113: +#line 1234 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::Nest; ;} + break; + + case 114: +#line 1235 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = + ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} + break; + + case 115: +#line 1239 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::None; ;} + break; + + case 116: +#line 1240 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); + ;} + break; + + case 117: +#line 1245 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} + break; + + case 118: +#line 1246 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} + break; + + case 119: +#line 1247 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} + break; + + case 120: +#line 1248 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::SExt; ;} + break; + + case 121: +#line 1249 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} + break; + + case 122: +#line 1250 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} + break; + + case 123: +#line 1253 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::None; ;} + break; + + case 124: +#line 1254 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); + ;} + break; + + case 125: +#line 1259 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 126: +#line 1260 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); + ;} + break; + + case 127: +#line 1267 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} + break; + + case 128: +#line 1268 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); + if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two"); CHECK_FOR_ERROR -; - break;} -case 128: -#line 1274 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = 0; ; - break;} -case 129: -#line 1275 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) +;} + break; + + case 129: +#line 1274 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} + break; + + case 130: +#line 1275 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); + if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two"); CHECK_FOR_ERROR -; - break;} -case 130: -#line 1284 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i) - if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\') +;} + break; + + case 131: +#line 1284 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) + if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') GEN_ERROR("Invalid character in section name"); - yyval.StrVal = yyvsp[0].StrVal; + (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); CHECK_FOR_ERROR -; - break;} -case 131: -#line 1292 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 132: -#line 1293 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = yyvsp[0].StrVal; ; - break;} -case 133: -#line 1298 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{; - break;} -case 134: -#line 1299 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{; - break;} -case 135: -#line 1300 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV->setSection(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; +;} + break; + + case 132: +#line 1292 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 133: +#line 1293 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} + break; + + case 134: +#line 1298 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + {;} + break; + + case 135: +#line 1299 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + {;} + break; + + case 136: +#line 1300 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); + delete (yyvsp[(1) - (1)].StrVal); CHECK_FOR_ERROR - ; - break;} -case 136: -#line 1305 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) + ;} + break; + + case 137: +#line 1305 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); - CurGV->setAlignment(yyvsp[0].UInt64Val); + CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 144: -#line 1321 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(OpaqueType::get()); + ;} + break; + + case 145: +#line 1321 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR - ; - break;} -case 145: -#line 1325 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); + ;} + break; + + case 146: +#line 1325 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR - ; - break;} -case 146: -#line 1329 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Pointer type? - if (*yyvsp[-2].TypeVal == Type::LabelTy) + ;} + break; + + case 147: +#line 1329 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Pointer type? + if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-2].TypeVal, yyvsp[-1].UIntVal))); - delete yyvsp[-2].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); + delete (yyvsp[(1) - (3)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 148: +#line 1336 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Named types are also simple types... + const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 147: -#line 1336 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Named types are also simple types... - const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - yyval.TypeVal = new PATypeHolder(tmp); - ; - break;} -case 148: -#line 1341 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Type UpReference - if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range"); + (yyval.TypeVal) = new PATypeHolder(tmp); + ;} + break; + + case 149: +#line 1341 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Type UpReference + if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... - yyval.TypeVal = new PATypeHolder(OT); + UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... + (yyval.TypeVal) = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); CHECK_FOR_ERROR - ; - break;} -case 149: -#line 1349 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 150: +#line 1349 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. - const Type* RetTy = *yyvsp[-4].TypeVal; + const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal); if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy || isa(RetTy))) GEN_ERROR("LLVM Functions cannot return aggregates"); std::vector Params; - TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end(); + TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); for (; I != E; ++I ) { const Type *Ty = I->Ty->get(); Params.push_back(Ty); @@ -3116,19 +4089,20 @@ CHECK_FOR_ERROR FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); - delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list - delete yyvsp[-4].TypeVal; // Delete the return type handle - yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); - CHECK_FOR_ERROR - ; - break;} -case 150: -#line 1379 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list + delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); + CHECK_FOR_ERROR + ;} + break; + + case 151: +#line 1379 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. std::vector Params; - TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end(); + TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); for ( ; I != E; ++I ) { const Type* Ty = I->Ty->get(); Params.push_back(Ty); @@ -3143,282 +4117,303 @@ CHECK_FOR_ERROR - FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg); - delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list - yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); - CHECK_FOR_ERROR - ; - break;} -case 151: -#line 1404 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Sized array type? - yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 152: -#line 1409 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Vector type? - const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); - if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) + FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); + delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); + CHECK_FOR_ERROR + ;} + break; + + case 152: +#line 1404 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Sized array type? + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); + delete (yyvsp[(4) - (5)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 153: +#line 1409 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Vector type? + const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); + if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) GEN_ERROR("Unsigned result not equal to signed result"); if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) GEN_ERROR("Element type of a VectorType must be primitive"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); + delete (yyvsp[(4) - (5)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 153: -#line 1419 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Structure type? + ;} + break; + + case 154: +#line 1419 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Structure type? std::vector Elements; - for (std::list::iterator I = yyvsp[-1].TypeList->begin(), - E = yyvsp[-1].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), + E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) Elements.push_back(*I); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); - delete yyvsp[-1].TypeList; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete (yyvsp[(2) - (3)].TypeList); CHECK_FOR_ERROR - ; - break;} -case 154: -#line 1429 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Empty structure type? - yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); - CHECK_FOR_ERROR - ; - break;} -case 155: -#line 1433 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 155: +#line 1429 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Empty structure type? + (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); + CHECK_FOR_ERROR + ;} + break; + + case 156: +#line 1433 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { std::vector Elements; - for (std::list::iterator I = yyvsp[-2].TypeList->begin(), - E = yyvsp[-2].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), + E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) Elements.push_back(*I); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); - delete yyvsp[-2].TypeList; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); + delete (yyvsp[(3) - (5)].TypeList); CHECK_FOR_ERROR - ; - break;} -case 156: -#line 1443 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Empty structure type? - yyval.TypeVal = new PATypeHolder(StructType::get(std::vector(), true)); - CHECK_FOR_ERROR - ; - break;} -case 157: -#line 1450 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 157: +#line 1443 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Empty structure type? + (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); + CHECK_FOR_ERROR + ;} + break; + + case 158: +#line 1450 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. - yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal; - yyval.TypeWithAttrs.Attrs = ParamAttr::None; - ; - break;} -case 158: -#line 1459 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); + (yyval.TypeWithAttrs).Attrs = ParamAttr::None; + ;} + break; + + case 159: +#line 1459 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); - if (!(*yyvsp[0].TypeVal)->isFirstClassType() && !isa(yyvsp[0].TypeVal->get())) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); + if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa((yyvsp[(1) - (1)].TypeVal)->get())) GEN_ERROR("LLVM functions cannot return aggregate types"); - yyval.TypeVal = yyvsp[0].TypeVal; - ; - break;} -case 159: -#line 1466 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(Type::VoidTy); - ; - break;} -case 160: -#line 1471 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeWithAttrsList = new TypeWithAttrsList(); - yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs); + (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); + ;} + break; + + case 160: +#line 1466 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); + ;} + break; + + case 161: +#line 1471 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); + (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); CHECK_FOR_ERROR - ; - break;} -case 161: -#line 1476 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs); + ;} + break; + + case 162: +#line 1476 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR - ; - break;} -case 163: -#line 1484 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList; + ;} + break; + + case 164: +#line 1484 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; TWA.Ty = new PATypeHolder(Type::VoidTy); - yyval.TypeWithAttrsList->push_back(TWA); + (yyval.TypeWithAttrsList)->push_back(TWA); CHECK_FOR_ERROR - ; - break;} -case 164: -#line 1491 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeWithAttrsList = new TypeWithAttrsList; + ;} + break; + + case 165: +#line 1491 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; TWA.Ty = new PATypeHolder(Type::VoidTy); - yyval.TypeWithAttrsList->push_back(TWA); + (yyval.TypeWithAttrsList)->push_back(TWA); CHECK_FOR_ERROR - ; - break;} -case 165: -#line 1498 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeWithAttrsList = new TypeWithAttrsList(); + ;} + break; + + case 166: +#line 1498 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR - ; - break;} -case 166: -#line 1506 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeList = new std::list(); - yyval.TypeList->push_back(*yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 167: -#line 1512 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; + ;} + break; + + case 167: +#line 1506 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList) = new std::list(); + (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); + delete (yyvsp[(1) - (1)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 168: -#line 1524 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized arr + ;} + break; + + case 168: +#line 1512 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); + delete (yyvsp[(3) - (3)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 169: +#line 1524 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized arr if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); + const ArrayType *ATy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + ""); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); + delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 169: -#line 1552 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 170: +#line 1552 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); + const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +""); - yyval.ConstVal = ConstantArray::get(ATy, std::vector()); - delete yyvsp[-2].TypeVal; + (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); + delete (yyvsp[(1) - (3)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 170: -#line 1568 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 171: +#line 1568 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); + const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length())) + if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length())) GEN_ERROR("Can't build string constant of size " + - itostr((int)(yyvsp[0].StrVal->length())) + + itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) + " when array has size " + itostr(NumElements) + ""); std::vector Vals; if (ETy == Type::Int8Ty) { - for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i) - Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i])); + for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) + Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); } else { - delete yyvsp[0].StrVal; + delete (yyvsp[(3) - (3)].StrVal); GEN_ERROR("Cannot build string arrays of non byte sized elements"); } - delete yyvsp[0].StrVal; - yyval.ConstVal = ConstantArray::get(ATy, Vals); - delete yyvsp[-2].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 171: -#line 1595 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized arr + delete (yyvsp[(3) - (3)].StrVal); + (yyval.ConstVal) = ConstantArray::get(ATy, Vals); + delete (yyvsp[(1) - (3)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 172: +#line 1595 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized arr if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - const VectorType *PTy = dyn_cast(yyvsp[-3].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); + const VectorType *PTy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make packed constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + ""); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); + delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 172: -#line 1623 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); + ;} + break; + + case 173: +#line 1623 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); - if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) + if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) - if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) + if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + @@ -3429,20 +4424,21 @@ GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); - yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); + delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 173: -#line 1649 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 174: +#line 1649 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); + const StructType *STy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type"); @@ -3452,25 +4448,26 @@ GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); - yyval.ConstVal = ConstantStruct::get(STy, std::vector()); - delete yyvsp[-2].TypeVal; + (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); + delete (yyvsp[(1) - (3)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 174: -#line 1669 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const StructType *STy = dyn_cast(yyvsp[-5].TypeVal->get()); + ;} + break; + + case 175: +#line 1669 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-5].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); - if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes()) + if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i) - if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) + if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + @@ -3481,20 +4478,21 @@ GEN_ERROR("Vector initializer to non-vector type '" + STy->getDescription() + "'"); - yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector); - delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector; + (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); + delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 175: -#line 1695 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 176: +#line 1695 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); - const StructType *STy = dyn_cast(yyvsp[-4].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); + const StructType *STy = dyn_cast((yyvsp[(1) - (5)].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-4].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type"); @@ -3504,44 +4502,47 @@ GEN_ERROR("Vector initializer to non-vector type '" + STy->getDescription() + "'"); - yyval.ConstVal = ConstantStruct::get(STy, std::vector()); - delete yyvsp[-4].TypeVal; + (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); + delete (yyvsp[(1) - (5)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 176: -#line 1715 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 177: +#line 1715 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); + const PointerType *PTy = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make null pointer constant with type: '" + - (*yyvsp[-1].TypeVal)->getDescription() + "'"); + (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); - yyval.ConstVal = ConstantPointerNull::get(PTy); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = ConstantPointerNull::get(PTy); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 177: -#line 1727 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 178: +#line 1727 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 178: -#line 1734 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); + (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); + delete (yyvsp[(1) - (2)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 179: +#line 1734 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); + const PointerType *Ty = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get()); if (Ty == 0) - GEN_ERROR("Global const reference must be a pointer type " + (*yyvsp[-1].TypeVal)->getDescription()); + GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); // ConstExprs can exist in the body of a function, thus creating // GlobalValues whenever they refer to a variable. Because we are in @@ -3553,7 +4554,7 @@ Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal); + Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -3568,16 +4569,16 @@ // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); + CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - yyvsp[0].ValIDVal.destroy(); + (yyvsp[(2) - (2)].ValIDVal).destroy(); } else { std::string Name; - if (yyvsp[0].ValIDVal.Type == ValID::GlobalName) - Name = yyvsp[0].ValIDVal.getName(); - else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID) + if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) + Name = (yyvsp[(2) - (2)].ValIDVal).getName(); + else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) GEN_ERROR("Invalid reference to global"); // Create the forward referenced global. @@ -3588,347 +4589,382 @@ CurModule.CurrentModule); } else { GV = new GlobalVariable(PT->getElementType(), false, - GlobalValue::ExternalWeakLinkage, 0, - Name, CurModule.CurrentModule); + GlobalValue::ExternalWeakLinkage, 0, + Name, CurModule.CurrentModule); } // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV)); + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); V = GV; } } - yyval.ConstVal = cast(V); - delete yyvsp[-1].TypeVal; // Free the type handle + (yyval.ConstVal) = cast(V); + delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle CHECK_FOR_ERROR - ; - break;} -case 179: -#line 1800 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 180: +#line 1800 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); + if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression: " + - (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription()); - yyval.ConstVal = yyvsp[0].ConstVal; - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 180: -#line 1810 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); + (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); + delete (yyvsp[(1) - (2)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 181: +#line 1810 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - const Type *Ty = yyvsp[-1].TypeVal->get(); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); + const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) GEN_ERROR("Cannot create a null initialized value of this type"); - yyval.ConstVal = Constant::getNullValue(Ty); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = Constant::getNullValue(Ty); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 181: -#line 1820 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // integral constants - if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) + ;} + break; + + case 182: +#line 1820 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); - yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true); + (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true); CHECK_FOR_ERROR - ; - break;} -case 182: -#line 1826 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // arbitrary precision integer constants - uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); - if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { + ;} + break; + + case 183: +#line 1826 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // arbitrary precision integer constants + uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); + if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { GEN_ERROR("Constant value does not fit in type"); } - yyvsp[0].APIntVal->sextOrTrunc(BitWidth); - yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal); - delete yyvsp[0].APIntVal; - CHECK_FOR_ERROR - ; - break;} -case 183: -#line 1836 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // integral constants - if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) + (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth); + (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); + delete (yyvsp[(2) - (2)].APIntVal); + CHECK_FOR_ERROR + ;} + break; + + case 184: +#line 1836 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); - yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false); + (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false); CHECK_FOR_ERROR - ; - break;} -case 184: -#line 1842 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // arbitrary precision integer constants - uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); - if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { + ;} + break; + + case 185: +#line 1842 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // arbitrary precision integer constants + uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); + if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { GEN_ERROR("Constant value does not fit in type"); } - yyvsp[0].APIntVal->zextOrTrunc(BitWidth); - yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal); - delete yyvsp[0].APIntVal; - CHECK_FOR_ERROR - ; - break;} -case 185: -#line 1852 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Boolean constants - assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); - yyval.ConstVal = ConstantInt::getTrue(); - CHECK_FOR_ERROR - ; - break;} -case 186: -#line 1857 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Boolean constants - assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); - yyval.ConstVal = ConstantInt::getFalse(); - CHECK_FOR_ERROR - ; - break;} -case 187: -#line 1862 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Floating point constants - if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal)) + (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth); + (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); + delete (yyvsp[(2) - (2)].APIntVal); + CHECK_FOR_ERROR + ;} + break; + + case 186: +#line 1852 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); + (yyval.ConstVal) = ConstantInt::getTrue(); + CHECK_FOR_ERROR + ;} + break; + + case 187: +#line 1857 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); + (yyval.ConstVal) = ConstantInt::getFalse(); + CHECK_FOR_ERROR + ;} + break; + + case 188: +#line 1862 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Floating point constants + if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); // Lexer has no type info, so builds all float and double FP constants // as double. Fix this here. Long double is done right. - if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy) - yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); - yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal); - delete yyvsp[0].FPVal; - CHECK_FOR_ERROR - ; - break;} -case 188: -#line 1875 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) + (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); + (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)); + delete (yyvsp[(2) - (2)].FPVal); + CHECK_FOR_ERROR + ;} + break; + + case 189: +#line 1875 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - Constant *Val = yyvsp[-3].ConstVal; - const Type *DestTy = yyvsp[-1].TypeVal->get(); - if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy)) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); + Constant *Val = (yyvsp[(3) - (6)].ConstVal); + const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); + if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) GEN_ERROR("invalid cast opcode for cast from '" + Val->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); - yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy); - delete yyvsp[-1].TypeVal; - ; - break;} -case 189: -#line 1887 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[-2].ConstVal->getType())) + (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); + delete (yyvsp[(5) - (6)].TypeVal); + ;} + break; + + case 190: +#line 1887 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); const Type *IdxTy = - GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(), + GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(), true); if (!IdxTy) GEN_ERROR("Index list invalid for constant getelementptr"); SmallVector IdxVec; - for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i) - if (Constant *C = dyn_cast((*yyvsp[-1].ValueList)[i])) + for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) + if (Constant *C = dyn_cast((*(yyvsp[(4) - (5)].ValueList))[i])) IdxVec.push_back(C); else GEN_ERROR("Indices to constant getelementptr must be constants"); - delete yyvsp[-1].ValueList; + delete (yyvsp[(4) - (5)].ValueList); - yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size()); + (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); CHECK_FOR_ERROR - ; - break;} -case 190: -#line 1909 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty) + ;} + break; + + case 191: +#line 1909 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) GEN_ERROR("Select operand types must match"); - yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 191: -#line 1917 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 192: +#line 1917 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); CHECK_FOR_ERROR; - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); - ; - break;} -case 192: -#line 1923 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); + ;} + break; + + case 193: +#line 1923 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); - if (!yyvsp[-3].ConstVal->getType()->isInteger()) { - if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa(yyvsp[-3].ConstVal->getType()) || - !cast(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger()) + if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { + if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa((yyvsp[(3) - (6)].ConstVal)->getType()) || + !cast((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) GEN_ERROR("Logical operator requires integral operands"); } - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 193: -#line 1934 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 194: +#line 1934 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); - yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); - ; - break;} -case 194: -#line 1939 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); + ;} + break; + + case 195: +#line 1939 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); - yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); - ; - break;} -case 195: -#line 1944 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); + ;} + break; + + case 196: +#line 1944 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); - yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 196: -#line 1950 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 197: +#line 1950 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); - yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 197: -#line 1956 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 198: +#line 1956 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); - yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 198: -#line 1965 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); + ;} + break; + + case 199: +#line 1965 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 199: -#line 1969 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ConstVector = new std::vector(); - yyval.ConstVector->push_back(yyvsp[0].ConstVal); + ;} + break; + + case 200: +#line 1969 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ConstVector) = new std::vector(); + (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 200: -#line 1977 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = false; ; - break;} -case 201: -#line 1977 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = true; ; - break;} -case 202: -#line 1980 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = true; ; - break;} -case 203: -#line 1980 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = false; ; - break;} -case 204: -#line 1983 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const Type* VTy = yyvsp[-1].TypeVal->get(); - Value *V = getVal(VTy, yyvsp[0].ValIDVal); + ;} + break; + + case 201: +#line 1977 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = false; ;} + break; + + case 202: +#line 1977 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = true; ;} + break; + + case 203: +#line 1980 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = true; ;} + break; + + case 204: +#line 1980 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = false; ;} + break; + + case 205: +#line 1983 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); + Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); CHECK_FOR_ERROR GlobalValue* Aliasee = dyn_cast(V); if (!Aliasee) GEN_ERROR("Aliases can be created only to global values"); - yyval.ConstVal = Aliasee; + (yyval.ConstVal) = Aliasee; CHECK_FOR_ERROR - delete yyvsp[-1].TypeVal; - ; - break;} -case 205: -#line 1995 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Constant *Val = yyvsp[-3].ConstVal; - const Type *DestTy = yyvsp[-1].TypeVal->get(); - if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy)) + delete (yyvsp[(1) - (2)].TypeVal); + ;} + break; + + case 206: +#line 1995 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + Constant *Val = (yyvsp[(3) - (6)].ConstVal); + const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); + if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) GEN_ERROR("invalid cast opcode for cast from '" + Val->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); - yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy); + (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); CHECK_FOR_ERROR - delete yyvsp[-1].TypeVal; - ; - break;} -case 206: -#line 2016 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = ParserResult = CurModule.CurrentModule; + delete (yyvsp[(5) - (6)].TypeVal); + ;} + break; + + case 207: +#line 2016 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); CHECK_FOR_ERROR; - ; - break;} -case 207: -#line 2021 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = ParserResult = CurModule.CurrentModule; + ;} + break; + + case 208: +#line 2021 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); CHECK_FOR_ERROR; - ; - break;} -case 210: -#line 2034 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.isDeclare = false; ; - break;} -case 211: -#line 2034 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 211: +#line 2034 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.isDeclare = false; ;} + break; + + case 212: +#line 2034 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.FunctionDone(); CHECK_FOR_ERROR - ; - break;} -case 212: -#line 2038 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.isDeclare = true; ; - break;} -case 213: -#line 2038 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 213: +#line 2038 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.isDeclare = true; ;} + break; + + case 214: +#line 2038 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 214: -#line 2041 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 215: +#line 2041 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 215: -#line 2044 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 216: +#line 2044 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: // @@ -3938,100 +4974,108 @@ // If types are not resolved eagerly, then the two types will not be // determined to be the same type! // - ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); + ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); - if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { + if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) { CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(*yyvsp[0].TypeVal); + CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); } - delete yyvsp[0].TypeVal; + delete (yyvsp[(3) - (3)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 216: -#line 2068 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType); + ;} + break; + + case 217: +#line 2068 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); - if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { + if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) { CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(yyvsp[0].PrimType); + CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); } CHECK_FOR_ERROR - ; - break;} -case 217: -#line 2080 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 218: +#line 2080 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { /* "Externally Visible" Linkage */ - if (yyvsp[-1].ConstVal == 0) + if ((yyvsp[(5) - (6)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, GlobalValue::ExternalLinkage, - yyvsp[-4].Visibility, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[-3].BoolVal, yyvsp[0].UIntVal); + CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, + (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal)); CHECK_FOR_ERROR - ; - break;} -case 218: -#line 2087 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 219: +#line 2087 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; - ; - break;} -case 219: -#line 2091 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-1].ConstVal == 0) + ;} + break; + + case 220: +#line 2091 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable(yyvsp[-6].StrVal, yyvsp[-5].Linkage, yyvsp[-4].Visibility, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[-3].BoolVal, yyvsp[0].UIntVal); + CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); CHECK_FOR_ERROR - ; - break;} -case 220: -#line 2096 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 221: +#line 2096 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; - ; - break;} -case 221: -#line 2100 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 222: +#line 2100 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - CurGV = ParseGlobalVariable(yyvsp[-6].StrVal, yyvsp[-5].Linkage, yyvsp[-4].Visibility, yyvsp[-2].BoolVal, *yyvsp[-1].TypeVal, 0, yyvsp[-3].BoolVal, yyvsp[0].UIntVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); + CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); CHECK_FOR_ERROR - delete yyvsp[-1].TypeVal; - ; - break;} -case 222: -#line 2106 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[(6) - (7)].TypeVal); + ;} + break; + + case 223: +#line 2106 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 223: -#line 2110 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 224: +#line 2110 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { std::string Name; - if (yyvsp[-4].StrVal) { - Name = *yyvsp[-4].StrVal; - delete yyvsp[-4].StrVal; + if ((yyvsp[(1) - (5)].StrVal)) { + Name = *(yyvsp[(1) - (5)].StrVal); + delete (yyvsp[(1) - (5)].StrVal); } if (Name.empty()) GEN_ERROR("Alias name cannot be empty"); - Constant* Aliasee = yyvsp[0].ConstVal; + Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); if (Aliasee == 0) GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); - GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee, + GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, CurModule.CurrentModule); - GA->setVisibility(yyvsp[-3].Visibility); + GA->setVisibility((yyvsp[(2) - (5)].Visibility)); InsertValue(GA, CurModule.Values); @@ -4055,150 +5099,165 @@ ID.destroy(); CHECK_FOR_ERROR - ; - break;} -case 224: -#line 2150 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CHECK_FOR_ERROR - ; - break;} -case 225: -#line 2153 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 225: +#line 2150 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 226: -#line 2159 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 226: +#line 2153 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CHECK_FOR_ERROR + ;} + break; + + case 227: +#line 2159 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) - CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal); + CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); else - CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; + CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); + delete (yyvsp[(1) - (1)].StrVal); CHECK_FOR_ERROR -; - break;} -case 227: -#line 2169 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; - ; - break;} -case 228: -#line 2173 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; - ; - break;} -case 230: -#line 2180 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; +;} + break; + + case 228: +#line 2169 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); + delete (yyvsp[(3) - (3)].StrVal); + ;} + break; + + case 229: +#line 2173 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); + delete (yyvsp[(3) - (3)].StrVal); + ;} + break; + + case 231: +#line 2180 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); + delete (yyvsp[(3) - (3)].StrVal); CHECK_FOR_ERROR - ; - break;} -case 231: -#line 2185 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; + ;} + break; + + case 232: +#line 2185 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); + delete (yyvsp[(1) - (1)].StrVal); CHECK_FOR_ERROR - ; - break;} -case 232: -#line 2190 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 233: +#line 2190 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 233: -#line 2199 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 234: +#line 2199 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - if (*yyvsp[-2].TypeVal == Type::VoidTy) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); + if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid"); - ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal; - yyval.ArgList = yyvsp[-4].ArgList; - yyvsp[-4].ArgList->push_back(E); - CHECK_FOR_ERROR - ; - break;} -case 234: -#line 2209 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal); + (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); + (yyvsp[(1) - (5)].ArgList)->push_back(E); + CHECK_FOR_ERROR + ;} + break; + + case 235: +#line 2209 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - if (*yyvsp[-2].TypeVal == Type::VoidTy) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); + if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid"); - ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal; - yyval.ArgList = new ArgListType; - yyval.ArgList->push_back(E); - CHECK_FOR_ERROR - ; - break;} -case 235: -#line 2220 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[0].ArgList; + ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal); + (yyval.ArgList) = new ArgListType; + (yyval.ArgList)->push_back(E); CHECK_FOR_ERROR - ; - break;} -case 236: -#line 2224 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[-2].ArgList; + ;} + break; + + case 236: +#line 2220 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); + CHECK_FOR_ERROR + ;} + break; + + case 237: +#line 2224 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; E.Ty = new PATypeHolder(Type::VoidTy); E.Name = 0; E.Attrs = ParamAttr::None; - yyval.ArgList->push_back(E); + (yyval.ArgList)->push_back(E); CHECK_FOR_ERROR - ; - break;} -case 237: -#line 2233 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = new ArgListType; + ;} + break; + + case 238: +#line 2233 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = new ArgListType; struct ArgListEntry E; E.Ty = new PATypeHolder(Type::VoidTy); E.Name = 0; E.Attrs = ParamAttr::None; - yyval.ArgList->push_back(E); + (yyval.ArgList)->push_back(E); CHECK_FOR_ERROR - ; - break;} -case 238: -#line 2242 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = 0; + ;} + break; + + case 239: +#line 2242 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = 0; CHECK_FOR_ERROR - ; - break;} -case 239: -#line 2248 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - std::string FunctionName(*yyvsp[-7].StrVal); - delete yyvsp[-7].StrVal; // Free strdup'd memory! + ;} + break; + + case 240: +#line 2248 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); + delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! // Check the function result for abstractness if this is a define. We should // have no abstract types at this point - if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-8].TypeVal)) - GEN_ERROR("Reference to abstract result: "+ yyvsp[-8].TypeVal->get()->getDescription()); + if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal))) + GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription()); std::vector ParamTypeList; SmallVector Attrs; - if (yyvsp[-3].ParamAttrs != ParamAttr::None) - Attrs.push_back(ParamAttrsWithIndex::get(0, yyvsp[-3].ParamAttrs)); - if (yyvsp[-5].ArgList) { // If there are arguments... + if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) + Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs))); + if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments... unsigned index = 1; - for (ArgListType::iterator I = yyvsp[-5].ArgList->begin(); I != yyvsp[-5].ArgList->end(); ++I, ++index) { + for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) { const Type* Ty = I->Ty->get(); if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); @@ -4215,9 +5274,9 @@ if (!Attrs.empty()) PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); - FunctionType *FT = FunctionType::get(*yyvsp[-8].TypeVal, ParamTypeList, isVarArg); + FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::getUnqual(FT); - delete yyvsp[-8].TypeVal; + delete (yyvsp[(2) - (10)].TypeVal); ValID ID; if (!FunctionName.empty()) { @@ -4271,31 +5330,31 @@ Fn->setLinkage(CurFun.Linkage); Fn->setVisibility(CurFun.Visibility); } - Fn->setCallingConv(yyvsp[-9].UIntVal); + Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal)); Fn->setParamAttrs(PAL); - Fn->setAlignment(yyvsp[-1].UIntVal); - if (yyvsp[-2].StrVal) { - Fn->setSection(*yyvsp[-2].StrVal); - delete yyvsp[-2].StrVal; - } - if (yyvsp[0].StrVal) { - Fn->setCollector(yyvsp[0].StrVal->c_str()); - delete yyvsp[0].StrVal; + Fn->setAlignment((yyvsp[(9) - (10)].UIntVal)); + if ((yyvsp[(8) - (10)].StrVal)) { + Fn->setSection(*(yyvsp[(8) - (10)].StrVal)); + delete (yyvsp[(8) - (10)].StrVal); + } + if ((yyvsp[(10) - (10)].StrVal)) { + Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str()); + delete (yyvsp[(10) - (10)].StrVal); } // Add all of the arguments we parsed to the function... - if (yyvsp[-5].ArgList) { // Is null if empty... + if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert(yyvsp[-5].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-5].ArgList->back().Name == 0 && + assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 && "Not a varargs marker!"); - delete yyvsp[-5].ArgList->back().Ty; - yyvsp[-5].ArgList->pop_back(); // Delete the last entry + delete (yyvsp[(5) - (10)].ArgList)->back().Ty; + (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = yyvsp[-5].ArgList->begin(); - I != yyvsp[-5].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { + for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); + I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR @@ -4303,114 +5362,128 @@ Idx++; } - delete yyvsp[-5].ArgList; // We're now done with the argument list + delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list } CHECK_FOR_ERROR -; - break;} -case 242: -#line 2375 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = CurFun.CurrentFunction; +;} + break; + + case 243: +#line 2375 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage); - yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility); -; - break;} -case 245: -#line 2386 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = yyvsp[-1].FunctionVal; + (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); + (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); +;} + break; + + case 246: +#line 2386 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR -; - break;} -case 246: -#line 2391 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage); - CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility); - yyval.FunctionVal = CurFun.CurrentFunction; +;} + break; + + case 247: +#line 2391 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); + CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); + (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR - ; - break;} -case 247: -#line 2403 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 248: +#line 2403 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; CHECK_FOR_ERROR - ; - break;} -case 248: -#line 2407 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + ;} + break; + + case 249: +#line 2407 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - ; - break;} -case 249: -#line 2412 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // A reference to a direct constant - yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 250: -#line 2416 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); + ;} + break; + + case 250: +#line 2412 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // A reference to a direct constant + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 251: -#line 2420 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Perhaps it's an FP constant? - yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); - CHECK_FOR_ERROR - ; - break;} -case 252: -#line 2424 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(ConstantInt::getTrue()); + ;} + break; + + case 251: +#line 2416 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 253: -#line 2428 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(ConstantInt::getFalse()); + ;} + break; + + case 252: +#line 2420 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Perhaps it's an FP constant? + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR - ; - break;} -case 254: -#line 2432 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createNull(); + ;} + break; + + case 253: +#line 2424 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR - ; - break;} -case 255: -#line 2436 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createUndef(); + ;} + break; + + case 254: +#line 2428 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); + CHECK_FOR_ERROR + ;} + break; + + case 255: +#line 2432 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createNull(); + CHECK_FOR_ERROR + ;} + break; + + case 256: +#line 2436 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR - ; - break;} -case 256: -#line 2440 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // A vector zero constant. - yyval.ValIDVal = ValID::createZeroInit(); - CHECK_FOR_ERROR - ; - break;} -case 257: -#line 2444 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized packed vector - const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); - int NumElements = yyvsp[-1].ConstVector->size(); + ;} + break; + + case 257: +#line 2440 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // A vector zero constant. + (yyval.ValIDVal) = ValID::createZeroInit(); + CHECK_FOR_ERROR + ;} + break; + + case 258: +#line 2444 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized packed vector + const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); + int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); VectorType* pt = VectorType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -4422,266 +5495,290 @@ ); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '" + - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector)); - delete PTy; delete yyvsp[-1].ConstVector; + (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); + delete PTy; delete (yyvsp[(2) - (3)].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 258: -#line 2469 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); + ;} + break; + + case 259: +#line 2469 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 259: -#line 2473 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal); - delete yyvsp[-2].StrVal; - delete yyvsp[0].StrVal; - CHECK_FOR_ERROR - ; - break;} -case 260: -#line 2483 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it an integer reference...? - yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal); - CHECK_FOR_ERROR - ; - break;} -case 261: -#line 2487 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal); + ;} + break; + + case 260: +#line 2473 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); + delete (yyvsp[(3) - (5)].StrVal); + delete (yyvsp[(5) - (5)].StrVal); CHECK_FOR_ERROR - ; - break;} -case 262: -#line 2491 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it a named reference...? - yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; - CHECK_FOR_ERROR - ; - break;} -case 263: -#line 2496 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it a named reference...? - yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal); - delete yyvsp[0].StrVal; - CHECK_FOR_ERROR - ; - break;} -case 266: -#line 2509 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 261: +#line 2483 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it an integer reference...? + (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); + CHECK_FOR_ERROR + ;} + break; + + case 262: +#line 2487 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); + CHECK_FOR_ERROR + ;} + break; + + case 263: +#line 2491 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it a named reference...? + (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); + delete (yyvsp[(1) - (1)].StrVal); + CHECK_FOR_ERROR + ;} + break; + + case 264: +#line 2496 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it a named reference...? + (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); + delete (yyvsp[(1) - (1)].StrVal); + CHECK_FOR_ERROR + ;} + break; + + case 267: +#line 2509 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 267: -#line 2518 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = new std::vector(); - yyval.ValueList->push_back(yyvsp[0].ValueVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); + (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 268: -#line 2523 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.ValueList=yyvsp[-2].ValueList)->push_back(yyvsp[0].ValueVal); + ;} + break; + + case 268: +#line 2518 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = new std::vector(); + (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 269: -#line 2528 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = yyvsp[-1].FunctionVal; + ;} + break; + + case 269: +#line 2523 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); + CHECK_FOR_ERROR + ;} + break; + + case 270: +#line 2528 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); + CHECK_FOR_ERROR + ;} + break; + + case 271: +#line 2532 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Do not allow functions with 0 basic blocks + (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); + CHECK_FOR_ERROR + ;} + break; + + case 272: +#line 2541 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); + CHECK_FOR_ERROR + InsertValue((yyvsp[(3) - (3)].TermInstVal)); + (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); + (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); + CHECK_FOR_ERROR + ;} + break; + + case 273: +#line 2550 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) + if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) + if (CI2->getParent() == 0) + (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); + (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); + (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); + CHECK_FOR_ERROR + ;} + break; + + case 274: +#line 2559 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Empty space between instruction lists + (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0); + CHECK_FOR_ERROR + ;} + break; + + case 275: +#line 2563 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Only the unwind to block + (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal((yyvsp[(3) - (3)].ValIDVal))); + CHECK_FOR_ERROR + ;} + break; + + case 276: +#line 2567 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Labelled (named) basic block + (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)), 0); + delete (yyvsp[(1) - (1)].StrVal); + CHECK_FOR_ERROR + ;} + break; + + case 277: +#line 2572 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (4)].StrVal)), getBBVal((yyvsp[(4) - (4)].ValIDVal))); + delete (yyvsp[(1) - (4)].StrVal); + CHECK_FOR_ERROR + ;} + break; + + case 278: +#line 2579 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Return with a result... + ValueList &VL = *(yyvsp[(2) - (2)].ValueList); + assert(!VL.empty() && "Invalid ret operands!"); + (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size()); + delete (yyvsp[(2) - (2)].ValueList); + CHECK_FOR_ERROR + ;} + break; + + case 279: +#line 2586 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Return with no result... + (yyval.TermInstVal) = ReturnInst::Create(); + CHECK_FOR_ERROR + ;} + break; + + case 280: +#line 2590 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Unconditional Branch... + BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 270: -#line 2532 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Do not allow functions with 0 basic blocks - yyval.FunctionVal = yyvsp[-1].FunctionVal; - CHECK_FOR_ERROR - ; - break;} -case 271: -#line 2541 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); + (yyval.TermInstVal) = BranchInst::Create(tmpBB); + ;} + break; + + case 281: +#line 2595 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + assert(cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?"); + BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].TermInstVal); - yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); - yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; - CHECK_FOR_ERROR - ; - break;} -case 272: -#line 2550 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (CastInst *CI1 = dyn_cast(yyvsp[0].InstVal)) - if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) - if (CI2->getParent() == 0) - yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2); - yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); - yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; - CHECK_FOR_ERROR - ; - break;} -case 273: -#line 2559 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Empty space between instruction lists - yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0); - CHECK_FOR_ERROR - ; - break;} -case 274: -#line 2563 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Only the unwind to block - yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal(yyvsp[0].ValIDVal)); - CHECK_FOR_ERROR - ; - break;} -case 275: -#line 2567 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Labelled (named) basic block - yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal), 0); - delete yyvsp[0].StrVal; - CHECK_FOR_ERROR - ; - break;} -case 276: -#line 2572 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[-3].StrVal), getBBVal(yyvsp[0].ValIDVal)); - delete yyvsp[-3].StrVal; + BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 277: -#line 2579 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Return with a result... - ValueList &VL = *yyvsp[0].ValueList; - assert(!VL.empty() && "Invalid ret operands!"); - yyval.TermInstVal = ReturnInst::Create(&VL[0], VL.size()); - delete yyvsp[0].ValueList; + Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 278: -#line 2586 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Return with no result... - yyval.TermInstVal = ReturnInst::Create(); - CHECK_FOR_ERROR - ; - break;} -case 279: -#line 2590 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Unconditional Branch... - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - yyval.TermInstVal = BranchInst::Create(tmpBB); - ; - break;} -case 280: -#line 2595 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - assert(cast(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?"); - BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); - CHECK_FOR_ERROR - BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal); - CHECK_FOR_ERROR - yyval.TermInstVal = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); - ; - break;} -case 281: -#line 2605 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); + (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); + ;} + break; + + case 282: +#line 2605 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); CHECK_FOR_ERROR - SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); - yyval.TermInstVal = S; + SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); + (yyval.TermInstVal) = S; - std::vector >::iterator I = yyvsp[-1].JumpTable->begin(), - E = yyvsp[-1].JumpTable->end(); + std::vector >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), + E = (yyvsp[(8) - (9)].JumpTable)->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else GEN_ERROR("Switch case is constant, but not a simple integer"); } - delete yyvsp[-1].JumpTable; + delete (yyvsp[(8) - (9)].JumpTable); CHECK_FOR_ERROR - ; - break;} -case 282: -#line 2624 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); + ;} + break; + + case 283: +#line 2624 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); CHECK_FOR_ERROR SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0); - yyval.TermInstVal = S; + (yyval.TermInstVal) = S; CHECK_FOR_ERROR - ; - break;} -case 283: -#line 2634 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 284: +#line 2634 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast(yyvsp[-11].TypeVal->get())) || + if (!(PFTy = dyn_cast((yyvsp[(3) - (14)].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = yyvsp[-8].ParamList->begin(), E = yyvsp[-8].ParamList->end(); + ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } - Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false); + Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - delete yyvsp[-11].TypeVal; + delete (yyvsp[(3) - (14)].TypeVal); - Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); + BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); CHECK_FOR_ERROR SmallVector Attrs; - if (yyvsp[-6].ParamAttrs != ParamAttr::None) - Attrs.push_back(ParamAttrsWithIndex::get(0, yyvsp[-6].ParamAttrs)); + if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) + Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs))); // Check the arguments ValueList Args; - if (yyvsp[-8].ParamList->empty()) { // Has no arguments? + if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -4691,7 +5788,7 @@ // correctly! FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = yyvsp[-8].ParamList->begin(), ArgE = yyvsp[-8].ParamList->end(); + ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -4720,347 +5817,375 @@ // Create the InvokeInst InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end()); - II->setCallingConv(yyvsp[-12].UIntVal); + II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); II->setParamAttrs(PAL); - yyval.TermInstVal = II; - delete yyvsp[-8].ParamList; + (yyval.TermInstVal) = II; + delete (yyvsp[(6) - (14)].ParamList); CHECK_FOR_ERROR - ; - break;} -case 284: -#line 2714 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TermInstVal = new UnwindInst(); + ;} + break; + + case 285: +#line 2714 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR - ; - break;} -case 285: -#line 2718 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TermInstVal = new UnreachableInst(); + ;} + break; + + case 286: +#line 2718 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR - ; - break;} -case 286: -#line 2725 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.JumpTable = yyvsp[-5].JumpTable; - Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + ;} + break; + + case 287: +#line 2725 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); + Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value"); - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR - yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); - ; - break;} -case 287: -#line 2736 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.JumpTable = new std::vector >(); - Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); + ;} + break; + + case 288: +#line 2736 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.JumpTable) = new std::vector >(); + Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value"); - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR - yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); - ; - break;} -case 288: -#line 2749 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); + ;} + break; + + case 289: +#line 2749 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is this definition named?? if so, assign the name... - setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); + setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].InstVal); - yyval.InstVal = yyvsp[0].InstVal; + InsertValue((yyvsp[(2) - (2)].InstVal)); + (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); CHECK_FOR_ERROR - ; - break;} -case 289: -#line 2759 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Used for PHI nodes + ;} + break; + + case 290: +#line 2759 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Used for PHI nodes if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription()); - yyval.PHIList = new std::list >(); - Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal); - CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); - CHECK_FOR_ERROR - yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB)); - delete yyvsp[-5].TypeVal; - ; - break;} -case 290: -#line 2770 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.PHIList = yyvsp[-6].PHIList; - Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); + (yyval.PHIList) = new std::list >(); + Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); + CHECK_FOR_ERROR + (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + delete (yyvsp[(1) - (6)].TypeVal); + ;} + break; + + case 291: +#line 2770 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); + Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); CHECK_FOR_ERROR - yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); - ; - break;} -case 291: -#line 2780 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + ;} + break; + + case 292: +#line 2780 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); // Used for call and invoke instructions - yyval.ParamList = new ParamList(); - ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal); - yyval.ParamList->push_back(E); - delete yyvsp[-3].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 292: -#line 2791 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.ParamList) = new ParamList(); + ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); + (yyval.ParamList)->push_back(E); + delete (yyvsp[(1) - (4)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 293: +#line 2791 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs - yyval.ParamList = new ParamList(); - ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal); - yyval.ParamList->push_back(E); - CHECK_FOR_ERROR - ; - break;} -case 293: -#line 2799 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.ParamList) = new ParamList(); + ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); + (yyval.ParamList)->push_back(E); + CHECK_FOR_ERROR + ;} + break; + + case 294: +#line 2799 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - yyval.ParamList = yyvsp[-5].ParamList; - ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal); - yyval.ParamList->push_back(E); - delete yyvsp[-3].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 294: -#line 2809 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); + (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); + ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); + (yyval.ParamList)->push_back(E); + delete (yyvsp[(3) - (6)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 295: +#line 2809 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 - yyval.ParamList = yyvsp[-5].ParamList; - ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal); - yyval.ParamList->push_back(E); - CHECK_FOR_ERROR - ; - break;} -case 295: -#line 2816 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ParamList = new ParamList(); ; - break;} -case 296: -#line 2819 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ValueList = new std::vector(); ; - break;} -case 297: -#line 2820 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = yyvsp[-2].ValueList; - yyval.ValueList->push_back(yyvsp[0].ValueVal); + (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); + ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); + (yyval.ParamList)->push_back(E); CHECK_FOR_ERROR - ; - break;} -case 298: -#line 2827 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + ;} + break; + + case 296: +#line 2816 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamList) = new ParamList(); ;} + break; + + case 297: +#line 2819 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ValueList) = new std::vector(); ;} + break; + + case 298: +#line 2820 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); + (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 299: -#line 2831 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 299: +#line 2827 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - ; - break;} -case 300: -#line 2836 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 300: +#line 2831 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; + CHECK_FOR_ERROR + ;} + break; + + case 301: +#line 2836 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && - !isa((*yyvsp[-3].TypeVal).get())) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); + if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && + !isa((*(yyvsp[(2) - (5)].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands"); - Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); CHECK_FOR_ERROR - Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 301: -#line 2852 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[(2) - (5)].TypeVal); + ;} + break; + + case 302: +#line 2852 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - if (!(*yyvsp[-3].TypeVal)->isInteger()) { - if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa(yyvsp[-3].TypeVal->get()) || - !cast(yyvsp[-3].TypeVal->get())->getElementType()->isInteger()) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); + if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { + if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa((yyvsp[(2) - (5)].TypeVal)->get()) || + !cast((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) GEN_ERROR("Logical operator requires integral operands"); } - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 302: -#line 2869 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[(2) - (5)].TypeVal); + ;} + break; + + case 303: +#line 2869 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - if (isa((*yyvsp[-3].TypeVal).get())) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); + if (isa((*(yyvsp[(3) - (6)].TypeVal)).get())) GEN_ERROR("Vector types not supported by icmp instruction"); - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("icmp operator returned null"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 303: -#line 2883 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[(3) - (6)].TypeVal); + ;} + break; + + case 304: +#line 2883 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); - if (isa((*yyvsp[-3].TypeVal).get())) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); + if (isa((*(yyvsp[(3) - (6)].TypeVal)).get())) GEN_ERROR("Vector types not supported by fcmp instruction"); - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("fcmp operator returned null"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 304: -#line 2897 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[(3) - (6)].TypeVal); + ;} + break; + + case 305: +#line 2897 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); - Value* Val = yyvsp[-2].ValueVal; - const Type* DestTy = yyvsp[0].TypeVal->get(); - if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy)) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); + Value* Val = (yyvsp[(2) - (4)].ValueVal); + const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); + if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) GEN_ERROR("invalid cast opcode for cast from '" + Val->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); - yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy); - delete yyvsp[0].TypeVal; - ; - break;} -case 305: -#line 2909 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty) + (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); + delete (yyvsp[(4) - (4)].TypeVal); + ;} + break; + + case 306: +#line 2909 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); - if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) + if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) GEN_ERROR("select value types should match"); - yyval.InstVal = SelectInst::Create(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 306: -#line 2917 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 307: +#line 2917 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); - yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 307: -#line 2924 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); + (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); + delete (yyvsp[(4) - (4)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 308: +#line 2924 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); - yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 308: -#line 2930 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 309: +#line 2930 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); - yyval.InstVal = InsertElementInst::Create(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 309: -#line 2936 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 310: +#line 2936 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); - yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 310: -#line 2942 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const Type *Ty = yyvsp[0].PHIList->front().first->getType(); + ;} + break; + + case 311: +#line 2942 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) GEN_ERROR("PHI node operands must be of first class type"); - yyval.InstVal = PHINode::Create(Ty); - ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size()); - while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) { - if (yyvsp[0].PHIList->front().first->getType() != Ty) + (yyval.InstVal) = PHINode::Create(Ty); + ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); + while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { + if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) GEN_ERROR("All elements of a PHI node must be of the same type"); - cast(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second); - yyvsp[0].PHIList->pop_front(); + cast((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); + (yyvsp[(2) - (2)].PHIList)->pop_front(); } - delete yyvsp[0].PHIList; // Free the list... + delete (yyvsp[(2) - (2)].PHIList); // Free the list... CHECK_FOR_ERROR - ; - break;} -case 311: -#line 2958 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 312: +#line 2958 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast(yyvsp[-5].TypeVal->get())) || + if (!(PFTy = dyn_cast((yyvsp[(3) - (8)].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = yyvsp[-2].ParamList->begin(), E = yyvsp[-2].ParamList->end(); + ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); } - Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false); + Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR // Check for call to invalid intrinsic to avoid crashing later. @@ -5074,11 +6199,11 @@ // Set up the ParamAttrs for the function SmallVector Attrs; - if (yyvsp[0].ParamAttrs != ParamAttr::None) - Attrs.push_back(ParamAttrsWithIndex::get(0, yyvsp[0].ParamAttrs)); + if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) + Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs))); // Check the arguments ValueList Args; - if (yyvsp[-2].ParamList->empty()) { // Has no arguments? + if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -5088,7 +6213,7 @@ // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = yyvsp[-2].ParamList->begin(), ArgE = yyvsp[-2].ParamList->end(); + ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -5117,377 +6242,384 @@ // Create the call node CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); - CI->setTailCall(yyvsp[-7].BoolVal); - CI->setCallingConv(yyvsp[-6].UIntVal); + CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); + CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); CI->setParamAttrs(PAL); - yyval.InstVal = CI; - delete yyvsp[-2].ParamList; - delete yyvsp[-5].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 312: -#line 3043 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = yyvsp[0].InstVal; + (yyval.InstVal) = CI; + delete (yyvsp[(6) - (8)].ParamList); + delete (yyvsp[(3) - (8)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 313: -#line 3048 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + ;} + break; + + case 313: +#line 3043 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR - ; - break;} -case 314: -#line 3052 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 314: +#line 3048 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - ; - break;} -case 315: -#line 3059 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 315: +#line 3052 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; + CHECK_FOR_ERROR + ;} + break; + + case 316: +#line 3059 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 316: -#line 3066 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); + (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); + delete (yyvsp[(2) - (3)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 317: +#line 3066 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); + Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; - ; - break;} -case 317: -#line 3074 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); + delete (yyvsp[(2) - (6)].TypeVal); + ;} + break; + + case 318: +#line 3074 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); - yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 318: -#line 3081 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); + (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); + delete (yyvsp[(2) - (3)].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 319: +#line 3081 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); + Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; - ; - break;} -case 319: -#line 3089 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[0].ValueVal->getType())) + (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); + delete (yyvsp[(2) - (6)].TypeVal); + ;} + break; + + case 320: +#line 3089 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + - yyvsp[0].ValueVal->getType()->getDescription() + ""); - yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); + (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); + (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 320: -#line 3097 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 321: +#line 3097 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - if (!isa(yyvsp[-2].TypeVal->get())) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); + if (!isa((yyvsp[(3) - (5)].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + - (*yyvsp[-2].TypeVal)->getDescription()); - if (!cast(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType()) + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); + if (!cast((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*yyvsp[-2].TypeVal)->getDescription()); - Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); + Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal); - delete yyvsp[-2].TypeVal; - ; - break;} -case 321: -#line 3111 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); + delete (yyvsp[(3) - (5)].TypeVal); + ;} + break; + + case 322: +#line 3111 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - const PointerType *PT = dyn_cast(yyvsp[-2].TypeVal->get()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); + const PointerType *PT = dyn_cast((yyvsp[(5) - (7)].TypeVal)->get()); if (!PT) GEN_ERROR("Can't store to a nonpointer type: " + - (*yyvsp[-2].TypeVal)->getDescription()); + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); const Type *ElTy = PT->getElementType(); - if (ElTy != yyvsp[-4].ValueVal->getType()) - GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() + + if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) + GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'"); - Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); + Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal); - delete yyvsp[-2].TypeVal; - ; - break;} -case 322: -#line 3128 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value *TmpVal = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-2].ValIDVal); - if (!GetResultInst::isValidOperands(TmpVal, yyvsp[0].UInt64Val)) + (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); + delete (yyvsp[(5) - (7)].TypeVal); + ;} + break; + + case 323: +#line 3128 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); + if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) GEN_ERROR("Invalid getresult operands"); - yyval.InstVal = new GetResultInst(TmpVal, yyvsp[0].UInt64Val); - delete yyvsp[-3].TypeVal; + (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val)); + delete (yyvsp[(2) - (5)].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 323: -#line 3136 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 324: +#line 3136 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); - if (!isa(yyvsp[-2].TypeVal->get())) + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); + if (!isa((yyvsp[(2) - (4)].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand"); - if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true)) + if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true)) GEN_ERROR("Invalid getelementptr indices for type '" + - (*yyvsp[-2].TypeVal)->getDescription()+ "'"); - Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); + Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = GetElementPtrInst::Create(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()); - delete yyvsp[-2].TypeVal; - delete yyvsp[0].ValueList; - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif + (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); + delete (yyvsp[(2) - (4)].TypeVal); + delete (yyvsp[(4) - (4)].ValueList); + ;} + break; -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + +/* Line 1267 of yacc.c. */ +#line 6409 "llvmAsmParser.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; -yyerrdefault: /* current state does not do anything special for the error token. */ -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; -yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -#if YYDEBUG != 0 - if (yydebug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); #endif - } - return 1; + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 3153 "/Users/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" + + +#line 3153 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions @@ -5562,3 +6694,4 @@ GenerateError(errMsg); return 0; } + Modified: llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.h.cvs?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.h.cvs Thu Apr 24 10:48:39 2008 @@ -1,4 +1,353 @@ -typedef union { +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ESINT64VAL = 258, + EUINT64VAL = 259, + ESAPINTVAL = 260, + EUAPINTVAL = 261, + LOCALVAL_ID = 262, + GLOBALVAL_ID = 263, + FPVAL = 264, + VOID = 265, + INTTYPE = 266, + FLOAT = 267, + DOUBLE = 268, + X86_FP80 = 269, + FP128 = 270, + PPC_FP128 = 271, + LABEL = 272, + TYPE = 273, + LOCALVAR = 274, + GLOBALVAR = 275, + LABELSTR = 276, + STRINGCONSTANT = 277, + ATSTRINGCONSTANT = 278, + PCTSTRINGCONSTANT = 279, + ZEROINITIALIZER = 280, + TRUETOK = 281, + FALSETOK = 282, + BEGINTOK = 283, + ENDTOK = 284, + DECLARE = 285, + DEFINE = 286, + GLOBAL = 287, + CONSTANT = 288, + SECTION = 289, + ALIAS = 290, + VOLATILE = 291, + THREAD_LOCAL = 292, + TO = 293, + DOTDOTDOT = 294, + NULL_TOK = 295, + UNDEF = 296, + INTERNAL = 297, + LINKONCE = 298, + WEAK = 299, + APPENDING = 300, + DLLIMPORT = 301, + DLLEXPORT = 302, + EXTERN_WEAK = 303, + OPAQUE = 304, + EXTERNAL = 305, + TARGET = 306, + TRIPLE = 307, + ALIGN = 308, + ADDRSPACE = 309, + DEPLIBS = 310, + CALL = 311, + TAIL = 312, + ASM_TOK = 313, + MODULE = 314, + SIDEEFFECT = 315, + CC_TOK = 316, + CCC_TOK = 317, + FASTCC_TOK = 318, + COLDCC_TOK = 319, + X86_STDCALLCC_TOK = 320, + X86_FASTCALLCC_TOK = 321, + DATALAYOUT = 322, + UNWINDS = 323, + RET = 324, + BR = 325, + SWITCH = 326, + INVOKE = 327, + UNWIND = 328, + UNREACHABLE = 329, + ADD = 330, + SUB = 331, + MUL = 332, + UDIV = 333, + SDIV = 334, + FDIV = 335, + UREM = 336, + SREM = 337, + FREM = 338, + AND = 339, + OR = 340, + XOR = 341, + SHL = 342, + LSHR = 343, + ASHR = 344, + ICMP = 345, + FCMP = 346, + EQ = 347, + NE = 348, + SLT = 349, + SGT = 350, + SLE = 351, + SGE = 352, + ULT = 353, + UGT = 354, + ULE = 355, + UGE = 356, + OEQ = 357, + ONE = 358, + OLT = 359, + OGT = 360, + OLE = 361, + OGE = 362, + ORD = 363, + UNO = 364, + UEQ = 365, + UNE = 366, + MALLOC = 367, + ALLOCA = 368, + FREE = 369, + LOAD = 370, + STORE = 371, + GETELEMENTPTR = 372, + TRUNC = 373, + ZEXT = 374, + SEXT = 375, + FPTRUNC = 376, + FPEXT = 377, + BITCAST = 378, + UITOFP = 379, + SITOFP = 380, + FPTOUI = 381, + FPTOSI = 382, + INTTOPTR = 383, + PTRTOINT = 384, + PHI_TOK = 385, + SELECT = 386, + VAARG = 387, + EXTRACTELEMENT = 388, + INSERTELEMENT = 389, + SHUFFLEVECTOR = 390, + GETRESULT = 391, + SIGNEXT = 392, + ZEROEXT = 393, + NORETURN = 394, + INREG = 395, + SRET = 396, + NOUNWIND = 397, + NOALIAS = 398, + BYVAL = 399, + NEST = 400, + READNONE = 401, + READONLY = 402, + GC = 403, + DEFAULT = 404, + HIDDEN = 405, + PROTECTED = 406 + }; +#endif +/* Tokens. */ +#define ESINT64VAL 258 +#define EUINT64VAL 259 +#define ESAPINTVAL 260 +#define EUAPINTVAL 261 +#define LOCALVAL_ID 262 +#define GLOBALVAL_ID 263 +#define FPVAL 264 +#define VOID 265 +#define INTTYPE 266 +#define FLOAT 267 +#define DOUBLE 268 +#define X86_FP80 269 +#define FP128 270 +#define PPC_FP128 271 +#define LABEL 272 +#define TYPE 273 +#define LOCALVAR 274 +#define GLOBALVAR 275 +#define LABELSTR 276 +#define STRINGCONSTANT 277 +#define ATSTRINGCONSTANT 278 +#define PCTSTRINGCONSTANT 279 +#define ZEROINITIALIZER 280 +#define TRUETOK 281 +#define FALSETOK 282 +#define BEGINTOK 283 +#define ENDTOK 284 +#define DECLARE 285 +#define DEFINE 286 +#define GLOBAL 287 +#define CONSTANT 288 +#define SECTION 289 +#define ALIAS 290 +#define VOLATILE 291 +#define THREAD_LOCAL 292 +#define TO 293 +#define DOTDOTDOT 294 +#define NULL_TOK 295 +#define UNDEF 296 +#define INTERNAL 297 +#define LINKONCE 298 +#define WEAK 299 +#define APPENDING 300 +#define DLLIMPORT 301 +#define DLLEXPORT 302 +#define EXTERN_WEAK 303 +#define OPAQUE 304 +#define EXTERNAL 305 +#define TARGET 306 +#define TRIPLE 307 +#define ALIGN 308 +#define ADDRSPACE 309 +#define DEPLIBS 310 +#define CALL 311 +#define TAIL 312 +#define ASM_TOK 313 +#define MODULE 314 +#define SIDEEFFECT 315 +#define CC_TOK 316 +#define CCC_TOK 317 +#define FASTCC_TOK 318 +#define COLDCC_TOK 319 +#define X86_STDCALLCC_TOK 320 +#define X86_FASTCALLCC_TOK 321 +#define DATALAYOUT 322 +#define UNWINDS 323 +#define RET 324 +#define BR 325 +#define SWITCH 326 +#define INVOKE 327 +#define UNWIND 328 +#define UNREACHABLE 329 +#define ADD 330 +#define SUB 331 +#define MUL 332 +#define UDIV 333 +#define SDIV 334 +#define FDIV 335 +#define UREM 336 +#define SREM 337 +#define FREM 338 +#define AND 339 +#define OR 340 +#define XOR 341 +#define SHL 342 +#define LSHR 343 +#define ASHR 344 +#define ICMP 345 +#define FCMP 346 +#define EQ 347 +#define NE 348 +#define SLT 349 +#define SGT 350 +#define SLE 351 +#define SGE 352 +#define ULT 353 +#define UGT 354 +#define ULE 355 +#define UGE 356 +#define OEQ 357 +#define ONE 358 +#define OLT 359 +#define OGT 360 +#define OLE 361 +#define OGE 362 +#define ORD 363 +#define UNO 364 +#define UEQ 365 +#define UNE 366 +#define MALLOC 367 +#define ALLOCA 368 +#define FREE 369 +#define LOAD 370 +#define STORE 371 +#define GETELEMENTPTR 372 +#define TRUNC 373 +#define ZEXT 374 +#define SEXT 375 +#define FPTRUNC 376 +#define FPEXT 377 +#define BITCAST 378 +#define UITOFP 379 +#define SITOFP 380 +#define FPTOUI 381 +#define FPTOSI 382 +#define INTTOPTR 383 +#define PTRTOINT 384 +#define PHI_TOK 385 +#define SELECT 386 +#define VAARG 387 +#define EXTRACTELEMENT 388 +#define INSERTELEMENT 389 +#define SHUFFLEVECTOR 390 +#define GETRESULT 391 +#define SIGNEXT 392 +#define ZEROEXT 393 +#define NORETURN 394 +#define INREG 395 +#define SRET 396 +#define NOUNWIND 397 +#define NOALIAS 398 +#define BYVAL 399 +#define NEST 400 +#define READNONE 401 +#define READONLY 402 +#define GC 403 +#define DEFAULT 404 +#define HIDDEN 405 +#define PROTECTED 406 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 950 "/home/ggreif/llvm/lib/AsmParser/llvmAsmParser.y" +{ llvm::Module *ModuleVal; llvm::Function *FunctionVal; llvm::BasicBlock *BasicBlockVal; @@ -43,156 +392,14 @@ llvm::Instruction::OtherOps OtherOpVal; llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; -} YYSTYPE; -#define ESINT64VAL 257 -#define EUINT64VAL 258 -#define ESAPINTVAL 259 -#define EUAPINTVAL 260 -#define LOCALVAL_ID 261 -#define GLOBALVAL_ID 262 -#define FPVAL 263 -#define VOID 264 -#define INTTYPE 265 -#define FLOAT 266 -#define DOUBLE 267 -#define X86_FP80 268 -#define FP128 269 -#define PPC_FP128 270 -#define LABEL 271 -#define TYPE 272 -#define LOCALVAR 273 -#define GLOBALVAR 274 -#define LABELSTR 275 -#define STRINGCONSTANT 276 -#define ATSTRINGCONSTANT 277 -#define PCTSTRINGCONSTANT 278 -#define ZEROINITIALIZER 279 -#define TRUETOK 280 -#define FALSETOK 281 -#define BEGINTOK 282 -#define ENDTOK 283 -#define DECLARE 284 -#define DEFINE 285 -#define GLOBAL 286 -#define CONSTANT 287 -#define SECTION 288 -#define ALIAS 289 -#define VOLATILE 290 -#define THREAD_LOCAL 291 -#define TO 292 -#define DOTDOTDOT 293 -#define NULL_TOK 294 -#define UNDEF 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define EXTERNAL 304 -#define TARGET 305 -#define TRIPLE 306 -#define ALIGN 307 -#define ADDRSPACE 308 -#define DEPLIBS 309 -#define CALL 310 -#define TAIL 311 -#define ASM_TOK 312 -#define MODULE 313 -#define SIDEEFFECT 314 -#define CC_TOK 315 -#define CCC_TOK 316 -#define FASTCC_TOK 317 -#define COLDCC_TOK 318 -#define X86_STDCALLCC_TOK 319 -#define X86_FASTCALLCC_TOK 320 -#define DATALAYOUT 321 -#define UNWINDS 322 -#define RET 323 -#define BR 324 -#define SWITCH 325 -#define INVOKE 326 -#define UNWIND 327 -#define UNREACHABLE 328 -#define ADD 329 -#define SUB 330 -#define MUL 331 -#define UDIV 332 -#define SDIV 333 -#define FDIV 334 -#define UREM 335 -#define SREM 336 -#define FREM 337 -#define AND 338 -#define OR 339 -#define XOR 340 -#define SHL 341 -#define LSHR 342 -#define ASHR 343 -#define ICMP 344 -#define FCMP 345 -#define EQ 346 -#define NE 347 -#define SLT 348 -#define SGT 349 -#define SLE 350 -#define SGE 351 -#define ULT 352 -#define UGT 353 -#define ULE 354 -#define UGE 355 -#define OEQ 356 -#define ONE 357 -#define OLT 358 -#define OGT 359 -#define OLE 360 -#define OGE 361 -#define ORD 362 -#define UNO 363 -#define UEQ 364 -#define UNE 365 -#define MALLOC 366 -#define ALLOCA 367 -#define FREE 368 -#define LOAD 369 -#define STORE 370 -#define GETELEMENTPTR 371 -#define TRUNC 372 -#define ZEXT 373 -#define SEXT 374 -#define FPTRUNC 375 -#define FPEXT 376 -#define BITCAST 377 -#define UITOFP 378 -#define SITOFP 379 -#define FPTOUI 380 -#define FPTOSI 381 -#define INTTOPTR 382 -#define PTRTOINT 383 -#define PHI_TOK 384 -#define SELECT 385 -#define VAARG 386 -#define EXTRACTELEMENT 387 -#define INSERTELEMENT 388 -#define SHUFFLEVECTOR 389 -#define GETRESULT 390 -#define SIGNEXT 391 -#define ZEROEXT 392 -#define NORETURN 393 -#define INREG 394 -#define SRET 395 -#define NOUNWIND 396 -#define NOALIAS 397 -#define BYVAL 398 -#define NEST 399 -#define READNONE 400 -#define READONLY 401 -#define GC 402 -#define DEFAULT 403 -#define HIDDEN 404 -#define PROTECTED 405 - +} +/* Line 1489 of yacc.c. */ +#line 398 "llvmAsmParser.tab.h" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif extern YYSTYPE llvmAsmlval; + Modified: llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y Thu Apr 24 10:48:39 2008 @@ -495,7 +495,7 @@ if (const FunctionType *FTy = dyn_cast(ElTy)) V = Function::Create(FTy, GlobalValue::ExternalLinkage); else - V = GlobalVariable::Create(ElTy, false, GlobalValue::ExternalLinkage, 0, "", + V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", (Module*)0, false, PTy->getAddressSpace()); break; } @@ -784,7 +784,7 @@ // Otherwise there is no existing GV to use, create one now. GlobalVariable *GV = - GlobalVariable::Create(Ty, isConstantGlobal, Linkage, Initializer, Name, + new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, CurModule.CurrentModule, IsThreadLocal, AddressSpace); GV->setVisibility(Visibility); InsertValue(GV, CurModule.Values); @@ -1782,7 +1782,7 @@ GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name, CurModule.CurrentModule); } else { - GV = GlobalVariable::Create(PT->getElementType(), false, + GV = new GlobalVariable(PT->getElementType(), false, GlobalValue::ExternalWeakLinkage, 0, Name, CurModule.CurrentModule); } Modified: llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y.cvs?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/branches/ggreif/use-diet/lib/AsmParser/llvmAsmParser.y.cvs Thu Apr 24 10:48:39 2008 @@ -496,7 +496,7 @@ V = Function::Create(FTy, GlobalValue::ExternalLinkage); else V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", - (Module*)0, false, PTy->getAddressSpace()); + (Module*)0, false, PTy->getAddressSpace()); break; } default: @@ -785,7 +785,7 @@ // Otherwise there is no existing GV to use, create one now. GlobalVariable *GV = new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, - CurModule.CurrentModule, IsThreadLocal, AddressSpace); + CurModule.CurrentModule, IsThreadLocal, AddressSpace); GV->setVisibility(Visibility); InsertValue(GV, CurModule.Values); return GV; @@ -1783,8 +1783,8 @@ CurModule.CurrentModule); } else { GV = new GlobalVariable(PT->getElementType(), false, - GlobalValue::ExternalWeakLinkage, 0, - Name, CurModule.CurrentModule); + GlobalValue::ExternalWeakLinkage, 0, + Name, CurModule.CurrentModule); } // Keep track of the fact that we have a forward ref to recycle it Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Thu Apr 24 10:48:39 2008 @@ -1055,7 +1055,7 @@ isThreadLocal = Record[7]; GlobalVariable *NewGV = - GlobalVariable::Create(Ty, isConstant, Linkage, 0, "", TheModule, + new GlobalVariable(Ty, isConstant, Linkage, 0, "", TheModule, isThreadLocal, AddressSpace); NewGV->setAlignment(Alignment); if (!Section.empty()) Modified: llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp Thu Apr 24 10:48:39 2008 @@ -337,7 +337,7 @@ } Constant *CA = ConstantArray::get(AT, ArrayElements); - GlobalVariable *CAGV = GlobalVariable::Create(AT, true, + GlobalVariable *CAGV = new GlobalVariable(AT, true, GlobalValue::InternalLinkage, CA, "llvm.dbg.array", SR.getModule()); @@ -1333,7 +1333,7 @@ // Construct string as an llvm constant. Constant *ConstStr = ConstantArray::get(String); // Otherwise create and return a new string global. - GlobalVariable *StrGV = GlobalVariable::Create(ConstStr->getType(), true, + GlobalVariable *StrGV = new GlobalVariable(ConstStr->getType(), true, GlobalVariable::InternalLinkage, ConstStr, ".str", M); StrGV->setSection("llvm.metadata"); @@ -1357,11 +1357,11 @@ const StructType *Ty = getTagType(DD); // Create the GlobalVariable early to prevent infinite recursion. - GlobalVariable *GV = GlobalVariable::Create(Ty, true, DD->getLinkage(), + GlobalVariable *GV = new GlobalVariable(Ty, true, DD->getLinkage(), NULL, DD->getDescString(), M); GV->setSection("llvm.metadata"); - // Insert GlobalVariable::Create in DescGlobals map. + // Insert new GlobalVariable in DescGlobals map. Slot = GV; // Set up elements vector Modified: llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp Thu Apr 24 10:48:39 2008 @@ -229,7 +229,7 @@ // to be a ModulePass (which means it cannot be in the 'llc' pipeline // (which uses a FunctionPassManager (which segfaults (not asserts) if // provided a ModulePass))). - Constant *GV = GlobalVariable::Create(FrameMap->getType(), true, + Constant *GV = new GlobalVariable(FrameMap->getType(), true, GlobalVariable::InternalLinkage, FrameMap, "__gc_" + F.getName(), F.getParent()); @@ -292,7 +292,7 @@ if (!Head) { // If the root chain does not exist, insert a new one with linkonce // linkage! - Head = GlobalVariable::Create(StackEntryPtrTy, false, + Head = new GlobalVariable(StackEntryPtrTy, false, GlobalValue::LinkOnceLinkage, Constant::getNullValue(StackEntryPtrTy), "llvm_gc_root_chain", &M); Modified: llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp Thu Apr 24 10:48:39 2008 @@ -499,7 +499,7 @@ // symbol over in the dest module... the initializer will be filled in // later by LinkGlobalInits... GlobalVariable *NewDGV = - GlobalVariable::Create(SGV->getType()->getElementType(), + new GlobalVariable(SGV->getType()->getElementType(), SGV->isConstant(), SGV->getLinkage(), /*init*/0, SGV->getName(), Dest); // Propagate alignment, visibility and section info. @@ -523,7 +523,7 @@ // AppendingVars map. The name is cleared out so that no linkage is // performed. GlobalVariable *NewDGV = - GlobalVariable::Create(SGV->getType()->getElementType(), + new GlobalVariable(SGV->getType()->getElementType(), SGV->isConstant(), SGV->getLinkage(), /*init*/0, "", Dest); @@ -558,7 +558,7 @@ // DGV and create a new one of the appropriate type. if (SGV->getType() != DGVar->getType()) { GlobalVariable *NewDGV = - GlobalVariable::Create(SGV->getType()->getElementType(), + new GlobalVariable(SGV->getType()->getElementType(), DGVar->isConstant(), DGVar->getLinkage(), /*init*/0, DGVar->getName(), Dest); CopyGVAttributes(NewDGV, DGVar); @@ -1034,7 +1034,7 @@ // Create the new global variable... GlobalVariable *NG = - GlobalVariable::Create(NewType, G1->isConstant(), G1->getLinkage(), + new GlobalVariable(NewType, G1->isConstant(), G1->getLinkage(), /*init*/0, First->first, M, G1->isThreadLocal()); // Propagate alignment, visibility and section info. Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp Thu Apr 24 10:48:39 2008 @@ -106,7 +106,7 @@ } ArrayType *AT = ArrayType::get(SBP, AUGs.size()); Constant *Init = ConstantArray::get(AT, AUGs); - GlobalValue *gv = GlobalVariable::Create(AT, false, + GlobalValue *gv = new GlobalVariable(AT, false, GlobalValue::AppendingLinkage, Init, "llvm.used", &M); gv->setSection("llvm.metadata"); Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp Thu Apr 24 10:48:39 2008 @@ -473,7 +473,7 @@ Constant *In = getAggregateConstantElement(Init, ConstantInt::get(Type::Int32Ty, i)); assert(In && "Couldn't get element of initializer?"); - GlobalVariable *NGV = GlobalVariable::Create(STy->getElementType(i), false, + GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false, GlobalVariable::InternalLinkage, In, GV->getName()+"."+utostr(i), (Module *)NULL, @@ -498,7 +498,7 @@ ConstantInt::get(Type::Int32Ty, i)); assert(In && "Couldn't get element of initializer?"); - GlobalVariable *NGV = GlobalVariable::Create(STy->getElementType(), false, + GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false, GlobalVariable::InternalLinkage, In, GV->getName()+"."+utostr(i), (Module *)NULL, @@ -799,7 +799,7 @@ // Create the new global variable. The contents of the malloc'd memory is // undefined, so initialize with an undef value. Constant *Init = UndefValue::get(MI->getAllocatedType()); - GlobalVariable *NewGV = GlobalVariable::Create(MI->getAllocatedType(), false, + GlobalVariable *NewGV = new GlobalVariable(MI->getAllocatedType(), false, GlobalValue::InternalLinkage, Init, GV->getName()+".body", (Module *)NULL, @@ -817,7 +817,7 @@ // If there is a comparison against null, we will insert a global bool to // keep track of whether the global was initialized yet or not. GlobalVariable *InitBool = - GlobalVariable::Create(Type::Int1Ty, false, GlobalValue::InternalLinkage, + new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage, ConstantInt::getFalse(), GV->getName()+".init", (Module *)NULL, GV->isThreadLocal()); bool InitBoolUsed = false; @@ -1132,7 +1132,7 @@ const Type *PFieldTy = PointerType::getUnqual(FieldTy); GlobalVariable *NGV = - GlobalVariable::Create(PFieldTy, false, GlobalValue::InternalLinkage, + new GlobalVariable(PFieldTy, false, GlobalValue::InternalLinkage, Constant::getNullValue(PFieldTy), GV->getName() + ".f" + utostr(FieldNo), GV, GV->isThreadLocal()); @@ -1356,7 +1356,7 @@ DOUT << " *** SHRINKING TO BOOL: " << *GV; // Create the new global, initializing it to false. - GlobalVariable *NewGV = GlobalVariable::Create(Type::Int1Ty, false, + GlobalVariable *NewGV = new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage, ConstantInt::getFalse(), GV->getName()+".b", (Module *)NULL, @@ -1754,7 +1754,7 @@ } // Create the new global and insert it next to the existing list. - GlobalVariable *NGV = GlobalVariable::Create(CA->getType(), GCL->isConstant(), + GlobalVariable *NGV = new GlobalVariable(CA->getType(), GCL->isConstant(), GCL->getLinkage(), CA, "", (Module *)NULL, GCL->isThreadLocal()); @@ -1992,7 +1992,7 @@ } else if (AllocaInst *AI = dyn_cast(CurInst)) { if (AI->isArrayAllocation()) return false; // Cannot handle array allocs. const Type *Ty = AI->getType()->getElementType(); - AllocaTmps.push_back(GlobalVariable::Create(Ty, false, + AllocaTmps.push_back(new GlobalVariable(Ty, false, GlobalValue::InternalLinkage, UndefValue::get(Ty), AI->getName())); Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp Thu Apr 24 10:48:39 2008 @@ -1232,7 +1232,7 @@ // pass to be run after this pass, to merge duplicate strings. FormatStr.erase(FormatStr.end()-1); Constant *Init = ConstantArray::get(FormatStr, true); - Constant *GV = GlobalVariable::Create(Init->getType(), true, + Constant *GV = new GlobalVariable(Init->getType(), true, GlobalVariable::InternalLinkage, Init, "str", CI->getParent()->getParent()->getParent()); Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp Thu Apr 24 10:48:39 2008 @@ -64,7 +64,7 @@ const Type *ATy = ArrayType::get(Type::Int32Ty, NumFunctions); GlobalVariable *Counters = - GlobalVariable::Create(ATy, false, GlobalValue::InternalLinkage, + new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "FuncProfCounters", &M); // Instrument all of the functions... @@ -109,7 +109,7 @@ const Type *ATy = ArrayType::get(Type::Int32Ty, NumBlocks); GlobalVariable *Counters = - GlobalVariable::Create(ATy, false, GlobalValue::InternalLinkage, + new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "BlockProfCounters", &M); // Instrument all of the blocks... Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp Thu Apr 24 10:48:39 2008 @@ -65,7 +65,7 @@ const Type *ATy = ArrayType::get(Type::Int32Ty, NumEdges); GlobalVariable *Counters = - GlobalVariable::Create(ATy, false, GlobalValue::InternalLinkage, + new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "EdgeProfCounters", &M); // Instrument all of the edges... Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp Thu Apr 24 10:48:39 2008 @@ -193,7 +193,7 @@ uint64_t resetval) : T(t) { ConstantInt* Init = ConstantInt::get(T, resetval); ResetValue = Init; - Counter = GlobalVariable::Create(T, false, GlobalValue::InternalLinkage, + Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage, Init, "RandomSteeringCounter", &M); } @@ -230,7 +230,7 @@ : AI(0), T(t) { ConstantInt* Init = ConstantInt::get(T, resetval); ResetValue = Init; - Counter = GlobalVariable::Create(T, false, GlobalValue::InternalLinkage, + Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage, Init, "RandomSteeringCounter", &M); } Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp Thu Apr 24 10:48:39 2008 @@ -56,7 +56,7 @@ // for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) - ValueMap[I] = GlobalVariable::Create(I->getType()->getElementType(), false, + ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false, GlobalValue::ExternalLinkage, 0, I->getName(), New); Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp Thu Apr 24 10:48:39 2008 @@ -138,7 +138,7 @@ // Now that we've done that, insert the jmpbuf list head global, unless it // already exists. if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) { - JBListHead = GlobalVariable::Create(PtrJBList, false, + JBListHead = new GlobalVariable(PtrJBList, false, GlobalValue::LinkOnceLinkage, Constant::getNullValue(PtrJBList), "llvm.sjljeh.jblist", &M); @@ -166,7 +166,7 @@ ConstantArray::get("ERROR: Exception thrown, but not caught!\n"); AbortMessageLength = Msg->getNumOperands()-1; // don't include \0 - GlobalVariable *MsgGV = GlobalVariable::Create(Msg->getType(), true, + GlobalVariable *MsgGV = new GlobalVariable(Msg->getType(), true, GlobalValue::InternalLinkage, Msg, "abortmsg", M); std::vector GEPIdx(2, Constant::getNullValue(Type::Int32Ty)); @@ -179,7 +179,7 @@ " program with -enable-correct-eh-support.\n"); AbortMessageLength = Msg->getNumOperands()-1; // don't include \0 - GlobalVariable *MsgGV = GlobalVariable::Create(Msg->getType(), true, + GlobalVariable *MsgGV = new GlobalVariable(Msg->getType(), true, GlobalValue::InternalLinkage, Msg, "abortmsg", M); std::vector GEPIdx(2, Constant::getNullValue(Type::Int32Ty)); Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp Thu Apr 24 10:48:39 2008 @@ -592,7 +592,7 @@ /*--.. Operations on global variables ......................................--*/ LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name) { - return wrap(GlobalVariable::Create(unwrap(Ty), false, + return wrap(new GlobalVariable(unwrap(Ty), false, GlobalValue::ExternalLinkage, 0, Name, unwrap(M))); } Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp Thu Apr 24 10:48:39 2008 @@ -38,7 +38,7 @@ return Ret; } GlobalVariable *ilist_traits::createSentinel() { - GlobalVariable *Ret = GlobalVariable::Create(Type::Int32Ty, false, + GlobalVariable *Ret = new GlobalVariable(Type::Int32Ty, false, GlobalValue::ExternalLinkage); // This should not be garbage monitored. LeakDetector::removeGarbageObject(Ret); Modified: llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp Thu Apr 24 10:48:39 2008 @@ -233,7 +233,7 @@ GV->eraseFromParent(); if (!M1Tors.empty()) { Constant *M1Init = GetTorInit(M1Tors); - GlobalVariable::Create(M1Init->getType(), false, GlobalValue::AppendingLinkage, + new GlobalVariable(M1Init->getType(), false, GlobalValue::AppendingLinkage, M1Init, GlobalName, M1); } @@ -244,7 +244,7 @@ GV->eraseFromParent(); if (!M2Tors.empty()) { Constant *M2Init = GetTorInit(M2Tors); - GlobalVariable::Create(M2Init->getType(), false, GlobalValue::AppendingLinkage, + new GlobalVariable(M2Init->getType(), false, GlobalValue::AppendingLinkage, M2Init, GlobalName, M2); } } Modified: llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp Thu Apr 24 10:48:39 2008 @@ -693,7 +693,7 @@ // 1. Add a string constant with its name to the global file Constant *InitArray = ConstantArray::get(F->getName()); GlobalVariable *funcName = - GlobalVariable::Create(InitArray->getType(), true /*isConstant*/, + new GlobalVariable(InitArray->getType(), true /*isConstant*/, GlobalValue::InternalLinkage, InitArray, F->getName() + "_name", Safe); @@ -712,7 +712,7 @@ // Create a new global to hold the cached function pointer. Constant *NullPtr = ConstantPointerNull::get(F->getType()); GlobalVariable *Cache = - GlobalVariable::Create(F->getType(), false,GlobalValue::InternalLinkage, + new GlobalVariable(F->getType(), false,GlobalValue::InternalLinkage, NullPtr,F->getName()+".fpcache", F->getParent()); // Construct a new stub function that will re-route calls to F Modified: llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp?rev=50211&r1=50210&r2=50211&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp (original) +++ llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp Thu Apr 24 10:48:39 2008 @@ -989,7 +989,7 @@ nl(Out) << "if (!" << getCppName(GV) << ") {"; in(); nl(Out) << getCppName(GV); } - Out << " = GlobalVariable::Create("; + Out << " = new GlobalVariable("; nl(Out) << "/*Type=*/"; printCppName(GV->getType()->getElementType()); Out << ","; @@ -1083,7 +1083,7 @@ switch (I->getOpcode()) { case Instruction::Ret: { const ReturnInst* ret = cast(I); - Out << "new ReturnInst(" + Out << "ReturnInst::Create(" << (ret->getReturnValue() ? opNames[0] + ", " : "") From ggreif at gmail.com Thu Apr 24 11:17:27 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 24 Apr 2008 16:17:27 -0000 Subject: [llvm-commits] [llvm] r50212 - /llvm/trunk/test/Transforms/JumpThreading/ Message-ID: <200804241617.m3OGHRtC012734@zion.cs.uiuc.edu> Author: ggreif Date: Thu Apr 24 11:17:27 2008 New Revision: 50212 URL: http://llvm.org/viewvc/llvm-project?rev=50212&view=rev Log: overlook Output directory Modified: llvm/trunk/test/Transforms/JumpThreading/ (props changed) Propchange: llvm/trunk/test/Transforms/JumpThreading/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Apr 24 11:17:27 2008 @@ -0,0 +1 @@ +Output From arnold.schwaighofer at gmail.com Thu Apr 24 12:38:50 2008 From: arnold.schwaighofer at gmail.com (Arnold Schwaighofer) Date: Thu, 24 Apr 2008 19:38:50 +0200 Subject: [llvm-commits] Tailcall PowerPC patch + refactoring Message-ID: See discussion in thread http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-April/014071.html. -------------- next part -------------- A non-text attachment was scrubbed... Name: r50212-refactored-ppc-tc.patch Type: application/octet-stream Size: 82666 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080424/25d69965/attachment.obj From dpatel at apple.com Thu Apr 24 12:48:02 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Apr 2008 17:48:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50215 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h config/i386/llvm-i386.cpp llvm-abi.h Message-ID: <200804241748.m3OHm3Rj015612@zion.cs.uiuc.edu> Author: dpatel Date: Thu Apr 24 12:48:02 2008 New Revision: 50215 URL: http://llvm.org/viewvc/llvm-project?rev=50215&view=rev Log: Remove dead code. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.2/trunk/gcc/llvm-abi.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=50215&r1=50214&r2=50215&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu Apr 24 12:48:02 2008 @@ -114,15 +114,6 @@ extern const Type *llvm_x86_aggr_type_for_struct_return(tree type); -/* LLVM_BUILD_MULTIPLE_RETURN_VALUE - Build multiple return values - for the function FN and add them in RETVALS. */ -#define LLVM_BUILD_MULTIPLE_RETURN_VALUE(Fn,R,RetVals,B) \ - llvm_x86_build_multiple_return_value((Fn),(R),(RetVals),(B)) - -extern void llvm_x86_build_multiple_return_value(Function *, Value *, - SmallVectorImpl &, - IRBuilder &); - /* LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from SRC and assign it to DEST. */ #define LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Src,Dest,V,B) \ Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50215&r1=50214&r2=50215&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu Apr 24 12:48:02 2008 @@ -1121,131 +1121,6 @@ } -// llvm_x86_build_multiple_return_value - Function FN returns multiple value -// where RETVAL points to the aggregate being returned. Build a RETVALS vector -// of individual values from RETVAL aggregate. RETVALS will be used by -// the client to build multiple value return instruction. -void llvm_x86_build_multiple_return_value(Function *Fn, Value *RetVal, - SmallVectorImpl &RetVals, - IRBuilder &Builder) { - const StructType *STy = cast(Fn->getReturnType()); - const PointerType *PTy = cast(RetVal->getType()); - const StructType *RetSTy = cast(PTy->getElementType()); - - llvm::Value *Idxs[3]; - Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv_gep"); - Value *E = Builder.CreateLoad(GEP, "mrv"); - Value *R = Builder.CreateBitCast(E, STy->getElementType(0), "tmp"); - - - - - // Walk RetSTy elements and populate RetVals vector. Note, STy and RetSTy - // may not match. For example, when STy is { <2 x float> } the RetSTy is - // { float[2]; } - unsigned NumElements = RetSTy->getNumElements(); - unsigned RNO = 0; - unsigned SNO = 0; - - if (NumElements == 3 - && RetSTy->getElementType(0)->getTypeID() == Type::FloatTyID - && RetSTy->getElementType(1)->getTypeID() == Type::FloatTyID - && RetSTy->getElementType(2)->getTypeID() == Type::FloatTyID) { - Value *GEP0 = Builder.CreateStructGEP(RetVal, 0, "mrv_idx"); - Value *ElemVal0 = Builder.CreateLoad(GEP0, "mrv"); - Value *GEP1 = Builder.CreateStructGEP(RetVal, 1, "mrv_idx"); - Value *ElemVal1 = Builder.CreateLoad(GEP1, "mrv"); - Value *GEP2 = Builder.CreateStructGEP(RetVal, 2, "mrv_idx"); - Value *ElemVal2 = Builder.CreateLoad(GEP2, "mrv"); - - Value *R = Constant::getNullValue(STy->getElementType(0)); - R = Builder.CreateInsertElement(R, ElemVal0, - ConstantInt::get(llvm::Type::Int32Ty, 0), - "mrv.f."); - R = Builder.CreateInsertElement(R, ElemVal1, - ConstantInt::get(llvm::Type::Int32Ty, 1), - "mrv.f."); - RetVals.push_back(R); - RetVals.push_back(ElemVal2); - return; - } - - while (RNO < NumElements) { - const Type *ElemType = RetSTy->getElementType(RNO); - if (ElemType->isFirstClassType()) { - Value *GEP = Builder.CreateStructGEP(RetVal, RNO, "mrv_idx"); - Value *ElemVal = Builder.CreateLoad(GEP, "mrv"); - RetVals.push_back(ElemVal); - ++RNO; - ++SNO; - continue; - } - - // Special treatement for _Complex. - if (const StructType *ComplexType = dyn_cast(ElemType)) { - llvm::Value *Idxs[3]; - Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, RNO); - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv_gep"); - RetVals.push_back(Builder.CreateLoad(GEP, "mrv")); - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, 1); - GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv_gep"); - RetVals.push_back(Builder.CreateLoad(GEP, "mrv")); - ++RNO; - ++SNO; - continue; - } - const ArrayType *ATy = cast(ElemType); - unsigned ArraySize = ATy->getNumElements(); - // AElemNo keeps track of array elements. This may not match index (VElemNo) - // that tracks vector elements when Src field type is VectorType.. - unsigned AElemNo = 0; - while (AElemNo < ArraySize) { - const Type *SElemTy = STy->getElementType(SNO); - if (const VectorType *SVElemTy = dyn_cast(SElemTy)) { - llvm::Value *Idxs[3]; - Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, RNO); - Value *R = Constant::getNullValue(SElemTy); - unsigned VElemNo = 0; - unsigned Size = AElemNo + SVElemTy->getNumElements(); - - // Only first two elements from <4 x float> are used, for example float[4] is - // transformed into two <4 x float> vectors. - if (SVElemTy->getElementType()->getTypeID() == Type::FloatTyID - && Size == 4) - Size = AElemNo + 2; - while (AElemNo < Size) { - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, AElemNo); - Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv.av.gep"); - Value *ElemVal = Builder.CreateLoad(GEP, "mrv"); - R = Builder.CreateInsertElement(R, ElemVal, - ConstantInt::get(llvm::Type::Int32Ty, VElemNo++), - "mrv.av."); - AElemNo++; - } - RetVals.push_back(R); - } else { - llvm::Value *Idxs[3]; - Idxs[0] = ConstantInt::get(llvm::Type::Int32Ty, 0); - Idxs[1] = ConstantInt::get(llvm::Type::Int32Ty, RNO); - Idxs[2] = ConstantInt::get(llvm::Type::Int32Ty, AElemNo++); - Value *GEP = Builder.CreateGEP(RetVal, Idxs, Idxs+3, "mrv.a.gep"); - Value *R = Builder.CreateLoad(GEP, "mrv.a"); - RetVals.push_back(R); - } - // Next Src field. - ++SNO; - } - // Finished building this array field. - RNO++; - } -} - // llvm_x86_extract_mrv_array_element - Helper function that help extract // an array element from multiple return value. // Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=50215&r1=50214&r2=50215&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu Apr 24 12:48:02 2008 @@ -307,20 +307,6 @@ getLLVMAggregateTypeForStructReturn(X) #endif -// LLVM_BUILD_MULTIPLE_RETURN_VALUE - Build multiple return values -// for the function FN and add them in RETVALS. Each target that -// supports multiple return value must implement this hook. -#ifndef LLVM_BUILD_MULTIPLE_RETURN_VALUE -#define LLVM_BUILD_MULTIPLE_RETURN_VALUE(Fn,R,RetVals,B) \ - llvm_default_build_multiple_return_value((Fn),(R),(RetVals),(B)) -#endif - -static void llvm_default_build_multiple_return_value(Function *F, Value *RetVal, - SmallVectorImpl &RetVals, - IRBuilder &Builder) { - assert (0 && "LLVM_BUILD_MULTIPLE_RETURN_VALUE is not implemented!"); -} - // LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from // SRC and assign it to DEST. Each target that supports multiple return // value must implement this hook. From dpatel at apple.com Thu Apr 24 12:54:25 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Apr 2008 17:54:25 -0000 Subject: [llvm-commits] [llvm] r50216 - /llvm/trunk/test/Makefile Message-ID: <200804241754.m3OHsPLf015908@zion.cs.uiuc.edu> Author: dpatel Date: Thu Apr 24 12:54:25 2008 New Revision: 50216 URL: http://llvm.org/viewvc/llvm-project?rev=50216&view=rev Log: Add EXTRA_OPTIONS on the llvmgcc command line. Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=50216&r1=50215&r2=50216&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Thu Apr 24 12:54:25 2008 @@ -98,7 +98,7 @@ @echo 'set compile_c "$(CC) $(CPP.Flags) $(CompileCommonOpts) -c "' >>site.tmp @echo 'set compile_cxx "$(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c"' >> site.tmp @echo 'set link "$(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) $(LD.Flags)"' >>site.tmp - @echo 'set llvmgcc "$(LLVMGCC)"' >> site.tmp + @echo 'set llvmgcc "$(LLVMGCC) $(EXTRA_OPTIONS)"' >> site.tmp @echo 'set llvmgxx "$(LLVMGCC)"' >> site.tmp @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp From dpatel at apple.com Thu Apr 24 12:59:03 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Apr 2008 17:59:03 -0000 Subject: [llvm-commits] [llvm] r50217 - /llvm/trunk/test/Makefile Message-ID: <200804241759.m3OHx3f6016136@zion.cs.uiuc.edu> Author: dpatel Date: Thu Apr 24 12:59:03 2008 New Revision: 50217 URL: http://llvm.org/viewvc/llvm-project?rev=50217&view=rev Log: Add EXTRA_OPTIONS on the llvmgxx command line. Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=50217&r1=50216&r2=50217&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Thu Apr 24 12:59:03 2008 @@ -99,7 +99,7 @@ @echo 'set compile_cxx "$(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c"' >> site.tmp @echo 'set link "$(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) $(LD.Flags)"' >>site.tmp @echo 'set llvmgcc "$(LLVMGCC) $(EXTRA_OPTIONS)"' >> site.tmp - @echo 'set llvmgxx "$(LLVMGCC)"' >> site.tmp + @echo 'set llvmgxx "$(LLVMGCC) $(EXTRA_OPTIONS)"' >> site.tmp @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp @echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> site.tmp From dpatel at apple.com Thu Apr 24 13:13:47 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Apr 2008 18:13:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50218 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200804241813.m3OIDlP5016608@zion.cs.uiuc.edu> Author: dpatel Date: Thu Apr 24 13:13:47 2008 New Revision: 50218 URL: http://llvm.org/viewvc/llvm-project?rev=50218&view=rev Log: Add comment. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=50218&r1=50217&r2=50218&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu Apr 24 13:13:47 2008 @@ -989,6 +989,11 @@ return NULL; } +/// llvm_x86_64_get_multiple_return_reg_classes - Find register classes used +/// to return Ty. It is expected that Ty requires multiple return values. +/// This routine uses GCC implementation to find required register classes. +/// The original implementation of this routine is based on +/// llvm_x86_64_should_pass_aggregate_in_mixed_regs code. void llvm_x86_64_get_multiple_return_reg_classes(tree TreeType, const Type *Ty, std::vector &Elts){ From evan.cheng at apple.com Thu Apr 24 13:42:47 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Apr 2008 18:42:47 -0000 Subject: [llvm-commits] [llvm] r50222 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Message-ID: <200804241842.m3OIgm94017570@zion.cs.uiuc.edu> Author: evancheng Date: Thu Apr 24 13:42:47 2008 New Revision: 50222 URL: http://llvm.org/viewvc/llvm-project?rev=50222&view=rev Log: Adjust inline cost computation to be less aggressive. Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=50222&r1=50221&r2=50222&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Thu Apr 24 13:42:47 2008 @@ -173,7 +173,7 @@ // make it almost guaranteed to be inlined. // if (Callee->hasInternalLinkage() && Callee->hasOneUse()) - InlineCost -= 30000; + InlineCost -= 15000; // If this function uses the coldcc calling convention, prefer not to inline // it. @@ -236,7 +236,7 @@ // Don't inline into something too big, which would make it bigger. // - InlineCost += Caller->size()/20; + InlineCost += Caller->size()/15; // Look at the size of the callee. Each instruction counts as 5. InlineCost += CalleeFI.NumInsts*5; From criswell at uiuc.edu Thu Apr 24 14:05:16 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 24 Apr 2008 19:05:16 -0000 Subject: [llvm-commits] [poolalloc] r50223 - /poolalloc/trunk/lib/DSA/DataStructure.cpp Message-ID: <200804241905.m3OJ5Gqw018394@zion.cs.uiuc.edu> Author: criswell Date: Thu Apr 24 14:05:16 2008 New Revision: 50223 URL: http://llvm.org/viewvc/llvm-project?rev=50223&view=rev Log: Change my debugging output to conform to standards. Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=50223&r1=50222&r2=50223&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructure.cpp Thu Apr 24 14:05:16 2008 @@ -146,9 +146,7 @@ if (T) mergeTypeInfo(T, 0); if (G) G->addNode(this); ++NumNodeAllocated; -#if JTC -std::cerr << "LLVA: Creating (1) DSNode " << this << "\n"; -#endif + DOUT << "LLVA: Creating (1) DSNode " << this << "\n"; } // DSNode copy constructor... do not copy over the referrers list! @@ -161,9 +159,7 @@ Links.resize(N.Links.size()); // Create the appropriate number of null links G->addNode(this); ++NumNodeAllocated; -#if JTC -std::cerr << "LLVA: Creating (2) DSNode " << this << "\n"; -#endif + DOUT << "LLVA: Creating (2) DSNode " << this << "\n"; } DSNode::~DSNode() { @@ -174,9 +170,7 @@ // // Remove all references to this node from the Pool Descriptor Map. // -#if JTC - std::cerr << "LLVA: Removing " << this << "\n"; -#endif + DOUT << "LLVA: Removing " << this << "\n"; if (ParentGraph) { hash_map &pdm=ParentGraph->getPoolDescriptorsMap(); pdm.erase (this); @@ -278,9 +272,7 @@ DestNode->Size = 1; DestNode->Globals.swap(Globals); -#if JTC - std::cerr << "LLVA: foldNode: " << this << " becomes " << DestNode << "\n"; -#endif + DOUT << "LLVA: foldNode: " << this << " becomes " << DestNode << "\n"; #ifdef LLVA_KERNEL //Again we have created a new DSNode, we need to fill in the // pool desc map appropriately @@ -903,10 +895,8 @@ //do nothing (common case) } else { if (pdm[NNode]) { -#if JTC - std::cerr << "LLVA: 1: currNode (" << currNode << ") becomes " << pdm[NNode]->getName() << "(" << NNode << ")\n"; -#endif - pdm[currNode] = pdm[NNode]; + DOUT << "LLVA: 1: currNode (" << currNode << ") becomes " << pdm[NNode]->getName() << "(" << NNode << ")\n"; + pdm[currNode] = pdm[NNode]; } } } else { @@ -917,10 +907,9 @@ // Verify that this is correct. I believe it is; it seems to make sense // since either node can be used after the merge. // -#if JTC -std::cerr << "LLVA: MergeNodes: currnode has something, newnode has nothing\n"; - std::cerr << "LLVA: 2: currNode (" << currNode << ") becomes " << "(" << NNode << ")\n"; -#endif + DOUT << "LLVA: MergeNodes: currnode has something, newnode has nothing\n"; + DOUT << "LLVA: 2: currNode (" << currNode << ") becomes " + << "(" << NNode << ")\n"; pdm[NNode] = pdm[currNode]; #endif //do nothing @@ -1025,9 +1014,7 @@ /// point to this node). /// void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) { -#if JTC -std::cerr << "LLVA: mergeWith: " << this << " becomes " << NH.getNode() << "\n"; -#endif + DOUT << "mergeWith: " << this << " becomes " << NH.getNode() << "\n"; DSNode *N = NH.getNode(); if (N == this && NH.getOffset() == Offset) return; // Noop @@ -1107,9 +1094,7 @@ DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */); DN->maskNodeTypes(BitsToKeep); NH = DN; -#if JTC -std::cerr << "LLVA: getClonedNH: " << SN << " becomes " << DN << "\n"; -#endif + DOUT << "getClonedNH: " << SN << " becomes " << DN << "\n"; #if 1 #ifdef LLVA_KERNEL //Again we have created a new DSNode, we need to fill in the @@ -1280,9 +1265,7 @@ } } -#if JTC -std::cerr << "LLVA: mergeWith: " << SN << " becomes " << DN << "\n"; -#endif + DOUT << "LLVA: mergeWith: " << SN << " becomes " << DN << "\n"; #ifdef LLVA_KERNEL //Here some merge is going on just like in DSNode::merge @@ -1306,9 +1289,7 @@ //do nothing (common case) } else { if (srcpdm[SN]) { -#if JTC - std::cerr << "LLVA: DN becomes " << srcpdm[SN]->getName() << std::endl; -#endif + DOUT << "DN becomes " << srcpdm[SN]->getName() << std::endl; destpdm[DN] = srcpdm[SN]; } } From nicolas.geoffray at lip6.fr Thu Apr 24 14:22:42 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 24 Apr 2008 19:22:42 -0000 Subject: [llvm-commits] [vmkit] r50224 - /vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Message-ID: <200804241922.m3OJMgfA018917@zion.cs.uiuc.edu> Author: geoffray Date: Thu Apr 24 14:22:42 2008 New Revision: 50224 URL: http://llvm.org/viewvc/llvm-project?rev=50224&view=rev Log: Decrement counter at the right place. Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=50224&r1=50223&r2=50224&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Thu Apr 24 14:22:42 2008 @@ -571,11 +571,11 @@ } else if (name->at(0) == AssessorDesc::I_TAB) { while (doLoop) { + --len; if (len == 0) { doLoop = false; } else { ++start; - --len; if (name->at(start) != AssessorDesc::I_TAB) { if (name->at(start) == AssessorDesc::I_REF) { uint32 size = (uint32)name->size; From nicolas.geoffray at lip6.fr Thu Apr 24 14:23:21 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 24 Apr 2008 19:23:21 -0000 Subject: [llvm-commits] [vmkit] r50225 - /vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp Message-ID: <200804241923.m3OJNLDh018944@zion.cs.uiuc.edu> Author: geoffray Date: Thu Apr 24 14:23:21 2008 New Revision: 50225 URL: http://llvm.org/viewvc/llvm-project?rev=50225&view=rev Log: Implement GetObjectArrayElement Modified: vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp?rev=50225&r1=50224&r2=50225&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp Thu Apr 24 14:23:21 2008 @@ -1655,7 +1655,12 @@ jobject GetObjectArrayElement(JNIEnv *env, jobjectArray array, jsize index) { - assert(0 && "implement me"); + BEGIN_EXCEPTION + + return (jobject)((ArrayObject*)array)->at(index); + + END_EXCEPTION + return 0; } From nicolas.geoffray at lip6.fr Thu Apr 24 14:24:03 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 24 Apr 2008 19:24:03 -0000 Subject: [llvm-commits] [vmkit] r50226 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathVMClass.cpp VMCore/JavaTypes.cpp VMCore/JavaTypes.h Message-ID: <200804241924.m3OJO3NA018976@zion.cs.uiuc.edu> Author: geoffray Date: Thu Apr 24 14:24:02 2008 New Revision: 50226 URL: http://llvm.org/viewvc/llvm-project?rev=50226&view=rev Log: Primitive classes have a special name, the AssessorDesc contains the real name. Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp?rev=50226&r1=50225&r2=50226&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp Thu Apr 24 14:24:02 2008 @@ -179,7 +179,7 @@ AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl); const UTF8* res = 0; if (ass) { - res = cl->name; + res = ass->UTF8Name; } else { const UTF8* iname = cl->name; res = iname->internalToJava(vm, 0, iname->size); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=50226&r1=50225&r2=50226&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Thu Apr 24 14:24:02 2008 @@ -57,8 +57,8 @@ AssessorDesc* AssessorDesc::dRef = 0; AssessorDesc* AssessorDesc::allocate(bool dt, char bid, uint32 nb, uint32 nw, - const char* name, Jnjvm* vm, - const llvm::Type* t, + const char* name, const char* className, + Jnjvm* vm, const llvm::Type* t, const char* assocName, arrayCtor_t ctor) { AssessorDesc* res = vm_new(vm, AssessorDesc)(); res->doTrace = dt; @@ -66,6 +66,7 @@ res->nbb = nb; res->nbw = nw; res->asciizName = name; + res->UTF8Name = vm->asciizConstructUTF8(name); res->llvmType = t; if (t && t != llvm::Type::VoidTy) { res->llvmTypePtr = llvm::PointerType::getUnqual(t); @@ -78,7 +79,7 @@ res->assocClassName = 0; if (bid != I_PARG && bid != I_PARD && bid != I_REF && bid != I_TAB) { - res->classType = vm->constructClass(vm->asciizConstructUTF8(name), + res->classType = vm->constructClass(vm->asciizConstructUTF8(className), CommonClass::jnjvmClassLoader); res->classType->status = ready; res->classType->access = ACC_ABSTRACT | ACC_FINAL | ACC_PUBLIC; @@ -90,38 +91,42 @@ void AssessorDesc::initialise(Jnjvm* vm) { - dParg = AssessorDesc::allocate(false, I_PARG, 0, 0, "(", vm, 0, 0, 0); - dPard = AssessorDesc::allocate(false, I_PARD, 0, 0, ")", vm, 0, 0, 0); - dVoid = AssessorDesc::allocate(false, I_VOID, 0, 0, "void", vm, - llvm::Type::VoidTy, "java/lang/Void", 0); - dBool = AssessorDesc::allocate(false, I_BOOL, 1, 1, "boolean", vm, + dParg = AssessorDesc::allocate(false, I_PARG, 0, 0, "(", "(", vm, 0, 0, 0); + dPard = AssessorDesc::allocate(false, I_PARD, 0, 0, ")", ")", vm, 0, 0, 0); + dVoid = AssessorDesc::allocate(false, I_VOID, 0, 0, "void", "*** void ***", + vm, llvm::Type::VoidTy, "java/lang/Void", 0); + dBool = AssessorDesc::allocate(false, I_BOOL, 1, 1, "boolean", + "*** boolean ***", vm, llvm::Type::Int8Ty, "java/lang/Boolean", (arrayCtor_t)ArrayUInt8::acons); - dByte = AssessorDesc::allocate(false, I_BYTE, 1, 1, "byte", vm, - llvm::Type::Int8Ty, "java/lang/Byte", + dByte = AssessorDesc::allocate(false, I_BYTE, 1, 1, "byte", "*** byte ***", + vm, llvm::Type::Int8Ty, "java/lang/Byte", (arrayCtor_t)ArraySInt8::acons); - dChar = AssessorDesc::allocate(false, I_CHAR, 2, 1, "char", vm, - llvm::Type::Int16Ty, "java/lang/Character", + dChar = AssessorDesc::allocate(false, I_CHAR, 2, 1, "char", "*** char ***", + vm, llvm::Type::Int16Ty, "java/lang/Character", (arrayCtor_t)ArrayUInt16::acons); - dShort = AssessorDesc::allocate(false, I_SHORT, 2, 1, "short", vm, - llvm::Type::Int16Ty, "java/lang/Short", + dShort = AssessorDesc::allocate(false, I_SHORT, 2, 1, "short", + "*** short ***", vm, llvm::Type::Int16Ty, + "java/lang/Short", (arrayCtor_t)ArraySInt16::acons); - dInt = AssessorDesc::allocate(false, I_INT, 4, 1, "int", vm, + dInt = AssessorDesc::allocate(false, I_INT, 4, 1, "int", "*** int ***", vm, llvm::Type::Int32Ty, "java/lang/Integer", (arrayCtor_t)ArraySInt32::acons); - dFloat = AssessorDesc::allocate(false, I_FLOAT, 4, 1, "float", vm, + dFloat = AssessorDesc::allocate(false, I_FLOAT, 4, 1, "float", + "*** float ***", vm, llvm::Type::FloatTy, "java/lang/Float", (arrayCtor_t)ArrayFloat::acons); - dLong = AssessorDesc::allocate(false, I_LONG, 8, 2, "long", vm, - llvm::Type::Int64Ty, "java/lang/Long", + dLong = AssessorDesc::allocate(false, I_LONG, 8, 2, "long", "*** long ***", + vm, llvm::Type::Int64Ty, "java/lang/Long", (arrayCtor_t)ArrayLong::acons); - dDouble = AssessorDesc::allocate(false, I_DOUBLE, 8, 2, "double", vm, + dDouble = AssessorDesc::allocate(false, I_DOUBLE, 8, 2, "double", + "*** double ***", vm, llvm::Type::DoubleTy, "java/lang/Double", (arrayCtor_t)ArrayDouble::acons); - dTab = AssessorDesc::allocate(true, I_TAB, 4, 1, "array", vm, + dTab = AssessorDesc::allocate(true, I_TAB, 4, 1, "array", "array", vm, JavaObject::llvmType, 0, (arrayCtor_t)ArrayObject::acons); - dRef = AssessorDesc::allocate(true, I_REF, 4, 1, "reference", vm, + dRef = AssessorDesc::allocate(true, I_REF, 4, 1, "reference", "reference", vm, JavaObject::llvmType, 0, (arrayCtor_t)ArrayObject::acons); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=50226&r1=50225&r2=50226&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Thu Apr 24 14:24:02 2008 @@ -57,6 +57,7 @@ const llvm::Type* llvmTypePtr; llvm::Constant* llvmNullConstant; const UTF8* assocClassName; + const UTF8* UTF8Name; arrayCtor_t arrayCtor; static AssessorDesc* dParg; @@ -74,9 +75,9 @@ static AssessorDesc* dRef; static AssessorDesc* allocate(bool dt, char bid, uint32 nb, uint32 nw, - const char* name, Jnjvm* vm, - const llvm::Type* type, const char* assocName, - arrayCtor_t ctor); + const char* name, const char* className, + Jnjvm* vm, const llvm::Type* type, + const char* assocName, arrayCtor_t ctor); static void initialise(Jnjvm* vm); From nicolas.geoffray at lip6.fr Thu Apr 24 14:42:40 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 24 Apr 2008 19:42:40 -0000 Subject: [llvm-commits] [vmkit] r50227 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaJIT.cpp JavaRuntimeJIT.cpp Message-ID: <200804241942.m3OJgevg019610@zion.cs.uiuc.edu> Author: geoffray Date: Thu Apr 24 14:42:39 2008 New Revision: 50227 URL: http://llvm.org/viewvc/llvm-project?rev=50227&view=rev Log: Implement ldc for Class. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50227&r1=50226&r2=50227&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Thu Apr 24 14:42:39 2008 @@ -921,7 +921,16 @@ AssessorDesc::dFloat); mvm::jit::unprotectConstants();//->unlock(); } else if (type == JavaCtpInfo::ConstantClass) { - assert(0 && "implement ConstantClass in ldc!"); + if (ctpInfo->ctpRes[index]) { + CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]); + push(cl->llvmDelegatee(compilingClass->isolate->module, currentBlock), + AssessorDesc::dRef); + } else { + Value* val = getResolvedClass(index, false); + Value* res = CallInst::Create(getClassDelegateeLLVM, val, "", + currentBlock); + push(res, AssessorDesc::dRef); + } } else { JavaThread::get()->isolate->unknownError("unknown type %d", type); } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=50227&r1=50226&r2=50227&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Thu Apr 24 14:42:39 2008 @@ -223,12 +223,16 @@ return cl->_staticInstance; } } +#endif extern "C" JavaObject* getClassDelegatee(CommonClass* cl) { +#ifdef MULTIPLE_VM Jnjvm* vm = JavaThread::get()->isolate; +#else + Jnjvm* vm = cl->isolate; +#endif return vm->getClassDelegatee(cl); } -#endif void JavaJIT::initialise() { void* p; From evan.cheng at apple.com Thu Apr 24 15:01:58 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Apr 2008 20:01:58 -0000 Subject: [llvm-commits] [llvm] r50229 - /llvm/trunk/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll Message-ID: <200804242001.m3OK1xQR020242@zion.cs.uiuc.edu> Author: evancheng Date: Thu Apr 24 15:01:58 2008 New Revision: 50229 URL: http://llvm.org/viewvc/llvm-project?rev=50229&view=rev Log: New test. Added: llvm/trunk/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll Added: llvm/trunk/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll?rev=50229&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll Thu Apr 24 15:01:58 2008 @@ -0,0 +1,89 @@ +; RUN: llvm-as < %s | llc -mtriple=powerpc-apple-darwin + + at _ZL10DeviceCode = internal global i16 0 ; [#uses=1] + at .str19 = internal constant [64 x i8] c"unlock_then_erase_sector: failed to erase block (status= 0x%x)\0A\00" ; <[64 x i8]*> [#uses=1] + at .str34 = internal constant [68 x i8] c"ProgramByWords - Erasing sector 0x%llx to 0x%llx (size 0x%x bytes)\0A\00" ; <[68 x i8]*> [#uses=1] + at .str35 = internal constant [37 x i8] c"ProgramByWords - Done erasing flash\0A\00" ; <[37 x i8]*> [#uses=1] + at .str36 = internal constant [48 x i8] c"ProgramByWords - Starting to write to FLASH...\0A\00" ; <[48 x i8]*> [#uses=1] + +declare void @IOLog(i8*, ...) + +declare void @IODelay(i32) + +define i32 @_Z14ProgramByWordsPvyy(i8* %buffer, i64 %Offset, i64 %bufferSize) nounwind { +entry: + volatile store i8 -1, i8* null, align 1 + %tmp28 = icmp eq i8 0, 0 ; [#uses=1] + br i1 %tmp28, label %bb107, label %bb + +bb: ; preds = %entry + %tmp9596430 = zext i32 0 to i64 ; [#uses=1] + %tmp98431 = add i64 %tmp9596430, %Offset ; [#uses=1] + %tmp100433 = icmp ugt i64 %tmp98431, %Offset ; [#uses=1] + br i1 %tmp100433, label %bb31, label %bb103 + +bb31: ; preds = %_Z24unlock_then_erase_sectory.exit, %bb + %Pos.0.reg2mem.0 = phi i64 [ %tmp93, %_Z24unlock_then_erase_sectory.exit ], [ %Offset, %bb ] ; [#uses=3] + %tmp35 = load i16* @_ZL10DeviceCode, align 2 ; [#uses=1] + %tmp3536 = zext i16 %tmp35 to i32 ; [#uses=2] + %tmp37 = and i32 %tmp3536, 65520 ; [#uses=1] + %tmp38 = icmp eq i32 %tmp37, 35008 ; [#uses=1] + %tmp34 = sub i64 %Pos.0.reg2mem.0, %Offset ; [#uses=2] + br i1 %tmp38, label %bb41, label %bb68 + +bb41: ; preds = %bb31 + %tmp43 = add i32 0, -1 ; [#uses=1] + %tmp4344 = zext i32 %tmp43 to i64 ; [#uses=1] + %tmp46 = and i64 %tmp4344, %tmp34 ; [#uses=0] + %tmp49 = and i32 %tmp3536, 1 ; [#uses=0] + ret i32 0 + +bb68: ; preds = %bb31 + tail call void (i8*, ...)* @IOLog( i8* getelementptr ([68 x i8]* @.str34, i32 0, i32 0), i64 %tmp34, i64 0, i32 131072 ) nounwind + %tmp2021.i = trunc i64 %Pos.0.reg2mem.0 to i32 ; [#uses=1] + %tmp202122.i = inttoptr i32 %tmp2021.i to i8* ; [#uses=1] + tail call void @IODelay( i32 500 ) nounwind + %tmp53.i = volatile load i16* null, align 2 ; [#uses=2] + %tmp5455.i = zext i16 %tmp53.i to i32 ; [#uses=1] + br i1 false, label %bb.i, label %bb65.i + +bb.i: ; preds = %bb68 + ret i32 0 + +bb65.i: ; preds = %bb68 + %tmp67.i = icmp eq i16 %tmp53.i, 128 ; [#uses=1] + br i1 %tmp67.i, label %_Z24unlock_then_erase_sectory.exit, label %bb70.i + +bb70.i: ; preds = %bb65.i + tail call void (i8*, ...)* @IOLog( i8* getelementptr ([64 x i8]* @.str19, i32 0, i32 0), i32 %tmp5455.i ) nounwind + ret i32 0 + +_Z24unlock_then_erase_sectory.exit: ; preds = %bb65.i + volatile store i8 -1, i8* %tmp202122.i, align 1 + %tmp93 = add i64 0, %Pos.0.reg2mem.0 ; [#uses=2] + %tmp98 = add i64 0, %Offset ; [#uses=1] + %tmp100 = icmp ugt i64 %tmp98, %tmp93 ; [#uses=1] + br i1 %tmp100, label %bb31, label %bb103 + +bb103: ; preds = %_Z24unlock_then_erase_sectory.exit, %bb + tail call void (i8*, ...)* @IOLog( i8* getelementptr ([37 x i8]* @.str35, i32 0, i32 0) ) nounwind + ret i32 0 + +bb107: ; preds = %entry + tail call void (i8*, ...)* @IOLog( i8* getelementptr ([48 x i8]* @.str36, i32 0, i32 0) ) nounwind + %tmp114115 = bitcast i8* %buffer to i16* ; [#uses=1] + %tmp256 = lshr i64 %bufferSize, 1 ; [#uses=1] + %tmp256257 = trunc i64 %tmp256 to i32 ; [#uses=1] + %tmp258 = getelementptr i16* %tmp114115, i32 %tmp256257 ; [#uses=0] + ret i32 0 +} + +define i32 @_Z17program_64B_blockyPm(i64 %Base, i32* %pData) nounwind { +entry: + unreachable +} + +define i32 @_Z15ProgramByBlocksyy(i64 %Offset, i64 %bufferSize) nounwind { +entry: + ret i32 0 +} From isanbard at gmail.com Thu Apr 24 15:53:51 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Apr 2008 20:53:51 -0000 Subject: [llvm-commits] [llvm] r50230 - /llvm/branches/Apple/Tak/ Message-ID: <200804242053.m3OKrp3E022497@zion.cs.uiuc.edu> Author: void Date: Thu Apr 24 15:53:51 2008 New Revision: 50230 URL: http://llvm.org/viewvc/llvm-project?rev=50230&view=rev Log: Creating Tak branch. Added: llvm/branches/Apple/Tak/ - copied from r50229, llvm/trunk/ From isanbard at gmail.com Thu Apr 24 15:54:37 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Apr 2008 20:54:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50231 - /llvm-gcc-4.2/branches/Apple/ Message-ID: <200804242054.m3OKsbf2022540@zion.cs.uiuc.edu> Author: void Date: Thu Apr 24 15:54:37 2008 New Revision: 50231 URL: http://llvm.org/viewvc/llvm-project?rev=50231&view=rev Log: Creating Apple branches directory Added: llvm-gcc-4.2/branches/Apple/ From isanbard at gmail.com Thu Apr 24 15:55:07 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Apr 2008 20:55:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50232 - /llvm-gcc-4.2/branches/Apple/Tak/ Message-ID: <200804242055.m3OKt7d3022565@zion.cs.uiuc.edu> Author: void Date: Thu Apr 24 15:55:07 2008 New Revision: 50232 URL: http://llvm.org/viewvc/llvm-project?rev=50232&view=rev Log: Creating Tak branch for llvm-gcc Added: llvm-gcc-4.2/branches/Apple/Tak/ - copied from r50231, llvm-gcc-4.2/trunk/ From evan.cheng at apple.com Thu Apr 24 15:56:30 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Apr 2008 13:56:30 -0700 Subject: [llvm-commits] [llvm] r50172 - in /llvm/trunk/test/CodeGen/X86: dagcombine-cse.ll vec_clear.ll vec_shuffle-11.ll vec_shuffle-16.ll In-Reply-To: <200804231825.m3NIPj63029520@zion.cs.uiuc.edu> References: <200804231825.m3NIPj63029520@zion.cs.uiuc.edu> Message-ID: <525A81B8-2B82-47AF-8510-A468036A1269@apple.com> Hi Anton, Instead of adding -realign-stack=0, can you just give them target triplet i386-apple-darwin? Thanks, Evan On Apr 23, 2008, at 11:25 AM, Anton Korobeynikov wrote: > Author: asl > Date: Wed Apr 23 13:25:44 2008 > New Revision: 50172 > > URL: http://llvm.org/viewvc/llvm-project?rev=50172&view=rev > Log: > Disable stack realignment for these tests > > Modified: > llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll > llvm/trunk/test/CodeGen/X86/vec_clear.ll > llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll > llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll > > Modified: llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll?rev=50172&r1=50171&r2=50172&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll (original) > +++ llvm/trunk/test/CodeGen/X86/dagcombine-cse.ll Wed Apr 23 > 13:25:44 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |& grep > asm-printer | grep 14 > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 - > stats |& grep asm-printer | grep 14 > > define i32 @t(i8* %ref_frame_ptr, i32 %ref_frame_stride, i32 %idxX, > i32 %idxY) nounwind { > entry: > > Modified: llvm/trunk/test/CodeGen/X86/vec_clear.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_clear.ll?rev=50172&r1=50171&r2=50172&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/vec_clear.ll (original) > +++ llvm/trunk/test/CodeGen/X86/vec_clear.ll Wed Apr 23 13:25:44 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep and > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 > | not grep and > > define <4 x float> @test(<4 x float>* %v1) { > %tmp = load <4 x float>* %v1 ; <<4 x float>> > [#uses=1] > > Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll?rev=50172&r1=50171&r2=50172&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll (original) > +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-11.ll Wed Apr 23 > 13:25:44 2008 > @@ -1,5 +1,5 @@ > ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 > -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep mov > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 > | not grep mov > > define <4 x i32> @test() { > %tmp131 = call <2 x i64> @llvm.x86.sse2.psrl.dq( <2 x i64> < > i64 -1, i64 -1 >, i32 96 ) ; <<2 x i64>> [#uses=1] > > Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll?rev=50172&r1=50171&r2=50172&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll (original) > +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-16.ll Wed Apr 23 > 13:25:44 2008 > @@ -1,8 +1,8 @@ > ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 | grep shufps > | count 4 > -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 | grep mov | > count 2 > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 -realign- > stack=0 | grep mov | count 2 > ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd | > count 4 > ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep shufps > -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep mov > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -realign-stack=0 > | not grep mov > > define <4 x float> @t1(<4 x float> %a, <4 x float> %b) nounwind { > %tmp1 = shufflevector <4 x float> %b, <4 x float> undef, <4 > x i32> zeroinitializer > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From lattner at apple.com Thu Apr 24 16:53:53 2008 From: lattner at apple.com (Tanya Lattner) Date: Thu, 24 Apr 2008 14:53:53 -0700 Subject: [llvm-commits] [llvm] r50174 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <479EBA8F-AB8A-4BED-9540-DC2B34E86406@apple.com> References: <200804231834.m3NIYbFb029779@zion.cs.uiuc.edu> <479EBA8F-AB8A-4BED-9540-DC2B34E86406@apple.com> Message-ID: <900938C9-0D4D-4DAC-850F-3AA9729FDF31@apple.com> On Apr 23, 2008, at 6:13 PM, Dale Johannesen wrote: > > On Apr 23, 2008, at 3:50 PM, Tanya Lattner wrote: > >> Dale, >> >> Can you use the doxygen style comments (///) for this function? > > I could. The function I split it out from doesn't do that, though. > Lots of functions don't have doxygen style comments. Its just good to fix that when we can. I'm just talking about the comments right above the function declaration. -Tanya >>> +// If this cast does not affect the value passed through the >>> varargs >>> +// area, we can eliminate the use of the cast. >>> +static bool isSafeToEliminateVarargsCast(const CallSite CS, >>> + const CastInst * const CI, >>> + const TargetData * const >>> TD, >>> + const int ix) { >>> >> >> Thanks, >> Tanya >> _______________________________________________ >> 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 kremenek at apple.com Thu Apr 24 18:48:12 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 24 Apr 2008 23:48:12 -0000 Subject: [llvm-commits] [llvm] r50235 - /llvm/trunk/include/llvm/ADT/DenseSet.h Message-ID: <200804242348.m3ONmCZ5027503@zion.cs.uiuc.edu> Author: kremenek Date: Thu Apr 24 18:48:12 2008 New Revision: 50235 URL: http://llvm.org/viewvc/llvm-project?rev=50235&view=rev Log: Added iterator support for DenseSet. Modified: llvm/trunk/include/llvm/ADT/DenseSet.h Modified: llvm/trunk/include/llvm/ADT/DenseSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?rev=50235&r1=50234&r2=50235&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseSet.h (original) +++ llvm/trunk/include/llvm/ADT/DenseSet.h Thu Apr 24 18:48:12 2008 @@ -24,15 +24,14 @@ /// should be optimized later if there is a need. template > class DenseSet { - DenseMap TheMap; + typedef DenseMap MapTy; + MapTy TheMap; public: DenseSet(const DenseSet &Other) : TheMap(Other.TheMap) {} explicit DenseSet(unsigned NumInitBuckets = 64) : TheMap(NumInitBuckets) {} bool empty() const { return TheMap.empty(); } - unsigned size() const { return TheMap.size(); } - - // TODO add iterators. + unsigned size() const { return TheMap.size(); } void clear() { TheMap.clear(); @@ -54,6 +53,41 @@ TheMap = RHS.TheMap; return *this; } + + // Iterators. + + class Iterator { + typename MapTy::iterator I; + public: + Iterator(const typename MapTy::iterator &i) : I(i) {} + + ValueT& operator*() { return I->first; } + ValueT* operator->() { return &I->first; } + + Iterator& operator++() { ++I; return *this; }; + bool operator==(const Iterator& X) const { return I == X.I; } + }; + + class ConstIterator { + typename MapTy::const_iterator I; + public: + ConstIterator(const typename MapTy::const_iterator &i) : I(i) {} + + const ValueT& operator*() { return I->first; } + const ValueT* operator->() { return &I->first; } + + ConstIterator& operator++() { ++I; return *this; }; + bool operator==(const ConstIterator& X) const { return I == X.I; } + }; + + typedef Iterator iterator; + typedef ConstIterator const_iterator; + + iterator begin() { return Iterator(TheMap.begin()); } + iterator end() { return Iterator(TheMap.end()); } + + const_iterator begin() const { return ConstIterator(TheMap.begin()); } + const_iterator end() const { return ConstIterator(TheMap.end()); } }; } // end namespace llvm From kremenek at apple.com Thu Apr 24 18:49:45 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 24 Apr 2008 23:49:45 -0000 Subject: [llvm-commits] [llvm] r50236 - /llvm/trunk/include/llvm/ADT/DenseSet.h Message-ID: <200804242349.m3ONnjkA027561@zion.cs.uiuc.edu> Author: kremenek Date: Thu Apr 24 18:49:45 2008 New Revision: 50236 URL: http://llvm.org/viewvc/llvm-project?rev=50236&view=rev Log: Implement != for DenseSet iterators. Modified: llvm/trunk/include/llvm/ADT/DenseSet.h Modified: llvm/trunk/include/llvm/ADT/DenseSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?rev=50236&r1=50235&r2=50236&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseSet.h (original) +++ llvm/trunk/include/llvm/ADT/DenseSet.h Thu Apr 24 18:49:45 2008 @@ -66,6 +66,7 @@ Iterator& operator++() { ++I; return *this; }; bool operator==(const Iterator& X) const { return I == X.I; } + bool operator!=(const Iterator& X) const { return I != X.I; } }; class ConstIterator { @@ -78,6 +79,7 @@ ConstIterator& operator++() { ++I; return *this; }; bool operator==(const ConstIterator& X) const { return I == X.I; } + bool operator!=(const ConstIterator& X) const { return I != X.I; } }; typedef Iterator iterator; From dpatel at apple.com Thu Apr 24 19:01:05 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 25 Apr 2008 00:01:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50238 - /llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Message-ID: <200804250001.m3P015NI027890@zion.cs.uiuc.edu> Author: dpatel Date: Thu Apr 24 19:01:05 2008 New Revision: 50238 URL: http://llvm.org/viewvc/llvm-project?rev=50238&view=rev Log: Fix struct-layout-1.exp tests crashes. Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp?rev=50238&r1=50237&r2=50238&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Thu Apr 24 19:01:05 2008 @@ -957,6 +957,11 @@ if (NumClasses == 1 && foundInt) return false; + if (NumClasses == 1 && + (Class[0] == X86_64_INTEGERSI_CLASS || Class[0] == X86_64_INTEGER_CLASS)) + // This will fit in one i32 register. + return false; + // Otherwise, use of multiple value return is OK. return true; } @@ -1096,7 +1101,9 @@ case X86_64_COMPLEX_X87_CLASS: assert(0 && "Not yet handled!"); case X86_64_NO_CLASS: - assert(0 && "Not yet handled!"); + // padding bytes. + Elts.push_back(Type::Int64Ty); + break; default: assert(0 && "Unexpected register class!"); } } From evan.cheng at apple.com Thu Apr 24 19:26:44 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Apr 2008 00:26:44 -0000 Subject: [llvm-commits] [llvm] r50239 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-04-24-MemCpyBug.ll Message-ID: <200804250026.m3P0Qidc028673@zion.cs.uiuc.edu> Author: evancheng Date: Thu Apr 24 19:26:43 2008 New Revision: 50239 URL: http://llvm.org/viewvc/llvm-project?rev=50239&view=rev Log: Fix bug in x86 memcpy / memset lowering. If there are trailing bytes not handled by rep instructions, a new memcpy / memset is introduced for them. However, since source / destination addresses are already adjusted, their offsets should be zero. Added: llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=50239&r1=50238&r2=50239&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Apr 24 19:26:43 2008 @@ -4822,7 +4822,7 @@ DAG.getConstant(Offset, AddrVT)), Src, DAG.getConstant(BytesLeft, SizeVT), - Align, DstSV, Offset); + Align, DstSV, 0); } // TODO: Use a Tokenfactor, as in memcpy, instead of a single chain. @@ -4847,8 +4847,6 @@ if (!AlwaysInline && SizeVal > getSubtarget()->getMaxInlineSizeThreshold()) return SDOperand(); - SmallVector Results; - MVT::ValueType AVT; unsigned BytesLeft = 0; if (Align >= 8 && Subtarget->is64Bit()) @@ -4881,25 +4879,24 @@ Ops.push_back(Chain); Ops.push_back(DAG.getValueType(AVT)); Ops.push_back(InFlag); - Results.push_back(DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], Ops.size())); + SDOperand RepMovs = DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], Ops.size()); + SmallVector Results; + Results.push_back(RepMovs); if (BytesLeft) { // Handle the last 1 - 7 bytes. unsigned Offset = SizeVal - BytesLeft; MVT::ValueType DstVT = Dst.getValueType(); MVT::ValueType SrcVT = Src.getValueType(); MVT::ValueType SizeVT = Size.getValueType(); - - Results.push_back(DAG.getMemcpy(Chain, + Results.push_back(DAG.getMemcpy(Chain, DAG.getNode(ISD::ADD, DstVT, Dst, - DAG.getConstant(Offset, - DstVT)), + DAG.getConstant(Offset, DstVT)), DAG.getNode(ISD::ADD, SrcVT, Src, - DAG.getConstant(Offset, - SrcVT)), + DAG.getConstant(Offset, SrcVT)), DAG.getConstant(BytesLeft, SizeVT), Align, AlwaysInline, - DstSV, Offset, SrcSV, Offset)); + DstSV, 0, SrcSV, 0)); } return DAG.getNode(ISD::TokenFactor, MVT::Other, &Results[0], Results.size()); Added: llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll?rev=50239&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll Thu Apr 24 19:26:43 2008 @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=x86 | not grep 120 +; Don't accidentally add the offset twice for trailing bytes. + + %struct.S63 = type { [63 x i8] } + at g1s63 = external global %struct.S63 ; <%struct.S63*> [#uses=1] + +declare void @test63(%struct.S63* byval align 4 ) nounwind + +define void @testit63_entry_2E_ce() nounwind { + tail call void @test63( %struct.S63* byval align 4 @g1s63 ) nounwind + ret void +} From dpatel at apple.com Thu Apr 24 19:43:34 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 25 Apr 2008 00:43:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r50240 - /llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Message-ID: <200804250043.m3P0hYX7029109@zion.cs.uiuc.edu> Author: dpatel Date: Thu Apr 24 19:43:33 2008 New Revision: 50240 URL: http://llvm.org/viewvc/llvm-project?rev=50240&view=rev Log: Use Type::X86_FP80Ty for _Complex types. Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp?rev=50240&r1=50239&r2=50240&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Thu Apr 24 19:43:33 2008 @@ -1099,7 +1099,8 @@ case X86_64_X87_CLASS: case X86_64_X87UP_CLASS: case X86_64_COMPLEX_X87_CLASS: - assert(0 && "Not yet handled!"); + Elts.push_back(Type::X86_FP80Ty); + break; case X86_64_NO_CLASS: // padding bytes. Elts.push_back(Type::Int64Ty); From isanbard at gmail.com Thu Apr 24 19:44:00 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Apr 2008 17:44:00 -0700 Subject: [llvm-commits] [llvm] r50239 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-04-24-MemCpyBug.ll In-Reply-To: <200804250026.m3P0Qidc028673@zion.cs.uiuc.edu> References: <200804250026.m3P0Qidc028673@zion.cs.uiuc.edu> Message-ID: <16e5fdf90804241744t7ffed5b5w5aeaad53d5ea915b@mail.gmail.com> Hi Evan, Please apply this to the Tak branch as well. Thanks! -bw On Thu, Apr 24, 2008 at 5:26 PM, Evan Cheng wrote: > Author: evancheng > Date: Thu Apr 24 19:26:43 2008 > New Revision: 50239 > > URL: http://llvm.org/viewvc/llvm-project?rev=50239&view=rev > Log: > Fix bug in x86 memcpy / memset lowering. If there are trailing bytes not handled by rep instructions, a new memcpy / memset is introduced for them. However, since source / destination addresses are already adjusted, their offsets should be zero. > > Added: > llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll > Modified: > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=50239&r1=50238&r2=50239&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Apr 24 19:26:43 2008 > @@ -4822,7 +4822,7 @@ > DAG.getConstant(Offset, AddrVT)), > Src, > DAG.getConstant(BytesLeft, SizeVT), > - Align, DstSV, Offset); > + Align, DstSV, 0); > } > > // TODO: Use a Tokenfactor, as in memcpy, instead of a single chain. > @@ -4847,8 +4847,6 @@ > if (!AlwaysInline && SizeVal > getSubtarget()->getMaxInlineSizeThreshold()) > return SDOperand(); > > - SmallVector Results; > - > MVT::ValueType AVT; > unsigned BytesLeft = 0; > if (Align >= 8 && Subtarget->is64Bit()) > @@ -4881,25 +4879,24 @@ > Ops.push_back(Chain); > Ops.push_back(DAG.getValueType(AVT)); > Ops.push_back(InFlag); > - Results.push_back(DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], Ops.size())); > + SDOperand RepMovs = DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], Ops.size()); > > + SmallVector Results; > + Results.push_back(RepMovs); > if (BytesLeft) { > // Handle the last 1 - 7 bytes. > unsigned Offset = SizeVal - BytesLeft; > MVT::ValueType DstVT = Dst.getValueType(); > MVT::ValueType SrcVT = Src.getValueType(); > MVT::ValueType SizeVT = Size.getValueType(); > - > - Results.push_back(DAG.getMemcpy(Chain, > + Results.push_back(DAG.getMemcpy(Chain, > DAG.getNode(ISD::ADD, DstVT, Dst, > - DAG.getConstant(Offset, > - DstVT)), > + DAG.getConstant(Offset, DstVT)), > DAG.getNode(ISD::ADD, SrcVT, Src, > - DAG.getConstant(Offset, > - SrcVT)), > + DAG.getConstant(Offset, SrcVT)), > DAG.getConstant(BytesLeft, SizeVT), > Align, AlwaysInline, > - DstSV, Offset, SrcSV, Offset)); > + DstSV, 0, SrcSV, 0)); > } > > return DAG.getNode(ISD::TokenFactor, MVT::Other, &Results[0], Results.size()); > > Added: llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll?rev=50239&view=auto > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll (added) > +++ llvm/trunk/test/CodeGen/X86/2008-04-24-MemCpyBug.ll Thu Apr 24 19:26:43 2008 > @@ -0,0 +1,12 @@ > +; RUN: llvm-as < %s | llc -march=x86 | not grep 120 > +; Don't accidentally add the offset twice for trailing bytes. > + > + %struct.S63 = type { [63 x i8] } > + at g1s63 = external global %struct.S63 ; <%struct.S63*> [#uses=1] > + > +declare void @test63(%struct.S63* byval align 4 ) nounwind > + > +define void @testit63_entry_2E_ce() nounwind { > + tail call void @test63( %struct.S63* byval align 4 @g1s63 ) nounwind > + ret void > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From kremenek at apple.com Thu Apr 24 20:31:57 2008 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 25 Apr 2008 01:31:57 -0000 Subject: [llvm-commits] [llvm] r50243 - /llvm/tags/checker/checker-12/ Message-ID: <200804250131.m3P1VvPl030417@zion.cs.uiuc.edu> Author: kremenek Date: Thu Apr 24 20:31:56 2008 New Revision: 50243 URL: http://llvm.org/viewvc/llvm-project?rev=50243&view=rev Log: Tagging checker-12. Added: llvm/tags/checker/checker-12/ - copied from r50242, llvm/trunk/ From kremenek at apple.com Thu Apr 24 21:08:06 2008 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 25 Apr 2008 02:08:06 -0000 Subject: [llvm-commits] [llvm] r50247 - /llvm/tags/checker/checker-13/ Message-ID: <200804250208.m3P286Zh031399@zion.cs.uiuc.edu> Author: kremenek Date: Thu Apr 24 21:08:06 2008 New Revision: 50247 URL: http://llvm.org/viewvc/llvm-project?rev=50247&view=rev Log: Tagging checker-13. Added: llvm/tags/checker/checker-13/ - copied from r50246, llvm/trunk/ From gordonhenriksen at mac.com Thu Apr 24 21:52:30 2008 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Fri, 25 Apr 2008 02:52:30 -0000 Subject: [llvm-commits] [llvm] r50249 - /llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Message-ID: <200804250252.m3P2qU18032552@zion.cs.uiuc.edu> Author: gordon Date: Thu Apr 24 21:52:30 2008 New Revision: 50249 URL: http://llvm.org/viewvc/llvm-project?rev=50249&view=rev Log: PR2202: LLVMCreateInterpreter creates a JIT Applying fix by Frits van Bommel. Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=50249&r1=50248&r2=50249&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Thu Apr 24 21:52:30 2008 @@ -104,7 +104,7 @@ char **OutError) { std::string Error; if (ExecutionEngine *Interp = - ExecutionEngine::create(unwrap(MP), false, &Error)) { + ExecutionEngine::create(unwrap(MP), true, &Error)) { *OutInterp = wrap(Interp); return 0; } From gordonhenriksen at mac.com Thu Apr 24 22:21:20 2008 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Fri, 25 Apr 2008 03:21:20 -0000 Subject: [llvm-commits] [llvm] r50250 - /llvm/trunk/include/llvm-c/Core.h Message-ID: <200804250321.m3P3LKRV000915@zion.cs.uiuc.edu> Author: gordon Date: Thu Apr 24 22:21:19 2008 New Revision: 50250 URL: http://llvm.org/viewvc/llvm-project?rev=50250&view=rev Log: PR2245: Misleading parameter name in llvm-c/Core.h:LLVMConstArray Applying fix by Frits van Bommel. Modified: llvm/trunk/include/llvm-c/Core.h Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=50250&r1=50249&r2=50250&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Thu Apr 24 22:21:19 2008 @@ -306,7 +306,7 @@ /* Operations on composite constants */ LLVMValueRef LLVMConstString(const char *Str, unsigned Length, int DontNullTerminate); -LLVMValueRef LLVMConstArray(LLVMTypeRef ArrayTy, +LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length); LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, int packed); From sabre at nondot.org Thu Apr 24 23:12:30 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Apr 2008 04:12:30 -0000 Subject: [llvm-commits] [llvm] r50251 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Message-ID: <200804250412.m3P4CUdm002328@zion.cs.uiuc.edu> Author: lattner Date: Thu Apr 24 23:12:29 2008 New Revision: 50251 URL: http://llvm.org/viewvc/llvm-project?rev=50251&view=rev Log: Don't infininitely thread branches when a threaded edge goes back to the block, e.g.: Threading edge through bool from 'bb37.us.thread3829' to 'bb37.us' with cost: 1, across block: bb37.us: ; preds = %bb37.us.thread3829, %bb37.us, %bb33 %D1361.1.us = phi i32 [ %tmp36, %bb33 ], [ %D1361.1.us, %bb37.us ], [ 0, %bb37.us.thread3829 ] ; [#uses=2] %tmp39.us = icmp eq i32 %D1361.1.us, 0 ; [#uses=1] br i1 %tmp39.us, label %bb37.us, label %bb42.us Added: llvm/trunk/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=50251&r1=50250&r2=50251&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Thu Apr 24 23:12:29 2008 @@ -250,6 +250,13 @@ SuccBB = SI->getSuccessor(SI->findCaseValue(PredCst)); } + // If threading to the same block as we come from, we would infinite loop. + if (SuccBB == BB) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - would thread to self!\n"; + return false; + } + // And finally, do it! DOUT << " Threading edge from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost @@ -319,6 +326,13 @@ // 'true' block. BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(isAnd); + // If threading to the same block as we come from, we would infinite loop. + if (SuccBB == BB) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - would thread to self!\n"; + return false; + } + // And finally, do it! DOUT << " Threading edge through bool from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " @@ -390,6 +404,14 @@ // Next, get our successor. BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(!TrueDirection); + // If threading to the same block as we come from, we would infinite loop. + if (SuccBB == BB) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - would thread to self!\n"; + return false; + } + + // And finally, do it! DOUT << " Threading edge through bool from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " Added: llvm/trunk/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll?rev=50251&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll (added) +++ llvm/trunk/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Thu Apr 24 23:12:29 2008 @@ -0,0 +1,142 @@ +; RUN: llvm-as < %s | opt -jump-threading -disable-output +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9" + at Link = global [1 x i32] [ i32 -1 ] ; <[1 x i32]*> [#uses=2] + at W = global [1 x i32] [ i32 2 ] ; <[1 x i32]*> [#uses=1] + +define i32 @f(i32 %k, i32 %p) nounwind { +entry: + br label %bb + +bb: ; preds = %bb56, %bb76.loopexit.us, %entry + %j.2 = phi i32 [ 0, %entry ], [ 1, %bb56 ], [ 1, %bb76.loopexit.us ] ; [#uses=5] + %pdest.2 = phi i32 [ 0, %entry ], [ %pdest.8, %bb56 ], [ %pdest.7.us, %bb76.loopexit.us ] ; [#uses=3] + %p_addr.0 = phi i32 [ %p, %entry ], [ 0, %bb56 ], [ %p_addr.1.us, %bb76.loopexit.us ] ; [#uses=3] + %k_addr.0 = phi i32 [ %k, %entry ], [ %tmp59, %bb56 ], [ %tmp59.us, %bb76.loopexit.us ] ; [#uses=4] + %tmp2 = icmp sgt i32 %pdest.2, 2 ; [#uses=1] + br i1 %tmp2, label %bb4.preheader, label %bb13 + +bb4.preheader: ; preds = %bb + %tmp109 = sub i32 1, %j.2 ; [#uses=2] + %tmp110 = icmp slt i32 %tmp109, -2 ; [#uses=1] + %smax111 = select i1 %tmp110, i32 -2, i32 %tmp109 ; [#uses=2] + %tmp112 = add i32 %j.2, %smax111 ; [#uses=2] + br label %bb4 + +bb4: ; preds = %bb4, %bb4.preheader + %indvar = phi i32 [ 0, %bb4.preheader ], [ %indvar.next, %bb4 ] ; [#uses=1] + %indvar.next = add i32 %indvar, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %tmp112 ; [#uses=1] + br i1 %exitcond, label %bb13.loopexit, label %bb4 + +bb13.loopexit: ; preds = %bb4 + %tmp = add i32 %j.2, %pdest.2 ; [#uses=1] + %tmp102 = add i32 %tmp, %smax111 ; [#uses=1] + %tmp104 = add i32 %tmp112, -1 ; [#uses=1] + %tmp106 = sub i32 %j.2, %tmp104 ; [#uses=1] + %tmp107 = add i32 %tmp106, -1 ; [#uses=1] + br label %bb13 + +bb13: ; preds = %bb13.loopexit, %bb + %j.1 = phi i32 [ %tmp107, %bb13.loopexit ], [ %j.2, %bb ] ; [#uses=4] + %pdest.1 = phi i32 [ %tmp102, %bb13.loopexit ], [ %pdest.2, %bb ] ; [#uses=2] + %tmp15 = icmp eq i32 %j.1, 1 ; [#uses=1] + br i1 %tmp15, label %bb82, label %bb27.preheader + +bb27.preheader: ; preds = %bb13 + %tmp21 = icmp eq i32 %j.1, %p_addr.0 ; [#uses=0] + br label %bb27.outer + +bb27.outer: ; preds = %bb27.outer.bb24.split_crit_edge, %bb27.preheader + %indvar118 = phi i32 [ 0, %bb27.preheader ], [ %indvar.next119, %bb27.outer.bb24.split_crit_edge ] ; [#uses=2] + %pdest.3.ph = add i32 %indvar118, %pdest.1 ; [#uses=2] + %tmp30 = icmp sgt i32 %pdest.3.ph, %p_addr.0 ; [#uses=1] + br i1 %tmp30, label %bb27.outer.bb24.split_crit_edge, label %bb27.outer.split + +bb27.outer.bb24.split_crit_edge: ; preds = %bb27.outer + %indvar.next119 = add i32 %indvar118, 1 ; [#uses=1] + br label %bb27.outer + +bb27.outer.split: ; preds = %bb27.outer + %tmp35 = getelementptr [1 x i32]* @W, i32 0, i32 %k_addr.0 ; [#uses=3] + %tmp48 = icmp slt i32 %p_addr.0, 1 ; [#uses=1] + %tmp53 = icmp sgt i32 %k_addr.0, 0 ; [#uses=1] + br label %bb33 + +bb33: ; preds = %bb51.split, %bb27.outer.split + %pdest.5 = phi i32 [ %pdest.3.ph, %bb27.outer.split ], [ %pdest.4, %bb51.split ] ; [#uses=1] + %tmp36 = load i32* %tmp35, align 4 ; [#uses=2] + br i1 %tmp48, label %bb37.us, label %bb37 + +bb37.us: ; preds = %bb42.us, %bb37.us, %bb33 + %D1361.1.us = phi i32 [ %tmp36, %bb33 ], [ 0, %bb42.us ], [ %D1361.1.us, %bb37.us ] ; [#uses=2] + %tmp39.us = icmp eq i32 %D1361.1.us, 0 ; [#uses=1] + br i1 %tmp39.us, label %bb37.us, label %bb42.us + +bb42.us: ; preds = %bb37.us + store i32 0, i32* %tmp35, align 4 + br label %bb37.us + +bb37: ; preds = %bb33 + %tmp39 = icmp eq i32 %tmp36, 0 ; [#uses=1] + br i1 %tmp39, label %bb51.split, label %bb42 + +bb42: ; preds = %bb37 + store i32 0, i32* %tmp35, align 4 + br label %bb51.split + +bb51.split: ; preds = %bb42, %bb37 + %pdest.4 = phi i32 [ 1, %bb42 ], [ %pdest.5, %bb37 ] ; [#uses=3] + br i1 %tmp53, label %bb33, label %bb56.preheader + +bb56.preheader: ; preds = %bb51.split + %tmp7394 = icmp sgt i32 %j.1, 0 ; [#uses=1] + br i1 %tmp7394, label %bb56.us, label %bb56 + +bb56.us: ; preds = %bb76.loopexit.us, %bb56.preheader + %pdest.8.us = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.7.us, %bb76.loopexit.us ] ; [#uses=1] + %k_addr.1.us = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59.us, %bb76.loopexit.us ] ; [#uses=1] + %tmp58.us = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1.us ; [#uses=1] + %tmp59.us = load i32* %tmp58.us, align 4 ; [#uses=3] + %tmp6295.us = icmp ne i32 %tmp59.us, -1 ; [#uses=2] + br label %bb60.us + +bb60.us: ; preds = %bb60.us, %bb56.us + %pdest.7.reg2mem.0.us = phi i32 [ %pdest.8.us, %bb56.us ], [ %pdest.7.us, %bb60.us ] ; [#uses=1] + %p_addr.1.reg2mem.0.us = phi i32 [ 0, %bb56.us ], [ %p_addr.1.us, %bb60.us ] ; [#uses=1] + %tmp67.us = zext i1 %tmp6295.us to i32 ; [#uses=2] + %pdest.7.us = add i32 %pdest.7.reg2mem.0.us, %tmp67.us ; [#uses=3] + %p_addr.1.us = add i32 %p_addr.1.reg2mem.0.us, %tmp67.us ; [#uses=3] + %tmp73.us = icmp slt i32 %p_addr.1.us, %j.1 ; [#uses=1] + br i1 %tmp73.us, label %bb60.us, label %bb76.loopexit.us + +bb76.loopexit.us: ; preds = %bb60.us + br i1 %tmp6295.us, label %bb56.us, label %bb + +bb56: ; preds = %bb56, %bb56.preheader + %pdest.8 = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.8, %bb56 ] ; [#uses=2] + %k_addr.1 = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59, %bb56 ] ; [#uses=1] + %tmp58 = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1 ; [#uses=1] + %tmp59 = load i32* %tmp58, align 4 ; [#uses=3] + %tmp6295 = icmp ne i32 %tmp59, -1 ; [#uses=1] + br i1 %tmp6295, label %bb56, label %bb + +bb82: ; preds = %bb13 + ret i32 %pdest.1 +} + +define i32 @main() nounwind { +entry: + %tmp1 = tail call i32 @f( i32 0, i32 2 ) nounwind ; [#uses=1] + %tmp2 = icmp eq i32 %tmp1, 0 ; [#uses=1] + br i1 %tmp2, label %bb, label %bb4 + +bb: ; preds = %entry + tail call void @abort( ) noreturn nounwind + unreachable + +bb4: ; preds = %entry + ret i32 0 +} + +declare void @abort() noreturn nounwind From sabre at nondot.org Fri Apr 25 00:13:01 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Apr 2008 05:13:01 -0000 Subject: [llvm-commits] [llvm] r50252 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll Message-ID: <200804250513.m3P5D2Yn003956@zion.cs.uiuc.edu> Author: lattner Date: Fri Apr 25 00:13:01 2008 New Revision: 50252 URL: http://llvm.org/viewvc/llvm-project?rev=50252&view=rev Log: Loosen up an assertion to allow intrinsics. I really have no idea what this code (findNonImmUse) does, so I'm only guessing that this is the right thing. It would be really really nice if this had comments and perhaps switched to SmallPtrSet (hint hint) :) This fixes rdar://5886601, a crash on gcc.target/i386/sse4_1-pblendw.c Added: llvm/trunk/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=50252&r1=50251&r2=50252&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Apr 25 00:13:01 2008 @@ -252,7 +252,10 @@ continue; // Immediate use is ok. if (Use == Root) { assert(Use->getOpcode() == ISD::STORE || - Use->getOpcode() == X86ISD::CMP); + Use->getOpcode() == X86ISD::CMP || + Use->getOpcode() == ISD::INTRINSIC_WO_CHAIN || + Use->getOpcode() == ISD::INTRINSIC_W_CHAIN || + Use->getOpcode() == ISD::INTRINSIC_VOID); continue; } found = true; Added: llvm/trunk/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll?rev=50252&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll Fri Apr 25 00:13:01 2008 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -mattr=+sse41 +; rdar://5886601 +; gcc testsuite: gcc.target/i386/sse4_1-pblendw.c +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin8" + +define i32 @main() nounwind { +entry: + %tmp122 = load <2 x i64>* null, align 16 ; <<2 x i64>> [#uses=1] + %tmp126 = bitcast <2 x i64> %tmp122 to <8 x i16> ; <<8 x i16>> [#uses=1] + %tmp129 = call <8 x i16> @llvm.x86.sse41.pblendw( <8 x i16> zeroinitializer, <8 x i16> %tmp126, i32 2 ) nounwind ; <<8 x i16>> [#uses=0] + ret i32 0 +} + +declare <8 x i16> @llvm.x86.sse41.pblendw(<8 x i16>, <8 x i16>, i32) nounwind From nicholas at mxc.ca Fri Apr 25 00:27:15 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 24 Apr 2008 22:27:15 -0700 Subject: [llvm-commits] [llvm] r50210 - /llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp In-Reply-To: <200804240947.m3O9l0tZ032712@zion.cs.uiuc.edu> References: <200804240947.m3O9l0tZ032712@zion.cs.uiuc.edu> Message-ID: <48116BB3.3010404@mxc.ca> Gabor Greif wrote: > Author: ggreif > Date: Thu Apr 24 04:46:58 2008 > New Revision: 50210 > > URL: http://llvm.org/viewvc/llvm-project?rev=50210&view=rev > Log: > document the magic numbers > > Modified: > llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp > > Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50210&r1=50209&r2=50210&view=diff > > ============================================================================== > --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original) > +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Thu Apr 24 04:46:58 2008 > @@ -149,6 +149,16 @@ > void BitcodeReaderValueList::resize(unsigned Desired) { > if (Desired > Capacity) > { > + // Since we expect many values > + // to come from the bitcode file > + // we better allocate the double > + // amount, so that the array size > + // grows exponentially at each > + // reallocation. Also, add a small > + // amount of 100 extra elements > + // each time, to reallocate less > + // frequently when the array > + // is still small. Unless you're speaking in verse, please wrap at 80 columns. > Capacity = Desired * 2 + 100; > Use *New = allocHungoffUses(Capacity); > Use *Old = OperandList; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From isanbard at gmail.com Fri Apr 25 00:46:14 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Apr 2008 05:46:14 -0000 Subject: [llvm-commits] [llvm] r50253 - in /llvm/branches/Apple/Tak: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Message-ID: <200804250546.m3P5kEPc004925@zion.cs.uiuc.edu> Author: void Date: Fri Apr 25 00:46:13 2008 New Revision: 50253 URL: http://llvm.org/viewvc/llvm-project?rev=50253&view=rev Log: Porting r50251 to Tak branch. Added: llvm/branches/Apple/Tak/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Modified: llvm/branches/Apple/Tak/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/branches/Apple/Tak/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Transforms/Scalar/JumpThreading.cpp?rev=50253&r1=50252&r2=50253&view=diff ============================================================================== --- llvm/branches/Apple/Tak/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/branches/Apple/Tak/lib/Transforms/Scalar/JumpThreading.cpp Fri Apr 25 00:46:13 2008 @@ -250,6 +250,13 @@ SuccBB = SI->getSuccessor(SI->findCaseValue(PredCst)); } + // If threading to the same block as we come from, we would infinite loop. + if (SuccBB == BB) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - would thread to self!\n"; + return false; + } + // And finally, do it! DOUT << " Threading edge from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost @@ -319,6 +326,13 @@ // 'true' block. BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(isAnd); + // If threading to the same block as we come from, we would infinite loop. + if (SuccBB == BB) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - would thread to self!\n"; + return false; + } + // And finally, do it! DOUT << " Threading edge through bool from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " @@ -390,6 +404,14 @@ // Next, get our successor. BasicBlock *SuccBB = BB->getTerminator()->getSuccessor(!TrueDirection); + // If threading to the same block as we come from, we would infinite loop. + if (SuccBB == BB) { + DOUT << " Not threading BB '" << BB->getNameStart() + << "' - would thread to self!\n"; + return false; + } + + // And finally, do it! DOUT << " Threading edge through bool from '" << PredBB->getNameStart() << "' to '" << SuccBB->getNameStart() << "' with cost: " Added: llvm/branches/Apple/Tak/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll?rev=50253&view=auto ============================================================================== --- llvm/branches/Apple/Tak/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll (added) +++ llvm/branches/Apple/Tak/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Fri Apr 25 00:46:13 2008 @@ -0,0 +1,142 @@ +; RUN: llvm-as < %s | opt -jump-threading -disable-output +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9" + at Link = global [1 x i32] [ i32 -1 ] ; <[1 x i32]*> [#uses=2] + at W = global [1 x i32] [ i32 2 ] ; <[1 x i32]*> [#uses=1] + +define i32 @f(i32 %k, i32 %p) nounwind { +entry: + br label %bb + +bb: ; preds = %bb56, %bb76.loopexit.us, %entry + %j.2 = phi i32 [ 0, %entry ], [ 1, %bb56 ], [ 1, %bb76.loopexit.us ] ; [#uses=5] + %pdest.2 = phi i32 [ 0, %entry ], [ %pdest.8, %bb56 ], [ %pdest.7.us, %bb76.loopexit.us ] ; [#uses=3] + %p_addr.0 = phi i32 [ %p, %entry ], [ 0, %bb56 ], [ %p_addr.1.us, %bb76.loopexit.us ] ; [#uses=3] + %k_addr.0 = phi i32 [ %k, %entry ], [ %tmp59, %bb56 ], [ %tmp59.us, %bb76.loopexit.us ] ; [#uses=4] + %tmp2 = icmp sgt i32 %pdest.2, 2 ; [#uses=1] + br i1 %tmp2, label %bb4.preheader, label %bb13 + +bb4.preheader: ; preds = %bb + %tmp109 = sub i32 1, %j.2 ; [#uses=2] + %tmp110 = icmp slt i32 %tmp109, -2 ; [#uses=1] + %smax111 = select i1 %tmp110, i32 -2, i32 %tmp109 ; [#uses=2] + %tmp112 = add i32 %j.2, %smax111 ; [#uses=2] + br label %bb4 + +bb4: ; preds = %bb4, %bb4.preheader + %indvar = phi i32 [ 0, %bb4.preheader ], [ %indvar.next, %bb4 ] ; [#uses=1] + %indvar.next = add i32 %indvar, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %tmp112 ; [#uses=1] + br i1 %exitcond, label %bb13.loopexit, label %bb4 + +bb13.loopexit: ; preds = %bb4 + %tmp = add i32 %j.2, %pdest.2 ; [#uses=1] + %tmp102 = add i32 %tmp, %smax111 ; [#uses=1] + %tmp104 = add i32 %tmp112, -1 ; [#uses=1] + %tmp106 = sub i32 %j.2, %tmp104 ; [#uses=1] + %tmp107 = add i32 %tmp106, -1 ; [#uses=1] + br label %bb13 + +bb13: ; preds = %bb13.loopexit, %bb + %j.1 = phi i32 [ %tmp107, %bb13.loopexit ], [ %j.2, %bb ] ; [#uses=4] + %pdest.1 = phi i32 [ %tmp102, %bb13.loopexit ], [ %pdest.2, %bb ] ; [#uses=2] + %tmp15 = icmp eq i32 %j.1, 1 ; [#uses=1] + br i1 %tmp15, label %bb82, label %bb27.preheader + +bb27.preheader: ; preds = %bb13 + %tmp21 = icmp eq i32 %j.1, %p_addr.0 ; [#uses=0] + br label %bb27.outer + +bb27.outer: ; preds = %bb27.outer.bb24.split_crit_edge, %bb27.preheader + %indvar118 = phi i32 [ 0, %bb27.preheader ], [ %indvar.next119, %bb27.outer.bb24.split_crit_edge ] ; [#uses=2] + %pdest.3.ph = add i32 %indvar118, %pdest.1 ; [#uses=2] + %tmp30 = icmp sgt i32 %pdest.3.ph, %p_addr.0 ; [#uses=1] + br i1 %tmp30, label %bb27.outer.bb24.split_crit_edge, label %bb27.outer.split + +bb27.outer.bb24.split_crit_edge: ; preds = %bb27.outer + %indvar.next119 = add i32 %indvar118, 1 ; [#uses=1] + br label %bb27.outer + +bb27.outer.split: ; preds = %bb27.outer + %tmp35 = getelementptr [1 x i32]* @W, i32 0, i32 %k_addr.0 ; [#uses=3] + %tmp48 = icmp slt i32 %p_addr.0, 1 ; [#uses=1] + %tmp53 = icmp sgt i32 %k_addr.0, 0 ; [#uses=1] + br label %bb33 + +bb33: ; preds = %bb51.split, %bb27.outer.split + %pdest.5 = phi i32 [ %pdest.3.ph, %bb27.outer.split ], [ %pdest.4, %bb51.split ] ; [#uses=1] + %tmp36 = load i32* %tmp35, align 4 ; [#uses=2] + br i1 %tmp48, label %bb37.us, label %bb37 + +bb37.us: ; preds = %bb42.us, %bb37.us, %bb33 + %D1361.1.us = phi i32 [ %tmp36, %bb33 ], [ 0, %bb42.us ], [ %D1361.1.us, %bb37.us ] ; [#uses=2] + %tmp39.us = icmp eq i32 %D1361.1.us, 0 ; [#uses=1] + br i1 %tmp39.us, label %bb37.us, label %bb42.us + +bb42.us: ; preds = %bb37.us + store i32 0, i32* %tmp35, align 4 + br label %bb37.us + +bb37: ; preds = %bb33 + %tmp39 = icmp eq i32 %tmp36, 0 ; [#uses=1] + br i1 %tmp39, label %bb51.split, label %bb42 + +bb42: ; preds = %bb37 + store i32 0, i32* %tmp35, align 4 + br label %bb51.split + +bb51.split: ; preds = %bb42, %bb37 + %pdest.4 = phi i32 [ 1, %bb42 ], [ %pdest.5, %bb37 ] ; [#uses=3] + br i1 %tmp53, label %bb33, label %bb56.preheader + +bb56.preheader: ; preds = %bb51.split + %tmp7394 = icmp sgt i32 %j.1, 0 ; [#uses=1] + br i1 %tmp7394, label %bb56.us, label %bb56 + +bb56.us: ; preds = %bb76.loopexit.us, %bb56.preheader + %pdest.8.us = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.7.us, %bb76.loopexit.us ] ; [#uses=1] + %k_addr.1.us = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59.us, %bb76.loopexit.us ] ; [#uses=1] + %tmp58.us = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1.us ; [#uses=1] + %tmp59.us = load i32* %tmp58.us, align 4 ; [#uses=3] + %tmp6295.us = icmp ne i32 %tmp59.us, -1 ; [#uses=2] + br label %bb60.us + +bb60.us: ; preds = %bb60.us, %bb56.us + %pdest.7.reg2mem.0.us = phi i32 [ %pdest.8.us, %bb56.us ], [ %pdest.7.us, %bb60.us ] ; [#uses=1] + %p_addr.1.reg2mem.0.us = phi i32 [ 0, %bb56.us ], [ %p_addr.1.us, %bb60.us ] ; [#uses=1] + %tmp67.us = zext i1 %tmp6295.us to i32 ; [#uses=2] + %pdest.7.us = add i32 %pdest.7.reg2mem.0.us, %tmp67.us ; [#uses=3] + %p_addr.1.us = add i32 %p_addr.1.reg2mem.0.us, %tmp67.us ; [#uses=3] + %tmp73.us = icmp slt i32 %p_addr.1.us, %j.1 ; [#uses=1] + br i1 %tmp73.us, label %bb60.us, label %bb76.loopexit.us + +bb76.loopexit.us: ; preds = %bb60.us + br i1 %tmp6295.us, label %bb56.us, label %bb + +bb56: ; preds = %bb56, %bb56.preheader + %pdest.8 = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.8, %bb56 ] ; [#uses=2] + %k_addr.1 = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59, %bb56 ] ; [#uses=1] + %tmp58 = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1 ; [#uses=1] + %tmp59 = load i32* %tmp58, align 4 ; [#uses=3] + %tmp6295 = icmp ne i32 %tmp59, -1 ; [#uses=1] + br i1 %tmp6295, label %bb56, label %bb + +bb82: ; preds = %bb13 + ret i32 %pdest.1 +} + +define i32 @main() nounwind { +entry: + %tmp1 = tail call i32 @f( i32 0, i32 2 ) nounwind ; [#uses=1] + %tmp2 = icmp eq i32 %tmp1, 0 ; [#uses=1] + br i1 %tmp2, label %bb, label %bb4 + +bb: ; preds = %entry + tail call void @abort( ) noreturn nounwind + unreachable + +bb4: ; preds = %entry + ret i32 0 +} + +declare void @abort() noreturn nounwind From isanbard at gmail.com Fri Apr 25 00:47:26 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Apr 2008 05:47:26 -0000 Subject: [llvm-commits] [llvm] r50254 - in /llvm/branches/Apple/Tak: lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll Message-ID: <200804250547.m3P5lQrE004982@zion.cs.uiuc.edu> Author: void Date: Fri Apr 25 00:47:26 2008 New Revision: 50254 URL: http://llvm.org/viewvc/llvm-project?rev=50254&view=rev Log: Applied r50252 to Tak branch. Added: llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=50254&r1=50253&r2=50254&view=diff ============================================================================== --- llvm/branches/Apple/Tak/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/branches/Apple/Tak/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Apr 25 00:47:26 2008 @@ -252,7 +252,10 @@ continue; // Immediate use is ok. if (Use == Root) { assert(Use->getOpcode() == ISD::STORE || - Use->getOpcode() == X86ISD::CMP); + Use->getOpcode() == X86ISD::CMP || + Use->getOpcode() == ISD::INTRINSIC_WO_CHAIN || + Use->getOpcode() == ISD::INTRINSIC_W_CHAIN || + Use->getOpcode() == ISD::INTRINSIC_VOID); continue; } found = true; Added: llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll?rev=50254&view=auto ============================================================================== --- llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll (added) +++ llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll Fri Apr 25 00:47:26 2008 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -mattr=+sse41 +; rdar://5886601 +; gcc testsuite: gcc.target/i386/sse4_1-pblendw.c +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin8" + +define i32 @main() nounwind { +entry: + %tmp122 = load <2 x i64>* null, align 16 ; <<2 x i64>> [#uses=1] + %tmp126 = bitcast <2 x i64> %tmp122 to <8 x i16> ; <<8 x i16>> [#uses=1] + %tmp129 = call <8 x i16> @llvm.x86.sse41.pblendw( <8 x i16> zeroinitializer, <8 x i16> %tmp126, i32 2 ) nounwind ; <<8 x i16>> [#uses=0] + ret i32 0 +} + +declare <8 x i16> @llvm.x86.sse41.pblendw(<8 x i16>, <8 x i16>, i32) nounwind From isanbard at gmail.com Fri Apr 25 00:48:36 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Apr 2008 05:48:36 -0000 Subject: [llvm-commits] [llvm] r50255 - in /llvm/branches/Apple/Tak: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-04-24-MemCpyBug.ll Message-ID: <200804250548.m3P5maF9005035@zion.cs.uiuc.edu> Author: void Date: Fri Apr 25 00:48:35 2008 New Revision: 50255 URL: http://llvm.org/viewvc/llvm-project?rev=50255&view=rev Log: Applie r50239 to Tak branch. Added: llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp?rev=50255&r1=50254&r2=50255&view=diff ============================================================================== --- llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp Fri Apr 25 00:48:35 2008 @@ -4822,7 +4822,7 @@ DAG.getConstant(Offset, AddrVT)), Src, DAG.getConstant(BytesLeft, SizeVT), - Align, DstSV, Offset); + Align, DstSV, 0); } // TODO: Use a Tokenfactor, as in memcpy, instead of a single chain. @@ -4847,8 +4847,6 @@ if (!AlwaysInline && SizeVal > getSubtarget()->getMaxInlineSizeThreshold()) return SDOperand(); - SmallVector Results; - MVT::ValueType AVT; unsigned BytesLeft = 0; if (Align >= 8 && Subtarget->is64Bit()) @@ -4881,25 +4879,24 @@ Ops.push_back(Chain); Ops.push_back(DAG.getValueType(AVT)); Ops.push_back(InFlag); - Results.push_back(DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], Ops.size())); + SDOperand RepMovs = DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], Ops.size()); + SmallVector Results; + Results.push_back(RepMovs); if (BytesLeft) { // Handle the last 1 - 7 bytes. unsigned Offset = SizeVal - BytesLeft; MVT::ValueType DstVT = Dst.getValueType(); MVT::ValueType SrcVT = Src.getValueType(); MVT::ValueType SizeVT = Size.getValueType(); - - Results.push_back(DAG.getMemcpy(Chain, + Results.push_back(DAG.getMemcpy(Chain, DAG.getNode(ISD::ADD, DstVT, Dst, - DAG.getConstant(Offset, - DstVT)), + DAG.getConstant(Offset, DstVT)), DAG.getNode(ISD::ADD, SrcVT, Src, - DAG.getConstant(Offset, - SrcVT)), + DAG.getConstant(Offset, SrcVT)), DAG.getConstant(BytesLeft, SizeVT), Align, AlwaysInline, - DstSV, Offset, SrcSV, Offset)); + DstSV, 0, SrcSV, 0)); } return DAG.getNode(ISD::TokenFactor, MVT::Other, &Results[0], Results.size()); Added: llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll?rev=50255&view=auto ============================================================================== --- llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll (added) +++ llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll Fri Apr 25 00:48:35 2008 @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=x86 | not grep 120 +; Don't accidentally add the offset twice for trailing bytes. + + %struct.S63 = type { [63 x i8] } + at g1s63 = external global %struct.S63 ; <%struct.S63*> [#uses=1] + +declare void @test63(%struct.S63* byval align 4 ) nounwind + +define void @testit63_entry_2E_ce() nounwind { + tail call void @test63( %struct.S63* byval align 4 @g1s63 ) nounwind + ret void +} From natebegeman at mac.com Fri Apr 25 01:37:06 2008 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 25 Apr 2008 06:37:06 -0000 Subject: [llvm-commits] [llvm] r50256 - /llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Message-ID: <200804250637.m3P6b6aU006349@zion.cs.uiuc.edu> Author: sampo Date: Fri Apr 25 01:37:06 2008 New Revision: 50256 URL: http://llvm.org/viewvc/llvm-project?rev=50256&view=rev Log: Teach the PruningFunctionCloner how to look through loads with ConstantExpression GEPs pointing into constant globals. Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=50256&r1=50255&r2=50256&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Fri Apr 25 01:37:06 2008 @@ -17,6 +17,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" +#include "llvm/GlobalVariable.h" #include "llvm/Function.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" @@ -308,13 +309,20 @@ else return 0; // All operands not constant! - if (const CmpInst *CI = dyn_cast(I)) return ConstantFoldCompareInstOperands(CI->getPredicate(), &Ops[0], Ops.size(), TD); - else - return ConstantFoldInstOperands(I->getOpcode(), I->getType(), - &Ops[0], Ops.size(), TD); + + if (ConstantExpr *CE = dyn_cast(Ops[0])) + if (const LoadInst *LI = dyn_cast(I)) + if (!LI->isVolatile() && CE->getOpcode() == Instruction::GetElementPtr) + if (GlobalVariable *GV = dyn_cast(CE->getOperand(0))) + if (GV->isConstant() && !GV->isDeclaration()) + return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), + CE); + + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), &Ops[0], + Ops.size(), TD); } /// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, From evan.cheng at apple.com Fri Apr 25 02:00:04 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Apr 2008 00:00:04 -0700 Subject: [llvm-commits] [llvm] r50255 - in /llvm/branches/Apple/Tak: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-04-24-MemCpyBug.ll In-Reply-To: <200804250548.m3P5maF9005035@zion.cs.uiuc.edu> References: <200804250548.m3P5maF9005035@zion.cs.uiuc.edu> Message-ID: <31825BC0-FF05-45BE-8F64-1E6BC066B725@apple.com> Thanks Bill. Evan On Apr 24, 2008, at 10:48 PM, Bill Wendling wrote: > Author: void > Date: Fri Apr 25 00:48:35 2008 > New Revision: 50255 > > URL: http://llvm.org/viewvc/llvm-project?rev=50255&view=rev > Log: > Applie r50239 to Tak branch. > > Added: > llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll > Modified: > llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp > > Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp?rev=50255&r1=50254&r2=50255&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp > (original) > +++ llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp Fri > Apr 25 00:48:35 2008 > @@ -4822,7 +4822,7 @@ > DAG.getConstant(Offset, > AddrVT)), > Src, > DAG.getConstant(BytesLeft, SizeVT), > - Align, DstSV, Offset); > + Align, DstSV, 0); > } > > // TODO: Use a Tokenfactor, as in memcpy, instead of a single chain. > @@ -4847,8 +4847,6 @@ > if (!AlwaysInline && SizeVal > getSubtarget()- > >getMaxInlineSizeThreshold()) > return SDOperand(); > > - SmallVector Results; > - > MVT::ValueType AVT; > unsigned BytesLeft = 0; > if (Align >= 8 && Subtarget->is64Bit()) > @@ -4881,25 +4879,24 @@ > Ops.push_back(Chain); > Ops.push_back(DAG.getValueType(AVT)); > Ops.push_back(InFlag); > - Results.push_back(DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], > Ops.size())); > + SDOperand RepMovs = DAG.getNode(X86ISD::REP_MOVS, Tys, &Ops[0], > Ops.size()); > > + SmallVector Results; > + Results.push_back(RepMovs); > if (BytesLeft) { > // Handle the last 1 - 7 bytes. > unsigned Offset = SizeVal - BytesLeft; > MVT::ValueType DstVT = Dst.getValueType(); > MVT::ValueType SrcVT = Src.getValueType(); > MVT::ValueType SizeVT = Size.getValueType(); > - > - Results.push_back(DAG.getMemcpy(Chain, > + Results.push_back(DAG.getMemcpy(Chain, > DAG.getNode(ISD::ADD, DstVT, Dst, > - > DAG.getConstant(Offset, > - > DstVT)), > + > DAG.getConstant(Offset, DstVT)), > DAG.getNode(ISD::ADD, SrcVT, Src, > - > DAG.getConstant(Offset, > - > SrcVT)), > + > DAG.getConstant(Offset, SrcVT)), > DAG.getConstant(BytesLeft, > SizeVT), > Align, AlwaysInline, > - DstSV, Offset, SrcSV, Offset)); > + DstSV, 0, SrcSV, 0)); > } > > return DAG.getNode(ISD::TokenFactor, MVT::Other, &Results[0], > Results.size()); > > Added: llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24- > MemCpyBug.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll?rev=50255&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll > (added) > +++ llvm/branches/Apple/Tak/test/CodeGen/X86/2008-04-24-MemCpyBug.ll > Fri Apr 25 00:48:35 2008 > @@ -0,0 +1,12 @@ > +; RUN: llvm-as < %s | llc -march=x86 | not grep 120 > +; Don't accidentally add the offset twice for trailing bytes. > + > + %struct.S63 = type { [63 x i8] } > + at g1s63 = external global %struct.S63 ; <%struct.S63*> [#uses=1] > + > +declare void @test63(%struct.S63* byval align 4 ) nounwind > + > +define void @testit63_entry_2E_ce() nounwind { > + tail call void @test63( %struct.S63* byval align 4 @g1s63 ) > nounwind > + ret void > +} > > > _______________________________________________ > 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 Fri Apr 25 02:56:45 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Apr 2008 07:56:45 -0000 Subject: [llvm-commits] [llvm] r50257 - in /llvm/trunk: lib/Target/X86/X86CallingConv.td lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/mmx-arg-passing.ll Message-ID: <200804250756.m3P7ukmF016766@zion.cs.uiuc.edu> Author: evancheng Date: Fri Apr 25 02:56:45 2008 New Revision: 50257 URL: http://llvm.org/viewvc/llvm-project?rev=50257&view=rev Log: MMX argument passing fixes: On Darwin / Linux x86-32, v8i8, v4i16, v2i32 values are passed in MM[0-2]. On Darwin / Linux x86-32, v1i64 values are passed in memory. On Darwin x86-64, v8i8, v4i16, v2i32 values are passed in XMM[0-7]. On Darwin x86-64, v1i64 values are passed in 64-bit GPRs. Added: llvm/trunk/test/CodeGen/X86/mmx-arg-passing.ll Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=50257&r1=50256&r2=50257&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Fri Apr 25 02:56:45 2008 @@ -133,12 +133,20 @@ // The first 8 FP/Vector arguments are passed in XMM registers. CCIfType<[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], - CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, - - // The first 8 MMX vector arguments are passed in GPRs. - CCIfType<[v8i8, v4i16, v2i32, v1i64], - CCAssignToReg<[RDI, RSI, RDX, RCX, R8 , R9 ]>>, + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, + // The first 8 MMX (except for v1i64) vector arguments are passed in XMM + // registers on Darwin. + CCIfType<[v8i8, v4i16, v2i32], + CCIfSubtarget<"isTargetDarwin()", + CCIfSubtarget<"hasSSE2()", + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>>, + + // The first 8 v1i64 vector arguments are passed in GPRs on Darwin. + CCIfType<[v1i64], + CCIfSubtarget<"isTargetDarwin()", + CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>>, + // Integer/FP values get stored in stack slots that are 8 bytes in size and // 8-byte aligned if there are no more registers to hold them. CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>, @@ -211,12 +219,19 @@ // The first 8 FP/Vector arguments are passed in XMM registers. CCIfType<[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], - CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, - - // The first 8 MMX vector arguments are passed in GPRs. - CCIfType<[v8i8, v4i16, v2i32, v1i64], - CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>, + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, + // The first 8 MMX (except for v1i64) vector arguments are passed in XMM + // registers on Darwin. + CCIfType<[v8i8, v4i16, v2i32], + CCIfSubtarget<"isTargetDarwin()", + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>, + + // The first 8 v1i64 vector arguments are passed in GPRs on Darwin. + CCIfType<[v1i64], + CCIfSubtarget<"isTargetDarwin()", + CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>>, + // Integer/FP values get stored in stack slots that are 8 bytes in size and // 8-byte aligned if there are no more registers to hold them. CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>, @@ -242,9 +257,15 @@ // The first 3 float or double arguments, if marked 'inreg' and if the call // is not a vararg call and if SSE2 is available, are passed in SSE registers. - CCIfNotVarArg>>>>, + // The first 3 __m64 (except for v1i64) vector arguments are passed in mmx + // registers if the call is not a vararg call. + CCIfNotVarArg>>, + // Integer/Float values get stored in stack slots that are 4 bytes in // size and 4-byte aligned. CCIfType<[i32, f32], CCAssignToStack<4, 4>>, @@ -264,8 +285,7 @@ // __m64 vectors get 8-byte stack slots that are 4-byte aligned. They are // passed in the parameter area. - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 4>> -]>; + CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 4>>]>; def CC_X86_32_C : CallingConv<[ // Promote i8/i16 arguments to i32. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=50257&r1=50256&r2=50257&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Apr 25 02:56:45 2008 @@ -1207,13 +1207,25 @@ RC = X86::FR32RegisterClass; else if (RegVT == MVT::f64) RC = X86::FR64RegisterClass; - else { - assert(MVT::isVector(RegVT)); - if (Is64Bit && MVT::getSizeInBits(RegVT) == 64) { - RC = X86::GR64RegisterClass; // MMX values are passed in GPRs. - RegVT = MVT::i64; - } else - RC = X86::VR128RegisterClass; + else if (MVT::isVector(RegVT) && MVT::getSizeInBits(RegVT) == 128) + RC = X86::VR128RegisterClass; + else if (MVT::isVector(RegVT)) { + assert(MVT::getSizeInBits(RegVT) == 64); + if (!Is64Bit) + RC = X86::VR64RegisterClass; // MMX values are passed in MMXs. + else { + // Darwin calling convention passes MMX values in either GPRs or + // XMMs in x86-64. Other targets pass them in memory. + if (RegVT != MVT::v1i64 && Subtarget->hasSSE2()) { + RC = X86::VR128RegisterClass; // MMX values are passed in XMMs. + RegVT = MVT::v2i64; + } else { + RC = X86::GR64RegisterClass; // v1i64 values are passed in GPRs. + RegVT = MVT::i64; + } + } + } else { + assert(0 && "Unknown argument type!"); } unsigned Reg = AddLiveIn(DAG.getMachineFunction(), VA.getLocReg(), RC); Added: llvm/trunk/test/CodeGen/X86/mmx-arg-passing.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mmx-arg-passing.ll?rev=50257&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/mmx-arg-passing.ll (added) +++ llvm/trunk/test/CodeGen/X86/mmx-arg-passing.ll Fri Apr 25 02:56:45 2008 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+mmx | grep mm0 | count 3 +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+mmx | grep esp | count 1 +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -mattr=+mmx,+sse2 | grep xmm0 +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -mattr=+mmx,+sse2 | grep rdi +; +; On Darwin x86-32, v8i8, v4i16, v2i32 values are passed in MM[0-2]. +; On Darwin x86-32, v1i64 values are passed in memory. +; On Darwin x86-64, v8i8, v4i16, v2i32 values are passed in XMM[0-7]. +; On Darwin x86-64, v1i64 values are passed in 64-bit GPRs. + + at u1 = external global <8 x i8> + +define void @t1(<8 x i8> %v1) nounwind { + store <8 x i8> %v1, <8 x i8>* @u1, align 8 + ret void +} + + at u2 = external global <1 x i64> + +define void @t2(<1 x i64> %v1) nounwind { + store <1 x i64> %v1, <1 x i64>* @u2, align 8 + ret void +} From isanbard at gmail.com Fri Apr 25 03:05:49 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Apr 2008 08:05:49 -0000 Subject: [llvm-commits] [llvm] r50258 - in /llvm/branches/Apple/Tak: lib/Target/X86/X86CallingConv.td lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/mmx-arg-passing.ll Message-ID: <200804250805.m3P85oWA017040@zion.cs.uiuc.edu> Author: void Date: Fri Apr 25 03:05:49 2008 New Revision: 50258 URL: http://llvm.org/viewvc/llvm-project?rev=50258&view=rev Log: Ported r50257 to Tak branch. Added: llvm/branches/Apple/Tak/test/CodeGen/X86/mmx-arg-passing.ll Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86CallingConv.td llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Target/X86/X86CallingConv.td?rev=50258&r1=50257&r2=50258&view=diff ============================================================================== --- llvm/branches/Apple/Tak/lib/Target/X86/X86CallingConv.td (original) +++ llvm/branches/Apple/Tak/lib/Target/X86/X86CallingConv.td Fri Apr 25 03:05:49 2008 @@ -133,12 +133,20 @@ // The first 8 FP/Vector arguments are passed in XMM registers. CCIfType<[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], - CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, - - // The first 8 MMX vector arguments are passed in GPRs. - CCIfType<[v8i8, v4i16, v2i32, v1i64], - CCAssignToReg<[RDI, RSI, RDX, RCX, R8 , R9 ]>>, + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, + // The first 8 MMX (except for v1i64) vector arguments are passed in XMM + // registers on Darwin. + CCIfType<[v8i8, v4i16, v2i32], + CCIfSubtarget<"isTargetDarwin()", + CCIfSubtarget<"hasSSE2()", + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>>, + + // The first 8 v1i64 vector arguments are passed in GPRs on Darwin. + CCIfType<[v1i64], + CCIfSubtarget<"isTargetDarwin()", + CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>>, + // Integer/FP values get stored in stack slots that are 8 bytes in size and // 8-byte aligned if there are no more registers to hold them. CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>, @@ -211,12 +219,19 @@ // The first 8 FP/Vector arguments are passed in XMM registers. CCIfType<[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], - CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, - - // The first 8 MMX vector arguments are passed in GPRs. - CCIfType<[v8i8, v4i16, v2i32, v1i64], - CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>, + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>, + // The first 8 MMX (except for v1i64) vector arguments are passed in XMM + // registers on Darwin. + CCIfType<[v8i8, v4i16, v2i32], + CCIfSubtarget<"isTargetDarwin()", + CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>, + + // The first 8 v1i64 vector arguments are passed in GPRs on Darwin. + CCIfType<[v1i64], + CCIfSubtarget<"isTargetDarwin()", + CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>>, + // Integer/FP values get stored in stack slots that are 8 bytes in size and // 8-byte aligned if there are no more registers to hold them. CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>, @@ -242,9 +257,15 @@ // The first 3 float or double arguments, if marked 'inreg' and if the call // is not a vararg call and if SSE2 is available, are passed in SSE registers. - CCIfNotVarArg>>>>, + // The first 3 __m64 (except for v1i64) vector arguments are passed in mmx + // registers if the call is not a vararg call. + CCIfNotVarArg>>, + // Integer/Float values get stored in stack slots that are 4 bytes in // size and 4-byte aligned. CCIfType<[i32, f32], CCAssignToStack<4, 4>>, @@ -264,8 +285,7 @@ // __m64 vectors get 8-byte stack slots that are 4-byte aligned. They are // passed in the parameter area. - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 4>> -]>; + CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 4>>]>; def CC_X86_32_C : CallingConv<[ // Promote i8/i16 arguments to i32. Modified: llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp?rev=50258&r1=50257&r2=50258&view=diff ============================================================================== --- llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/branches/Apple/Tak/lib/Target/X86/X86ISelLowering.cpp Fri Apr 25 03:05:49 2008 @@ -1207,13 +1207,25 @@ RC = X86::FR32RegisterClass; else if (RegVT == MVT::f64) RC = X86::FR64RegisterClass; - else { - assert(MVT::isVector(RegVT)); - if (Is64Bit && MVT::getSizeInBits(RegVT) == 64) { - RC = X86::GR64RegisterClass; // MMX values are passed in GPRs. - RegVT = MVT::i64; - } else - RC = X86::VR128RegisterClass; + else if (MVT::isVector(RegVT) && MVT::getSizeInBits(RegVT) == 128) + RC = X86::VR128RegisterClass; + else if (MVT::isVector(RegVT)) { + assert(MVT::getSizeInBits(RegVT) == 64); + if (!Is64Bit) + RC = X86::VR64RegisterClass; // MMX values are passed in MMXs. + else { + // Darwin calling convention passes MMX values in either GPRs or + // XMMs in x86-64. Other targets pass them in memory. + if (RegVT != MVT::v1i64 && Subtarget->hasSSE2()) { + RC = X86::VR128RegisterClass; // MMX values are passed in XMMs. + RegVT = MVT::v2i64; + } else { + RC = X86::GR64RegisterClass; // v1i64 values are passed in GPRs. + RegVT = MVT::i64; + } + } + } else { + assert(0 && "Unknown argument type!"); } unsigned Reg = AddLiveIn(DAG.getMachineFunction(), VA.getLocReg(), RC); Added: llvm/branches/Apple/Tak/test/CodeGen/X86/mmx-arg-passing.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/CodeGen/X86/mmx-arg-passing.ll?rev=50258&view=auto ============================================================================== --- llvm/branches/Apple/Tak/test/CodeGen/X86/mmx-arg-passing.ll (added) +++ llvm/branches/Apple/Tak/test/CodeGen/X86/mmx-arg-passing.ll Fri Apr 25 03:05:49 2008 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+mmx | grep mm0 | count 3 +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+mmx | grep esp | count 1 +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -mattr=+mmx,+sse2 | grep xmm0 +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -mattr=+mmx,+sse2 | grep rdi +; +; On Darwin x86-32, v8i8, v4i16, v2i32 values are passed in MM[0-2]. +; On Darwin x86-32, v1i64 values are passed in memory. +; On Darwin x86-64, v8i8, v4i16, v2i32 values are passed in XMM[0-7]. +; On Darwin x86-64, v1i64 values are passed in 64-bit GPRs. + + at u1 = external global <8 x i8> + +define void @t1(<8 x i8> %v1) nounwind { + store <8 x i8> %v1, <8 x i8>* @u1, align 8 + ret void +} + + at u2 = external global <1 x i64> + +define void @t2(<1 x i64> %v1) nounwind { + store <1 x i64> %v1, <1 x i64>* @u2, align 8 + ret void +} From evan.cheng at apple.com Fri Apr 25 03:22:20 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Apr 2008 08:22:20 -0000 Subject: [llvm-commits] [llvm] r50259 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200804250822.m3P8MKw9017577@zion.cs.uiuc.edu> Author: evancheng Date: Fri Apr 25 03:22:20 2008 New Revision: 50259 URL: http://llvm.org/viewvc/llvm-project?rev=50259&view=rev Log: - Switch from std::set to SmallPtrSet. - Add comments. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=50259&r1=50258&r2=50259&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Apr 25 03:22:20 2008 @@ -36,6 +36,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include #include @@ -222,6 +223,8 @@ }; } +/// findFlagUse - Return use of MVT::Flag value produced by the specified SDNode. +/// static SDNode *findFlagUse(SDNode *N) { unsigned FlagResNo = N->getNumValues()-1; for (SDNode::use_iterator I = N->use_begin(), E = N->use_end(); I != E; ++I) { @@ -235,21 +238,24 @@ return NULL; } +/// findNonImmUse - Return true by reference in "found" if "Use" is an +/// non-immediate use of "Def". This function recursively traversing +/// up the operand chain ignoring certain nodes. static void findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse, SDNode *Root, SDNode *Skip, bool &found, - std::set &Visited) { + SmallPtrSet &Visited) { if (found || Use->getNodeId() > Def->getNodeId() || - !Visited.insert(Use).second) + !Visited.insert(Use)) return; - + for (unsigned i = 0, e = Use->getNumOperands(); !found && i != e; ++i) { SDNode *N = Use->getOperand(i).Val; if (N == Skip) continue; if (N == Def) { if (Use == ImmedUse) - continue; // Immediate use is ok. + continue; // We are not looking for immediate use. if (Use == Root) { assert(Use->getOpcode() == ISD::STORE || Use->getOpcode() == X86ISD::CMP || @@ -261,6 +267,8 @@ found = true; break; } + + // Traverse up the operand chain. findNonImmUse(N, Def, ImmedUse, Root, Skip, found, Visited); } } @@ -276,7 +284,7 @@ /// its chain operand. static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse, SDNode *Skip = NULL) { - std::set Visited; + SmallPtrSet Visited; bool found = false; findNonImmUse(Root, Def, ImmedUse, Root, Skip, found, Visited); return found; From evan.cheng at apple.com Fri Apr 25 03:55:29 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Apr 2008 08:55:29 -0000 Subject: [llvm-commits] [llvm] r50260 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200804250855.m3P8tTR2018478@zion.cs.uiuc.edu> Author: evancheng Date: Fri Apr 25 03:55:28 2008 New Revision: 50260 URL: http://llvm.org/viewvc/llvm-project?rev=50260&view=rev Log: Not checking for intrinsics which do not have a chain operand. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=50260&r1=50259&r2=50260&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Apr 25 03:55:28 2008 @@ -255,11 +255,12 @@ continue; if (N == Def) { if (Use == ImmedUse) - continue; // We are not looking for immediate use. + continue; // We are not looking for immediate use. if (Use == Root) { + // Must be a chain reading node where it is possible to reach its own + // chain operand through a path started from another operand. assert(Use->getOpcode() == ISD::STORE || Use->getOpcode() == X86ISD::CMP || - Use->getOpcode() == ISD::INTRINSIC_WO_CHAIN || Use->getOpcode() == ISD::INTRINSIC_W_CHAIN || Use->getOpcode() == ISD::INTRINSIC_VOID); continue; From ggreif at gmail.com Fri Apr 25 03:59:22 2008 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 25 Apr 2008 08:59:22 -0000 Subject: [llvm-commits] [llvm] r50261 - /llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Message-ID: <200804250859.m3P8xMSh018587@zion.cs.uiuc.edu> Author: ggreif Date: Fri Apr 25 03:59:22 2008 New Revision: 50261 URL: http://llvm.org/viewvc/llvm-project?rev=50261&view=rev Log: break lines near 80 columns Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50261&r1=50260&r2=50261&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Fri Apr 25 03:59:22 2008 @@ -149,16 +149,11 @@ void BitcodeReaderValueList::resize(unsigned Desired) { if (Desired > Capacity) { - // Since we expect many values - // to come from the bitcode file - // we better allocate the double - // amount, so that the array size - // grows exponentially at each - // reallocation. Also, add a small - // amount of 100 extra elements - // each time, to reallocate less - // frequently when the array - // is still small. + // Since we expect many values to come from the bitcode file we better + // allocate the double amount, so that the array size grows exponentially + // at each reallocation. Also, add a small amount of 100 extra elements + // each time, to reallocate less frequently when the array is still small. + // Capacity = Desired * 2 + 100; Use *New = allocHungoffUses(Capacity); Use *Old = OperandList; From clattner at apple.com Fri Apr 25 10:58:36 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Apr 2008 08:58:36 -0700 Subject: [llvm-commits] [llvm] r50259 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp In-Reply-To: <200804250822.m3P8MKw9017577@zion.cs.uiuc.edu> References: <200804250822.m3P8MKw9017577@zion.cs.uiuc.edu> Message-ID: <9A43F901-B2DE-43B7-BF6B-285A72108C01@apple.com> On Apr 25, 2008, at 1:22 AM, Evan Cheng wrote: > Author: evancheng > Date: Fri Apr 25 03:22:20 2008 > New Revision: 50259 > > URL: http://llvm.org/viewvc/llvm-project?rev=50259&view=rev > Log: > - Switch from std::set to SmallPtrSet. > - Add comments. Thanks Evan! -Chris From sabre at nondot.org Fri Apr 25 11:06:47 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Apr 2008 11:06:47 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2008-06-PLDI-PuzzleSolving.html 2008-06-PLDI-PuzzleSolving.pdf index.html Message-ID: <200804251606.m3PG6lxE031371@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2008-06-PLDI-PuzzleSolving.html added (r1.1) 2008-06-PLDI-PuzzleSolving.pdf added (r1.1) index.html updated: 1.67 -> 1.68 --- Log message: Add Fernando's PLDI'08 paper. --- Diffs of the changes: (+44 -0) 2008-06-PLDI-PuzzleSolving.html | 39 +++++++++++++++++++++++++++++++++++++++ 2008-06-PLDI-PuzzleSolving.pdf | 0 index.html | 5 +++++ 3 files changed, 44 insertions(+) Index: llvm-www/pubs/2008-06-PLDI-PuzzleSolving.html diff -c /dev/null llvm-www/pubs/2008-06-PLDI-PuzzleSolving.html:1.1 *** /dev/null Fri Apr 25 11:06:11 2008 --- llvm-www/pubs/2008-06-PLDI-PuzzleSolving.html Fri Apr 25 11:06:00 2008 *************** *** 0 **** --- 1,39 ---- + + + + + + Register Allocation by Puzzle Solving + + + +
    + Register Allocation by Puzzle Solving +
    +
    + Fernando Magno Quintao Pereira and Jens Palsberg +
    + +

    Abstract:

    +
    + We have shown that register allocation can be viewed as solving a collection of puzzles. We model the register file as a puzzle board and the program variables as puzzle pieces; pre-coloring and register aliasing fit in naturally. For architectures such as x86, PowerPC, and StrongARM, we can solve the puzzles in polynomial time, and we have augmented the puzzle solver with a simple heuristic for spilling. For SPEC CPU2000, our implementation is as fast as the extended version of linear scan used by LLVM, which is the JIT compiler in the openGL stack of Mac OS 10.5. Our implementation produces Pentium code that is of similar quality to the code produced by the slower, state-of-the-art iterated register coalescing algorithm of George and Appel augmented with extensions by Smith, Ramsey, and Holloway. +
    + +

    Bibtex:

    +
    + @inproceedings{Pereira08PLDI,
    +  author = {Fernando Magno Quintao Pereira and Jens Palsberg},
    +  title = {Register Allocation by Puzzle Solving},
    +  booktitle = {ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation (PLDI'08)},
    +  year = {2008},
    + }
    + 
    + +

    Download:

    +
    + + + Index: llvm-www/pubs/2008-06-PLDI-PuzzleSolving.pdf Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.67 llvm-www/pubs/index.html:1.68 --- llvm-www/pubs/index.html:1.67 Tue Apr 22 20:05:11 2008 +++ llvm-www/pubs/index.html Fri Apr 25 11:06:00 2008 @@ -8,6 +8,11 @@ Torvald Riegel, Christof Fetzer, and Pascal Felber
    Proc. 20th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA'08), June, 2008 +
  4. "Register Allocation by Puzzle Solving"
    +Fernando Magno Quintao Pereira and Jens Palsberg
    +Proc. ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation (PLDI'08), June, 2008
  5. + +
  6. "Cycle-approximate Retargetable Performance Estimation at the Transaction Level"
    Y. Hwang, S. Abdi, and D. Gajski
    From nicolas.geoffray at lip6.fr Fri Apr 25 11:08:20 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 25 Apr 2008 16:08:20 -0000 Subject: [llvm-commits] [vmkit] r50264 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathVMSystemProperties.cpp VMCore/JavaIsolate.cpp VMCore/JavaUpcalls.cpp Message-ID: <200804251608.m3PG8KDD031434@zion.cs.uiuc.edu> Author: geoffray Date: Fri Apr 25 11:08:20 2008 New Revision: 50264 URL: http://llvm.org/viewvc/llvm-project?rev=50264&view=rev Log: Implement Java post-properties. Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp?rev=50264&r1=50263&r2=50264&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp Fri Apr 25 11:08:20 2008 @@ -118,6 +118,12 @@ } - +extern "C" void propertiesPostInit(JavaObject* prop) { + Jnjvm* vm = JavaThread::get()->isolate; + for (std::vector >::iterator i = vm->postProperties.begin(), + e = vm->postProperties.end(); i!= e; i++) { + setProperty(vm, prop, i->first, i->second); + } +} } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=50264&r1=50263&r2=50264&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Fri Apr 25 11:08:20 2008 @@ -198,7 +198,7 @@ else vm->setClasspath(argv[i]); } else if (!(strcmp(cur, "-debug"))) { nyi(); - } else if (!(strcmp(cur, "-D"))) { + } else if (!(strncmp(cur, "-D", 2))) { uint32 len = strlen(cur); if (len == 2) { printInformation(); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp?rev=50264&r1=50263&r2=50264&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Fri Apr 25 11:08:20 2008 @@ -253,6 +253,12 @@ getCallingClassLoader->llvmFunction->setName("getCallingClassLoader"); getCallingClassLoader->llvmFunction->setLinkage(llvm::GlobalValue::ExternalLinkage); } + + JavaMethod* postProperties = UPCALL_METHOD(vm, "gnu/classpath/VMSystemProperties", "postInit", "(Ljava/util/Properties;)V", ACC_STATIC); + { + postProperties->llvmFunction->setName("propertiesPostInit"); + postProperties->llvmFunction->setLinkage(llvm::GlobalValue::ExternalLinkage); + } } extern "C" JavaString* internString(JavaString* obj) { From clattner at apple.com Fri Apr 25 11:12:28 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Apr 2008 09:12:28 -0700 Subject: [llvm-commits] [llvm] r50256 - /llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp In-Reply-To: <200804250637.m3P6b6aU006349@zion.cs.uiuc.edu> References: <200804250637.m3P6b6aU006349@zion.cs.uiuc.edu> Message-ID: On Apr 24, 2008, at 11:37 PM, Nate Begeman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=50256&view=rev > Log: > Teach the PruningFunctionCloner how to look through loads with > ConstantExpression GEPs pointing into constant globals. Nice, one minor tweak: > + > + if (ConstantExpr *CE = dyn_cast(Ops[0])) > + if (const LoadInst *LI = dyn_cast(I)) Please change the order of the first two lines. In theory there might be a zero-operand instruction in the future, and it would be nice to not accidentally read invalid memory. This is definitely a 'theoretical' concern, but good to take care of now. Thanks Nate! -Chris > > + if (!LI->isVolatile() && CE->getOpcode() == > Instruction::GetElementPtr) > + if (GlobalVariable *GV = dyn_cast(CE- > >getOperand(0))) > + if (GV->isConstant() && !GV->isDeclaration()) > + return ConstantFoldLoadThroughGEPConstantExpr(GV- > >getInitializer(), > + CE); > + > + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), > &Ops[0], > + Ops.size(), TD); > } > > /// CloneAndPruneFunctionInto - This works exactly like > CloneFunctionInto, > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicholas at mxc.ca Fri Apr 25 11:54:00 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 25 Apr 2008 16:54:00 -0000 Subject: [llvm-commits] [llvm] r50265 - in /llvm/trunk: include/llvm/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ test/Transforms/Inline/ test/Transforms/PruneEH/ test/Transforms/SimplifyCFG/ tools/llvm-bcanalyzer/ Message-ID: <200804251654.m3PGs1Kg032722@zion.cs.uiuc.edu> Author: nicholas Date: Fri Apr 25 11:53:59 2008 New Revision: 50265 URL: http://llvm.org/viewvc/llvm-project?rev=50265&view=rev Log: Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989 r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123. Removed: llvm/trunk/test/Transforms/Inline/unwindto.ll llvm/trunk/test/Transforms/PruneEH/unwindto.ll llvm/trunk/test/Transforms/SimplifyCFG/unwindto.ll Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h llvm/trunk/include/llvm/BasicBlock.h llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h llvm/trunk/include/llvm/Support/CFG.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/Transforms/IPO/PruneEH.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp llvm/trunk/lib/Transforms/Utils/CloneTrace.cpp llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/BasicBlock.cpp llvm/trunk/lib/VMCore/Verifier.cpp llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Fri Apr 25 11:53:59 2008 @@ -118,8 +118,8 @@ block_iterator block_begin() const { return Blocks.begin(); } block_iterator block_end() const { return Blocks.end(); } - /// isLoopExit - True if this block can branch to another block that is - /// outside of the current loop. + /// isLoopExit - True if terminator in the block can branch to another block + /// that is outside of the current loop. /// bool isLoopExit(const BlockT *BB) const { typedef GraphTraits BlockTraits; Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Fri Apr 25 11:53:59 2008 @@ -49,14 +49,13 @@ /// modifying a program. However, the verifier will ensure that basic blocks /// are "well formed". /// @brief LLVM Basic Block Representation -class BasicBlock : public User { // Basic blocks are data objects also +class BasicBlock : public Value { // Basic blocks are data objects also public: typedef iplist InstListType; private : InstListType InstList; BasicBlock *Prev, *Next; // Next and Prev links for our intrusive linked list Function *Parent; - Use unwindDest; void setParent(Function *parent); void setNext(BasicBlock *N) { Next = N; } @@ -71,7 +70,7 @@ /// InsertBefore is null), or before the specified basic block. /// explicit BasicBlock(const std::string &Name = "", Function *Parent = 0, - BasicBlock *InsertBefore = 0, BasicBlock *UnwindDest = 0); + BasicBlock *InsertBefore = 0); public: /// Instruction iterators... typedef InstListType::iterator iterator; @@ -79,27 +78,21 @@ // allocate space for exactly zero operands static BasicBlock *Create(const std::string &Name = "", Function *Parent = 0, - BasicBlock *InsertBefore = 0, BasicBlock *UnwindDest = 0) { - return new(!!UnwindDest) BasicBlock(Name, Parent, InsertBefore, UnwindDest); + BasicBlock *InsertBefore = 0) { + return new BasicBlock(Name, Parent, InsertBefore); } ~BasicBlock(); - /// getUnwindDest - Returns the BasicBlock that flow will enter if an unwind - /// instruction occurs in this block. May be null, in which case unwinding - /// is undefined in this block. - const BasicBlock *getUnwindDest() const; - BasicBlock *getUnwindDest(); - - /// setUnwindDest - Set which BasicBlock flow will enter if an unwind is - /// executed within this block. It may be set to null if unwinding is not - /// permitted in this block. - void setUnwindDest(BasicBlock *unwindDest); - /// getParent - Return the enclosing method, or null if none /// const Function *getParent() const { return Parent; } Function *getParent() { return Parent; } + /// use_back - Specialize the methods defined in Value, as we know that an + /// BasicBlock can only be used by Instructions (specifically PHI and terms). + Instruction *use_back() { return cast(*use_begin());} + const Instruction *use_back() const { return cast(*use_begin());} + /// getTerminator() - If this is a well formed basic block, then this returns /// a pointer to the terminator instruction. If it is not, then you get a /// null pointer back. @@ -187,14 +180,7 @@ /// update the PHI nodes that reside in the block. Note that this should be /// called while the predecessor still refers to this block. /// - /// DontDeleteUselessPHIs will keep PHIs that have one value or the same - /// value for all entries. - /// - /// OnlyDeleteOne will only remove one entry from a PHI, in case there were - /// duplicate entries for the Pred. - /// - void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false, - bool OnlyDeleteOne = false); + void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false); /// splitBasicBlock - This splits a basic block into two at the specified /// instruction. Note that all instructions BEFORE the specified iterator Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original) +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Fri Apr 25 11:53:59 2008 @@ -202,9 +202,7 @@ // this is so information only available in the pointer type (e.g. address // spaces) is retained. FUNC_CODE_INST_STORE2 = 24, // STORE: [ptrty,ptr,val, align, vol] - FUNC_CODE_INST_GETRESULT = 25, // GETRESULT: [ty, opval, n] - - FUNC_CODE_INST_BB_UNWINDDEST = 26 // BB_UNWINDDEST: [bb#] + FUNC_CODE_INST_GETRESULT = 25 // GETRESULT: [ty, opval, n] }; } // End bitc namespace } // End llvm namespace Modified: llvm/trunk/include/llvm/Support/CFG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CFG.h?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CFG.h (original) +++ llvm/trunk/include/llvm/Support/CFG.h Fri Apr 25 11:53:59 2008 @@ -34,17 +34,14 @@ typedef PredIterator<_Ptr,_USE_iterator> _Self; typedef typename super::pointer pointer; - inline void advancePastNonPreds() { - // Loop to ignore non predecessor uses (for example PHI nodes)... - while (!It.atEnd()) { - if (isa(*It) || isa(*It)) - break; + inline void advancePastNonTerminators() { + // Loop to ignore non terminator uses (for example PHI nodes)... + while (!It.atEnd() && !isa(*It)) ++It; - } } inline PredIterator(_Ptr *bb) : It(bb->use_begin()) { - advancePastNonPreds(); + advancePastNonTerminators(); } inline PredIterator(_Ptr *bb, bool) : It(bb->use_end()) {} @@ -53,16 +50,13 @@ inline pointer operator*() const { assert(!It.atEnd() && "pred_iterator out of range!"); - if (isa(*It)) // not dyn_cast due to const-correctness - return cast(*It)->getParent(); - - return cast<_Ptr>(*It); + return cast(*It)->getParent(); } inline pointer *operator->() const { return &(operator*()); } inline _Self& operator++() { // Preincrement assert(!It.atEnd() && "pred_iterator out of range!"); - ++It; advancePastNonPreds(); + ++It; advancePastNonTerminators(); return *this; } @@ -106,8 +100,6 @@ inline SuccIterator(Term_ T, bool) // end iterator : Term(T), idx(Term->getNumSuccessors()) { assert(T && "getTerminator returned null!"); - if (Term->getParent()->getUnwindDest()) - ++idx; } inline const _Self &operator=(const _Self &I) { @@ -123,12 +115,7 @@ inline bool operator==(const _Self& x) const { return idx == x.idx; } inline bool operator!=(const _Self& x) const { return !operator==(x); } - inline pointer operator*() const { - if (idx == Term->getNumSuccessors()) - return Term->getParent()->getUnwindDest(); - - return Term->getSuccessor(idx); - } + inline pointer operator*() const { return Term->getSuccessor(idx); } inline pointer operator->() const { return operator*(); } inline _Self& operator++() { ++idx; return *this; } // Preincrement Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Fri Apr 25 11:53:59 2008 @@ -474,7 +474,6 @@ KEYWORD("asm", ASM_TOK); KEYWORD("sideeffect", SIDEEFFECT); KEYWORD("gc", GC); - KEYWORD("unwinds", UNWINDS); KEYWORD("cc", CC_TOK); KEYWORD("ccc", CCC_TOK); Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Apr 25 11:53:59 2008 @@ -517,7 +517,7 @@ /// defineBBVal - This is a definition of a new basic block with the specified /// identifier which must be the same as CurFun.NextValNum, if its numeric. -static BasicBlock *defineBBVal(const ValID &ID, BasicBlock *unwindDest) { +static BasicBlock *defineBBVal(const ValID &ID) { assert(inFunctionScope() && "Can't get basic block at global scope!"); BasicBlock *BB = 0; @@ -559,7 +559,6 @@ } ID.destroy(); - BB->setUnwindDest(unwindDest); return BB; } @@ -1063,7 +1062,7 @@ %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN ADDRSPACE %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK -%token DATALAYOUT UNWINDS +%token DATALAYOUT %type OptCallingConv %type OptParamAttrs ParamAttr %type OptFuncAttrs FuncAttr @@ -2559,22 +2558,14 @@ CHECK_FOR_ERROR } | /* empty */ { // Empty space between instruction lists - $$ = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0); - CHECK_FOR_ERROR - } - | UNWINDS TO ValueRef { // Only the unwind to block - $$ = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal($3)); + $$ = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR } | LABELSTR { // Labelled (named) basic block - $$ = defineBBVal(ValID::createLocalName(*$1), 0); - delete $1; - CHECK_FOR_ERROR - } - | LABELSTR UNWINDS TO ValueRef { - $$ = defineBBVal(ValID::createLocalName(*$1), getBBVal($4)); + $$ = defineBBVal(ValID::createLocalName(*$1)); delete $1; CHECK_FOR_ERROR + }; BBTerminatorInst : Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Apr 25 11:53:59 2008 @@ -517,7 +517,7 @@ /// defineBBVal - This is a definition of a new basic block with the specified /// identifier which must be the same as CurFun.NextValNum, if its numeric. -static BasicBlock *defineBBVal(const ValID &ID, BasicBlock *unwindDest) { +static BasicBlock *defineBBVal(const ValID &ID) { assert(inFunctionScope() && "Can't get basic block at global scope!"); BasicBlock *BB = 0; @@ -559,7 +559,6 @@ } ID.destroy(); - BB->setUnwindDest(unwindDest); return BB; } @@ -1063,7 +1062,7 @@ %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN ADDRSPACE %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK -%token DATALAYOUT UNWINDS +%token DATALAYOUT %type OptCallingConv %type OptParamAttrs ParamAttr %type OptFuncAttrs FuncAttr @@ -2559,22 +2558,14 @@ CHECK_FOR_ERROR } | /* empty */ { // Empty space between instruction lists - $$ = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0); - CHECK_FOR_ERROR - } - | UNWINDS TO ValueRef { // Only the unwind to block - $$ = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal($3)); + $$ = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR } | LABELSTR { // Labelled (named) basic block - $$ = defineBBVal(ValID::createLocalName(*$1), 0); - delete $1; - CHECK_FOR_ERROR - } - | LABELSTR UNWINDS TO ValueRef { - $$ = defineBBVal(ValID::createLocalName(*$1), getBBVal($4)); + $$ = defineBBVal(ValID::createLocalName(*$1)); delete $1; CHECK_FOR_ERROR + }; BBTerminatorInst : Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Apr 25 11:53:59 2008 @@ -1224,15 +1224,6 @@ CurBB = FunctionBBs[0]; continue; - case bitc::FUNC_CODE_INST_BB_UNWINDDEST: // BB_UNWINDDEST: [bb#] - if (CurBB->getUnwindDest()) - return Error("Only permit one BB_UNWINDDEST per BB"); - if (Record.size() != 1) - return Error("Invalid BB_UNWINDDEST record"); - - CurBB->setUnwindDest(getBasicBlock(Record[0])); - continue; - case bitc::FUNC_CODE_INST_BINOP: { // BINOP: [opval, ty, opval, opcode] unsigned OpNum = 0; Value *LHS, *RHS; Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Apr 25 11:53:59 2008 @@ -970,20 +970,13 @@ unsigned InstID = CstEnd; // Finally, emit all the instructions, in order. - for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { - if (const BasicBlock *unwindDest = BB->getUnwindDest()) { - Vals.push_back(VE.getValueID(unwindDest)); - Stream.EmitRecord(bitc::FUNC_CODE_INST_BB_UNWINDDEST, Vals); - Vals.clear(); - } - + for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) { WriteInstruction(*I, InstID, VE, Stream, Vals); if (I->getType() != Type::VoidTy) ++InstID; } - } // Emit names for all the instructions etc. WriteValueSymbolTable(F.getValueSymbolTable(), VE, Stream); Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Fri Apr 25 11:53:59 2008 @@ -31,7 +31,6 @@ STATISTIC(NumRemoved, "Number of invokes removed"); STATISTIC(NumUnreach, "Number of noreturn calls optimized"); -STATISTIC(NumBBUnwind, "Number of unwind dest removed from blocks"); namespace { struct VISIBILITY_HIDDEN PruneEH : public CallGraphSCCPass { @@ -152,8 +151,6 @@ bool PruneEH::SimplifyFunction(Function *F) { bool MadeChange = false; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { - bool couldUnwind = false; - if (InvokeInst *II = dyn_cast(BB->getTerminator())) if (II->doesNotThrow()) { SmallVector Args(II->op_begin()+3, II->op_end()); @@ -183,12 +180,10 @@ ++NumRemoved; MadeChange = true; - } else { - couldUnwind = true; } for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) - if (CallInst *CI = dyn_cast(I++)) { + if (CallInst *CI = dyn_cast(I++)) if (CI->doesNotReturn() && !isa(I)) { // This call calls a function that cannot return. Insert an // unreachable instruction after it and simplify the code. Do this @@ -204,19 +199,9 @@ MadeChange = true; ++NumUnreach; break; - } else if (!CI->doesNotThrow()) { - couldUnwind = true; } - } - - // Strip 'unwindTo' off of BBs that have no calls/invokes without nounwind. - if (!couldUnwind && BB->getUnwindDest()) { - MadeChange = true; - ++NumBBUnwind; - BB->getUnwindDest()->removePredecessor(BB, false, true); - BB->setUnwindDest(NULL); - } } + return MadeChange; } Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Apr 25 11:53:59 2008 @@ -11180,15 +11180,12 @@ // Recursively visit successors. If this is a branch or switch on a // constant, only visit the reachable successor. - if (BB->getUnwindDest()) - Worklist.push_back(BB->getUnwindDest()); TerminatorInst *TI = BB->getTerminator(); if (BranchInst *BI = dyn_cast(TI)) { if (BI->isConditional() && isa(BI->getCondition())) { bool CondVal = cast(BI->getCondition())->getZExtValue(); BasicBlock *ReachableBB = BI->getSuccessor(!CondVal); - if (ReachableBB != BB->getUnwindDest()) - Worklist.push_back(ReachableBB); + Worklist.push_back(ReachableBB); continue; } } else if (SwitchInst *SI = dyn_cast(TI)) { @@ -11197,8 +11194,7 @@ for (unsigned i = 1, e = SI->getNumSuccessors(); i != e; ++i) if (SI->getCaseValue(i) == Cond) { BasicBlock *ReachableBB = SI->getSuccessor(i); - if (ReachableBB != BB->getUnwindDest()) - Worklist.push_back(ReachableBB); + Worklist.push_back(ReachableBB); continue; } Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Fri Apr 25 11:53:59 2008 @@ -405,14 +405,10 @@ } // Remap all instructions in the most recent iteration - for (unsigned i = 0; i < NewBlocks.size(); ++i) { - BasicBlock *NB = NewBlocks[i]; - if (BasicBlock *UnwindDest = NB->getUnwindDest()) - NB->setUnwindDest(cast(LastValueMap[UnwindDest])); - - for (BasicBlock::iterator I = NB->begin(), E = NB->end(); I != E; ++I) + for (unsigned i = 0; i < NewBlocks.size(); ++i) + for (BasicBlock::iterator I = NewBlocks[i]->begin(), + E = NewBlocks[i]->end(); I != E; ++I) RemapInstruction(I, LastValueMap); - } } // The latch block exits the loop. If there are any PHI nodes in the Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Apr 25 11:53:59 2008 @@ -819,14 +819,10 @@ } // Rewrite the code to refer to itself. - for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i) { - BasicBlock *NB = NewBlocks[i]; - if (BasicBlock *UnwindDest = NB->getUnwindDest()) - NB->setUnwindDest(cast(ValueMap[UnwindDest])); - - for (BasicBlock::iterator I = NB->begin(), E = NB->end(); I != E; ++I) + for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i) + for (BasicBlock::iterator I = NewBlocks[i]->begin(), + E = NewBlocks[i]->end(); I != E; ++I) RemapInstruction(I, ValueMap); - } // Rewrite the original preheader to select between versions of the loop. BranchInst *OldBR = cast(OrigPreheader->getTerminator()); Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Fri Apr 25 11:53:59 2008 @@ -1727,11 +1727,6 @@ // If there are any PHI nodes in this successor, drop entries for BB now. BasicBlock *DeadBB = BlocksToErase[i]; while (!DeadBB->use_empty()) { - if (BasicBlock *PredBB = dyn_cast(DeadBB->use_back())) { - PredBB->setUnwindDest(NULL); - continue; - } - Instruction *I = cast(DeadBB->use_back()); bool Folded = ConstantFoldTerminator(I->getParent()); if (!Folded) { Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Fri Apr 25 11:53:59 2008 @@ -161,7 +161,6 @@ while (isa(SplitIt)) ++SplitIt; BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split"); - New->setUnwindDest(Old->getUnwindDest()); // The new block lives in whichever loop the old one did. if (Loop *L = LI.getLoopFor(Old)) @@ -210,12 +209,8 @@ BranchInst *BI = BranchInst::Create(BB, NewBB); // Move the edges from Preds to point to NewBB instead of BB. - for (unsigned i = 0; i != NumPreds; ++i) { + for (unsigned i = 0; i != NumPreds; ++i) Preds[i]->getTerminator()->replaceUsesOfWith(BB, NewBB); - - if (Preds[i]->getUnwindDest() == BB) - Preds[i]->setUnwindDest(NewBB); - } // Update dominator tree and dominator frontier if available. DominatorTree *DT = P ? P->getAnalysisToUpdate() : 0; Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Fri Apr 25 11:53:59 2008 @@ -34,7 +34,6 @@ ClonedCodeInfo *CodeInfo) { BasicBlock *NewBB = BasicBlock::Create("", F); if (BB->hasName()) NewBB->setName(BB->getName()+NameSuffix); - NewBB->setUnwindDest(const_cast(BB->getUnwindDest())); bool hasCalls = false, hasDynamicAllocas = false, hasStaticAllocas = false; @@ -108,15 +107,10 @@ // references as we go. This uses ValueMap to do all the hard work. // for (Function::iterator BB = cast(ValueMap[OldFunc->begin()]), - BE = NewFunc->end(); BB != BE; ++BB) { - // Fix up the unwind destination. - if (BasicBlock *UnwindDest = BB->getUnwindDest()) - BB->setUnwindDest(cast(ValueMap[UnwindDest])); - + BE = NewFunc->end(); BB != BE; ++BB) // Loop over all instructions, fixing each one as we find it... for (BasicBlock::iterator II = BB->begin(); II != BB->end(); ++II) RemapInstruction(II, ValueMap); - } } /// CloneFunction - Return a copy of the specified function, but without Modified: llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp Fri Apr 25 11:53:59 2008 @@ -130,10 +130,6 @@ for(SmallVector::iterator NBItr = NewBlocks.begin(), NBE = NewBlocks.end(); NBItr != NBE; ++NBItr) { BasicBlock *NB = *NBItr; - - if (BasicBlock *UnwindDest = NB->getUnwindDest()) - NB->setUnwindDest(cast(ValueMap[UnwindDest])); - for(BasicBlock::iterator BI = NB->begin(), BE = NB->end(); BI != BE; ++BI) { Instruction *Insn = BI; Modified: llvm/trunk/lib/Transforms/Utils/CloneTrace.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneTrace.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneTrace.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneTrace.cpp Fri Apr 25 11:53:59 2008 @@ -68,11 +68,6 @@ //Second loop to do the remapping for (std::vector::const_iterator BB = clonedTrace.begin(), BE = clonedTrace.end(); BB != BE; ++BB) { - - //Remap the unwind destination - if (BasicBlock *UnwindDest = (*BB)->getUnwindDest()) - (*BB)->setUnwindDest(cast(ValueMap[UnwindDest])); - for (BasicBlock::iterator I = (*BB)->begin(); I != (*BB)->end(); ++I) { //Loop over all the operands of the instruction for (unsigned op=0, E = I->getNumOperands(); op != E; ++op) { Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Fri Apr 25 11:53:59 2008 @@ -203,7 +203,6 @@ BasicBlock *OrigBB = TheCall->getParent(); Function *Caller = OrigBB->getParent(); - BasicBlock *UnwindBB = OrigBB->getUnwindDest(); // GC poses two hazards to inlining, which only occur when the callee has GC: // 1. If the caller has no GC, then the callee's GC must be propagated to the @@ -419,18 +418,6 @@ } } - // If we are inlining a function that unwinds into a BB with an unwind dest, - // turn the inlined unwinds into branches to the unwind dest. - if (InlinedFunctionInfo.ContainsUnwinds && UnwindBB && isa(TheCall)) - for (Function::iterator BB = FirstNewBlock, E = Caller->end(); - BB != E; ++BB) { - TerminatorInst *Term = BB->getTerminator(); - if (isa(Term)) { - BranchInst::Create(UnwindBB, Term); - BB->getInstList().erase(Term); - } - } - // If we are inlining for an invoke instruction, we must make sure to rewrite // any inlined 'unwind' instructions into branches to the invoke exception // destination, and call instructions into invoke instructions. Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Fri Apr 25 11:53:59 2008 @@ -125,17 +125,18 @@ if (LI->getLoopFor(BB)) continue; bool BlockUnreachable = false; + TerminatorInst *TI = BB->getTerminator(); // Check to see if any successors of this block are non-loop-header loops // that are not the header. - for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { + for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) { // If this successor is not in a loop, BB is clearly ok. - Loop *L = LI->getLoopFor(*I); + Loop *L = LI->getLoopFor(TI->getSuccessor(i)); if (!L) continue; // If the succ is the loop header, and if L is a top-level loop, then this // is an entrance into a loop through the header, which is also ok. - if (L->getHeader() == *I && L->getParentLoop() == 0) + if (L->getHeader() == TI->getSuccessor(i) && L->getParentLoop() == 0) continue; // Otherwise, this is an entrance into a loop from some place invalid. @@ -153,11 +154,10 @@ // loop by replacing the terminator. // Remove PHI entries from the successors. - for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) - (*I)->removePredecessor(BB); + for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) + TI->getSuccessor(i)->removePredecessor(BB); // Add a new unreachable instruction before the old terminator. - TerminatorInst *TI = BB->getTerminator(); new UnreachableInst(TI); // Delete the dead terminator. @@ -576,15 +576,12 @@ } // Now that all of the PHI nodes have been inserted and adjusted, modify the - // backedge blocks to branch to the BEBlock instead of the header. + // backedge blocks to just to the BEBlock instead of the header. for (unsigned i = 0, e = BackedgeBlocks.size(); i != e; ++i) { TerminatorInst *TI = BackedgeBlocks[i]->getTerminator(); for (unsigned Op = 0, e = TI->getNumSuccessors(); Op != e; ++Op) if (TI->getSuccessor(Op) == Header) TI->setSuccessor(Op, BEBlock); - - if (BackedgeBlocks[i]->getUnwindDest() == Header) - BackedgeBlocks[i]->setUnwindDest(BEBlock); } //===--- Update all analyses which we must preserve now -----------------===// Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Apr 25 11:53:59 2008 @@ -1342,8 +1342,6 @@ SmallVector UncondBranchPreds; SmallVector CondBranchPreds; for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) { - if ((*PI)->getUnwindDest() == BB) continue; - TerminatorInst *PTI = (*PI)->getTerminator(); if (BranchInst *BI = dyn_cast(PTI)) { if (BI->isUnconditional()) @@ -1408,14 +1406,8 @@ SmallVector Preds(pred_begin(BB), pred_end(BB)); while (!Preds.empty()) { BasicBlock *Pred = Preds.back(); - - if (Pred->getUnwindDest() == BB) { - Pred->setUnwindDest(NULL); - Changed = true; - } - if (BranchInst *BI = dyn_cast(Pred->getTerminator())) { - if (BI->isUnconditional() && BI->getSuccessor(0) == BB) { + if (BI->isUnconditional()) { Pred->getInstList().pop_back(); // nuke uncond branch new UnwindInst(Pred); // Use unwind. Changed = true; @@ -1840,7 +1832,6 @@ BasicBlock *OnlySucc = 0; if (OnlyPred && OnlyPred != BB && // Don't break self loops - OnlyPred->getUnwindDest() != BB && OnlyPred->getTerminator()->getOpcode() != Instruction::Invoke) { // Check to see if there is only one distinct successor... succ_iterator SI(succ_begin(OnlyPred)), SE(succ_end(OnlyPred)); @@ -1852,8 +1843,7 @@ } } - if (OnlySucc && (BB->getUnwindDest() == OnlyPred->getUnwindDest() || - !BB->getUnwindDest() || !OnlyPred->getUnwindDest())) { + if (OnlySucc) { DOUT << "Merging: " << *BB << "into: " << *OnlyPred; // Resolve any PHI nodes at the start of the block. They are all @@ -1873,10 +1863,6 @@ // Move all definitions in the successor to the predecessor. OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList()); - // Move the unwind destination block - if (!OnlyPred->getUnwindDest() && BB->getUnwindDest()) - OnlyPred->setUnwindDest(BB->getUnwindDest()); - // Make all PHI nodes that referred to BB now refer to Pred as their // source. BB->replaceAllUsesWith(OnlyPred); Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=50265&r1=50264&r2=50265&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Fri Apr 25 11:53:59 2008 @@ -1163,18 +1163,9 @@ /// printBasicBlock - This member is called for each basic block in a method. /// void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { - if (BB->hasName()) // Print out the label if it exists... - Out << '\n' << getLLVMName(BB->getName(), LabelPrefix) << ':'; - - if (const BasicBlock* unwindDest = BB->getUnwindDest()) { - if (BB->hasName()) - Out << ' '; - - Out << "unwinds to"; - writeOperand(unwindDest, false); - } - - if (!BB->hasName() && !BB->use_empty()) { // Don't print block # of no uses... + if (BB->hasName()) { // Print out the label if it exists... + Out << "\n" << getLLVMName(BB->getName(), LabelPrefix) << ':'; + } else if (!BB->use_empty()) { // Don't print block # of no uses... Out << "\n;