From sabre at nondot.org Mon Aug 31 00:17:58 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 05:17:58 -0000 Subject: [llvm-commits] [llvm] r80538 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200908310517.n7V5Hxhn030600@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 00:17:58 2009 New Revision: 80538 URL: http://llvm.org/viewvc/llvm-project?rev=80538&view=rev Log: improve -debug output, so that -debug is more likely to print when instcombine is changing stuff. 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=80538&r1=80537&r2=80538&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Aug 31 00:17:58 2009 @@ -327,6 +327,8 @@ // instruction. Instead, visit methods should return the value returned by // this function. Instruction *EraseInstFromFunction(Instruction &I) { + DEBUG(errs() << "IC: erase " << I); + assert(I.use_empty() && "Cannot erase instruction that is used!"); // Make sure that we reprocess all operands now that we reduced their // use counts. @@ -10149,10 +10151,11 @@ } } - if (Caller->getType() != Type::getVoidTy(*Context) && !Caller->use_empty()) + + if (!Caller->use_empty()) Caller->replaceAllUsesWith(NV); - Caller->eraseFromParent(); - Worklist.Remove(Caller); + + EraseInstFromFunction(*Caller); return true; } From sabre at nondot.org Mon Aug 31 00:22:48 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 05:22:48 -0000 Subject: [llvm-commits] [llvm] r80539 - /llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Message-ID: <200908310522.n7V5Mmgr031192@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 00:22:48 2009 New Revision: 80539 URL: http://llvm.org/viewvc/llvm-project?rev=80539&view=rev Log: add -debug output Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=80539&r1=80538&r2=80539&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Mon Aug 31 00:22:48 2009 @@ -593,6 +593,10 @@ Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); NF->copyAttributesFrom(F); + + DEBUG(errs() << "ARG PROMOTION: Promoting to:" << *NF << "\n" + << "From: " << *F); + // Recompute the parameter attributes list based on the new arguments for // the function. NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), AttributesVec.end())); From sabre at nondot.org Mon Aug 31 00:34:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 05:34:32 -0000 Subject: [llvm-commits] [llvm] r80540 - /llvm/trunk/lib/Transforms/IPO/Inliner.cpp Message-ID: <200908310534.n7V5YWFG032570@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 00:34:32 2009 New Revision: 80540 URL: http://llvm.org/viewvc/llvm-project?rev=80540&view=rev Log: comment and simplify some code. Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=80540&r1=80539&r2=80540&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Mon Aug 31 00:34:32 2009 @@ -231,12 +231,18 @@ for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { CallSite CS = CallSite::get(I); - if (CS.getInstruction() == 0 || isa(I)) + // If this this isn't a call, or it is a call to an intrinsic, it can + // never be inlined. + if (CS.getInstruction() == 0 || isa(I)) continue; - if (CS.getCalledFunction() == 0 || - !CS.getCalledFunction()->isDeclaration()) - CallSites.push_back(CS); + // If this is a direct call to an external function, we can never inline + // it. If it is an indirect call, inlining may resolve it to be a + // direct call, so we keep it. + if (CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration()) + continue; + + CallSites.push_back(CS); } } @@ -262,25 +268,12 @@ // Iterate over the outer loop because inlining functions can cause indirect // calls to become direct calls. for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) { - // We can only inline direct calls. CallSite CS = CallSites[CSi]; Function *Callee = CS.getCalledFunction(); - if (!Callee) continue; + // We can only inline direct calls to non-declarations. + if (Callee == 0 || Callee->isDeclaration()) continue; - // Calls to external functions are never inlinable. - if (Callee->isDeclaration()) { - if (SCC.size() == 1) { - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); - } else { - // Keep the 'in SCC / not in SCC' boundary correct. - CallSites.erase(CallSites.begin()+CSi); - } - --CSi; - continue; - } - // If the policy determines that we should inline this function, // try to do so. if (!shouldInline(CS)) @@ -294,7 +287,9 @@ // If we inlined the last possible call site to the function, delete the // function body now. if (Callee->use_empty() && Callee->hasLocalLinkage() && + // TODO: Can remove if in SCC now. !SCCFunctions.count(Callee) && + // The function may be apparently dead, but if there are indirect // callgraph references to the node, we cannot delete it yet, this // could invalidate the CGSCC iterator. From sabre at nondot.org Mon Aug 31 00:47:00 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 05:47:00 -0000 Subject: [llvm-commits] [llvm] r80541 - in /llvm/trunk: lib/Analysis/IPA/CallGraph.cpp test/Transforms/Inline/crash.ll Message-ID: <200908310547.n7V5l0C0001608@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 00:46:59 2009 New Revision: 80541 URL: http://llvm.org/viewvc/llvm-project?rev=80541&view=rev Log: fix a crash building SPASS by tolerating a callsite that doesn't exist in the callgraph, see the big comment at the top of the testcase. Added: llvm/trunk/test/Transforms/Inline/crash.ll Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=80541&r1=80540&r2=80541&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Mon Aug 31 00:46:59 2009 @@ -239,14 +239,19 @@ /// specified call site. Note that this method takes linear time, so it /// should be used sparingly. void CallGraphNode::removeCallEdgeFor(CallSite CS) { - for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { - assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); - if (I->first == CS) { - I->second->DropRef(); - *I = CalledFunctions.back(); - CalledFunctions.pop_back(); - return; - } + // Scan for the call site. Note that we aren't guaranteed to find the call + // site in this node, even in reasonable situations. Passes like instcombine + // can adjust callsites (e.g. folding bitcasts into calls to make them direct) + // which can introduce new call sites. Since instcombine is not callgraph + // aware, it doesn't know to tell CallGraph about this change. + for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); + I != CalledFunctions.end(); ++I) { + if (I->first != CS) continue; + + I->second->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); + return; } } Added: llvm/trunk/test/Transforms/Inline/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/crash.ll?rev=80541&view=auto ============================================================================== --- llvm/trunk/test/Transforms/Inline/crash.ll (added) +++ llvm/trunk/test/Transforms/Inline/crash.ll Mon Aug 31 00:46:59 2009 @@ -0,0 +1,57 @@ +; RUN: llvm-as < %s | opt -inline -argpromotion -instcombine -disable-output + +; This test was failing because the inliner would inline @list_DeleteElement +; into @list_DeleteDuplicates and then into @inf_GetBackwardPartnerLits, +; turning the indirect call into a direct one. This allowed instcombine to see +; the bitcast and eliminate it, deleting the original call and introducing +; another one. This crashed the inliner because the new call was not in the +; callgraph. + +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-darwin10.0" + + +define void @list_DeleteElement(i32 (i8*, i8*)* nocapture %Test) nounwind ssp { +entry: + %0 = call i32 %Test(i8* null, i8* undef) nounwind + ret void +} + + +define void @list_DeleteDuplicates(i32 (i8*, i8*)* nocapture %Test) nounwind ssp { +foo: + call void @list_DeleteElement(i32 (i8*, i8*)* %Test) nounwind ssp + call fastcc void @list_Rplacd1284() nounwind ssp + unreachable + +} + +define internal i32 @inf_LiteralsHaveSameSubtermAndAreFromSameClause(i32* nocapture %L1, i32* nocapture %L2) nounwind readonly ssp { +entry: + unreachable +} + + +define internal fastcc void @inf_GetBackwardPartnerLits(i32* nocapture %Flags) nounwind ssp { +test: + call void @list_DeleteDuplicates(i32 (i8*, i8*)* bitcast (i32 (i32*, i32*)* @inf_LiteralsHaveSameSubtermAndAreFromSameClause to i32 (i8*, i8*)*)) nounwind + ret void +} + + +define void @inf_BackwardEmptySortPlusPlus() nounwind ssp { +entry: + call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp + unreachable +} + +define void @inf_BackwardWeakening() nounwind ssp { +entry: + call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp + unreachable +} + + + + +declare fastcc void @list_Rplacd1284() nounwind ssp From sabre at nondot.org Mon Aug 31 01:01:21 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 06:01:21 -0000 Subject: [llvm-commits] [llvm] r80542 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200908310601.n7V61Lck003348@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 01:01:21 2009 New Revision: 80542 URL: http://llvm.org/viewvc/llvm-project?rev=80542&view=rev Log: cleanups, factor some code out to a helper function Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80542&r1=80541&r2=80542&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Mon Aug 31 01:01:21 2009 @@ -31,7 +31,6 @@ namespace { class CGPassManager : public ModulePass, public PMDataManager { - public: static char ID; explicit CGPassManager(int Depth) @@ -73,11 +72,41 @@ virtual PassManagerType getPassManagerType() const { return PMT_CallGraphPassManager; } + +private: + bool RunPassOnSCC(Pass *P, std::vector &CurSCC); }; -} +} // end anonymous namespace. char CGPassManager::ID = 0; + +bool CGPassManager::RunPassOnSCC(Pass *P, std::vector &CurSCC) { + bool Changed = false; + if (CallGraphSCCPass *CGSP = dynamic_cast(P)) { + StartPassTimer(P); + Changed = CGSP->runOnSCC(CurSCC); + StopPassTimer(P); + return Changed; + } + + StartPassTimer(P); + FPPassManager *FPP = dynamic_cast(P); + assert(FPP && "Invalid CGPassManager member"); + + // Run pass P on all functions in the current SCC. + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) { + if (Function *F = CurSCC[i]->getFunction()) { + dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); + Changed |= FPP->runOnFunction(*F); + } + } + StopPassTimer(P); + + return Changed; +} + + /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. bool CGPassManager::runOnModule(Module &M) { @@ -86,7 +115,7 @@ std::vector CurSCC; - // Walk SCC + // Walk the callgraph in bottom-up SCC order. for (scc_iterator CGI = scc_begin(&CG), E = scc_end(&CG); CGI != E;) { // Copy the current SCC and increment past it so that the pass can hack @@ -94,31 +123,19 @@ CurSCC = *CGI; ++CGI; - // Run all passes on current SCC - for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { - Pass *P = getContainedPass(Index); + + // Run all passes on current SCC. + for (unsigned PassNo = 0, e = getNumContainedPasses(); + PassNo != e; ++PassNo) { + Pass *P = getContainedPass(PassNo); dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, ""); dumpRequiredSet(P); initializeAnalysisImpl(P); - StartPassTimer(P); - if (CallGraphSCCPass *CGSP = dynamic_cast(P)) - Changed |= CGSP->runOnSCC(CurSCC); - else { - FPPassManager *FPP = dynamic_cast(P); - assert (FPP && "Invalid CGPassManager member"); - - // Run pass P on all functions current SCC - for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) { - if (Function *F = CurSCC[i]->getFunction()) { - dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); - Changed |= FPP->runOnFunction(*F); - } - } - } - StopPassTimer(P); + // Actually run this pass on the current SCC. + Changed |= RunPassOnSCC(P, CurSCC); if (Changed) dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, ""); From wendling at apple.com Mon Aug 31 01:15:28 2009 From: wendling at apple.com (Bill Wendling) Date: Sun, 30 Aug 2009 23:15:28 -0700 Subject: [llvm-commits] [llvm] r80481 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200908300555.n7U5taUH013777@zion.cs.uiuc.edu> References: <200908300555.n7U5taUH013777@zion.cs.uiuc.edu> Message-ID: <59344B05-E035-4D0C-A0FE-A8746C7954B0@apple.com> On Aug 29, 2009, at 10:55 PM, Chris Lattner wrote: > Author: lattner > Date: Sun Aug 30 00:55:36 2009 > New Revision: 80481 > > URL: http://llvm.org/viewvc/llvm-project?rev=80481&view=rev > Log: > refactor instcombine's worklist processing stuff out to its own class. > > 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=80481&r1=80480&r2=80481&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun > Aug 30 00:55:36 2009 > @@ -74,30 +74,27 @@ > STATISTIC(NumSunkInst , "Number of instructions sunk"); > > namespace { > - class VISIBILITY_HIDDEN InstCombiner > - : public FunctionPass, > - public InstVisitor { > - // Worklist of all of the instructions that need to be > simplified. > + /// InstCombineWorklist - This is the worklist management logic for > + /// InstCombine. > + class InstCombineWorklist { Would it make sense for this class to be marked 'VISIBILITY_HIDDEN' as well? -bw From sabre at nondot.org Mon Aug 31 01:18:52 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 30 Aug 2009 23:18:52 -0700 Subject: [llvm-commits] [llvm] r80481 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <59344B05-E035-4D0C-A0FE-A8746C7954B0@apple.com> References: <200908300555.n7U5taUH013777@zion.cs.uiuc.edu> <59344B05-E035-4D0C-A0FE-A8746C7954B0@apple.com> Message-ID: <99BCA8C4-B048-4E9E-9D30-085F9F24BFC0@nondot.org> On Aug 30, 2009, at 11:15 PM, Bill Wendling wrote: >> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun >> Aug 30 00:55:36 2009 >> @@ -74,30 +74,27 @@ >> STATISTIC(NumSunkInst , "Number of instructions sunk"); >> >> namespace { >> - class VISIBILITY_HIDDEN InstCombiner >> - : public FunctionPass, >> - public InstVisitor { >> - // Worklist of all of the instructions that need to be >> simplified. >> + /// InstCombineWorklist - This is the worklist management logic >> for >> + /// InstCombine. >> + class InstCombineWorklist { > > Would it make sense for this class to be marked 'VISIBILITY_HIDDEN' > as well? VISIBILITY_HIDDEN is an optimization hint only useful for GCC versions before 4.2. I'm not too compelled to continue its use anymore. Would anyone object to ripping it out completely? -Chris From wendling at apple.com Mon Aug 31 01:25:20 2009 From: wendling at apple.com (Bill Wendling) Date: Sun, 30 Aug 2009 23:25:20 -0700 Subject: [llvm-commits] [llvm] r80481 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <99BCA8C4-B048-4E9E-9D30-085F9F24BFC0@nondot.org> References: <200908300555.n7U5taUH013777@zion.cs.uiuc.edu> <59344B05-E035-4D0C-A0FE-A8746C7954B0@apple.com> <99BCA8C4-B048-4E9E-9D30-085F9F24BFC0@nondot.org> Message-ID: On Aug 30, 2009, at 11:18 PM, Chris Lattner wrote: > On Aug 30, 2009, at 11:15 PM, Bill Wendling wrote: > >>> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun >>> Aug 30 00:55:36 2009 >>> @@ -74,30 +74,27 @@ >>> STATISTIC(NumSunkInst , "Number of instructions sunk"); >>> >>> namespace { >>> - class VISIBILITY_HIDDEN InstCombiner >>> - : public FunctionPass, >>> - public InstVisitor { >>> - // Worklist of all of the instructions that need to be >>> simplified. >>> + /// InstCombineWorklist - This is the worklist management logic >>> for >>> + /// InstCombine. >>> + class InstCombineWorklist { >> >> Would it make sense for this class to be marked 'VISIBILITY_HIDDEN' >> as well? > > VISIBILITY_HIDDEN is an optimization hint only useful for GCC > versions before 4.2. I'm not too compelled to continue its use > anymore. Would anyone object to ripping it out completely? > Ah! I see. I have no objection. -bw From sabre at nondot.org Mon Aug 31 01:57:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 06:57:37 -0000 Subject: [llvm-commits] [llvm] r80562 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200908310657.n7V6vcv0010737@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 01:57:37 2009 New Revision: 80562 URL: http://llvm.org/viewvc/llvm-project?rev=80562&view=rev Log: fix some cases where instcombine would change hte IR but not return true from runOnFunction 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=80562&r1=80561&r2=80562&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Aug 31 01:57:37 2009 @@ -164,6 +164,7 @@ public InstVisitor { TargetData *TD; bool MustPreserveLCSSA; + bool MadeIRChange; public: /// Worklist - All of the instructions that need to be simplified. InstCombineWorklist Worklist; @@ -339,6 +340,7 @@ } Worklist.Remove(&I); I.eraseFromParent(); + MadeIRChange = true; return 0; // Don't do anything with FI } @@ -12676,7 +12678,7 @@ } bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { - bool Changed = false; + MadeIRChange = false; TD = getAnalysisIfAvailable(); DEBUG(errs() << "\n\nINSTCOMBINE ITERATION #" << Iteration << " on " @@ -12703,7 +12705,7 @@ // going to do one without it. if (!isa(I)) { ++NumDeadInst; - Changed = true; + MadeIRChange = true; } if (!I->use_empty()) I->replaceAllUsesWith(UndefValue::get(I->getType())); @@ -12721,7 +12723,7 @@ DEBUG(errs() << "IC: DCE: " << *I << '\n'); EraseInstFromFunction(*I); ++NumDeadInst; - Changed = true; + MadeIRChange = true; continue; } @@ -12733,7 +12735,7 @@ ReplaceInstUsesWith(*I, C); ++NumConstProp; EraseInstFromFunction(*I); - Changed = true; + MadeIRChange = true; continue; } @@ -12745,7 +12747,7 @@ F.getContext(), TD)) if (NewC != CE) { i->set(NewC); - Changed = true; + MadeIRChange = true; } } @@ -12768,7 +12770,7 @@ if (UserIsSuccessor && !isa(I->use_back()) && next(pred_begin(UserParent)) == pred_end(UserParent)) // Okay, the CFG is simple enough, try to sink this instruction. - Changed |= TryToSinkInstruction(I, UserParent); + MadeIRChange |= TryToSinkInstruction(I, UserParent); } } @@ -12823,12 +12825,12 @@ Worklist.AddUsersToWorkList(*I); } } - Changed = true; + MadeIRChange = true; } } Worklist.Zap(); - return Changed; + return MadeIRChange; } From sabre at nondot.org Mon Aug 31 02:23:46 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 07:23:46 -0000 Subject: [llvm-commits] [llvm] r80566 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200908310723.n7V7NlfF013906@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 02:23:46 2009 New Revision: 80566 URL: http://llvm.org/viewvc/llvm-project?rev=80566&view=rev Log: Step #1 to giving Callgraph some sane invariants. The problems with callgraph stem from the fact that we have two types of passes that need to update it: 1. callgraphscc and module passes that are explicitly aware of it 2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes by the CGSCC Passmgr. In the case of #1, we can reasonably expect the passes to update the call graph just like any analysis. However, functionpasses are not and generally should not be CG aware. This has caused us no end of problems, so this takes a new approach. Logically, the CGSCC Pass manager can rescan every function after it runs a function pass over it to see if the functionpass made any updates to the IR that affect the callgraph. This allows it to catch new calls introduced by the functionpass. In practice, doing this would be slow. This implementation keeps track of whether or not the current scc is dirtied by a function pass, and, if so, delays updating the callgraph until it is actually needed again. This was we avoid extraneous rescans, but we still have good invariants when the callgraph is needed. Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode to use a CallBackVH for the callsite entry of the CallGraphNode. This way we can immediately remove entries from the callgraph when a FunctionPass is active instead of having dangling pointers. The current pass tries to tolerate these dangling pointers, but it is just an evil hack. This is related to PR3601/4835/4029. This also reverts r80541, a hack working around the sad lack of invariants. Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h llvm/trunk/lib/Analysis/IPA/CallGraph.cpp llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=80566&r1=80565&r2=80566&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/CallGraph.h (original) +++ llvm/trunk/include/llvm/Analysis/CallGraph.h Mon Aug 31 02:23:46 2009 @@ -107,6 +107,7 @@ /// Returns the CallGraphNode which is used to represent undetermined calls /// into the callgraph. Override this if you want behavioral inheritance. virtual CallGraphNode* getExternalCallingNode() const { return 0; } + virtual CallGraphNode* getCallsExternalNode() const { return 0; } /// Return the root/main method in the module, or some other root node, such /// as the externalcallingnode. Overload these if you behavioral @@ -248,6 +249,10 @@ /// should be used sparingly. void removeCallEdgeFor(CallSite CS); + // FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR. + void removeCallEdgeFor(Instruction *CS); + + /// removeAnyCallEdgeTo - This method removes all call edges from this node /// to the specified callee function. This takes more time to execute than /// removeCallEdgeTo, so it should not be used unless necessary. Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=80566&r1=80565&r2=80566&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Mon Aug 31 02:23:46 2009 @@ -239,23 +239,33 @@ /// specified call site. Note that this method takes linear time, so it /// should be used sparingly. void CallGraphNode::removeCallEdgeFor(CallSite CS) { - // Scan for the call site. Note that we aren't guaranteed to find the call - // site in this node, even in reasonable situations. Passes like instcombine - // can adjust callsites (e.g. folding bitcasts into calls to make them direct) - // which can introduce new call sites. Since instcombine is not callgraph - // aware, it doesn't know to tell CallGraph about this change. - for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); - I != CalledFunctions.end(); ++I) { - if (I->first != CS) continue; - - I->second->DropRef(); - *I = CalledFunctions.back(); - CalledFunctions.pop_back(); - return; + for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { + assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); + if (I->first == CS) { + I->second->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); + return; + } + } +} + +// FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR. +void CallGraphNode::removeCallEdgeFor(Instruction *CS) { + for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { + assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); + if (I->first.getInstruction() == CS) { + I->second->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); + return; + } } + } + // removeAnyCallEdgeTo - This method removes any call edges from this node to // the specified callee function. This takes more time to execute than // removeCallEdgeTo, so it should not be used unless necessary. @@ -291,18 +301,18 @@ CallGraphNode *NewCallee) { for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callsite to replace!"); - if (I->first == Old) { - I->first = New; - - // If the callee is changing, not just the callsite, then update it as - // well. - if (NewCallee) { - I->second->DropRef(); - I->second = NewCallee; - I->second->AddRef(); - } - return; + if (I->first != Old) continue; + + I->first = New; + + // If the callee is changing, not just the callsite, then update it as + // well. + if (NewCallee) { + I->second->DropRef(); + I->second = NewCallee; + I->second->AddRef(); } + return; } } Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80566&r1=80565&r2=80566&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Mon Aug 31 02:23:46 2009 @@ -15,11 +15,13 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "cgscc-passmgr" #include "llvm/CallGraphSCCPass.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/PassManagers.h" #include "llvm/Function.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -74,16 +76,24 @@ } private: - bool RunPassOnSCC(Pass *P, std::vector &CurSCC); + bool RunPassOnSCC(Pass *P, std::vector &CurSCC, + CallGraph &CG, bool &CallGraphUpToDate); + void RefreshCallGraph(std::vector &CurSCC, CallGraph &CG); }; } // end anonymous namespace. char CGPassManager::ID = 0; -bool CGPassManager::RunPassOnSCC(Pass *P, std::vector &CurSCC) { +bool CGPassManager::RunPassOnSCC(Pass *P, std::vector &CurSCC, + CallGraph &CG, bool &CallGraphUpToDate) { bool Changed = false; if (CallGraphSCCPass *CGSP = dynamic_cast(P)) { + if (!CallGraphUpToDate) { + RefreshCallGraph(CurSCC, CG); + CallGraphUpToDate = true; + } + StartPassTimer(P); Changed = CGSP->runOnSCC(CurSCC); StopPassTimer(P); @@ -103,9 +113,118 @@ } StopPassTimer(P); + // The the function pass(es) modified the IR, they may have clobbered the + // callgraph. + if (Changed && CallGraphUpToDate) { + DEBUG(errs() << "CGSCCPASSMGR: Pass Dirtied SCC: " + << P->getPassName() << '\n'); + CallGraphUpToDate = false; + } return Changed; } +void CGPassManager::RefreshCallGraph(std::vector &CurSCC, + CallGraph &CG) { + DenseMap CallSites; + + DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() + << " nodes:\n"; + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) + CurSCC[i]->dump(); + ); + + bool MadeChange = false; + MadeChange = MadeChange; + + // Scan all functions in the SCC. + for (unsigned sccidx = 0, e = CurSCC.size(); sccidx != e; ++sccidx) { + CallGraphNode *CGN = CurSCC[sccidx]; + Function *F = CGN->getFunction(); + if (F == 0 || F->isDeclaration()) continue; + + // Walk the function body looking for call sites. Sync up the call sites in + // CGN with those actually in the function. + + // Get the set of call sites currently in the function. + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ++I){ + assert(I->first.getInstruction() && + "Call site record in function should not be abstract"); + assert(!CallSites.count(I->first.getInstruction()) && + "Call site occurs in node multiple times"); + CallSites.insert(std::make_pair(I->first.getInstruction(), + I->second)); + } + + // Loop over all of the instructions in the function, getting the callsites. + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + CallSite CS = CallSite::get(I); + if (!CS.getInstruction()) continue; + + // If this call site already existed in the callgraph, just verify it + // matches up to expectations and remove it from CallSites. + DenseMap::iterator ExistingIt = + CallSites.find(CS.getInstruction()); + if (ExistingIt != CallSites.end()) { + CallGraphNode *ExistingNode = ExistingIt->second; + + // Remove from CallSites since we have now seen it. + CallSites.erase(ExistingIt); + + // Verify that the callee is right. + if (ExistingNode->getFunction() == CS.getCalledFunction()) + continue; + + // If not, we either went from a direct call to indirect, indirect to + // direct, or direct to different direct. + CallGraphNode *CalleeNode; + if (Function *Callee = CS.getCalledFunction()) + CalleeNode = CG.getOrInsertFunction(Callee); + else + CalleeNode = CG.getCallsExternalNode(); + + CGN->replaceCallSite(CS, CS, CalleeNode); + MadeChange = true; + continue; + } + + // If the call site didn't exist in the CGN yet, add it. We assume that + // newly introduced call sites won't be indirect. This could be fixed + // in the future. + CallGraphNode *CalleeNode; + if (Function *Callee = CS.getCalledFunction()) + CalleeNode = CG.getOrInsertFunction(Callee); + else + CalleeNode = CG.getCallsExternalNode(); + + CGN->addCalledFunction(CS, CalleeNode); + MadeChange = true; + } + + // After scanning this function, if we still have entries in callsites, then + // they are dangling pointers. Crap. Well, until we change CallGraph to + // use CallbackVH, we'll just zap them here. When we have that, this should + // turn into an assertion. + if (CallSites.empty()) continue; + + for (DenseMap::iterator I = CallSites.begin(), + E = CallSites.end(); I != E; ++I) + // FIXME: I had to add a special horrible form of removeCallEdgeFor to + // support this. Remove the Instruction* version of it when we can. + CGN->removeCallEdgeFor(I->first); + MadeChange = true; + CallSites.clear(); + } + + DEBUG(if (MadeChange) { + errs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) + CurSCC[i]->dump(); + } else { + errs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; + } + ); +} /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. @@ -124,6 +243,15 @@ ++CGI; + // CallGraphUpToDate - Keep track of whether the callgraph is known to be + // up-to-date or not. The CGSSC pass manager runs two types of passes: + // CallGraphSCC Passes and other random function passes. Because other + // random function passes are not CallGraph aware, they may clobber the + // call graph by introducing new calls or deleting other ones. This flag + // is set to false when we run a function pass so that we know to clean up + // the callgraph when we need to run a CGSCCPass again. + bool CallGraphUpToDate = true; + // Run all passes on current SCC. for (unsigned PassNo = 0, e = getNumContainedPasses(); PassNo != e; ++PassNo) { @@ -135,7 +263,7 @@ initializeAnalysisImpl(P); // Actually run this pass on the current SCC. - Changed |= RunPassOnSCC(P, CurSCC); + Changed |= RunPassOnSCC(P, CurSCC, CG, CallGraphUpToDate); if (Changed) dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, ""); @@ -146,6 +274,11 @@ recordAvailableAnalysis(P); removeDeadPasses(P, "", ON_CG_MSG); } + + // If the callgraph was left out of date (because the last pass run was a + // functionpass), refresh it before we move on to the next SCC. + if (!CallGraphUpToDate) + RefreshCallGraph(CurSCC, CG); } Changed |= doFinalization(CG); return Changed; From daniel at zuster.org Mon Aug 31 03:07:00 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:07:00 -0000 Subject: [llvm-commits] [llvm] r80567 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/CMakeLists.txt lib/MC/MCExpr.cpp tools/llvm-mc/AsmExpr.cpp tools/llvm-mc/AsmExpr.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/CMakeLists.txt Message-ID: <200908310807.n7V871m6032173@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:06:59 2009 New Revision: 80567 URL: http://llvm.org/viewvc/llvm-project?rev=80567&view=rev Log: llvm-mc: Move AsmExpr into MC lib (as MCExpr). Added: llvm/trunk/include/llvm/MC/MCExpr.h - copied, changed from r80566, llvm/trunk/tools/llvm-mc/AsmExpr.h llvm/trunk/lib/MC/MCExpr.cpp - copied, changed from r80566, llvm/trunk/tools/llvm-mc/AsmExpr.cpp Removed: llvm/trunk/tools/llvm-mc/AsmExpr.cpp llvm/trunk/tools/llvm-mc/AsmExpr.h Modified: llvm/trunk/lib/MC/CMakeLists.txt llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/CMakeLists.txt Copied: llvm/trunk/include/llvm/MC/MCExpr.h (from r80566, llvm/trunk/tools/llvm-mc/AsmExpr.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?p2=llvm/trunk/include/llvm/MC/MCExpr.h&p1=llvm/trunk/tools/llvm-mc/AsmExpr.h&r1=80566&r2=80567&rev=80567&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Aug 31 03:06:59 2009 @@ -1,4 +1,4 @@ -//===- AsmExpr.h - Assembly file expressions --------------------*- C++ -*-===// +//===- MCExpr.h - Assembly Level Expressions --------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef ASMEXPR_H -#define ASMEXPR_H +#ifndef LLVM_MC_MCEXPR_H +#define LLVM_MC_MCEXPR_H #include "llvm/Support/Casting.h" #include "llvm/Support/DataTypes.h" @@ -18,11 +18,11 @@ class MCSymbol; class MCValue; -/// AsmExpr - Base class for the full range of assembler expressions which are +/// MCExpr - Base class for the full range of assembler expressions which are /// needed for parsing. -class AsmExpr { +class MCExpr { public: - enum AsmExprKind { + enum ExprKind { Binary, ///< Binary expressions. Constant, ///< Constant expressions. SymbolRef, ///< References to labels and assigned expressions. @@ -30,15 +30,15 @@ }; private: - AsmExprKind Kind; + ExprKind Kind; protected: - AsmExpr(AsmExprKind _Kind) : Kind(_Kind) {} + MCExpr(ExprKind _Kind) : Kind(_Kind) {} public: - virtual ~AsmExpr(); + virtual ~MCExpr(); - AsmExprKind getKind() const { return Kind; } + ExprKind getKind() const { return Kind; } /// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value. /// @@ -53,48 +53,48 @@ /// @result - True on success. bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const; - static bool classof(const AsmExpr *) { return true; } + static bool classof(const MCExpr *) { return true; } }; -//// AsmConstantExpr - Represent a constant integer expression. -class AsmConstantExpr : public AsmExpr { +//// MCConstantExpr - Represent a constant integer expression. +class MCConstantExpr : public MCExpr { int64_t Value; public: - AsmConstantExpr(int64_t _Value) - : AsmExpr(AsmExpr::Constant), Value(_Value) {} + MCConstantExpr(int64_t _Value) + : MCExpr(MCExpr::Constant), Value(_Value) {} int64_t getValue() const { return Value; } - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::Constant; + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Constant; } - static bool classof(const AsmConstantExpr *) { return true; } + static bool classof(const MCConstantExpr *) { return true; } }; -/// AsmSymbolRefExpr - Represent a reference to a symbol from inside an +/// MCSymbolRefExpr - Represent a reference to a symbol from inside an /// expression. /// /// A symbol reference in an expression may be a use of a label, a use of an /// assembler variable (defined constant), or constitute an implicit definition /// of the symbol as external. -class AsmSymbolRefExpr : public AsmExpr { +class MCSymbolRefExpr : public MCExpr { MCSymbol *Symbol; public: - AsmSymbolRefExpr(MCSymbol *_Symbol) - : AsmExpr(AsmExpr::SymbolRef), Symbol(_Symbol) {} + MCSymbolRefExpr(MCSymbol *_Symbol) + : MCExpr(MCExpr::SymbolRef), Symbol(_Symbol) {} MCSymbol *getSymbol() const { return Symbol; } - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::SymbolRef; + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::SymbolRef; } - static bool classof(const AsmSymbolRefExpr *) { return true; } + static bool classof(const MCSymbolRefExpr *) { return true; } }; -/// AsmUnaryExpr - Unary assembler expressions. -class AsmUnaryExpr : public AsmExpr { +/// MCUnaryExpr - Unary assembler expressions. +class MCUnaryExpr : public MCExpr { public: enum Opcode { LNot, ///< Logical negation. @@ -105,27 +105,27 @@ private: Opcode Op; - AsmExpr *Expr; + MCExpr *Expr; public: - AsmUnaryExpr(Opcode _Op, AsmExpr *_Expr) - : AsmExpr(AsmExpr::Unary), Op(_Op), Expr(_Expr) {} - ~AsmUnaryExpr() { + MCUnaryExpr(Opcode _Op, MCExpr *_Expr) + : MCExpr(MCExpr::Unary), Op(_Op), Expr(_Expr) {} + ~MCUnaryExpr() { delete Expr; } Opcode getOpcode() const { return Op; } - AsmExpr *getSubExpr() const { return Expr; } + MCExpr *getSubExpr() const { return Expr; } - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::Unary; + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Unary; } - static bool classof(const AsmUnaryExpr *) { return true; } + static bool classof(const MCUnaryExpr *) { return true; } }; -/// AsmBinaryExpr - Binary assembler expressions. -class AsmBinaryExpr : public AsmExpr { +/// MCBinaryExpr - Binary assembler expressions. +class MCBinaryExpr : public MCExpr { public: enum Opcode { Add, ///< Addition. @@ -150,12 +150,12 @@ private: Opcode Op; - AsmExpr *LHS, *RHS; + MCExpr *LHS, *RHS; public: - AsmBinaryExpr(Opcode _Op, AsmExpr *_LHS, AsmExpr *_RHS) - : AsmExpr(AsmExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} - ~AsmBinaryExpr() { + MCBinaryExpr(Opcode _Op, MCExpr *_LHS, MCExpr *_RHS) + : MCExpr(MCExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} + ~MCBinaryExpr() { delete LHS; delete RHS; } @@ -163,15 +163,15 @@ Opcode getOpcode() const { return Op; } /// getLHS - Get the left-hand side expression of the binary operator. - AsmExpr *getLHS() const { return LHS; } + MCExpr *getLHS() const { return LHS; } /// getRHS - Get the right-hand side expression of the binary operator. - AsmExpr *getRHS() const { return RHS; } + MCExpr *getRHS() const { return RHS; } - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::Binary; + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Binary; } - static bool classof(const AsmBinaryExpr *) { return true; } + static bool classof(const MCBinaryExpr *) { return true; } }; } // end namespace llvm Modified: llvm/trunk/lib/MC/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=80567&r1=80566&r2=80567&view=diff ============================================================================== --- llvm/trunk/lib/MC/CMakeLists.txt (original) +++ llvm/trunk/lib/MC/CMakeLists.txt Mon Aug 31 03:06:59 2009 @@ -8,6 +8,7 @@ MCAssembler.cpp MCCodeEmitter.cpp MCContext.cpp + MCExpr.cpp MCInst.cpp MCMachOStreamer.cpp MCNullStreamer.cpp Copied: llvm/trunk/lib/MC/MCExpr.cpp (from r80566, llvm/trunk/tools/llvm-mc/AsmExpr.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?p2=llvm/trunk/lib/MC/MCExpr.cpp&p1=llvm/trunk/tools/llvm-mc/AsmExpr.cpp&r1=80566&r2=80567&rev=80567&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Mon Aug 31 03:06:59 2009 @@ -1,4 +1,4 @@ -//===- AsmExpr.cpp - Assembly file expressions ----------------------------===// +//===- MCExpr.cpp - Assembly Level Expression Implementation --------------===// // // The LLVM Compiler Infrastructure // @@ -7,16 +7,16 @@ // //===----------------------------------------------------------------------===// -#include "AsmExpr.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" using namespace llvm; -AsmExpr::~AsmExpr() { +MCExpr::~MCExpr() { } -bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { +bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { MCValue Value; if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isAbsolute()) @@ -48,17 +48,17 @@ return true; } -bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { +bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { switch (getKind()) { default: assert(0 && "Invalid assembly expression kind!"); case Constant: - Res = MCValue::get(cast(this)->getValue()); + Res = MCValue::get(cast(this)->getValue()); return true; case SymbolRef: { - MCSymbol *Sym = cast(this)->getSymbol(); + MCSymbol *Sym = cast(this)->getSymbol(); if (const MCValue *Value = Ctx.GetSymbolValue(Sym)) Res = *Value; else @@ -67,31 +67,31 @@ } case Unary: { - const AsmUnaryExpr *AUE = cast(this); + const MCUnaryExpr *AUE = cast(this); MCValue Value; if (!AUE->getSubExpr()->EvaluateAsRelocatable(Ctx, Value)) return false; switch (AUE->getOpcode()) { - case AsmUnaryExpr::LNot: + case MCUnaryExpr::LNot: if (!Value.isAbsolute()) return false; Res = MCValue::get(!Value.getConstant()); break; - case AsmUnaryExpr::Minus: + case MCUnaryExpr::Minus: /// -(a - b + const) ==> (b - a - const) if (Value.getSymA() && !Value.getSymB()) return false; Res = MCValue::get(Value.getSymB(), Value.getSymA(), -Value.getConstant()); break; - case AsmUnaryExpr::Not: + case MCUnaryExpr::Not: if (!Value.isAbsolute()) return false; Res = MCValue::get(~Value.getConstant()); break; - case AsmUnaryExpr::Plus: + case MCUnaryExpr::Plus: Res = Value; break; } @@ -100,7 +100,7 @@ } case Binary: { - const AsmBinaryExpr *ABE = cast(this); + const MCBinaryExpr *ABE = cast(this); MCValue LHSValue, RHSValue; if (!ABE->getLHS()->EvaluateAsRelocatable(Ctx, LHSValue) || @@ -113,14 +113,14 @@ switch (ABE->getOpcode()) { default: return false; - case AsmBinaryExpr::Sub: + case MCBinaryExpr::Sub: // Negate RHS and add. return EvaluateSymbolicAdd(LHSValue, RHSValue.getSymB(), RHSValue.getSymA(), -RHSValue.getConstant(), Res); - case AsmBinaryExpr::Add: + case MCBinaryExpr::Add: return EvaluateSymbolicAdd(LHSValue, RHSValue.getSymA(), RHSValue.getSymB(), RHSValue.getConstant(), @@ -134,24 +134,24 @@ int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); int64_t Result = 0; switch (ABE->getOpcode()) { - case AsmBinaryExpr::Add: Result = LHS + RHS; break; - case AsmBinaryExpr::And: Result = LHS & RHS; break; - case AsmBinaryExpr::Div: Result = LHS / RHS; break; - case AsmBinaryExpr::EQ: Result = LHS == RHS; break; - case AsmBinaryExpr::GT: Result = LHS > RHS; break; - case AsmBinaryExpr::GTE: Result = LHS >= RHS; break; - case AsmBinaryExpr::LAnd: Result = LHS && RHS; break; - case AsmBinaryExpr::LOr: Result = LHS || RHS; break; - case AsmBinaryExpr::LT: Result = LHS < RHS; break; - case AsmBinaryExpr::LTE: Result = LHS <= RHS; break; - case AsmBinaryExpr::Mod: Result = LHS % RHS; break; - case AsmBinaryExpr::Mul: Result = LHS * RHS; break; - case AsmBinaryExpr::NE: Result = LHS != RHS; break; - case AsmBinaryExpr::Or: Result = LHS | RHS; break; - case AsmBinaryExpr::Shl: Result = LHS << RHS; break; - case AsmBinaryExpr::Shr: Result = LHS >> RHS; break; - case AsmBinaryExpr::Sub: Result = LHS - RHS; break; - case AsmBinaryExpr::Xor: Result = LHS ^ RHS; break; + case MCBinaryExpr::Add: Result = LHS + RHS; break; + case MCBinaryExpr::And: Result = LHS & RHS; break; + case MCBinaryExpr::Div: Result = LHS / RHS; break; + case MCBinaryExpr::EQ: Result = LHS == RHS; break; + case MCBinaryExpr::GT: Result = LHS > RHS; break; + case MCBinaryExpr::GTE: Result = LHS >= RHS; break; + case MCBinaryExpr::LAnd: Result = LHS && RHS; break; + case MCBinaryExpr::LOr: Result = LHS || RHS; break; + case MCBinaryExpr::LT: Result = LHS < RHS; break; + case MCBinaryExpr::LTE: Result = LHS <= RHS; break; + case MCBinaryExpr::Mod: Result = LHS % RHS; break; + case MCBinaryExpr::Mul: Result = LHS * RHS; break; + case MCBinaryExpr::NE: Result = LHS != RHS; break; + case MCBinaryExpr::Or: Result = LHS | RHS; break; + case MCBinaryExpr::Shl: Result = LHS << RHS; break; + case MCBinaryExpr::Shr: Result = LHS >> RHS; break; + case MCBinaryExpr::Sub: Result = LHS - RHS; break; + case MCBinaryExpr::Xor: Result = LHS ^ RHS; break; } Res = MCValue::get(Result); Removed: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=80566&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp (removed) @@ -1,162 +0,0 @@ -//===- AsmExpr.cpp - Assembly file expressions ----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "AsmExpr.h" -#include "llvm/MC/MCContext.h" -#include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" -using namespace llvm; - -AsmExpr::~AsmExpr() { -} - -bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { - MCValue Value; - - if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isAbsolute()) - return false; - - Res = Value.getConstant(); - return true; -} - -static bool EvaluateSymbolicAdd(const MCValue &LHS, const MCSymbol *RHS_A, - const MCSymbol *RHS_B, int64_t RHS_Cst, - MCValue &Res) { - // We can't add or subtract two symbols. - if ((LHS.getSymA() && RHS_A) || - (LHS.getSymB() && RHS_B)) - return false; - - const MCSymbol *A = LHS.getSymA() ? LHS.getSymA() : RHS_A; - const MCSymbol *B = LHS.getSymB() ? LHS.getSymB() : RHS_B; - if (B) { - // If we have a negated symbol, then we must have also have a non-negated - // symbol in order to encode the expression. We can do this check later to - // permit expressions which eventually fold to a representable form -- such - // as (a + (0 - b)) -- if necessary. - if (!A) - return false; - } - Res = MCValue::get(A, B, LHS.getConstant() + RHS_Cst); - return true; -} - -bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { - switch (getKind()) { - default: - assert(0 && "Invalid assembly expression kind!"); - - case Constant: - Res = MCValue::get(cast(this)->getValue()); - return true; - - case SymbolRef: { - MCSymbol *Sym = cast(this)->getSymbol(); - if (const MCValue *Value = Ctx.GetSymbolValue(Sym)) - Res = *Value; - else - Res = MCValue::get(Sym, 0, 0); - return true; - } - - case Unary: { - const AsmUnaryExpr *AUE = cast(this); - MCValue Value; - - if (!AUE->getSubExpr()->EvaluateAsRelocatable(Ctx, Value)) - return false; - - switch (AUE->getOpcode()) { - case AsmUnaryExpr::LNot: - if (!Value.isAbsolute()) - return false; - Res = MCValue::get(!Value.getConstant()); - break; - case AsmUnaryExpr::Minus: - /// -(a - b + const) ==> (b - a - const) - if (Value.getSymA() && !Value.getSymB()) - return false; - Res = MCValue::get(Value.getSymB(), Value.getSymA(), - -Value.getConstant()); - break; - case AsmUnaryExpr::Not: - if (!Value.isAbsolute()) - return false; - Res = MCValue::get(~Value.getConstant()); - break; - case AsmUnaryExpr::Plus: - Res = Value; - break; - } - - return true; - } - - case Binary: { - const AsmBinaryExpr *ABE = cast(this); - MCValue LHSValue, RHSValue; - - if (!ABE->getLHS()->EvaluateAsRelocatable(Ctx, LHSValue) || - !ABE->getRHS()->EvaluateAsRelocatable(Ctx, RHSValue)) - return false; - - // We only support a few operations on non-constant expressions, handle - // those first. - if (!LHSValue.isAbsolute() || !RHSValue.isAbsolute()) { - switch (ABE->getOpcode()) { - default: - return false; - case AsmBinaryExpr::Sub: - // Negate RHS and add. - return EvaluateSymbolicAdd(LHSValue, - RHSValue.getSymB(), RHSValue.getSymA(), - -RHSValue.getConstant(), - Res); - - case AsmBinaryExpr::Add: - return EvaluateSymbolicAdd(LHSValue, - RHSValue.getSymA(), RHSValue.getSymB(), - RHSValue.getConstant(), - Res); - } - } - - // FIXME: We need target hooks for the evaluation. It may be limited in - // width, and gas defines the result of comparisons differently from Apple - // as (the result is sign extended). - int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); - int64_t Result = 0; - switch (ABE->getOpcode()) { - case AsmBinaryExpr::Add: Result = LHS + RHS; break; - case AsmBinaryExpr::And: Result = LHS & RHS; break; - case AsmBinaryExpr::Div: Result = LHS / RHS; break; - case AsmBinaryExpr::EQ: Result = LHS == RHS; break; - case AsmBinaryExpr::GT: Result = LHS > RHS; break; - case AsmBinaryExpr::GTE: Result = LHS >= RHS; break; - case AsmBinaryExpr::LAnd: Result = LHS && RHS; break; - case AsmBinaryExpr::LOr: Result = LHS || RHS; break; - case AsmBinaryExpr::LT: Result = LHS < RHS; break; - case AsmBinaryExpr::LTE: Result = LHS <= RHS; break; - case AsmBinaryExpr::Mod: Result = LHS % RHS; break; - case AsmBinaryExpr::Mul: Result = LHS * RHS; break; - case AsmBinaryExpr::NE: Result = LHS != RHS; break; - case AsmBinaryExpr::Or: Result = LHS | RHS; break; - case AsmBinaryExpr::Shl: Result = LHS << RHS; break; - case AsmBinaryExpr::Shr: Result = LHS >> RHS; break; - case AsmBinaryExpr::Sub: Result = LHS - RHS; break; - case AsmBinaryExpr::Xor: Result = LHS ^ RHS; break; - } - - Res = MCValue::get(Result); - return true; - } - } -} - Removed: llvm/trunk/tools/llvm-mc/AsmExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.h?rev=80566&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.h (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.h (removed) @@ -1,179 +0,0 @@ -//===- AsmExpr.h - Assembly file expressions --------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef ASMEXPR_H -#define ASMEXPR_H - -#include "llvm/Support/Casting.h" -#include "llvm/Support/DataTypes.h" - -namespace llvm { -class MCContext; -class MCSymbol; -class MCValue; - -/// AsmExpr - Base class for the full range of assembler expressions which are -/// needed for parsing. -class AsmExpr { -public: - enum AsmExprKind { - Binary, ///< Binary expressions. - Constant, ///< Constant expressions. - SymbolRef, ///< References to labels and assigned expressions. - Unary ///< Unary expressions. - }; - -private: - AsmExprKind Kind; - -protected: - AsmExpr(AsmExprKind _Kind) : Kind(_Kind) {} - -public: - virtual ~AsmExpr(); - - AsmExprKind getKind() const { return Kind; } - - /// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value. - /// - /// @param Res - The absolute value, if evaluation succeeds. - /// @result - True on success. - bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; - - /// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable - /// value, i.e. an expression of the fixed form (a - b + constant). - /// - /// @param Res - The relocatable value, if evaluation succeeds. - /// @result - True on success. - bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const; - - static bool classof(const AsmExpr *) { return true; } -}; - -//// AsmConstantExpr - Represent a constant integer expression. -class AsmConstantExpr : public AsmExpr { - int64_t Value; - -public: - AsmConstantExpr(int64_t _Value) - : AsmExpr(AsmExpr::Constant), Value(_Value) {} - - int64_t getValue() const { return Value; } - - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::Constant; - } - static bool classof(const AsmConstantExpr *) { return true; } -}; - -/// AsmSymbolRefExpr - Represent a reference to a symbol from inside an -/// expression. -/// -/// A symbol reference in an expression may be a use of a label, a use of an -/// assembler variable (defined constant), or constitute an implicit definition -/// of the symbol as external. -class AsmSymbolRefExpr : public AsmExpr { - MCSymbol *Symbol; - -public: - AsmSymbolRefExpr(MCSymbol *_Symbol) - : AsmExpr(AsmExpr::SymbolRef), Symbol(_Symbol) {} - - MCSymbol *getSymbol() const { return Symbol; } - - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::SymbolRef; - } - static bool classof(const AsmSymbolRefExpr *) { return true; } -}; - -/// AsmUnaryExpr - Unary assembler expressions. -class AsmUnaryExpr : public AsmExpr { -public: - enum Opcode { - LNot, ///< Logical negation. - Minus, ///< Unary minus. - Not, ///< Bitwise negation. - Plus ///< Unary plus. - }; - -private: - Opcode Op; - AsmExpr *Expr; - -public: - AsmUnaryExpr(Opcode _Op, AsmExpr *_Expr) - : AsmExpr(AsmExpr::Unary), Op(_Op), Expr(_Expr) {} - ~AsmUnaryExpr() { - delete Expr; - } - - Opcode getOpcode() const { return Op; } - - AsmExpr *getSubExpr() const { return Expr; } - - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::Unary; - } - static bool classof(const AsmUnaryExpr *) { return true; } -}; - -/// AsmBinaryExpr - Binary assembler expressions. -class AsmBinaryExpr : public AsmExpr { -public: - enum Opcode { - Add, ///< Addition. - And, ///< Bitwise and. - Div, ///< Division. - EQ, ///< Equality comparison. - GT, ///< Greater than comparison. - GTE, ///< Greater than or equal comparison. - LAnd, ///< Logical and. - LOr, ///< Logical or. - LT, ///< Less than comparison. - LTE, ///< Less than or equal comparison. - Mod, ///< Modulus. - Mul, ///< Multiplication. - NE, ///< Inequality comparison. - Or, ///< Bitwise or. - Shl, ///< Bitwise shift left. - Shr, ///< Bitwise shift right. - Sub, ///< Subtraction. - Xor ///< Bitwise exclusive or. - }; - -private: - Opcode Op; - AsmExpr *LHS, *RHS; - -public: - AsmBinaryExpr(Opcode _Op, AsmExpr *_LHS, AsmExpr *_RHS) - : AsmExpr(AsmExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} - ~AsmBinaryExpr() { - delete LHS; - delete RHS; - } - - Opcode getOpcode() const { return Op; } - - /// getLHS - Get the left-hand side expression of the binary operator. - AsmExpr *getLHS() const { return LHS; } - - /// getRHS - Get the right-hand side expression of the binary operator. - AsmExpr *getRHS() const { return RHS; } - - static bool classof(const AsmExpr *E) { - return E->getKind() == AsmExpr::Binary; - } - static bool classof(const AsmBinaryExpr *) { return true; } -}; - -} // end namespace llvm - -#endif Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80567&r1=80566&r2=80567&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:06:59 2009 @@ -13,10 +13,10 @@ #include "AsmParser.h" -#include "AsmExpr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" @@ -173,7 +173,7 @@ /// /// parenexpr ::= expr) /// -bool AsmParser::ParseParenExpr(AsmExpr *&Res) { +bool AsmParser::ParseParenExpr(MCExpr *&Res) { if (ParseExpression(Res)) return true; if (Lexer.isNot(AsmToken::RParen)) return TokError("expected ')' in parentheses expression"); @@ -197,7 +197,7 @@ /// primaryexpr ::= symbol /// primaryexpr ::= number /// primaryexpr ::= ~,+,- primaryexpr -bool AsmParser::ParsePrimaryExpr(AsmExpr *&Res) { +bool AsmParser::ParsePrimaryExpr(MCExpr *&Res) { switch (Lexer.getKind()) { default: return TokError("unknown token in expression"); @@ -205,7 +205,7 @@ Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new AsmUnaryExpr(AsmUnaryExpr::LNot, Res); + Res = new MCUnaryExpr(MCUnaryExpr::LNot, Res); return false; case AsmToken::String: case AsmToken::Identifier: { @@ -213,12 +213,12 @@ // handle things like LFOO+4. MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier()); - Res = new AsmSymbolRefExpr(Sym); + Res = new MCSymbolRefExpr(Sym); Lexer.Lex(); // Eat identifier. return false; } case AsmToken::Integer: - Res = new AsmConstantExpr(Lexer.getTok().getIntVal()); + Res = new MCConstantExpr(Lexer.getTok().getIntVal()); Lexer.Lex(); // Eat token. return false; case AsmToken::LParen: @@ -228,19 +228,19 @@ Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new AsmUnaryExpr(AsmUnaryExpr::Minus, Res); + Res = new MCUnaryExpr(MCUnaryExpr::Minus, Res); return false; case AsmToken::Plus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new AsmUnaryExpr(AsmUnaryExpr::Plus, Res); + Res = new MCUnaryExpr(MCUnaryExpr::Plus, Res); return false; case AsmToken::Tilde: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new AsmUnaryExpr(AsmUnaryExpr::Not, Res); + Res = new MCUnaryExpr(MCUnaryExpr::Not, Res); return false; } } @@ -252,14 +252,14 @@ /// expr ::= expr *,/,%,<<,>> expr -> highest. /// expr ::= primaryexpr /// -bool AsmParser::ParseExpression(AsmExpr *&Res) { +bool AsmParser::ParseExpression(MCExpr *&Res) { Res = 0; return ParsePrimaryExpr(Res) || ParseBinOpRHS(1, Res); } bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { - AsmExpr *Expr; + MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); if (ParseExpression(Expr)) @@ -272,7 +272,7 @@ } bool AsmParser::ParseRelocatableExpression(MCValue &Res) { - AsmExpr *Expr; + MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); if (ParseExpression(Expr)) @@ -285,7 +285,7 @@ } bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) { - AsmExpr *Expr; + MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); if (ParseParenExpr(Expr)) @@ -298,73 +298,73 @@ } static unsigned getBinOpPrecedence(AsmToken::TokenKind K, - AsmBinaryExpr::Opcode &Kind) { + MCBinaryExpr::Opcode &Kind) { switch (K) { default: return 0; // not a binop. // Lowest Precedence: &&, || case AsmToken::AmpAmp: - Kind = AsmBinaryExpr::LAnd; + Kind = MCBinaryExpr::LAnd; return 1; case AsmToken::PipePipe: - Kind = AsmBinaryExpr::LOr; + Kind = MCBinaryExpr::LOr; return 1; // Low Precedence: +, -, ==, !=, <>, <, <=, >, >= case AsmToken::Plus: - Kind = AsmBinaryExpr::Add; + Kind = MCBinaryExpr::Add; return 2; case AsmToken::Minus: - Kind = AsmBinaryExpr::Sub; + Kind = MCBinaryExpr::Sub; return 2; case AsmToken::EqualEqual: - Kind = AsmBinaryExpr::EQ; + Kind = MCBinaryExpr::EQ; return 2; case AsmToken::ExclaimEqual: case AsmToken::LessGreater: - Kind = AsmBinaryExpr::NE; + Kind = MCBinaryExpr::NE; return 2; case AsmToken::Less: - Kind = AsmBinaryExpr::LT; + Kind = MCBinaryExpr::LT; return 2; case AsmToken::LessEqual: - Kind = AsmBinaryExpr::LTE; + Kind = MCBinaryExpr::LTE; return 2; case AsmToken::Greater: - Kind = AsmBinaryExpr::GT; + Kind = MCBinaryExpr::GT; return 2; case AsmToken::GreaterEqual: - Kind = AsmBinaryExpr::GTE; + Kind = MCBinaryExpr::GTE; return 2; // Intermediate Precedence: |, &, ^ // // FIXME: gas seems to support '!' as an infix operator? case AsmToken::Pipe: - Kind = AsmBinaryExpr::Or; + Kind = MCBinaryExpr::Or; return 3; case AsmToken::Caret: - Kind = AsmBinaryExpr::Xor; + Kind = MCBinaryExpr::Xor; return 3; case AsmToken::Amp: - Kind = AsmBinaryExpr::And; + Kind = MCBinaryExpr::And; return 3; // Highest Precedence: *, /, %, <<, >> case AsmToken::Star: - Kind = AsmBinaryExpr::Mul; + Kind = MCBinaryExpr::Mul; return 4; case AsmToken::Slash: - Kind = AsmBinaryExpr::Div; + Kind = MCBinaryExpr::Div; return 4; case AsmToken::Percent: - Kind = AsmBinaryExpr::Mod; + Kind = MCBinaryExpr::Mod; return 4; case AsmToken::LessLess: - Kind = AsmBinaryExpr::Shl; + Kind = MCBinaryExpr::Shl; return 4; case AsmToken::GreaterGreater: - Kind = AsmBinaryExpr::Shr; + Kind = MCBinaryExpr::Shr; return 4; } } @@ -372,9 +372,9 @@ /// ParseBinOpRHS - Parse all binary operators with precedence >= 'Precedence'. /// Res contains the LHS of the expression on input. -bool AsmParser::ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res) { +bool AsmParser::ParseBinOpRHS(unsigned Precedence, MCExpr *&Res) { while (1) { - AsmBinaryExpr::Opcode Kind = AsmBinaryExpr::Add; + MCBinaryExpr::Opcode Kind = MCBinaryExpr::Add; unsigned TokPrec = getBinOpPrecedence(Lexer.getKind(), Kind); // If the next token is lower precedence than we are allowed to eat, return @@ -385,19 +385,19 @@ Lexer.Lex(); // Eat the next primary expression. - AsmExpr *RHS; + MCExpr *RHS; if (ParsePrimaryExpr(RHS)) return true; // If BinOp binds less tightly with RHS than the operator after RHS, let // the pending operator take RHS as its LHS. - AsmBinaryExpr::Opcode Dummy; + MCBinaryExpr::Opcode Dummy; unsigned NextTokPrec = getBinOpPrecedence(Lexer.getKind(), Dummy); if (TokPrec < NextTokPrec) { if (ParseBinOpRHS(Precedence+1, RHS)) return true; } // Merge LHS and RHS according to operator. - Res = new AsmBinaryExpr(Kind, Res, RHS); + Res = new MCBinaryExpr(Kind, Res, RHS); } } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80567&r1=80566&r2=80567&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:06:59 2009 @@ -22,9 +22,9 @@ #include "llvm/MC/MCStreamer.h" namespace llvm { -class AsmExpr; class AsmCond; class MCContext; +class MCExpr; class MCInst; class MCStreamer; class MCValue; @@ -66,7 +66,7 @@ virtual bool Error(SMLoc L, const Twine &Msg); - virtual bool ParseExpression(AsmExpr *&Res); + virtual bool ParseExpression(MCExpr *&Res); virtual bool ParseAbsoluteExpression(int64_t &Res); @@ -104,9 +104,9 @@ /// @see ParseRelocatableExpression, ParseParenExpr. bool ParseParenRelocatableExpression(MCValue &Res); - bool ParsePrimaryExpr(AsmExpr *&Res); - bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res); - bool ParseParenExpr(AsmExpr *&Res); + bool ParsePrimaryExpr(MCExpr *&Res); + bool ParseBinOpRHS(unsigned Precedence, MCExpr *&Res); + bool ParseParenExpr(MCExpr *&Res); /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// and set \arg Res to the identifier contents. Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/CMakeLists.txt?rev=80567&r1=80566&r2=80567&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/CMakeLists.txt (original) +++ llvm/trunk/tools/llvm-mc/CMakeLists.txt Mon Aug 31 03:06:59 2009 @@ -2,7 +2,6 @@ add_llvm_tool(llvm-mc llvm-mc.cpp - AsmExpr.cpp AsmLexer.cpp AsmParser.cpp ) From daniel at zuster.org Mon Aug 31 03:07:09 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:07:09 -0000 Subject: [llvm-commits] [llvm] r80568 - /llvm/trunk/include/llvm/MC/MCContext.h Message-ID: <200908310807.n7V879kL032202@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:07:08 2009 New Revision: 80568 URL: http://llvm.org/viewvc/llvm-project?rev=80568&view=rev Log: llvm-mc: Add some doxyment markers. Modified: llvm/trunk/include/llvm/MC/MCContext.h Modified: llvm/trunk/include/llvm/MC/MCContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=80568&r1=80567&r2=80568&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCContext.h (original) +++ llvm/trunk/include/llvm/MC/MCContext.h Mon Aug 31 03:07:08 2009 @@ -46,7 +46,10 @@ public: MCContext(); ~MCContext(); - + + /// @name Symbol Managment + /// @{ + /// CreateSymbol - Create a new symbol with the specified @param Name. /// /// @param Name - The symbol name, which must be unique across all symbols. @@ -72,6 +75,10 @@ /// LookupSymbol - Get the symbol for @param Name, or null. MCSymbol *LookupSymbol(const StringRef &Name) const; + /// @} + /// @name Symbol Value Table + /// @{ + /// ClearSymbolValue - Erase a value binding for @arg Symbol, if one exists. void ClearSymbolValue(const MCSymbol *Symbol); @@ -82,6 +89,8 @@ /// none exists. const MCValue *GetSymbolValue(const MCSymbol *Symbol) const; + /// @} + void *Allocate(unsigned Size, unsigned Align = 8) { return Allocator.Allocate(Size, Align); } From daniel at zuster.org Mon Aug 31 03:07:22 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:07:22 -0000 Subject: [llvm-commits] [llvm] r80569 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200908310807.n7V87Nmf032245@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:07:22 2009 New Revision: 80569 URL: http://llvm.org/viewvc/llvm-project?rev=80569&view=rev Log: llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs). Modified: llvm/trunk/include/llvm/MC/MCExpr.h llvm/trunk/lib/MC/MCExpr.cpp llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=80569&r1=80568&r2=80569&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Aug 31 03:07:22 2009 @@ -19,7 +19,7 @@ class MCValue; /// MCExpr - Base class for the full range of assembler expressions which are -/// needed for parsing. +/// needed for parsing. class MCExpr { public: enum ExprKind { @@ -28,18 +28,26 @@ SymbolRef, ///< References to labels and assigned expressions. Unary ///< Unary expressions. }; - + private: ExprKind Kind; - + + MCExpr(const MCExpr&); // DO NOT IMPLEMENT + void operator=(const MCExpr&); // DO NOT IMPLEMENT + protected: MCExpr(ExprKind _Kind) : Kind(_Kind) {} - + public: - virtual ~MCExpr(); + /// @name Accessors + /// @{ ExprKind getKind() const { return Kind; } + /// @} + /// @name Expression Evaluation + /// @{ + /// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value. /// /// @param Res - The absolute value, if evaluation succeeds. @@ -53,6 +61,8 @@ /// @result - True on success. bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const; + /// @} + static bool classof(const MCExpr *) { return true; } }; @@ -60,14 +70,25 @@ class MCConstantExpr : public MCExpr { int64_t Value; -public: - MCConstantExpr(int64_t _Value) + MCConstantExpr(int64_t _Value) : MCExpr(MCExpr::Constant), Value(_Value) {} - + +public: + /// @name Construction + /// @{ + + static const MCConstantExpr *Create(int64_t Value, MCContext &Ctx); + + /// @} + /// @name Accessors + /// @{ + int64_t getValue() const { return Value; } - static bool classof(const MCExpr *E) { - return E->getKind() == MCExpr::Constant; + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Constant; } static bool classof(const MCConstantExpr *) { return true; } }; @@ -79,16 +100,27 @@ /// assembler variable (defined constant), or constitute an implicit definition /// of the symbol as external. class MCSymbolRefExpr : public MCExpr { - MCSymbol *Symbol; + const MCSymbol *Symbol; -public: - MCSymbolRefExpr(MCSymbol *_Symbol) + MCSymbolRefExpr(const MCSymbol *_Symbol) : MCExpr(MCExpr::SymbolRef), Symbol(_Symbol) {} - - MCSymbol *getSymbol() const { return Symbol; } - static bool classof(const MCExpr *E) { - return E->getKind() == MCExpr::SymbolRef; +public: + /// @name Construction + /// @{ + + static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx); + + /// @} + /// @name Accessors + /// @{ + + const MCSymbol &getSymbol() const { return *Symbol; } + + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::SymbolRef; } static bool classof(const MCSymbolRefExpr *) { return true; } }; @@ -105,21 +137,44 @@ private: Opcode Op; - MCExpr *Expr; + const MCExpr *Expr; -public: - MCUnaryExpr(Opcode _Op, MCExpr *_Expr) + MCUnaryExpr(Opcode _Op, const MCExpr *_Expr) : MCExpr(MCExpr::Unary), Op(_Op), Expr(_Expr) {} - ~MCUnaryExpr() { - delete Expr; + +public: + /// @name Construction + /// @{ + + static const MCUnaryExpr *Create(Opcode Op, const MCExpr *Expr, + MCContext &Ctx); + static const MCUnaryExpr *CreateLNot(const MCExpr *Expr, MCContext &Ctx) { + return Create(LNot, Expr, Ctx); + } + static const MCUnaryExpr *CreateMinus(const MCExpr *Expr, MCContext &Ctx) { + return Create(Minus, Expr, Ctx); + } + static const MCUnaryExpr *CreateNot(const MCExpr *Expr, MCContext &Ctx) { + return Create(Not, Expr, Ctx); } + static const MCUnaryExpr *CreatePlus(const MCExpr *Expr, MCContext &Ctx) { + return Create(Plus, Expr, Ctx); + } + + /// @} + /// @name Accessors + /// @{ + /// getOpcode - Get the kind of this unary expression. Opcode getOpcode() const { return Op; } - MCExpr *getSubExpr() const { return Expr; } + /// getSubExpr - Get the child of this unary expression. + const MCExpr *getSubExpr() const { return Expr; } - static bool classof(const MCExpr *E) { - return E->getKind() == MCExpr::Unary; + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Unary; } static bool classof(const MCUnaryExpr *) { return true; } }; @@ -150,26 +205,107 @@ private: Opcode Op; - MCExpr *LHS, *RHS; + const MCExpr *LHS, *RHS; -public: - MCBinaryExpr(Opcode _Op, MCExpr *_LHS, MCExpr *_RHS) + MCBinaryExpr(Opcode _Op, const MCExpr *_LHS, const MCExpr *_RHS) : MCExpr(MCExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} - ~MCBinaryExpr() { - delete LHS; - delete RHS; + +public: + /// @name Construction + /// @{ + + static const MCBinaryExpr *Create(Opcode Op, const MCExpr *LHS, + const MCExpr *RHS, MCContext &Ctx); + static const MCBinaryExpr *CreateAdd(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Add, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateAnd(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(And, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateDiv(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Div, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateEQ(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(EQ, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateGT(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(GT, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateGTE(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(GTE, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLAnd(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LAnd, LHS, RHS, Ctx); } + static const MCBinaryExpr *CreateLOr(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LOr, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLT(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LT, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLTE(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LTE, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateMod(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Mod, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateMul(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Mul, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateNE(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(NE, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateOr(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Or, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateShl(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Shl, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateShr(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Shr, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateSub(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Sub, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateXor(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Xor, LHS, RHS, Ctx); + } + + /// @} + /// @name Accessors + /// @{ + /// getOpcode - Get the kind of this binary expression. Opcode getOpcode() const { return Op; } /// getLHS - Get the left-hand side expression of the binary operator. - MCExpr *getLHS() const { return LHS; } + const MCExpr *getLHS() const { return LHS; } /// getRHS - Get the right-hand side expression of the binary operator. - MCExpr *getRHS() const { return RHS; } + const MCExpr *getRHS() const { return RHS; } + + /// @} - static bool classof(const MCExpr *E) { - return E->getKind() == MCExpr::Binary; + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Binary; } static bool classof(const MCBinaryExpr *) { return true; } }; Modified: llvm/trunk/lib/MC/MCExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=80569&r1=80568&r2=80569&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Mon Aug 31 03:07:22 2009 @@ -13,9 +13,30 @@ #include "llvm/MC/MCValue.h" using namespace llvm; -MCExpr::~MCExpr() { +const MCBinaryExpr * MCBinaryExpr::Create(Opcode Opc, + const MCExpr *LHS, + const MCExpr *RHS, + MCContext &Ctx) { + return new (Ctx) MCBinaryExpr(Opc, LHS, RHS); } +const MCUnaryExpr * MCUnaryExpr::Create(Opcode Opc, + const MCExpr *Expr, + MCContext &Ctx) { + return new (Ctx) MCUnaryExpr(Opc, Expr); +} + +const MCConstantExpr *MCConstantExpr::Create(int64_t Value, MCContext &Ctx) { + return new (Ctx) MCConstantExpr(Value); +} + +const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym, + MCContext &Ctx) { + return new (Ctx) MCSymbolRefExpr(Sym); +} + +/* *** */ + bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { MCValue Value; @@ -50,19 +71,16 @@ bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { switch (getKind()) { - default: - assert(0 && "Invalid assembly expression kind!"); - case Constant: Res = MCValue::get(cast(this)->getValue()); return true; case SymbolRef: { - MCSymbol *Sym = cast(this)->getSymbol(); - if (const MCValue *Value = Ctx.GetSymbolValue(Sym)) + const MCSymbol &Sym = cast(this)->getSymbol(); + if (const MCValue *Value = Ctx.GetSymbolValue(&Sym)) Res = *Value; else - Res = MCValue::get(Sym, 0, 0); + Res = MCValue::get(&Sym, 0, 0); return true; } @@ -158,5 +176,7 @@ return true; } } -} + assert(0 && "Invalid assembly expression kind!"); + return false; +} Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80569&r1=80568&r2=80569&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:07:22 2009 @@ -173,7 +173,7 @@ /// /// parenexpr ::= expr) /// -bool AsmParser::ParseParenExpr(MCExpr *&Res) { +bool AsmParser::ParseParenExpr(const MCExpr *&Res) { if (ParseExpression(Res)) return true; if (Lexer.isNot(AsmToken::RParen)) return TokError("expected ')' in parentheses expression"); @@ -197,7 +197,7 @@ /// primaryexpr ::= symbol /// primaryexpr ::= number /// primaryexpr ::= ~,+,- primaryexpr -bool AsmParser::ParsePrimaryExpr(MCExpr *&Res) { +bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res) { switch (Lexer.getKind()) { default: return TokError("unknown token in expression"); @@ -205,7 +205,7 @@ Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new MCUnaryExpr(MCUnaryExpr::LNot, Res); + Res = MCUnaryExpr::CreateLNot(Res, Ctx); return false; case AsmToken::String: case AsmToken::Identifier: { @@ -213,12 +213,12 @@ // handle things like LFOO+4. MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier()); - Res = new MCSymbolRefExpr(Sym); + Res = MCSymbolRefExpr::Create(Sym, Ctx); Lexer.Lex(); // Eat identifier. return false; } case AsmToken::Integer: - Res = new MCConstantExpr(Lexer.getTok().getIntVal()); + Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), Ctx); Lexer.Lex(); // Eat token. return false; case AsmToken::LParen: @@ -228,19 +228,19 @@ Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new MCUnaryExpr(MCUnaryExpr::Minus, Res); + Res = MCUnaryExpr::CreateMinus(Res, Ctx); return false; case AsmToken::Plus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new MCUnaryExpr(MCUnaryExpr::Plus, Res); + Res = MCUnaryExpr::CreatePlus(Res, Ctx); return false; case AsmToken::Tilde: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = new MCUnaryExpr(MCUnaryExpr::Not, Res); + Res = MCUnaryExpr::CreateNot(Res, Ctx); return false; } } @@ -252,14 +252,14 @@ /// expr ::= expr *,/,%,<<,>> expr -> highest. /// expr ::= primaryexpr /// -bool AsmParser::ParseExpression(MCExpr *&Res) { +bool AsmParser::ParseExpression(const MCExpr *&Res) { Res = 0; return ParsePrimaryExpr(Res) || ParseBinOpRHS(1, Res); } bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { - MCExpr *Expr; + const MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); if (ParseExpression(Expr)) @@ -272,7 +272,7 @@ } bool AsmParser::ParseRelocatableExpression(MCValue &Res) { - MCExpr *Expr; + const MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); if (ParseExpression(Expr)) @@ -285,7 +285,7 @@ } bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) { - MCExpr *Expr; + const MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); if (ParseParenExpr(Expr)) @@ -372,7 +372,7 @@ /// ParseBinOpRHS - Parse all binary operators with precedence >= 'Precedence'. /// Res contains the LHS of the expression on input. -bool AsmParser::ParseBinOpRHS(unsigned Precedence, MCExpr *&Res) { +bool AsmParser::ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res) { while (1) { MCBinaryExpr::Opcode Kind = MCBinaryExpr::Add; unsigned TokPrec = getBinOpPrecedence(Lexer.getKind(), Kind); @@ -385,7 +385,7 @@ Lexer.Lex(); // Eat the next primary expression. - MCExpr *RHS; + const MCExpr *RHS; if (ParsePrimaryExpr(RHS)) return true; // If BinOp binds less tightly with RHS than the operator after RHS, let @@ -397,7 +397,7 @@ } // Merge LHS and RHS according to operator. - Res = new MCBinaryExpr(Kind, Res, RHS); + Res = MCBinaryExpr::Create(Kind, Res, RHS, Ctx); } } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80569&r1=80568&r2=80569&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:07:22 2009 @@ -66,7 +66,7 @@ virtual bool Error(SMLoc L, const Twine &Msg); - virtual bool ParseExpression(MCExpr *&Res); + virtual bool ParseExpression(const MCExpr *&Res); virtual bool ParseAbsoluteExpression(int64_t &Res); @@ -104,9 +104,9 @@ /// @see ParseRelocatableExpression, ParseParenExpr. bool ParseParenRelocatableExpression(MCValue &Res); - bool ParsePrimaryExpr(MCExpr *&Res); - bool ParseBinOpRHS(unsigned Precedence, MCExpr *&Res); - bool ParseParenExpr(MCExpr *&Res); + bool ParsePrimaryExpr(const MCExpr *&Res); + bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res); + bool ParseParenExpr(const MCExpr *&Res); /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// and set \arg Res to the identifier contents. From daniel at zuster.org Mon Aug 31 03:07:33 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:07:33 -0000 Subject: [llvm-commits] [llvm] r80570 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp Message-ID: <200908310807.n7V87XEs032282@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:07:33 2009 New Revision: 80570 URL: http://llvm.org/viewvc/llvm-project?rev=80570&view=rev Log: llvm-mc: Add MCExpr::{dump,print}. Modified: llvm/trunk/include/llvm/MC/MCExpr.h llvm/trunk/lib/MC/MCExpr.cpp Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=80570&r1=80569&r2=80570&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Aug 31 03:07:33 2009 @@ -17,6 +17,7 @@ class MCContext; class MCSymbol; class MCValue; +class raw_ostream; /// MCExpr - Base class for the full range of assembler expressions which are /// needed for parsing. @@ -45,6 +46,13 @@ ExprKind getKind() const { return Kind; } /// @} + /// @name Utility Methods + /// @{ + + void print(raw_ostream &OS) const; + void dump() const; + + /// @} /// @name Expression Evaluation /// @{ Modified: llvm/trunk/lib/MC/MCExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=80570&r1=80569&r2=80570&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Mon Aug 31 03:07:33 2009 @@ -11,8 +11,75 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; +void MCExpr::print(raw_ostream &OS) const { + switch (getKind()) { + case MCExpr::Constant: + OS << cast(*this).getValue(); + return; + + case MCExpr::SymbolRef: + cast(*this).getSymbol().print(OS); + return; + + case MCExpr::Unary: { + const MCUnaryExpr &UE = cast(*this); + switch (UE.getOpcode()) { + default: assert(0 && "Invalid opcode!"); + case MCUnaryExpr::LNot: OS << '!'; break; + case MCUnaryExpr::Minus: OS << '-'; break; + case MCUnaryExpr::Not: OS << '~'; break; + case MCUnaryExpr::Plus: OS << '+'; break; + } + UE.getSubExpr()->print(OS); + return; + } + + case MCExpr::Binary: { + const MCBinaryExpr &BE = cast(*this); + OS << '('; + BE.getLHS()->print(OS); + OS << ' '; + switch (BE.getOpcode()) { + default: assert(0 && "Invalid opcode!"); + case MCBinaryExpr::Add: OS << '+'; break; + case MCBinaryExpr::And: OS << '&'; break; + case MCBinaryExpr::Div: OS << '/'; break; + case MCBinaryExpr::EQ: OS << "=="; break; + case MCBinaryExpr::GT: OS << '>'; break; + case MCBinaryExpr::GTE: OS << ">="; break; + case MCBinaryExpr::LAnd: OS << "&&"; break; + case MCBinaryExpr::LOr: OS << "||"; break; + case MCBinaryExpr::LT: OS << '<'; break; + case MCBinaryExpr::LTE: OS << "<="; break; + case MCBinaryExpr::Mod: OS << '%'; break; + case MCBinaryExpr::Mul: OS << '*'; break; + case MCBinaryExpr::NE: OS << "!="; break; + case MCBinaryExpr::Or: OS << '|'; break; + case MCBinaryExpr::Shl: OS << "<<"; break; + case MCBinaryExpr::Shr: OS << ">>"; break; + case MCBinaryExpr::Sub: OS << '-'; break; + case MCBinaryExpr::Xor: OS << '^'; break; + } + OS << ' '; + BE.getRHS()->print(OS); + OS << ')'; + return; + } + } + + assert(0 && "Invalid expression kind!"); +} + +void MCExpr::dump() const { + print(errs()); + errs() << '\n'; +} + +/* *** */ + const MCBinaryExpr * MCBinaryExpr::Create(Opcode Opc, const MCExpr *LHS, const MCExpr *RHS, From daniel at zuster.org Mon Aug 31 03:07:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:07:44 -0000 Subject: [llvm-commits] [llvm] r80571 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200908310807.n7V87iN8032313@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:07:44 2009 New Revision: 80571 URL: http://llvm.org/viewvc/llvm-project?rev=80571&view=rev Log: llvm-mc: Add MCAsmParser::getContext. Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=80571&r1=80570&r2=80571&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmParser.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Aug 31 03:07:44 2009 @@ -14,6 +14,7 @@ namespace llvm { class MCAsmLexer; +class MCContext; class MCValue; class SMLoc; class Twine; @@ -31,6 +32,8 @@ virtual MCAsmLexer &getLexer() = 0; + virtual MCContext &getContext() = 0; + /// Warning - Emit a warning at the location \arg L, with the message \arg /// Msg. virtual void Warning(SMLoc L, const Twine &Msg) = 0; Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80571&r1=80570&r2=80571&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:07:44 2009 @@ -205,7 +205,7 @@ Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = MCUnaryExpr::CreateLNot(Res, Ctx); + Res = MCUnaryExpr::CreateLNot(Res, getContext()); return false; case AsmToken::String: case AsmToken::Identifier: { @@ -213,12 +213,12 @@ // handle things like LFOO+4. MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier()); - Res = MCSymbolRefExpr::Create(Sym, Ctx); + Res = MCSymbolRefExpr::Create(Sym, getContext()); Lexer.Lex(); // Eat identifier. return false; } case AsmToken::Integer: - Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), Ctx); + Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), getContext()); Lexer.Lex(); // Eat token. return false; case AsmToken::LParen: @@ -228,19 +228,19 @@ Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = MCUnaryExpr::CreateMinus(Res, Ctx); + Res = MCUnaryExpr::CreateMinus(Res, getContext()); return false; case AsmToken::Plus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = MCUnaryExpr::CreatePlus(Res, Ctx); + Res = MCUnaryExpr::CreatePlus(Res, getContext()); return false; case AsmToken::Tilde: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; - Res = MCUnaryExpr::CreateNot(Res, Ctx); + Res = MCUnaryExpr::CreateNot(Res, getContext()); return false; } } @@ -300,7 +300,8 @@ static unsigned getBinOpPrecedence(AsmToken::TokenKind K, MCBinaryExpr::Opcode &Kind) { switch (K) { - default: return 0; // not a binop. + default: + return 0; // not a binop. // Lowest Precedence: &&, || case AsmToken::AmpAmp: @@ -397,7 +398,7 @@ } // Merge LHS and RHS according to operator. - Res = MCBinaryExpr::Create(Kind, Res, RHS, Ctx); + Res = MCBinaryExpr::Create(Kind, Res, RHS, getContext()); } } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80571&r1=80570&r2=80571&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:07:44 2009 @@ -62,6 +62,8 @@ virtual MCAsmLexer &getLexer() { return Lexer; } + virtual MCContext &getContext() { return Ctx; } + virtual void Warning(SMLoc L, const Twine &Meg); virtual bool Error(SMLoc L, const Twine &Msg); @@ -72,6 +74,8 @@ virtual bool ParseRelocatableExpression(MCValue &Res); + virtual bool ParseParenRelocatableExpression(MCValue &Res); + /// } private: @@ -94,16 +98,6 @@ bool ParseAssignment(const StringRef &Name, bool IsDotSet); - /// ParseParenRelocatableExpression - Parse an expression which must be - /// relocatable, assuming that an initial '(' has already been consumed. - /// - /// @param Res - The relocatable expression value. The result is undefined on - /// error. - /// @result - False on success. - /// - /// @see ParseRelocatableExpression, ParseParenExpr. - bool ParseParenRelocatableExpression(MCValue &Res); - bool ParsePrimaryExpr(const MCExpr *&Res); bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res); bool ParseParenExpr(const MCExpr *&Res); From daniel at zuster.org Mon Aug 31 03:07:55 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:07:55 -0000 Subject: [llvm-commits] [llvm] r80572 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp lib/MC/MCMachOStreamer.cpp Message-ID: <200908310807.n7V87t0A032349@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:07:55 2009 New Revision: 80572 URL: http://llvm.org/viewvc/llvm-project?rev=80572&view=rev Log: llvm-mc: Add MCContext to MCAssembler. Modified: llvm/trunk/include/llvm/MC/MCAssembler.h llvm/trunk/lib/MC/MCAssembler.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp Modified: llvm/trunk/include/llvm/MC/MCAssembler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=80572&r1=80571&r2=80572&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAssembler.h (original) +++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon Aug 31 03:07:55 2009 @@ -21,6 +21,7 @@ namespace llvm { class raw_ostream; class MCAssembler; +class MCContext; class MCSection; class MCSectionData; @@ -559,6 +560,8 @@ MCAssembler(const MCAssembler&); // DO NOT IMPLEMENT void operator=(const MCAssembler&); // DO NOT IMPLEMENT + MCContext &Context; + raw_ostream &OS; iplist Sections; @@ -584,9 +587,11 @@ // concrete and require clients to pass in a target like object. The other // option is to make this abstract, and have targets provide concrete // implementations as we do with AsmParser. - MCAssembler(raw_ostream &OS); + MCAssembler(MCContext &_Context, raw_ostream &OS); ~MCAssembler(); + MCContext &getContext() const { return Context; } + /// Finish - Do final processing and write the object to the output stream. void Finish(); Modified: llvm/trunk/lib/MC/MCAssembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=80572&r1=80571&r2=80572&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAssembler.cpp (original) +++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Aug 31 03:07:55 2009 @@ -940,9 +940,8 @@ /* *** */ -MCAssembler::MCAssembler(raw_ostream &_OS) - : OS(_OS), - SubsectionsViaSymbols(false) +MCAssembler::MCAssembler(MCContext &_Context, raw_ostream &_OS) + : Context(_Context), OS(_OS), SubsectionsViaSymbols(false) { } Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=80572&r1=80571&r2=80572&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Aug 31 03:07:55 2009 @@ -83,7 +83,7 @@ public: MCMachOStreamer(MCContext &Context, raw_ostream &_OS, MCCodeEmitter *_Emitter) - : MCStreamer(Context), Assembler(_OS), Emitter(_Emitter), + : MCStreamer(Context), Assembler(Context, _OS), Emitter(_Emitter), CurSectionData(0) {} ~MCMachOStreamer() {} From daniel at zuster.org Mon Aug 31 03:08:07 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:08:07 -0000 Subject: [llvm-commits] [llvm] r80573 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp lib/MC/MCMachOStreamer.cpp Message-ID: <200908310808.n7V887uX032384@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:08:06 2009 New Revision: 80573 URL: http://llvm.org/viewvc/llvm-project?rev=80573&view=rev Log: llvm-mc: Make MCSymbolData symbol member const. Modified: llvm/trunk/include/llvm/MC/MCAssembler.h llvm/trunk/lib/MC/MCAssembler.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp Modified: llvm/trunk/include/llvm/MC/MCAssembler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=80573&r1=80572&r2=80573&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAssembler.h (original) +++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon Aug 31 03:08:06 2009 @@ -437,7 +437,7 @@ // FIXME: Same concerns as with SectionData. class MCSymbolData : public ilist_node { public: - MCSymbol &Symbol; + const MCSymbol &Symbol; /// Fragment - The fragment this symbol's value is relative to, if any. MCFragment *Fragment; @@ -474,13 +474,13 @@ public: // Only for use as sentinel. MCSymbolData(); - MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, + MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, MCAssembler *A = 0); /// @name Accessors /// @{ - MCSymbol &getSymbol() const { return Symbol; } + const MCSymbol &getSymbol() const { return Symbol; } MCFragment *getFragment() const { return Fragment; } void setFragment(MCFragment *Value) { Fragment = Value; } Modified: llvm/trunk/lib/MC/MCAssembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=80573&r1=80572&r2=80573&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAssembler.cpp (original) +++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Aug 31 03:08:06 2009 @@ -331,7 +331,7 @@ void WriteNlist32(MachSymbolData &MSD) { MCSymbolData &Data = *MSD.SymbolData; - MCSymbol &Symbol = Data.getSymbol(); + const MCSymbol &Symbol = Data.getSymbol(); uint8_t Type = 0; uint16_t Flags = Data.getFlags(); uint32_t Address = 0; @@ -592,7 +592,7 @@ // files. for (MCAssembler::symbol_iterator it = Asm.symbol_begin(), ie = Asm.symbol_end(); it != ie; ++it) { - MCSymbol &Symbol = it->getSymbol(); + const MCSymbol &Symbol = it->getSymbol(); // Ignore assembler temporaries. if (it->getSymbol().isTemporary()) @@ -628,7 +628,7 @@ // Now add the data for local symbols. for (MCAssembler::symbol_iterator it = Asm.symbol_begin(), ie = Asm.symbol_end(); it != ie; ++it) { - MCSymbol &Symbol = it->getSymbol(); + const MCSymbol &Symbol = it->getSymbol(); // Ignore assembler temporaries. if (it->getSymbol().isTemporary()) @@ -926,9 +926,9 @@ /* *** */ -MCSymbolData::MCSymbolData() : Symbol(*(MCSymbol*)0) {} +MCSymbolData::MCSymbolData() : Symbol(*(const MCSymbol*)0) {} -MCSymbolData::MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment, +MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, MCAssembler *A) : Symbol(_Symbol), Fragment(_Fragment), Offset(_Offset), IsExternal(false), IsPrivateExtern(false), Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=80573&r1=80572&r2=80573&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Aug 31 03:08:06 2009 @@ -72,7 +72,7 @@ return *Entry; } - MCSymbolData &getSymbolData(MCSymbol &Symbol) { + MCSymbolData &getSymbolData(const MCSymbol &Symbol) { MCSymbolData *&Entry = SymbolMap[&Symbol]; if (!Entry) From daniel at zuster.org Mon Aug 31 03:08:17 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:08:17 -0000 Subject: [llvm-commits] [llvm] r80574 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200908310808.n7V88IS4032427@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:08:17 2009 New Revision: 80574 URL: http://llvm.org/viewvc/llvm-project?rev=80574&view=rev Log: llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr. Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=80574&r1=80573&r2=80574&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmParser.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Aug 31 03:08:17 2009 @@ -15,6 +15,7 @@ namespace llvm { class MCAsmLexer; class MCContext; +class MCExpr; class MCValue; class SMLoc; class Twine; @@ -45,6 +46,21 @@ /// clients. virtual bool Error(SMLoc L, const Twine &Msg) = 0; + /// ParseExpression - Parse an arbitrary expression. + /// + /// @param Res - The value of the expression. The result is undefined + /// on error. + /// @result - False on success. + virtual bool ParseExpression(const MCExpr *&Res) = 0; + + /// ParseParenExpression - Parse an arbitrary expression, assuming that an + /// initial '(' has already been consumed. + /// + /// @param Res - The value of the expression. The result is undefined + /// on error. + /// @result - False on success. + virtual bool ParseParenExpression(const MCExpr *&Res) = 0; + /// ParseAbsoluteExpression - Parse an expression which must evaluate to an /// absolute value. /// Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80574&r1=80573&r2=80574&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:08:17 2009 @@ -21,6 +21,7 @@ #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCValue.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetAsmParser.h" @@ -258,6 +259,13 @@ ParseBinOpRHS(1, Res); } +bool AsmParser::ParseParenExpression(const MCExpr *&Res) { + if (ParseParenExpr(Res)) + return true; + + return false; +} + bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { const MCExpr *Expr; Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80574&r1=80573&r2=80574&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:08:17 2009 @@ -70,6 +70,8 @@ virtual bool ParseExpression(const MCExpr *&Res); + virtual bool ParseParenExpression(const MCExpr *&Res); + virtual bool ParseAbsoluteExpression(int64_t &Res); virtual bool ParseRelocatableExpression(MCValue &Res); From daniel at zuster.org Mon Aug 31 03:08:38 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:08:38 -0000 Subject: [llvm-commits] [llvm] r80575 - in /llvm/trunk: include/llvm/MC/MCInst.h lib/MC/MCAsmStreamer.cpp lib/MC/MCInst.cpp lib/MC/MCMachOStreamer.cpp lib/Target/X86/AsmParser/X86AsmParser.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp lib/Target/X86/X86CodeEmitter.cpp test/MC/AsmParser/labels.s test/MC/AsmParser/x86_operands.s Message-ID: <200908310808.n7V88dlg032503@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:08:38 2009 New Revision: 80575 URL: http://llvm.org/viewvc/llvm-project?rev=80575&view=rev Log: llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue. Also, use MCInst::print instead of custom code in MCAsmPrinter. Modified: llvm/trunk/include/llvm/MC/MCInst.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCInst.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/test/MC/AsmParser/labels.s llvm/trunk/test/MC/AsmParser/x86_operands.s Modified: llvm/trunk/include/llvm/MC/MCInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInst.h?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCInst.h (original) +++ llvm/trunk/include/llvm/MC/MCInst.h Mon Aug 31 03:08:38 2009 @@ -16,13 +16,13 @@ #ifndef LLVM_MC_MCINST_H #define LLVM_MC_MCINST_H -#include "llvm/MC/MCValue.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/DebugLoc.h" namespace llvm { class raw_ostream; +class MCExpr; /// MCOperand - Instances of this class represent operands of the MCInst class. /// This is a simple discriminated union. @@ -32,14 +32,14 @@ kRegister, ///< Register operand. kImmediate, ///< Immediate operand. kMBBLabel, ///< Basic block label. - kMCValue ///< Relocatable immediate operand. + kExpr ///< Relocatable immediate operand. }; unsigned char Kind; union { unsigned RegVal; int64_t ImmVal; - MCValue MCValueVal; + const MCExpr *ExprVal; struct { unsigned FunctionNo; unsigned BlockNo; @@ -54,7 +54,7 @@ bool isReg() const { return Kind == kRegister; } bool isImm() const { return Kind == kImmediate; } bool isMBBLabel() const { return Kind == kMBBLabel; } - bool isMCValue() const { return Kind == kMCValue; } + bool isExpr() const { return Kind == kExpr; } /// getReg - Returns the register number. unsigned getReg() const { @@ -78,21 +78,21 @@ } unsigned getMBBLabelFunction() const { - assert(isMBBLabel() && "Wrong accessor"); + assert(isMBBLabel() && "This is not a machine basic block"); return MBBLabel.FunctionNo; } unsigned getMBBLabelBlock() const { - assert(isMBBLabel() && "Wrong accessor"); + assert(isMBBLabel() && "This is not a machine basic block"); return MBBLabel.BlockNo; } - const MCValue &getMCValue() const { - assert(isMCValue() && "This is not an MCValue"); - return MCValueVal; - } - void setMCValue(const MCValue &Val) { - assert(isMCValue() && "This is not an MCValue"); - MCValueVal = Val; + const MCExpr *getExpr() const { + assert(isExpr() && "This is not an expression"); + return ExprVal; + } + void setExpr(const MCExpr *Val) { + assert(isExpr() && "This is not an expression"); + ExprVal = Val; } static MCOperand CreateReg(unsigned Reg) { @@ -114,10 +114,10 @@ Op.MBBLabel.BlockNo = MBB; return Op; } - static MCOperand CreateMCValue(const MCValue &Val) { + static MCOperand CreateExpr(const MCExpr *Val) { MCOperand Op; - Op.Kind = kMCValue; - Op.MCValueVal = Val; + Op.Kind = kExpr; + Op.ExprVal = Val; return Op; } Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Aug 31 03:08:38 2009 @@ -10,13 +10,14 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/ADT/SmallString.h" #include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" -#include "llvm/MC/MCAsmInfo.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Format.h" @@ -271,18 +272,6 @@ OS << ".org " << Offset << ", " << (unsigned) Value << '\n'; } -static raw_ostream &operator<<(raw_ostream &OS, const MCOperand &Op) { - if (Op.isReg()) - return OS << "reg:" << Op.getReg(); - if (Op.isImm()) - return OS << "imm:" << Op.getImm(); - if (Op.isMBBLabel()) - return OS << "mbblabel:(" - << Op.getMBBLabelFunction() << ", " << Op.getMBBLabelBlock(); - assert(Op.isMCValue() && "Invalid operand!"); - return OS << "val:" << Op.getMCValue(); -} - void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { assert(CurSection && "Cannot emit contents before setting section!"); @@ -312,15 +301,8 @@ // Otherwise fall back to a structural printing for now. Eventually we should // always have access to the target specific printer. - OS << "MCInst(" - << "opcode=" << Inst.getOpcode() << ", " - << "operands=["; - for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) { - if (i) - OS << ", "; - OS << Inst.getOperand(i); - } - OS << "])\n"; + Inst.print(OS); + OS << '\n'; } void MCAsmStreamer::Finish() { Modified: llvm/trunk/lib/MC/MCInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCInst.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCInst.cpp (original) +++ llvm/trunk/lib/MC/MCInst.cpp Mon Aug 31 03:08:38 2009 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCInst.h" +#include "llvm/MC/MCExpr.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -23,9 +24,9 @@ else if (isMBBLabel()) OS << "MBB:(" << getMBBLabelFunction() << "," << getMBBLabelBlock() << ")"; - else if (isMCValue()) { - OS << "Value:("; - getMCValue().print(OS); + else if (isExpr()) { + OS << "Expr:("; + getExpr()->print(OS); OS << ")"; } else OS << "UNDEFINED"; Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Aug 31 03:08:38 2009 @@ -12,6 +12,7 @@ #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCCodeEmitter.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbol.h" @@ -95,6 +96,30 @@ return Value; } + const MCExpr *AddValueSymbols(const MCExpr *Value) { + switch (Value->getKind()) { + case MCExpr::Constant: + break; + + case MCExpr::Binary: { + const MCBinaryExpr *BE = cast(Value); + AddValueSymbols(BE->getLHS()); + AddValueSymbols(BE->getRHS()); + break; + } + + case MCExpr::SymbolRef: + getSymbolData(cast(Value)->getSymbol()); + break; + + case MCExpr::Unary: + AddValueSymbols(cast(Value)->getSubExpr()); + break; + } + + return Value; + } + /// @name MCStreamer Interface /// @{ @@ -330,8 +355,8 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) { // Scan for values. for (unsigned i = 0; i != Inst.getNumOperands(); ++i) - if (Inst.getOperand(i).isMCValue()) - AddValueSymbols(Inst.getOperand(i).getMCValue()); + if (Inst.getOperand(i).isExpr()) + AddValueSymbols(Inst.getOperand(i).getExpr()); if (!Emitter) llvm_unreachable("no code emitter available!"); Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Aug 31 03:08:38 2009 @@ -12,8 +12,8 @@ #include "llvm/ADT/Twine.h" #include "llvm/MC/MCAsmLexer.h" #include "llvm/MC/MCAsmParser.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" -#include "llvm/MC/MCValue.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetAsmParser.h" @@ -85,12 +85,12 @@ } Reg; struct { - MCValue Val; + const MCExpr *Val; } Imm; struct { unsigned SegReg; - MCValue Disp; + const MCExpr *Disp; unsigned BaseReg; unsigned IndexReg; unsigned Scale; @@ -107,12 +107,12 @@ return Reg.RegNo; } - const MCValue &getImm() const { + const MCExpr *getImm() const { assert(Kind == Immediate && "Invalid access!"); return Imm.Val; } - const MCValue &getMemDisp() const { + const MCExpr *getMemDisp() const { assert(Kind == Memory && "Invalid access!"); return Mem.Disp; } @@ -143,11 +143,12 @@ if (!isImm()) return false; - if (!getImm().isAbsolute()) - return true; + if (const MCConstantExpr *CE = dyn_cast(getImm())) { + int64_t Value = CE->getValue(); + return Value == (int64_t) (int8_t) Value; + } - int64_t Value = getImm().getConstant(); - return Value == (int64_t) (int8_t) Value; + return true; } bool isMem() const { return Kind == Memory; } @@ -161,13 +162,13 @@ void addImmOperands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); - Inst.addOperand(MCOperand::CreateMCValue(getImm())); + Inst.addOperand(MCOperand::CreateExpr(getImm())); } void addImmSExt8Operands(MCInst &Inst, unsigned N) const { // FIXME: Support user customization of the render method. assert(N == 1 && "Invalid number of operands!"); - Inst.addOperand(MCOperand::CreateMCValue(getImm())); + Inst.addOperand(MCOperand::CreateExpr(getImm())); } void addMemOperands(MCInst &Inst, unsigned N) const { @@ -176,7 +177,7 @@ Inst.addOperand(MCOperand::CreateReg(getMemBaseReg())); Inst.addOperand(MCOperand::CreateImm(getMemScale())); Inst.addOperand(MCOperand::CreateReg(getMemIndexReg())); - Inst.addOperand(MCOperand::CreateMCValue(getMemDisp())); + Inst.addOperand(MCOperand::CreateExpr(getMemDisp())); // FIXME: What a hack. if (N == 5) @@ -198,15 +199,16 @@ return Res; } - static X86Operand CreateImm(MCValue Val) { + static X86Operand CreateImm(const MCExpr *Val) { X86Operand Res; Res.Kind = Immediate; Res.Imm.Val = Val; return Res; } - static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, - unsigned IndexReg, unsigned Scale) { + static X86Operand CreateMem(unsigned SegReg, const MCExpr *Disp, + unsigned BaseReg, unsigned IndexReg, + unsigned Scale) { // We should never just have a displacement, that would be an immediate. assert((SegReg || BaseReg || IndexReg) && "Invalid memory operand!"); @@ -257,8 +259,8 @@ case AsmToken::Dollar: { // $42 -> immediate. getLexer().Lex(); - MCValue Val; - if (getParser().ParseRelocatableExpression(Val)) + const MCExpr *Val; + if (getParser().ParseExpression(Val)) return true; Op = X86Operand::CreateImm(Val); return false; @@ -275,9 +277,9 @@ // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)". The // only way to do this without lookahead is to eat the ( and see what is after // it. - MCValue Disp = MCValue::get(0, 0, 0); + const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext()); if (getLexer().isNot(AsmToken::LParen)) { - if (getParser().ParseRelocatableExpression(Disp)) return true; + if (getParser().ParseExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. @@ -302,7 +304,7 @@ // memory operand consumed. } else { // It must be an parenthesized expression, parse it now. - if (getParser().ParseParenRelocatableExpression(Disp)) + if (getParser().ParseParenExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 31 03:08:38 2009 @@ -28,6 +28,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Assembly/Writer.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" @@ -794,8 +795,17 @@ // Create a symbol for the name. MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name); - return MCOperand::CreateMCValue(MCValue::get(Sym, NegatedSymbol, - MO.getOffset())); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, OutContext); + if (NegatedSymbol) + Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(NegatedSymbol, + OutContext), + OutContext); + Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(), + OutContext), + OutContext); + return MCOperand::CreateExpr(Expr); } MCOperand X86ATTAsmPrinter:: @@ -807,7 +817,13 @@ } MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name); - return MCOperand::CreateMCValue(MCValue::get(Sym, 0, MO.getOffset())); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + const MCExpr *Expr = + MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, OutContext), + MCConstantExpr::Create(MO.getOffset(),OutContext), + OutContext); + return MCOperand::CreateExpr(Expr); } @@ -848,7 +864,10 @@ // Emit the call. MCSymbol *PICBase = GetPICBaseSymbol(); TmpInst.setOpcode(X86::CALLpcrel32); - TmpInst.addOperand(MCOperand::CreateMCValue(MCValue::get(PICBase))); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + TmpInst.addOperand(MCOperand::CreateExpr(MCSymbolRefExpr::Create(PICBase, + OutContext))); printInstruction(&TmpInst); // Emit the label. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Mon Aug 31 03:08:38 2009 @@ -16,6 +16,7 @@ #include "llvm/MC/MCInst.h" #include "X86ATTAsmPrinter.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCExpr.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; @@ -55,8 +56,8 @@ if (Op.isImm()) O << Op.getImm(); - else if (Op.isMCValue()) - Op.getMCValue().print(O); + else if (Op.isExpr()) + Op.getExpr()->print(O); else if (Op.isMBBLabel()) // FIXME: Keep in sync with printBasicBlockLabel. printBasicBlockLabel // should eventually call into this code, not the other way around. @@ -90,9 +91,9 @@ O << '$'; O << Op.getImm(); return; - } else if (Op.isMCValue()) { + } else if (Op.isExpr()) { O << '$'; - Op.getMCValue().print(O); + Op.getExpr()->print(O); return; } @@ -109,8 +110,8 @@ int64_t DispVal = DispSpec.getImm(); if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg())) O << DispVal; - } else if (DispSpec.isMCValue()) { - DispSpec.getMCValue().print(O); + } else if (DispSpec.isExpr()) { + DispSpec.getExpr()->print(O); } else { llvm_unreachable("non-immediate displacement for LEA?"); //assert(DispSpec.isGlobal() || DispSpec.isCPI() || Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Mon Aug 31 03:08:38 2009 @@ -30,6 +30,7 @@ #include "llvm/Function.h" #include "llvm/ADT/Statistic.h" #include "llvm/MC/MCCodeEmitter.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" @@ -968,12 +969,12 @@ Instr->addOperand(MachineOperand::CreateImm(Op.getImm())); return true; } - if (!Op.isMCValue()) + if (!Op.isExpr()) return false; - const MCValue &Val = Op.getMCValue(); - if (Val.isAbsolute()) { - Instr->addOperand(MachineOperand::CreateImm(Val.getConstant())); + const MCExpr *Expr = Op.getExpr(); + if (const MCConstantExpr *CE = dyn_cast(Expr)) { + Instr->addOperand(MachineOperand::CreateImm(CE->getValue())); return true; } @@ -1036,9 +1037,8 @@ if (CurOp < NumOps) { // Hack to make branches work. if (!(Desc.TSFlags & X86II::ImmMask) && - MI.getOperand(0).isMCValue() && - MI.getOperand(0).getMCValue().getSymA() && - !MI.getOperand(0).getMCValue().getSymB()) + MI.getOperand(0).isExpr() && + isa(MI.getOperand(0).getExpr())) Instr->addOperand(MachineOperand::CreateMBB(DummyMBB)); else OK &= AddImmToInstr(MI, Instr, CurOp); Modified: llvm/trunk/test/MC/AsmParser/labels.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/labels.s?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/labels.s (original) +++ llvm/trunk/test/MC/AsmParser/labels.s Mon Aug 31 03:08:38 2009 @@ -15,12 +15,12 @@ foo: // CHECK: addl $24, "a$b"(%eax) addl $24, "a$b"(%eax) -// CHECK: addl $24, "a$b" + 10(%eax) +// CHECK: addl $24, ("a$b" + 10)(%eax) addl $24, ("a$b" + 10)(%eax) // CHECK: "b$c" = 10 "b$c" = 10 -// CHECK: addl $10, %eax +// CHECK: addl $"b$c", %eax addl "b$c", %eax // CHECK: set "a 0", 11 Modified: llvm/trunk/test/MC/AsmParser/x86_operands.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/x86_operands.s?rev=80575&r1=80574&r2=80575&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/x86_operands.s (original) +++ llvm/trunk/test/MC/AsmParser/x86_operands.s Mon Aug 31 03:08:38 2009 @@ -5,11 +5,11 @@ # Immediates # CHECK: addl $1, %eax addl $1, %eax -# CHECK: addl $3, %eax +# CHECK: addl $(1 + 2), %eax addl $(1+2), %eax # CHECK: addl $a, %eax addl $a, %eax -# CHECK: addl $3, %eax +# CHECK: addl $(1 + 2), %eax addl $1 + 2, %eax # Disambiguation @@ -18,15 +18,15 @@ #addl $1, 4+4 # FIXME: Add back when we can match this. #addl $1, (4+4) -# CHECK: addl $1, 8(%eax) +# CHECK: addl $1, (4 + 4)(%eax) addl $1, 4+4(%eax) -# CHECK: addl $1, 8(%eax) +# CHECK: addl $1, (4 + 4)(%eax) addl $1, (4+4)(%eax) # CHECK: addl $1, 8(%eax) addl $1, 8(%eax) # CHECK: addl $1, 0(%eax) addl $1, (%eax) -# CHECK: addl $1, 8(,%eax) +# CHECK: addl $1, (4 + 4)(,%eax) addl $1, (4+4)(,%eax) # Indirect Memory Operands From daniel at zuster.org Mon Aug 31 03:08:50 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:08:50 -0000 Subject: [llvm-commits] [llvm] r80576 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200908310808.n7V88ob1032539@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:08:50 2009 New Revision: 80576 URL: http://llvm.org/viewvc/llvm-project?rev=80576&view=rev Log: llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression. Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=80576&r1=80575&r2=80576&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmParser.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Aug 31 03:08:50 2009 @@ -68,24 +68,6 @@ /// on error. /// @result - False on success. virtual bool ParseAbsoluteExpression(int64_t &Res) = 0; - - /// ParseRelocatableExpression - Parse an expression which must be - /// relocatable. - /// - /// @param Res - The relocatable expression value. The result is undefined on - /// error. - /// @result - False on success. - virtual bool ParseRelocatableExpression(MCValue &Res) = 0; - - /// ParseParenRelocatableExpression - Parse an expression which must be - /// relocatable, assuming that an initial '(' has already been consumed. - /// - /// @param Res - The relocatable expression value. The result is undefined on - /// error. - /// @result - False on success. - /// - /// @see ParseRelocatableExpression, ParseParenExpr. - virtual bool ParseParenRelocatableExpression(MCValue &Res) = 0; }; } // End llvm namespace Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80576&r1=80575&r2=80576&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:08:50 2009 @@ -279,32 +279,6 @@ return false; } -bool AsmParser::ParseRelocatableExpression(MCValue &Res) { - const MCExpr *Expr; - - SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) - return true; - - if (!Expr->EvaluateAsRelocatable(Ctx, Res)) - return Error(StartLoc, "expected relocatable expression"); - - return false; -} - -bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) { - const MCExpr *Expr; - - SMLoc StartLoc = Lexer.getLoc(); - if (ParseParenExpr(Expr)) - return true; - - if (!Expr->EvaluateAsRelocatable(Ctx, Res)) - return Error(StartLoc, "expected relocatable expression"); - - return false; -} - static unsigned getBinOpPrecedence(AsmToken::TokenKind K, MCBinaryExpr::Opcode &Kind) { switch (K) { @@ -739,9 +713,14 @@ SMLoc EqualLoc = Lexer.getLoc(); MCValue Value; - if (ParseRelocatableExpression(Value)) + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; + if (!Expr->EvaluateAsRelocatable(Ctx, Value)) + return Error(StartLoc, "expected relocatable expression"); + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in assignment"); @@ -958,11 +937,16 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) { if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - MCValue Expr; - if (ParseRelocatableExpression(Expr)) + MCValue Value; + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; - Out.EmitValue(Expr, Size); + if (!Expr->EvaluateAsRelocatable(Ctx, Value)) + return Error(StartLoc, "expected relocatable expression"); + + Out.EmitValue(Value, Size); if (Lexer.is(AsmToken::EndOfStatement)) break; @@ -1054,9 +1038,14 @@ /// ::= .org expression [ , expression ] bool AsmParser::ParseDirectiveOrg() { MCValue Offset; - if (ParseRelocatableExpression(Offset)) + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; + if (!Expr->EvaluateAsRelocatable(Ctx, Offset)) + return Error(StartLoc, "expected relocatable expression"); + // Parse optional fill expression. int64_t FillExpr = 0; if (Lexer.isNot(AsmToken::EndOfStatement)) { @@ -1428,10 +1417,15 @@ return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); - MCValue Expr; - if (ParseRelocatableExpression(Expr)) + MCValue Value; + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; + if (!Expr->EvaluateAsRelocatable(Ctx, Value)) + return Error(StartLoc, "expected relocatable expression"); + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.lsym' directive"); Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80576&r1=80575&r2=80576&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:08:50 2009 @@ -74,10 +74,6 @@ virtual bool ParseAbsoluteExpression(int64_t &Res); - virtual bool ParseRelocatableExpression(MCValue &Res); - - virtual bool ParseParenRelocatableExpression(MCValue &Res); - /// } private: From daniel at zuster.org Mon Aug 31 03:09:09 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:09:09 -0000 Subject: [llvm-commits] [llvm] r80577 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp lib/MC/MCMachOStreamer.cpp lib/MC/MCNullStreamer.cpp test/MC/AsmParser/directive_include.s test/MC/AsmParser/directive_set.s test/MC/AsmParser/labels.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200908310809.n7V89AZv032597@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:09:09 2009 New Revision: 80577 URL: http://llvm.org/viewvc/llvm-project?rev=80577&view=rev Log: llvm-mc: Simplify EmitAssignment ('.set' is identical to '='). Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/MC/MCNullStreamer.cpp llvm/trunk/test/MC/AsmParser/directive_include.s llvm/trunk/test/MC/AsmParser/directive_set.s llvm/trunk/test/MC/AsmParser/labels.s llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Aug 31 03:09:09 2009 @@ -116,11 +116,7 @@ /// /// @param Symbol - The symbol being assigned to. /// @param Value - The value for the symbol. - /// @param MakeAbsolute - If true, then the symbol should be given the - /// absolute value of @param Value, even if @param Value would be - /// relocatable expression. This corresponds to the ".set" directive. - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false) = 0; + virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value) = 0; /// EmitSymbolAttribute - Add the given @param Attribute to @param Symbol. virtual void EmitSymbolAttribute(MCSymbol *Symbol, Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Aug 31 03:09:09 2009 @@ -47,8 +47,7 @@ virtual void EmitAssemblerFlag(AssemblerFlag Flag); - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false); + virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value); virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); @@ -126,26 +125,12 @@ OS << '\n'; } -void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute) { +void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value) { // Only absolute symbols can be redefined. assert((Symbol->isUndefined() || Symbol->isAbsolute()) && "Cannot define a symbol twice!"); - if (MakeAbsolute) { - OS << ".set " << Symbol << ", " << Value << '\n'; - - // HACK: If the value isn't already absolute, set the symbol value to - // itself, we want to use the .set absolute value, not the actual - // expression. - if (!Value.isAbsolute()) - getContext().SetSymbolValue(Symbol, MCValue::get(Symbol)); - else - getContext().SetSymbolValue(Symbol, Value); - } else { - OS << Symbol << " = " << Value << '\n'; - getContext().SetSymbolValue(Symbol, Value); - } + OS << Symbol << " = " << Value << '\n'; } void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Aug 31 03:09:09 2009 @@ -129,8 +129,7 @@ virtual void EmitAssemblerFlag(AssemblerFlag Flag); - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false); + virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value); virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); @@ -201,9 +200,7 @@ assert(0 && "invalid assembler flag!"); } -void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, - const MCValue &Value, - bool MakeAbsolute) { +void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value) { // Only absolute symbols can be redefined. assert((Symbol->isUndefined() || Symbol->isAbsolute()) && "Cannot define a symbol twice!"); Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Mon Aug 31 03:09:09 2009 @@ -34,8 +34,7 @@ virtual void EmitAssemblerFlag(AssemblerFlag Flag) {} - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false) {} + virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value) {} virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) {} Modified: llvm/trunk/test/MC/AsmParser/directive_include.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_include.s?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_include.s (original) +++ llvm/trunk/test/MC/AsmParser/directive_include.s Mon Aug 31 03:09:09 2009 @@ -2,7 +2,7 @@ # CHECK: TESTA: # CHECK: TEST0: -# CHECK: .set a, 0 +# CHECK: a = 0 # CHECK: TESTB: TESTA: .include "directive_set.s" Modified: llvm/trunk/test/MC/AsmParser/directive_set.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_set.s?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_set.s (original) +++ llvm/trunk/test/MC/AsmParser/directive_set.s Mon Aug 31 03:09:09 2009 @@ -1,7 +1,7 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s # CHECK: TEST0: -# CHECK: .set a, 0 +# CHECK: a = 0 TEST0: .set a, 0 Modified: llvm/trunk/test/MC/AsmParser/labels.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/labels.s?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/labels.s (original) +++ llvm/trunk/test/MC/AsmParser/labels.s Mon Aug 31 03:09:09 2009 @@ -23,10 +23,10 @@ // CHECK: addl $"b$c", %eax addl "b$c", %eax -// CHECK: set "a 0", 11 +// CHECK: "a 0" = 11 .set "a 0", 11 -// CHECK: .long 11 +// CHECK: .long "a 0" .long "a 0" // XXCHCK: .section "a 1,a 2" @@ -44,7 +44,7 @@ // CHECK: .comm "a 6",1 .comm "a 6", 1 -// CHECK: .zerofill __DATA,__bss,"a 7",1 +// CHECK: .zerofill __DATA,__bss,"a 7",1,0 .lcomm "a 7", 1 // FIXME: We don't bother to support .lsym. @@ -52,7 +52,7 @@ // CHECX: .lsym "a 8",1 // .lsym "a 8", 1 -// CHECK: set "a 9", a - b +// CHECK: "a 9" = a - b .set "a 9", a - b // CHECK: .long "a 9" Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:09:09 2009 @@ -431,7 +431,7 @@ // identifier '=' ... -> assignment statement Lexer.Lex(); - return ParseAssignment(IDVal, false); + return ParseAssignment(IDVal); default: // Normal instruction or directive. break; @@ -708,7 +708,7 @@ return false; } -bool AsmParser::ParseAssignment(const StringRef &Name, bool IsDotSet) { +bool AsmParser::ParseAssignment(const StringRef &Name) { // FIXME: Use better location, we should use proper tokens. SMLoc EqualLoc = Lexer.getLoc(); @@ -737,7 +737,7 @@ return Error(EqualLoc, "symbol has already been defined"); // Do the assignment. - Out.EmitAssignment(Sym, Value, IsDotSet); + Out.EmitAssignment(Sym, Value); return false; } @@ -769,7 +769,7 @@ return TokError("unexpected token in '.set'"); Lexer.Lex(); - return ParseAssignment(Name, true); + return ParseAssignment(Name); } /// ParseDirectiveSection: Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80577&r1=80576&r2=80577&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:09:09 2009 @@ -94,7 +94,7 @@ SMLoc DirectiveLoc); void EatToEndOfStatement(); - bool ParseAssignment(const StringRef &Name, bool IsDotSet); + bool ParseAssignment(const StringRef &Name); bool ParsePrimaryExpr(const MCExpr *&Res); bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res); From daniel at zuster.org Mon Aug 31 03:09:29 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 08:09:29 -0000 Subject: [llvm-commits] [llvm] r80578 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp lib/MC/MCMachOStreamer.cpp lib/MC/MCNullStreamer.cpp test/MC/AsmParser/conditional_asm.s test/MC/AsmParser/exprs-invalid.s test/MC/AsmParser/labels.s tools/llvm-mc/AsmParser.cpp Message-ID: <200908310809.n7V89TKi032680@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 03:09:28 2009 New Revision: 80578 URL: http://llvm.org/viewvc/llvm-project?rev=80578&view=rev Log: llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/MC/MCNullStreamer.cpp llvm/trunk/test/MC/AsmParser/conditional_asm.s llvm/trunk/test/MC/AsmParser/exprs-invalid.s llvm/trunk/test/MC/AsmParser/labels.s llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Aug 31 03:09:28 2009 @@ -21,10 +21,10 @@ class MCAsmInfo; class MCCodeEmitter; class MCContext; + class MCExpr; class MCInst; class MCSection; class MCSymbol; - class MCValue; class StringRef; class raw_ostream; @@ -116,7 +116,7 @@ /// /// @param Symbol - The symbol being assigned to. /// @param Value - The value for the symbol. - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value) = 0; + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0; /// EmitSymbolAttribute - Add the given @param Attribute to @param Symbol. virtual void EmitSymbolAttribute(MCSymbol *Symbol, @@ -166,7 +166,7 @@ /// @param Value - The value to emit. /// @param Size - The size of the integer (in bytes) to emit. This must /// match a native machine width. - virtual void EmitValue(const MCValue &Value, unsigned Size) = 0; + virtual void EmitValue(const MCExpr *Value, unsigned Size) = 0; /// EmitValueToAlignment - Emit some number of copies of @param Value until /// the byte alignment @param ByteAlignment is reached. @@ -197,7 +197,7 @@ /// @param Offset - The offset to reach. This may be an expression, but the /// expression must be associated with the current section. /// @param Value - The value to use when filling bytes. - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0) = 0; /// @} Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Aug 31 03:09:28 2009 @@ -17,7 +17,6 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Format.h" @@ -47,7 +46,7 @@ virtual void EmitAssemblerFlag(AssemblerFlag Flag); - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value); + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); @@ -61,13 +60,13 @@ virtual void EmitBytes(const StringRef &Data); - virtual void EmitValue(const MCValue &Value, unsigned Size); + virtual void EmitValue(const MCExpr *Value, unsigned Size); virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0); - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0); virtual void EmitInstruction(const MCInst &Inst); @@ -86,7 +85,7 @@ } /// Allow printing values directly to a raw_ostream. -static inline raw_ostream &operator<<(raw_ostream &os, const MCValue &Value) { +static inline raw_ostream &operator<<(raw_ostream &os, const MCExpr &Value) { Value.print(os); return os; } @@ -96,9 +95,10 @@ return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8)); } -static inline MCValue truncateToSize(const MCValue &Value, unsigned Bytes) { - return MCValue::get(Value.getSymA(), Value.getSymB(), - truncateToSize(Value.getConstant(), Bytes)); +static inline const MCExpr *truncateToSize(const MCExpr *Value, + unsigned Bytes) { + // FIXME: Do we really need this routine? + return Value; } void MCAsmStreamer::SwitchSection(const MCSection *Section) { @@ -125,12 +125,12 @@ OS << '\n'; } -void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value) { +void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { // Only absolute symbols can be redefined. assert((Symbol->isUndefined() || Symbol->isAbsolute()) && "Cannot define a symbol twice!"); - OS << Symbol << " = " << Value << '\n'; + OS << Symbol << " = " << *Value << '\n'; } void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, @@ -189,7 +189,7 @@ OS << ".byte " << (unsigned) (unsigned char) Data[i] << '\n'; } -void MCAsmStreamer::EmitValue(const MCValue &Value, unsigned Size) { +void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size) { assert(CurSection && "Cannot emit contents before setting section!"); // Need target hooks to know how to print this. switch (Size) { @@ -201,7 +201,7 @@ case 8: OS << ".quad"; break; } - OS << ' ' << truncateToSize(Value, Size) << '\n'; + OS << ' ' << *truncateToSize(Value, Size) << '\n'; } void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, @@ -251,10 +251,10 @@ OS << '\n'; } -void MCAsmStreamer::EmitValueToOffset(const MCValue &Offset, +void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { // FIXME: Verify that Offset is associated with the current section. - OS << ".org " << Offset << ", " << (unsigned) Value << '\n'; + OS << ".org " << *Offset << ", " << (unsigned) Value << '\n'; } void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Aug 31 03:09:28 2009 @@ -16,6 +16,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCValue.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -88,14 +89,6 @@ CurSectionData(0) {} ~MCMachOStreamer() {} - const MCValue &AddValueSymbols(const MCValue &Value) { - if (Value.getSymA()) - getSymbolData(*const_cast(Value.getSymA())); - if (Value.getSymB()) - getSymbolData(*const_cast(Value.getSymB())); - return Value; - } - const MCExpr *AddValueSymbols(const MCExpr *Value) { switch (Value->getKind()) { case MCExpr::Constant: @@ -129,7 +122,7 @@ virtual void EmitAssemblerFlag(AssemblerFlag Flag); - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value); + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); @@ -143,13 +136,13 @@ virtual void EmitBytes(const StringRef &Data); - virtual void EmitValue(const MCValue &Value, unsigned Size); + virtual void EmitValue(const MCExpr *Value, unsigned Size); virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0); - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0); virtual void EmitInstruction(const MCInst &Inst); @@ -200,7 +193,7 @@ assert(0 && "invalid assembler flag!"); } -void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value) { +void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { // Only absolute symbols can be redefined. assert((Symbol->isUndefined() || Symbol->isAbsolute()) && "Cannot define a symbol twice!"); @@ -327,8 +320,13 @@ DF->getContents().append(Data.begin(), Data.end()); } -void MCMachOStreamer::EmitValue(const MCValue &Value, unsigned Size) { - new MCFillFragment(AddValueSymbols(Value), Size, 1, CurSectionData); +void MCMachOStreamer::EmitValue(const MCExpr *Value, unsigned Size) { + MCValue RelocValue; + + if (!AddValueSymbols(Value)->EvaluateAsRelocatable(getContext(), RelocValue)) + return llvm_report_error("expected relocatable expression"); + + new MCFillFragment(RelocValue, Size, 1, CurSectionData); } void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment, @@ -344,9 +342,15 @@ CurSectionData->setAlignment(ByteAlignment); } -void MCMachOStreamer::EmitValueToOffset(const MCValue &Offset, +void MCMachOStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { - new MCOrgFragment(AddValueSymbols(Offset), Value, CurSectionData); + MCValue RelocOffset; + + if (!AddValueSymbols(Offset)->EvaluateAsRelocatable(getContext(), + RelocOffset)) + return llvm_report_error("expected relocatable expression"); + + new MCOrgFragment(RelocOffset, Value, CurSectionData); } void MCMachOStreamer::EmitInstruction(const MCInst &Inst) { Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Mon Aug 31 03:09:28 2009 @@ -13,7 +13,6 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" using namespace llvm; @@ -34,7 +33,7 @@ virtual void EmitAssemblerFlag(AssemblerFlag Flag) {} - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value) {} + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {} virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) {} @@ -48,13 +47,13 @@ virtual void EmitBytes(const StringRef &Data) {} - virtual void EmitValue(const MCValue &Value, unsigned Size) {} + virtual void EmitValue(const MCExpr *Value, unsigned Size) {} virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0) {} - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0) {} virtual void EmitInstruction(const MCInst &Inst) {} Modified: llvm/trunk/test/MC/AsmParser/conditional_asm.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/conditional_asm.s?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/conditional_asm.s (original) +++ llvm/trunk/test/MC/AsmParser/conditional_asm.s Mon Aug 31 03:09:28 2009 @@ -1,6 +1,6 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s -I %p | FileCheck %s -# CHECK: .byte 2 +# CHECK: .byte (1 + 1) .if 1+2 .if 1-1 .byte 1 Modified: llvm/trunk/test/MC/AsmParser/exprs-invalid.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs-invalid.s?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs-invalid.s (original) +++ llvm/trunk/test/MC/AsmParser/exprs-invalid.s Mon Aug 31 03:09:28 2009 @@ -1,6 +1,11 @@ // RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t // RUN: FileCheck -input-file %t %s +// Currently XFAIL'ed, since the front-end isn't validating this. Figure out the +// right resolution. +// +// XFAIL: * + .text a: .data Modified: llvm/trunk/test/MC/AsmParser/labels.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/labels.s?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/labels.s (original) +++ llvm/trunk/test/MC/AsmParser/labels.s Mon Aug 31 03:09:28 2009 @@ -52,7 +52,7 @@ // CHECX: .lsym "a 8",1 // .lsym "a 8", 1 -// CHECK: "a 9" = a - b +// CHECK: "a 9" = (a - b) .set "a 9", a - b // CHECK: .long "a 9" Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80578&r1=80577&r2=80578&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:09:28 2009 @@ -21,7 +21,6 @@ #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetAsmParser.h" @@ -712,15 +711,11 @@ // FIXME: Use better location, we should use proper tokens. SMLoc EqualLoc = Lexer.getLoc(); - MCValue Value; - const MCExpr *Expr; + const MCExpr *Value; SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) + if (ParseExpression(Value)) return true; - if (!Expr->EvaluateAsRelocatable(Ctx, Value)) - return Error(StartLoc, "expected relocatable expression"); - if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in assignment"); @@ -937,15 +932,11 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) { if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - MCValue Value; - const MCExpr *Expr; + const MCExpr *Value; SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) + if (ParseExpression(Value)) return true; - if (!Expr->EvaluateAsRelocatable(Ctx, Value)) - return Error(StartLoc, "expected relocatable expression"); - Out.EmitValue(Value, Size); if (Lexer.is(AsmToken::EndOfStatement)) @@ -992,7 +983,7 @@ // FIXME: Sometimes the fill expr is 'nop' if it isn't supplied, instead of 0. for (uint64_t i = 0, e = NumBytes; i != e; ++i) - Out.EmitValue(MCValue::get(FillExpr), 1); + Out.EmitValue(MCConstantExpr::Create(FillExpr, getContext()), 1); return false; } @@ -1029,7 +1020,7 @@ return TokError("invalid '.fill' size, expected 1, 2, 4, or 8"); for (uint64_t i = 0, e = NumValues; i != e; ++i) - Out.EmitValue(MCValue::get(FillExpr), FillSize); + Out.EmitValue(MCConstantExpr::Create(FillExpr, getContext()), FillSize); return false; } @@ -1037,15 +1028,11 @@ /// ParseDirectiveOrg /// ::= .org expression [ , expression ] bool AsmParser::ParseDirectiveOrg() { - MCValue Offset; - const MCExpr *Expr; + const MCExpr *Offset; SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) + if (ParseExpression(Offset)) return true; - if (!Expr->EvaluateAsRelocatable(Ctx, Offset)) - return Error(StartLoc, "expected relocatable expression"); - // Parse optional fill expression. int64_t FillExpr = 0; if (Lexer.isNot(AsmToken::EndOfStatement)) { @@ -1417,15 +1404,11 @@ return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); - MCValue Value; - const MCExpr *Expr; + const MCExpr *Value; SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) + if (ParseExpression(Value)) return true; - if (!Expr->EvaluateAsRelocatable(Ctx, Value)) - return Error(StartLoc, "expected relocatable expression"); - if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.lsym' directive"); From baldrick at free.fr Mon Aug 31 03:31:34 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 10:31:34 +0200 Subject: [llvm-commits] [llvm] r80566 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <200908310723.n7V7NlfF013906@zion.cs.uiuc.edu> References: <200908310723.n7V7NlfF013906@zion.cs.uiuc.edu> Message-ID: <4A9B8A66.6000105@free.fr> Hi Chris, this seems like a reasonable approach. > + // The the function pass(es) modified the IR, they may have clobbered the The the -> The > + MadeChange = MadeChange; Doesn't seem very useful :) > + // Scan all functions in the SCC. Can a function pass muck with CurSCC? > + if (F == 0 || F->isDeclaration()) continue; What about functions with weak linkage? Also, I think this routine should live in the same file as the other callgraph computing routines. Perhaps it can be merged somehow with the existing CG calculation. (That way, if someone modifies the interaction between, say, weak linkage and how the callgraph is calculated, this won't be forgotten). > + if (!CallGraphUpToDate) > + RefreshCallGraph(CurSCC, CG); Don't you need to set CallGraphUpToDate to "true" here? Ciao, Duncan. From evan.cheng at apple.com Mon Aug 31 03:31:55 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 31 Aug 2009 01:31:55 -0700 Subject: [llvm-commits] [llvm] r80530 - in /llvm/trunk/lib/CodeGen: AsmPrinter/DwarfException.cpp SjLjEHPrepare.cpp In-Reply-To: <200908310135.n7V1Z4Qd002984@zion.cs.uiuc.edu> References: <200908310135.n7V1Z4Qd002984@zion.cs.uiuc.edu> Message-ID: <850CD172-4067-4CDC-87BF-A6732596873D@apple.com> Test case? Evan On Aug 30, 2009, at 6:35 PM, Jim Grosbach wrote: > Author: grosbach > Date: Sun Aug 30 20:35:03 2009 > New Revision: 80530 > > URL: http://llvm.org/viewvc/llvm-project?rev=80530&view=rev > Log: > PR4747 > > Shared landing pads run into trouble with SJLJ, as the dispatch > table is > mapped to call sites, and merging the pads will throw that off. > There needs > to be a one-to-one mapping of landing pad exception table entries to > invoke > call points. > > Detecting the shared pad during lowering of SJLJ info insn't > sufficient, as > the dispatch function may still need separate destinations to properly > handle phi-nodes. > > Modified: > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp > llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80530&r1=80529&r2=80530&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Sun Aug 30 > 20:35:03 2009 > @@ -468,8 +468,9 @@ > FirstActions[P.PadIndex] > }; > > - // Try to merge with the previous call-site. > - if (PreviousIsInvoke) { > + // Try to merge with the previous call-site. SJLJ doesn't > do this > + if (PreviousIsInvoke && > + MAI->getExceptionHandlingType() == > ExceptionHandling::Dwarf) { > CallSiteEntry &Prev = CallSites.back(); > if (Site.PadLabel == Prev.PadLabel && Site.Action == > Prev.Action) { > // Extend the range of the previous entry. > > Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=80530&r1=80529&r2=80530&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original) > +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Sun Aug 30 20:35:03 2009 > @@ -24,7 +24,6 @@ > #include "llvm/CodeGen/Passes.h" > #include "llvm/Transforms/Utils/BasicBlockUtils.h" > #include "llvm/Transforms/Utils/Local.h" > -#include "llvm/ADT/DenseMap.h" > #include "llvm/ADT/Statistic.h" > #include "llvm/ADT/SmallVector.h" > #include "llvm/Support/CommandLine.h" > @@ -70,7 +69,8 @@ > > private: > void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, > - Value *CallSite); > + Value *CallSite, > + SwitchInst *CatchSwitch); > void splitLiveRangesLiveAcrossInvokes(SmallVector 16> &Invokes); > bool insertSjLjEHSupport(Function &F); > }; > @@ -126,9 +126,14 @@ > > /// markInvokeCallSite - Insert code to mark the call_site for this > invoke > void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, > - Value *CallSite) { > + Value *CallSite, > + SwitchInst *CatchSwitch) { > ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II- > >getContext()), > InvokeNo); > + // The runtime comes back to the dispatcher with the call_site - > 1 in > + // the context. Odd, but there it is. > + ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II- > >getContext()), > + InvokeNo - 1); > > // If the unwind edge has phi nodes, split the edge. > if (isa(II->getUnwindDest()->begin())) { > @@ -145,6 +150,8 @@ > // location afterward. > new StoreInst(CallSiteNoC, CallSite, true, II); // volatile > > + // Add a switch case to our unwind block. > + CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); > // We still want this to look like an invoke so we emit the LSDA > properly > // FIXME: ??? Or will this cause strangeness with mis-matched IDs > like > // when it was in the front end? > @@ -311,6 +318,13 @@ > if (!Invokes.empty()) { > // We have invokes, so we need to add register/unregister calls > to get > // this function onto the global unwind stack. > + // > + // First thing we need to do is scan the whole function for > values that are > + // live across unwind edges. Each value that is live across an > unwind edge > + // we spill into a stack location, guaranteeing that there is > nothing live > + // across the unwind edge. This process also splits all > critical edges > + // coming out of invoke's. > + splitLiveRangesLiveAcrossInvokes(Invokes); > > BasicBlock *EntryBB = F.begin(); > // Create an alloca for the incoming jump buffer ptr and the new > jump buffer > @@ -462,32 +476,11 @@ > ContBlock->getTerminator()); > Register->setDoesNotThrow(); > > - // At this point, we are all set up. Update the invoke > instructions > + // At this point, we are all set up, update the invoke > instructions > // to mark their call_site values, and fill in the dispatch switch > // accordingly. > - DenseMap PadSites; > - unsigned NextCallSiteValue = 1; > - for (SmallVector::iterator I = Invokes.begin(), > - E = Invokes.end(); I < E; ++I) { > - unsigned CallSiteValue; > - BasicBlock *LandingPad = (*I)->getSuccessor(1); > - // landing pads can be shared. If we see a landing pad again, > we > - // want to make sure to use the same call site index so the > dispatch > - // will go to the right place. > - CallSiteValue = PadSites[LandingPad]; > - if (!CallSiteValue) { > - CallSiteValue = NextCallSiteValue++; > - PadSites[LandingPad] = CallSiteValue; > - // Add a switch case to our unwind block. The runtime comes > back > - // to the dispatcher with the call_site - 1 in the context. > Odd, > - // but there it is. > - ConstantInt *SwitchValC = > - ConstantInt::get(Type::getInt32Ty((*I)->getContext()), > - CallSiteValue - 1); > - DispatchSwitch->addCase(SwitchValC, (*I)->getUnwindDest()); > - } > - markInvokeCallSite(*I, CallSiteValue, CallSite); > - } > + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) > + markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch); > > // The front end has likely added calls to _Unwind_Resume. We need > // to find those calls and mark the call_site as -1 immediately > prior. > @@ -515,13 +508,6 @@ > Unwinds[i]->eraseFromParent(); > } > > - // Scan the whole function for values that are live across > unwind edges. > - // Each value that is live across an unwind edge we spill into > a stack > - // location, guaranteeing that there is nothing live across the > unwind > - // edge. This process also splits all critical edges coming > out of > - // invoke's. > - splitLiveRangesLiveAcrossInvokes(Invokes); > - > // Finally, for any returns from this function, if this function > contains an > // invoke, add a call to unregister the function context. > for (unsigned i = 0, e = Returns.size(); i != e; ++i) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Mon Aug 31 03:38:53 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 08:38:53 -0000 Subject: [llvm-commits] [gcc-plugin] r80579 - /gcc-plugin/trunk/llvm-backend.cpp Message-ID: <200908310838.n7V8crCG003918@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 03:38:53 2009 New Revision: 80579 URL: http://llvm.org/viewvc/llvm-project?rev=80579&view=rev Log: Add an explanation of why we do not initialize the module here. Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=80579&r1=80578&r2=80579&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Mon Aug 31 03:38:53 2009 @@ -1786,6 +1786,8 @@ /// llvm_start_unit - Perform late initialization. This is called by GCC just /// before processing the compilation unit. +/// NOTE: called even when only doing syntax checking, so do not initialize the +/// module etc here. static void llvm_start_unit(void *gcc_data, void *user_data) { if (!quiet_flag) errs() << "Starting compilation unit\n"; From baldrick at free.fr Mon Aug 31 03:57:39 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 08:57:39 -0000 Subject: [llvm-commits] [gcc-plugin] r80581 - /gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Message-ID: <200908310857.n7V8veWP006491@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 03:57:39 2009 New Revision: 80581 URL: http://llvm.org/viewvc/llvm-project?rev=80581&view=rev Log: Also expose the release_stmt_tree method. Modified: gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Modified: gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff?rev=80581&r1=80580&r2=80581&view=diff ============================================================================== --- gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff (original) +++ gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Mon Aug 31 03:57:39 2009 @@ -1,7 +1,7 @@ -Index: gcc.fsf.master/gcc/cfgexpand.c +Index: lto/gcc/cfgexpand.c =================================================================== ---- gcc.fsf.master.orig/gcc/cfgexpand.c 2009-08-20 14:04:30.060847582 +0200 -+++ gcc.fsf.master/gcc/cfgexpand.c 2009-08-20 14:04:36.327849397 +0200 +--- lto.orig/gcc/cfgexpand.c 2009-08-31 10:39:47.371256259 +0200 ++++ lto/gcc/cfgexpand.c 2009-08-31 10:49:52.283196375 +0200 @@ -124,7 +124,7 @@ GIMPLE tuple STMT and returns the same statement in the form of a tree. */ @@ -11,3 +11,12 @@ gimple_to_tree (gimple stmt) { tree t; +@@ -363,7 +363,7 @@ + + /* Release back to GC memory allocated by gimple_to_tree. */ + +-static void ++void + release_stmt_tree (gimple stmt, tree stmt_tree) + { + tree_ann_common_t ann; From baldrick at free.fr Mon Aug 31 03:59:33 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 08:59:33 -0000 Subject: [llvm-commits] [gcc-plugin] r80582 - /gcc-plugin/trunk/gcc-patches/i386_static.diff Message-ID: <200908310859.n7V8xXTk006778@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 03:59:33 2009 New Revision: 80582 URL: http://llvm.org/viewvc/llvm-project?rev=80582&view=rev Log: Refresh. Modified: gcc-plugin/trunk/gcc-patches/i386_static.diff Modified: gcc-plugin/trunk/gcc-patches/i386_static.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/i386_static.diff?rev=80582&r1=80581&r2=80582&view=diff ============================================================================== --- gcc-plugin/trunk/gcc-patches/i386_static.diff (original) +++ gcc-plugin/trunk/gcc-patches/i386_static.diff Mon Aug 31 03:59:33 2009 @@ -1,8 +1,8 @@ -Index: gcc.fsf.master/gcc/config/i386/i386.c +Index: lto/gcc/config/i386/i386.c =================================================================== ---- gcc.fsf.master.orig/gcc/config/i386/i386.c 2009-07-22 17:44:01.303541063 +0200 -+++ gcc.fsf.master/gcc/config/i386/i386.c 2009-07-22 17:49:05.282542208 +0200 -@@ -4954,7 +4954,7 @@ +--- lto.orig/gcc/config/i386/i386.c 2009-08-31 10:47:18.103197067 +0200 ++++ lto/gcc/config/i386/i386.c 2009-08-31 10:49:23.167200047 +0200 +@@ -4927,7 +4927,7 @@ case, we return the original mode and warn ABI change if CUM isn't NULL. */ @@ -11,7 +11,7 @@ type_natural_mode (const_tree type, CUMULATIVE_ARGS *cum) { enum machine_mode mode = TYPE_MODE (type); -@@ -5085,7 +5085,7 @@ +@@ -5058,7 +5058,7 @@ See the x86-64 PS ABI for details. */ @@ -20,7 +20,7 @@ classify_argument (enum machine_mode mode, const_tree type, enum x86_64_reg_class classes[MAX_CLASSES], int bit_offset) { -@@ -5465,7 +5465,7 @@ +@@ -5438,7 +5438,7 @@ /* Examine the argument and return set number of register required in each class. Return 0 iff parameter should be passed in memory. */ @@ -29,7 +29,7 @@ examine_argument (enum machine_mode mode, const_tree type, int in_return, int *int_nregs, int *sse_nregs) { -@@ -6145,7 +6145,7 @@ +@@ -6118,7 +6118,7 @@ /* Return true when TYPE should be 128bit aligned for 32bit argument passing ABI. */ From baldrick at free.fr Mon Aug 31 05:04:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 10:04:16 -0000 Subject: [llvm-commits] [gcc-plugin] r80583 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200908311004.n7VA4GM4015329@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 05:04:15 2009 New Revision: 80583 URL: http://llvm.org/viewvc/llvm-project?rev=80583&view=rev Log: Free memory allocated using gimple_to_tree. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=80583&r1=80582&r2=80583&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Mon Aug 31 05:04:15 2009 @@ -750,6 +750,7 @@ } extern "C" tree gimple_to_tree(gimple); +extern "C" void release_stmt_tree (gimple, tree); Function *TreeToLLVM::EmitFunction() { // Set up parameters and prepare for return, for the function. @@ -777,17 +778,19 @@ case GIMPLE_PREDICT: case GIMPLE_RESX: { // TODO Handle gimple directly, rather than converting to a tree. - MemRef DestLoc; tree stmt = gimple_to_tree(gimple_stmt); // If this stmt returns an aggregate value (e.g. a call whose result is // ignored), create a temporary to receive the value. Note that we don't // do this for MODIFY_EXPRs as an efficiency hack. + MemRef DestLoc; if (isAggregateTreeType(TREE_TYPE(stmt)) && TREE_CODE(stmt)!= MODIFY_EXPR && TREE_CODE(stmt)!=INIT_EXPR) DestLoc = CreateTempLoc(ConvertType(TREE_TYPE(stmt))); Emit(stmt, DestLoc.Ptr ? &DestLoc : NULL); + + release_stmt_tree(gimple_stmt, stmt); break; } From asl at math.spbu.ru Mon Aug 31 09:58:59 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 31 Aug 2009 14:58:59 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80586 - /llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp Message-ID: <200908311458.n7VEwxMF019992@zion.cs.uiuc.edu> Author: asl Date: Mon Aug 31 09:58:59 2009 New Revision: 80586 URL: http://llvm.org/viewvc/llvm-project?rev=80586&view=rev Log: Add missed testsuite predicated missed during NEON merge Modified: llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp Modified: llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp?rev=80586&r1=80585&r2=80586&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/lib/target-supports.exp Mon Aug 31 09:58:59 2009 @@ -1329,6 +1329,75 @@ } } +# LLVM LOCAL begin +# Return 1 if this is an ARM target supporting -mfpu=neon +# -mfloat-abi=softfp. Some multilibs may be incompatible with these +# options. + +proc check_effective_target_arm_neon_ok { } { + if { [check_effective_target_arm32] } { + return [check_no_compiler_messages arm_neon_ok object { + int dummy; + } "-mfpu=neon -mfloat-abi=softfp"] + } else { + return 0 + } +} + +# Return 1 if the target supports executing NEON instructions, 0 +# otherwise. Cache the result. + +proc check_effective_target_arm_neon_hw { } { + global arm_neon_hw_available_saved + global tool + + if [info exists arm_neon_hw_available_saved] { + verbose "check_arm_neon_hw_available returning saved $arm_neon_hw_available_saved" 2 + } else { + set arm_neon_hw_available_saved 0 + + # Set up, compile, and execute a test program containing NEON + # instructions. Include the current process ID in the file + # names to prevent conflicts with invocations for multiple + # testsuites. + set src neon[pid].c + set exe neon[pid].x + + set f [open $src "w"] + puts $f "int main() {" + puts $f " long long a = 0, b = 1;" + puts $f " asm (\"vorr %P0, %P1, %P2\"" + puts $f " : \"=w\" (a)" + puts $f " : \"0\" (a), \"w\" (b));" + puts $f " return (a != 1);" + puts $f "}" + close $f + + set opts "additional_flags=-mfpu=neon additional_flags=-mfloat-abi=softfp" + + verbose "check_arm_neon_hw_available compiling testfile $src" 2 + set lines [${tool}_target_compile $src $exe executable "$opts"] + file delete $src + + if [string match "" $lines] then { + # No error message, compilation succeeded. + set result [${tool}_load "./$exe" "" ""] + set status [lindex $result 0] + remote_file build delete $exe + verbose "check_arm_neon_hw_available testfile status is <$status>" 2 + + if { $status == "pass" } then { + set arm_neon_hw_available_saved 1 + } + } else { + verbose "check_arm_neon_hw_available testfile compilation failed" 2 + } + } + + return $arm_neon_hw_available_saved +} +# LLVM LOCAL end + # Return 1 if this is a PowerPC target with floating-point registers. proc check_effective_target_powerpc_fprs { } { From grosbach at apple.com Mon Aug 31 10:57:17 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 31 Aug 2009 08:57:17 -0700 Subject: [llvm-commits] [llvm] r80530 - in /llvm/trunk/lib/CodeGen: AsmPrinter/DwarfException.cpp SjLjEHPrepare.cpp In-Reply-To: <850CD172-4067-4CDC-87BF-A6732596873D@apple.com> References: <200908310135.n7V1Z4Qd002984@zion.cs.uiuc.edu> <850CD172-4067-4CDC-87BF-A6732596873D@apple.com> Message-ID: <909B60C0-6DC2-48C4-9B64-DC6A40DE3297@apple.com> This is caught by MultiSource/Applications/kimwitu++/kc. A variation that can also fail is caught by SingleSource/Regression/C++/EH/ function_try_block. I can add an additional compile-time test to 'make check' if you want. I'm not sure how useful that is, though, as it would be checking nothing that isn't handled by the above tests, and would miss any runtime issues. -Jim On Aug 31, 2009, at 1:31 AM, Evan Cheng wrote: > Test case? > > Evan > > On Aug 30, 2009, at 6:35 PM, Jim Grosbach wrote: > >> Author: grosbach >> Date: Sun Aug 30 20:35:03 2009 >> New Revision: 80530 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80530&view=rev >> Log: >> PR4747 >> >> Shared landing pads run into trouble with SJLJ, as the dispatch >> table is >> mapped to call sites, and merging the pads will throw that off. >> There needs >> to be a one-to-one mapping of landing pad exception table entries >> to invoke >> call points. >> >> Detecting the shared pad during lowering of SJLJ info insn't >> sufficient, as >> the dispatch function may still need separate destinations to >> properly >> handle phi-nodes. >> >> Modified: >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >> llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80530&r1=80529&r2=80530&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Sun Aug 30 >> 20:35:03 2009 >> @@ -468,8 +468,9 @@ >> FirstActions[P.PadIndex] >> }; >> >> - // Try to merge with the previous call-site. >> - if (PreviousIsInvoke) { >> + // Try to merge with the previous call-site. SJLJ doesn't >> do this >> + if (PreviousIsInvoke && >> + MAI->getExceptionHandlingType() == >> ExceptionHandling::Dwarf) { >> CallSiteEntry &Prev = CallSites.back(); >> if (Site.PadLabel == Prev.PadLabel && Site.Action == >> Prev.Action) { >> // Extend the range of the previous entry. >> >> Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=80530&r1=80529&r2=80530&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Sun Aug 30 20:35:03 2009 >> @@ -24,7 +24,6 @@ >> #include "llvm/CodeGen/Passes.h" >> #include "llvm/Transforms/Utils/BasicBlockUtils.h" >> #include "llvm/Transforms/Utils/Local.h" >> -#include "llvm/ADT/DenseMap.h" >> #include "llvm/ADT/Statistic.h" >> #include "llvm/ADT/SmallVector.h" >> #include "llvm/Support/CommandLine.h" >> @@ -70,7 +69,8 @@ >> >> private: >> void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, >> - Value *CallSite); >> + Value *CallSite, >> + SwitchInst *CatchSwitch); >> void splitLiveRangesLiveAcrossInvokes(SmallVector> 16> &Invokes); >> bool insertSjLjEHSupport(Function &F); >> }; >> @@ -126,9 +126,14 @@ >> >> /// markInvokeCallSite - Insert code to mark the call_site for this >> invoke >> void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned >> InvokeNo, >> - Value *CallSite) { >> + Value *CallSite, >> + SwitchInst *CatchSwitch) { >> ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II- >> >getContext()), >> InvokeNo); >> + // The runtime comes back to the dispatcher with the call_site - >> 1 in >> + // the context. Odd, but there it is. >> + ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II- >> >getContext()), >> + InvokeNo - 1); >> >> // If the unwind edge has phi nodes, split the edge. >> if (isa(II->getUnwindDest()->begin())) { >> @@ -145,6 +150,8 @@ >> // location afterward. >> new StoreInst(CallSiteNoC, CallSite, true, II); // volatile >> >> + // Add a switch case to our unwind block. >> + CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); >> // We still want this to look like an invoke so we emit the LSDA >> properly >> // FIXME: ??? Or will this cause strangeness with mis-matched IDs >> like >> // when it was in the front end? >> @@ -311,6 +318,13 @@ >> if (!Invokes.empty()) { >> // We have invokes, so we need to add register/unregister calls >> to get >> // this function onto the global unwind stack. >> + // >> + // First thing we need to do is scan the whole function for >> values that are >> + // live across unwind edges. Each value that is live across >> an unwind edge >> + // we spill into a stack location, guaranteeing that there is >> nothing live >> + // across the unwind edge. This process also splits all >> critical edges >> + // coming out of invoke's. >> + splitLiveRangesLiveAcrossInvokes(Invokes); >> >> BasicBlock *EntryBB = F.begin(); >> // Create an alloca for the incoming jump buffer ptr and the new >> jump buffer >> @@ -462,32 +476,11 @@ >> ContBlock->getTerminator()); >> Register->setDoesNotThrow(); >> >> - // At this point, we are all set up. Update the invoke >> instructions >> + // At this point, we are all set up, update the invoke >> instructions >> // to mark their call_site values, and fill in the dispatch switch >> // accordingly. >> - DenseMap PadSites; >> - unsigned NextCallSiteValue = 1; >> - for (SmallVector::iterator I = Invokes.begin(), >> - E = Invokes.end(); I < E; ++I) { >> - unsigned CallSiteValue; >> - BasicBlock *LandingPad = (*I)->getSuccessor(1); >> - // landing pads can be shared. If we see a landing pad >> again, we >> - // want to make sure to use the same call site index so the >> dispatch >> - // will go to the right place. >> - CallSiteValue = PadSites[LandingPad]; >> - if (!CallSiteValue) { >> - CallSiteValue = NextCallSiteValue++; >> - PadSites[LandingPad] = CallSiteValue; >> - // Add a switch case to our unwind block. The runtime >> comes back >> - // to the dispatcher with the call_site - 1 in the >> context. Odd, >> - // but there it is. >> - ConstantInt *SwitchValC = >> - ConstantInt::get(Type::getInt32Ty((*I)->getContext()), >> - CallSiteValue - 1); >> - DispatchSwitch->addCase(SwitchValC, (*I)->getUnwindDest()); >> - } >> - markInvokeCallSite(*I, CallSiteValue, CallSite); >> - } >> + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) >> + markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch); >> >> // The front end has likely added calls to _Unwind_Resume. We need >> // to find those calls and mark the call_site as -1 immediately >> prior. >> @@ -515,13 +508,6 @@ >> Unwinds[i]->eraseFromParent(); >> } >> >> - // Scan the whole function for values that are live across >> unwind edges. >> - // Each value that is live across an unwind edge we spill into >> a stack >> - // location, guaranteeing that there is nothing live across >> the unwind >> - // edge. This process also splits all critical edges coming >> out of >> - // invoke's. >> - splitLiveRangesLiveAcrossInvokes(Invokes); >> - >> // Finally, for any returns from this function, if this function >> contains an >> // invoke, add a call to unregister the function context. >> for (unsigned i = 0, e = Returns.size(); i != e; ++i) >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From grosbach at apple.com Mon Aug 31 11:11:29 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 31 Aug 2009 16:11:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c Message-ID: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 31 11:11:29 2009 New Revision: 80588 URL: http://llvm.org/viewvc/llvm-project?rev=80588&view=rev Log: Cleanup of cruft left over from front-end sjlj bits. No longer necessary with the EH handled in the back end. Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c llvm-gcc-4.2/trunk/gcc/cp/except.c llvm-gcc-4.2/trunk/gcc/except.c llvm-gcc-4.2/trunk/gcc/except.h llvm-gcc-4.2/trunk/gcc/libfuncs.h llvm-gcc-4.2/trunk/gcc/llvm-internal.h llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Mon Aug 31 11:11:29 2009 @@ -3586,10 +3586,6 @@ = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gcc_personality_sj0" : "__gcc_personality_v0"); - llvm_unwind_sjlj_register_libfunc - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); - llvm_unwind_sjlj_unregister_libfunc - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); #else eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/except.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/except.c Mon Aug 31 11:11:29 2009 @@ -97,10 +97,6 @@ = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gxx_personality_sj0" : "__gxx_personality_v0"); - llvm_unwind_sjlj_register_libfunc - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); - llvm_unwind_sjlj_unregister_libfunc - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); #else eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gxx_personality_sj0" Modified: llvm-gcc-4.2/trunk/gcc/except.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/except.c (original) +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 @@ -115,21 +115,12 @@ htab_t type_to_runtime_map; /* Describe the SjLj_Function_Context structure. */ -#ifndef ENABLE_LLVM static GTY(()) tree sjlj_fc_type_node; static int sjlj_fc_call_site_ofs; static int sjlj_fc_data_ofs; static int sjlj_fc_personality_ofs; static int sjlj_fc_lsda_ofs; static int sjlj_fc_jbuf_ofs; -#else -tree sjlj_fc_type_node; -int sjlj_fc_call_site_ofs; -int sjlj_fc_data_ofs; -int sjlj_fc_personality_ofs; -int sjlj_fc_lsda_ofs; -int sjlj_fc_jbuf_ofs; -#endif /* Describes one exception region. */ struct eh_region GTY(()) @@ -285,7 +276,7 @@ static hashval_t ehspec_filter_hash (const void *); static int add_ttypes_entry (htab_t, tree); static int add_ehspec_entry (htab_t, htab_t, tree); -/*static void assign_filter_values (void); */ +static void assign_filter_values (void); static void build_post_landing_pads (void); static void connect_post_landing_pads (void); static void dw2_build_landing_pads (void); @@ -1385,7 +1376,7 @@ we use lots of landing pads, and so every type or list can share the same filter value, which saves table space. */ -/*static*/ void +static void assign_filter_values (void) { int i; Modified: llvm-gcc-4.2/trunk/gcc/except.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.h?rev=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/except.h (original) +++ llvm-gcc-4.2/trunk/gcc/except.h Mon Aug 31 11:11:29 2009 @@ -57,7 +57,6 @@ /* After initial rtl generation, call back to finish generating exception support code. */ extern void finish_eh_generation (void); -extern void assign_filter_values (void); extern void init_eh (void); extern void init_eh_for_function (void); @@ -125,13 +124,6 @@ extern struct eh_region *get_eh_region (unsigned); extern tree get_eh_type_list (struct eh_region *); extern tree lookup_type_for_runtime (tree); - -extern GTY(()) tree sjlj_fc_type_node; -extern int sjlj_fc_call_site_ofs; -extern int sjlj_fc_data_ofs; -extern int sjlj_fc_personality_ofs; -extern int sjlj_fc_lsda_ofs; -extern int sjlj_fc_jbuf_ofs; #endif /* LLVM local end */ Modified: llvm-gcc-4.2/trunk/gcc/libfuncs.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libfuncs.h?rev=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/libfuncs.h (original) +++ llvm-gcc-4.2/trunk/gcc/libfuncs.h Mon Aug 31 11:11:29 2009 @@ -82,15 +82,9 @@ #ifdef ENABLE_LLVM #define llvm_unwind_resume_libfunc (llvm_libfunc_table[LTI_unwind_resume]) #define llvm_eh_personality_libfunc (llvm_libfunc_table[LTI_eh_personality]) -#define llvm_unwind_sjlj_register_libfunc \ - (llvm_libfunc_table[LTI_unwind_sjlj_register]) -#define llvm_unwind_sjlj_unregister_libfunc \ - (llvm_libfunc_table[LTI_unwind_sjlj_unregister]) #else #define llvm_unwind_resume_libfunc unwind_resume_libfunc #define llvm_eh_personality_libfunc eh_personality_libfunc -#define llvm_unwind_sjlj_register_libfunc unwind_sjlj_register_libfunc -#define llvm_unwind_sjlj_unregister_libfunc unwind_sjlj_unregister_libfunc #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 31 11:11:29 2009 @@ -448,12 +448,6 @@ Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align); Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align); - /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher - void EmitSjLjDispatcher(); - - /// EmitSjLjLandingPads - Emit SJLJ EH landing pads. - void EmitSjLjLandingPads(); - /// EmitLandingPads - Emit EH landing pads. void EmitLandingPads(); 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=80588&r1=80587&r2=80588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Aug 31 11:11:29 2009 @@ -8291,10 +8291,6 @@ #ifdef ENABLE_LLVM llvm_eh_personality_libfunc = llvm_init_one_libfunc ("__objc_personality_v0"); - llvm_unwind_sjlj_register_libfunc - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); - llvm_unwind_sjlj_unregister_libfunc - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); #else eh_personality_libfunc = init_one_libfunc ("__objc_personality_v0"); From edwintorok at gmail.com Mon Aug 31 11:12:30 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 31 Aug 2009 16:12:30 -0000 Subject: [llvm-commits] [llvm] r80589 - /llvm/trunk/lib/System/DynamicLibrary.cpp Message-ID: <200908311612.n7VGCUVg029338@zion.cs.uiuc.edu> Author: edwin Date: Mon Aug 31 11:12:29 2009 New Revision: 80589 URL: http://llvm.org/viewvc/llvm-project?rev=80589&view=rev Log: Fix ExplicitSymbols leak. Modified: llvm/trunk/lib/System/DynamicLibrary.cpp Modified: llvm/trunk/lib/System/DynamicLibrary.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=80589&r1=80588&r2=80589&view=diff ============================================================================== --- llvm/trunk/lib/System/DynamicLibrary.cpp (original) +++ llvm/trunk/lib/System/DynamicLibrary.cpp Mon Aug 31 11:12:29 2009 @@ -25,6 +25,13 @@ // Collection of symbol name/value pairs to be searched prior to any libraries. static std::map *ExplicitSymbols = 0; +static struct ExplicitSymbolsDeleter { + ~ExplicitSymbolsDeleter() { + if (ExplicitSymbols) + delete ExplicitSymbols; + } +} Dummy; + void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, void *symbolValue) { if (ExplicitSymbols == 0) From edwintorok at gmail.com Mon Aug 31 11:14:59 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 31 Aug 2009 16:14:59 -0000 Subject: [llvm-commits] [llvm] r80590 - in /llvm/trunk/lib/VMCore: ConstantsContext.h LLVMContextImpl.h Type.cpp TypesContext.h Message-ID: <200908311614.n7VGEx0D029652@zion.cs.uiuc.edu> Author: edwin Date: Mon Aug 31 11:14:59 2009 New Revision: 80590 URL: http://llvm.org/viewvc/llvm-project?rev=80590&view=rev Log: Free the constants that have no uses in ~LLVMContext. This fixes leaks from LLVMContext in multithreaded apps. Since constants are only deleted if they have no uses, it is safe to not delete a Module on shutdown, as many single-threaded tools do. Multithreaded apps should however delete the Module before destroying the Context to ensure that there are no leaks (assuming they use a different context for each thread). Modified: llvm/trunk/lib/VMCore/ConstantsContext.h llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Type.cpp llvm/trunk/lib/VMCore/TypesContext.h Modified: llvm/trunk/lib/VMCore/ConstantsContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=80590&r1=80589&r2=80590&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantsContext.h (original) +++ llvm/trunk/lib/VMCore/ConstantsContext.h Mon Aug 31 11:14:59 2009 @@ -575,6 +575,14 @@ // to enforce proper synchronization. typename MapTy::iterator map_begin() { return Map.begin(); } typename MapTy::iterator map_end() { return Map.end(); } + + void freeConstants() { + for (typename MapTy::iterator I=Map.begin(), E=Map.end(); + I != E; ++I) { + if (I->second->use_empty()) + delete I->second; + } + } /// InsertOrGetItem - Return an iterator for the specified element. /// If the element exists in the map, the returned iterator points to the Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=80590&r1=80589&r2=80590&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Aug 31 11:14:59 2009 @@ -96,7 +96,6 @@ class LLVMContextImpl { public: sys::SmartRWMutex ConstantsLock; - typedef DenseMap IntMapTy; IntMapTy IntConstants; @@ -196,6 +195,28 @@ Int16Ty(C, 16), Int32Ty(C, 32), Int64Ty(C, 64) { } + + ~LLVMContextImpl() + { + ExprConstants.freeConstants(); + ArrayConstants.freeConstants(); + StructConstants.freeConstants(); + VectorConstants.freeConstants(); + + AggZeroConstants.freeConstants(); + NullPtrConstants.freeConstants(); + UndefValueConstants.freeConstants(); + for (IntMapTy::iterator I=IntConstants.begin(), E=IntConstants.end(); + I != E; ++I) { + if (I->second->use_empty()) + delete I->second; + } + for (FPMapTy::iterator I=FPConstants.begin(), E=FPConstants.end(); + I != E; ++I) { + if (I->second->use_empty()) + delete I->second; + } + } }; } Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=80590&r1=80589&r2=80590&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Mon Aug 31 11:14:59 2009 @@ -500,7 +500,7 @@ llvm_release_global_lock(); } - } else { + } else if (!AlwaysOpaqueTy) { AlwaysOpaqueTy = OpaqueType::get(getContext()); Holder = new PATypeHolder(AlwaysOpaqueTy); } Modified: llvm/trunk/lib/VMCore/TypesContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/TypesContext.h?rev=80590&r1=80589&r2=80590&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/TypesContext.h (original) +++ llvm/trunk/lib/VMCore/TypesContext.h Mon Aug 31 11:14:59 2009 @@ -221,7 +221,6 @@ // PATypeHolder won't destroy non-abstract types. // We can't destroy them by simply iterating, because // they may contain references to each-other. -#if 0 for (std::multimap::iterator I = TypesByHash.begin(), E = TypesByHash.end(); I != E; ++I) { Type *Ty = const_cast(I->second.Ty); @@ -235,7 +234,6 @@ operator delete(Ty); } } -#endif } void RemoveFromTypesByHash(unsigned Hash, const Type *Ty) { From benny.kra at googlemail.com Mon Aug 31 08:05:26 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Mon, 31 Aug 2009 13:05:26 -0000 Subject: [llvm-commits] [llvm] r80584 - in /llvm/trunk/lib/Target: ARM/ ARM/AsmPrinter/ Alpha/ Alpha/AsmPrinter/ Alpha/TargetInfo/ Blackfin/ Blackfin/AsmPrinter/ CellSPU/ CellSPU/AsmPrinter/ MSP430/ MSP430/AsmPrinter/ Mips/ PIC16/ PIC16/AsmPrinter/ PowerPC/ PowerPC/TargetInfo/ Sparc/ Sparc/AsmPrinter/ SystemZ/ SystemZ/AsmPrinter/ X86/ XCore/ Message-ID: <200908311305.n7VD5Q4t005426@zion.cs.uiuc.edu> Author: d0k Date: Mon Aug 31 08:05:24 2009 New Revision: 80584 URL: http://llvm.org/viewvc/llvm-project?rev=80584&view=rev Log: Normalize makefile comments and sort cmake file lists. Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile llvm/trunk/lib/Target/ARM/CMakeLists.txt llvm/trunk/lib/Target/Alpha/AsmPrinter/Makefile llvm/trunk/lib/Target/Alpha/CMakeLists.txt llvm/trunk/lib/Target/Alpha/TargetInfo/Makefile llvm/trunk/lib/Target/Blackfin/AsmPrinter/Makefile llvm/trunk/lib/Target/Blackfin/CMakeLists.txt llvm/trunk/lib/Target/CellSPU/AsmPrinter/Makefile llvm/trunk/lib/Target/CellSPU/CMakeLists.txt llvm/trunk/lib/Target/MSP430/AsmPrinter/Makefile llvm/trunk/lib/Target/MSP430/CMakeLists.txt llvm/trunk/lib/Target/Mips/CMakeLists.txt llvm/trunk/lib/Target/PIC16/AsmPrinter/Makefile llvm/trunk/lib/Target/PIC16/CMakeLists.txt llvm/trunk/lib/Target/PowerPC/CMakeLists.txt llvm/trunk/lib/Target/PowerPC/TargetInfo/Makefile llvm/trunk/lib/Target/Sparc/AsmPrinter/Makefile llvm/trunk/lib/Target/Sparc/CMakeLists.txt llvm/trunk/lib/Target/SystemZ/AsmPrinter/Makefile llvm/trunk/lib/Target/SystemZ/CMakeLists.txt llvm/trunk/lib/Target/X86/CMakeLists.txt llvm/trunk/lib/Target/XCore/CMakeLists.txt Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/ARM/Makefile -----------------------------*- Makefile -*-===## +##===- lib/Target/ARM/AsmPrinter/Makefile ------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -22,9 +22,9 @@ ARMISelLowering.cpp ARMJITInfo.cpp ARMLoadStoreOptimizer.cpp + ARMMCAsmInfo.cpp ARMRegisterInfo.cpp ARMSubtarget.cpp - ARMMCAsmInfo.cpp ARMTargetMachine.cpp NEONPreAllocPass.cpp Thumb1InstrInfo.cpp Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/Alpha/Makefile ---------------------------*- Makefile -*-===## +##===- lib/Target/Alpha/AsmPrinter/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/Alpha/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Alpha/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -19,9 +19,9 @@ AlphaISelLowering.cpp AlphaJITInfo.cpp AlphaLLRP.cpp + AlphaMCAsmInfo.cpp AlphaRegisterInfo.cpp AlphaSubtarget.cpp - AlphaMCAsmInfo.cpp AlphaTargetMachine.cpp ) Modified: llvm/trunk/lib/Target/Alpha/TargetInfo/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/TargetInfo/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/TargetInfo/Makefile (original) +++ llvm/trunk/lib/Target/Alpha/TargetInfo/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -#===- lib/Target/Alpha/TargetInfo/Makefile -----------------*- Makefile -*-===## +##===- lib/Target/Alpha/TargetInfo/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/Blackfin/Makefile ------------------------*- Makefile -*-===## +##===- lib/Target/Blackfin/AsmPrinter/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/Blackfin/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Blackfin/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -14,8 +14,8 @@ BlackfinInstrInfo.cpp BlackfinISelDAGToDAG.cpp BlackfinISelLowering.cpp + BlackfinMCAsmInfo.cpp BlackfinRegisterInfo.cpp BlackfinSubtarget.cpp - BlackfinMCAsmInfo.cpp BlackfinTargetMachine.cpp ) Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/CellSPU/Makefile -------------------------*- Makefile -*-===## +##===- lib/Target/CellSPU/AsmPrinter/Makefile --------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/CellSPU/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/CellSPU/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -17,9 +17,9 @@ SPUInstrInfo.cpp SPUISelDAGToDAG.cpp SPUISelLowering.cpp + SPUMCAsmInfo.cpp SPURegisterInfo.cpp SPUSubtarget.cpp - SPUMCAsmInfo.cpp SPUTargetMachine.cpp ) Modified: llvm/trunk/lib/Target/MSP430/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/MSP430/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/MSP430/Makefile --------------------------*- Makefile -*-===## +##===- lib/Target/MSP430/AsmPrinter/Makefile ---------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/MSP430/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/MSP430/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -11,11 +11,11 @@ tablegen(MSP430GenSubtarget.inc -gen-subtarget) add_llvm_target(MSP430CodeGen - MSP430ISelDAGToDAG.cpp - MSP430RegisterInfo.cpp - MSP430MCAsmInfo.cpp MSP430InstrInfo.cpp + MSP430ISelDAGToDAG.cpp MSP430ISelLowering.cpp + MSP430MCAsmInfo.cpp + MSP430RegisterInfo.cpp MSP430Subtarget.cpp MSP430TargetMachine.cpp ) Modified: llvm/trunk/lib/Target/Mips/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Mips/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -15,9 +15,9 @@ MipsInstrInfo.cpp MipsISelDAGToDAG.cpp MipsISelLowering.cpp + MipsMCAsmInfo.cpp MipsRegisterInfo.cpp MipsSubtarget.cpp - MipsMCAsmInfo.cpp MipsTargetMachine.cpp MipsTargetObjectFile.cpp ) Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/PIC16/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/PIC16/Makefile ----------------------------*- Makefile -*-===## +##===- lib/Target/PIC16/AsmPrinter/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/PIC16/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/PIC16/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -16,9 +16,9 @@ PIC16ISelDAGToDAG.cpp PIC16ISelLowering.cpp PIC16MemSelOpt.cpp + PIC16MCAsmInfo.cpp PIC16RegisterInfo.cpp PIC16Subtarget.cpp - PIC16MCAsmInfo.cpp PIC16TargetMachine.cpp PIC16TargetObjectFile.cpp ) Modified: llvm/trunk/lib/Target/PowerPC/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/PowerPC/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -20,10 +20,10 @@ PPCISelLowering.cpp PPCJITInfo.cpp PPCMachOWriterInfo.cpp + PPCMCAsmInfo.cpp PPCPredicates.cpp PPCRegisterInfo.cpp PPCSubtarget.cpp - PPCMCAsmInfo.cpp PPCTargetMachine.cpp ) Modified: llvm/trunk/lib/Target/PowerPC/TargetInfo/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/TargetInfo/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/TargetInfo/Makefile (original) +++ llvm/trunk/lib/Target/PowerPC/TargetInfo/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/PowerPC/TargetInfo/Makefile ------------------*- Makefile -*-===## +##===- lib/Target/PowerPC/TargetInfo/Makefile --------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/Sparc/Makefile ---------------------------*- Makefile -*-===## +##===- lib/Target/Sparc/AsmPrinter/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/Sparc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Sparc/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -16,9 +16,9 @@ SparcInstrInfo.cpp SparcISelDAGToDAG.cpp SparcISelLowering.cpp + SparcMCAsmInfo.cpp SparcRegisterInfo.cpp SparcSubtarget.cpp - SparcMCAsmInfo.cpp SparcTargetMachine.cpp ) Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/Makefile?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/AsmPrinter/Makefile (original) +++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/Makefile Mon Aug 31 08:05:24 2009 @@ -1,4 +1,4 @@ -##===- lib/Target/SystemZ/Makefile ------------- -----------*- Makefile -*-===## +##===- lib/Target/SystemZ/AsmPrinter/Makefile --------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # Modified: llvm/trunk/lib/Target/SystemZ/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/SystemZ/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -14,9 +14,9 @@ SystemZISelDAGToDAG.cpp SystemZISelLowering.cpp SystemZInstrInfo.cpp + SystemZMCAsmInfo.cpp SystemZRegisterInfo.cpp SystemZSubtarget.cpp - SystemZMCAsmInfo.cpp SystemZTargetMachine.cpp ) Modified: llvm/trunk/lib/Target/X86/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/X86/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -22,9 +22,9 @@ X86ISelLowering.cpp X86InstrInfo.cpp X86JITInfo.cpp + X86MCAsmInfo.cpp X86RegisterInfo.cpp X86Subtarget.cpp - X86MCAsmInfo.cpp X86TargetMachine.cpp X86FastISel.cpp ) Modified: llvm/trunk/lib/Target/XCore/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/CMakeLists.txt?rev=80584&r1=80583&r2=80584&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/XCore/CMakeLists.txt Mon Aug 31 08:05:24 2009 @@ -16,9 +16,9 @@ XCoreInstrInfo.cpp XCoreISelDAGToDAG.cpp XCoreISelLowering.cpp + XCoreMCAsmInfo.cpp XCoreRegisterInfo.cpp XCoreSubtarget.cpp - XCoreMCAsmInfo.cpp XCoreTargetMachine.cpp XCoreTargetObjectFile.cpp ) From baldrick at free.fr Mon Aug 31 11:33:40 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 18:33:40 +0200 Subject: [llvm-commits] [llvm] r80428 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: References: <200908291220.n7TCKtn5012907@zion.cs.uiuc.edu> <4A995A13.7040803@free.fr> <4A9A8757.9070604@free.fr> Message-ID: <4A9BFB64.7060204@free.fr> Hi Bill, >>>>> - Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); >>>>> - Asm->EOL("FDE Encoding (pcrel sdata4)"); >>>>> + Encoding = >>>>> Asm->TM.getTargetLowering()->getPreferredLSDADataFormat(); >>>>> + Asm->EmitInt8(Encoding); >>>>> + Asm->EOL("LSDA Encoding", Encoding); >>>> >>>> here you state how you will output the data. But I don't see the >>>> corresponding changes to the places where the data is actually output. >>>> >>> Eric got the LSDA to look sensible before this change. :-) >>> Essentially, this is fixing a long-standing bug on Darwin where we >>> weren't emitting the encoding in the CIE properly. But I'll verify >>> that the LSDA looks good. >> >> I don't get it. You have a target method (getPreferredLSDADataFormat) >> to tell you the LSDA format. Surely the place the LSDA is written >> should query this method and output data according to what it returns? >> Instead it looks like the LSDA output stuff has it's own way of working >> out the format, so you have two places that need to know the same bit >> of information (the format), but each is driven by different target >> methods and different logic that needs to be kept in sync. That's just >> asking for trouble! At this point I should confess that I didn't bother >> looking at the LSDA code, so hopefully it's not the duplicated mess my >> fevered brain is imagining :) >> > If that were the only thing wrong with our exception handling output, I > would be happy. :-) > > The naming of this method is probably unfortunate. I'm going off of the > GCC naming, which seems reasonable. The actual output of the LSDA > doesn't need to query this (it needs other formatting information, but > not this particular one). It just magically outputs it in the correct > format. Or at least the unwinder will see it as such. if the place that outputs the data already has enough info to get the format right, then doesn't that mean that the getPreferredLSDADataFormat target hook is redundant? It could presumably be implemented as a utility in DwarfException.cpp, and be driven by the same target info that is driving LSDA output. > > I'll mention that this isn't the optimal solution. :) Eric and I talked > with Chris, and he wants to go back to "first principles" with this > stuff. For instance, "why do we use pcrel for one architecture and > pcrel+sdata4 for another?" It's probably a function of other factors in > the object file. If we can do it *that* way, special ugly calls like > getPreferred*DataFormat will go away. Sure, it should all be driven by a logical and orthogonal set of target information. That's why I don't see the point of introducing a new target hook (getPreferredLSDADataFormat) which is not orthogonal at all, since it can apparently be calculated from existing target settings... > It would probably be better to simply use the actual byte size of the > pointer. Though I'm not at all sure how that would work on machines with > ptrs > 8 bytes. I guess 16 bit machines are more likely :) Anyway, the only real point I want to make is that rather than having stuff like "if (4 bytes) then x; else (y)" all over the place, it would be neater to have methods that work without any assumptions on pointer sizes, even if no such machines exist. Ciao, Duncan. From baldrick at free.fr Mon Aug 31 11:45:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 16:45:16 -0000 Subject: [llvm-commits] [llvm] r80592 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h Message-ID: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 11:45:16 2009 New Revision: 80592 URL: http://llvm.org/viewvc/llvm-project?rev=80592&view=rev Log: Revert commit 80428. It completely broke exception handling on x86-32 linux. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=80592&r1=80591&r2=80592&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Aug 31 11:45:16 2009 @@ -32,7 +32,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/DebugLoc.h" -#include "llvm/Support/Dwarf.h" #include "llvm/Target/TargetMachine.h" #include #include @@ -751,7 +750,7 @@ /// getPICJumpTableRelocaBase - Returns relocation base for the given PIC /// jumptable. virtual SDValue getPICJumpTableRelocBase(SDValue Table, - SelectionDAG &DAG) const; + SelectionDAG &DAG) const; /// isOffsetFoldingLegal - Return true if folding a constant offset /// with the given GlobalAddress is legal. It is frequently not legal in @@ -761,18 +760,6 @@ /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *) const = 0; - /// getPreferredLSDADataFormat - Return the preferred exception handling data - /// format for the LSDA. - virtual unsigned getPreferredLSDADataFormat() const { - return dwarf::DW_EH_PE_absptr; - } - - /// getPreferredFDEDataFormat - Return the preferred exception handling data - /// format for the FDE. - virtual unsigned getPreferredFDEDataFormat() const { - return dwarf::DW_EH_PE_absptr; - } - //===--------------------------------------------------------------------===// // TargetLowering Optimization Methods // Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80592&r1=80591&r2=80592&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 31 11:45:16 2009 @@ -22,7 +22,6 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" -#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/Dwarf.h" @@ -81,7 +80,6 @@ EmitLabel("eh_frame_common_begin", Index); Asm->EmitInt32((int)0); Asm->EOL("CIE Identifier Tag"); - Asm->EmitInt8(dwarf::DW_CIE_VERSION); Asm->EOL("CIE Version"); @@ -93,29 +91,23 @@ // Round out reader. Asm->EmitULEB128Bytes(1); Asm->EOL("CIE Code Alignment Factor"); - Asm->EmitSLEB128Bytes(stackGrowth); Asm->EOL("CIE Data Alignment Factor"); - Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true)); Asm->EOL("CIE Return Address Column"); - unsigned Encoding = 0; - // If there is a personality, we need to indicate the function's location. if (Personality) { Asm->EmitULEB128Bytes(7); Asm->EOL("Augmentation Size"); if (MAI->getNeedsIndirectEncoding()) { - Encoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4 | - dwarf::DW_EH_PE_indirect; - Asm->EmitInt8(Encoding); - Asm->EOL("Personality", Encoding); + Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4 | + dwarf::DW_EH_PE_indirect); + Asm->EOL("Personality (pcrel sdata4 indirect)"); } else { - Encoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; - Asm->EmitInt8(Encoding); - Asm->EOL("Personality", Encoding); + Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); + Asm->EOL("Personality (pcrel sdata4)"); } PrintRelDirective(true); @@ -126,20 +118,17 @@ O << "-" << MAI->getPCSymbol(); Asm->EOL("Personality"); - Encoding = Asm->TM.getTargetLowering()->getPreferredLSDADataFormat(); - Asm->EmitInt8(Encoding); - Asm->EOL("LSDA Encoding", Encoding); - - Encoding = Asm->TM.getTargetLowering()->getPreferredFDEDataFormat(); - Asm->EmitInt8(Encoding); - Asm->EOL("FDE Encoding", Encoding); + Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); + Asm->EOL("LSDA Encoding (pcrel sdata4)"); + + Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); + Asm->EOL("FDE Encoding (pcrel sdata4)"); } else { Asm->EmitULEB128Bytes(1); Asm->EOL("Augmentation Size"); - Encoding = Asm->TM.getTargetLowering()->getPreferredFDEDataFormat(); - Asm->EmitInt8(Encoding); - Asm->EOL("FDE Encoding", Encoding); + Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); + Asm->EOL("FDE Encoding (pcrel sdata4)"); } // Indicate locations of general callee saved registers in frame. @@ -163,7 +152,6 @@ "Should not emit 'available externally' functions at all"); const Function *TheFunc = EHFrameInfo.function; - bool is4Byte = TD->getPointerSize() == sizeof(int32_t); Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection()); @@ -207,22 +195,23 @@ Asm->EOL("FDE CIE offset"); - EmitReference("eh_func_begin", EHFrameInfo.Number, true, is4Byte); + EmitReference("eh_func_begin", EHFrameInfo.Number, true, true); Asm->EOL("FDE initial location"); - EmitDifference("eh_func_end", EHFrameInfo.Number, - "eh_func_begin", EHFrameInfo.Number, is4Byte); + "eh_func_begin", EHFrameInfo.Number, true); Asm->EOL("FDE address range"); // If there is a personality and landing pads then point to the language // specific data area in the exception table. if (MMI->getPersonalities()[0] != NULL) { + bool is4Byte = TD->getPointerSize() == sizeof(int32_t); + Asm->EmitULEB128Bytes(is4Byte ? 4 : 8); Asm->EOL("Augmentation size"); - if (EHFrameInfo.hasLandingPads) { + if (EHFrameInfo.hasLandingPads) EmitReference("exception", EHFrameInfo.Number, true, false); - } else { + else { if (is4Byte) Asm->EmitInt32((int)0); else @@ -930,8 +919,6 @@ MF->getFunction())); } - MF = 0; - if (TimePassesIsEnabled) ExceptionTimer->stopTimer(); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=80592&r1=80591&r2=80592&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Aug 31 11:45:16 2009 @@ -464,40 +464,6 @@ return 2; } -/// getPreferredLSDADataFormat - Return the preferred exception handling data -/// format for the LSDA. -unsigned PPCTargetLowering::getPreferredLSDADataFormat() const { - if (getTargetMachine().getSubtarget().isDarwin()) - return dwarf::DW_EH_PE_pcrel; - - if (PPCSubTarget.isPPC64() || - getTargetMachine().getRelocationModel() == Reloc::PIC_) { - unsigned DataTy = - (PPCSubTarget.isPPC64() ? - dwarf::DW_EH_PE_udata8 : dwarf::DW_EH_PE_udata4); - return dwarf::DW_EH_PE_pcrel | DataTy; - } - - return dwarf::DW_EH_PE_absptr; -} - -/// getPreferredFDEDataFormat - Return the preferred exception handling data -/// format for the FDE. -unsigned PPCTargetLowering::getPreferredFDEDataFormat() const { - if (getTargetMachine().getSubtarget().isDarwin()) - return dwarf::DW_EH_PE_pcrel; - - if (PPCSubTarget.isPPC64() || - getTargetMachine().getRelocationModel() == Reloc::PIC_) { - unsigned DataTy = - (PPCSubTarget.isPPC64() ? - dwarf::DW_EH_PE_udata8 : dwarf::DW_EH_PE_udata4); - return dwarf::DW_EH_PE_pcrel | DataTy; - } - - return dwarf::DW_EH_PE_absptr; -} - //===----------------------------------------------------------------------===// // Node matching predicates, for use by the tblgen matching code. //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=80592&r1=80591&r2=80592&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Mon Aug 31 11:45:16 2009 @@ -346,14 +346,6 @@ /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; - /// getPreferredLSDADataFormat - Return the preferred exception handling data - /// format for the LSDA. - virtual unsigned getPreferredLSDADataFormat() const; - - /// getPreferredFDEDataFormat - Return the preferred exception handling data - /// format for the FDE. - virtual unsigned getPreferredFDEDataFormat() const; - private: SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const; SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=80592&r1=80591&r2=80592&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 31 11:45:16 2009 @@ -1055,49 +1055,6 @@ return F->hasFnAttr(Attribute::OptimizeForSize) ? 0 : 4; } -/// getPreferredLSDADataFormat - Return the preferred exception handling data -/// format for the LSDA. -unsigned X86TargetLowering::getPreferredLSDADataFormat() const { - if (Subtarget->isTargetDarwin()) - return dwarf::DW_EH_PE_pcrel; - - CodeModel::Model M = getTargetMachine().getCodeModel(); - - if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { - if (!Subtarget->is64Bit() || M == CodeModel::Small) - return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; - - return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8; - } - - if (M == CodeModel::Small) - return dwarf::DW_EH_PE_sdata4; - - return dwarf::DW_EH_PE_absptr; -} - -/// getPreferredFDEDataFormat - Return the preferred exception handling data -/// format for the FDE. -unsigned X86TargetLowering::getPreferredFDEDataFormat() const { - if (Subtarget->isTargetDarwin()) - return dwarf::DW_EH_PE_pcrel; - - CodeModel::Model M = getTargetMachine().getCodeModel(); - - if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { - if (!Subtarget->is64Bit() || - M == CodeModel::Small || M == CodeModel::Medium) - return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; - - return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8; - } - - if (M == CodeModel::Small || M == CodeModel::Medium) - return dwarf::DW_EH_PE_sdata4; - - return dwarf::DW_EH_PE_absptr; -} - //===----------------------------------------------------------------------===// // Return Value Calling Convention Implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=80592&r1=80591&r2=80592&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Aug 31 11:45:16 2009 @@ -560,14 +560,6 @@ /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; - /// getPreferredLSDADataFormat - Return the preferred exception handling data - /// format for the LSDA. - virtual unsigned getPreferredLSDADataFormat() const; - - /// getPreferredFDEDataFormat - Return the preferred exception handling data - /// format for the FDE. - virtual unsigned getPreferredFDEDataFormat() const; - private: /// Subtarget - Keep a pointer to the X86Subtarget around so that we can /// make the right decision when generating code for different targets. From echristo at apple.com Mon Aug 31 11:47:33 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 31 Aug 2009 09:47:33 -0700 Subject: [llvm-commits] [llvm] r80592 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> References: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> Message-ID: On Aug 31, 2009, at 9:45 AM, Duncan Sands wrote: > Revert commit 80428. It completely broke exception > handling on x86-32 linux. For poor Bill's knowledge, what happened? -eric From baldrick at free.fr Mon Aug 31 11:55:08 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 18:55:08 +0200 Subject: [llvm-commits] [llvm] r80592 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: References: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> Message-ID: <4A9C006C.5020004@free.fr> >> Revert commit 80428. It completely broke exception >> handling on x86-32 linux. > > For poor Bill's knowledge, what happened? It looks like exceptions were not being caught anymore. Basically every test in the Ada testsuite failed due to uncaught exceptions. Ciao, Duncan. From baldrick at free.fr Mon Aug 31 11:57:33 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 16:57:33 -0000 Subject: [llvm-commits] [gcc-plugin] r80594 - in /gcc-plugin/trunk: llvm-cache.c llvm-cache.h Message-ID: <200908311657.n7VGvXBZ002528@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 11:57:33 2009 New Revision: 80594 URL: http://llvm.org/viewvc/llvm-project?rev=80594&view=rev Log: Do not expose the definition of tree_llvm_map in the header. It is an internal detail. Modified: gcc-plugin/trunk/llvm-cache.c gcc-plugin/trunk/llvm-cache.h Modified: gcc-plugin/trunk/llvm-cache.c URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.c?rev=80594&r1=80593&r2=80594&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-cache.c (original) +++ gcc-plugin/trunk/llvm-cache.c Mon Aug 31 11:57:33 2009 @@ -33,6 +33,11 @@ #include "stdio.h" //QQ +struct GTY(()) tree_llvm_map { + struct tree_map_base base; + const void * GTY((skip)) val; +}; + #define tree_llvm_map_eq tree_map_base_eq #define tree_llvm_map_hash tree_map_base_hash #define tree_llvm_map_marked_p tree_map_base_marked_p Modified: gcc-plugin/trunk/llvm-cache.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.h?rev=80594&r1=80593&r2=80594&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-cache.h (original) +++ gcc-plugin/trunk/llvm-cache.h Mon Aug 31 11:57:33 2009 @@ -35,12 +35,6 @@ #include "target.h" #include "tree.h" -struct GTY(()) tree_llvm_map { - struct tree_map_base base; - const void *val; -}; -/* FIXME: Need to use gengtype and tell the GC about this. */ - extern bool llvm_has_cached (union tree_node *); extern const void *llvm_get_cached (union tree_node *); From echristo at apple.com Mon Aug 31 12:04:47 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 31 Aug 2009 10:04:47 -0700 Subject: [llvm-commits] [llvm] r80592 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <4A9C006C.5020004@free.fr> References: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> <4A9C006C.5020004@free.fr> Message-ID: On Aug 31, 2009, at 9:55 AM, Duncan Sands wrote: >>> Revert commit 80428. It completely broke exception >>> handling on x86-32 linux. >> For poor Bill's knowledge, what happened? > > It looks like exceptions were not being caught anymore. > Basically every test in the Ada testsuite failed due > to uncaught exceptions. Hmm.. OK. We'll take a look. Thanks! -eric From clattner at apple.com Mon Aug 31 12:05:48 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 31 Aug 2009 10:05:48 -0700 Subject: [llvm-commits] [llvm] r80530 - in /llvm/trunk/lib/CodeGen: AsmPrinter/DwarfException.cpp SjLjEHPrepare.cpp In-Reply-To: <909B60C0-6DC2-48C4-9B64-DC6A40DE3297@apple.com> References: <200908310135.n7V1Z4Qd002984@zion.cs.uiuc.edu> <850CD172-4067-4CDC-87BF-A6732596873D@apple.com> <909B60C0-6DC2-48C4-9B64-DC6A40DE3297@apple.com> Message-ID: <8C6BC7AA-8541-4D44-A54C-6E998B069BC8@apple.com> On Aug 31, 2009, at 8:57 AM, Jim Grosbach wrote: > This is caught by MultiSource/Applications/kimwitu++/kc. A variation > that can also fail is caught by SingleSource/Regression/C++/EH/ > function_try_block. > > I can add an additional compile-time test to 'make check' if you want. > I'm not sure how useful that is, though, as it would be checking > nothing that isn't handled by the above tests, and would miss any > runtime issues. For something like this, adding a test to the dejagnu suite is a good idea. It is run much more frequently than llvm-test. Please reduce the testcase to the essentials required to reproduce the failure though, don't just check in a massive test or a bugpoint reduced test. -Chris From clattner at apple.com Mon Aug 31 12:06:25 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 31 Aug 2009 10:06:25 -0700 Subject: [llvm-commits] [llvm] r80589 - /llvm/trunk/lib/System/DynamicLibrary.cpp In-Reply-To: <200908311612.n7VGCUVg029338@zion.cs.uiuc.edu> References: <200908311612.n7VGCUVg029338@zion.cs.uiuc.edu> Message-ID: On Aug 31, 2009, at 9:12 AM, Torok Edwin wrote: > Author: edwin > Date: Mon Aug 31 11:12:29 2009 > New Revision: 80589 > > URL: http://llvm.org/viewvc/llvm-project?rev=80589&view=rev > Log: > Fix ExplicitSymbols leak. Edwin, can this be a ManagedStatic, or something else that doesn't have a static ctor/dtor? -Chris > > Modified: > llvm/trunk/lib/System/DynamicLibrary.cpp > > Modified: llvm/trunk/lib/System/DynamicLibrary.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=80589&r1=80588&r2=80589&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/System/DynamicLibrary.cpp (original) > +++ llvm/trunk/lib/System/DynamicLibrary.cpp Mon Aug 31 11:12:29 2009 > @@ -25,6 +25,13 @@ > // Collection of symbol name/value pairs to be searched prior to any > libraries. > static std::map *ExplicitSymbols = 0; > > +static struct ExplicitSymbolsDeleter { > + ~ExplicitSymbolsDeleter() { > + if (ExplicitSymbols) > + delete ExplicitSymbols; > + } > +} Dummy; > + > void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, > void *symbolValue) { > if (ExplicitSymbols == 0) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Mon Aug 31 12:08:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Aug 2009 17:08:31 -0000 Subject: [llvm-commits] [llvm] r80595 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200908311708.n7VH8ViT003964@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 31 12:08:30 2009 New Revision: 80595 URL: http://llvm.org/viewvc/llvm-project?rev=80595&view=rev Log: cleanups pointed out by duncan Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80595&r1=80594&r2=80595&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Mon Aug 31 12:08:30 2009 @@ -113,7 +113,7 @@ } StopPassTimer(P); - // The the function pass(es) modified the IR, they may have clobbered the + // The function pass(es) modified the IR, they may have clobbered the // callgraph. if (Changed && CallGraphUpToDate) { DEBUG(errs() << "CGSCCPASSMGR: Pass Dirtied SCC: " @@ -134,7 +134,6 @@ ); bool MadeChange = false; - MadeChange = MadeChange; // Scan all functions in the SCC. for (unsigned sccidx = 0, e = CurSCC.size(); sccidx != e; ++sccidx) { From wendling at apple.com Mon Aug 31 12:10:02 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 31 Aug 2009 10:10:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> Message-ID: On Aug 31, 2009, at 9:11 AM, Jim Grosbach wrote: > Modified: llvm-gcc-4.2/trunk/gcc/except.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/except.c (original) > +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 > @@ -285,7 +276,7 @@ > static hashval_t ehspec_filter_hash (const void *); > static int add_ttypes_entry (htab_t, tree); > static int add_ehspec_entry (htab_t, htab_t, tree); > -/*static void assign_filter_values (void); */ > +static void assign_filter_values (void); > static void build_post_landing_pads (void); > static void connect_post_landing_pads (void); > static void dw2_build_landing_pads (void); > @@ -1385,7 +1376,7 @@ > we use lots of landing pads, and so every type or list can share > the same filter value, which saves table space. */ > > -/*static*/ void > +static void Will these two changes need LLVM LOCAL tags? -bw From clattner at apple.com Mon Aug 31 12:10:19 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 31 Aug 2009 10:10:19 -0700 Subject: [llvm-commits] [llvm] r80566 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <4A9B8A66.6000105@free.fr> References: <200908310723.n7V7NlfF013906@zion.cs.uiuc.edu> <4A9B8A66.6000105@free.fr> Message-ID: On Aug 31, 2009, at 1:31 AM, Duncan Sands wrote: > Hi Chris, this seems like a reasonable approach. > + // The the function pass(es) modified the IR, they may have > clobbered the > The the -> The > + MadeChange = MadeChange; > Doesn't seem very useful :) Fixed, thanks. > + // Scan all functions in the SCC. > > Can a function pass muck with CurSCC? No, function passes are allowed to modify the body of a function, but they have no way to change the contents of the CurSCC vector. > >> + if (F == 0 || F->isDeclaration()) continue; > > What about functions with weak linkage? This is mirroring logic for the current callgraph construction stuff. Weak functions etc could definitely be improved in the callgraph by not modeling them or by treating them as external functions, but the callgraph and cgsccpm logic needs to be the same. > Also, I think this routine > should live in the same file as the other callgraph computing > routines. Perhaps it can be merged somehow with the existing CG > calculation. (That way, if someone modifies the interaction between, > say, weak linkage and how the callgraph is calculated, this won't > be forgotten). Right, another day though :) > >> + if (!CallGraphUpToDate) >> + RefreshCallGraph(CurSCC, CG); > > Don't you need to set CallGraphUpToDate to "true" here? It's dead after this point. Thanks for the review! -Chris From grosbach at apple.com Mon Aug 31 12:18:51 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 31 Aug 2009 10:18:51 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> Message-ID: <7F2A9A41-5AF6-46F3-BDE6-3938DCED8E06@apple.com> On Aug 31, 2009, at 10:10 AM, Bill Wendling wrote: > > On Aug 31, 2009, at 9:11 AM, Jim Grosbach wrote: > >> Modified: llvm-gcc-4.2/trunk/gcc/except.c >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/except.c (original) >> +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 >> @@ -285,7 +276,7 @@ >> static hashval_t ehspec_filter_hash (const void *); >> static int add_ttypes_entry (htab_t, tree); >> static int add_ehspec_entry (htab_t, htab_t, tree); >> -/*static void assign_filter_values (void); */ >> +static void assign_filter_values (void); >> static void build_post_landing_pads (void); >> static void connect_post_landing_pads (void); >> static void dw2_build_landing_pads (void); >> @@ -1385,7 +1376,7 @@ >> we use lots of landing pads, and so every type or list can share >> the same filter value, which saves table space. */ >> >> -/*static*/ void >> +static void > > > Will these two changes need LLVM LOCAL tags? > No, having them that way in the first place was inadvertent. This changes these lines back to the way they appear in stock GCC. -jim From dalej at apple.com Mon Aug 31 12:49:20 2009 From: dalej at apple.com (Dale Johannesen) Date: Mon, 31 Aug 2009 17:49:20 -0000 Subject: [llvm-commits] [llvm] r80596 - /llvm/trunk/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c Message-ID: <200908311749.n7VHnK8c009003@zion.cs.uiuc.edu> Author: johannes Date: Mon Aug 31 12:49:20 2009 New Revision: 80596 URL: http://llvm.org/viewvc/llvm-project?rev=80596&view=rev Log: Mark test as passing on all x86, which it should, although I don't think anyone cares about this feature except Darwin. PR 4825. Modified: llvm/trunk/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c Modified: llvm/trunk/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c?rev=80596&r1=80595&r2=80596&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c (original) +++ llvm/trunk/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c Mon Aug 31 12:49:20 2009 @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -fasm-blocks -S -o - | grep {\\\*1192} // Complicated expression as jump target // XFAIL: * -// XTARGET: darwin +// XTARGET: x86,i386,i686 asm void Method3() { From wendling at apple.com Mon Aug 31 12:49:35 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 31 Aug 2009 10:49:35 -0700 Subject: [llvm-commits] [llvm] r80428 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <4A9BFB64.7060204@free.fr> References: <200908291220.n7TCKtn5012907@zion.cs.uiuc.edu> <4A995A13.7040803@free.fr> <4A9A8757.9070604@free.fr> <4A9BFB64.7060204@free.fr> Message-ID: <09813C23-3DBE-4B72-83AE-9D359BE77B6E@apple.com> On Aug 31, 2009, at 9:33 AM, Duncan Sands wrote: > if the place that outputs the data already has enough info to get the > format right, then doesn't that mean that the > getPreferredLSDADataFormat > target hook is redundant? It could presumably be implemented as a > utility in DwarfException.cpp, and be driven by the same target info > that is driving LSDA output. [...] > Sure, it should all be driven by a logical and orthogonal set of > target information. That's why I don't see the point of introducing > a new target hook (getPreferredLSDADataFormat) which is not orthogonal > at all, since it can apparently be calculated from existing target > settings... > Sure. I suppose what I'm saying here is that I don't know the orthogonal set of conditions which need to be met to determine the data format at this point. I don't see anything in the LSDA output code which indicates that it's following orthogonal conditions. It's just outputting stuff. >> It would probably be better to simply use the actual byte size of the >> pointer. Though I'm not at all sure how that would work on machines >> with >> ptrs > 8 bytes. > > I guess 16 bit machines are more likely :) Anyway, the only real > point > I want to make is that rather than having stuff like "if (4 bytes) > then > x; else (y)" all over the place, it would be neater to have methods > that > work without any assumptions on pointer sizes, even if no such > machines > exist. > 'Twould be a grand world if that were so. -bw -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090831/ae2bb85f/attachment.html From evan.cheng at apple.com Mon Aug 31 12:52:02 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 31 Aug 2009 10:52:02 -0700 Subject: [llvm-commits] [llvm] r80530 - in /llvm/trunk/lib/CodeGen: AsmPrinter/DwarfException.cpp SjLjEHPrepare.cpp In-Reply-To: <909B60C0-6DC2-48C4-9B64-DC6A40DE3297@apple.com> References: <200908310135.n7V1Z4Qd002984@zion.cs.uiuc.edu> <850CD172-4067-4CDC-87BF-A6732596873D@apple.com> <909B60C0-6DC2-48C4-9B64-DC6A40DE3297@apple.com> Message-ID: On Aug 31, 2009, at 8:57 AM, Jim Grosbach wrote: > This is caught by MultiSource/Applications/kimwitu++/kc. A variation > that can also fail is caught by SingleSource/Regression/C++/EH/ > function_try_block. > > I can add an additional compile-time test to 'make check' if you > want. I'm not sure how useful that is, though, as it would be > checking nothing that isn't handled by the above tests, and would > miss any runtime issues. For compile time failures, it's important to add a test. Not everyone can run the actual ARM runtime test, but everyone can run the dejagnu tests. Evan > > -Jim > > On Aug 31, 2009, at 1:31 AM, Evan Cheng wrote: > >> Test case? >> >> Evan >> >> On Aug 30, 2009, at 6:35 PM, Jim Grosbach wrote: >> >>> Author: grosbach >>> Date: Sun Aug 30 20:35:03 2009 >>> New Revision: 80530 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=80530&view=rev >>> Log: >>> PR4747 >>> >>> Shared landing pads run into trouble with SJLJ, as the dispatch >>> table is >>> mapped to call sites, and merging the pads will throw that off. >>> There needs >>> to be a one-to-one mapping of landing pad exception table entries >>> to invoke >>> call points. >>> >>> Detecting the shared pad during lowering of SJLJ info insn't >>> sufficient, as >>> the dispatch function may still need separate destinations to >>> properly >>> handle phi-nodes. >>> >>> Modified: >>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>> llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp >>> >>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80530&r1=80529&r2=80530&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Sun Aug >>> 30 20:35:03 2009 >>> @@ -468,8 +468,9 @@ >>> FirstActions[P.PadIndex] >>> }; >>> >>> - // Try to merge with the previous call-site. >>> - if (PreviousIsInvoke) { >>> + // Try to merge with the previous call-site. SJLJ doesn't >>> do this >>> + if (PreviousIsInvoke && >>> + MAI->getExceptionHandlingType() == >>> ExceptionHandling::Dwarf) { >>> CallSiteEntry &Prev = CallSites.back(); >>> if (Site.PadLabel == Prev.PadLabel && Site.Action == >>> Prev.Action) { >>> // Extend the range of the previous entry. >>> >>> Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=80530&r1=80529&r2=80530&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Sun Aug 30 20:35:03 >>> 2009 >>> @@ -24,7 +24,6 @@ >>> #include "llvm/CodeGen/Passes.h" >>> #include "llvm/Transforms/Utils/BasicBlockUtils.h" >>> #include "llvm/Transforms/Utils/Local.h" >>> -#include "llvm/ADT/DenseMap.h" >>> #include "llvm/ADT/Statistic.h" >>> #include "llvm/ADT/SmallVector.h" >>> #include "llvm/Support/CommandLine.h" >>> @@ -70,7 +69,8 @@ >>> >>> private: >>> void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, >>> - Value *CallSite); >>> + Value *CallSite, >>> + SwitchInst *CatchSwitch); >>> void splitLiveRangesLiveAcrossInvokes(SmallVector>> 16> &Invokes); >>> bool insertSjLjEHSupport(Function &F); >>> }; >>> @@ -126,9 +126,14 @@ >>> >>> /// markInvokeCallSite - Insert code to mark the call_site for >>> this invoke >>> void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned >>> InvokeNo, >>> - Value *CallSite) { >>> + Value *CallSite, >>> + SwitchInst *CatchSwitch) { >>> ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II- >>> >getContext()), >>> InvokeNo); >>> + // The runtime comes back to the dispatcher with the call_site >>> - 1 in >>> + // the context. Odd, but there it is. >>> + ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II- >>> >getContext()), >>> + InvokeNo - 1); >>> >>> // If the unwind edge has phi nodes, split the edge. >>> if (isa(II->getUnwindDest()->begin())) { >>> @@ -145,6 +150,8 @@ >>> // location afterward. >>> new StoreInst(CallSiteNoC, CallSite, true, II); // volatile >>> >>> + // Add a switch case to our unwind block. >>> + CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); >>> // We still want this to look like an invoke so we emit the LSDA >>> properly >>> // FIXME: ??? Or will this cause strangeness with mis-matched IDs >>> like >>> // when it was in the front end? >>> @@ -311,6 +318,13 @@ >>> if (!Invokes.empty()) { >>> // We have invokes, so we need to add register/unregister calls >>> to get >>> // this function onto the global unwind stack. >>> + // >>> + // First thing we need to do is scan the whole function for >>> values that are >>> + // live across unwind edges. Each value that is live across >>> an unwind edge >>> + // we spill into a stack location, guaranteeing that there is >>> nothing live >>> + // across the unwind edge. This process also splits all >>> critical edges >>> + // coming out of invoke's. >>> + splitLiveRangesLiveAcrossInvokes(Invokes); >>> >>> BasicBlock *EntryBB = F.begin(); >>> // Create an alloca for the incoming jump buffer ptr and the new >>> jump buffer >>> @@ -462,32 +476,11 @@ >>> ContBlock->getTerminator()); >>> Register->setDoesNotThrow(); >>> >>> - // At this point, we are all set up. Update the invoke >>> instructions >>> + // At this point, we are all set up, update the invoke >>> instructions >>> // to mark their call_site values, and fill in the dispatch switch >>> // accordingly. >>> - DenseMap PadSites; >>> - unsigned NextCallSiteValue = 1; >>> - for (SmallVector::iterator I = Invokes.begin(), >>> - E = Invokes.end(); I < E; ++I) { >>> - unsigned CallSiteValue; >>> - BasicBlock *LandingPad = (*I)->getSuccessor(1); >>> - // landing pads can be shared. If we see a landing pad >>> again, we >>> - // want to make sure to use the same call site index so the >>> dispatch >>> - // will go to the right place. >>> - CallSiteValue = PadSites[LandingPad]; >>> - if (!CallSiteValue) { >>> - CallSiteValue = NextCallSiteValue++; >>> - PadSites[LandingPad] = CallSiteValue; >>> - // Add a switch case to our unwind block. The runtime >>> comes back >>> - // to the dispatcher with the call_site - 1 in the >>> context. Odd, >>> - // but there it is. >>> - ConstantInt *SwitchValC = >>> - ConstantInt::get(Type::getInt32Ty((*I)->getContext()), >>> - CallSiteValue - 1); >>> - DispatchSwitch->addCase(SwitchValC, (*I)->getUnwindDest()); >>> - } >>> - markInvokeCallSite(*I, CallSiteValue, CallSite); >>> - } >>> + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) >>> + markInvokeCallSite(Invokes[i], i+1, CallSite, >>> DispatchSwitch); >>> >>> // The front end has likely added calls to _Unwind_Resume. We need >>> // to find those calls and mark the call_site as -1 immediately >>> prior. >>> @@ -515,13 +508,6 @@ >>> Unwinds[i]->eraseFromParent(); >>> } >>> >>> - // Scan the whole function for values that are live across >>> unwind edges. >>> - // Each value that is live across an unwind edge we spill >>> into a stack >>> - // location, guaranteeing that there is nothing live across >>> the unwind >>> - // edge. This process also splits all critical edges coming >>> out of >>> - // invoke's. >>> - splitLiveRangesLiveAcrossInvokes(Invokes); >>> - >>> // Finally, for any returns from this function, if this function >>> contains an >>> // invoke, add a call to unregister the function context. >>> for (unsigned i = 0, e = Returns.size(); i != e; ++i) >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > From wendling at apple.com Mon Aug 31 12:52:14 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 31 Aug 2009 10:52:14 -0700 Subject: [llvm-commits] [llvm] r80592 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <4A9C006C.5020004@free.fr> References: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> <4A9C006C.5020004@free.fr> Message-ID: <4E4329A8-F482-4816-A974-31913C10C0E4@apple.com> On Aug 31, 2009, at 9:55 AM, Duncan Sands wrote: >>> Revert commit 80428. It completely broke exception >>> handling on x86-32 linux. >> >> For poor Bill's knowledge, what happened? > > It looks like exceptions were not being caught anymore. > Basically every test in the Ada testsuite failed due > to uncaught exceptions. > Hi Duncan, Could you send .s files before and after the patch for one of the tests that fails? Please use -dA to generate the .s. -bw From dalej at apple.com Mon Aug 31 13:05:23 2009 From: dalej at apple.com (Dale Johannesen) Date: Mon, 31 Aug 2009 18:05:23 -0000 Subject: [llvm-commits] [llvm] r80598 - in /llvm/trunk/test/FrontendObjC: 2009-04-14-AsmSection.m 2009-04-27-bitfield-vs-ivar.m 2009-08-17-DebugInfo.m Message-ID: <200908311805.n7VI5NcX011155@zion.cs.uiuc.edu> Author: johannes Date: Mon Aug 31 13:05:23 2009 New Revision: 80598 URL: http://llvm.org/viewvc/llvm-project?rev=80598&view=rev Log: Fix some misspellings of XTARGET. Modified: llvm/trunk/test/FrontendObjC/2009-04-14-AsmSection.m llvm/trunk/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Modified: llvm/trunk/test/FrontendObjC/2009-04-14-AsmSection.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-04-14-AsmSection.m?rev=80598&r1=80597&r2=80598&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2009-04-14-AsmSection.m (original) +++ llvm/trunk/test/FrontendObjC/2009-04-14-AsmSection.m Mon Aug 31 13:05:23 2009 @@ -1,6 +1,6 @@ // RUN: %llvmgcc -S %s -fobjc-abi-version=2 -emit-llvm -o %t // RUN: grep {OBJC_CLASS_\\\$_A.*section.*__DATA, __objc_data.*align} %t -// XTARGETS: darwin +// XTARGET: darwin @interface A @end Modified: llvm/trunk/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m?rev=80598&r1=80597&r2=80598&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m (original) +++ llvm/trunk/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m Mon Aug 31 13:05:23 2009 @@ -2,7 +2,7 @@ // RUN: grep {OBJC_CLASS_RO_\\\$_I4} %t | grep {i32 0, i32 1, i32 2, i32 0} // RUN: grep {OBJC_CLASS_RO_\\\$_I2} %t | grep {i32 0, i32 1, i32 1, i32 0} // RUN: grep {OBJC_CLASS_RO_\\\$_I5} %t | grep {i32 0, i32 0, i32 0, i32 0} -// XTARGETS: darwin +// XTARGET: darwin // Test instance variable sizing when base class ends in bitfield @interface I3 { Modified: llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m?rev=80598&r1=80597&r2=80598&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m (original) +++ llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Mon Aug 31 13:05:23 2009 @@ -6,7 +6,7 @@ // RUN: echo {break randomFunc\n} > %t.in // RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ // RUN: grep {Breakpoint 1 at 0x.*: file 2009-08-17-DebugInfo.m, line 21} -// XTARGETS: darwin +// XTARGET: darwin @interface MyClass { int my; From jonz at apple.com Mon Aug 31 13:11:00 2009 From: jonz at apple.com (Jon Ziegler) Date: Mon, 31 Aug 2009 18:11:00 -0000 Subject: [llvm-commits] [llvm] r80599 - /llvm/tags/Apple/llvmCore-2205/ Message-ID: <200908311811.n7VIB096011866@zion.cs.uiuc.edu> Author: jonz Date: Mon Aug 31 13:11:00 2009 New Revision: 80599 URL: http://llvm.org/viewvc/llvm-project?rev=80599&view=rev Log: Creating llvmCore-2205 branch Added: llvm/tags/Apple/llvmCore-2205/ - copied from r80598, llvm/branches/Apple/Bender-SWB/ From jonz at apple.com Mon Aug 31 13:25:46 2009 From: jonz at apple.com (Jon Ziegler) Date: Mon, 31 Aug 2009 18:25:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80600 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2205/ Message-ID: <200908311825.n7VIPkHj013772@zion.cs.uiuc.edu> Author: jonz Date: Mon Aug 31 13:25:46 2009 New Revision: 80600 URL: http://llvm.org/viewvc/llvm-project?rev=80600&view=rev Log: Creating llvmgcc42-2205 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2205/ - copied from r80599, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From isanbard at gmail.com Mon Aug 31 13:26:48 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 31 Aug 2009 18:26:48 -0000 Subject: [llvm-commits] [llvm] r80601 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200908311826.n7VIQmc5013916@zion.cs.uiuc.edu> Author: void Date: Mon Aug 31 13:26:48 2009 New Revision: 80601 URL: http://llvm.org/viewvc/llvm-project?rev=80601&view=rev Log: Output a hex value, because all of the others are hex. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80601&r1=80600&r2=80601&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 31 13:26:48 2009 @@ -826,7 +826,7 @@ std::string GLN; O << Asm->getGlobalLinkName(GV, GLN); } else { - O << "0"; + O << "0x0"; } Asm->EOL("TypeInfo"); From mrs at apple.com Mon Aug 31 13:32:15 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 31 Aug 2009 11:32:15 -0700 Subject: [llvm-commits] [PATCH] x86_64 detection and building on 10.6 In-Reply-To: <638514FD-A5C8-407C-B5F7-778283024822@fallingsnow.net> References: <638514FD-A5C8-407C-B5F7-778283024822@fallingsnow.net> Message-ID: <44B13E8C-5C13-47AB-9F45-B07E1ECAAD30@apple.com> On Aug 30, 2009, at 12:31 PM, Evan Phoenix wrote: > Currently, it's not possible to build LLVM and link it against > something compiled by default on 10.6, since LLVM forces itself to > build 32bit only, and 10.6 defaults to compile 64bit by default. Not quite right: $ gcc -arch ppc64 -E -dM -x c /dev/null -o - | grep LP64 #define __LP64__ 1 #define _LP64 1 If you check uname -m and if it says i386, then this is safe to do. I support the general idea however. From dpatel at apple.com Mon Aug 31 13:49:10 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 18:49:10 -0000 Subject: [llvm-commits] [llvm] r80602 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/Target/PIC16/PIC16DebugInfo.cpp Message-ID: <200908311849.n7VInBLD016652@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 13:49:10 2009 New Revision: 80602 URL: http://llvm.org/viewvc/llvm-project?rev=80602&view=rev Log: Simplify isDerivedType() and other predicate interface. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80602&r1=80601&r2=80602&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 13:49:10 2009 @@ -87,6 +87,13 @@ /// dump - print descriptor. void dump() const; + + bool isDerivedType() const; + bool isCompositeType() const; + bool isBasicType() const; + bool isVariable() const; + bool isSubprogram() const; + bool isGlobalVariable() const; }; /// DISubrange - This is used to represent ranges, for array bounds. @@ -185,19 +192,6 @@ DIType(MDNode *N, bool, bool) : DIDescriptor(N) {} public: - /// isDerivedType - Return true if the specified tag is legal for - /// DIDerivedType. - static bool isDerivedType(unsigned TAG); - - /// isCompositeType - Return true if the specified tag is legal for - /// DICompositeType. - static bool isCompositeType(unsigned TAG); - - /// isBasicType - Return true if the specified tag is legal for - /// DIBasicType. - static bool isBasicType(unsigned TAG) { - return TAG == dwarf::DW_TAG_base_type; - } /// Verify - Verify that a type descriptor is well formed. bool Verify() const; @@ -257,7 +251,7 @@ public: explicit DIDerivedType(MDNode *N = 0) : DIType(N, true, true) { - if (DbgNode && !isDerivedType(getTag())) + if (DbgNode && !isDerivedType()) DbgNode = 0; } @@ -282,7 +276,7 @@ public: explicit DICompositeType(MDNode *N = 0) : DIDerivedType(N, true, true) { - if (N && !isCompositeType(getTag())) + if (N && !isCompositeType()) DbgNode = 0; } @@ -302,18 +296,6 @@ explicit DIGlobal(MDNode *N, unsigned RequiredTag) : DIDescriptor(N, RequiredTag) {} - /// isSubprogram - Return true if the specified tag is legal for - /// DISubprogram. - static bool isSubprogram(unsigned TAG) { - return TAG == dwarf::DW_TAG_subprogram; - } - - /// isGlobalVariable - Return true if the specified tag is legal for - /// DIGlobalVariable. - static bool isGlobalVariable(unsigned TAG) { - return TAG == dwarf::DW_TAG_variable; - } - public: virtual ~DIGlobal() {} @@ -393,7 +375,7 @@ public: explicit DIVariable(MDNode *N = 0) : DIDescriptor(N) { - if (DbgNode && !isVariable(getTag())) + if (DbgNode && !isVariable()) DbgNode = 0; } @@ -405,8 +387,6 @@ unsigned getLineNumber() const { return getUnsignedField(4); } DIType getType() const { return getFieldAs(5); } - /// isVariable - Return true if the specified tag is legal for DIVariable. - static bool isVariable(unsigned Tag); /// Verify - Verify that a variable descriptor is well formed. bool Verify() const; Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80602&r1=80601&r2=80602&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 13:49:10 2009 @@ -124,22 +124,23 @@ } //===----------------------------------------------------------------------===// -// Simple Descriptor Constructors and other Methods +// Predicates //===----------------------------------------------------------------------===// -// Needed by DIVariable::getType(). -DIType::DIType(MDNode *N) : DIDescriptor(N) { - if (!N) return; - unsigned tag = getTag(); - if (tag != dwarf::DW_TAG_base_type && !DIDerivedType::isDerivedType(tag) && - !DICompositeType::isCompositeType(tag)) { - DbgNode = 0; - } +/// isBasicType - Return true if the specified tag is legal for +/// DIBasicType. +bool DIDescriptor::isBasicType() const { + assert (isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + return Tag == dwarf::DW_TAG_base_type; } -/// isDerivedType - Return true if the specified tag is legal for -/// DIDerivedType. -bool DIType::isDerivedType(unsigned Tag) { +/// isDerivedType - Return true if the specified tag is legal for DIDerivedType. +bool DIDescriptor::isDerivedType() const { + assert (isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + switch (Tag) { case dwarf::DW_TAG_typedef: case dwarf::DW_TAG_pointer_type: @@ -152,14 +153,17 @@ return true; default: // CompositeTypes are currently modelled as DerivedTypes. - return isCompositeType(Tag); + return isCompositeType(); } } /// isCompositeType - Return true if the specified tag is legal for /// DICompositeType. -bool DIType::isCompositeType(unsigned TAG) { - switch (TAG) { +bool DIDescriptor::isCompositeType() const { + assert (isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + switch (Tag) { case dwarf::DW_TAG_array_type: case dwarf::DW_TAG_structure_type: case dwarf::DW_TAG_union_type: @@ -174,7 +178,10 @@ } /// isVariable - Return true if the specified tag is legal for DIVariable. -bool DIVariable::isVariable(unsigned Tag) { +bool DIDescriptor::isVariable() const { + assert (isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + switch (Tag) { case dwarf::DW_TAG_auto_variable: case dwarf::DW_TAG_arg_variable: @@ -185,6 +192,36 @@ } } +/// isSubprogram - Return true if the specified tag is legal for +/// DISubprogram. +bool DIDescriptor::isSubprogram() const { + assert (isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + return Tag == dwarf::DW_TAG_subprogram; +} + +/// isGlobalVariable - Return true if the specified tag is legal for +/// DIGlobalVariable. +bool DIDescriptor::isGlobalVariable() const { + assert (isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + return Tag == dwarf::DW_TAG_variable; +} + + +//===----------------------------------------------------------------------===// +// Simple Descriptor Constructors and other Methods +//===----------------------------------------------------------------------===// + +DIType::DIType(MDNode *N) : DIDescriptor(N) { + if (!N) return; + if (!isBasicType() && !isDerivedType() && !isCompositeType()) { + DbgNode = 0; + } +} + unsigned DIArray::getNumElements() const { assert (DbgNode && "Invalid DIArray"); return DbgNode->getNumElements(); @@ -366,11 +403,11 @@ if (isForwardDecl()) errs() << " [fwd] "; - if (isBasicType(Tag)) + if (isBasicType()) DIBasicType(DbgNode).dump(); - else if (isDerivedType(Tag)) + else if (isDerivedType()) DIDerivedType(DbgNode).dump(); - else if (isCompositeType(Tag)) + else if (isCompositeType()) DICompositeType(DbgNode).dump(); else { errs() << "Invalid DIType\n"; @@ -417,7 +454,7 @@ if (isDefinition()) errs() << " [def] "; - if (isGlobalVariable(Tag)) + if (isGlobalVariable()) DIGlobalVariable(DbgNode).dump(); errs() << "\n"; @@ -818,7 +855,7 @@ return; addCompileUnit(DT.getCompileUnit()); - if (DT.isCompositeType(DT.getTag())) { + if (DT.isCompositeType()) { DICompositeType DCT(DT.getNode()); processType(DCT.getTypeDerivedFrom()); DIArray DA = DCT.getTypeArray(); @@ -831,7 +868,7 @@ else processSubprogram(DISubprogram(D.getNode())); } - } else if (DT.isDerivedType(DT.getTag())) { + } else if (DT.isDerivedType()) { DIDerivedType DDT(DT.getNode()); if (!DDT.isNull()) processType(DDT.getTypeDerivedFrom()); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=80602&r1=80601&r2=80602&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 31 13:49:10 2009 @@ -547,12 +547,12 @@ // Construct type. DIE Buffer(dwarf::DW_TAG_base_type); - if (Ty.isBasicType(Ty.getTag())) + if (Ty.isBasicType()) ConstructTypeDIE(DW_Unit, Buffer, DIBasicType(Ty.getNode())); - else if (Ty.isCompositeType(Ty.getTag())) + else if (Ty.isCompositeType()) ConstructTypeDIE(DW_Unit, Buffer, DICompositeType(Ty.getNode())); else { - assert(Ty.isDerivedType(Ty.getTag()) && "Unknown kind of DIType"); + assert(Ty.isDerivedType() && "Unknown kind of DIType"); ConstructTypeDIE(DW_Unit, Buffer, DIDerivedType(Ty.getNode())); } Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=80602&r1=80601&r2=80602&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Mon Aug 31 13:49:10 2009 @@ -28,11 +28,11 @@ void PIC16DbgInfo::PopulateDebugInfo (DIType Ty, unsigned short &TypeNo, bool &HasAux, int Aux[], std::string &TagName) { - if (Ty.isBasicType(Ty.getTag())) + if (Ty.isBasicType()) PopulateBasicTypeInfo (Ty, TypeNo); - else if (Ty.isDerivedType(Ty.getTag())) + else if (Ty.isDerivedType()) PopulateDerivedTypeInfo (Ty, TypeNo, HasAux, Aux, TagName); - else if (Ty.isCompositeType(Ty.getTag())) + else if (Ty.isCompositeType()) PopulateCompositeTypeInfo (Ty, TypeNo, HasAux, Aux, TagName); else { TypeNo = PIC16Dbg::T_NULL; From edwintorok at gmail.com Mon Aug 31 14:04:40 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 31 Aug 2009 22:04:40 +0300 Subject: [llvm-commits] [llvm] r80589 - /llvm/trunk/lib/System/DynamicLibrary.cpp In-Reply-To: References: <200908311612.n7VGCUVg029338@zion.cs.uiuc.edu> Message-ID: <4A9C1EC8.7010509@gmail.com> On 2009-08-31 20:06, Chris Lattner wrote: > > On Aug 31, 2009, at 9:12 AM, Torok Edwin wrote: > >> Author: edwin >> Date: Mon Aug 31 11:12:29 2009 >> New Revision: 80589 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80589&view=rev >> Log: >> Fix ExplicitSymbols leak. > > Edwin, can this be a ManagedStatic, or something else that doesn't > have a static ctor/dtor? Thought about it, but there are 2 issues: - AddSymbol is called from a static constructor in another file: ExecutionEngine/JIT/Intercept.cpp (the fstat workaround for Linux). - using ManagedStatic in System would create a circular dep between Support and System, llvm-config doesn't like that I only added a static destructor, ExplicitSymbols is still created on first use, when needed, so there is no static constructor currently :) Best regards, --Edwin From daniel at zuster.org Mon Aug 31 14:08:12 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 12:08:12 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> Message-ID: <6a8523d60908311208g64ac4743sf4de340387c9227f@mail.gmail.com> Hi Jim, This caused the llvm-gcc-i386-darwin9 bootstrap to start failing. The failures are the same as are currently on llvm-gcc-powerpc-darwin9 (which are the same as I see when building a local llvm-gcc-x86_64-darwin10 bootstrap). Unfortunately the llvm-gcc-powerpc-darwin9 failures started while the buildbot was restarting, so I don't know exactly what is going on. I believe this is somehow related to the instcombine changes, so your change may have just caused llvm-gcc-i386-darwin9 to start hitting something it wasn't before. At this point I don't know whats up with the llvm-gcc bootstrap builds but I would like the to get resolved ASAP. Can you talk to Chris about where he is at on this and maybe take a look? - Daniel On Mon, Aug 31, 2009 at 9:11 AM, Jim Grosbach wrote: > Author: grosbach > Date: Mon Aug 31 11:11:29 2009 > New Revision: 80588 > > URL: http://llvm.org/viewvc/llvm-project?rev=80588&view=rev > Log: > Cleanup of cruft left over from front-end sjlj bits. No longer necessary with the EH handled in the back end. > > Modified: > ? ?llvm-gcc-4.2/trunk/gcc/c-decl.c > ? ?llvm-gcc-4.2/trunk/gcc/cp/except.c > ? ?llvm-gcc-4.2/trunk/gcc/except.c > ? ?llvm-gcc-4.2/trunk/gcc/except.h > ? ?llvm-gcc-4.2/trunk/gcc/libfuncs.h > ? ?llvm-gcc-4.2/trunk/gcc/llvm-internal.h > ? ?llvm-gcc-4.2/trunk/gcc/objc/objc-act.c > > Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) > +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Mon Aug 31 11:11:29 2009 > @@ -3586,10 +3586,6 @@ > ? ? = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? "__gcc_personality_sj0" > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?: "__gcc_personality_v0"); > - ?llvm_unwind_sjlj_register_libfunc > - ? ?= llvm_init_one_libfunc ("_Unwind_SjLj_Register"); > - ?llvm_unwind_sjlj_unregister_libfunc > - ? ?= llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); > ?#else > ? eh_personality_libfunc > ? ? = init_one_libfunc (USING_SJLJ_EXCEPTIONS > > Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/cp/except.c (original) > +++ llvm-gcc-4.2/trunk/gcc/cp/except.c Mon Aug 31 11:11:29 2009 > @@ -97,10 +97,6 @@ > ? ? = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? "__gxx_personality_sj0" > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?: "__gxx_personality_v0"); > - ?llvm_unwind_sjlj_register_libfunc > - ? ?= llvm_init_one_libfunc ("_Unwind_SjLj_Register"); > - ?llvm_unwind_sjlj_unregister_libfunc > - ? ?= llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); > ?#else > ? eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "__gxx_personality_sj0" > > Modified: llvm-gcc-4.2/trunk/gcc/except.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/except.c (original) > +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 > @@ -115,21 +115,12 @@ > ? htab_t type_to_runtime_map; > > ?/* Describe the SjLj_Function_Context structure. ?*/ > -#ifndef ENABLE_LLVM > ?static GTY(()) tree sjlj_fc_type_node; > ?static int sjlj_fc_call_site_ofs; > ?static int sjlj_fc_data_ofs; > ?static int sjlj_fc_personality_ofs; > ?static int sjlj_fc_lsda_ofs; > ?static int sjlj_fc_jbuf_ofs; > -#else > -tree sjlj_fc_type_node; > -int sjlj_fc_call_site_ofs; > -int sjlj_fc_data_ofs; > -int sjlj_fc_personality_ofs; > -int sjlj_fc_lsda_ofs; > -int sjlj_fc_jbuf_ofs; > -#endif > > ?/* Describes one exception region. ?*/ > ?struct eh_region GTY(()) > @@ -285,7 +276,7 @@ > ?static hashval_t ehspec_filter_hash (const void *); > ?static int add_ttypes_entry (htab_t, tree); > ?static int add_ehspec_entry (htab_t, htab_t, tree); > -/*static void assign_filter_values (void); */ > +static void assign_filter_values (void); > ?static void build_post_landing_pads (void); > ?static void connect_post_landing_pads (void); > ?static void dw2_build_landing_pads (void); > @@ -1385,7 +1376,7 @@ > ? ?we use lots of landing pads, and so every type or list can share > ? ?the same filter value, which saves table space. ?*/ > > -/*static*/ void > +static void > ?assign_filter_values (void) > ?{ > ? int i; > > Modified: llvm-gcc-4.2/trunk/gcc/except.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.h?rev=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/except.h (original) > +++ llvm-gcc-4.2/trunk/gcc/except.h Mon Aug 31 11:11:29 2009 > @@ -57,7 +57,6 @@ > ?/* After initial rtl generation, call back to finish generating > ? ?exception support code. ?*/ > ?extern void finish_eh_generation (void); > -extern void assign_filter_values (void); > > ?extern void init_eh (void); > ?extern void init_eh_for_function (void); > @@ -125,13 +124,6 @@ > ?extern struct eh_region *get_eh_region (unsigned); > ?extern tree get_eh_type_list (struct eh_region *); > ?extern tree lookup_type_for_runtime (tree); > - > -extern GTY(()) tree sjlj_fc_type_node; > -extern int sjlj_fc_call_site_ofs; > -extern int sjlj_fc_data_ofs; > -extern int sjlj_fc_personality_ofs; > -extern int sjlj_fc_lsda_ofs; > -extern int sjlj_fc_jbuf_ofs; > ?#endif > ?/* LLVM local end */ > > > Modified: llvm-gcc-4.2/trunk/gcc/libfuncs.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libfuncs.h?rev=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/libfuncs.h (original) > +++ llvm-gcc-4.2/trunk/gcc/libfuncs.h Mon Aug 31 11:11:29 2009 > @@ -82,15 +82,9 @@ > ?#ifdef ENABLE_LLVM > ?#define llvm_unwind_resume_libfunc ? ? (llvm_libfunc_table[LTI_unwind_resume]) > ?#define llvm_eh_personality_libfunc ? ?(llvm_libfunc_table[LTI_eh_personality]) > -#define llvm_unwind_sjlj_register_libfunc \ > - ?(llvm_libfunc_table[LTI_unwind_sjlj_register]) > -#define llvm_unwind_sjlj_unregister_libfunc \ > - ?(llvm_libfunc_table[LTI_unwind_sjlj_unregister]) > ?#else > ?#define llvm_unwind_resume_libfunc ? ? unwind_resume_libfunc > ?#define llvm_eh_personality_libfunc ? ?eh_personality_libfunc > -#define llvm_unwind_sjlj_register_libfunc unwind_sjlj_register_libfunc > -#define llvm_unwind_sjlj_unregister_libfunc unwind_sjlj_unregister_libfunc > ?#endif > ?/* LLVM LOCAL end */ > > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 31 11:11:29 2009 > @@ -448,12 +448,6 @@ > ? Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align); > ? Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align); > > - ?/// EmitSjLjDispatcher - Emit SJLJ EH dispatcher > - ?void EmitSjLjDispatcher(); > - > - ?/// EmitSjLjLandingPads - Emit SJLJ EH landing pads. > - ?void EmitSjLjLandingPads(); > - > ? /// EmitLandingPads - Emit EH landing pads. > ? void EmitLandingPads(); > > > 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=80588&r1=80587&r2=80588&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) > +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Aug 31 11:11:29 2009 > @@ -8291,10 +8291,6 @@ > ?#ifdef ENABLE_LLVM > ? ? ? llvm_eh_personality_libfunc > ? ? ? ? = llvm_init_one_libfunc ("__objc_personality_v0"); > - ? ? ?llvm_unwind_sjlj_register_libfunc > - ? ? ? ?= llvm_init_one_libfunc ("_Unwind_SjLj_Register"); > - ? ? ?llvm_unwind_sjlj_unregister_libfunc > - ? ? ? ?= llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); > ?#else > ? ? ? eh_personality_libfunc > ? ? ? ? = init_one_libfunc ("__objc_personality_v0"); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Mon Aug 31 14:13:48 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 19:13:48 -0000 Subject: [llvm-commits] [llvm] r80603 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Message-ID: <200908311913.n7VJDmQw019820@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 14:13:47 2009 New Revision: 80603 URL: http://llvm.org/viewvc/llvm-project?rev=80603&view=rev Log: Avoid unnecessary +0 in experimental-asm-printer. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=80603&r1=80602&r2=80603&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 31 14:13:47 2009 @@ -802,9 +802,10 @@ Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(NegatedSymbol, OutContext), OutContext); - Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(), - OutContext), - OutContext); + if (MO.getOffset()) + Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(), + OutContext), + OutContext); return MCOperand::CreateExpr(Expr); } @@ -819,10 +820,12 @@ MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name); // FIXME: We would like an efficient form for this, so we don't have to do a // lot of extra uniquing. - const MCExpr *Expr = - MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, OutContext), - MCConstantExpr::Create(MO.getOffset(),OutContext), - OutContext); + const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, OutContext); + if (MO.getOffset()) + Expr = MCBinaryExpr::CreateAdd(Expr, + MCConstantExpr::Create(MO.getOffset(), + OutContext), + OutContext); return MCOperand::CreateExpr(Expr); } From daniel at zuster.org Mon Aug 31 14:13:56 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 19:13:56 -0000 Subject: [llvm-commits] [llvm] r80604 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Message-ID: <200908311913.n7VJDurr019848@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 14:13:56 2009 New Revision: 80604 URL: http://llvm.org/viewvc/llvm-project?rev=80604&view=rev Log: Stop printing old asm printing code inline with -experimental-asm-printer (this allows diffing and assembling the .s) Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=80604&r1=80603&r2=80604&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 31 14:13:56 2009 @@ -880,15 +880,10 @@ TmpInst.setOpcode(X86::POP32r); TmpInst.getOperand(0) = MCOperand::CreateReg(MI->getOperand(0).getReg()); printInstruction(&TmpInst); - O << "OLD: "; - // Call the autogenerated instruction printer routines. - printInstruction(MI); return; } } - O << "NEW: "; - TmpInst.setOpcode(MI->getOpcode()); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { @@ -930,10 +925,6 @@ // FIXME: Convert TmpInst. printInstruction(&TmpInst); - O << "OLD: "; - - // Call the autogenerated instruction printer routines. - printInstruction(MI); } void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { From daniel at zuster.org Mon Aug 31 14:14:06 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 31 Aug 2009 19:14:06 -0000 Subject: [llvm-commits] [llvm] r80605 - in /llvm/trunk/lib/Target/X86/AsmPrinter: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h Message-ID: <200908311914.n7VJE6n7019876@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 14:14:05 2009 New Revision: 80605 URL: http://llvm.org/viewvc/llvm-project?rev=80605&view=rev Log: X86/exp-asm-printer: Lower MachineOperand::MO_JumpTableIndex to MCOperand. - Down to 7 failures on 403.gcc. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=80605&r1=80604&r2=80605&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 31 14:14:05 2009 @@ -24,6 +24,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Type.h" +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Assembly/Writer.h" @@ -810,7 +811,7 @@ } MCOperand X86ATTAsmPrinter:: -LowerExternalSymbolOperand(const MachineOperand &MO){ +LowerExternalSymbolOperand(const MachineOperand &MO) { std::string Name = Mang->makeNameProper(MO.getSymbolName()); if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) { FnStubs[Name+"$stub"] = Name; @@ -829,6 +830,35 @@ return MCOperand::CreateExpr(Expr); } +MCOperand X86ATTAsmPrinter::LowerJumpTableOperand(const MachineOperand &MO) { + SmallString<256> Name; + raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "JTI" + << getFunctionNumber() << '_' << MO.getIndex(); + + MCSymbol *NegatedSymbol = 0; + switch (MO.getTargetFlags()) { + default: + llvm_unreachable("Unknown target flag on GV operand"); + case X86II::MO_PIC_BASE_OFFSET: + case X86II::MO_DARWIN_NONLAZY_PIC_BASE: + case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: + // Subtract the pic base. + NegatedSymbol = GetPICBaseSymbol(); + break; + } + + // Create a symbol for the name. + MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name.str()); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, OutContext); + if (NegatedSymbol) + Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(NegatedSymbol, + OutContext), + OutContext); + return MCOperand::CreateExpr(Expr); +} + /// printMachineInstruction -- Print out a single X86 LLVM instruction MI in /// AT&T syntax to the current output stream. @@ -895,6 +925,9 @@ O.flush(); errs() << "Cannot lower operand #" << i << " of :" << *MI; llvm_unreachable("Unimp"); + case MachineOperand::MO_JumpTableIndex: + MCOp = LowerJumpTableOperand(MO); + break; case MachineOperand::MO_Register: MCOp = MCOperand::CreateReg(MO.getReg()); break; Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=80605&r1=80604&r2=80605&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Mon Aug 31 14:14:05 2009 @@ -69,6 +69,7 @@ // New MCInst printing stuff. void printInstruction(const MCInst *MI); MCSymbol *GetPICBaseSymbol(); + MCOperand LowerJumpTableOperand(const MachineOperand &MO); MCOperand LowerGlobalAddressOperand(const MachineOperand &MO); MCOperand LowerExternalSymbolOperand(const MachineOperand &MO); From baldrick at free.fr Mon Aug 31 14:18:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 21:18:16 +0200 Subject: [llvm-commits] [llvm] r80592 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <4E4329A8-F482-4816-A974-31913C10C0E4@apple.com> References: <200908311645.n7VGjH8b000977@zion.cs.uiuc.edu> <4A9C006C.5020004@free.fr> <4E4329A8-F482-4816-A974-31913C10C0E4@apple.com> Message-ID: <4A9C21F8.8010700@free.fr> Hi Bill, > Could you send .s files before and after the patch for one of the tests > that fails? Please use -dA to generate the .s. no problem. Here are the changes that make good into bad: .uleb128 7 .byte 0x1B .long __gnat_eh_personality-. - .byte 0x1B - .byte 0x1B + .byte 0xB + .byte 0xB .byte 0xC .uleb128 4 .uleb128 4 Ciao, Duncan. From edwintorok at gmail.com Mon Aug 31 14:44:41 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 31 Aug 2009 22:44:41 +0300 Subject: [llvm-commits] [llvm] r80602 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/Target/PIC16/PIC16DebugInfo.cpp In-Reply-To: <200908311849.n7VInBLD016652@zion.cs.uiuc.edu> References: <200908311849.n7VInBLD016652@zion.cs.uiuc.edu> Message-ID: <4A9C2829.9020808@gmail.com> On 2009-08-31 21:49, Devang Patel wrote: > Author: dpatel > Date: Mon Aug 31 13:49:10 2009 > New Revision: 80602 > > URL: http://llvm.org/viewvc/llvm-project?rev=80602&view=rev > Log: > Simplify isDerivedType() and other predicate interface. > > Hi Devang, This broke clang -g on x86_64 linux, see the buildbot: http://google1.osuosl.org:8011/builders/clang-x86_64-linux/builds/4560 It fails with this assertion failure: clang-cc: DebugInfo.cpp:182: bool llvm::DIDescriptor::isVariable() const: Assertion `isNull() && "Invalid descriptor!"' failed. Best regards, --Edwin From evan.cheng at apple.com Mon Aug 31 15:02:46 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 31 Aug 2009 13:02:46 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: <6a8523d60908311208g64ac4743sf4de340387c9227f@mail.gmail.com> References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> <6a8523d60908311208g64ac4743sf4de340387c9227f@mail.gmail.com> Message-ID: <2718B13E-6AC0-415B-AE85-23096C19567C@apple.com> Hrm. How is bootstrapping breaking? I find it hard to believe this particular patch can break bootstrapping. Evan On Aug 31, 2009, at 12:08 PM, Daniel Dunbar wrote: > Hi Jim, > > This caused the llvm-gcc-i386-darwin9 bootstrap to start failing. The > failures are the same as are currently on llvm-gcc-powerpc-darwin9 > (which are the same as I see when building a local > llvm-gcc-x86_64-darwin10 bootstrap). > > Unfortunately the llvm-gcc-powerpc-darwin9 failures started while the > buildbot was restarting, so I don't know exactly what is going on. I > believe this is somehow related to the instcombine changes, so your > change may have just caused llvm-gcc-i386-darwin9 to start hitting > something it wasn't before. > > At this point I don't know whats up with the llvm-gcc bootstrap builds > but I would like the to get resolved ASAP. Can you talk to Chris about > where he is at on this and maybe take a look? > > - Daniel > > On Mon, Aug 31, 2009 at 9:11 AM, Jim Grosbach > wrote: >> Author: grosbach >> Date: Mon Aug 31 11:11:29 2009 >> New Revision: 80588 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80588&view=rev >> Log: >> Cleanup of cruft left over from front-end sjlj bits. No longer >> necessary with the EH handled in the back end. >> >> Modified: >> llvm-gcc-4.2/trunk/gcc/c-decl.c >> llvm-gcc-4.2/trunk/gcc/cp/except.c >> llvm-gcc-4.2/trunk/gcc/except.c >> llvm-gcc-4.2/trunk/gcc/except.h >> llvm-gcc-4.2/trunk/gcc/libfuncs.h >> llvm-gcc-4.2/trunk/gcc/llvm-internal.h >> llvm-gcc-4.2/trunk/gcc/objc/objc-act.c >> >> Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) >> +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Mon Aug 31 11:11:29 2009 >> @@ -3586,10 +3586,6 @@ >> = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS >> ? "__gcc_personality_sj0" >> : "__gcc_personality_v0"); >> - llvm_unwind_sjlj_register_libfunc >> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >> - llvm_unwind_sjlj_unregister_libfunc >> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >> #else >> eh_personality_libfunc >> = init_one_libfunc (USING_SJLJ_EXCEPTIONS >> >> Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/cp/except.c (original) >> +++ llvm-gcc-4.2/trunk/gcc/cp/except.c Mon Aug 31 11:11:29 2009 >> @@ -97,10 +97,6 @@ >> = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS >> ? "__gxx_personality_sj0" >> : "__gxx_personality_v0"); >> - llvm_unwind_sjlj_register_libfunc >> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >> - llvm_unwind_sjlj_unregister_libfunc >> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >> #else >> eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS >> ? "__gxx_personality_sj0" >> >> Modified: llvm-gcc-4.2/trunk/gcc/except.c >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/except.c (original) >> +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 >> @@ -115,21 +115,12 @@ >> htab_t type_to_runtime_map; >> >> /* Describe the SjLj_Function_Context structure. */ >> -#ifndef ENABLE_LLVM >> static GTY(()) tree sjlj_fc_type_node; >> static int sjlj_fc_call_site_ofs; >> static int sjlj_fc_data_ofs; >> static int sjlj_fc_personality_ofs; >> static int sjlj_fc_lsda_ofs; >> static int sjlj_fc_jbuf_ofs; >> -#else >> -tree sjlj_fc_type_node; >> -int sjlj_fc_call_site_ofs; >> -int sjlj_fc_data_ofs; >> -int sjlj_fc_personality_ofs; >> -int sjlj_fc_lsda_ofs; >> -int sjlj_fc_jbuf_ofs; >> -#endif >> >> /* Describes one exception region. */ >> struct eh_region GTY(()) >> @@ -285,7 +276,7 @@ >> static hashval_t ehspec_filter_hash (const void *); >> static int add_ttypes_entry (htab_t, tree); >> static int add_ehspec_entry (htab_t, htab_t, tree); >> -/*static void assign_filter_values (void); */ >> +static void assign_filter_values (void); >> static void build_post_landing_pads (void); >> static void connect_post_landing_pads (void); >> static void dw2_build_landing_pads (void); >> @@ -1385,7 +1376,7 @@ >> we use lots of landing pads, and so every type or list can share >> the same filter value, which saves table space. */ >> >> -/*static*/ void >> +static void >> assign_filter_values (void) >> { >> int i; >> >> Modified: llvm-gcc-4.2/trunk/gcc/except.h >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.h?rev=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/except.h (original) >> +++ llvm-gcc-4.2/trunk/gcc/except.h Mon Aug 31 11:11:29 2009 >> @@ -57,7 +57,6 @@ >> /* After initial rtl generation, call back to finish generating >> exception support code. */ >> extern void finish_eh_generation (void); >> -extern void assign_filter_values (void); >> >> extern void init_eh (void); >> extern void init_eh_for_function (void); >> @@ -125,13 +124,6 @@ >> extern struct eh_region *get_eh_region (unsigned); >> extern tree get_eh_type_list (struct eh_region *); >> extern tree lookup_type_for_runtime (tree); >> - >> -extern GTY(()) tree sjlj_fc_type_node; >> -extern int sjlj_fc_call_site_ofs; >> -extern int sjlj_fc_data_ofs; >> -extern int sjlj_fc_personality_ofs; >> -extern int sjlj_fc_lsda_ofs; >> -extern int sjlj_fc_jbuf_ofs; >> #endif >> /* LLVM local end */ >> >> >> Modified: llvm-gcc-4.2/trunk/gcc/libfuncs.h >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libfuncs.h?rev=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/libfuncs.h (original) >> +++ llvm-gcc-4.2/trunk/gcc/libfuncs.h Mon Aug 31 11:11:29 2009 >> @@ -82,15 +82,9 @@ >> #ifdef ENABLE_LLVM >> #define llvm_unwind_resume_libfunc (llvm_libfunc_table >> [LTI_unwind_resume]) >> #define llvm_eh_personality_libfunc (llvm_libfunc_table >> [LTI_eh_personality]) >> -#define llvm_unwind_sjlj_register_libfunc \ >> - (llvm_libfunc_table[LTI_unwind_sjlj_register]) >> -#define llvm_unwind_sjlj_unregister_libfunc \ >> - (llvm_libfunc_table[LTI_unwind_sjlj_unregister]) >> #else >> #define llvm_unwind_resume_libfunc unwind_resume_libfunc >> #define llvm_eh_personality_libfunc eh_personality_libfunc >> -#define llvm_unwind_sjlj_register_libfunc >> unwind_sjlj_register_libfunc >> -#define llvm_unwind_sjlj_unregister_libfunc >> unwind_sjlj_unregister_libfunc >> #endif >> /* LLVM LOCAL end */ >> >> >> Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) >> +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 31 11:11:29 2009 >> @@ -448,12 +448,6 @@ >> Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, >> unsigned Align); >> Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, >> unsigned Align); >> >> - /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher >> - void EmitSjLjDispatcher(); >> - >> - /// EmitSjLjLandingPads - Emit SJLJ EH landing pads. >> - void EmitSjLjLandingPads(); >> - >> /// EmitLandingPads - Emit EH landing pads. >> void EmitLandingPads(); >> >> >> 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=80588&r1=80587&r2=80588&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) >> +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Aug 31 11:11:29 2009 >> @@ -8291,10 +8291,6 @@ >> #ifdef ENABLE_LLVM >> llvm_eh_personality_libfunc >> = llvm_init_one_libfunc ("__objc_personality_v0"); >> - llvm_unwind_sjlj_register_libfunc >> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >> - llvm_unwind_sjlj_unregister_libfunc >> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >> #else >> eh_personality_libfunc >> = init_one_libfunc ("__objc_personality_v0"); >> >> >> _______________________________________________ >> 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 Mon Aug 31 15:06:52 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 31 Aug 2009 20:06:52 -0000 Subject: [llvm-commits] [llvm] r80611 - /llvm/tags/cremebrulee/ Message-ID: <200908312006.n7VK6qeY026457@zion.cs.uiuc.edu> Author: kremenek Date: Mon Aug 31 15:06:51 2009 New Revision: 80611 URL: http://llvm.org/viewvc/llvm-project?rev=80611&view=rev Log: Creating tag directory. Added: llvm/tags/cremebrulee/ From edwintorok at gmail.com Mon Aug 31 15:10:13 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 31 Aug 2009 23:10:13 +0300 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: <2718B13E-6AC0-415B-AE85-23096C19567C@apple.com> References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> <6a8523d60908311208g64ac4743sf4de340387c9227f@mail.gmail.com> <2718B13E-6AC0-415B-AE85-23096C19567C@apple.com> Message-ID: <4A9C2E25.103@gmail.com> On 2009-08-31 23:02, Evan Cheng wrote: > Hrm. How is bootstrapping breaking? I find it hard to believe this > particular patch can break bootstrapping. > This patch is needed to fix bootstrapping on x86_64 linux, are you sure this is what breaks the darwin build? > Evan > > On Aug 31, 2009, at 12:08 PM, Daniel Dunbar wrote: > > >> Hi Jim, >> >> This caused the llvm-gcc-i386-darwin9 bootstrap to start failing. The >> failures are the same as are currently on llvm-gcc-powerpc-darwin9 >> (which are the same as I see when building a local >> llvm-gcc-x86_64-darwin10 bootstrap). >> >> Unfortunately the llvm-gcc-powerpc-darwin9 failures started while the >> buildbot was restarting, so I don't know exactly what is going on. I >> believe this is somehow related to the instcombine changes, so your >> change may have just caused llvm-gcc-i386-darwin9 to start hitting >> something it wasn't before. >> >> At this point I don't know whats up with the llvm-gcc bootstrap builds >> but I would like the to get resolved ASAP. Can you talk to Chris about >> where he is at on this and maybe take a look? >> >> - Daniel >> >> On Mon, Aug 31, 2009 at 9:11 AM, Jim Grosbach >> wrote: >> >>> Author: grosbach >>> Date: Mon Aug 31 11:11:29 2009 >>> New Revision: 80588 >>> r80588 is needed to bootstrap llvm-gcc 2.6 on x86_64 Linux, without it the bootstrap fails: gtype-desc.c:5862: error: 'sjlj_fc_type_node' undeclared here (not in a function) Without r80588 llvm 2.6 can't bootstrap on x86_64! Best regards, --Edwin From kremenek at apple.com Mon Aug 31 15:10:35 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 31 Aug 2009 20:10:35 -0000 Subject: [llvm-commits] [llvm] r80613 - /llvm/tags/checker/cremebrulee-1/ Message-ID: <200908312010.n7VKAZVM026955@zion.cs.uiuc.edu> Author: kremenek Date: Mon Aug 31 15:10:35 2009 New Revision: 80613 URL: http://llvm.org/viewvc/llvm-project?rev=80613&view=rev Log: Tagging cremebrulee-1. Added: llvm/tags/checker/cremebrulee-1/ - copied from r80612, llvm/trunk/ From evan.cheng at apple.com Mon Aug 31 15:14:07 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 31 Aug 2009 20:14:07 -0000 Subject: [llvm-commits] [llvm] r80615 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb.td test/CodeGen/Thumb2/thumb2-ifcvt2.ll Message-ID: <200908312014.n7VKE77O027444@zion.cs.uiuc.edu> Author: evancheng Date: Mon Aug 31 15:14:07 2009 New Revision: 80615 URL: http://llvm.org/viewvc/llvm-project?rev=80615&view=rev Log: Remove .n suffix for some 16-bit opcodes now that Darwin assembler is fixed. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=80615&r1=80614&r2=80615&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Aug 31 15:14:07 2009 @@ -250,7 +250,7 @@ let isBarrier = 1 in { let isPredicable = 1 in def tB : T1I<(outs), (ins brtarget:$target), IIC_Br, - "b.n $target", [(br bb:$target)]>; + "b $target", [(br bb:$target)]>; // Far jump let Defs = [LR] in @@ -268,7 +268,7 @@ // a two-value operand where a dag node expects two operands. :( let isBranch = 1, isTerminator = 1 in def tBcc : T1I<(outs), (ins brtarget:$target, pred:$cc), IIC_Br, - "b$cc.n $target", + "b$cc $target", [/*(ARMbrcond bb:$target, imm:$cc)*/]>; //===----------------------------------------------------------------------===// @@ -310,10 +310,9 @@ "ldr", " $dst, $addr", []>; // Load tconstpool -// FIXME: Added .n suffix to workaround a Darwin assembler bug. let canFoldAsLoad = 1 in def tLDRpci : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi, - "ldr", ".n $dst, $addr", + "ldr", " $dst, $addr", [(set tGPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>; // Special LDR for loads from non-pc-relative constpools. Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll?rev=80615&r1=80614&r2=80615&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll Mon Aug 31 15:14:07 2009 @@ -31,7 +31,7 @@ ; CHECK: CountTree: ; CHECK: it eq ; CHECK: cmpeq -; CHECK: beq.n +; CHECK: beq ; CHECK: itt eq ; CHECK: moveq ; CHECK: popeq @@ -82,7 +82,7 @@ entry: ; CHECK: t2: ; CHECK: cmp r0, #0 -; CHECK: beq.n +; CHECK: beq br i1 undef, label %bb.i.i3, label %growMapping.exit bb.i.i3: ; preds = %entry From kremenek at apple.com Mon Aug 31 15:21:26 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 31 Aug 2009 20:21:26 -0000 Subject: [llvm-commits] [llvm] r80616 - in /llvm/tags: checker/cremebrulee-1/ cremebrulee/cremebrulee-1/ Message-ID: <200908312021.n7VKLQsK028391@zion.cs.uiuc.edu> Author: kremenek Date: Mon Aug 31 15:21:26 2009 New Revision: 80616 URL: http://llvm.org/viewvc/llvm-project?rev=80616&view=rev Log: This tag was put in the wrong directory. Added: llvm/tags/cremebrulee/cremebrulee-1/ - copied from r80615, llvm/tags/checker/cremebrulee-1/ Removed: llvm/tags/checker/cremebrulee-1/ From dpatel at apple.com Mon Aug 31 15:27:49 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 20:27:49 -0000 Subject: [llvm-commits] [llvm] r80618 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <200908312027.n7VKRnWF029223@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 15:27:49 2009 New Revision: 80618 URL: http://llvm.org/viewvc/llvm-project?rev=80618&view=rev Log: Oops. Fix inverted logic in assertion check. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80618&r1=80617&r2=80618&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 15:27:49 2009 @@ -130,7 +130,7 @@ /// isBasicType - Return true if the specified tag is legal for /// DIBasicType. bool DIDescriptor::isBasicType() const { - assert (isNull() && "Invalid descriptor!"); + assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); return Tag == dwarf::DW_TAG_base_type; @@ -138,7 +138,7 @@ /// isDerivedType - Return true if the specified tag is legal for DIDerivedType. bool DIDescriptor::isDerivedType() const { - assert (isNull() && "Invalid descriptor!"); + assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); switch (Tag) { @@ -160,7 +160,7 @@ /// isCompositeType - Return true if the specified tag is legal for /// DICompositeType. bool DIDescriptor::isCompositeType() const { - assert (isNull() && "Invalid descriptor!"); + assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); switch (Tag) { @@ -179,7 +179,7 @@ /// isVariable - Return true if the specified tag is legal for DIVariable. bool DIDescriptor::isVariable() const { - assert (isNull() && "Invalid descriptor!"); + assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); switch (Tag) { @@ -195,7 +195,7 @@ /// isSubprogram - Return true if the specified tag is legal for /// DISubprogram. bool DIDescriptor::isSubprogram() const { - assert (isNull() && "Invalid descriptor!"); + assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); return Tag == dwarf::DW_TAG_subprogram; @@ -204,7 +204,7 @@ /// isGlobalVariable - Return true if the specified tag is legal for /// DIGlobalVariable. bool DIDescriptor::isGlobalVariable() const { - assert (isNull() && "Invalid descriptor!"); + assert (!isNull() && "Invalid descriptor!"); unsigned Tag = getTag(); return Tag == dwarf::DW_TAG_variable; From dpatel at apple.com Mon Aug 31 15:28:16 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 13:28:16 -0700 Subject: [llvm-commits] [llvm] r80602 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/Target/PIC16/PIC16DebugInfo.cpp In-Reply-To: <4A9C2829.9020808@gmail.com> References: <200908311849.n7VInBLD016652@zion.cs.uiuc.edu> <4A9C2829.9020808@gmail.com> Message-ID: <166DBAE6-1BA2-40D1-AC14-A9CF4AAFC14C@apple.com> On Aug 31, 2009, at 12:44 PM, T?r?k Edwin wrote: > On 2009-08-31 21:49, Devang Patel wrote: >> Author: dpatel >> Date: Mon Aug 31 13:49:10 2009 >> New Revision: 80602 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80602&view=rev >> Log: >> Simplify isDerivedType() and other predicate interface. >> >> > > Hi Devang, > > This broke clang -g on x86_64 linux, see the buildbot: > http://google1.osuosl.org:8011/builders/clang-x86_64-linux/builds/4560 > > It fails with this assertion failure: > clang-cc: DebugInfo.cpp:182: bool llvm::DIDescriptor::isVariable() > const: Assertion `isNull() && "Invalid descriptor!"' failed. > Fixed. - Devang From grosbach at apple.com Mon Aug 31 15:34:50 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 31 Aug 2009 13:34:50 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: <2718B13E-6AC0-415B-AE85-23096C19567C@apple.com> References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> <6a8523d60908311208g64ac4743sf4de340387c9227f@mail.gmail.com> <2718B13E-6AC0-415B-AE85-23096C19567C@apple.com> Message-ID: If it's the same failure I'm looking at, it's a stage2 vs. stage3 comparison failure. There's definitely something odd going on there, and I share the suspicion that it's something unrelated that just happens to be triggered now. I just did a fresh checkout of llvm and llvm-gcc, reverted the two patches the buildbot identifies, and did a clean build. The bootstrap failure is still there. Something else is going on. -jim On Aug 31, 2009, at 1:02 PM, Evan Cheng wrote: > Hrm. How is bootstrapping breaking? I find it hard to believe this > particular patch can break bootstrapping. > > Evan > > On Aug 31, 2009, at 12:08 PM, Daniel Dunbar wrote: > >> Hi Jim, >> >> This caused the llvm-gcc-i386-darwin9 bootstrap to start failing. The >> failures are the same as are currently on llvm-gcc-powerpc-darwin9 >> (which are the same as I see when building a local >> llvm-gcc-x86_64-darwin10 bootstrap). >> >> Unfortunately the llvm-gcc-powerpc-darwin9 failures started while the >> buildbot was restarting, so I don't know exactly what is going on. I >> believe this is somehow related to the instcombine changes, so your >> change may have just caused llvm-gcc-i386-darwin9 to start hitting >> something it wasn't before. >> >> At this point I don't know whats up with the llvm-gcc bootstrap >> builds >> but I would like the to get resolved ASAP. Can you talk to Chris >> about >> where he is at on this and maybe take a look? >> >> - Daniel >> >> On Mon, Aug 31, 2009 at 9:11 AM, Jim Grosbach >> wrote: >>> Author: grosbach >>> Date: Mon Aug 31 11:11:29 2009 >>> New Revision: 80588 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=80588&view=rev >>> Log: >>> Cleanup of cruft left over from front-end sjlj bits. No longer >>> necessary with the EH handled in the back end. >>> >>> Modified: >>> llvm-gcc-4.2/trunk/gcc/c-decl.c >>> llvm-gcc-4.2/trunk/gcc/cp/except.c >>> llvm-gcc-4.2/trunk/gcc/except.c >>> llvm-gcc-4.2/trunk/gcc/except.h >>> llvm-gcc-4.2/trunk/gcc/libfuncs.h >>> llvm-gcc-4.2/trunk/gcc/llvm-internal.h >>> llvm-gcc-4.2/trunk/gcc/objc/objc-act.c >>> >>> Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c >>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) >>> +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Mon Aug 31 11:11:29 2009 >>> @@ -3586,10 +3586,6 @@ >>> = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS >>> ? "__gcc_personality_sj0" >>> : "__gcc_personality_v0"); >>> - llvm_unwind_sjlj_register_libfunc >>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >>> - llvm_unwind_sjlj_unregister_libfunc >>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >>> #else >>> eh_personality_libfunc >>> = init_one_libfunc (USING_SJLJ_EXCEPTIONS >>> >>> Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c >>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/cp/except.c (original) >>> +++ llvm-gcc-4.2/trunk/gcc/cp/except.c Mon Aug 31 11:11:29 2009 >>> @@ -97,10 +97,6 @@ >>> = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS >>> ? "__gxx_personality_sj0" >>> : "__gxx_personality_v0"); >>> - llvm_unwind_sjlj_register_libfunc >>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >>> - llvm_unwind_sjlj_unregister_libfunc >>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >>> #else >>> eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS >>> ? "__gxx_personality_sj0" >>> >>> Modified: llvm-gcc-4.2/trunk/gcc/except.c >>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/except.c (original) >>> +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 >>> @@ -115,21 +115,12 @@ >>> htab_t type_to_runtime_map; >>> >>> /* Describe the SjLj_Function_Context structure. */ >>> -#ifndef ENABLE_LLVM >>> static GTY(()) tree sjlj_fc_type_node; >>> static int sjlj_fc_call_site_ofs; >>> static int sjlj_fc_data_ofs; >>> static int sjlj_fc_personality_ofs; >>> static int sjlj_fc_lsda_ofs; >>> static int sjlj_fc_jbuf_ofs; >>> -#else >>> -tree sjlj_fc_type_node; >>> -int sjlj_fc_call_site_ofs; >>> -int sjlj_fc_data_ofs; >>> -int sjlj_fc_personality_ofs; >>> -int sjlj_fc_lsda_ofs; >>> -int sjlj_fc_jbuf_ofs; >>> -#endif >>> >>> /* Describes one exception region. */ >>> struct eh_region GTY(()) >>> @@ -285,7 +276,7 @@ >>> static hashval_t ehspec_filter_hash (const void *); >>> static int add_ttypes_entry (htab_t, tree); >>> static int add_ehspec_entry (htab_t, htab_t, tree); >>> -/*static void assign_filter_values (void); */ >>> +static void assign_filter_values (void); >>> static void build_post_landing_pads (void); >>> static void connect_post_landing_pads (void); >>> static void dw2_build_landing_pads (void); >>> @@ -1385,7 +1376,7 @@ >>> we use lots of landing pads, and so every type or list can share >>> the same filter value, which saves table space. */ >>> >>> -/*static*/ void >>> +static void >>> assign_filter_values (void) >>> { >>> int i; >>> >>> Modified: llvm-gcc-4.2/trunk/gcc/except.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.h?rev=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/except.h (original) >>> +++ llvm-gcc-4.2/trunk/gcc/except.h Mon Aug 31 11:11:29 2009 >>> @@ -57,7 +57,6 @@ >>> /* After initial rtl generation, call back to finish generating >>> exception support code. */ >>> extern void finish_eh_generation (void); >>> -extern void assign_filter_values (void); >>> >>> extern void init_eh (void); >>> extern void init_eh_for_function (void); >>> @@ -125,13 +124,6 @@ >>> extern struct eh_region *get_eh_region (unsigned); >>> extern tree get_eh_type_list (struct eh_region *); >>> extern tree lookup_type_for_runtime (tree); >>> - >>> -extern GTY(()) tree sjlj_fc_type_node; >>> -extern int sjlj_fc_call_site_ofs; >>> -extern int sjlj_fc_data_ofs; >>> -extern int sjlj_fc_personality_ofs; >>> -extern int sjlj_fc_lsda_ofs; >>> -extern int sjlj_fc_jbuf_ofs; >>> #endif >>> /* LLVM local end */ >>> >>> >>> Modified: llvm-gcc-4.2/trunk/gcc/libfuncs.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libfuncs.h?rev=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/libfuncs.h (original) >>> +++ llvm-gcc-4.2/trunk/gcc/libfuncs.h Mon Aug 31 11:11:29 2009 >>> @@ -82,15 +82,9 @@ >>> #ifdef ENABLE_LLVM >>> #define llvm_unwind_resume_libfunc (llvm_libfunc_table >>> [LTI_unwind_resume]) >>> #define llvm_eh_personality_libfunc (llvm_libfunc_table >>> [LTI_eh_personality]) >>> -#define llvm_unwind_sjlj_register_libfunc \ >>> - (llvm_libfunc_table[LTI_unwind_sjlj_register]) >>> -#define llvm_unwind_sjlj_unregister_libfunc \ >>> - (llvm_libfunc_table[LTI_unwind_sjlj_unregister]) >>> #else >>> #define llvm_unwind_resume_libfunc unwind_resume_libfunc >>> #define llvm_eh_personality_libfunc eh_personality_libfunc >>> -#define llvm_unwind_sjlj_register_libfunc >>> unwind_sjlj_register_libfunc >>> -#define llvm_unwind_sjlj_unregister_libfunc >>> unwind_sjlj_unregister_libfunc >>> #endif >>> /* LLVM LOCAL end */ >>> >>> >>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) >>> +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 31 11:11:29 2009 >>> @@ -448,12 +448,6 @@ >>> Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, >>> unsigned Align); >>> Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, >>> unsigned Align); >>> >>> - /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher >>> - void EmitSjLjDispatcher(); >>> - >>> - /// EmitSjLjLandingPads - Emit SJLJ EH landing pads. >>> - void EmitSjLjLandingPads(); >>> - >>> /// EmitLandingPads - Emit EH landing pads. >>> void EmitLandingPads(); >>> >>> >>> 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=80588&r1=80587&r2=80588&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) >>> +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Aug 31 11:11:29 2009 >>> @@ -8291,10 +8291,6 @@ >>> #ifdef ENABLE_LLVM >>> llvm_eh_personality_libfunc >>> = llvm_init_one_libfunc ("__objc_personality_v0"); >>> - llvm_unwind_sjlj_register_libfunc >>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >>> - llvm_unwind_sjlj_unregister_libfunc >>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >>> #else >>> eh_personality_libfunc >>> = init_one_libfunc ("__objc_personality_v0"); >>> >>> >>> _______________________________________________ >>> 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 baldrick at free.fr Mon Aug 31 15:40:48 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Aug 2009 20:40:48 -0000 Subject: [llvm-commits] [gcc-plugin] r80619 - /gcc-plugin/trunk/Makefile Message-ID: <200908312040.n7VKemv2030857@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 31 15:40:47 2009 New Revision: 80619 URL: http://llvm.org/viewvc/llvm-project?rev=80619&view=rev Log: Use round brackets everywhere rather than curly brackets somewhere. Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=80619&r1=80618&r2=80619&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Mon Aug 31 15:40:47 2009 @@ -16,16 +16,16 @@ CFLAGS+=-Wall -Werror -fPIC -g -O2 CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" \ -DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR) -CFLAGS+=-I${GCCOBJECT_DIR}/gcc -I${GCCOBJECT_DIR}/gcc/include \ - -I${GCCSOURCE_DIR}/gcc -I${GCCSOURCE_DIR}/include \ - -I${GCCSOURCE_DIR}/libcpp/include -I${GCCSOURCE_DIR}/libdecnumber \ - -I${GCCOBJECT_DIR}/libdecnumber -I. +CFLAGS+=-I$(GCCOBJECT_DIR)/gcc -I$(GCCOBJECT_DIR)/gcc/include \ + -I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \ + -I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \ + -I$(GCCOBJECT_DIR)/libdecnumber -I. CXXFLAGS+=$(CFLAGS) $(shell llvm-config --cppflags) LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core ipo scalaropts target x86) llvm.so: $(PLUGIN_OBJECT_FILES) - $(CXX) -shared $^ -o $@ ${LDFLAGS} + $(CXX) -shared $^ -o $@ $(LDFLAGS) clean:: rm -f *.o *.so $(ARCH_DIR)/*.o From dpatel at apple.com Mon Aug 31 15:44:45 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 20:44:45 -0000 Subject: [llvm-commits] [llvm] r80620 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200908312044.n7VKik96031361@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 15:44:45 2009 New Revision: 80620 URL: http://llvm.org/viewvc/llvm-project?rev=80620&view=rev Log: Introduce DIScope. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80620&r1=80619&r2=80620&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 15:44:45 2009 @@ -94,6 +94,7 @@ bool isVariable() const; bool isSubprogram() const; bool isGlobalVariable() const; + bool isScope() const; }; /// DISubrange - This is used to represent ranges, for array bounds. @@ -118,6 +119,15 @@ } }; + /// DIScope - A base class for various scopes. + class DIScope : public DIDescriptor { + public: + explicit DIScope(MDNode *N = 0) : DIDescriptor (N) { + if (DbgNode && !isScope()) + DbgNode = 0; + } + }; + /// DICompileUnit - A wrapper for a compile unit. class DICompileUnit : public DIDescriptor { public: Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80620&r1=80619&r2=80620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 15:44:45 2009 @@ -210,6 +210,22 @@ return Tag == dwarf::DW_TAG_variable; } +/// isScope - Return true if the specified tag is one of the scope +/// related tag. +bool DIDescriptor::isScope() const { + assert (!isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + switch (Tag) { + case dwarf::DW_TAG_compile_unit: + case dwarf::DW_TAG_lexical_block: + case dwarf::DW_TAG_subprogram: + return true; + default: + break; + } + return false; +} //===----------------------------------------------------------------------===// // Simple Descriptor Constructors and other Methods From david_goodwin at apple.com Mon Aug 31 15:47:03 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 31 Aug 2009 20:47:03 -0000 Subject: [llvm-commits] [llvm] r80621 - in /llvm/trunk: lib/CodeGen/PostRASchedulerList.cpp test/CodeGen/ARM/2009-08-21-PostRAKill4.ll Message-ID: <200908312047.n7VKl3q4031649@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Aug 31 15:47:02 2009 New Revision: 80621 URL: http://llvm.org/viewvc/llvm-project?rev=80621&view=rev Log: Don't mark a register live at an undef use. Added: llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=80621&r1=80620&r2=80621&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original) +++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Mon Aug 31 15:47:02 2009 @@ -310,11 +310,11 @@ // prologue/epilogue insertion so there's no way to add additional // saved registers. // - // TODO: If the callee saves and restores these, then we can potentially - // use them between the save and the restore. To do that, we could scan - // the exit blocks to see which of these registers are defined. - // Alternatively, callee-saved registers that aren't saved and restored - // could be marked live-in in every block. + // TODO: there is a new method + // MachineFrameInfo::getPristineRegs(MBB). It gives you a list of + // CSRs that have not been saved when entering the MBB. The + // remaining CSRs have been saved and can be treated like call + // clobbered registers. for (const unsigned *I = TRI->getCalleeSavedRegs(); *I; ++I) { unsigned Reg = *I; Classes[Reg] = reinterpret_cast(-1); @@ -788,7 +788,6 @@ I != E; --Count) { MachineInstr *MI = --I; - DEBUG(MI->dump()); // Update liveness. Registers that are defed but not used in this // instruction are now dead. Mark register and all subregs as they // are completely defined. @@ -801,8 +800,6 @@ // Ignore two-addr defs. if (MI->isRegTiedToUseOperand(i)) continue; - DEBUG(errs() << "*** Handling Defs " << TM.getRegisterInfo()->get(Reg).Name << '\n'); - KillIndices[Reg] = ~0u; // Repeat for all subregs. @@ -822,8 +819,6 @@ unsigned Reg = MO.getReg(); if ((Reg == 0) || ReservedRegs.test(Reg)) continue; - DEBUG(errs() << "*** Handling Uses " << TM.getRegisterInfo()->get(Reg).Name << '\n'); - bool kill = false; if (killedRegs.find(Reg) == killedRegs.end()) { kill = true; @@ -851,14 +846,14 @@ killedRegs.insert(Reg); } - // Mark any used register and subregs as now live... + // Mark any used register (that is not using undef) and subregs as + // now live... for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isUse()) continue; + if (!MO.isReg() || !MO.isUse() || MO.isUndef()) continue; unsigned Reg = MO.getReg(); if ((Reg == 0) || ReservedRegs.test(Reg)) continue; - DEBUG(errs() << "Killing " << TM.getRegisterInfo()->get(Reg).Name << '\n'); KillIndices[Reg] = Count; for (const unsigned *Subreg = TRI->getSubRegisters(Reg); Added: llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll?rev=80621&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll Mon Aug 31 15:47:02 2009 @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | llc -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards + +; ModuleID = '' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" +target triple = "armv7-apple-darwin9" + + at .str = external constant [36 x i8], align 1 ; <[36 x i8]*> [#uses=0] + at .str1 = external constant [31 x i8], align 1 ; <[31 x i8]*> [#uses=1] + at .str2 = external constant [4 x i8], align 1 ; <[4 x i8]*> [#uses=1] + +declare arm_apcscc i32 @getUnknown(i32, ...) nounwind + +declare void @llvm.va_start(i8*) nounwind + +declare void @llvm.va_end(i8*) nounwind + +declare arm_apcscc i32 @printf(i8* nocapture, ...) nounwind + +define arm_apcscc i32 @main() nounwind { +entry: + %0 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([31 x i8]* @.str1, i32 0, i32 0), i32 1, i32 1, i32 1, i32 1, i32 1, i32 1) nounwind ; [#uses=0] + %1 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([31 x i8]* @.str1, i32 0, i32 0), i32 -128, i32 116, i32 116, i32 -3852, i32 -31232, i32 -1708916736) nounwind ; [#uses=0] + %2 = tail call arm_apcscc i32 (i32, ...)* @getUnknown(i32 undef, i32 116, i32 116, i32 -3852, i32 -31232, i32 30556, i32 -1708916736) nounwind ; [#uses=1] + %3 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @.str2, i32 0, i32 0), i32 %2) nounwind ; [#uses=0] + ret i32 0 +} From gohman at apple.com Mon Aug 31 16:15:24 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 31 Aug 2009 21:15:24 -0000 Subject: [llvm-commits] [llvm] r80623 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp Message-ID: <200908312115.n7VLFOOc002788@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 31 16:15:23 2009 New Revision: 80623 URL: http://llvm.org/viewvc/llvm-project?rev=80623&view=rev Log: Extend the ValuesAtScope cache to cover all expressions, not just SCEVUnknowns, as the non-SCEVUnknown cases in the getSCEVAtScope code can also end up repeatedly climing through the same expression trees, which can be unusably slow when the trees are very tall. Also, add a quick check for SCEV pointer equality to the main SCEV comparison routine, as the full comparison code can be expensive in the case of large expression trees. These fix compile-time problems in some pathlogical cases. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=80623&r1=80622&r2=80623&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Aug 31 16:15:23 2009 @@ -219,10 +219,11 @@ /// exit value. std::map ConstantEvolutionLoopExitValue; - /// ValuesAtScopes - This map contains entries for all the instructions - /// that we attempt to compute getSCEVAtScope information for without - /// using SCEV techniques, which can be expensive. - std::map > ValuesAtScopes; + /// ValuesAtScopes - This map contains entries for all the expressions + /// that we attempt to compute getSCEVAtScope information for, which can + /// be expensive in extreme cases. + std::map > ValuesAtScopes; /// createSCEV - We know that there is no SCEV for the specified value. /// Analyze the expression. @@ -236,6 +237,11 @@ /// SCEVs. const SCEV *createNodeForGEP(Operator *GEP); + /// computeSCEVAtScope - Implementation code for getSCEVAtScope; called + /// at most once for each SCEV+Loop pair. + /// + const SCEV *computeSCEVAtScope(const SCEV *S, const Loop *L); + /// ForgetSymbolicValue - This looks up computed SCEV values for all /// instructions that depend on the given instruction and removes them from /// the Scalars map if they reference SymName. This is used during PHI Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=80623&r1=80622&r2=80623&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Aug 31 16:15:23 2009 @@ -385,6 +385,10 @@ explicit SCEVComplexityCompare(LoopInfo *li) : LI(li) {} bool operator()(const SCEV *LHS, const SCEV *RHS) const { + // Fast-path: SCEVs are uniqued so we can do a quick equality check. + if (LHS == RHS) + return false; + // Primarily, sort the SCEVs by their getSCEVType(). if (LHS->getSCEVType() != RHS->getSCEVType()) return LHS->getSCEVType() < RHS->getSCEVType(); @@ -2420,9 +2424,10 @@ // count information isn't going to change anything. In the later // case, createNodeForPHI will perform the necessary updates on its // own when it gets to that point. - if (!isa(I) || !isa(It->second)) + if (!isa(I) || !isa(It->second)) { + ValuesAtScopes.erase(It->second); Scalars.erase(It); - ValuesAtScopes.erase(I); + } } PushDefUseChildren(I, Worklist); @@ -3232,9 +3237,10 @@ // count information isn't going to change anything. In the later // case, createNodeForPHI will perform the necessary updates on its // own when it gets to that point. - if (!isa(I) || !isa(It->second)) + if (!isa(I) || !isa(It->second)) { + ValuesAtScopes.erase(It->second); Scalars.erase(It); - ValuesAtScopes.erase(I); + } if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } @@ -3264,8 +3270,8 @@ std::map::iterator It = Scalars.find(static_cast(I)); if (It != Scalars.end()) { + ValuesAtScopes.erase(It->second); Scalars.erase(It); - ValuesAtScopes.erase(I); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } @@ -3897,8 +3903,20 @@ /// In the case that a relevant loop exit value cannot be computed, the /// original value V is returned. const SCEV *ScalarEvolution::getSCEVAtScope(const SCEV *V, const Loop *L) { - // FIXME: this should be turned into a virtual method on SCEV! + // Check to see if we've folded this expression at this loop before. + std::map &Values = ValuesAtScopes[V]; + std::pair::iterator, bool> Pair = + Values.insert(std::make_pair(L, static_cast(0))); + if (!Pair.second) + return Pair.first->second ? Pair.first->second : V; + + // Otherwise compute it. + const SCEV *C = computeSCEVAtScope(V, L); + Pair.first->second = C; + return C; +} +const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) { if (isa(V)) return V; // If this instruction is evolved from a constant-evolving PHI, compute the @@ -3931,13 +3949,6 @@ // the arguments into constants, and if so, try to constant propagate the // result. This is particularly useful for computing loop exit values. if (CanConstantFold(I)) { - // Check to see if we've folded this instruction at this loop before. - std::map &Values = ValuesAtScopes[I]; - std::pair::iterator, bool> Pair = - Values.insert(std::make_pair(L, static_cast(0))); - if (!Pair.second) - return Pair.first->second ? &*getSCEV(Pair.first->second) : V; - std::vector Operands; Operands.reserve(I->getNumOperands()); for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { @@ -3986,7 +3997,6 @@ C = ConstantFoldInstOperands(I->getOpcode(), I->getType(), &Operands[0], Operands.size(), getContext()); - Pair.first->second = C; return getSCEV(C); } } @@ -5031,8 +5041,6 @@ assert(SE && "SCEVCallbackVH called with a null ScalarEvolution!"); if (PHINode *PN = dyn_cast(getValPtr())) SE->ConstantEvolutionLoopExitValue.erase(PN); - if (Instruction *I = dyn_cast(getValPtr())) - SE->ValuesAtScopes.erase(I); SE->Scalars.erase(getValPtr()); // this now dangles! } @@ -5062,8 +5070,6 @@ continue; if (PHINode *PN = dyn_cast(U)) SE->ConstantEvolutionLoopExitValue.erase(PN); - if (Instruction *I = dyn_cast(U)) - SE->ValuesAtScopes.erase(I); SE->Scalars.erase(U); for (Value::use_iterator UI = U->use_begin(), UE = U->use_end(); UI != UE; ++UI) @@ -5073,8 +5079,6 @@ if (DeleteOld) { if (PHINode *PN = dyn_cast(Old)) SE->ConstantEvolutionLoopExitValue.erase(PN); - if (Instruction *I = dyn_cast(Old)) - SE->ValuesAtScopes.erase(I); SE->Scalars.erase(Old); // this now dangles! } From dpatel at apple.com Mon Aug 31 16:34:44 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 21:34:44 -0000 Subject: [llvm-commits] [llvm] r80627 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200908312134.n7VLYidr005500@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 16:34:44 2009 New Revision: 80627 URL: http://llvm.org/viewvc/llvm-project?rev=80627&view=rev Log: Derive DICompileUnit from DIScope. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80627&r1=80626&r2=80627&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 16:34:44 2009 @@ -95,6 +95,7 @@ bool isSubprogram() const; bool isGlobalVariable() const; bool isScope() const; + bool isCompileUnit() const; }; /// DISubrange - This is used to represent ranges, for array bounds. @@ -129,10 +130,13 @@ }; /// DICompileUnit - A wrapper for a compile unit. - class DICompileUnit : public DIDescriptor { + class DICompileUnit : public DIScope { public: - explicit DICompileUnit(MDNode *N = 0) - : DIDescriptor(N, dwarf::DW_TAG_compile_unit) {} + explicit DICompileUnit(MDNode *N = 0) { + DbgNode = N; + if (DbgNode && !isCompileUnit()) + DbgNode = 0; + } unsigned getLanguage() const { return getUnsignedField(2); } const std::string &getFilename(std::string &F) const { Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80627&r1=80626&r2=80627&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 16:34:44 2009 @@ -227,6 +227,14 @@ return false; } +/// isCompileUnit - Return true if the specified tag is DW_TAG_compile_unit. +bool DIDescriptor::isCompileUnit() const { + assert (!isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + return Tag == dwarf::DW_TAG_compile_unit; +} + //===----------------------------------------------------------------------===// // Simple Descriptor Constructors and other Methods //===----------------------------------------------------------------------===// From grosbach at apple.com Mon Aug 31 16:44:58 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 31 Aug 2009 14:44:58 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80588 - in /llvm-gcc-4.2/trunk/gcc: c-decl.c cp/except.c except.c except.h libfuncs.h llvm-internal.h objc/objc-act.c In-Reply-To: References: <200908311611.n7VGBUt7029204@zion.cs.uiuc.edu> <6a8523d60908311208g64ac4743sf4de340387c9227f@mail.gmail.com> <2718B13E-6AC0-415B-AE85-23096C19567C@apple.com> Message-ID: This also fails if I revert both llvm and llvm-gcc back to r80587 and do a clean build. For added curiosity, it fails in the same way when building with gcc-4.2 as the host compiler (darwin9 defaults to gcc-4.0). -Jim On Aug 31, 2009, at 1:34 PM, Jim Grosbach wrote: > If it's the same failure I'm looking at, it's a stage2 vs. stage3 > comparison failure. There's definitely something odd going on there, > and I share the suspicion that it's something unrelated that just > happens to be triggered now. > > I just did a fresh checkout of llvm and llvm-gcc, reverted the two > patches the buildbot identifies, and did a clean build. The bootstrap > failure is still there. Something else is going on. > > -jim > > On Aug 31, 2009, at 1:02 PM, Evan Cheng wrote: > >> Hrm. How is bootstrapping breaking? I find it hard to believe this >> particular patch can break bootstrapping. >> >> Evan >> >> On Aug 31, 2009, at 12:08 PM, Daniel Dunbar wrote: >> >>> Hi Jim, >>> >>> This caused the llvm-gcc-i386-darwin9 bootstrap to start failing. >>> The >>> failures are the same as are currently on llvm-gcc-powerpc-darwin9 >>> (which are the same as I see when building a local >>> llvm-gcc-x86_64-darwin10 bootstrap). >>> >>> Unfortunately the llvm-gcc-powerpc-darwin9 failures started while >>> the >>> buildbot was restarting, so I don't know exactly what is going on. I >>> believe this is somehow related to the instcombine changes, so your >>> change may have just caused llvm-gcc-i386-darwin9 to start hitting >>> something it wasn't before. >>> >>> At this point I don't know whats up with the llvm-gcc bootstrap >>> builds >>> but I would like the to get resolved ASAP. Can you talk to Chris >>> about >>> where he is at on this and maybe take a look? >>> >>> - Daniel >>> >>> On Mon, Aug 31, 2009 at 9:11 AM, Jim Grosbach >>> wrote: >>>> Author: grosbach >>>> Date: Mon Aug 31 11:11:29 2009 >>>> New Revision: 80588 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=80588&view=rev >>>> Log: >>>> Cleanup of cruft left over from front-end sjlj bits. No longer >>>> necessary with the EH handled in the back end. >>>> >>>> Modified: >>>> llvm-gcc-4.2/trunk/gcc/c-decl.c >>>> llvm-gcc-4.2/trunk/gcc/cp/except.c >>>> llvm-gcc-4.2/trunk/gcc/except.c >>>> llvm-gcc-4.2/trunk/gcc/except.h >>>> llvm-gcc-4.2/trunk/gcc/libfuncs.h >>>> llvm-gcc-4.2/trunk/gcc/llvm-internal.h >>>> llvm-gcc-4.2/trunk/gcc/objc/objc-act.c >>>> >>>> Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c >>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Mon Aug 31 11:11:29 2009 >>>> @@ -3586,10 +3586,6 @@ >>>> = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS >>>> ? "__gcc_personality_sj0" >>>> : "__gcc_personality_v0"); >>>> - llvm_unwind_sjlj_register_libfunc >>>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >>>> - llvm_unwind_sjlj_unregister_libfunc >>>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >>>> #else >>>> eh_personality_libfunc >>>> = init_one_libfunc (USING_SJLJ_EXCEPTIONS >>>> >>>> Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c >>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/cp/except.c (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/cp/except.c Mon Aug 31 11:11:29 2009 >>>> @@ -97,10 +97,6 @@ >>>> = llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS >>>> ? "__gxx_personality_sj0" >>>> : "__gxx_personality_v0"); >>>> - llvm_unwind_sjlj_register_libfunc >>>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >>>> - llvm_unwind_sjlj_unregister_libfunc >>>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >>>> #else >>>> eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS >>>> ? "__gxx_personality_sj0" >>>> >>>> Modified: llvm-gcc-4.2/trunk/gcc/except.c >>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/except.c (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 31 11:11:29 2009 >>>> @@ -115,21 +115,12 @@ >>>> htab_t type_to_runtime_map; >>>> >>>> /* Describe the SjLj_Function_Context structure. */ >>>> -#ifndef ENABLE_LLVM >>>> static GTY(()) tree sjlj_fc_type_node; >>>> static int sjlj_fc_call_site_ofs; >>>> static int sjlj_fc_data_ofs; >>>> static int sjlj_fc_personality_ofs; >>>> static int sjlj_fc_lsda_ofs; >>>> static int sjlj_fc_jbuf_ofs; >>>> -#else >>>> -tree sjlj_fc_type_node; >>>> -int sjlj_fc_call_site_ofs; >>>> -int sjlj_fc_data_ofs; >>>> -int sjlj_fc_personality_ofs; >>>> -int sjlj_fc_lsda_ofs; >>>> -int sjlj_fc_jbuf_ofs; >>>> -#endif >>>> >>>> /* Describes one exception region. */ >>>> struct eh_region GTY(()) >>>> @@ -285,7 +276,7 @@ >>>> static hashval_t ehspec_filter_hash (const void *); >>>> static int add_ttypes_entry (htab_t, tree); >>>> static int add_ehspec_entry (htab_t, htab_t, tree); >>>> -/*static void assign_filter_values (void); */ >>>> +static void assign_filter_values (void); >>>> static void build_post_landing_pads (void); >>>> static void connect_post_landing_pads (void); >>>> static void dw2_build_landing_pads (void); >>>> @@ -1385,7 +1376,7 @@ >>>> we use lots of landing pads, and so every type or list can share >>>> the same filter value, which saves table space. */ >>>> >>>> -/*static*/ void >>>> +static void >>>> assign_filter_values (void) >>>> { >>>> int i; >>>> >>>> Modified: llvm-gcc-4.2/trunk/gcc/except.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.h?rev=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/except.h (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/except.h Mon Aug 31 11:11:29 2009 >>>> @@ -57,7 +57,6 @@ >>>> /* After initial rtl generation, call back to finish generating >>>> exception support code. */ >>>> extern void finish_eh_generation (void); >>>> -extern void assign_filter_values (void); >>>> >>>> extern void init_eh (void); >>>> extern void init_eh_for_function (void); >>>> @@ -125,13 +124,6 @@ >>>> extern struct eh_region *get_eh_region (unsigned); >>>> extern tree get_eh_type_list (struct eh_region *); >>>> extern tree lookup_type_for_runtime (tree); >>>> - >>>> -extern GTY(()) tree sjlj_fc_type_node; >>>> -extern int sjlj_fc_call_site_ofs; >>>> -extern int sjlj_fc_data_ofs; >>>> -extern int sjlj_fc_personality_ofs; >>>> -extern int sjlj_fc_lsda_ofs; >>>> -extern int sjlj_fc_jbuf_ofs; >>>> #endif >>>> /* LLVM local end */ >>>> >>>> >>>> Modified: llvm-gcc-4.2/trunk/gcc/libfuncs.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libfuncs.h?rev=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/libfuncs.h (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/libfuncs.h Mon Aug 31 11:11:29 2009 >>>> @@ -82,15 +82,9 @@ >>>> #ifdef ENABLE_LLVM >>>> #define llvm_unwind_resume_libfunc (llvm_libfunc_table >>>> [LTI_unwind_resume]) >>>> #define llvm_eh_personality_libfunc (llvm_libfunc_table >>>> [LTI_eh_personality]) >>>> -#define llvm_unwind_sjlj_register_libfunc \ >>>> - (llvm_libfunc_table[LTI_unwind_sjlj_register]) >>>> -#define llvm_unwind_sjlj_unregister_libfunc \ >>>> - (llvm_libfunc_table[LTI_unwind_sjlj_unregister]) >>>> #else >>>> #define llvm_unwind_resume_libfunc unwind_resume_libfunc >>>> #define llvm_eh_personality_libfunc eh_personality_libfunc >>>> -#define llvm_unwind_sjlj_register_libfunc >>>> unwind_sjlj_register_libfunc >>>> -#define llvm_unwind_sjlj_unregister_libfunc >>>> unwind_sjlj_unregister_libfunc >>>> #endif >>>> /* LLVM LOCAL end */ >>>> >>>> >>>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 31 11:11:29 2009 >>>> @@ -448,12 +448,6 @@ >>>> Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, >>>> unsigned Align); >>>> Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, >>>> unsigned Align); >>>> >>>> - /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher >>>> - void EmitSjLjDispatcher(); >>>> - >>>> - /// EmitSjLjLandingPads - Emit SJLJ EH landing pads. >>>> - void EmitSjLjLandingPads(); >>>> - >>>> /// EmitLandingPads - Emit EH landing pads. >>>> void EmitLandingPads(); >>>> >>>> >>>> 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=80588&r1=80587&r2=80588&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) >>>> +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Aug 31 11:11:29 2009 >>>> @@ -8291,10 +8291,6 @@ >>>> #ifdef ENABLE_LLVM >>>> llvm_eh_personality_libfunc >>>> = llvm_init_one_libfunc ("__objc_personality_v0"); >>>> - llvm_unwind_sjlj_register_libfunc >>>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Register"); >>>> - llvm_unwind_sjlj_unregister_libfunc >>>> - = llvm_init_one_libfunc ("_Unwind_SjLj_Unregister"); >>>> #else >>>> eh_personality_libfunc >>>> = init_one_libfunc ("__objc_personality_v0"); >>>> >>>> >>>> _______________________________________________ >>>> 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 richard at xmos.com Mon Aug 31 16:51:36 2009 From: richard at xmos.com (Richard Osborne) Date: Mon, 31 Aug 2009 21:51:36 -0000 Subject: [llvm-commits] [llvm] r80629 - /llvm/trunk/lib/Support/Triple.cpp Message-ID: <200908312151.n7VLpaii007715@zion.cs.uiuc.edu> Author: friedgold Date: Mon Aug 31 16:51:36 2009 New Revision: 80629 URL: http://llvm.org/viewvc/llvm-project?rev=80629&view=rev Log: Add triple parsing support for XCore. Modified: llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=80629&r1=80628&r2=80629&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Mon Aug 31 16:51:36 2009 @@ -186,6 +186,8 @@ Arch = systemz; else if (ArchName == "tce") Arch = tce; + else if (ArchName == "xcore") + Arch = xcore; else Arch = UnknownArch; From bob.wilson at apple.com Mon Aug 31 16:54:16 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 31 Aug 2009 21:54:16 -0000 Subject: [llvm-commits] [llvm] r80630 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200908312154.n7VLsGGP008067@zion.cs.uiuc.edu> Author: bwilson Date: Mon Aug 31 16:54:16 2009 New Revision: 80630 URL: http://llvm.org/viewvc/llvm-project?rev=80630&view=rev Log: If the tied registers are already the same, there is no need to change them. Move the code to make that change inside the conditional. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80630&r1=80629&r2=80630&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Aug 31 16:54:16 2009 @@ -985,13 +985,13 @@ mi->getOperand(i).getReg() == regB) mi->getOperand(i).setReg(regA); } - } - assert(mi->getOperand(ti).isDef() && mi->getOperand(si).isUse()); - mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); - MadeChange = true; + assert(mi->getOperand(ti).isDef() && mi->getOperand(si).isUse()); + mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); + MadeChange = true; - DEBUG(errs() << "\t\trewrite to:\t" << *mi); + DEBUG(errs() << "\t\trewrite to:\t" << *mi); + } } mi = nmi; From bob.wilson at apple.com Mon Aug 31 16:54:55 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 31 Aug 2009 21:54:55 -0000 Subject: [llvm-commits] [llvm] r80631 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200908312154.n7VLstKb008175@zion.cs.uiuc.edu> Author: bwilson Date: Mon Aug 31 16:54:55 2009 New Revision: 80631 URL: http://llvm.org/viewvc/llvm-project?rev=80631&view=rev Log: Use early exit and reduce indentation. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80631&r1=80630&r2=80631&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Aug 31 16:54:55 2009 @@ -791,132 +791,98 @@ assert(mi->getOperand(si).isReg() && mi->getOperand(si).getReg() && mi->getOperand(si).isUse() && "two address instruction invalid"); - // If the two operands are the same we just remove the use - // and mark the def as def&use, otherwise we have to insert a copy. - if (mi->getOperand(ti).getReg() != mi->getOperand(si).getReg()) { - // Rewrite: - // a = b op c - // to: - // a = b - // a = a op c - unsigned regA = mi->getOperand(ti).getReg(); - unsigned regB = mi->getOperand(si).getReg(); - unsigned regASubIdx = mi->getOperand(ti).getSubReg(); + // If the two operands are the same, nothing needs to be done. + if (mi->getOperand(ti).getReg() == mi->getOperand(si).getReg()) + continue; + + // Rewrite: + // a = b op c + // to: + // a = b + // a = a op c + unsigned regA = mi->getOperand(ti).getReg(); + unsigned regB = mi->getOperand(si).getReg(); + unsigned regASubIdx = mi->getOperand(ti).getSubReg(); - assert(TargetRegisterInfo::isVirtualRegister(regB) && - "cannot make instruction into two-address form"); + assert(TargetRegisterInfo::isVirtualRegister(regB) && + "cannot make instruction into two-address form"); #ifndef NDEBUG - // First, verify that we don't have a use of a in the instruction (a = - // b + a for example) because our transformation will not work. This - // should never occur because we are in SSA form. - for (unsigned i = 0; i != mi->getNumOperands(); ++i) - assert(i == ti || - !mi->getOperand(i).isReg() || - mi->getOperand(i).getReg() != regA); + // First, verify that we don't have a use of a in the instruction (a = + // b + a for example) because our transformation will not work. This + // should never occur because we are in SSA form. + for (unsigned i = 0; i != mi->getNumOperands(); ++i) + assert(i == ti || + !mi->getOperand(i).isReg() || + mi->getOperand(i).getReg() != regA); #endif - // If this instruction is not the killing user of B, see if we can - // rearrange the code to make it so. Making it the killing user will - // allow us to coalesce A and B together, eliminating the copy we are - // about to insert. - if (!isKilled(*mi, regB, MRI, TII)) { - // If regA is dead and the instruction can be deleted, just delete - // it so it doesn't clobber regB. - SmallVector Kills; - if (mi->getOperand(ti).isDead() && - isSafeToDelete(mi, regB, TII, Kills)) { - SmallVector - ,MachineInstr*>, 4> NewKills; - bool ReallySafe = true; - // If this instruction kills some virtual registers, we need - // update the kill information. If it's not possible to do so, - // then bail out. - while (!Kills.empty()) { - unsigned Kill = Kills.back(); - Kills.pop_back(); - if (TargetRegisterInfo::isPhysicalRegister(Kill)) { - ReallySafe = false; - break; - } - MachineInstr *LastKill = FindLastUseInMBB(Kill, &*mbbi, Dist); - if (LastKill) { - bool isModRef = LastKill->modifiesRegister(Kill); - NewKills.push_back(std::make_pair(std::make_pair(Kill,isModRef), - LastKill)); - } else { - ReallySafe = false; - break; - } + // If this instruction is not the killing user of B, see if we can + // rearrange the code to make it so. Making it the killing user will + // allow us to coalesce A and B together, eliminating the copy we are + // about to insert. + if (!isKilled(*mi, regB, MRI, TII)) { + // If regA is dead and the instruction can be deleted, just delete + // it so it doesn't clobber regB. + SmallVector Kills; + if (mi->getOperand(ti).isDead() && + isSafeToDelete(mi, regB, TII, Kills)) { + SmallVector + ,MachineInstr*>, 4> NewKills; + bool ReallySafe = true; + // If this instruction kills some virtual registers, we need + // update the kill information. If it's not possible to do so, + // then bail out. + while (!Kills.empty()) { + unsigned Kill = Kills.back(); + Kills.pop_back(); + if (TargetRegisterInfo::isPhysicalRegister(Kill)) { + ReallySafe = false; + break; } - - if (ReallySafe) { - if (LV) { - while (!NewKills.empty()) { - MachineInstr *NewKill = NewKills.back().second; - unsigned Kill = NewKills.back().first.first; - bool isDead = NewKills.back().first.second; - NewKills.pop_back(); - if (LV->removeVirtualRegisterKilled(Kill, mi)) { - if (isDead) - LV->addVirtualRegisterDead(Kill, NewKill); - else - LV->addVirtualRegisterKilled(Kill, NewKill); - } - } - } - - // We're really going to nuke the old inst. If regB was marked - // as a kill we need to update its Kills list. - if (mi->getOperand(si).isKill()) - LV->removeVirtualRegisterKilled(regB, mi); - - mbbi->erase(mi); // Nuke the old inst. - mi = nmi; - ++NumDeletes; - break; // Done with this instruction. + MachineInstr *LastKill = FindLastUseInMBB(Kill, &*mbbi, Dist); + if (LastKill) { + bool isModRef = LastKill->modifiesRegister(Kill); + NewKills.push_back(std::make_pair(std::make_pair(Kill,isModRef), + LastKill)); + } else { + ReallySafe = false; + break; } } - // If this instruction is commutative, check to see if C dies. If - // so, swap the B and C operands. This makes the live ranges of A - // and C joinable. - // FIXME: This code also works for A := B op C instructions. - unsigned SrcOp1, SrcOp2; - if (TID.isCommutable() && mi->getNumOperands() >= 3 && - TII->findCommutedOpIndices(mi, SrcOp1, SrcOp2)) { - unsigned regC = 0; - if (si == SrcOp1) - regC = mi->getOperand(SrcOp2).getReg(); - else if (si == SrcOp2) - regC = mi->getOperand(SrcOp1).getReg(); - if (isKilled(*mi, regC, MRI, TII)) { - if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { - ++NumCommuted; - regB = regC; - goto InstructionRearranged; + if (ReallySafe) { + if (LV) { + while (!NewKills.empty()) { + MachineInstr *NewKill = NewKills.back().second; + unsigned Kill = NewKills.back().first.first; + bool isDead = NewKills.back().first.second; + NewKills.pop_back(); + if (LV->removeVirtualRegisterKilled(Kill, mi)) { + if (isDead) + LV->addVirtualRegisterDead(Kill, NewKill); + else + LV->addVirtualRegisterKilled(Kill, NewKill); + } } } - } - // If this instruction is potentially convertible to a true - // three-address instruction, - if (TID.isConvertibleTo3Addr()) { - // FIXME: This assumes there are no more operands which are tied - // to another register. -#ifndef NDEBUG - for (unsigned i = si + 1, e = TID.getNumOperands(); i < e; ++i) - assert(TID.getOperandConstraint(i, TOI::TIED_TO) == -1); -#endif - - if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) { - ++NumConvertedTo3Addr; - break; // Done with this instruction. - } + // We're really going to nuke the old inst. If regB was marked + // as a kill we need to update its Kills list. + if (mi->getOperand(si).isKill()) + LV->removeVirtualRegisterKilled(regB, mi); + + mbbi->erase(mi); // Nuke the old inst. + mi = nmi; + ++NumDeletes; + break; // Done with this instruction. } } - // If it's profitable to commute the instruction, do so. + // If this instruction is commutative, check to see if C dies. If + // so, swap the B and C operands. This makes the live ranges of A + // and C joinable. + // FIXME: This code also works for A := B op C instructions. unsigned SrcOp1, SrcOp2; if (TID.isCommutable() && mi->getNumOperands() >= 3 && TII->findCommutedOpIndices(mi, SrcOp1, SrcOp2)) { @@ -925,73 +891,107 @@ regC = mi->getOperand(SrcOp2).getReg(); else if (si == SrcOp2) regC = mi->getOperand(SrcOp1).getReg(); - - if (regC && isProfitableToCommute(regB, regC, mi, mbbi, Dist)) + if (isKilled(*mi, regC, MRI, TII)) { if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { - ++NumAggrCommuted; ++NumCommuted; regB = regC; goto InstructionRearranged; } + } } - // If it's profitable to convert the 2-address instruction to a - // 3-address one, do so. - if (TID.isConvertibleTo3Addr() && isProfitableToConv3Addr(regA)) { + // If this instruction is potentially convertible to a true + // three-address instruction, + if (TID.isConvertibleTo3Addr()) { + // FIXME: This assumes there are no more operands which are tied + // to another register. +#ifndef NDEBUG + for (unsigned i = si + 1, e = TID.getNumOperands(); i < e; ++i) + assert(TID.getOperandConstraint(i, TOI::TIED_TO) == -1); +#endif + if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) { ++NumConvertedTo3Addr; break; // Done with this instruction. } } + } + + // If it's profitable to commute the instruction, do so. + unsigned SrcOp1, SrcOp2; + if (TID.isCommutable() && mi->getNumOperands() >= 3 && + TII->findCommutedOpIndices(mi, SrcOp1, SrcOp2)) { + unsigned regC = 0; + if (si == SrcOp1) + regC = mi->getOperand(SrcOp2).getReg(); + else if (si == SrcOp2) + regC = mi->getOperand(SrcOp1).getReg(); + + if (regC && isProfitableToCommute(regB, regC, mi, mbbi, Dist)) + if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { + ++NumAggrCommuted; + ++NumCommuted; + regB = regC; + goto InstructionRearranged; + } + } - InstructionRearranged: - const TargetRegisterClass* rc = MRI->getRegClass(regB); - MachineInstr *DefMI = MRI->getVRegDef(regB); - // If it's safe and profitable, remat the definition instead of - // copying it. - if (DefMI && - DefMI->getDesc().isAsCheapAsAMove() && - DefMI->isSafeToReMat(TII, regB) && - isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist)){ - DEBUG(errs() << "2addr: REMATTING : " << *DefMI << "\n"); - TII->reMaterialize(*mbbi, mi, regA, regASubIdx, DefMI); - ReMatRegs.set(regB); - ++NumReMats; - } else { - bool Emitted = TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); - (void)Emitted; - assert(Emitted && "Unable to issue a copy instruction!\n"); + // If it's profitable to convert the 2-address instruction to a + // 3-address one, do so. + if (TID.isConvertibleTo3Addr() && isProfitableToConv3Addr(regA)) { + if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) { + ++NumConvertedTo3Addr; + break; // Done with this instruction. } + } - MachineBasicBlock::iterator prevMI = prior(mi); - // Update DistanceMap. - DistanceMap.insert(std::make_pair(prevMI, Dist)); - DistanceMap[mi] = ++Dist; - - // Update live variables for regB. - if (LV) { - if (LV->removeVirtualRegisterKilled(regB, mi)) - LV->addVirtualRegisterKilled(regB, prevMI); + InstructionRearranged: + const TargetRegisterClass* rc = MRI->getRegClass(regB); + MachineInstr *DefMI = MRI->getVRegDef(regB); + // If it's safe and profitable, remat the definition instead of + // copying it. + if (DefMI && + DefMI->getDesc().isAsCheapAsAMove() && + DefMI->isSafeToReMat(TII, regB) && + isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist)){ + DEBUG(errs() << "2addr: REMATTING : " << *DefMI << "\n"); + TII->reMaterialize(*mbbi, mi, regA, regASubIdx, DefMI); + ReMatRegs.set(regB); + ++NumReMats; + } else { + bool Emitted = TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); + (void)Emitted; + assert(Emitted && "Unable to issue a copy instruction!\n"); + } - if (LV->removeVirtualRegisterDead(regB, mi)) - LV->addVirtualRegisterDead(regB, prevMI); - } + MachineBasicBlock::iterator prevMI = prior(mi); + // Update DistanceMap. + DistanceMap.insert(std::make_pair(prevMI, Dist)); + DistanceMap[mi] = ++Dist; + + // Update live variables for regB. + if (LV) { + if (LV->removeVirtualRegisterKilled(regB, mi)) + LV->addVirtualRegisterKilled(regB, prevMI); + + if (LV->removeVirtualRegisterDead(regB, mi)) + LV->addVirtualRegisterDead(regB, prevMI); + } - DEBUG(errs() << "\t\tprepend:\t" << *prevMI); + DEBUG(errs() << "\t\tprepend:\t" << *prevMI); - // Replace all occurences of regB with regA. - for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { - if (mi->getOperand(i).isReg() && - mi->getOperand(i).getReg() == regB) - mi->getOperand(i).setReg(regA); - } + // Replace all occurences of regB with regA. + for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { + if (mi->getOperand(i).isReg() && + mi->getOperand(i).getReg() == regB) + mi->getOperand(i).setReg(regA); + } - assert(mi->getOperand(ti).isDef() && mi->getOperand(si).isUse()); - mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); - MadeChange = true; + assert(mi->getOperand(ti).isDef() && mi->getOperand(si).isUse()); + mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); + MadeChange = true; - DEBUG(errs() << "\t\trewrite to:\t" << *mi); - } + DEBUG(errs() << "\t\trewrite to:\t" << *mi); } mi = nmi; From ggreif at gmail.com Mon Aug 31 15:54:24 2009 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 31 Aug 2009 20:54:24 -0000 Subject: [llvm-commits] [llvm] r80622 - /llvm/trunk/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200908312054.n7VKsO2x032568@zion.cs.uiuc.edu> Author: ggreif Date: Mon Aug 31 15:54:23 2009 New Revision: 80622 URL: http://llvm.org/viewvc/llvm-project?rev=80622&view=rev Log: restore semantics of operator* (removing a FIXME I had to introduce in r80224) Modified: llvm/trunk/include/llvm/ADT/EquivalenceClasses.h Modified: llvm/trunk/include/llvm/ADT/EquivalenceClasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/EquivalenceClasses.h?rev=80622&r1=80621&r2=80622&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/EquivalenceClasses.h (original) +++ llvm/trunk/include/llvm/ADT/EquivalenceClasses.h Mon Aug 31 15:54:23 2009 @@ -234,8 +234,9 @@ } class member_iterator : public std::iterator { - typedef std::iterator super; + const ElemTy, ptrdiff_t> { + typedef std::iterator super; const ECValue *Node; friend class EquivalenceClasses; public: @@ -249,7 +250,7 @@ reference operator*() const { assert(Node != 0 && "Dereferencing end()!"); - return const_cast(Node->getData()); // FIXME + return Node->getData(); } reference operator->() const { return operator*(); } From ctice at apple.com Mon Aug 31 16:19:38 2009 From: ctice at apple.com (Caroline Tice) Date: Mon, 31 Aug 2009 21:19:38 -0000 Subject: [llvm-commits] [llvm] r80625 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h Message-ID: <200908312119.n7VLJcxx003376@zion.cs.uiuc.edu> Author: ctice Date: Mon Aug 31 16:19:37 2009 New Revision: 80625 URL: http://llvm.org/viewvc/llvm-project?rev=80625&view=rev Log: Add flag to mark structs for Apple Block "byref" variables; also add code to modify the type and location debug information for these variables to match the programmer's expectations. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80625&r1=80624&r2=80625&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 16:19:37 2009 @@ -191,7 +191,8 @@ FlagPrivate = 1 << 0, FlagProtected = 1 << 1, FlagFwdDecl = 1 << 2, - FlagAppleBlock = 1 << 3 + FlagAppleBlock = 1 << 3, + FlagBlockByrefStruct = 1 << 4 }; protected: @@ -235,6 +236,9 @@ bool isAppleBlockExtension() const { return (getFlags() & FlagAppleBlock) != 0; } + bool isBlockByrefStruct() const { + return (getFlags() & FlagBlockByrefStruct) != 0; + } /// dump - print type. void dump() const; @@ -401,6 +405,12 @@ /// Verify - Verify that a variable descriptor is well formed. bool Verify() const; + /// isBlockByrefVariable - Return true if the variable was declared as + /// a "__block" variable (Apple Blocks). + bool isBlockByrefVariable() const { + return getType().isBlockByrefStruct(); + } + /// dump - print variable. void dump() const; }; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=80625&r1=80624&r2=80625&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 31 16:19:37 2009 @@ -500,6 +500,238 @@ AddUInt(Die, dwarf::DW_AT_decl_line, 0, Line); } +/* Byref variables, in Blocks, are declared by the programmer as + "SomeType VarName;", but the compiler creates a + __Block_byref_x_VarName struct, and gives the variable VarName + either the struct, or a pointer to the struct, as its type. This + is necessary for various behind-the-scenes things the compiler + needs to do with by-reference variables in blocks. + + However, as far as the original *programmer* is concerned, the + variable should still have type 'SomeType', as originally declared. + + The following function dives into the __Block_byref_x_VarName + struct to find the original type of the variable. This will be + passed back to the code generating the type for the Debug + Information Entry for the variable 'VarName'. 'VarName' will then + have the original type 'SomeType' in its debug information. + + The original type 'SomeType' will be the type of the field named + 'VarName' inside the __Block_byref_x_VarName struct. + + NOTE: In order for this to not completely fail on the debugger + side, the Debug Information Entry for the variable VarName needs to + have a DW_AT_location that tells the debugger how to unwind through + the pointers and __Block_byref_x_VarName struct to find the actual + value of the variable. The function AddBlockByrefType does this. */ + +/// Find the type the programmer originally declared the variable to be +/// and return that type. +/// +DIType DwarfDebug::GetBlockByrefType(DIType Ty, std::string Name) { + + DIType subType = Ty; + unsigned tag = Ty.getTag(); + + if (tag == dwarf::DW_TAG_pointer_type) { + DIDerivedType DTy = DIDerivedType (Ty.getNode()); + subType = DTy.getTypeDerivedFrom(); + } + + DICompositeType blockStruct = DICompositeType(subType.getNode()); + + DIArray Elements = blockStruct.getTypeArray(); + + if (Elements.isNull()) + return Ty; + + for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { + DIDescriptor Element = Elements.getElement(i); + DIDerivedType DT = DIDerivedType(Element.getNode()); + std::string Name2; + DT.getName(Name2); + if (Name == Name2) + return (DT.getTypeDerivedFrom()); + } + + return Ty; +} + +/* Byref variables, in Blocks, are declared by the programmer as "SomeType + VarName;", but the compiler creates a __Block_byref_x_VarName struct, and + gives the variable VarName either the struct, or a pointer to the struct, as + its type. This is necessary for various behind-the-scenes things the + compiler needs to do with by-reference variables in Blocks. + + However, as far as the original *programmer* is concerned, the variable + should still have type 'SomeType', as originally declared. + + The function GetBlockByrefType dives into the __Block_byref_x_VarName + struct to find the original type of the variable, which is then assigned to + the variable's Debug Information Entry as its real type. So far, so good. + However now the debugger will expect the variable VarName to have the type + SomeType. So we need the location attribute for the variable to be an + expression that explains to the debugger how to navigate through the + pointers and struct to find the actual variable of type SomeType. + + The following function does just that. We start by getting + the "normal" location for the variable. This will be the location + of either the struct __Block_byref_x_VarName or the pointer to the + struct __Block_byref_x_VarName. + + The struct will look something like: + + struct __Block_byref_x_VarName { + ... + struct __Block_byref_x_VarName *forwarding; + ... + SomeType VarName; + ... + }; + + If we are given the struct directly (as our starting point) we + need to tell the debugger to: + + 1). Add the offset of the forwarding field. + + 2). Follow that pointer to get the the real __Block_byref_x_VarName + struct to use (the real one may have been copied onto the heap). + + 3). Add the offset for the field VarName, to find the actual variable. + + If we started with a pointer to the struct, then we need to + dereference that pointer first, before the other steps. + Translating this into DWARF ops, we will need to append the following + to the current location description for the variable: + + DW_OP_deref -- optional, if we start with a pointer + DW_OP_plus_uconst + DW_OP_deref + DW_OP_plus_uconst + + That is what this function does. */ + +/// AddBlockByrefAddress - Start with the address based on the location +/// provided, and generate the DWARF information necessary to find the +/// actual Block variable (navigating the Block struct) based on the +/// starting location. Add the DWARF information to the die. For +/// more information, read large comment just above here. +/// +void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die, + unsigned Attribute, + const MachineLocation &Location) { + const DIVariable &VD = DV->getVariable(); + DIType Ty = VD.getType(); + DIType TmpTy = Ty; + unsigned Tag = Ty.getTag(); + bool isPointer = false; + + std::string varName; + VD.getName(varName); + + if (Tag == dwarf::DW_TAG_pointer_type) { + DIDerivedType DTy = DIDerivedType (Ty.getNode()); + TmpTy = DTy.getTypeDerivedFrom(); + isPointer = true; + } + + DICompositeType blockStruct = DICompositeType(TmpTy.getNode()); + + std::string typeName; + blockStruct.getName(typeName); + + assert(typeName.find ("__Block_byref_") == 0 + && "Attempting to get Block location of non-Block variable!"); + + // Find the __forwarding field and the variable field in the __Block_byref + // struct. + + DIArray Fields = blockStruct.getTypeArray(); + DIDescriptor varField = DIDescriptor(); + DIDescriptor forwardingField = DIDescriptor(); + + + for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) { + DIDescriptor Element = Fields.getElement(i); + DIDerivedType DT = DIDerivedType(Element.getNode()); + std::string fieldName; + DT.getName(fieldName); + if (fieldName == "__forwarding") + forwardingField = Element; + else if (fieldName == varName) + varField = Element; + } + + assert (!varField.isNull() && "Can't find byref variable in Block struct"); + assert (!forwardingField.isNull() + && "Can't find forwarding field in Block struct"); + + // Get the offsets for the forwarding field and the variable field. + + unsigned int forwardingFieldOffset = + DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3; + unsigned int varFieldOffset = + DIDerivedType(varField.getNode()).getOffsetInBits() >> 3; + + // Decode the original location, and use that as the start of the + // byref variable's location. + + unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false); + DIEBlock *Block = new DIEBlock(); + + if (Location.isReg()) { + if (Reg < 32) + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + Reg); + else { + Reg = Reg - dwarf::DW_OP_reg0; + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg); + AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg); + } + } else { + if (Reg < 32) + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg); + else { + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx); + AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg); + } + + AddUInt(Block, 0, dwarf::DW_FORM_sdata, Location.getOffset()); + } + + // If we started with a pointer to the__Block_byref... struct, then + // the first thing we need to do is dereference the pointer (DW_OP_deref). + + if (isPointer) + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); + + // Next add the offset for the '__forwarding' field: + // DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in + // adding the offset if it's 0. + + if (forwardingFieldOffset > 0) { + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); + AddUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset); + } + + // Now dereference the __forwarding field to get to the real __Block_byref + // struct: DW_OP_deref. + + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); + + // Now that we've got the real __Block_byref... struct, add the offset + // for the variable's field to get to the location of the actual variable: + // DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0. + + if (varFieldOffset > 0) { + AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); + AddUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset); + } + + // Now attach the location information to the DIE. + + AddBlock(Die, Attribute, 0, Block); +} + /// AddAddress - Add an address attribute to a die based on the location /// provided. void DwarfDebug::AddAddress(DIE *Die, unsigned Attribute, @@ -961,7 +1193,10 @@ AddSourceLine(VariableDie, &VD); // Add variable type. - AddType(Unit, VariableDie, VD.getType()); + if (VD.isBlockByrefVariable()) + AddType(Unit, VariableDie, GetBlockByrefType(VD.getType(), Name)); + else + AddType(Unit, VariableDie, VD.getType()); // Add variable address. if (!DV->isInlinedFnVar()) { @@ -970,7 +1205,11 @@ MachineLocation Location; Location.set(RI->getFrameRegister(*MF), RI->getFrameIndexOffset(*MF, DV->getFrameIndex())); - AddAddress(VariableDie, dwarf::DW_AT_location, Location); + + if (VD.isBlockByrefVariable()) + AddBlockByrefAddress (DV, VariableDie, dwarf::DW_AT_location, Location); + else + AddAddress(VariableDie, dwarf::DW_AT_location, Location); } return VariableDie; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=80625&r1=80624&r2=80625&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Aug 31 16:19:37 2009 @@ -287,6 +287,14 @@ void AddAddress(DIE *Die, unsigned Attribute, const MachineLocation &Location); + /// AddBlockByrefAddress - Start with the address based on the location + /// provided, and generate the DWARF information necessary to find the + /// actual Block variable (navigating the Block struct) based on the + /// starting location. Add the DWARF information to the die. + /// + void AddBlockByrefAddress(DbgVariable *&DV, DIE *Die, unsigned Attribute, + const MachineLocation &Location); + /// AddType - Add a new type attribute to the specified entity. void AddType(CompileUnit *DW_Unit, DIE *Entity, DIType Ty); @@ -454,6 +462,11 @@ void ConstructSubprogram(MDNode *N); + /// Find the type the programmer originally declared the variable to be + /// and return that type. + /// + DIType GetBlockByrefType(DIType Ty, std::string Name); + public: //===--------------------------------------------------------------------===// // Main entry points. From ctice at apple.com Mon Aug 31 16:22:12 2009 From: ctice at apple.com (Caroline Tice) Date: Mon, 31 Aug 2009 21:22:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80626 - in /llvm-gcc-4.2/trunk/gcc: ChangeLog.apple llvm-debug.cpp tree.c tree.h Message-ID: <200908312122.n7VLMDkY003834@zion.cs.uiuc.edu> Author: ctice Date: Mon Aug 31 16:22:12 2009 New Revision: 80626 URL: http://llvm.org/viewvc/llvm-project?rev=80626&view=rev Log: When converting tree types to llvm types, add appropriate flag to mark Block "byref" variables; also added a new function to test when it's appropriate to add the flags. Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog.apple llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp llvm-gcc-4.2/trunk/gcc/tree.c llvm-gcc-4.2/trunk/gcc/tree.h Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog.apple URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ChangeLog.apple?rev=80626&r1=80625&r2=80626&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ChangeLog.apple (original) +++ llvm-gcc-4.2/trunk/gcc/ChangeLog.apple Mon Aug 31 16:22:12 2009 @@ -1,3 +1,9 @@ +2009-08-31 Caroline Tice + + Radar 6419781 + * tree.c (type_is_block_byref_struct): New function. + * tree.h (type_is_block_byref_struct): New extern function decl. + 2009-07-31 Bob Wilson Radar 7105099 Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=80626&r1=80625&r2=80626&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Mon Aug 31 16:22:12 2009 @@ -445,6 +445,9 @@ TREE_CODE(type) == BLOCK_POINTER_TYPE) ? DW_TAG_pointer_type : DW_TAG_reference_type; + unsigned Flags = 0; + if (type_is_block_byref_struct(type)) + Flags |= llvm::DIType::FlagBlockByrefStruct; expanded_location Loc = GetNodeLocation(type); std::string PName; @@ -455,7 +458,7 @@ NodeSizeInBits(type), NodeAlignInBits(type), 0 /*offset */, - 0 /* flags */, + Flags, FromTy); } @@ -591,7 +594,8 @@ unsigned Flags = llvm::DIType::FlagFwdDecl; if (TYPE_BLOCK_IMPL_STRUCT(type)) Flags |= llvm::DIType::FlagAppleBlock; - + if (type_is_block_byref_struct(type)) + Flags |= llvm::DIType::FlagBlockByrefStruct; llvm::DICompositeType FwdDecl = DebugFactory.CreateCompositeType(Tag, findRegion(type), Modified: llvm-gcc-4.2/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=80626&r1=80625&r2=80626&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree.c Mon Aug 31 16:22:12 2009 @@ -7975,4 +7975,37 @@ } /* APPLE LOCAL end weak_import on property 6676828 */ +/* APPLE LOCAL begin radar 6419781 */ +bool +type_is_block_byref_struct (tree type) +{ + bool ret_value = false; + + if (!type) + return false; + + if (TREE_CODE (type) == POINTER_TYPE) + type = TREE_TYPE (type); + + if (!type + || ! TYPE_NAME (type) + || ! (TREE_CODE (type) == RECORD_TYPE)) + return false; + + if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE + && strncmp (IDENTIFIER_POINTER (TYPE_NAME (type)), + "__Block_byref_", 14) == 0) + return true; + else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && DECL_NAME (TYPE_NAME (type)) + && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))) + && (strncmp + (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))), + "__Block_byref_", 14) == 0)) + return true; + else + return false; +} +/* APPLE LOCAL begin end 6419781 */ + #include "gt-tree.h" Modified: llvm-gcc-4.2/trunk/gcc/tree.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=80626&r1=80625&r2=80626&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.h (original) +++ llvm-gcc-4.2/trunk/gcc/tree.h Mon Aug 31 16:22:12 2009 @@ -4892,4 +4892,8 @@ /* APPLE LOCAL end radar 6300081 */ +/* APPLE LOCAL begin radar 6419781 */ +extern bool type_is_block_byref_struct (tree); +/* APPLE LOCAL end radar 6419781 */ + #endif /* GCC_TREE_H */ From gohman at apple.com Mon Aug 31 16:58:28 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 31 Aug 2009 21:58:28 -0000 Subject: [llvm-commits] [llvm] r80632 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200908312158.n7VLwSWv008668@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 31 16:58:28 2009 New Revision: 80632 URL: http://llvm.org/viewvc/llvm-project?rev=80632&view=rev Log: Don't use an iterator which is potentially invalidated. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=80632&r1=80631&r2=80632&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Aug 31 16:58:28 2009 @@ -3912,7 +3912,7 @@ // Otherwise compute it. const SCEV *C = computeSCEVAtScope(V, L); - Pair.first->second = C; + ValuesAtScopes[V][L] = C; return C; } From dpatel at apple.com Mon Aug 31 17:00:16 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 22:00:16 -0000 Subject: [llvm-commits] [llvm] r80633 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200908312200.n7VM0GYf008900@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 17:00:15 2009 New Revision: 80633 URL: http://llvm.org/viewvc/llvm-project?rev=80633&view=rev Log: Rename DIBlock as DILexicalBlock. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80633&r1=80632&r2=80633&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 17:00:15 2009 @@ -96,6 +96,7 @@ bool isGlobalVariable() const; bool isScope() const; bool isCompileUnit() const; + bool isLexicalBlock() const; }; /// DISubrange - This is used to represent ranges, for array bounds. @@ -419,12 +420,14 @@ void dump() const; }; - /// DIBlock - This is a wrapper for a block (e.g. a function, scope, etc). - class DIBlock : public DIDescriptor { + /// DILexicalBlock - This is a wrapper for a lexical block. + class DILexicalBlock : public DIScope { public: - explicit DIBlock(MDNode *N = 0) - : DIDescriptor(N, dwarf::DW_TAG_lexical_block) {} - + explicit DILexicalBlock(MDNode *N = 0) { + DbgNode = N; + if (DbgNode && !isLexicalBlock()) + DbgNode = 0; + } DIDescriptor getContext() const { return getDescriptorField(1); } }; @@ -524,9 +527,9 @@ DICompileUnit CompileUnit, unsigned LineNo, DIType Type); - /// CreateBlock - This creates a descriptor for a lexical block with the - /// specified parent context. - DIBlock CreateBlock(DIDescriptor Context); + /// CreateLexicalBlock - This creates a descriptor for a lexical block + /// with the specified parent context. + DILexicalBlock CreateLexicalBlock(DIDescriptor Context); /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation, /// inserting it at the end of the specified basic block. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80633&r1=80632&r2=80633&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 17:00:15 2009 @@ -235,6 +235,14 @@ return Tag == dwarf::DW_TAG_compile_unit; } +/// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block. +bool DIDescriptor::isLexicalBlock() const { + assert (!isNull() && "Invalid descriptor!"); + unsigned Tag = getTag(); + + return Tag == dwarf::DW_TAG_lexical_block; +} + //===----------------------------------------------------------------------===// // Simple Descriptor Constructors and other Methods //===----------------------------------------------------------------------===// @@ -758,12 +766,12 @@ /// CreateBlock - This creates a descriptor for a lexical block with the /// specified parent VMContext. -DIBlock DIFactory::CreateBlock(DIDescriptor Context) { +DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context) { Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_lexical_block), Context.getNode() }; - return DIBlock(MDNode::get(VMContext, &Elts[0], 2)); + return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2)); } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=80633&r1=80632&r2=80633&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 31 17:00:15 2009 @@ -1222,7 +1222,7 @@ if (Slot) return Slot; DbgScope *Parent = NULL; - DIBlock Block(N); + DILexicalBlock Block(N); // Don't create a new scope if we already created one for an inlined function. DenseMap::iterator From dpatel at apple.com Mon Aug 31 17:01:01 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 22:01:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80635 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200908312201.n7VM113h009019@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 17:01:01 2009 New Revision: 80635 URL: http://llvm.org/viewvc/llvm-project?rev=80635&view=rev Log: Rename DIBlock as DILexicalBlock. Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=80635&r1=80634&r2=80635&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Mon Aug 31 17:01:01 2009 @@ -272,7 +272,7 @@ llvm::DIDescriptor D; if (!RegionStack.empty()) D = RegionStack.back(); - D = DebugFactory.CreateBlock(D); + D = DebugFactory.CreateLexicalBlock(D); RegionStack.push_back(D); DebugFactory.InsertRegionStart(D, CurBB); } From evan.cheng at apple.com Mon Aug 31 17:36:49 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 31 Aug 2009 15:36:49 -0700 Subject: [llvm-commits] [llvm] r80630 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp In-Reply-To: <200908312154.n7VLsGGP008067@zion.cs.uiuc.edu> References: <200908312154.n7VLsGGP008067@zion.cs.uiuc.edu> Message-ID: <34CF69FA-5DC2-4D97-B595-EA5426E2CEA3@apple.com> Thanks. Is this fixing an actual bug? Test case? Evan On Aug 31, 2009, at 2:54 PM, Bob Wilson wrote: > Author: bwilson > Date: Mon Aug 31 16:54:16 2009 > New Revision: 80630 > > URL: http://llvm.org/viewvc/llvm-project?rev=80630&view=rev > Log: > If the tied registers are already the same, there is no need to change > them. Move the code to make that change inside the conditional. > > Modified: > llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > > Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80630&r1=80629&r2=80630&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) > +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Aug 31 > 16:54:16 2009 > @@ -985,13 +985,13 @@ > mi->getOperand(i).getReg() == regB) > mi->getOperand(i).setReg(regA); > } > - } > > - assert(mi->getOperand(ti).isDef() && mi->getOperand > (si).isUse()); > - mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); > - MadeChange = true; > + assert(mi->getOperand(ti).isDef() && mi->getOperand > (si).isUse()); > + mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); > + MadeChange = true; > > - DEBUG(errs() << "\t\trewrite to:\t" << *mi); > + DEBUG(errs() << "\t\trewrite to:\t" << *mi); > + } > } > > mi = nmi; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From bob.wilson at apple.com Mon Aug 31 17:43:29 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 31 Aug 2009 15:43:29 -0700 Subject: [llvm-commits] [llvm] r80630 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp In-Reply-To: <34CF69FA-5DC2-4D97-B595-EA5426E2CEA3@apple.com> References: <200908312154.n7VLsGGP008067@zion.cs.uiuc.edu> <34CF69FA-5DC2-4D97-B595-EA5426E2CEA3@apple.com> Message-ID: <2D01B34E-3FA9-47DD-81C6-4185D82B3141@apple.com> On Aug 31, 2009, at 3:36 PM, Evan Cheng wrote: > Thanks. Is this fixing an actual bug? Test case? No bug. Just cleaning up. Bug fix coming soon.... > > Evan > > On Aug 31, 2009, at 2:54 PM, Bob Wilson wrote: > >> Author: bwilson >> Date: Mon Aug 31 16:54:16 2009 >> New Revision: 80630 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80630&view=rev >> Log: >> If the tied registers are already the same, there is no need to >> change >> them. Move the code to make that change inside the conditional. >> >> Modified: >> llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp >> >> Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80630&r1=80629&r2=80630&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) >> +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Aug 31 >> 16:54:16 2009 >> @@ -985,13 +985,13 @@ >> mi->getOperand(i).getReg() == regB) >> mi->getOperand(i).setReg(regA); >> } >> - } >> >> - assert(mi->getOperand(ti).isDef() && mi->getOperand >> (si).isUse()); >> - mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); >> - MadeChange = true; >> + assert(mi->getOperand(ti).isDef() && mi->getOperand >> (si).isUse()); >> + mi->getOperand(ti).setReg(mi->getOperand(si).getReg()); >> + MadeChange = true; >> >> - DEBUG(errs() << "\t\trewrite to:\t" << *mi); >> + DEBUG(errs() << "\t\trewrite to:\t" << *mi); >> + } >> } >> >> mi = nmi; >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dpatel at apple.com Mon Aug 31 17:47:14 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Aug 2009 22:47:14 -0000 Subject: [llvm-commits] [llvm] r80637 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h Message-ID: <200908312247.n7VMlE2f014885@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 17:47:13 2009 New Revision: 80637 URL: http://llvm.org/viewvc/llvm-project?rev=80637&view=rev Log: Subprogram is a scope. Derive DISubprogram from DIScope. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80637&r1=80636&r2=80637&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 17:47:13 2009 @@ -342,11 +342,26 @@ }; /// DISubprogram - This is a wrapper for a subprogram (e.g. a function). - class DISubprogram : public DIGlobal { + class DISubprogram : public DIScope { public: - explicit DISubprogram(MDNode *N = 0) - : DIGlobal(N, dwarf::DW_TAG_subprogram) {} + explicit DISubprogram(MDNode *N = 0) { + DbgNode = N; + if (DbgNode && !isSubprogram()) + DbgNode = 0; + } + DIDescriptor getContext() const { return getDescriptorField(2); } + const std::string &getName(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDisplayName(std::string &F) const { + return getStringField(4, F); + } + const std::string &getLinkageName(std::string &F) const { + return getStringField(5, F); + } + DICompileUnit getCompileUnit() const{ return getFieldAs(6); } + unsigned getLineNumber() const { return getUnsignedField(7); } DICompositeType getType() const { return getFieldAs(8); } /// getReturnTypeName - Subprogram return types are encoded either as @@ -362,6 +377,11 @@ return T.getName(F); } + /// isLocalToUnit - Return true if this subprogram is local to the current + /// compile unit, like 'static' in C. + unsigned isLocalToUnit() const { return getUnsignedField(9); } + unsigned isDefinition() const { return getUnsignedField(10); } + /// Verify - Verify that a subprogram descriptor is well formed. bool Verify() const; Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80637&r1=80636&r2=80637&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 17:47:13 2009 @@ -494,7 +494,24 @@ /// dump - Print subprogram. void DISubprogram::dump() const { - DIGlobal::dump(); + std::string Res; + if (!getName(Res).empty()) + errs() << " [" << Res << "] "; + + unsigned Tag = getTag(); + errs() << " [" << dwarf::TagString(Tag) << "] "; + + // TODO : Print context + getCompileUnit().dump(); + errs() << " [" << getLineNumber() << "] "; + + if (isLocalToUnit()) + errs() << " [local] "; + + if (isDefinition()) + errs() << " [def] "; + + errs() << "\n"; } /// dump - Print global variable. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=80637&r1=80636&r2=80637&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 31 17:47:13 2009 @@ -487,6 +487,23 @@ AddUInt(Die, dwarf::DW_AT_decl_file, 0, FileID); AddUInt(Die, dwarf::DW_AT_decl_line, 0, Line); } + +/// AddSourceLine - Add location information to specified debug information +/// entry. +void DwarfDebug::AddSourceLine(DIE *Die, const DISubprogram *SP) { + // If there is no compile unit specified, don't add a line #. + if (SP->getCompileUnit().isNull()) + return; + + unsigned Line = SP->getLineNumber(); + unsigned FileID = FindCompileUnit(SP->getCompileUnit()).getID(); + assert(FileID && "Invalid file id"); + AddUInt(Die, dwarf::DW_AT_decl_file, 0, FileID); + AddUInt(Die, dwarf::DW_AT_decl_line, 0, Line); +} + +/// AddSourceLine - Add location information to specified debug information +/// entry. void DwarfDebug::AddSourceLine(DIE *Die, const DIType *Ty) { // If there is no compile unit specified, don't add a line #. DICompileUnit CU = Ty->getCompileUnit(); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=80637&r1=80636&r2=80637&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Aug 31 17:47:13 2009 @@ -275,11 +275,8 @@ /// AddSourceLine - Add location information to specified debug information /// entry. void AddSourceLine(DIE *Die, const DIVariable *V); - - /// AddSourceLine - Add location information to specified debug information - /// entry. void AddSourceLine(DIE *Die, const DIGlobal *G); - + void AddSourceLine(DIE *Die, const DISubprogram *SP); void AddSourceLine(DIE *Die, const DIType *Ty); /// AddAddress - Add an address attribute to a die based on the location From asl at math.spbu.ru Mon Aug 31 18:16:02 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 31 Aug 2009 23:16:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80638 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm-modes.def arm.c arm.h arm_neon.h llvm-arm.cpp neon-gen.ml neon.md neon.ml Message-ID: <200908312316.n7VNG3A6018495@zion.cs.uiuc.edu> Author: asl Date: Mon Aug 31 18:16:02 2009 New Revision: 80638 URL: http://llvm.org/viewvc/llvm-project?rev=80638&view=rev Log: Use V1DI mode for v1i64 NEON vectors, not just DI mode. This fixes more than 150 fails in gcc NEON testsuite. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-modes.def llvm-gcc-4.2/trunk/gcc/config/arm/arm.c llvm-gcc-4.2/trunk/gcc/config/arm/arm.h llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml llvm-gcc-4.2/trunk/gcc/config/arm/neon.md llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-modes.def URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm-modes.def?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm-modes.def (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm-modes.def Mon Aug 31 18:16:02 2009 @@ -58,6 +58,10 @@ VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */ VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */ +/* LLVM LOCAL begin */ +VECTOR_MODE (INT, DI, 1); /* V1DI */ +/* LLVM LOCAL end */ + /* APPLE LOCAL begin v7 support. Merge from Codesourcery */ /* Opaque integer modes for 3, 4, 6 or 8 Neon double registers (2 is TImode). */ Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Mon Aug 31 18:16:02 2009 @@ -16244,7 +16244,9 @@ T_V4HI = 0x0002, T_V2SI = 0x0004, T_V2SF = 0x0008, - T_DI = 0x0010, + /* LLVM LOCAL begin */ + T_V1DI = 0x0010, + /* LLVM LOCAL end */ T_V16QI = 0x0020, T_V8HI = 0x0040, T_V4SI = 0x0080, @@ -16259,7 +16261,9 @@ #define v4hi_UP T_V4HI #define v2si_UP T_V2SI #define v2sf_UP T_V2SF -#define di_UP T_DI +/* LLVM LOCAL begin */ +#define v1di_UP T_V1DI +/* LLVM LOCAL end */ #define v16qi_UP T_V16QI #define v8hi_UP T_V8HI #define v4si_UP T_V4SI @@ -16389,14 +16393,15 @@ WARNING: Variants should be listed in the same increasing order as neon_builtin_type_bits. */ +/* LLVM LOCAL begin */ static neon_builtin_datum neon_builtin_data[] = { { VAR10 (BINOP, vadd, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR3 (BINOP, vaddl, v8qi, v4hi, v2si) }, { VAR3 (BINOP, vaddw, v8qi, v4hi, v2si) }, { VAR6 (BINOP, vhadd, v8qi, v4hi, v2si, v16qi, v8hi, v4si) }, - { VAR8 (BINOP, vqadd, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (BINOP, vqadd, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, { VAR3 (BINOP, vaddhn, v8hi, v4si, v2di) }, { VAR8 (BINOP, vmul, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, { VAR8 (TERNOP, vmla, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, @@ -16414,22 +16419,22 @@ { VAR4 (SCALARMULH, vqdmulh_n, v4hi, v2si, v8hi, v4si) }, { VAR4 (LANEMULH, vqdmulh_lane, v4hi, v2si, v8hi, v4si) }, { VAR2 (BINOP, vqdmull, v4hi, v2si) }, - { VAR8 (BINOP, vshl, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, - { VAR8 (BINOP, vqshl, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, - { VAR8 (SHIFTIMM, vshr_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (BINOP, vshl, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (BINOP, vqshl, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTIMM, vshr_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, { VAR3 (SHIFTIMM, vshrn_n, v8hi, v4si, v2di) }, { VAR3 (SHIFTIMM, vqshrn_n, v8hi, v4si, v2di) }, { VAR3 (SHIFTIMM, vqshrun_n, v8hi, v4si, v2di) }, - { VAR8 (SHIFTIMM, vshl_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, - { VAR8 (SHIFTIMM, vqshl_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, - { VAR8 (SHIFTIMM, vqshlu_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTIMM, vshl_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTIMM, vqshl_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTIMM, vqshlu_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, { VAR3 (SHIFTIMM, vshll_n, v8qi, v4hi, v2si) }, - { VAR8 (SHIFTACC, vsra_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTACC, vsra_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, { VAR10 (BINOP, vsub, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR3 (BINOP, vsubl, v8qi, v4hi, v2si) }, { VAR3 (BINOP, vsubw, v8qi, v4hi, v2si) }, - { VAR8 (BINOP, vqsub, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (BINOP, vqsub, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, { VAR6 (BINOP, vhsub, v8qi, v4hi, v2si, v16qi, v8hi, v4si) }, { VAR3 (BINOP, vsubhn, v8hi, v4si, v2di) }, { VAR8 (BINOP, vceq, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, @@ -16451,8 +16456,8 @@ { VAR4 (BINOP, vpmin, v8qi, v4hi, v2si, v2sf) }, { VAR2 (BINOP, vrecps, v2sf, v4sf) }, { VAR2 (BINOP, vrsqrts, v2sf, v4sf) }, - { VAR8 (SHIFTINSERT, vsri_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, - { VAR8 (SHIFTINSERT, vsli_n, v8qi, v4hi, v2si, di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTINSERT, vsri_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, + { VAR8 (SHIFTINSERT, vsli_n, v8qi, v4hi, v2si, v1di, v16qi, v8hi, v4si, v2di) }, { VAR8 (UNOP, vabs, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, { VAR6 (UNOP, vqabs, v8qi, v4hi, v2si, v16qi, v8hi, v4si) }, { VAR8 (UNOP, vneg, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, @@ -16465,15 +16470,15 @@ { VAR6 (UNOP, vmvn, v8qi, v4hi, v2si, v16qi, v8hi, v4si) }, /* FIXME: vget_lane supports more variants than this! */ { VAR10 (GETLANE, vget_lane, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (SETLANE, vset_lane, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, - { VAR5 (CREATE, vcreate, v8qi, v4hi, v2si, v2sf, di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, + { VAR5 (CREATE, vcreate, v8qi, v4hi, v2si, v2sf, v1di) }, { VAR10 (DUP, vdup_n, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (DUPLANE, vdup_lane, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, - { VAR5 (COMBINE, vcombine, v8qi, v4hi, v2si, v2sf, di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, + { VAR5 (COMBINE, vcombine, v8qi, v4hi, v2si, v2sf, v1di) }, { VAR5 (SPLIT, vget_high, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR5 (SPLIT, vget_low, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR3 (UNOP, vmovn, v8hi, v4si, v2di) }, @@ -16495,14 +16500,14 @@ { VAR2 (SCALARMAC, vmlsl_n, v4hi, v2si) }, { VAR2 (SCALARMAC, vqdmlsl_n, v4hi, v2si) }, { VAR10 (BINOP, vext, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR8 (UNOP, vrev64, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, { VAR4 (UNOP, vrev32, v8qi, v4hi, v16qi, v8hi) }, { VAR2 (UNOP, vrev16, v8qi, v16qi) }, { VAR4 (CONVERT, vcvt, v2si, v2sf, v4si, v4sf) }, { VAR4 (FIXCONV, vcvt_n, v2si, v2sf, v4si, v4sf) }, { VAR10 (SELECT, vbsl, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR1 (VTBL, vtbl1, v8qi) }, { VAR1 (VTBL, vtbl2, v8qi) }, { VAR1 (VTBL, vtbl3, v8qi) }, @@ -16514,64 +16519,65 @@ { VAR8 (RESULTPAIR, vtrn, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, { VAR8 (RESULTPAIR, vzip, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, { VAR8 (RESULTPAIR, vuzp, v8qi, v4hi, v2si, v2sf, v16qi, v8hi, v4si, v4sf) }, - { VAR5 (REINTERP, vreinterpretv8qi, v8qi, v4hi, v2si, v2sf, di) }, - { VAR5 (REINTERP, vreinterpretv4hi, v8qi, v4hi, v2si, v2sf, di) }, - { VAR5 (REINTERP, vreinterpretv2si, v8qi, v4hi, v2si, v2sf, di) }, - { VAR5 (REINTERP, vreinterpretv2sf, v8qi, v4hi, v2si, v2sf, di) }, - { VAR5 (REINTERP, vreinterpretdi, v8qi, v4hi, v2si, v2sf, di) }, + { VAR5 (REINTERP, vreinterpretv8qi, v8qi, v4hi, v2si, v2sf, v1di) }, + { VAR5 (REINTERP, vreinterpretv4hi, v8qi, v4hi, v2si, v2sf, v1di) }, + { VAR5 (REINTERP, vreinterpretv2si, v8qi, v4hi, v2si, v2sf, v1di) }, + { VAR5 (REINTERP, vreinterpretv2sf, v8qi, v4hi, v2si, v2sf, v1di) }, + { VAR5 (REINTERP, vreinterpretv1di, v8qi, v4hi, v2si, v2sf, v1di) }, { VAR5 (REINTERP, vreinterpretv16qi, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR5 (REINTERP, vreinterpretv8hi, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR5 (REINTERP, vreinterpretv4si, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR5 (REINTERP, vreinterpretv4sf, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR5 (REINTERP, vreinterpretv2di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (LOAD1, vld1, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (LOAD1LANE, vld1_lane, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (LOAD1, vld1_dup, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (STORE1, vst1, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (STORE1LANE, vst1_lane, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR9 (LOADSTRUCT, - vld2, v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) }, + vld2, v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf) }, { VAR7 (LOADSTRUCTLANE, vld2_lane, v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) }, - { VAR5 (LOADSTRUCT, vld2_dup, v8qi, v4hi, v2si, v2sf, di) }, + { VAR5 (LOADSTRUCT, vld2_dup, v8qi, v4hi, v2si, v2sf, v1di) }, { VAR9 (STORESTRUCT, vst2, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf) }, { VAR7 (STORESTRUCTLANE, vst2_lane, v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) }, { VAR9 (LOADSTRUCT, - vld3, v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) }, + vld3, v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf) }, { VAR7 (LOADSTRUCTLANE, vld3_lane, v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) }, - { VAR5 (LOADSTRUCT, vld3_dup, v8qi, v4hi, v2si, v2sf, di) }, + { VAR5 (LOADSTRUCT, vld3_dup, v8qi, v4hi, v2si, v2sf, v1di) }, { VAR9 (STORESTRUCT, vst3, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf) }, { VAR7 (STORESTRUCTLANE, vst3_lane, v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) }, { VAR9 (LOADSTRUCT, vld4, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf) }, { VAR7 (LOADSTRUCTLANE, vld4_lane, v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) }, - { VAR5 (LOADSTRUCT, vld4_dup, v8qi, v4hi, v2si, v2sf, di) }, + { VAR5 (LOADSTRUCT, vld4_dup, v8qi, v4hi, v2si, v2sf, v1di) }, { VAR9 (STORESTRUCT, vst4, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf) }, { VAR7 (STORESTRUCTLANE, vst4_lane, v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) }, { VAR10 (LOGICBINOP, vand, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (LOGICBINOP, vorr, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (BINOP, veor, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (LOGICBINOP, vbic, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) }, + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) }, { VAR10 (LOGICBINOP, vorn, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) } + v8qi, v4hi, v2si, v2sf, v1di, v16qi, v8hi, v4si, v4sf, v2di) } }; +/* LLVM LOCAL end */ #undef CF #undef VAR1 @@ -16605,7 +16611,7 @@ /* LLVM LOCAL begin multi-vector types */ #ifdef ENABLE_LLVM /* Create a new builtin struct type containing NUMVECS fields (where NUMVECS - is in the range from 2 to 4) of type VECTYPE. */ + is in the range from 1 to 4) of type VECTYPE. */ static tree build_multivec_type (tree vectype, unsigned numvecs, const char *tag) { @@ -16617,7 +16623,7 @@ name = build_decl (TYPE_DECL, get_identifier (tag), record); TYPE_NAME (record) = name; - gcc_assert (numvecs >= 2 && numvecs <= 4); + gcc_assert (numvecs >= 1 && numvecs <= 4); fields = NULL; for (n = 0; n < numvecs; ++n) { @@ -16671,6 +16677,9 @@ #define v8hi_TN V8HI_type_node #define v4si_TN V4SI_type_node #define v4sf_TN V4SF_type_node +/* LLVM LOCAL begin */ +#define v1di_TN V1DI_type_node +/* LLVM LOCAL end */ #define v2di_TN V2DI_type_node /* LLVM LOCAL begin multi-vector types */ @@ -16679,13 +16688,14 @@ #define pv4hi_TN V4HI2_type_node #define pv2si_TN V2SI2_type_node #define pv2sf_TN V2SF2_type_node -#define pdi_TN DI2_type_node +#define pdi_TN DI1_type_node #define pv16qi_TN V16QI2_type_node #define pv8hi_TN V8HI2_type_node #define pv4si_TN V4SI2_type_node #define pv4sf_TN V4SF2_type_node #define pv2di_TN V2DI2_type_node +#define pv1di_TN V1DI2_type_node #else /* !ENABLE_LLVM */ #define pv8qi_TN V8QI_pointer_node #define pv4hi_TN V4HI_pointer_node @@ -16775,6 +16785,11 @@ build_vector_type_for_mode (neon_intSI_type_node, V2SImode); tree V2SF_type_node = build_vector_type_for_mode (neon_float_type_node, V2SFmode); + /* LLVM LOCAL begin */ + tree V1DI_type_node = + build_vector_type_for_mode (neon_intDI_type_node, V1DImode); + /* LLVM LOCAL end */ + /* 128-bit vectors. */ tree V16QI_type_node = build_vector_type_for_mode (neon_intQI_type_node, V16QImode); @@ -16801,6 +16816,10 @@ "__builtin_neon_v4hi2"); tree V2SI2_type_node = build_multivec_type (V2SI_type_node, 2, "__builtin_neon_v2si2"); + tree V1DI2_type_node = build_multivec_type (V1DI_type_node, 1, + "__builtin_neon_v1di2"); + tree DI1_type_node = build_multivec_type (neon_intDI_type_node, 1, + "__builtin_neon_di1"); tree DI2_type_node = build_multivec_type (neon_intDI_type_node, 2, "__builtin_neon_di2"); tree V2SF2_type_node = build_multivec_type (V2SF_type_node, 2, @@ -16899,13 +16918,14 @@ #endif /* ENABLE_LLVM */ /* LLVM LOCAL end multi-vector types */ + /* LLVM LOCAL begin */ /* Binops, all-doubleword arithmetic. */ TYPE4 (v8qi, v8qi, v8qi, si); TYPE4 (v4hi, v4hi, v4hi, si); TYPE4 (v2si, v2si, v2si, si); TYPE4 (v2sf, v2sf, v2sf, si); - TYPE4 (di, di, di, si); - + TYPE4 (v1di, v1di, v1di, si); + /* Binops, all-quadword arithmetic. */ TYPE4 (v16qi, v16qi, v16qi, si); TYPE4 (v8hi, v8hi, v8hi, si); @@ -16936,7 +16956,7 @@ /* Binops, dest and first operand elements wider (vpadal). */ TYPE4 (v4hi, v4hi, v8qi, si); TYPE4 (v2si, v2si, v4hi, si); - TYPE4 (di, di, v2si, si); + TYPE4 (v1di, v1di, v2si, si); TYPE4 (v8hi, v8hi, v16qi, si); TYPE4 (v4si, v4si, v8hi, si); TYPE4 (v2di, v2di, v4si, si); @@ -16964,7 +16984,7 @@ TYPE3 (v4hi, v4hi, si); TYPE3 (v2si, v2si, si); TYPE3 (v2sf, v2sf, si); - TYPE3 (di, di, si); + TYPE3 (v1di, v1di, si); /* Unops, all-quadword arithmetic. */ TYPE3 (v16qi, v16qi, si); @@ -16986,7 +17006,7 @@ /* Unops, dest elements wider (vpaddl). */ TYPE3 (v4hi, v8qi, si); TYPE3 (v2si, v4hi, si); - TYPE3 (di, v2si, si); + TYPE3 (v1di, v2si, si); TYPE3 (v8hi, v16qi, si); TYPE3 (v4si, v8hi, si); TYPE3 (v2di, v4si, si); @@ -16996,7 +17016,7 @@ TYPE4 (hi, v4hi, si, si); TYPE4 (si, v2si, si, si); TYPE4 (sf, v2sf, si, si); - TYPE4 (di, di, si, si); + TYPE4 (di, v1di, si, si); /* Get-lane from quadword insns. */ TYPE4 (qi, v16qi, si, si); @@ -17010,6 +17030,7 @@ TYPE4 (v4hi, hi, v4hi, si); TYPE4 (v2si, si, v2si, si); TYPE4 (v2sf, sf, v2sf, si); + TYPE4 (v1di, di, v1di, si); /* Set lane in quadword insns. */ TYPE4 (v16qi, qi, v16qi, si); @@ -17023,7 +17044,7 @@ TYPE2 (v4hi, di); TYPE2 (v2si, di); TYPE2 (v2sf, di); - TYPE2 (di, di); + TYPE2 (v1di, di); /* Duplicate an ARM register into lanes of a vector. */ TYPE2 (v8qi, qi); @@ -17042,21 +17063,21 @@ TYPE3 (v8hi, v4hi, si); TYPE3 (v4si, v2si, si); TYPE3 (v4sf, v2sf, si); - TYPE3 (v2di, di, si); + TYPE3 (v2di, v1di, si); /* Combine doubleword vectors into quadword vectors. */ TYPE3 (v16qi, v8qi, v8qi); TYPE3 (v8hi, v4hi, v4hi); TYPE3 (v4si, v2si, v2si); TYPE3 (v4sf, v2sf, v2sf); - TYPE3 (v2di, di, di); + TYPE3 (v2di, v1di, v1di); /* Split quadword vectors into high or low parts. */ TYPE2 (v8qi, v16qi); TYPE2 (v4hi, v8hi); TYPE2 (v2si, v4si); TYPE2 (v2sf, v4sf); - TYPE2 (di, v2di); + TYPE2 (v1di, v2di); /* Conversions, int<->float. */ TYPE3 (v2si, v2sf, si); @@ -17123,7 +17144,7 @@ TYPE4 (v4hi, v4hi, v4hi, v4hi); TYPE4 (v2si, v2si, v2si, v2si); TYPE4 (v2sf, v2si, v2sf, v2sf); - TYPE4 (di, di, di, di); + TYPE4 (v1di, v1di, v1di, v1di); TYPE4 (v16qi, v16qi, v16qi, v16qi); TYPE4 (v8hi, v8hi, v8hi, v8hi); @@ -17134,6 +17155,7 @@ /* Shift immediate operations. */ TYPE4 (v8qi, v8qi, si, si); TYPE4 (v4hi, v4hi, si, si); + TYPE4 (v1di, v1di, si, si); TYPE4 (v16qi, v16qi, si, si); TYPE4 (v8hi, v8hi, si, si); @@ -17151,12 +17173,13 @@ /* Shift + accumulate operations. */ TYPE5 (v8qi, v8qi, v8qi, si, si); - TYPE5 (di, di, di, si, si); + TYPE5 (v1di, v1di, v1di, si, si); TYPE5 (v16qi, v16qi, v16qi, si, si); TYPE5 (v8hi, v8hi, v8hi, si, si); TYPE5 (v4sf, v4sf, v4sf, si, si); TYPE5 (v2di, v2di, v2di, si, si); + /* LLVM LOCAL end */ /* Operations which return results as pairs. */ /* LLVM LOCAL begin multi-vector types */ @@ -17164,7 +17187,7 @@ TYPE4_RESULTPAIR (void, pv4hi, v4hi, v4hi); TYPE4_RESULTPAIR (void, pv2si, v2si, v2si); TYPE4_RESULTPAIR (void, pv2sf, v2sf, v2sf); - TYPE4_RESULTPAIR (void, pdi, di, di); + TYPE4_RESULTPAIR (void, pv1di, v1di, v1di); TYPE4_RESULTPAIR (void, pv16qi, v16qi, v16qi); TYPE4_RESULTPAIR (void, pv8hi, v8hi, v8hi); @@ -17192,8 +17215,10 @@ build_function_type_list (V4HI_type_node, const_intHI_pointer_node, NULL); tree v2si_ftype_const_si_pointer = build_function_type_list (V2SI_type_node, const_intSI_pointer_node, NULL); - tree di_ftype_const_di_pointer = - build_function_type_list (intDI_type_node, const_intDI_pointer_node, NULL); + /* LLVM LOCAL begin */ + tree v1di_ftype_const_di_pointer = + build_function_type_list (V1DI_type_node, const_intDI_pointer_node, NULL); + /* LLVM LOCAL end */ tree v2sf_ftype_const_sf_pointer = build_function_type_list (V2SF_type_node, const_float_pointer_node, NULL); @@ -17219,9 +17244,11 @@ tree v2si_ftype_const_si_pointer_v2si_si = build_function_type_list (V2SI_type_node, const_intSI_pointer_node, V2SI_type_node, intSI_type_node, NULL); - tree di_ftype_const_di_pointer_di_si = - build_function_type_list (intDI_type_node, const_intDI_pointer_node, - intDI_type_node, intSI_type_node, NULL); + /* LLVM LOCAL begin */ + tree v1di_ftype_const_di_pointer_v1di_si = + build_function_type_list (V1DI_type_node, const_intDI_pointer_node, + V1DI_type_node, intSI_type_node, NULL); + /* LLVM LOCAL end */ tree v2sf_ftype_const_sf_pointer_v2sf_si = build_function_type_list (V2SF_type_node, const_float_pointer_node, V2SF_type_node, intSI_type_node, NULL); @@ -17253,9 +17280,11 @@ tree void_ftype_si_pointer_v2si = build_function_type_list (void_type_node, intSI_pointer_node, V2SI_type_node, NULL); - tree void_ftype_di_pointer_di = + /* LLVM LOCAL begin */ + tree void_ftype_di_pointer_v1di = build_function_type_list (void_type_node, intDI_pointer_node, - intDI_type_node, NULL); + V1DI_type_node, NULL); + /* LLVM LOCAL end */ tree void_ftype_sf_pointer_v2sf = build_function_type_list (void_type_node, float_pointer_node, V2SF_type_node, NULL); @@ -17287,9 +17316,11 @@ tree void_ftype_si_pointer_v2si_si = build_function_type_list (void_type_node, intSI_pointer_node, V2SI_type_node, intSI_type_node, NULL); - tree void_ftype_di_pointer_di_si = + /* LLVM LOCAL begin */ + tree void_ftype_di_pointer_v1di_si = build_function_type_list (void_type_node, intDI_pointer_node, - intDI_type_node, intSI_type_node, NULL); + V1DI_type_node, intSI_type_node, NULL); + /* LLVM LOCAL end */ tree void_ftype_sf_pointer_v2sf_si = build_function_type_list (void_type_node, float_pointer_node, V2SF_type_node, intSI_type_node, NULL); @@ -17678,6 +17709,8 @@ "__builtin_neon_v4hi2"); (*lang_hooks.types.register_builtin_type) (V2SI2_type_node, "__builtin_neon_v2si2"); + (*lang_hooks.types.register_builtin_type) (DI1_type_node, + "__builtin_neon_di1"); (*lang_hooks.types.register_builtin_type) (DI2_type_node, "__builtin_neon_di2"); (*lang_hooks.types.register_builtin_type) (V2SF2_type_node, @@ -17733,7 +17766,9 @@ dreg_types[1] = V4HI_type_node; dreg_types[2] = V2SI_type_node; dreg_types[3] = V2SF_type_node; - dreg_types[4] = neon_intDI_type_node; + /* LLVM LOCAL begin */ + dreg_types[4] = V1DI_type_node; + /* LLVM LOCAL end */ qreg_types[0] = V16QI_type_node; qreg_types[1] = V8HI_type_node; @@ -17762,10 +17797,12 @@ for (j = 0; j < T_MAX; j++) { + /* LLVM LOCAL begin */ const char* const modenames[] = { - "v8qi", "v4hi", "v2si", "v2sf", "di", + "v8qi", "v4hi", "v2si", "v2sf", "v1di", "v16qi", "v8hi", "v4si", "v4sf", "v2di" }; + /* LLVM LOCAL end */ char namebuf[60]; tree ftype = NULL; enum insn_code icode; @@ -17821,12 +17858,14 @@ ftype = v2sf_ftype_v2sf_si; break; - case DImode: - if (mode0 == DImode) - ftype = di_ftype_di_si; + /* LLVM LOCAL begin */ + case V1DImode: + if (mode0 == V1DImode) + ftype = v1di_ftype_v1di_si; else if (mode0 == V2SImode) - ftype = di_ftype_v2si_si; + ftype = v1di_ftype_v2si_si; break; + /* LLVM LOCAL end */ case V16QImode: if (mode0 == V16QImode) @@ -17911,12 +17950,14 @@ ftype = v2sf_ftype_v2sf_v2sf_si; break; - case DImode: - if (mode0 == DImode && mode1 == DImode) - ftype = di_ftype_di_di_si; - else if (mode0 == DImode && mode1 == V2SImode) - ftype = di_ftype_di_v2si_si; + /* LLVM LOCAL begin */ + case V1DImode: + if (mode0 == V1DImode && mode1 == V1DImode) + ftype = v1di_ftype_v1di_v1di_si; + else if (mode0 == V1DImode && mode1 == V2SImode) + ftype = v1di_ftype_v1di_v2si_si; break; + /* LLVM LOCAL end */ case V16QImode: if (mode0 == V16QImode && mode1 == V16QImode) @@ -18045,7 +18086,7 @@ case NEON_GETLANE: /* Vector lane extraction. */ - gcc_assert (valid_neon_mode (mode0) && mode1 == SImode + gcc_assert (valid_neon_mode (mode0) && mode1 == SImode && mode2 == SImode); switch (tmode) { @@ -18077,12 +18118,14 @@ ftype = sf_ftype_v4sf_si_si; break; + /* LLVM LOCAL begin */ case DImode: - if (mode0 == DImode) - ftype = di_ftype_di_si_si; + if (mode0 == V1DImode) + ftype = di_ftype_v1di_si_si; else if (mode0 == V2DImode) ftype = di_ftype_v2di_si_si; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); @@ -18115,10 +18158,12 @@ ftype = v2sf_ftype_sf_v2sf_si; break; - case DImode: - if (mode0 == DImode && mode1 == DImode) - ftype = di_ftype_di_di_si; + /* LLVM LOCAL begin */ + case V1DImode: + if (mode0 == DImode && mode1 == V1DImode) + ftype = v1di_ftype_di_v1di_si; break; + /* LLVM LOCAL end */ case V16QImode: if (mode0 == QImode && mode1 == V16QImode) @@ -18160,13 +18205,15 @@ case V4HImode: ftype = v4hi_ftype_di; break; case V2SImode: ftype = v2si_ftype_di; break; case V2SFmode: ftype = v2sf_ftype_di; break; - case DImode: ftype = di_ftype_di; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = v1di_ftype_di; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; case NEON_DUP: - gcc_assert ((mode0 == DImode && tmode == DImode) + gcc_assert ((mode0 == DImode && tmode == V1DImode) || mode0 == GET_MODE_INNER (tmode)); switch (tmode) { @@ -18174,7 +18221,9 @@ case V4HImode: ftype = v4hi_ftype_hi; break; case V2SImode: ftype = v2si_ftype_si; break; case V2SFmode: ftype = v2sf_ftype_sf; break; - case DImode: ftype = di_ftype_di; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = v1di_ftype_di; break; + /* LLVM LOCAL end */ case V16QImode: ftype = v16qi_ftype_qi; break; case V8HImode: ftype = v8hi_ftype_hi; break; case V4SImode: ftype = v4si_ftype_si; break; @@ -18192,12 +18241,16 @@ case V4HImode: ftype = v4hi_ftype_v4hi_si; break; case V2SImode: ftype = v2si_ftype_v2si_si; break; case V2SFmode: ftype = v2sf_ftype_v2sf_si; break; - case DImode: ftype = di_ftype_di_si; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = v1di_ftype_v1di_si; break; + /* LLVM LOCAL end */ case V16QImode: ftype = v16qi_ftype_v8qi_si; break; case V8HImode: ftype = v8hi_ftype_v4hi_si; break; case V4SImode: ftype = v4si_ftype_v2si_si; break; case V4SFmode: ftype = v4sf_ftype_v2sf_si; break; - case V2DImode: ftype = v2di_ftype_di_si; break; + /* LLVM LOCAL begin */ + case V2DImode: ftype = v2di_ftype_v1di_si; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; @@ -18227,10 +18280,12 @@ ftype = v2si_ftype_v2di_si_si; break; - case DImode: - if (mode0 == DImode) - ftype = di_ftype_di_si_si; + /* LLVM LOCAL begin */ + case V1DImode: + if (mode0 == V1DImode) + ftype = v1di_ftype_v1di_si_si; break; + /* LLVM LOCAL end */ case V16QImode: if (mode0 == V16QImode) @@ -18271,7 +18326,9 @@ case V4HImode: ftype = v4hi_ftype_v4hi_v4hi_si_si; break; case V2SImode: ftype = v2si_ftype_v2si_v2si_si_si; break; case V2SFmode: ftype = v2sf_ftype_v2sf_v2sf_si_si; break; - case DImode: ftype = di_ftype_di_di_si_si; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = v1di_ftype_v1di_v1di_si_si; break; + /* LLVM LOCAL end */ case V16QImode: ftype = v16qi_ftype_v16qi_v16qi_si_si; break; case V8HImode: ftype = v8hi_ftype_v8hi_v8hi_si_si; break; case V4SImode: ftype = v4si_ftype_v4si_v4si_si_si; break; @@ -18304,11 +18361,13 @@ if (mode0 == V2SFmode && mode1 == V2SFmode) ftype = v4sf_ftype_v2sf_v2sf; break; - + + /* LLVM LOCAL begin */ case V2DImode: - if (mode0 == DImode && mode1 == DImode) - ftype = v2di_ftype_di_di; + if (mode0 == V1DImode && mode1 == V1DImode) + ftype = v2di_ftype_v1di_v1di; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); @@ -18339,10 +18398,12 @@ ftype = v2sf_ftype_v4sf; break; - case DImode: + /* LLVM LOCAL begin */ + case V1DImode: if (mode0 == V2DImode) - ftype = di_ftype_v2di; + ftype = v1di_ftype_v2di; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); @@ -18711,7 +18772,9 @@ case V4HImode: ftype = v4hi_ftype_v4hi_v4hi_v4hi; break; case V2SImode: ftype = v2si_ftype_v2si_v2si_v2si; break; case V2SFmode: ftype = v2sf_ftype_v2si_v2sf_v2sf; break; - case DImode: ftype = di_ftype_di_di_di; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = v1di_ftype_v1di_v1di_v1di; break; + /* LLVM LOCAL end */ case V16QImode: ftype = v16qi_ftype_v16qi_v16qi_v16qi; break; case V8HImode: ftype = v8hi_ftype_v8hi_v8hi_v8hi; break; case V4SImode: ftype = v4si_ftype_v4si_v4si_v4si; break; @@ -18758,7 +18821,9 @@ case V4HImode: ftype = void_ftype_pv4hi_v4hi_v4hi; break; case V2SImode: ftype = void_ftype_pv2si_v2si_v2si; break; case V2SFmode: ftype = void_ftype_pv2sf_v2sf_v2sf; break; - case DImode: ftype = void_ftype_pdi_di_di; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = void_ftype_pv1di_v1di_v1di; break; + /* LLVM LOCAL end */ case V16QImode: ftype = void_ftype_pv16qi_v16qi_v16qi; break; case V8HImode: ftype = void_ftype_pv8hi_v8hi_v8hi; break; case V4SImode: ftype = void_ftype_pv4si_v4si_v4si; break; @@ -18780,7 +18845,9 @@ case V4HImode: ftype = reinterp_ftype_dreg[1][rhs]; break; case V2SImode: ftype = reinterp_ftype_dreg[2][rhs]; break; case V2SFmode: ftype = reinterp_ftype_dreg[3][rhs]; break; - case DImode: ftype = reinterp_ftype_dreg[4][rhs]; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = reinterp_ftype_dreg[4][rhs]; break; + /* LLVM LOCAL end */ case V16QImode: ftype = reinterp_ftype_qreg[0][rhs]; break; case V8HImode: ftype = reinterp_ftype_qreg[1][rhs]; break; case V4SImode: ftype = reinterp_ftype_qreg[2][rhs]; break; @@ -18798,7 +18865,9 @@ case V4HImode: ftype = v4hi_ftype_const_hi_pointer; break; case V2SImode: ftype = v2si_ftype_const_si_pointer; break; case V2SFmode: ftype = v2sf_ftype_const_sf_pointer; break; - case DImode: ftype = di_ftype_const_di_pointer; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = v1di_ftype_const_di_pointer; break; + /* LLVM LOCAL end */ case V16QImode: ftype = v16qi_ftype_const_qi_pointer; break; case V8HImode: ftype = v8hi_ftype_const_hi_pointer; break; case V4SImode: ftype = v4si_ftype_const_si_pointer; break; @@ -18823,9 +18892,11 @@ case V2SFmode: ftype = v2sf_ftype_const_sf_pointer_v2sf_si; break; - case DImode: - ftype = di_ftype_const_di_pointer_di_si; + /* LLVM LOCAL begin */ + case V1DImode: + ftype = v1di_ftype_const_di_pointer_v1di_si; break; + /* LLVM LOCAL end */ case V16QImode: ftype = v16qi_ftype_const_qi_pointer_v16qi_si; break; @@ -18853,7 +18924,9 @@ case V4HImode: ftype = void_ftype_hi_pointer_v4hi; break; case V2SImode: ftype = void_ftype_si_pointer_v2si; break; case V2SFmode: ftype = void_ftype_sf_pointer_v2sf; break; - case DImode: ftype = void_ftype_di_pointer_di; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = void_ftype_di_pointer_v1di; break; + /* LLVM LOCAL end */ case V16QImode: ftype = void_ftype_qi_pointer_v16qi; break; case V8HImode: ftype = void_ftype_hi_pointer_v8hi; break; case V4SImode: ftype = void_ftype_si_pointer_v4si; break; @@ -18870,7 +18943,9 @@ case V4HImode: ftype = void_ftype_hi_pointer_v4hi_si; break; case V2SImode: ftype = void_ftype_si_pointer_v2si_si; break; case V2SFmode: ftype = void_ftype_sf_pointer_v2sf_si; break; - case DImode: ftype = void_ftype_di_pointer_di_si; break; + /* LLVM LOCAL begin */ + case V1DImode: ftype = void_ftype_di_pointer_v1di_si; break; + /* LLVM LOCAL end */ case V16QImode: ftype = void_ftype_qi_pointer_v16qi_si; break; case V8HImode: ftype = void_ftype_hi_pointer_v8hi_si; break; case V4SImode: ftype = void_ftype_si_pointer_v4si_si; break; @@ -18891,7 +18966,9 @@ case T_V4HI: ftype = ti_ftype_const_hi_pointer; break; case T_V2SI: ftype = ti_ftype_const_si_pointer; break; case T_V2SF: ftype = ti_ftype_const_sf_pointer; break; - case T_DI: ftype = ti_ftype_const_di_pointer; break; + /* LLVM LOCAL begin */ + case T_V1DI: ftype = ti_ftype_const_di_pointer; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; @@ -18904,7 +18981,9 @@ case T_V4HI: ftype = ei_ftype_const_hi_pointer; break; case T_V2SI: ftype = ei_ftype_const_si_pointer; break; case T_V2SF: ftype = ei_ftype_const_sf_pointer; break; - case T_DI: ftype = ei_ftype_const_di_pointer; break; + /* LLVM LOCAL begin */ + case T_V1DI: ftype = ei_ftype_const_di_pointer; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; @@ -18925,7 +19004,9 @@ case T_V2SI: ftype = oid_ftype_const_si_pointer; break; case T_V2SF: ftype = oid_ftype_const_sf_pointer; break; /* LLVM LOCAL end multi-vector types */ - case T_DI: ftype = oi_ftype_const_di_pointer; break; + /* LLVM LOCAL begin */ + case T_V1DI: ftype = oi_ftype_const_di_pointer; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; @@ -19091,7 +19172,9 @@ case T_V4HI: ftype = void_ftype_hi_pointer_ti; break; case T_V2SI: ftype = void_ftype_si_pointer_ti; break; case T_V2SF: ftype = void_ftype_sf_pointer_ti; break; - case T_DI: ftype = void_ftype_di_pointer_ti; break; + /* LLVM LOCAL begin */ + case T_V1DI: ftype = void_ftype_di_pointer_ti; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; @@ -19104,7 +19187,9 @@ case T_V4HI: ftype = void_ftype_hi_pointer_ei; break; case T_V2SI: ftype = void_ftype_si_pointer_ei; break; case T_V2SF: ftype = void_ftype_sf_pointer_ei; break; - case T_DI: ftype = void_ftype_di_pointer_ei; break; + /* LLVM LOCAL begin */ + case T_V1DI: ftype = void_ftype_di_pointer_ei; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; @@ -19125,7 +19210,9 @@ case T_V2SI: ftype = void_ftype_si_pointer_oid; break; case T_V2SF: ftype = void_ftype_sf_pointer_oid; break; /* LLVM LOCAL end multi-vector types */ - case T_DI: ftype = void_ftype_di_pointer_oi; break; + /* LLVM LOCAL begin */ + case T_V1DI: ftype = void_ftype_di_pointer_oi; break; + /* LLVM LOCAL end */ default: gcc_unreachable (); } break; Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Mon Aug 31 18:16:02 2009 @@ -1138,9 +1138,11 @@ /* APPLE LOCAL begin v7 support. Merge from Codesourcery */ /* Modes valid for Neon D registers. */ +/* LLVM LOCAL begin */ #define VALID_NEON_DREG_MODE(MODE) \ ((MODE) == V2SImode || (MODE) == V4HImode || (MODE) == V8QImode \ - || (MODE) == V2SFmode || (MODE) == DImode) + || (MODE) == V2SFmode || (MODE) == V1DImode) +/* LLVM LOCAL end */ /* Modes valid for Neon Q registers. */ #define VALID_NEON_QREG_MODE(MODE) \ @@ -3365,7 +3367,9 @@ NEON_BUILTIN_vreinterpretv4hi, NEON_BUILTIN_vreinterpretv2si, NEON_BUILTIN_vreinterpretv2sf, - NEON_BUILTIN_vreinterpretdi, + /* LLVM LOCAL begin */ + NEON_BUILTIN_vreinterpretv1di, + /* LLVM LOCAL end */ NEON_BUILTIN_vreinterpretv16qi, NEON_BUILTIN_vreinterpretv8hi, NEON_BUILTIN_vreinterpretv4si, Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h Mon Aug 31 18:16:02 2009 @@ -46,14 +46,14 @@ typedef __builtin_neon_qi int8x8_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_hi int16x4_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_si int32x2_t __attribute__ ((__vector_size__ (8))); -typedef __builtin_neon_di int64x1_t; +typedef __builtin_neon_di int64x1_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_sf float32x2_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_poly8 poly8x8_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_poly16 poly16x4_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_uqi uint8x8_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_uhi uint16x4_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_usi uint32x2_t __attribute__ ((__vector_size__ (8))); -typedef __builtin_neon_udi uint64x1_t; +typedef __builtin_neon_udi uint64x1_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_qi int8x16_t __attribute__ ((__vector_size__ (16))); typedef __builtin_neon_hi int16x8_t __attribute__ ((__vector_size__ (16))); typedef __builtin_neon_si int32x4_t __attribute__ ((__vector_size__ (16))); @@ -411,7 +411,7 @@ (int32x2_t)__builtin_neon_vaddv2si (__a, __b, 1) #define vadd_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vadddi (__a, __b, 1) + (int64x1_t)__builtin_neon_vaddv1di (__a, __b, 1) #define vadd_f32(__a, __b) \ (float32x2_t)__builtin_neon_vaddv2sf (__a, __b, 5) @@ -426,7 +426,7 @@ (uint32x2_t)__builtin_neon_vaddv2si (__a, __b, 0) #define vadd_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vadddi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vaddv1di (__a, __b, 0) #define vaddq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vaddv16qi (__a, __b, 1) @@ -573,7 +573,7 @@ (int32x2_t)__builtin_neon_vqaddv2si (__a, __b, 1) #define vqadd_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqadddi (__a, __b, 1) + (int64x1_t)__builtin_neon_vqaddv1di (__a, __b, 1) #define vqadd_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vqaddv8qi (__a, __b, 0) @@ -585,7 +585,7 @@ (uint32x2_t)__builtin_neon_vqaddv2si (__a, __b, 0) #define vqadd_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqadddi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vqaddv1di (__a, __b, 0) #define vqaddq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vqaddv16qi (__a, __b, 1) @@ -888,7 +888,7 @@ (int32x2_t)__builtin_neon_vsubv2si (__a, __b, 1) #define vsub_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vsubdi (__a, __b, 1) + (int64x1_t)__builtin_neon_vsubv1di (__a, __b, 1) #define vsub_f32(__a, __b) \ (float32x2_t)__builtin_neon_vsubv2sf (__a, __b, 5) @@ -903,7 +903,7 @@ (uint32x2_t)__builtin_neon_vsubv2si (__a, __b, 0) #define vsub_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vsubdi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vsubv1di (__a, __b, 0) #define vsubq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vsubv16qi (__a, __b, 1) @@ -1014,7 +1014,7 @@ (int32x2_t)__builtin_neon_vqsubv2si (__a, __b, 1) #define vqsub_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqsubdi (__a, __b, 1) + (int64x1_t)__builtin_neon_vqsubv1di (__a, __b, 1) #define vqsub_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vqsubv8qi (__a, __b, 0) @@ -1026,7 +1026,7 @@ (uint32x2_t)__builtin_neon_vqsubv2si (__a, __b, 0) #define vqsub_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqsubdi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vqsubv1di (__a, __b, 0) #define vqsubq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vqsubv16qi (__a, __b, 1) @@ -1725,7 +1725,7 @@ (int32x2_t)__builtin_neon_vshlv2si (__a, __b, 1) #define vshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshldi (__a, __b, 1) + (int64x1_t)__builtin_neon_vshlv1di (__a, __b, 1) #define vshl_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vshlv8qi (__a, __b, 0) @@ -1737,7 +1737,7 @@ (uint32x2_t)__builtin_neon_vshlv2si (__a, __b, 0) #define vshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshldi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vshlv1di (__a, __b, 0) #define vshlq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vshlv16qi (__a, __b, 1) @@ -1773,7 +1773,7 @@ (int32x2_t)__builtin_neon_vshlv2si (__a, __b, 3) #define vrshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshldi (__a, __b, 3) + (int64x1_t)__builtin_neon_vshlv1di (__a, __b, 3) #define vrshl_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vshlv8qi (__a, __b, 2) @@ -1785,7 +1785,7 @@ (uint32x2_t)__builtin_neon_vshlv2si (__a, __b, 2) #define vrshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshldi (__a, __b, 2) + (uint64x1_t)__builtin_neon_vshlv1di (__a, __b, 2) #define vrshlq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vshlv16qi (__a, __b, 3) @@ -1821,7 +1821,7 @@ (int32x2_t)__builtin_neon_vqshlv2si (__a, __b, 1) #define vqshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqshldi (__a, __b, 1) + (int64x1_t)__builtin_neon_vqshlv1di (__a, __b, 1) #define vqshl_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 0) @@ -1833,7 +1833,7 @@ (uint32x2_t)__builtin_neon_vqshlv2si (__a, __b, 0) #define vqshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshldi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vqshlv1di (__a, __b, 0) #define vqshlq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 1) @@ -1869,7 +1869,7 @@ (int32x2_t)__builtin_neon_vqshlv2si (__a, __b, 3) #define vqrshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqshldi (__a, __b, 3) + (int64x1_t)__builtin_neon_vqshlv1di (__a, __b, 3) #define vqrshl_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 2) @@ -1881,7 +1881,7 @@ (uint32x2_t)__builtin_neon_vqshlv2si (__a, __b, 2) #define vqrshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshldi (__a, __b, 2) + (uint64x1_t)__builtin_neon_vqshlv1di (__a, __b, 2) #define vqrshlq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 3) @@ -1917,7 +1917,7 @@ (int32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 1) #define vshr_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshr_ndi (__a, __b, 1) + (int64x1_t)__builtin_neon_vshr_nv1di (__a, __b, 1) #define vshr_n_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 0) @@ -1929,7 +1929,7 @@ (uint32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 0) #define vshr_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshr_ndi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vshr_nv1di (__a, __b, 0) #define vshrq_n_s8(__a, __b) \ (int8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 1) @@ -1965,7 +1965,7 @@ (int32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 3) #define vrshr_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshr_ndi (__a, __b, 3) + (int64x1_t)__builtin_neon_vshr_nv1di (__a, __b, 3) #define vrshr_n_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 2) @@ -1977,7 +1977,7 @@ (uint32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 2) #define vrshr_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshr_ndi (__a, __b, 2) + (uint64x1_t)__builtin_neon_vshr_nv1di (__a, __b, 2) #define vrshrq_n_s8(__a, __b) \ (int8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 3) @@ -2103,7 +2103,7 @@ (int32x2_t)__builtin_neon_vshl_nv2si (__a, __b, 1) #define vshl_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshl_ndi (__a, __b, 1) + (int64x1_t)__builtin_neon_vshl_nv1di (__a, __b, 1) #define vshl_n_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vshl_nv8qi (__a, __b, 0) @@ -2115,7 +2115,7 @@ (uint32x2_t)__builtin_neon_vshl_nv2si (__a, __b, 0) #define vshl_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshl_ndi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vshl_nv1di (__a, __b, 0) #define vshlq_n_s8(__a, __b) \ (int8x16_t)__builtin_neon_vshl_nv16qi (__a, __b, 1) @@ -2151,7 +2151,7 @@ (int32x2_t)__builtin_neon_vqshl_nv2si (__a, __b, 1) #define vqshl_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqshl_ndi (__a, __b, 1) + (int64x1_t)__builtin_neon_vqshl_nv1di (__a, __b, 1) #define vqshl_n_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vqshl_nv8qi (__a, __b, 0) @@ -2163,7 +2163,7 @@ (uint32x2_t)__builtin_neon_vqshl_nv2si (__a, __b, 0) #define vqshl_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshl_ndi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vqshl_nv1di (__a, __b, 0) #define vqshlq_n_s8(__a, __b) \ (int8x16_t)__builtin_neon_vqshl_nv16qi (__a, __b, 1) @@ -2199,7 +2199,7 @@ (uint32x2_t)__builtin_neon_vqshlu_nv2si (__a, __b, 1) #define vqshlu_n_s64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshlu_ndi (__a, __b, 1) + (uint64x1_t)__builtin_neon_vqshlu_nv1di (__a, __b, 1) #define vqshluq_n_s8(__a, __b) \ (uint8x16_t)__builtin_neon_vqshlu_nv16qi (__a, __b, 1) @@ -2241,7 +2241,7 @@ (int32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 1) #define vsra_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 1) + (int64x1_t)__builtin_neon_vsra_nv1di (__a, __b, __c, 1) #define vsra_n_u8(__a, __b, __c) \ (uint8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 0) @@ -2253,7 +2253,7 @@ (uint32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 0) #define vsra_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 0) + (uint64x1_t)__builtin_neon_vsra_nv1di (__a, __b, __c, 0) #define vsraq_n_s8(__a, __b, __c) \ (int8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 1) @@ -2289,7 +2289,7 @@ (int32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 3) #define vrsra_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 3) + (int64x1_t)__builtin_neon_vsra_nv1di (__a, __b, __c, 3) #define vrsra_n_u8(__a, __b, __c) \ (uint8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 2) @@ -2301,7 +2301,7 @@ (uint32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 2) #define vrsra_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 2) + (uint64x1_t)__builtin_neon_vsra_nv1di (__a, __b, __c, 2) #define vrsraq_n_s8(__a, __b, __c) \ (int8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 3) @@ -2337,7 +2337,7 @@ (int32x2_t)__builtin_neon_vsri_nv2si (__a, __b, __c) #define vsri_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsri_ndi (__a, __b, __c) + (int64x1_t)__builtin_neon_vsri_nv1di (__a, __b, __c) #define vsri_n_u8(__a, __b, __c) \ (uint8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c) @@ -2349,7 +2349,7 @@ (uint32x2_t)__builtin_neon_vsri_nv2si (__a, __b, __c) #define vsri_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsri_ndi (__a, __b, __c) + (uint64x1_t)__builtin_neon_vsri_nv1di (__a, __b, __c) #define vsri_n_p8(__a, __b, __c) \ (poly8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c) @@ -2397,7 +2397,7 @@ (int32x2_t)__builtin_neon_vsli_nv2si (__a, __b, __c) #define vsli_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsli_ndi (__a, __b, __c) + (int64x1_t)__builtin_neon_vsli_nv1di (__a, __b, __c) #define vsli_n_u8(__a, __b, __c) \ (uint8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c) @@ -2409,7 +2409,7 @@ (uint32x2_t)__builtin_neon_vsli_nv2si (__a, __b, __c) #define vsli_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsli_ndi (__a, __b, __c) + (uint64x1_t)__builtin_neon_vsli_nv1di (__a, __b, __c) #define vsli_n_p8(__a, __b, __c) \ (poly8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c) @@ -2697,10 +2697,10 @@ (poly16_t)__builtin_neon_vget_lanev4hi (__a, __b, 4) #define vget_lane_s64(__a, __b) \ - (int64_t)__builtin_neon_vget_lanedi (__a, __b, 1) + (int64_t)__builtin_neon_vget_lanev1di (__a, __b, 1) #define vget_lane_u64(__a, __b) \ - (uint64_t)__builtin_neon_vget_lanedi (__a, __b, 0) + (uint64_t)__builtin_neon_vget_lanev1di (__a, __b, 0) #define vgetq_lane_s8(__a, __b) \ (int8_t)__builtin_neon_vget_lanev16qi (__a, __b, 1) @@ -2763,10 +2763,10 @@ (poly16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c) #define vset_lane_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vset_lanedi (__a, __b, __c) + (int64x1_t)__builtin_neon_vset_lanev1di (__a, __b, __c) #define vset_lane_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vset_lanedi (__a, __b, __c) + (uint64x1_t)__builtin_neon_vset_lanev1di (__a, __b, __c) #define vsetq_lane_s8(__a, __b, __c) \ (int8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c) @@ -2811,7 +2811,7 @@ (int32x2_t)__builtin_neon_vcreatev2si (__a) #define vcreate_s64(__a) \ - (int64x1_t)__builtin_neon_vcreatedi (__a) + (int64x1_t)__builtin_neon_vcreatev1di (__a) #define vcreate_f32(__a) \ (float32x2_t)__builtin_neon_vcreatev2sf (__a) @@ -2826,7 +2826,7 @@ (uint32x2_t)__builtin_neon_vcreatev2si (__a) #define vcreate_u64(__a) \ - (uint64x1_t)__builtin_neon_vcreatedi (__a) + (uint64x1_t)__builtin_neon_vcreatev1di (__a) #define vcreate_p8(__a) \ (poly8x8_t)__builtin_neon_vcreatev8qi (__a) @@ -2862,10 +2862,10 @@ (poly16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vdup_n_s64(__a) \ - (int64x1_t)__builtin_neon_vdup_ndi (__a) + (int64x1_t)__builtin_neon_vdup_nv1di (__a) #define vdup_n_u64(__a) \ - (uint64x1_t)__builtin_neon_vdup_ndi (__a) + (uint64x1_t)__builtin_neon_vdup_nv1di (__a) #define vdupq_n_s8(__a) \ (int8x16_t)__builtin_neon_vdup_nv16qi (__a) @@ -2928,10 +2928,10 @@ (poly16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vmov_n_s64(__a) \ - (int64x1_t)__builtin_neon_vdup_ndi (__a) + (int64x1_t)__builtin_neon_vdup_nv1di (__a) #define vmov_n_u64(__a) \ - (uint64x1_t)__builtin_neon_vdup_ndi (__a) + (uint64x1_t)__builtin_neon_vdup_nv1di (__a) #define vmovq_n_s8(__a) \ (int8x16_t)__builtin_neon_vdup_nv16qi (__a) @@ -2994,10 +2994,10 @@ (poly16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b) #define vdup_lane_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vdup_lanedi (__a, __b) + (int64x1_t)__builtin_neon_vdup_lanev1di (__a, __b) #define vdup_lane_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vdup_lanedi (__a, __b) + (uint64x1_t)__builtin_neon_vdup_lanev1di (__a, __b) #define vdupq_lane_s8(__a, __b) \ (int8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b) @@ -3042,7 +3042,7 @@ (int32x4_t)__builtin_neon_vcombinev2si (__a, __b) #define vcombine_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vcombinedi (__a, __b) + (int64x2_t)__builtin_neon_vcombinev1di (__a, __b) #define vcombine_f32(__a, __b) \ (float32x4_t)__builtin_neon_vcombinev2sf (__a, __b) @@ -3057,7 +3057,7 @@ (uint32x4_t)__builtin_neon_vcombinev2si (__a, __b) #define vcombine_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vcombinedi (__a, __b) + (uint64x2_t)__builtin_neon_vcombinev1di (__a, __b) #define vcombine_p8(__a, __b) \ (poly8x16_t)__builtin_neon_vcombinev8qi (__a, __b) @@ -3714,7 +3714,7 @@ (int32x2_t)__builtin_neon_vextv2si (__a, __b, __c) #define vext_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vextdi (__a, __b, __c) + (int64x1_t)__builtin_neon_vextv1di (__a, __b, __c) #define vext_f32(__a, __b, __c) \ (float32x2_t)__builtin_neon_vextv2sf (__a, __b, __c) @@ -3729,7 +3729,7 @@ (uint32x2_t)__builtin_neon_vextv2si (__a, __b, __c) #define vext_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vextdi (__a, __b, __c) + (uint64x1_t)__builtin_neon_vextv1di (__a, __b, __c) #define vext_p8(__a, __b, __c) \ (poly8x8_t)__builtin_neon_vextv8qi (__a, __b, __c) @@ -3888,7 +3888,7 @@ (int32x2_t)__builtin_neon_vbslv2si (__a, __b, __c) #define vbsl_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vbsldi (__a, __b, __c) + (int64x1_t)__builtin_neon_vbslv1di (__a, __b, __c) #define vbsl_f32(__a, __b, __c) \ (float32x2_t)__builtin_neon_vbslv2sf (__a, __b, __c) @@ -3903,7 +3903,7 @@ (uint32x2_t)__builtin_neon_vbslv2si (__a, __b, __c) #define vbsl_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vbsldi (__a, __b, __c) + (uint64x1_t)__builtin_neon_vbslv1di (__a, __b, __c) #define vbsl_p8(__a, __b, __c) \ (poly8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c) @@ -4332,7 +4332,7 @@ (int32x2_t)__builtin_neon_vld1v2si (__a) #define vld1_s64(__a) \ - (int64x1_t)__builtin_neon_vld1di (__a) + (int64x1_t)__builtin_neon_vld1v1di (__a) #define vld1_f32(__a) \ (float32x2_t)__builtin_neon_vld1v2sf (__a) @@ -4347,7 +4347,7 @@ (uint32x2_t)__builtin_neon_vld1v2si (__a) #define vld1_u64(__a) \ - (uint64x1_t)__builtin_neon_vld1di (__a) + (uint64x1_t)__builtin_neon_vld1v1di (__a) #define vld1_p8(__a) \ (poly8x8_t)__builtin_neon_vld1v8qi (__a) @@ -4416,10 +4416,10 @@ (poly16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c) #define vld1_lane_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vld1_lanedi (__a, __b, __c) + (int64x1_t)__builtin_neon_vld1_lanev1di (__a, __b, __c) #define vld1_lane_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vld1_lanedi (__a, __b, __c) + (uint64x1_t)__builtin_neon_vld1_lanev1di (__a, __b, __c) #define vld1q_lane_s8(__a, __b, __c) \ (int8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c) @@ -4482,10 +4482,10 @@ (poly16x4_t)__builtin_neon_vld1_dupv4hi (__a) #define vld1_dup_s64(__a) \ - (int64x1_t)__builtin_neon_vld1_dupdi (__a) + (int64x1_t)__builtin_neon_vld1_dupv1di (__a) #define vld1_dup_u64(__a) \ - (uint64x1_t)__builtin_neon_vld1_dupdi (__a) + (uint64x1_t)__builtin_neon_vld1_dupv1di (__a) #define vld1q_dup_s8(__a) \ (int8x16_t)__builtin_neon_vld1_dupv16qi (__a) @@ -4530,7 +4530,7 @@ __builtin_neon_vst1v2si (__a, __b) #define vst1_s64(__a, __b) \ - __builtin_neon_vst1di (__a, __b) + __builtin_neon_vst1v1di (__a, __b) #define vst1_f32(__a, __b) \ __builtin_neon_vst1v2sf (__a, __b) @@ -4545,7 +4545,7 @@ __builtin_neon_vst1v2si (__a, __b) #define vst1_u64(__a, __b) \ - __builtin_neon_vst1di (__a, __b) + __builtin_neon_vst1v1di (__a, __b) #define vst1_p8(__a, __b) \ __builtin_neon_vst1v8qi (__a, __b) @@ -4614,10 +4614,10 @@ __builtin_neon_vst1_lanev4hi (__a, __b, __c) #define vst1_lane_s64(__a, __b, __c) \ - __builtin_neon_vst1_lanedi (__a, __b, __c) + __builtin_neon_vst1_lanev1di (__a, __b, __c) #define vst1_lane_u64(__a, __b, __c) \ - __builtin_neon_vst1_lanedi (__a, __b, __c) + __builtin_neon_vst1_lanev1di (__a, __b, __c) #define vst1q_lane_s8(__a, __b, __c) \ __builtin_neon_vst1_lanev16qi (__a, __b, __c) @@ -4718,14 +4718,14 @@ #define vld2_s64(__a) \ ({ \ union { int64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ - __rv.__o = __builtin_neon_vld2di (__a); \ + __rv.__o = __builtin_neon_vld2v1di (__a); \ __rv.__i; \ }) #define vld2_u64(__a) \ ({ \ union { uint64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ - __rv.__o = __builtin_neon_vld2di (__a); \ + __rv.__o = __builtin_neon_vld2v1di (__a); \ __rv.__i; \ }) @@ -4978,14 +4978,14 @@ #define vld2_dup_s64(__a) \ ({ \ union { int64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ - __rv.__o = __builtin_neon_vld2_dupdi (__a); \ + __rv.__o = __builtin_neon_vld2_dupv1di (__a); \ __rv.__i; \ }) #define vld2_dup_u64(__a) \ ({ \ union { uint64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ - __rv.__o = __builtin_neon_vld2_dupdi (__a); \ + __rv.__o = __builtin_neon_vld2_dupv1di (__a); \ __rv.__i; \ }) @@ -5046,13 +5046,13 @@ #define vst2_s64(__a, __b) \ ({ \ union { int64x1x2_t __i; __builtin_neon_di2 __o; } __bu = { __b }; \ - __builtin_neon_vst2di (__a, __bu.__o); \ + __builtin_neon_vst2v1di (__a, __bu.__o); \ }) #define vst2_u64(__a, __b) \ ({ \ union { uint64x1x2_t __i; __builtin_neon_di2 __o; } __bu = { __b }; \ - __builtin_neon_vst2di (__a, __bu.__o); \ + __builtin_neon_vst2v1di (__a, __bu.__o); \ }) #define vst2q_s8(__a, __b) \ @@ -5265,14 +5265,14 @@ #define vld3_s64(__a) \ ({ \ union { int64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ - __rv.__o = __builtin_neon_vld3di (__a); \ + __rv.__o = __builtin_neon_vld3v1di (__a); \ __rv.__i; \ }) #define vld3_u64(__a) \ ({ \ union { uint64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ - __rv.__o = __builtin_neon_vld3di (__a); \ + __rv.__o = __builtin_neon_vld3v1di (__a); \ __rv.__i; \ }) @@ -5525,14 +5525,14 @@ #define vld3_dup_s64(__a) \ ({ \ union { int64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ - __rv.__o = __builtin_neon_vld3_dupdi (__a); \ + __rv.__o = __builtin_neon_vld3_dupv1di (__a); \ __rv.__i; \ }) #define vld3_dup_u64(__a) \ ({ \ union { uint64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ - __rv.__o = __builtin_neon_vld3_dupdi (__a); \ + __rv.__o = __builtin_neon_vld3_dupv1di (__a); \ __rv.__i; \ }) @@ -5593,13 +5593,13 @@ #define vst3_s64(__a, __b) \ ({ \ union { int64x1x3_t __i; __builtin_neon_di3 __o; } __bu = { __b }; \ - __builtin_neon_vst3di (__a, __bu.__o); \ + __builtin_neon_vst3v1di (__a, __bu.__o); \ }) #define vst3_u64(__a, __b) \ ({ \ union { uint64x1x3_t __i; __builtin_neon_di3 __o; } __bu = { __b }; \ - __builtin_neon_vst3di (__a, __bu.__o); \ + __builtin_neon_vst3v1di (__a, __bu.__o); \ }) #define vst3q_s8(__a, __b) \ @@ -5812,14 +5812,14 @@ #define vld4_s64(__a) \ ({ \ union { int64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ - __rv.__o = __builtin_neon_vld4di (__a); \ + __rv.__o = __builtin_neon_vld4v1di (__a); \ __rv.__i; \ }) #define vld4_u64(__a) \ ({ \ union { uint64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ - __rv.__o = __builtin_neon_vld4di (__a); \ + __rv.__o = __builtin_neon_vld4v1di (__a); \ __rv.__i; \ }) @@ -6072,14 +6072,14 @@ #define vld4_dup_s64(__a) \ ({ \ union { int64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ - __rv.__o = __builtin_neon_vld4_dupdi (__a); \ + __rv.__o = __builtin_neon_vld4_dupv1di (__a); \ __rv.__i; \ }) #define vld4_dup_u64(__a) \ ({ \ union { uint64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ - __rv.__o = __builtin_neon_vld4_dupdi (__a); \ + __rv.__o = __builtin_neon_vld4_dupv1di (__a); \ __rv.__i; \ }) @@ -6140,13 +6140,13 @@ #define vst4_s64(__a, __b) \ ({ \ union { int64x1x4_t __i; __builtin_neon_di4 __o; } __bu = { __b }; \ - __builtin_neon_vst4di (__a, __bu.__o); \ + __builtin_neon_vst4v1di (__a, __bu.__o); \ }) #define vst4_u64(__a, __b) \ ({ \ union { uint64x1x4_t __i; __builtin_neon_di4 __o; } __bu = { __b }; \ - __builtin_neon_vst4di (__a, __bu.__o); \ + __builtin_neon_vst4v1di (__a, __bu.__o); \ }) #define vst4q_s8(__a, __b) \ @@ -6303,7 +6303,7 @@ (int32x2_t)__builtin_neon_vandv2si (__a, __b, 1) #define vand_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vanddi (__a, __b, 1) + (int64x1_t)__builtin_neon_vandv1di (__a, __b, 1) #define vand_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vandv8qi (__a, __b, 0) @@ -6315,7 +6315,7 @@ (uint32x2_t)__builtin_neon_vandv2si (__a, __b, 0) #define vand_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vanddi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vandv1di (__a, __b, 0) #define vandq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vandv16qi (__a, __b, 1) @@ -6351,7 +6351,7 @@ (int32x2_t)__builtin_neon_vorrv2si (__a, __b, 1) #define vorr_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vorrdi (__a, __b, 1) + (int64x1_t)__builtin_neon_vorrv1di (__a, __b, 1) #define vorr_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vorrv8qi (__a, __b, 0) @@ -6363,7 +6363,7 @@ (uint32x2_t)__builtin_neon_vorrv2si (__a, __b, 0) #define vorr_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vorrdi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vorrv1di (__a, __b, 0) #define vorrq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vorrv16qi (__a, __b, 1) @@ -6399,7 +6399,7 @@ (int32x2_t)__builtin_neon_veorv2si (__a, __b, 1) #define veor_s64(__a, __b) \ - (int64x1_t)__builtin_neon_veordi (__a, __b, 1) + (int64x1_t)__builtin_neon_veorv1di (__a, __b, 1) #define veor_u8(__a, __b) \ (uint8x8_t)__builtin_neon_veorv8qi (__a, __b, 0) @@ -6411,7 +6411,7 @@ (uint32x2_t)__builtin_neon_veorv2si (__a, __b, 0) #define veor_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_veordi (__a, __b, 0) + (uint64x1_t)__builtin_neon_veorv1di (__a, __b, 0) #define veorq_s8(__a, __b) \ (int8x16_t)__builtin_neon_veorv16qi (__a, __b, 1) @@ -6447,7 +6447,7 @@ (int32x2_t)__builtin_neon_vbicv2si (__a, __b, 1) #define vbic_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vbicdi (__a, __b, 1) + (int64x1_t)__builtin_neon_vbicv1di (__a, __b, 1) #define vbic_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vbicv8qi (__a, __b, 0) @@ -6459,7 +6459,7 @@ (uint32x2_t)__builtin_neon_vbicv2si (__a, __b, 0) #define vbic_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vbicdi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vbicv1di (__a, __b, 0) #define vbicq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vbicv16qi (__a, __b, 1) @@ -6495,7 +6495,7 @@ (int32x2_t)__builtin_neon_vornv2si (__a, __b, 1) #define vorn_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vorndi (__a, __b, 1) + (int64x1_t)__builtin_neon_vornv1di (__a, __b, 1) #define vorn_u8(__a, __b) \ (uint8x8_t)__builtin_neon_vornv8qi (__a, __b, 0) @@ -6507,7 +6507,7 @@ (uint32x2_t)__builtin_neon_vornv2si (__a, __b, 0) #define vorn_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vorndi (__a, __b, 0) + (uint64x1_t)__builtin_neon_vornv1di (__a, __b, 0) #define vornq_s8(__a, __b) \ (int8x16_t)__builtin_neon_vornv16qi (__a, __b, 1) @@ -6544,7 +6544,7 @@ (poly8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_p8_s64(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qidi (__a) + (poly8x8_t)__builtin_neon_vreinterpretv8qiv1di (__a) #define vreinterpret_p8_f32(__a) \ (poly8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a) @@ -6559,7 +6559,7 @@ (poly8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_p8_u64(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qidi (__a) + (poly8x8_t)__builtin_neon_vreinterpretv8qiv1di (__a) #define vreinterpret_p8_p16(__a) \ (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) @@ -6604,7 +6604,7 @@ (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_p16_s64(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hidi (__a) + (poly16x4_t)__builtin_neon_vreinterpretv4hiv1di (__a) #define vreinterpret_p16_f32(__a) \ (poly16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a) @@ -6619,7 +6619,7 @@ (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_p16_u64(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hidi (__a) + (poly16x4_t)__builtin_neon_vreinterpretv4hiv1di (__a) #define vreinterpret_p16_p8(__a) \ (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) @@ -6664,7 +6664,7 @@ (float32x2_t)__builtin_neon_vreinterpretv2sfv2si (__a) #define vreinterpret_f32_s64(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfdi (__a) + (float32x2_t)__builtin_neon_vreinterpretv2sfv1di (__a) #define vreinterpret_f32_u8(__a) \ (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a) @@ -6676,7 +6676,7 @@ (float32x2_t)__builtin_neon_vreinterpretv2sfv2si (__a) #define vreinterpret_f32_u64(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfdi (__a) + (float32x2_t)__builtin_neon_vreinterpretv2sfv1di (__a) #define vreinterpret_f32_p8(__a) \ (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a) @@ -6715,34 +6715,34 @@ (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a) #define vreinterpret_s64_s8(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div8qi (__a) #define vreinterpret_s64_s16(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div4hi (__a) #define vreinterpret_s64_s32(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv2si (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div2si (__a) #define vreinterpret_s64_f32(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv2sf (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div2sf (__a) #define vreinterpret_s64_u8(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div8qi (__a) #define vreinterpret_s64_u16(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div4hi (__a) #define vreinterpret_s64_u32(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv2si (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div2si (__a) #define vreinterpret_s64_u64(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdidi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div1di (__a) #define vreinterpret_s64_p8(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div8qi (__a) #define vreinterpret_s64_p16(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) + (int64x1_t)__builtin_neon_vreinterpretv1div4hi (__a) #define vreinterpretq_s64_s8(__a) \ (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) @@ -6775,34 +6775,34 @@ (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpret_u64_s8(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div8qi (__a) #define vreinterpret_u64_s16(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div4hi (__a) #define vreinterpret_u64_s32(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv2si (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div2si (__a) #define vreinterpret_u64_s64(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdidi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div1di (__a) #define vreinterpret_u64_f32(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv2sf (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div2sf (__a) #define vreinterpret_u64_u8(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div8qi (__a) #define vreinterpret_u64_u16(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div4hi (__a) #define vreinterpret_u64_u32(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv2si (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div2si (__a) #define vreinterpret_u64_p8(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div8qi (__a) #define vreinterpret_u64_p16(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) + (uint64x1_t)__builtin_neon_vreinterpretv1div4hi (__a) #define vreinterpretq_u64_s8(__a) \ (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) @@ -6841,7 +6841,7 @@ (int8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_s8_s64(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qidi (__a) + (int8x8_t)__builtin_neon_vreinterpretv8qiv1di (__a) #define vreinterpret_s8_f32(__a) \ (int8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a) @@ -6856,7 +6856,7 @@ (int8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_s8_u64(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qidi (__a) + (int8x8_t)__builtin_neon_vreinterpretv8qiv1di (__a) #define vreinterpret_s8_p8(__a) \ (int8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) @@ -6901,7 +6901,7 @@ (int16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_s16_s64(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hidi (__a) + (int16x4_t)__builtin_neon_vreinterpretv4hiv1di (__a) #define vreinterpret_s16_f32(__a) \ (int16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a) @@ -6916,7 +6916,7 @@ (int16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_s16_u64(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hidi (__a) + (int16x4_t)__builtin_neon_vreinterpretv4hiv1di (__a) #define vreinterpret_s16_p8(__a) \ (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) @@ -6961,7 +6961,7 @@ (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpret_s32_s64(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2sidi (__a) + (int32x2_t)__builtin_neon_vreinterpretv2siv1di (__a) #define vreinterpret_s32_f32(__a) \ (int32x2_t)__builtin_neon_vreinterpretv2siv2sf (__a) @@ -6976,7 +6976,7 @@ (int32x2_t)__builtin_neon_vreinterpretv2siv2si (__a) #define vreinterpret_s32_u64(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2sidi (__a) + (int32x2_t)__builtin_neon_vreinterpretv2siv1di (__a) #define vreinterpret_s32_p8(__a) \ (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) @@ -7024,7 +7024,7 @@ (uint8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_u8_s64(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qidi (__a) + (uint8x8_t)__builtin_neon_vreinterpretv8qiv1di (__a) #define vreinterpret_u8_f32(__a) \ (uint8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a) @@ -7036,7 +7036,7 @@ (uint8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_u8_u64(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qidi (__a) + (uint8x8_t)__builtin_neon_vreinterpretv8qiv1di (__a) #define vreinterpret_u8_p8(__a) \ (uint8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) @@ -7084,7 +7084,7 @@ (uint16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_u16_s64(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hidi (__a) + (uint16x4_t)__builtin_neon_vreinterpretv4hiv1di (__a) #define vreinterpret_u16_f32(__a) \ (uint16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a) @@ -7096,7 +7096,7 @@ (uint16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_u16_u64(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hidi (__a) + (uint16x4_t)__builtin_neon_vreinterpretv4hiv1di (__a) #define vreinterpret_u16_p8(__a) \ (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) @@ -7144,7 +7144,7 @@ (uint32x2_t)__builtin_neon_vreinterpretv2siv2si (__a) #define vreinterpret_u32_s64(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2sidi (__a) + (uint32x2_t)__builtin_neon_vreinterpretv2siv1di (__a) #define vreinterpret_u32_f32(__a) \ (uint32x2_t)__builtin_neon_vreinterpretv2siv2sf (__a) @@ -7156,7 +7156,7 @@ (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpret_u32_u64(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2sidi (__a) + (uint32x2_t)__builtin_neon_vreinterpretv2siv1di (__a) #define vreinterpret_u32_p8(__a) \ (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Mon Aug 31 18:16:02 2009 @@ -423,7 +423,7 @@ case NEON_BUILTIN_vreinterpretv4hi: case NEON_BUILTIN_vreinterpretv2si: case NEON_BUILTIN_vreinterpretv2sf: - case NEON_BUILTIN_vreinterpretdi: + case NEON_BUILTIN_vreinterpretv1di: case NEON_BUILTIN_vreinterpretv16qi: case NEON_BUILTIN_vreinterpretv8hi: case NEON_BUILTIN_vreinterpretv4si: @@ -669,7 +669,7 @@ case NEON_BUILTIN_vreinterpretv4hi: case NEON_BUILTIN_vreinterpretv2si: case NEON_BUILTIN_vreinterpretv2sf: - case NEON_BUILTIN_vreinterpretdi: + case NEON_BUILTIN_vreinterpretv1di: allow_128bit_modes = false; allow_64bit_elements = true; break; @@ -715,7 +715,7 @@ if (modeCheckOpnd >= 0) { switch (insn_data[icode].operand[modeCheckOpnd].mode) { - case V8QImode: case V4HImode: case V2SImode: case DImode: case V2SFmode: + case V8QImode: case V4HImode: case V2SImode: case V1DImode: case V2SFmode: if (!allow_64bit_modes) return BadModeError(exp, Result); break; @@ -765,7 +765,7 @@ if (!allow_32bit_elements) return BadModeError(exp, Result); break; - case DImode: case V2DImode: + case V1DImode: case V2DImode: if (!allow_64bit_elements) return BadModeError(exp, Result); break; @@ -1992,7 +1992,7 @@ case NEON_BUILTIN_vreinterpretv4hi: case NEON_BUILTIN_vreinterpretv2si: case NEON_BUILTIN_vreinterpretv2sf: - case NEON_BUILTIN_vreinterpretdi: + case NEON_BUILTIN_vreinterpretv1di: case NEON_BUILTIN_vreinterpretv16qi: case NEON_BUILTIN_vreinterpretv8hi: case NEON_BUILTIN_vreinterpretv4si: Modified: llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml Mon Aug 31 18:16:02 2009 @@ -345,8 +345,9 @@ (fun (cbase, abase, esize, enum) -> let attr = match enum with - 1 -> "" - | _ -> Printf.sprintf "\t__attribute__ ((__vector_size__ (%d)))" +(* LLVM LOCAL begin *) +(* LLVM LOCAL end *) + _ -> Printf.sprintf "\t__attribute__ ((__vector_size__ (%d)))" (esize * enum / 8) in Format.printf "typedef %s %s%dx%d_t%s;@\n" cbase abase esize enum attr) typeinfo; Modified: llvm-gcc-4.2/trunk/gcc/config/arm/neon.md URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/neon.md?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/neon.md (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/neon.md Mon Aug 31 18:16:02 2009 @@ -168,7 +168,8 @@ (define_mode_macro VD [V8QI V4HI V2SI V2SF]) ;; Double-width vector modes plus 64-bit elements. -(define_mode_macro VDX [V8QI V4HI V2SI V2SF DI]) +;; LLVM LOCAL +(define_mode_macro VDX [V8QI V4HI V2SI V2SF V1DI]) ;; Same, without floating-point elements. (define_mode_macro VDI [V8QI V4HI V2SI]) @@ -203,8 +204,9 @@ ;; Narrowable modes. (define_mode_macro VN [V8HI V4SI V2DI]) -;; All supported vector modes (except singleton DImode). -(define_mode_macro VDQ [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF V2DI]) +;; All supported vector modes. +;; LLVM LOCAL +(define_mode_macro VDQ [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF V2DI V1DI]) ;; All supported vector modes (except those with 64-bit integer elements). (define_mode_macro VDQW [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF]) @@ -212,14 +214,17 @@ ;; Supported integer vector modes (not 64 bit elements). (define_mode_macro VDQIW [V8QI V16QI V4HI V8HI V2SI V4SI]) -;; Supported integer vector modes (not singleton DI) -(define_mode_macro VDQI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI]) +;; Supported integer vector modes +;; LLVM LOCAL +(define_mode_macro VDQI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI V1DI]) ;; Vector modes, including 64-bit integer elements. -(define_mode_macro VDQX [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF DI V2DI]) +;; LLVM LOCAL +(define_mode_macro VDQX [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF V1DI V2DI]) ;; Vector modes including 64-bit integer elements, but no floats. -(define_mode_macro VDQIX [V8QI V16QI V4HI V8HI V2SI V4SI DI V2DI]) +;; LLVM LOCAL +(define_mode_macro VDQIX [V8QI V16QI V4HI V8HI V2SI V4SI V1DI V2DI]) ;; Vector modes for float->int conversions. (define_mode_macro VCVTF [V2SF V4SF]) @@ -252,7 +257,8 @@ (define_mode_macro VE [V8QI V16QI]) ;; Modes with 64-bit elements only. -(define_mode_macro V64 [DI V2DI]) +;; LLVM LOCAL +(define_mode_macro V64 [V1DI V2DI]) ;; Modes with 32-bit elements only. (define_mode_macro V32 [V2SI V2SF V4SI V4SF]) @@ -266,7 +272,8 @@ (V4HI "HI") (V8HI "HI") (V2SI "SI") (V4SI "SI") (V2SF "SF") (V4SF "SF") - (DI "DI") (V2DI "DI")]) +;; LLVM LOCAL + (V1DI "DI") (V2DI "DI")]) ;; Mode of pair of elements for each vector mode, to define transfer ;; size for structure lane/dup loads and stores. @@ -274,7 +281,8 @@ (V4HI "SI") (V8HI "SI") (V2SI "V2SI") (V4SI "V2SI") (V2SF "V2SF") (V4SF "V2SF") - (DI "V2DI") (V2DI "V2DI")]) +;; LLVM LOCAL + (V1DI "V2DI") (V2DI "V2DI")]) ;; Similar, for three elements. ;; ??? Should we define extra modes so that sizes of all three-element @@ -283,21 +291,24 @@ (V4HI "V4HI") (V8HI "V4HI") (V2SI "V4SI") (V4SI "V4SI") (V2SF "V4SF") (V4SF "V4SF") - (DI "EI") (V2DI "EI")]) +;; LLVM LOCAL + (V1DI "EI") (V2DI "EI")]) ;; Similar, for four elements. (define_mode_attr V_four_elem [(V8QI "SI") (V16QI "SI") (V4HI "V4HI") (V8HI "V4HI") (V2SI "V4SI") (V4SI "V4SI") (V2SF "V4SF") (V4SF "V4SF") - (DI "OI") (V2DI "OI")]) +;; LLVM LOCAL + (V1DI "OI") (V2DI "OI")]) ;; Register width from element mode (define_mode_attr V_reg [(V8QI "P") (V16QI "q") (V4HI "P") (V8HI "q") (V2SI "P") (V4SI "q") (V2SF "P") (V4SF "q") - (DI "P") (V2DI "q")]) +;; LLVM LOCAL + (V1DI "P") (V2DI "q")]) ;; Wider modes with the same number of elements. (define_mode_attr V_widen [(V8QI "V8HI") (V4HI "V4SI") (V2SI "V2DI")]) @@ -308,55 +319,64 @@ ;; Modes with half the number of equal-sized elements. (define_mode_attr V_HALF [(V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI") (V4SF "V2SF") - (V2DI "DI")]) +;; LLVM LOCAL + (V2DI "V1DI")]) ;; Same, but lower-case. (define_mode_attr V_half [(V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si") (V4SF "v2sf") - (V2DI "di")]) +;; LLVM LOCAL + (V2DI "v1di")]) ;; Modes with twice the number of equal-sized elements. (define_mode_attr V_DOUBLE [(V8QI "V16QI") (V4HI "V8HI") (V2SI "V4SI") (V2SF "V4SF") - (DI "V2DI")]) +;; LLVM LOCAL + (V1DI "V2DI")]) ;; Same, but lower-case. (define_mode_attr V_double [(V8QI "v16qi") (V4HI "v8hi") (V2SI "v4si") (V2SF "v4sf") - (DI "v2di")]) +;; LLVM LOCAL + (V1DI "v2di")]) ;; Modes with double-width elements. (define_mode_attr V_double_width [(V8QI "V4HI") (V16QI "V8HI") (V4HI "V2SI") (V8HI "V4SI") - (V2SI "DI") (V4SI "V2DI")]) +;; LLVM LOCAL + (V2SI "V1DI") (V4SI "V2DI")]) ;; Mode of result of comparison operations (and bit-select operand 1). (define_mode_attr V_cmp_result [(V8QI "V8QI") (V16QI "V16QI") (V4HI "V4HI") (V8HI "V8HI") (V2SI "V2SI") (V4SI "V4SI") (V2SF "V2SI") (V4SF "V4SI") - (DI "DI") (V2DI "V2DI")]) +;; LLVM LOCAL + (V1DI "V1DI") (V2DI "V2DI")]) ;; Get element type from double-width mode, for operations where we don't care ;; about signedness. (define_mode_attr V_if_elem [(V8QI "i8") (V16QI "i8") (V4HI "i16") (V8HI "i16") (V2SI "i32") (V4SI "i32") - (DI "i64") (V2DI "i64") +;; LLVM LOCAL + (V1DI "i64") (V2DI "i64") (V2SF "f32") (V4SF "f32")]) ;; Same, but for operations which work on signed values. (define_mode_attr V_s_elem [(V8QI "s8") (V16QI "s8") (V4HI "s16") (V8HI "s16") (V2SI "s32") (V4SI "s32") - (DI "s64") (V2DI "s64") +;; LLVM LOCAL + (V1DI "s64") (V2DI "s64") (V2SF "f32") (V4SF "f32")]) ;; Same, but for operations which work on unsigned values. (define_mode_attr V_u_elem [(V8QI "u8") (V16QI "u8") (V4HI "u16") (V8HI "u16") (V2SI "u32") (V4SI "u32") - (DI "u64") (V2DI "u64") +;; LLVM LOCAL + (V1DI "u64") (V2DI "u64") (V2SF "f32") (V4SF "f32")]) ;; Element types for extraction of unsigned scalars. @@ -368,7 +388,8 @@ (define_mode_attr V_sz_elem [(V8QI "8") (V16QI "8") (V4HI "16") (V8HI "16") (V2SI "32") (V4SI "32") - (DI "64") (V2DI "64") +;; LLVM LOCAL + (V1DI "64") (V2DI "64") (V2SF "32") (V4SF "32")]) ;; Element sizes for duplicating ARM registers to all elements of a vector. @@ -379,14 +400,16 @@ (V4HI "TI") (V8HI "OI") (V2SI "TI") (V4SI "OI") (V2SF "TI") (V4SF "OI") - (DI "TI") (V2DI "OI")]) +;; LLVM LOCAL + (V1DI "TI") (V2DI "OI")]) ;; Same, but lower-case. (define_mode_attr V_pair [(V8QI "ti") (V16QI "oi") (V4HI "ti") (V8HI "oi") (V2SI "ti") (V4SI "oi") (V2SF "ti") (V4SF "oi") - (DI "ti") (V2DI "oi")]) +;; LLVM LOCAL + (V1DI "ti") (V2DI "oi")]) ;; Operations on two halves of a quadword vector. (define_code_macro vqh_ops [plus smin smax umin umax]) @@ -408,7 +431,8 @@ (V4HI "") (V8HI "") (V2SI "") (V4SI "") (V2SF "") (V4SF "") - (DI "_neon") (V2DI "")]) +;; LLVM LOCAL + (V1DI "") (V2DI "")]) ;; Scalars to be presented to scalar multiplication instructions ;; must satisfy the following constraints. @@ -496,27 +520,31 @@ (define_mode_attr Is_float_mode [(V8QI "false") (V16QI "false") (V4HI "false") (V8HI "false") (V2SI "false") (V4SI "false") - (V2SF "true") (V4SF "true") - (DI "false") (V2DI "false")]) + (V2SF "true") (V4SF "true") +;; LLVM LOCAL + (V1DI "false") (V2DI "false")]) -(define_mode_attr Scalar_mul_8_16 [(V8QI "true") (V16QI "true") - (V4HI "true") (V8HI "true") +(define_mode_attr Scalar_mul_8_16 [(V8QI "true") (V16QI "true") + (V4HI "true") (V8HI "true") (V2SI "false") (V4SI "false") (V2SF "false") (V4SF "false") - (DI "false") (V2DI "false")]) +;; LLVM LOCAL + (V1DI "false") (V2DI "false")]) (define_mode_attr Is_d_reg [(V8QI "true") (V16QI "false") (V4HI "true") (V8HI "false") (V2SI "true") (V4SI "false") (V2SF "true") (V4SF "false") - (DI "true") (V2DI "false")]) +;; LLVM LOCAL + (V1DI "true") (V2DI "false")]) (define_mode_attr V_mode_nunits [(V8QI "8") (V16QI "16") (V4HI "4") (V8HI "8") (V2SI "2") (V4SI "4") (V2SF "2") (V4SF "4") - (DI "1") (V2DI "2")]) +;; LLVM LOCAL + (V1DI "1") (V2DI "2")]) ;; FIXME: Attributes are probably borked. (define_insn "*neon_mov" @@ -866,11 +894,8 @@ ;; Doubleword and quadword arithmetic. -;; NOTE: vadd/vsub and some other instructions also support 64-bit integer -;; element size, which we could potentially use for "long long" operations. We -;; don't want to do this at present though, because moving values from the -;; vector unit to the ARM core is currently slow and 64-bit addition (etc.) is -;; easy to do with ARM instructions anyway. +;; LLVM LOCAL begin +;; LLVM LOCAL end (define_insn "*add3_neon" [(set (match_operand:VDQ 0 "s_register_operand" "=w") @@ -938,23 +963,8 @@ [(set_attr "neon_type" "neon_int_1")] ) -(define_insn "iordi3_neon" - [(set (match_operand:DI 0 "s_register_operand" "=w,w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w,0") - (match_operand:DI 2 "neon_logic_op2" "w,Dl")] - UNSPEC_VORR))] - "TARGET_NEON" -{ - switch (which_alternative) - { - case 0: return "vorr\t%P0, %P1, %P2"; - case 1: return neon_output_logic_immediate ("vorr", &operands[2], - DImode, 0, VALID_NEON_QREG_MODE (DImode)); - default: gcc_unreachable (); - } -} - [(set_attr "neon_type" "neon_int_1")] -) +;; LLVM LOCAL begin +;; LLVM LOCAL end ;; The concrete forms of the Neon immediate-logic instructions are vbic and ;; vorr. We support the pseudo-instruction vand instead, because that @@ -978,23 +988,8 @@ [(set_attr "neon_type" "neon_int_1")] ) -(define_insn "anddi3_neon" - [(set (match_operand:DI 0 "s_register_operand" "=w,w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w,0") - (match_operand:DI 2 "neon_inv_logic_op2" "w,DL")] - UNSPEC_VAND))] - "TARGET_NEON" -{ - switch (which_alternative) - { - case 0: return "vand\t%P0, %P1, %P2"; - case 1: return neon_output_logic_immediate ("vand", &operands[2], - DImode, 1, VALID_NEON_QREG_MODE (DImode)); - default: gcc_unreachable (); - } -} - [(set_attr "neon_type" "neon_int_1")] -) +;; LLVM LOCAL begin +;; LLVM LOCAL end (define_insn "orn3_neon" [(set (match_operand:VDQ 0 "s_register_operand" "=w") @@ -1005,15 +1000,8 @@ [(set_attr "neon_type" "neon_int_1")] ) -(define_insn "orndi3_neon" - [(set (match_operand:DI 0 "s_register_operand" "=w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w") - (match_operand:DI 2 "s_register_operand" "w")] - UNSPEC_VORN))] - "TARGET_NEON" - "vorn\t%P0, %P1, %P2" - [(set_attr "neon_type" "neon_int_1")] -) +;; LLVM LOCAL begin +;; LLVM LOCAL end (define_insn "bic3_neon" [(set (match_operand:VDQ 0 "s_register_operand" "=w") @@ -1024,15 +1012,8 @@ [(set_attr "neon_type" "neon_int_1")] ) -(define_insn "bicdi3_neon" - [(set (match_operand:DI 0 "s_register_operand" "=w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w") - (match_operand:DI 2 "s_register_operand" "w")] - UNSPEC_VBIC))] - "TARGET_NEON" - "vbic\t%P0, %P1, %P2" - [(set_attr "neon_type" "neon_int_1")] -) +;; LLVM LOCAL begin +;; LLVM LOCAL end (define_insn "xor3" [(set (match_operand:VDQ 0 "s_register_operand" "=w") @@ -1043,15 +1024,8 @@ [(set_attr "neon_type" "neon_int_1")] ) -(define_insn "xordi3_neon" - [(set (match_operand:DI 0 "s_register_operand" "=w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w") - (match_operand:DI 2 "s_register_operand" "w")] - UNSPEC_VEOR))] - "TARGET_NEON" - "veor\t%P0, %P1, %P2" - [(set_attr "neon_type" "neon_int_1")] -) +;; LLVM LOCAL begin +;; LLVM LOCAL end (define_insn "one_cmpl2" [(set (match_operand:VDQ 0 "s_register_operand" "=w") @@ -1478,6 +1452,17 @@ DONE; }) +;; LLVM LOCAL begin +(define_insn "reduc_splus_v1di" + [(set (match_operand:V1DI 0 "s_register_operand" "=w") + (unspec:V1DI [(match_operand:V1DI 1 "s_register_operand" "w")] + UNSPEC_VPADD))] + "TARGET_NEON" + "vadd.i64\t%P0, %e1, %f1" + [(set_attr "neon_type" "neon_int_1")] +) +;; LLVM LOCAL end + (define_insn "reduc_splus_v2di" [(set (match_operand:V2DI 0 "s_register_operand" "=w") (unspec:V2DI [(match_operand:V2DI 1 "s_register_operand" "w")] @@ -2452,9 +2437,10 @@ ; with this insn. Operand 3 (info word) is ignored because it does nothing ; useful with 64-bit elements. -(define_insn "neon_vget_lanedi" +;; LLVM LOCAL begin +(define_insn "neon_vget_lanev1di" [(set (match_operand:DI 0 "s_register_operand" "=r") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w") + (unspec:DI [(match_operand:V1DI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") (match_operand:SI 3 "immediate_operand" "i")] UNSPEC_VGET_LANE))] @@ -2463,6 +2449,7 @@ [(set_attr "predicable" "yes") (set_attr "neon_type" "neon_bp_simple")] ) +;; LLVM LOCAL end (define_insn "neon_vget_lane" [(set (match_operand: 0 "s_register_operand" "=r") @@ -2525,17 +2512,19 @@ ; See neon_vget_lanedi comment for reasons operands 2 & 3 are ignored. -(define_insn "neon_vset_lanedi" - [(set (match_operand:DI 0 "s_register_operand" "=w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "r") - (match_operand:DI 2 "s_register_operand" "0") - (match_operand:SI 3 "immediate_operand" "i")] +;; LLVM LOCAL begin +(define_insn "neon_vset_lanev1di" + [(set (match_operand:V1DI 0 "s_register_operand" "=w") + (unspec:V1DI [(match_operand:DI 1 "s_register_operand" "r") + (match_operand:V1DI 2 "s_register_operand" "0") + (match_operand:SI 3 "immediate_operand" "i")] UNSPEC_VSET_LANE))] "TARGET_NEON" "vmov%?\t%P0, %Q1, %R1 @ di" [(set_attr "predicable" "yes") (set_attr "neon_type" "neon_bp_simple")] ) +;; LLVM LOCAL end (define_insn "neon_vset_lane" [(set (match_operand:VQ 0 "s_register_operand" "=w") @@ -2604,15 +2593,17 @@ (set_attr "neon_type" "neon_bp_simple")] ) -(define_insn "neon_vdup_ndi" - [(set (match_operand:DI 0 "s_register_operand" "=w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "r")] - UNSPEC_VDUP_N))] +;; LLVM LOCAL begin +(define_insn "neon_vdup_nv1di" + [(set (match_operand:V1DI 0 "s_register_operand" "=w") + (unspec:V1DI [(match_operand:DI 1 "s_register_operand" "r")] + UNSPEC_VDUP_N))] "TARGET_NEON" "vmov%?\t%P0, %Q1, %R1" [(set_attr "predicable" "yes") (set_attr "neon_type" "neon_bp_simple")] ) +;; LLVM LOCAL end (define_insn "neon_vdup_nv2di" [(set (match_operand:V2DI 0 "s_register_operand" "=w") @@ -2648,21 +2639,24 @@ ) ; Scalar index is ignored, since only zero is valid here. -(define_expand "neon_vdup_lanedi" - [(set (match_operand:DI 0 "s_register_operand" "=w") - (unspec:DI [(match_operand:DI 1 "s_register_operand" "w") - (match_operand:SI 2 "immediate_operand" "i")] - UNSPEC_VDUP_LANE))] +;; LLVM LOCAL begin +(define_expand "neon_vdup_lanev1di" + [(set (match_operand:V1DI 0 "s_register_operand" "=w") + (unspec:V1DI [(match_operand:V1DI 1 "s_register_operand" "w") + (match_operand:SI 2 "immediate_operand" "i")] + UNSPEC_VDUP_LANE))] "TARGET_NEON" { emit_move_insn (operands[0], operands[1]); DONE; }) +;; LLVM LOCAL end ; Likewise. (define_insn "neon_vdup_lanev2di" [(set (match_operand:V2DI 0 "s_register_operand" "=w") - (unspec:V2DI [(match_operand:DI 1 "s_register_operand" "w") +;; LLVM LOCAL + (unspec:V2DI [(match_operand:V1DI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i")] UNSPEC_VDUP_LANE))] "TARGET_NEON" @@ -3809,14 +3803,16 @@ DONE; }) -(define_expand "neon_vreinterpretdi" - [(match_operand:DI 0 "s_register_operand" "") +;; LLVM LOCAL begin +(define_expand "neon_vreinterpretv1di" + [(match_operand:V1DI 0 "s_register_operand" "") (match_operand:VDX 1 "s_register_operand" "")] "TARGET_NEON" { neon_reinterpret (operands[0], operands[1]); DONE; }) +;; LLVM LOCAL end (define_expand "neon_vreinterpretv16qi" [(match_operand:V16QI 0 "s_register_operand" "") Modified: llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml?rev=80638&r1=80637&r2=80638&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml Mon Aug 31 18:16:02 2009 @@ -104,9 +104,10 @@ | Arity3 of vectype * vectype * vectype * vectype | Arity4 of vectype * vectype * vectype * vectype * vectype -type vecmode = V8QI | V4HI | V2SI | V2SF | DI +(* LLVM LOCAL *) +type vecmode = V8QI | V4HI | V2SI | V2SF | V1DI | V16QI | V8HI | V4SI | V4SF | V2DI - | QI | HI | SI | SF + | QI | HI | SI | SF | DI type opcode = (* Binary ops. *) @@ -355,7 +356,8 @@ in match shape with All (_, Dreg) | By_scalar Dreg | Pair_result Dreg | Unary_scalar Dreg | Binary_imm Dreg | Long_noreg Dreg | Wide_noreg Dreg -> - [| V8QI; V4HI; if flt then V2SF else V2SI; DI |].(idx) +(* LLVM LOCAL *) + [| V8QI; V4HI; if flt then V2SF else V2SI; V1DI |].(idx) | All (_, Qreg) | By_scalar Qreg | Pair_result Qreg | Unary_scalar Qreg | Binary_imm Qreg | Long_noreg Qreg | Wide_noreg Qreg -> [| V16QI; V8HI; if flt then V4SF else V4SI; V2DI |].(idx) @@ -363,7 +365,8 @@ [| QI; HI; if flt then SF else SI; DI |].(idx) | Long | Wide | Wide_lane | Wide_scalar | Long_imm -> - [| V8QI; V4HI; V2SI; DI |].(idx) +(* LLVM LOCAL *) + [| V8QI; V4HI; V2SI; V1DI |].(idx) | Narrow | Narrow_imm -> [| V16QI; V8HI; V4SI; V2DI |].(idx) | Use_operands ops -> mode_of_elt elt (All (0, (find_key_operand ops))) | _ -> failwith "invalid shape" @@ -481,7 +484,8 @@ | T_int16x8 | T_uint16x8 | T_poly16x8 -> V8HI | T_int32x2 | T_uint32x2 -> V2SI | T_int32x4 | T_uint32x4 -> V4SI - | T_int64x1 | T_uint64x1 -> DI +(* LLVM LOCAL *) + | T_int64x1 | T_uint64x1 -> V1DI | T_int64x2 | T_uint64x2 -> V2DI | T_float32x2 -> V2SF | T_float32x4 -> V4SF @@ -497,17 +501,20 @@ 4, V8QI -> B_TId8mode | 4, V4HI -> B_TId16mode | 4, V2SI -> B_TId32mode - | 4, DI -> B_TId64mode +(* LLVM LOCAL *) + | 4, V1DI -> B_TId64mode | 4, V2SF -> B_TIdSFmode | 6, V8QI -> B_EId8mode | 6, V4HI -> B_EId16mode | 6, V2SI -> B_EId32mode - | 6, DI -> B_EId64mode +(* LLVM LOCAL *) + | 6, V1DI -> B_EId64mode | 6, V2SF -> B_EIdSFmode | 8, V8QI -> B_OId8mode | 8, V4HI -> B_OId16mode | 8, V2SI -> B_OId32mode - | 8, DI -> B_OId64mode +(* LLVM LOCAL *) + | 8, V1DI -> B_OId64mode | 8, V2SF -> B_OIdSFmode | 8, V16QI -> B_OIq8mode | 8, V8HI -> B_OIq16mode @@ -1807,7 +1814,8 @@ V8QI -> "v8qi" | V4HI -> "v4hi" | V2SI -> "v2si" | V2SF -> "v2sf" | DI -> "di" | V16QI -> "v16qi" | V8HI -> "v8hi" | V4SI -> "v4si" | V4SF -> "v4sf" | V2DI -> "v2di" | QI -> "qi" | HI -> "hi" | SI -> "si" - | SF -> "sf" +(* LLVM LOCAL *) + | SF -> "sf" | V1DI -> "v1di" (* Use uppercase chars for letters which form part of the intrinsic name, but should be omitted from the builtin name (the info is passed in an extra From wendling at apple.com Mon Aug 31 19:30:25 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 31 Aug 2009 17:30:25 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80626 - in /llvm-gcc-4.2/trunk/gcc: ChangeLog.apple llvm-debug.cpp tree.c tree.h In-Reply-To: <200908312122.n7VLMDkY003834@zion.cs.uiuc.edu> References: <200908312122.n7VLMDkY003834@zion.cs.uiuc.edu> Message-ID: <59F1F46A-64CB-4AAA-B616-54FD1E75C63F@apple.com> Hi Caroline, Could you rename the "APPLE LOCAL" markers to "LLVM LOCAL"? I just want to make sure that they won't be deleted by me the next time I do a sync. :-) -bw On Aug 31, 2009, at 2:22 PM, Caroline Tice wrote: > Modified: llvm-gcc-4.2/trunk/gcc/tree.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=80626&r1=80625&r2=80626&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/tree.c (original) > +++ llvm-gcc-4.2/trunk/gcc/tree.c Mon Aug 31 16:22:12 2009 > @@ -7975,4 +7975,37 @@ > } > /* APPLE LOCAL end weak_import on property 6676828 */ > > +/* APPLE LOCAL begin radar 6419781 */ > +bool > +type_is_block_byref_struct (tree type) > +{ > + bool ret_value = false; > + > + if (!type) > + return false; > + > + if (TREE_CODE (type) == POINTER_TYPE) > + type = TREE_TYPE (type); > + > + if (!type > + || ! TYPE_NAME (type) > + || ! (TREE_CODE (type) == RECORD_TYPE)) > + return false; > + > + if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE > + && strncmp (IDENTIFIER_POINTER (TYPE_NAME (type)), > + "__Block_byref_", 14) == 0) > + return true; > + else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL > + && DECL_NAME (TYPE_NAME (type)) > + && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))) > + && (strncmp > + (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))), > + "__Block_byref_", 14) == 0)) > + return true; > + else > + return false; > +} > +/* APPLE LOCAL begin end 6419781 */ > + > #include "gt-tree.h" > > Modified: llvm-gcc-4.2/trunk/gcc/tree.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=80626&r1=80625&r2=80626&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/tree.h (original) > +++ llvm-gcc-4.2/trunk/gcc/tree.h Mon Aug 31 16:22:12 2009 > @@ -4892,4 +4892,8 @@ > > /* APPLE LOCAL end radar 6300081 */ > > +/* APPLE LOCAL begin radar 6419781 */ > +extern bool type_is_block_byref_struct (tree); > +/* APPLE LOCAL end radar 6419781 */ > + > #endif /* GCC_TREE_H */ > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Mon Aug 31 19:53:22 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Sep 2009 00:53:22 -0000 Subject: [llvm-commits] [llvm] r80647 - /llvm/trunk/include/llvm/Analysis/DebugInfo.h Message-ID: <200909010053.n810rM3q030896@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 19:53:21 2009 New Revision: 80647 URL: http://llvm.org/viewvc/llvm-project?rev=80647&view=rev Log: Add getDirectory() and getFilename() interface to DIScope. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80647&r1=80646&r2=80647&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 19:53:21 2009 @@ -128,6 +128,14 @@ if (DbgNode && !isScope()) DbgNode = 0; } + + virtual const std::string &getFilename(std::string &F) const { + return F; + } + + virtual const std::string &getDirectory(std::string &D) const { + return D; + } }; /// DICompileUnit - A wrapper for a compile unit. @@ -382,6 +390,13 @@ unsigned isLocalToUnit() const { return getUnsignedField(9); } unsigned isDefinition() const { return getUnsignedField(10); } + const std::string &getFilename(std::string &F) const { + return getCompileUnit().getFilename(F); + } + const std::string &getDirectory(std::string &F) const { + return getCompileUnit().getDirectory(F); + } + /// Verify - Verify that a subprogram descriptor is well formed. bool Verify() const; @@ -448,7 +463,16 @@ if (DbgNode && !isLexicalBlock()) DbgNode = 0; } - DIDescriptor getContext() const { return getDescriptorField(1); } + DIScope getContext() const { return getFieldAs(1); } + + const std::string &getFilename(std::string &F) const { + return getContext().getFilename(F); + } + const std::string &getDirectory(std::string &D) const { + return getContext().getDirectory(D); + } + + }; /// DIFactory - This object assists with the construction of the various From dpatel at apple.com Mon Aug 31 20:14:15 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Sep 2009 01:14:15 -0000 Subject: [llvm-commits] [llvm] r80648 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200909010114.n811EFml000971@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 31 20:14:15 2009 New Revision: 80648 URL: http://llvm.org/viewvc/llvm-project?rev=80648&view=rev Log: Introduce DILocation. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80648&r1=80647&r2=80648&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 20:14:15 2009 @@ -471,8 +471,24 @@ const std::string &getDirectory(std::string &D) const { return getContext().getDirectory(D); } + }; + /// DILocation - This object holds location information. This object + /// is not associated with any DWARF tag. + class DILocation : public DIDescriptor { + public: + explicit DILocation(MDNode *L) { DbgNode = L; } + unsigned getLineNumber() const { return getUnsignedField(0); } + unsigned getColumnNumber() const { return getUnsignedField(1); } + DIScope getScope() const { return getFieldAs(3); } + DILocation getOrigLocation() const { return getFieldAs(4); } + std::string getFilename(std::string &F) const { + return getScope().getFilename(F); + } + std::string getDirectory(std::string &D) const { + return getScope().getDirectory(D); + } }; /// DIFactory - This object assists with the construction of the various @@ -575,6 +591,10 @@ /// with the specified parent context. DILexicalBlock CreateLexicalBlock(DIDescriptor Context); + /// CreateLocation - Creates a debug info location. + DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo, + DIScope S, DILocation OrigLoc); + /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation, /// inserting it at the end of the specified basic block. void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo, Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80648&r1=80647&r2=80648&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 20:14:15 2009 @@ -791,6 +791,18 @@ return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2)); } +/// CreateLocation - Creates a debug info location. +DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo, + DIScope S, DILocation OrigLoc) { + Value *Elts[] = { + ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), + ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo), + S.getNode(), + OrigLoc.getNode(), + }; + return DILocation(MDNode::get(VMContext, &Elts[0], 4)); +} + //===----------------------------------------------------------------------===// // DIFactory: Routines for inserting code into a function From grosbach at apple.com Mon Aug 31 20:57:56 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 01:57:56 -0000 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Message-ID: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 31 20:57:56 2009 New Revision: 80649 URL: http://llvm.org/viewvc/llvm-project?rev=80649&view=rev Log: Clean up LSDA name generation and use for SJLJ exception handling. This makes an eggregious hack somewhat more palatable. Bringing the LSDA forward and making it a GV available for reference would be even better, but is beyond the scope of what I'm looking to solve at this point. Objective C++ code could generate function names that broke the previous scheme. This fixes that. Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Aug 31 20:57:56 2009 @@ -172,6 +172,10 @@ /// std::string getCurrentFunctionEHName(const MachineFunction *MF) const; + /// getFunctionNumber - Return a unique ID for the current function. + /// + unsigned getFunctionNumber() const { return FunctionNumber; } + protected: /// getAnalysisUsage - Record analysis usage. /// @@ -217,10 +221,6 @@ /// is being processed from runOnMachineFunction. void SetupMachineFunction(MachineFunction &MF); - /// getFunctionNumber - Return a unique ID for the current function. - /// - unsigned getFunctionNumber() const { return FunctionNumber; } - /// IncrementFunctionNumber - Increase Function Number. AsmPrinters should /// not normally call this, as the counter is automatically bumped by /// SetupMachineFunction. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 31 20:57:56 2009 @@ -25,9 +25,11 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Support/Mangler.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/StringExtras.h" +#include using namespace llvm; static TimerGroup &getDwarfTimerGroup() { @@ -599,9 +601,12 @@ EmitLabel("exception", SubprogramCount); if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { - std::string SjLjName = "_lsda_"; - SjLjName += MF->getFunction()->getName().str(); - EmitLabel(SjLjName.c_str(), 0); + std::stringstream out; + out << Asm->getFunctionNumber(); + std::string LSDAName = + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), + Mangler::Private); + EmitLabel(LSDAName.c_str(), 0, false); } // Emit the header. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 20:57:56 2009 @@ -43,21 +43,27 @@ /// PrintLabelName - Print label name in form used by Dwarf writer. /// -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { - O << MAI->getPrivateGlobalPrefix() << Tag; +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, + bool ForcePrivate) const { + if (ForcePrivate) + O << MAI->getPrivateGlobalPrefix(); + O << Tag; if (Number) O << Number; } void Dwarf::PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix) const { - O << MAI->getPrivateGlobalPrefix() << Tag; + const char *Suffix, bool ForcePrivate) const { + if (ForcePrivate) + O << MAI->getPrivateGlobalPrefix(); + O << Tag; if (Number) O << Number; O << Suffix; } /// EmitLabel - Emit location label for internal use by Dwarf. /// -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { - PrintLabelName(Tag, Number); +void Dwarf::EmitLabel(const char *Tag, unsigned Number, + bool ForcePrivate) const { + PrintLabelName(Tag, Number, ForcePrivate); O << ":\n"; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 20:57:56 2009 @@ -100,16 +100,18 @@ void PrintLabelName(const DWLabel &Label) const { PrintLabelName(Label.getTag(), Label.getNumber()); } - void PrintLabelName(const char *Tag, unsigned Number) const; void PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix) const; + bool ForcePrivate = true) const; + void PrintLabelName(const char *Tag, unsigned Number, + const char *Suffix, bool ForcePrivate = true) const; /// EmitLabel - Emit location label for internal use by Dwarf. /// void EmitLabel(const DWLabel &Label) const { EmitLabel(Label.getTag(), Label.getNumber()); } - void EmitLabel(const char *Tag, unsigned Number) const; + void EmitLabel(const char *Tag, unsigned Number, + bool ForcePrivate = true) const; /// EmitReference - Emit a reference to a label. /// Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 20:57:56 2009 @@ -20,11 +20,12 @@ using namespace llvm; ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, unsigned id, + ARMCP::ARMCPKind K, unsigned char PCAdj, const char *Modif, bool AddCA) : MachineConstantPoolValue((const Type*)gv->getType()), - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, @@ -33,12 +34,12 @@ const char *Modif, bool AddCA) : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const char *Modif) : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv->getContext())), - GV(gv), S(NULL), LabelId(0), PCAdjust(0), + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust(0), Modifier(Modif) {} int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 20:57:56 2009 @@ -21,12 +21,20 @@ class GlobalValue; class LLVMContext; +namespace ARMCP { + enum ARMCPKind { + CPValue, + CPLSDA + }; +} + /// ARMConstantPoolValue - ARM specific constantpool value. This is used to /// represent PC relative displacement between the address of the load /// instruction and the global value being loaded, i.e. (&GV-(LPIC+8)). class ARMConstantPoolValue : public MachineConstantPoolValue { GlobalValue *GV; // GlobalValue being loaded. const char *S; // ExtSymbol being loaded. + ARMCP::ARMCPKind Kind; // Value or LSDA? unsigned LabelId; // Label id of the load. unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative. // 8 for ARM, 4 for Thumb. @@ -35,6 +43,7 @@ public: ARMConstantPoolValue(GlobalValue *gv, unsigned id, + ARMCP::ARMCPKind Kind = ARMCP::CPValue, unsigned char PCAdj = 0, const char *Modifier = NULL, bool AddCurrentAddress = false); ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, @@ -52,6 +61,7 @@ bool mustAddCurrentAddress() const { return AddCurrentAddress; } unsigned getLabelId() const { return LabelId; } unsigned char getPCAdjustment() const { return PCAdjust; } + bool isLSDA() { return Kind == ARMCP::CPLSDA; } virtual unsigned getRelocationInfo() const { // FIXME: This is conservatively claiming that these entries require a Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 20:57:56 2009 @@ -40,6 +40,7 @@ #include "llvm/ADT/VectorExtras.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" +#include using namespace llvm; static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, EVT &LocVT, @@ -969,7 +970,8 @@ // tBX takes a register source operand. if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) { ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, - ARMPCLabelIndex, 4); + ARMPCLabelIndex, + ARMCP::CPValue, 4); SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy(), 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); Callee = DAG.getLoad(getPointerTy(), dl, @@ -1166,7 +1168,7 @@ unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, - PCAdj, "tlsgd", true); + ARMCP::CPValue, PCAdj, "tlsgd", true); SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, NULL, 0); @@ -1208,7 +1210,7 @@ unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, - PCAdj, "gottpoff", true); + ARMCP::CPValue, PCAdj, "gottpoff", true); Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); @@ -1284,7 +1286,7 @@ else { unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget->isThumb()?4:8); ARMConstantPoolValue *CPV = - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); + new ARMConstantPoolValue(GV, ARMPCLabelIndex, ARMCP::CPValue, PCAdj); CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); } CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); @@ -1375,10 +1377,6 @@ return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); } case Intrinsic::eh_sjlj_lsda: { - // blah. horrible, horrible hack with the forced magic name. - // really need to clean this up. It belongs in the target-independent - // layer somehow that doesn't require the coupling with the asm - // printer. MachineFunction &MF = DAG.getMachineFunction(); EVT PtrVT = getPointerTy(); DebugLoc dl = Op.getDebugLoc(); @@ -1386,13 +1384,9 @@ SDValue CPAddr; unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget->isThumb() ? 4 : 8); - // Save off the LSDA name for the AsmPrinter to use when it's time - // to emit the table - std::string LSDAName = "L_lsda_"; - LSDAName += MF.getFunction()->getName(); ARMConstantPoolValue *CPV = - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str(), - ARMPCLabelIndex, PCAdj); + new ARMConstantPoolValue(MF.getFunction(), ARMPCLabelIndex, + ARMCP::CPLSDA, PCAdj); CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); SDValue Result = Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug 31 20:57:56 2009 @@ -44,6 +44,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/FormattedStream.h" #include +#include using namespace llvm; STATISTIC(EmittedInsts, "Number of machine instrs printed"); @@ -159,8 +160,13 @@ ARMConstantPoolValue *ACPV = static_cast(MCPV); GlobalValue *GV = ACPV->getGV(); std::string Name; - - if (GV) { + + if (ACPV->isLSDA()) { + std::stringstream out; + out << getFunctionNumber(); + Name = Mang->makeNameProper(std::string("LSDA_") + out.str(), + Mangler::Private); + } else if (GV) { bool isIndirect = Subtarget->isTargetDarwin() && Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel() == Reloc::Static); @@ -175,9 +181,7 @@ else GVNonLazyPtrs[SymName] = Name; } - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) - Name = ACPV->getSymbol(); - else + } else Name = Mang->makeNameProper(ACPV->getSymbol()); O << Name; Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug 31 20:57:56 2009 @@ -0,0 +1,103 @@ +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s + +%struct.A = type { i32* } + +define arm_apcscc void @"\01-[MyFunction Name:]"() { +entry: + %save_filt.1 = alloca i32 ; [#uses=2] + %save_eptr.0 = alloca i8* ; [#uses=2] + %a = alloca %struct.A ; <%struct.A*> [#uses=3] + %eh_exception = alloca i8* ; [#uses=5] + %eh_selector = alloca i32 ; [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) + invoke arm_apcscc void @_Z3barv() + to label %invcont unwind label %lpad + +invcont: ; preds = %entry + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind + br label %return + +bb: ; preds = %ppad + %eh_select = load i32* %eh_selector ; [#uses=1] + store i32 %eh_select, i32* %save_filt.1, align 4 + %eh_value = load i8** %eh_exception ; [#uses=1] + store i8* %eh_value, i8** %save_eptr.0, align 4 + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind + %0 = load i8** %save_eptr.0, align 4 ; [#uses=1] + store i8* %0, i8** %eh_exception, align 4 + %1 = load i32* %save_filt.1, align 4 ; [#uses=1] + store i32 %1, i32* %eh_selector, align 4 + br label %Unwind + +return: ; preds = %invcont + ret void + +lpad: ; preds = %entry + %eh_ptr = call i8* @llvm.eh.exception() ; [#uses=1] + store i8* %eh_ptr, i8** %eh_exception + %eh_ptr1 = load i8** %eh_exception ; [#uses=1] + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*), i32 0) ; [#uses=1] + store i32 %eh_select2, i32* %eh_selector + br label %ppad + +ppad: ; preds = %lpad + br label %bb + +Unwind: ; preds = %bb + %eh_ptr3 = load i8** %eh_exception ; [#uses=1] + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) + unreachable +} + +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* %this) { +entry: + %this_addr = alloca %struct.A* ; <%struct.A**> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store %struct.A* %this, %struct.A** %this_addr + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; [#uses=1] + %1 = bitcast i8* %0 to i32* ; [#uses=1] + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> [#uses=1] + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; [#uses=1] + store i32* %1, i32** %3, align 4 + br label %return + +return: ; preds = %entry + ret void +} + +declare arm_apcscc i8* @_Znwm(i32) + +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) nounwind { +entry: + %this_addr = alloca %struct.A* ; <%struct.A**> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store %struct.A* %this, %struct.A** %this_addr + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> [#uses=1] + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; [#uses=1] + %2 = load i32** %1, align 4 ; [#uses=1] + %3 = bitcast i32* %2 to i8* ; [#uses=1] + call arm_apcscc void @_ZdlPv(i8* %3) nounwind + br label %bb + +bb: ; preds = %entry + br label %return + +return: ; preds = %bb + ret void +} +;CHECK: L_LSDA_1: + +declare arm_apcscc void @_ZdlPv(i8*) nounwind + +declare arm_apcscc void @_Z3barv() + +declare i8* @llvm.eh.exception() nounwind + +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind + +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind + +declare arm_apcscc i32 @__gxx_personality_sj0(...) + +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) From grosbach at apple.com Mon Aug 31 21:05:04 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 02:05:04 -0000 Subject: [llvm-commits] [llvm] r80650 - in /llvm/trunk/lib/Target/ARM: ARMConstantPoolValue.cpp ARMConstantPoolValue.h Message-ID: <200909010205.n81254AU007383@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 31 21:05:03 2009 New Revision: 80650 URL: http://llvm.org/viewvc/llvm-project?rev=80650&view=rev Log: Fix compiler warnings Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80650&r1=80649&r2=80650&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 21:05:03 2009 @@ -39,7 +39,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const char *Modif) : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv->getContext())), - GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust(0), + GV(gv), S(NULL), LabelId(0), Kind(ARMCP::CPValue), PCAdjust(0), Modifier(Modif) {} int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80650&r1=80649&r2=80650&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 21:05:03 2009 @@ -34,8 +34,8 @@ class ARMConstantPoolValue : public MachineConstantPoolValue { GlobalValue *GV; // GlobalValue being loaded. const char *S; // ExtSymbol being loaded. - ARMCP::ARMCPKind Kind; // Value or LSDA? unsigned LabelId; // Label id of the load. + ARMCP::ARMCPKind Kind; // Value or LSDA? unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative. // 8 for ARM, 4 for Thumb. const char *Modifier; // GV modifier i.e. (&GV(modifier)-(LPIC+8)) From grosbach at apple.com Mon Aug 31 21:34:49 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 02:34:49 -0000 Subject: [llvm-commits] [llvm] r80651 - /llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Message-ID: <200909010234.n812YnhT011425@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 31 21:34:49 2009 New Revision: 80651 URL: http://llvm.org/viewvc/llvm-project?rev=80651&view=rev Log: SJLJ is arm/darwin only for now. force the triple for the test Modified: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Modified: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80651&r1=80650&r2=80651&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug 31 21:34:49 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 -march=arm -f | FileCheck %s %struct.A = type { i32* } From daniel at zuster.org Mon Aug 31 23:09:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 04:09:04 -0000 Subject: [llvm-commits] [llvm] r80652 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp Message-ID: <200909010409.n8149487023070@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 23:09:03 2009 New Revision: 80652 URL: http://llvm.org/viewvc/llvm-project?rev=80652&view=rev Log: llvm-mc: Store MCSymbolData value as a pointer (to make MSVC happy). Modified: llvm/trunk/include/llvm/MC/MCAssembler.h llvm/trunk/lib/MC/MCAssembler.cpp Modified: llvm/trunk/include/llvm/MC/MCAssembler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=80652&r1=80651&r2=80652&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAssembler.h (original) +++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon Aug 31 23:09:03 2009 @@ -437,7 +437,7 @@ // FIXME: Same concerns as with SectionData. class MCSymbolData : public ilist_node { public: - const MCSymbol &Symbol; + const MCSymbol *Symbol; /// Fragment - The fragment this symbol's value is relative to, if any. MCFragment *Fragment; @@ -480,7 +480,7 @@ /// @name Accessors /// @{ - const MCSymbol &getSymbol() const { return Symbol; } + const MCSymbol &getSymbol() const { return *Symbol; } MCFragment *getFragment() const { return Fragment; } void setFragment(MCFragment *Value) { Fragment = Value; } Modified: llvm/trunk/lib/MC/MCAssembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=80652&r1=80651&r2=80652&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAssembler.cpp (original) +++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Aug 31 23:09:03 2009 @@ -926,11 +926,11 @@ /* *** */ -MCSymbolData::MCSymbolData() : Symbol(*(const MCSymbol*)0) {} +MCSymbolData::MCSymbolData() : Symbol(0) {} MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, MCAssembler *A) - : Symbol(_Symbol), Fragment(_Fragment), Offset(_Offset), + : Symbol(&_Symbol), Fragment(_Fragment), Offset(_Offset), IsExternal(false), IsPrivateExtern(false), CommonSize(0), CommonAlign(0), Flags(0), Index(0) { From daniel at zuster.org Mon Aug 31 23:13:01 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 04:13:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80653 - /llvm-gcc-4.2/trunk/gcc/tree.c Message-ID: <200909010413.n814D1jT023560@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 31 23:13:01 2009 New Revision: 80653 URL: http://llvm.org/viewvc/llvm-project?rev=80653&view=rev Log: Remove unused variable. Modified: llvm-gcc-4.2/trunk/gcc/tree.c Modified: llvm-gcc-4.2/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=80653&r1=80652&r2=80653&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree.c Mon Aug 31 23:13:01 2009 @@ -7979,8 +7979,6 @@ bool type_is_block_byref_struct (tree type) { - bool ret_value = false; - if (!type) return false; From bob.wilson at apple.com Mon Aug 31 23:18:40 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 04:18:40 -0000 Subject: [llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll Message-ID: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> Author: bwilson Date: Mon Aug 31 23:18:40 2009 New Revision: 80654 URL: http://llvm.org/viewvc/llvm-project?rev=80654&view=rev Log: Fix pr4843: When an instruction has multiple destination registers that are tied to different source registers, the TwoAddressInstructionPass needs to be smarter. Change it to check before replacing a source register whether that source register is tied to a different destination register, and if so, defer handling it until a subsequent iteration. Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80654&r1=80653&r2=80654&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Aug 31 23:18:40 2009 @@ -968,23 +968,67 @@ // Update DistanceMap. DistanceMap.insert(std::make_pair(prevMI, Dist)); DistanceMap[mi] = ++Dist; + + // Scan the operands to find: (1) the use operand that kills regB (if + // any); (2) whether the kill operand is being replaced by regA on + // this iteration; and (3) the first use of regB that is not being + // replaced on this iteration. A use of regB will not replaced if it + // is tied to a different destination register and will be handled on + // a later iteration. + MachineOperand *KillMO = NULL; + MachineOperand *FirstKeptMO = NULL; + bool KillMOKept = false; + for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { + MachineOperand &MO = mi->getOperand(i); + if (MO.isReg() && MO.getReg() == regB && MO.isUse()) { - // Update live variables for regB. - if (LV) { - if (LV->removeVirtualRegisterKilled(regB, mi)) - LV->addVirtualRegisterKilled(regB, prevMI); + // Check if this operand is tied to a different destination. + bool isKept = false; + unsigned dsti = 0; + if (mi->isRegTiedToDefOperand(i, &dsti) && dsti != ti) { + isKept = true; + if (!FirstKeptMO) + FirstKeptMO = &MO; + } + + if (MO.isKill()) { + KillMO = &MO; + KillMOKept = isKept; + } + } + } - if (LV->removeVirtualRegisterDead(regB, mi)) - LV->addVirtualRegisterDead(regB, prevMI); + // Update live variables for regB. + if (KillMO) { + if (!FirstKeptMO) { + // All uses of regB are being replaced; move the kill to prevMI. + if (LV && LV->removeVirtualRegisterKilled(regB, mi)) + LV->addVirtualRegisterKilled(regB, prevMI); + } else { + if (!KillMOKept) { + // The kill marker is on an operand being replaced, but there + // are other uses of regB remaining. Move the kill marker to + // one of them. + KillMO->setIsKill(false); + FirstKeptMO->setIsKill(true); + } + } } DEBUG(errs() << "\t\tprepend:\t" << *prevMI); - - // Replace all occurences of regB with regA. + + // Replace uses of regB with regA. for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { - if (mi->getOperand(i).isReg() && - mi->getOperand(i).getReg() == regB) - mi->getOperand(i).setReg(regA); + MachineOperand &MO = mi->getOperand(i); + if (MO.isReg() && MO.getReg() == regB && MO.isUse()) { + + // Skip operands that are tied to other register definitions. + unsigned dsti = 0; + if (mi->isRegTiedToDefOperand(i, &dsti) && dsti != ti) + continue; + + MO.setReg(regA); + } } assert(mi->getOperand(ti).isDef() && mi->getOperand(si).isUse()); Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll?rev=80654&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll Mon Aug 31 23:18:40 2009 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s +; pr4843 +define <4 x i16> @v2regbug(<4 x i16>* %B) nounwind { +;CHECK: v2regbug: +;CHECK: vzip.16 + %tmp1 = load <4 x i16>* %B + %tmp2 = shufflevector <4 x i16> %tmp1, <4 x i16> undef, <4 x i32> + ret <4 x i16> %tmp2 +} From bob.wilson at apple.com Mon Aug 31 23:26:29 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 04:26:29 -0000 Subject: [llvm-commits] [llvm] r80656 - in /llvm/trunk/lib/Target/ARM: ARMISelDAGToDAG.cpp ARMISelLowering.cpp ARMInstrNEON.td NEONPreAllocPass.cpp Message-ID: <200909010426.n814QTkE025319@zion.cs.uiuc.edu> Author: bwilson Date: Mon Aug 31 23:26:28 2009 New Revision: 80656 URL: http://llvm.org/viewvc/llvm-project?rev=80656&view=rev Log: Generate code for vld{234}_lane intrinsics. Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=80656&r1=80655&r2=80656&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Aug 31 23:26:28 2009 @@ -1375,6 +1375,63 @@ return CurDAG->getTargetNode(Opc, dl, ResTys, Ops, 4); } + case Intrinsic::arm_neon_vld2lane: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (VT.getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vld2lane type"); + case MVT::v8i8: Opc = ARM::VLD2LNd8; break; + case MVT::v4i16: Opc = ARM::VLD2LNd16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VLD2LNd32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), Chain }; + return CurDAG->getTargetNode(Opc, dl, VT, VT, MVT::Other, Ops, 7); + } + + case Intrinsic::arm_neon_vld3lane: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (VT.getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vld3lane type"); + case MVT::v8i8: Opc = ARM::VLD3LNd8; break; + case MVT::v4i16: Opc = ARM::VLD3LNd16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VLD3LNd32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), N->getOperand(6), Chain }; + return CurDAG->getTargetNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 8); + } + + case Intrinsic::arm_neon_vld4lane: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (VT.getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vld4lane type"); + case MVT::v8i8: Opc = ARM::VLD4LNd8; break; + case MVT::v4i16: Opc = ARM::VLD4LNd16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VLD4LNd32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), N->getOperand(6), + N->getOperand(7), Chain }; + std::vector ResTys(4, VT); + ResTys.push_back(MVT::Other); + return CurDAG->getTargetNode(Opc, dl, ResTys, Ops, 9); + } + case Intrinsic::arm_neon_vst2: { SDValue MemAddr, MemUpdate, MemOpc; if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80656&r1=80655&r2=80656&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 23:26:28 2009 @@ -1350,6 +1350,26 @@ return SDValue(); } +static SDValue LowerNeonVLDLaneIntrinsic(SDValue Op, SelectionDAG &DAG, + unsigned NumVecs) { + SDNode *Node = Op.getNode(); + EVT VT = Node->getValueType(0); + + if (!VT.is64BitVector()) + return SDValue(); // unimplemented + + // Change the lane number operand to be a TargetConstant; otherwise it + // will be legalized into a register. + ConstantSDNode *Lane = dyn_cast(Node->getOperand(NumVecs+3)); + if (!Lane) { + assert(false && "vld lane number must be a constant"); + return SDValue(); + } + SmallVector Ops(Node->op_begin(), Node->op_end()); + Ops[NumVecs+3] = DAG.getTargetConstant(Lane->getZExtValue(), MVT::i32); + return DAG.UpdateNodeOperands(Op, &Ops[0], Ops.size()); +} + SDValue ARMTargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) { unsigned IntNo = cast(Op.getOperand(1))->getZExtValue(); @@ -1358,6 +1378,12 @@ return LowerNeonVLDIntrinsic(Op, DAG, 3); case Intrinsic::arm_neon_vld4: return LowerNeonVLDIntrinsic(Op, DAG, 4); + case Intrinsic::arm_neon_vld2lane: + return LowerNeonVLDLaneIntrinsic(Op, DAG, 2); + case Intrinsic::arm_neon_vld3lane: + return LowerNeonVLDLaneIntrinsic(Op, DAG, 3); + case Intrinsic::arm_neon_vld4lane: + return LowerNeonVLDLaneIntrinsic(Op, DAG, 4); case Intrinsic::arm_neon_vst3: return LowerNeonVSTIntrinsic(Op, DAG, 3); case Intrinsic::arm_neon_vst4: Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=80656&r1=80655&r2=80656&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Aug 31 23:26:28 2009 @@ -207,6 +207,44 @@ def VLD4d8 : VLD4D<"vld4.8">; def VLD4d16 : VLD4D<"vld4.16">; def VLD4d32 : VLD4D<"vld4.32">; + +// VLD2LN : Vector Load (single 2-element structure to one lane) +class VLD2LND + : NLdSt<(outs DPR:$dst1, DPR:$dst2), + (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane), + NoItinerary, + !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"), + "$src1 = $dst1, $src2 = $dst2", []>; + +def VLD2LNd8 : VLD2LND<"vld2.8">; +def VLD2LNd16 : VLD2LND<"vld2.16">; +def VLD2LNd32 : VLD2LND<"vld2.32">; + +// VLD3LN : Vector Load (single 3-element structure to one lane) +class VLD3LND + : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), + (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, + nohash_imm:$lane), NoItinerary, + !strconcat(OpcodeStr, + "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"), + "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>; + +def VLD3LNd8 : VLD3LND<"vld3.8">; +def VLD3LNd16 : VLD3LND<"vld3.16">; +def VLD3LNd32 : VLD3LND<"vld3.32">; + +// VLD4LN : Vector Load (single 4-element structure to one lane) +class VLD4LND + : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4), + (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, + nohash_imm:$lane), NoItinerary, + !strconcat(OpcodeStr, + "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"), + "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>; + +def VLD4LNd8 : VLD4LND<"vld4.8">; +def VLD4LNd16 : VLD4LND<"vld4.16">; +def VLD4LNd32 : VLD4LND<"vld4.32">; } // VST1 : Vector Store (multiple single elements) Modified: llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp?rev=80656&r1=80655&r2=80656&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Mon Aug 31 23:26:28 2009 @@ -45,6 +45,9 @@ case ARM::VLD2d8: case ARM::VLD2d16: case ARM::VLD2d32: + case ARM::VLD2LNd8: + case ARM::VLD2LNd16: + case ARM::VLD2LNd32: FirstOpnd = 0; NumRegs = 2; return true; @@ -52,6 +55,9 @@ case ARM::VLD3d8: case ARM::VLD3d16: case ARM::VLD3d32: + case ARM::VLD3LNd8: + case ARM::VLD3LNd16: + case ARM::VLD3LNd32: FirstOpnd = 0; NumRegs = 3; return true; @@ -59,6 +65,9 @@ case ARM::VLD4d8: case ARM::VLD4d16: case ARM::VLD4d32: + case ARM::VLD4LNd8: + case ARM::VLD4LNd16: + case ARM::VLD4LNd32: FirstOpnd = 0; NumRegs = 4; return true; From bob.wilson at apple.com Mon Aug 31 23:27:10 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 04:27:10 -0000 Subject: [llvm-commits] [llvm] r80658 - /llvm/trunk/test/CodeGen/ARM/vldlane.ll Message-ID: <200909010427.n814RAaq025437@zion.cs.uiuc.edu> Author: bwilson Date: Mon Aug 31 23:27:10 2009 New Revision: 80658 URL: http://llvm.org/viewvc/llvm-project?rev=80658&view=rev Log: Add test for vld{234}_lane instructions. Added: llvm/trunk/test/CodeGen/ARM/vldlane.ll Added: llvm/trunk/test/CodeGen/ARM/vldlane.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vldlane.ll?rev=80658&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vldlane.ll (added) +++ llvm/trunk/test/CodeGen/ARM/vldlane.ll Mon Aug 31 23:27:10 2009 @@ -0,0 +1,187 @@ +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s + +%struct.__builtin_neon_v8qi2 = type { <8 x i8>, <8 x i8> } +%struct.__builtin_neon_v4hi2 = type { <4 x i16>, <4 x i16> } +%struct.__builtin_neon_v2si2 = type { <2 x i32>, <2 x i32> } +%struct.__builtin_neon_v2sf2 = type { <2 x float>, <2 x float> } + +define <8 x i8> @vld2lanei8(i8* %A, <8 x i8>* %B) nounwind { +;CHECK: vld2lanei8: +;CHECK: vld2.8 + %tmp1 = load <8 x i8>* %B + %tmp2 = call %struct.__builtin_neon_v8qi2 @llvm.arm.neon.vld2lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v8qi2 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v8qi2 %tmp2, 1 + %tmp5 = add <8 x i8> %tmp3, %tmp4 + ret <8 x i8> %tmp5 +} + +define <4 x i16> @vld2lanei16(i16* %A, <4 x i16>* %B) nounwind { +;CHECK: vld2lanei16: +;CHECK: vld2.16 + %tmp1 = load <4 x i16>* %B + %tmp2 = call %struct.__builtin_neon_v4hi2 @llvm.arm.neon.vld2lane.v4i16(i16* %A, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v4hi2 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v4hi2 %tmp2, 1 + %tmp5 = add <4 x i16> %tmp3, %tmp4 + ret <4 x i16> %tmp5 +} + +define <2 x i32> @vld2lanei32(i32* %A, <2 x i32>* %B) nounwind { +;CHECK: vld2lanei32: +;CHECK: vld2.32 + %tmp1 = load <2 x i32>* %B + %tmp2 = call %struct.__builtin_neon_v2si2 @llvm.arm.neon.vld2lane.v2i32(i32* %A, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v2si2 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v2si2 %tmp2, 1 + %tmp5 = add <2 x i32> %tmp3, %tmp4 + ret <2 x i32> %tmp5 +} + +define <2 x float> @vld2lanef(float* %A, <2 x float>* %B) nounwind { +;CHECK: vld2lanef: +;CHECK: vld2.32 + %tmp1 = load <2 x float>* %B + %tmp2 = call %struct.__builtin_neon_v2sf2 @llvm.arm.neon.vld2lane.v2f32(float* %A, <2 x float> %tmp1, <2 x float> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v2sf2 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v2sf2 %tmp2, 1 + %tmp5 = add <2 x float> %tmp3, %tmp4 + ret <2 x float> %tmp5 +} + +declare %struct.__builtin_neon_v8qi2 @llvm.arm.neon.vld2lane.v8i8(i8*) nounwind readonly +declare %struct.__builtin_neon_v4hi2 @llvm.arm.neon.vld2lane.v4i16(i8*) nounwind readonly +declare %struct.__builtin_neon_v2si2 @llvm.arm.neon.vld2lane.v2i32(i8*) nounwind readonly +declare %struct.__builtin_neon_v2sf2 @llvm.arm.neon.vld2lane.v2f32(i8*) nounwind readonly + +%struct.__builtin_neon_v8qi3 = type { <8 x i8>, <8 x i8>, <8 x i8> } +%struct.__builtin_neon_v4hi3 = type { <4 x i16>, <4 x i16>, <4 x i16> } +%struct.__builtin_neon_v2si3 = type { <2 x i32>, <2 x i32>, <2 x i32> } +%struct.__builtin_neon_v2sf3 = type { <2 x float>, <2 x float>, <2 x float> } + +define <8 x i8> @vld3lanei8(i8* %A, <8 x i8>* %B) nounwind { +;CHECK: vld3lanei8: +;CHECK: vld3.8 + %tmp1 = load <8 x i8>* %B + %tmp2 = call %struct.__builtin_neon_v8qi3 @llvm.arm.neon.vld3lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v8qi3 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v8qi3 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v8qi3 %tmp2, 2 + %tmp6 = add <8 x i8> %tmp3, %tmp4 + %tmp7 = add <8 x i8> %tmp5, %tmp6 + ret <8 x i8> %tmp7 +} + +define <4 x i16> @vld3lanei16(i16* %A, <4 x i16>* %B) nounwind { +;CHECK: vld3lanei16: +;CHECK: vld3.16 + %tmp1 = load <4 x i16>* %B + %tmp2 = call %struct.__builtin_neon_v4hi3 @llvm.arm.neon.vld3lane.v4i16(i16* %A, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v4hi3 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v4hi3 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v4hi3 %tmp2, 2 + %tmp6 = add <4 x i16> %tmp3, %tmp4 + %tmp7 = add <4 x i16> %tmp5, %tmp6 + ret <4 x i16> %tmp7 +} + +define <2 x i32> @vld3lanei32(i32* %A, <2 x i32>* %B) nounwind { +;CHECK: vld3lanei32: +;CHECK: vld3.32 + %tmp1 = load <2 x i32>* %B + %tmp2 = call %struct.__builtin_neon_v2si3 @llvm.arm.neon.vld3lane.v2i32(i32* %A, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v2si3 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v2si3 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v2si3 %tmp2, 2 + %tmp6 = add <2 x i32> %tmp3, %tmp4 + %tmp7 = add <2 x i32> %tmp5, %tmp6 + ret <2 x i32> %tmp7 +} + +define <2 x float> @vld3lanef(float* %A, <2 x float>* %B) nounwind { +;CHECK: vld3lanef: +;CHECK: vld3.32 + %tmp1 = load <2 x float>* %B + %tmp2 = call %struct.__builtin_neon_v2sf3 @llvm.arm.neon.vld3lane.v2f32(float* %A, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v2sf3 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v2sf3 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v2sf3 %tmp2, 2 + %tmp6 = add <2 x float> %tmp3, %tmp4 + %tmp7 = add <2 x float> %tmp5, %tmp6 + ret <2 x float> %tmp7 +} + +declare %struct.__builtin_neon_v8qi3 @llvm.arm.neon.vld3lane.v8i8(i8*) nounwind readonly +declare %struct.__builtin_neon_v4hi3 @llvm.arm.neon.vld3lane.v4i16(i8*) nounwind readonly +declare %struct.__builtin_neon_v2si3 @llvm.arm.neon.vld3lane.v2i32(i8*) nounwind readonly +declare %struct.__builtin_neon_v2sf3 @llvm.arm.neon.vld3lane.v2f32(i8*) nounwind readonly + +%struct.__builtin_neon_v8qi4 = type { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } +%struct.__builtin_neon_v4hi4 = type { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } +%struct.__builtin_neon_v2si4 = type { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } +%struct.__builtin_neon_v2sf4 = type { <2 x float>, <2 x float>, <2 x float>, <2 x float> } + +define <8 x i8> @vld4lanei8(i8* %A, <8 x i8>* %B) nounwind { +;CHECK: vld4lanei8: +;CHECK: vld4.8 + %tmp1 = load <8 x i8>* %B + %tmp2 = call %struct.__builtin_neon_v8qi4 @llvm.arm.neon.vld4lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v8qi4 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v8qi4 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v8qi4 %tmp2, 2 + %tmp6 = extractvalue %struct.__builtin_neon_v8qi4 %tmp2, 3 + %tmp7 = add <8 x i8> %tmp3, %tmp4 + %tmp8 = add <8 x i8> %tmp5, %tmp6 + %tmp9 = add <8 x i8> %tmp7, %tmp8 + ret <8 x i8> %tmp9 +} + +define <4 x i16> @vld4lanei16(i16* %A, <4 x i16>* %B) nounwind { +;CHECK: vld4lanei16: +;CHECK: vld4.16 + %tmp1 = load <4 x i16>* %B + %tmp2 = call %struct.__builtin_neon_v4hi4 @llvm.arm.neon.vld4lane.v4i16(i16* %A, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v4hi4 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v4hi4 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v4hi4 %tmp2, 2 + %tmp6 = extractvalue %struct.__builtin_neon_v4hi4 %tmp2, 3 + %tmp7 = add <4 x i16> %tmp3, %tmp4 + %tmp8 = add <4 x i16> %tmp5, %tmp6 + %tmp9 = add <4 x i16> %tmp7, %tmp8 + ret <4 x i16> %tmp9 +} + +define <2 x i32> @vld4lanei32(i32* %A, <2 x i32>* %B) nounwind { +;CHECK: vld4lanei32: +;CHECK: vld4.32 + %tmp1 = load <2 x i32>* %B + %tmp2 = call %struct.__builtin_neon_v2si4 @llvm.arm.neon.vld4lane.v2i32(i32* %A, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v2si4 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v2si4 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v2si4 %tmp2, 2 + %tmp6 = extractvalue %struct.__builtin_neon_v2si4 %tmp2, 3 + %tmp7 = add <2 x i32> %tmp3, %tmp4 + %tmp8 = add <2 x i32> %tmp5, %tmp6 + %tmp9 = add <2 x i32> %tmp7, %tmp8 + ret <2 x i32> %tmp9 +} + +define <2 x float> @vld4lanef(float* %A, <2 x float>* %B) nounwind { +;CHECK: vld4lanef: +;CHECK: vld4.32 + %tmp1 = load <2 x float>* %B + %tmp2 = call %struct.__builtin_neon_v2sf4 @llvm.arm.neon.vld4lane.v2f32(float* %A, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, i32 1) + %tmp3 = extractvalue %struct.__builtin_neon_v2sf4 %tmp2, 0 + %tmp4 = extractvalue %struct.__builtin_neon_v2sf4 %tmp2, 1 + %tmp5 = extractvalue %struct.__builtin_neon_v2sf4 %tmp2, 2 + %tmp6 = extractvalue %struct.__builtin_neon_v2sf4 %tmp2, 3 + %tmp7 = add <2 x float> %tmp3, %tmp4 + %tmp8 = add <2 x float> %tmp5, %tmp6 + %tmp9 = add <2 x float> %tmp7, %tmp8 + ret <2 x float> %tmp9 +} + +declare %struct.__builtin_neon_v8qi4 @llvm.arm.neon.vld4lane.v8i8(i8*) nounwind readonly +declare %struct.__builtin_neon_v4hi4 @llvm.arm.neon.vld4lane.v4i16(i8*) nounwind readonly +declare %struct.__builtin_neon_v2si4 @llvm.arm.neon.vld4lane.v2i32(i8*) nounwind readonly +declare %struct.__builtin_neon_v2sf4 @llvm.arm.neon.vld4lane.v2f32(i8*) nounwind readonly From dpatel at apple.com Tue Sep 1 00:04:28 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Sep 2009 05:04:28 -0000 Subject: [llvm-commits] [llvm] r80660 - /llvm/trunk/include/llvm/Analysis/DebugInfo.h Message-ID: <200909010504.n8154Sx7030265@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 1 00:04:28 2009 New Revision: 80660 URL: http://llvm.org/viewvc/llvm-project?rev=80660&view=rev Log: Add virtual destructor. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80660&r1=80659&r2=80660&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Tue Sep 1 00:04:28 2009 @@ -128,6 +128,7 @@ if (DbgNode && !isScope()) DbgNode = 0; } + virtual ~DIScope() {} virtual const std::string &getFilename(std::string &F) const { return F; From sabre at nondot.org Tue Sep 1 01:31:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 06:31:32 -0000 Subject: [llvm-commits] [llvm] r80663 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Analysis/IPA/CallGraphSCCPass.cpp lib/Transforms/IPO/PruneEH.cpp lib/Transforms/Utils/InlineFunction.cpp test/Transforms/ArgumentPromotion/callgraph-update.ll Message-ID: <200909010631.n816VWSl009006@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 01:31:31 2009 New Revision: 80663 URL: http://llvm.org/viewvc/llvm-project?rev=80663&view=rev Log: Change CallGraphNode to maintain it's Function as an AssertingVH for sanity. This didn't turn up any bugs. Change CallGraphNode to maintain its "callsite" information in the call edges list as a WeakVH instead of as an instruction*. This fixes a broad class of dangling pointer bugs, and makes CallGraph have a number of useful invariants again. This fixes the class of problem indicated by PR4029 and PR3601. Added: llvm/trunk/test/Transforms/ArgumentPromotion/callgraph-update.ll Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h llvm/trunk/lib/Analysis/IPA/CallGraph.cpp llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp llvm/trunk/lib/Transforms/IPO/PruneEH.cpp llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=80663&r1=80662&r2=80663&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/CallGraph.h (original) +++ llvm/trunk/include/llvm/Analysis/CallGraph.h Tue Sep 1 01:31:31 2009 @@ -55,6 +55,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Pass.h" #include "llvm/Support/CallSite.h" +#include "llvm/Support/ValueHandle.h" #include "llvm/System/IncludeFile.h" #include @@ -158,11 +159,16 @@ }; //===----------------------------------------------------------------------===// -// CallGraphNode class definition +// CallGraphNode class definition. // class CallGraphNode { - Function *F; - typedef std::pair CallRecord; + AssertingVH F; + + // CallRecord - This is a pair of the calling instruction (a call or invoke) + // and the callgraph node being called. +public: + typedef std::pair CallRecord; +private: std::vector CalledFunctions; /// NumReferences - This is the number of times that this CallGraphNode occurs @@ -240,19 +246,22 @@ /// addCalledFunction - Add a function to the list of functions called by this /// one. void addCalledFunction(CallSite CS, CallGraphNode *M) { - CalledFunctions.push_back(std::make_pair(CS, M)); + CalledFunctions.push_back(std::make_pair(CS.getInstruction(), M)); M->AddRef(); } + void removeCallEdge(iterator I) { + I->second->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); + } + + /// removeCallEdgeFor - This method removes the edge in the node for the /// specified call site. Note that this method takes linear time, so it /// should be used sparingly. void removeCallEdgeFor(CallSite CS); - // FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR. - void removeCallEdgeFor(Instruction *CS); - - /// removeAnyCallEdgeTo - This method removes all call edges from this node /// to the specified callee function. This takes more time to execute than /// removeCallEdgeTo, so it should not be used unless necessary. @@ -278,7 +287,7 @@ template <> struct GraphTraits { typedef CallGraphNode NodeType; - typedef std::pair CGNPairTy; + typedef CallGraphNode::CallRecord CGNPairTy; typedef std::pointer_to_unary_function CGNDerefFun; static NodeType *getEntryNode(CallGraphNode *CGN) { return CGN; } Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=80663&r1=80662&r2=80663&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Tue Sep 1 01:31:31 2009 @@ -241,7 +241,7 @@ void CallGraphNode::removeCallEdgeFor(CallSite CS) { for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); - if (I->first == CS) { + if (I->first == CS.getInstruction()) { I->second->DropRef(); *I = CalledFunctions.back(); CalledFunctions.pop_back(); @@ -250,21 +250,6 @@ } } -// FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR. -void CallGraphNode::removeCallEdgeFor(Instruction *CS) { - for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { - assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); - if (I->first.getInstruction() == CS) { - I->second->DropRef(); - *I = CalledFunctions.back(); - CalledFunctions.pop_back(); - return; - } - } - -} - - // removeAnyCallEdgeTo - This method removes any call edges from this node to // the specified callee function. This takes more time to execute than @@ -285,7 +270,7 @@ for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callee to remove!"); CallRecord &CR = *I; - if (CR.second == Callee && CR.first.getInstruction() == 0) { + if (CR.second == Callee && CR.first == 0) { Callee->DropRef(); *I = CalledFunctions.back(); CalledFunctions.pop_back(); @@ -301,9 +286,9 @@ CallGraphNode *NewCallee) { for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callsite to replace!"); - if (I->first != Old) continue; + if (I->first != Old.getInstruction()) continue; - I->first = New; + I->first = New.getInstruction(); // If the callee is changing, not just the callsite, then update it as // well. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80663&r1=80662&r2=80663&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 01:31:31 2009 @@ -125,7 +125,7 @@ void CGPassManager::RefreshCallGraph(std::vector &CurSCC, CallGraph &CG) { - DenseMap CallSites; + DenseMap CallSites; DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() << " nodes:\n"; @@ -146,12 +146,28 @@ // Get the set of call sites currently in the function. for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ++I){ - assert(I->first.getInstruction() && - "Call site record in function should not be abstract"); - assert(!CallSites.count(I->first.getInstruction()) && + // If this call site is null, then the function pass deleted the call + // entirely and the WeakVH nulled it out. + if (I->first == 0 || + // If we've already seen this call site, then the FunctionPass RAUW'd + // one call with another, which resulted in two "uses" in the edge + // list of the same call. + CallSites.count(I->first) || + + // If the call edge is not from a call or invoke, then the function + // pass RAUW'd a call with another value. This can happen when + // constant folding happens of well known functions etc. + CallSite::get(I->first).getInstruction() == 0) { + // Just remove the edge from the set of callees. + CGN->removeCallEdge(I); + E = CGN->end(); + --I; + continue; + } + + assert(!CallSites.count(I->first) && "Call site occurs in node multiple times"); - CallSites.insert(std::make_pair(I->first.getInstruction(), - I->second)); + CallSites.insert(std::make_pair(I->first, I->second)); } // Loop over all of the instructions in the function, getting the callsites. @@ -162,7 +178,7 @@ // If this call site already existed in the callgraph, just verify it // matches up to expectations and remove it from CallSites. - DenseMap::iterator ExistingIt = + DenseMap::iterator ExistingIt = CallSites.find(CS.getInstruction()); if (ExistingIt != CallSites.end()) { CallGraphNode *ExistingNode = ExistingIt->second; @@ -201,18 +217,14 @@ } // After scanning this function, if we still have entries in callsites, then - // they are dangling pointers. Crap. Well, until we change CallGraph to - // use CallbackVH, we'll just zap them here. When we have that, this should - // turn into an assertion. - if (CallSites.empty()) continue; - - for (DenseMap::iterator I = CallSites.begin(), - E = CallSites.end(); I != E; ++I) - // FIXME: I had to add a special horrible form of removeCallEdgeFor to - // support this. Remove the Instruction* version of it when we can. - CGN->removeCallEdgeFor(I->first); - MadeChange = true; - CallSites.clear(); + // they are dangling pointers. WeakVH should save us for this, so abort if + // this happens. + assert(CallSites.empty() && "Dangling pointers found in call sites map"); + + // Periodically do an explicit clear to remove tombstones when processing + // large scc's. + if ((sccidx & 15) == 0) + CallSites.clear(); } DEBUG(if (MadeChange) { Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=80663&r1=80662&r2=80663&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Tue Sep 1 01:31:31 2009 @@ -165,9 +165,6 @@ // function if we have invokes to non-unwinding functions or code after calls to // no-return functions. bool PruneEH::SimplifyFunction(Function *F) { - CallGraph &CG = getAnalysis(); - CallGraphNode *CGN = CG[F]; - bool MadeChange = false; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (InvokeInst *II = dyn_cast(BB->getTerminator())) @@ -181,14 +178,13 @@ Call->setAttributes(II->getAttributes()); // Anything that used the value produced by the invoke instruction - // now uses the value produced by the call instruction. + // now uses the value produced by the call instruction. Note that we + // do this even for void functions and calls with no uses so that the + // callgraph edge is updated. II->replaceAllUsesWith(Call); BasicBlock *UnwindBlock = II->getUnwindDest(); UnwindBlock->removePredecessor(II->getParent()); - // Fix up the call graph. - CGN->replaceCallSite(II, Call, 0/*keep callee*/); - // Insert a branch to the normal destination right before the // invoke. BranchInst::Create(II->getNormalDest(), II); Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=80663&r1=80662&r2=80663&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Tue Sep 1 01:31:31 2009 @@ -212,7 +212,7 @@ } for (; I != E; ++I) { - const Instruction *OrigCall = I->first.getInstruction(); + const Value *OrigCall = I->first; DenseMap::iterator VMI = ValueMap.find(OrigCall); // Only copy the edge if the call was inlined! Added: llvm/trunk/test/Transforms/ArgumentPromotion/callgraph-update.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ArgumentPromotion/callgraph-update.ll?rev=80663&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ArgumentPromotion/callgraph-update.ll (added) +++ llvm/trunk/test/Transforms/ArgumentPromotion/callgraph-update.ll Tue Sep 1 01:31:31 2009 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | opt -argpromotion -simplifycfg -constmerge | llvm-dis +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-darwin10.0" + +%struct.VEC2 = type { double, double, double } +%struct.VERTEX = type { %struct.VEC2, %struct.VERTEX*, %struct.VERTEX* } +%struct.edge_rec = type { %struct.VERTEX*, %struct.edge_rec*, i32, i8* } + +declare %struct.edge_rec* @alloc_edge() nounwind ssp + +define i64 @build_delaunay(%struct.VERTEX* %tree, %struct.VERTEX* %extra) nounwind ssp { +entry: + br i1 undef, label %bb11, label %bb12 + +bb11: ; preds = %bb10 + %a = call %struct.edge_rec* @alloc_edge() nounwind ; <%struct.edge_rec*> [#uses=0] + ret i64 123 + +bb12: ; preds = %bb10 + %b = call %struct.edge_rec* @alloc_edge() nounwind ; <%struct.edge_rec*> [#uses=1] + %c = ptrtoint %struct.edge_rec* %b to i64 + ret i64 %c +} From sabre at nondot.org Tue Sep 1 01:33:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 06:33:49 -0000 Subject: [llvm-commits] [llvm] r80664 - /llvm/trunk/test/Transforms/Inline/callgraph-update.ll Message-ID: <200909010633.n816Xo7K009332@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 01:33:49 2009 New Revision: 80664 URL: http://llvm.org/viewvc/llvm-project?rev=80664&view=rev Log: testcase for PR3601 Added: llvm/trunk/test/Transforms/Inline/callgraph-update.ll Added: llvm/trunk/test/Transforms/Inline/callgraph-update.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/callgraph-update.ll?rev=80664&view=auto ============================================================================== --- llvm/trunk/test/Transforms/Inline/callgraph-update.ll (added) +++ llvm/trunk/test/Transforms/Inline/callgraph-update.ll Tue Sep 1 01:33:49 2009 @@ -0,0 +1,33 @@ +; RUN: llvm-as < %s | opt -inline -loop-rotate | llvm-dis +; PR3601 +declare void @solve() + +define internal fastcc void @read() { + br label %bb4 + +bb3: + br label %bb4 + +bb4: + call void @solve() + br i1 false, label %bb5, label %bb3 + +bb5: + unreachable +} + +define internal fastcc void @parse() { + call fastcc void @read() + ret void +} + +define void @main() { + invoke fastcc void @parse() + to label %invcont unwind label %lpad + +invcont: + unreachable + +lpad: + unreachable +} From evan.cheng at apple.com Tue Sep 1 02:37:53 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 00:37:53 -0700 Subject: [llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll In-Reply-To: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> References: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> Message-ID: Hi Bob, I am taking issues with this patch. The two-address pass is starting to get too complicated (my fault). I've been thinking about restructuring the code. This patch is making the code even harder to read. It also potentially calls removeVirtualRegisterKilled() multiple times for each source register. Each of the call ends up scanning the entire operand list. That seems inefficient to me. Also, what happens to the code the calls LV->removeVirtualRegisterDead(regB, mi)? if (KillMO) { if (!FirstKeptMO) { // All uses of regB are being replaced; move the kill to prevMI. if (LV && LV->removeVirtualRegisterKilled(regB, mi)) When KillMO is not null, it shouldn't be necessary to call removeVirtualRegisterKilled, right? Also notice we are scanning the operands twice: for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { ... } // Replace uses of regB with regA. for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { ... } Please scan the operands just once. If it sees any other source operand of the same virtual register tied to another def, then it should not update the other operands of the same virtual register. The next iteration will deal with them. As for the kill marker, it should move it to the previous instruction the first time it is processed. All you have to ensure is the later iteration does not insert any instruction between the kill marker and the mi being processed. That should be pretty straight forward. Just add a iterator which is the instruction insertion location. The first time you insert a copy, it should then be moved to the copy instruction, etc. e.g. a, b = op c, c // insert pos => a = c // insert pos a, b = op a, c => b = c a = c a, b = op a, b Since you are working on this code, could be please clean it up a bit. Can you factor this if statement: if (mi->getOperand(ti).isDead() && isSafeToDelete(mi, regB, TII, Kills)) { to a separate function? Thanks, Evan On Aug 31, 2009, at 9:18 PM, Bob Wilson wrote: > Author: bwilson > Date: Mon Aug 31 23:18:40 2009 > New Revision: 80654 > > URL: http://llvm.org/viewvc/llvm-project?rev=80654&view=rev > Log: > Fix pr4843: When an instruction has multiple destination registers > that are > tied to different source registers, the TwoAddressInstructionPass > needs to > be smarter. Change it to check before replacing a source register > whether > that source register is tied to a different destination register, > and if so, > defer handling it until a subsequent iteration. > > Added: > llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll > Modified: > llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > > Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80654&r1=80653&r2=80654&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) > +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Aug 31 > 23:18:40 2009 > @@ -968,23 +968,67 @@ > // Update DistanceMap. > DistanceMap.insert(std::make_pair(prevMI, Dist)); > DistanceMap[mi] = ++Dist; > + > + // Scan the operands to find: (1) the use operand that > kills regB (if > + // any); (2) whether the kill operand is being replaced by > regA on > + // this iteration; and (3) the first use of regB that is > not being > + // replaced on this iteration. A use of regB will not > replaced if it > + // is tied to a different destination register and will be > handled on > + // a later iteration. > + MachineOperand *KillMO = NULL; > + MachineOperand *FirstKeptMO = NULL; > + bool KillMOKept = false; > + for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { > + MachineOperand &MO = mi->getOperand(i); > + if (MO.isReg() && MO.getReg() == regB && MO.isUse()) { > > - // Update live variables for regB. > - if (LV) { > - if (LV->removeVirtualRegisterKilled(regB, mi)) > - LV->addVirtualRegisterKilled(regB, prevMI); > + // Check if this operand is tied to a different > destination. > + bool isKept = false; > + unsigned dsti = 0; > + if (mi->isRegTiedToDefOperand(i, &dsti) && dsti != ti) { > + isKept = true; > + if (!FirstKeptMO) > + FirstKeptMO = &MO; > + } > + > + if (MO.isKill()) { > + KillMO = &MO; > + KillMOKept = isKept; > + } > + } > + } > > - if (LV->removeVirtualRegisterDead(regB, mi)) > - LV->addVirtualRegisterDead(regB, prevMI); > + // Update live variables for regB. > + if (KillMO) { > + if (!FirstKeptMO) { > + // All uses of regB are being replaced; move the kill > to prevMI. > + if (LV && LV->removeVirtualRegisterKilled(regB, mi)) > + LV->addVirtualRegisterKilled(regB, prevMI); > + } else { > + if (!KillMOKept) { > + // The kill marker is on an operand being replaced, > but there > + // are other uses of regB remaining. Move the kill > marker to > + // one of them. > + KillMO->setIsKill(false); > + FirstKeptMO->setIsKill(true); > + } > + } > } > > DEBUG(errs() << "\t\tprepend:\t" << *prevMI); > - > - // Replace all occurences of regB with regA. > + > + // Replace uses of regB with regA. > for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { > - if (mi->getOperand(i).isReg() && > - mi->getOperand(i).getReg() == regB) > - mi->getOperand(i).setReg(regA); > + MachineOperand &MO = mi->getOperand(i); > + if (MO.isReg() && MO.getReg() == regB && MO.isUse()) { > + > + // Skip operands that are tied to other register > definitions. > + unsigned dsti = 0; > + if (mi->isRegTiedToDefOperand(i, &dsti) && dsti != ti) > + continue; > + > + MO.setReg(regA); > + } > } > > assert(mi->getOperand(ti).isDef() && mi- > >getOperand(si).isUse()); > > Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll?rev=80654&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll (added) > +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll Mon Aug > 31 23:18:40 2009 > @@ -0,0 +1,9 @@ > +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s > +; pr4843 > +define <4 x i16> @v2regbug(<4 x i16>* %B) nounwind { > +;CHECK: v2regbug: > +;CHECK: vzip.16 > + %tmp1 = load <4 x i16>* %B > + %tmp2 = shufflevector <4 x i16> %tmp1, <4 x i16> undef, <4 x > i32> > + ret <4 x i16> %tmp2 > +} > > > _______________________________________________ > 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 Tue Sep 1 02:56:02 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 00:56:02 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> Message-ID: <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> Comments below. On Aug 31, 2009, at 6:57 PM, Jim Grosbach wrote: > Author: grosbach > Date: Mon Aug 31 20:57:56 2009 > New Revision: 80649 > > URL: http://llvm.org/viewvc/llvm-project?rev=80649&view=rev > Log: > Clean up LSDA name generation and use for SJLJ exception handling. > This > makes an eggregious hack somewhat more palatable. Bringing the LSDA > forward > and making it a GV available for reference would be even better, but > is > beyond the scope of what I'm looking to solve at this point. > > Objective C++ code could generate function names that broke the > previous > scheme. This fixes that. > > Added: > llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll > Modified: > llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h > llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp > llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h > llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Aug 31 20:57:56 > 2009 > @@ -172,6 +172,10 @@ > /// > std::string getCurrentFunctionEHName(const MachineFunction *MF) > const; > > + /// getFunctionNumber - Return a unique ID for the current > function. > + /// > + unsigned getFunctionNumber() const { return FunctionNumber; } > + > protected: > /// getAnalysisUsage - Record analysis usage. > /// > @@ -217,10 +221,6 @@ > /// is being processed from runOnMachineFunction. > void SetupMachineFunction(MachineFunction &MF); > > - /// getFunctionNumber - Return a unique ID for the current > function. > - /// > - unsigned getFunctionNumber() const { return FunctionNumber; } > - Is this necessary? DwarfException should be using SubprogramCount, no? > /// IncrementFunctionNumber - Increase Function Number. > AsmPrinters should > /// not normally call this, as the counter is automatically > bumped by > /// SetupMachineFunction. > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 31 > 20:57:56 2009 > @@ -25,9 +25,11 @@ > #include "llvm/Target/TargetOptions.h" > #include "llvm/Target/TargetRegisterInfo.h" > #include "llvm/Support/Dwarf.h" > +#include "llvm/Support/Mangler.h" > #include "llvm/Support/Timer.h" > #include "llvm/Support/raw_ostream.h" > #include "llvm/ADT/StringExtras.h" > +#include > using namespace llvm; > > static TimerGroup &getDwarfTimerGroup() { > @@ -599,9 +601,12 @@ > > EmitLabel("exception", SubprogramCount); > if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { > - std::string SjLjName = "_lsda_"; > - SjLjName += MF->getFunction()->getName().str(); > - EmitLabel(SjLjName.c_str(), 0); > + std::stringstream out; > + out << Asm->getFunctionNumber(); SubprogramCount? > + std::string LSDAName = > + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), > + Mangler::Private); > + EmitLabel(LSDAName.c_str(), 0, false); Rather than making arbitrary change Dwarf::PrintLabelName and Dwarf::EmitLabel to accommodate this, why not just do out << LSDAName << 0 << ":\n"; Evan > } > > // Emit the header. > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 > 20:57:56 2009 > @@ -43,21 +43,27 @@ > > /// PrintLabelName - Print label name in form used by Dwarf writer. > /// > -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { > - O << MAI->getPrivateGlobalPrefix() << Tag; > +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, > + bool ForcePrivate) const { > + if (ForcePrivate) > + O << MAI->getPrivateGlobalPrefix(); > + O << Tag; > if (Number) O << Number; > } > void Dwarf::PrintLabelName(const char *Tag, unsigned Number, > - const char *Suffix) const { > - O << MAI->getPrivateGlobalPrefix() << Tag; > + const char *Suffix, bool ForcePrivate) > const { > + if (ForcePrivate) > + O << MAI->getPrivateGlobalPrefix(); > + O << Tag; > if (Number) O << Number; > O << Suffix; > } > > /// EmitLabel - Emit location label for internal use by Dwarf. > /// > -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { > - PrintLabelName(Tag, Number); > +void Dwarf::EmitLabel(const char *Tag, unsigned Number, > + bool ForcePrivate) const { > + PrintLabelName(Tag, Number, ForcePrivate); > O << ":\n"; > } > > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 > 20:57:56 2009 > @@ -100,16 +100,18 @@ > void PrintLabelName(const DWLabel &Label) const { > PrintLabelName(Label.getTag(), Label.getNumber()); > } > - void PrintLabelName(const char *Tag, unsigned Number) const; > void PrintLabelName(const char *Tag, unsigned Number, > - const char *Suffix) const; > + bool ForcePrivate = true) const; > + void PrintLabelName(const char *Tag, unsigned Number, > + const char *Suffix, bool ForcePrivate = > true) const; > > /// EmitLabel - Emit location label for internal use by Dwarf. > /// > void EmitLabel(const DWLabel &Label) const { > EmitLabel(Label.getTag(), Label.getNumber()); > } > - void EmitLabel(const char *Tag, unsigned Number) const; > + void EmitLabel(const char *Tag, unsigned Number, > + bool ForcePrivate = true) const; > > /// EmitReference - Emit a reference to a label. > /// > > Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 > 20:57:56 2009 > @@ -20,11 +20,12 @@ > using namespace llvm; > > ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, unsigned > id, > + ARMCP::ARMCPKind K, > unsigned char PCAdj, > const char *Modif, > bool AddCA) > : MachineConstantPoolValue((const Type*)gv->getType()), > - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), > + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), > Modifier(Modif), AddCurrentAddress(AddCA) {} > > ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, > @@ -33,12 +34,12 @@ > const char *Modif, > bool AddCA) > : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), > - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), > + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), > PCAdjust(PCAdj), > Modifier(Modif), AddCurrentAddress(AddCA) {} > > ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const > char *Modif) > : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- > >getContext())), > - GV(gv), S(NULL), LabelId(0), PCAdjust(0), > + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust(0), > Modifier(Modif) {} > > int > ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool > *CP, > > Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 > 20:57:56 2009 > @@ -21,12 +21,20 @@ > class GlobalValue; > class LLVMContext; > > +namespace ARMCP { > + enum ARMCPKind { > + CPValue, > + CPLSDA > + }; > +} > + > /// ARMConstantPoolValue - ARM specific constantpool value. This is > used to > /// represent PC relative displacement between the address of the load > /// instruction and the global value being loaded, i.e. (&GV-(LPIC > +8)). > class ARMConstantPoolValue : public MachineConstantPoolValue { > GlobalValue *GV; // GlobalValue being loaded. > const char *S; // ExtSymbol being loaded. > + ARMCP::ARMCPKind Kind; // Value or LSDA? > unsigned LabelId; // Label id of the load. > unsigned char PCAdjust; // Extra adjustment if constantpool is pc > relative. > // 8 for ARM, 4 for Thumb. > @@ -35,6 +43,7 @@ > > public: > ARMConstantPoolValue(GlobalValue *gv, unsigned id, > + ARMCP::ARMCPKind Kind = ARMCP::CPValue, > unsigned char PCAdj = 0, const char *Modifier > = NULL, > bool AddCurrentAddress = false); > ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, > @@ -52,6 +61,7 @@ > bool mustAddCurrentAddress() const { return AddCurrentAddress; } > unsigned getLabelId() const { return LabelId; } > unsigned char getPCAdjustment() const { return PCAdjust; } > + bool isLSDA() { return Kind == ARMCP::CPLSDA; } > > virtual unsigned getRelocationInfo() const { > // FIXME: This is conservatively claiming that these entries > require a > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 > 20:57:56 2009 > @@ -40,6 +40,7 @@ > #include "llvm/ADT/VectorExtras.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/MathExtras.h" > +#include > using namespace llvm; > > static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, EVT > &LocVT, > @@ -969,7 +970,8 @@ > // tBX takes a register source operand. > if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- > >hasV5TOps()) { > ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, > - > ARMPCLabelIndex, 4); > + > ARMPCLabelIndex, > + > ARMCP::CPValue, 4); > SDValue CPAddr = DAG.getTargetConstantPool(CPV, > getPointerTy(), 4); > CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); > Callee = DAG.getLoad(getPointerTy(), dl, > @@ -1166,7 +1168,7 @@ > unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; > ARMConstantPoolValue *CPV = > new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, > - PCAdj, "tlsgd", true); > + ARMCP::CPValue, PCAdj, "tlsgd", true); > SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); > Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); > Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, > NULL, 0); > @@ -1208,7 +1210,7 @@ > unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; > ARMConstantPoolValue *CPV = > new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, > - PCAdj, "gottpoff", true); > + ARMCP::CPValue, PCAdj, "gottpoff", > true); > Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); > Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); > Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); > @@ -1284,7 +1286,7 @@ > else { > unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- > >isThumb()?4:8); > ARMConstantPoolValue *CPV = > - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); > + new ARMConstantPoolValue(GV, ARMPCLabelIndex, ARMCP::CPValue, > PCAdj); > CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); > } > CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); > @@ -1375,10 +1377,6 @@ > return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); > } > case Intrinsic::eh_sjlj_lsda: { > - // blah. horrible, horrible hack with the forced magic name. > - // really need to clean this up. It belongs in the target- > independent > - // layer somehow that doesn't require the coupling with the asm > - // printer. > MachineFunction &MF = DAG.getMachineFunction(); > EVT PtrVT = getPointerTy(); > DebugLoc dl = Op.getDebugLoc(); > @@ -1386,13 +1384,9 @@ > SDValue CPAddr; > unsigned PCAdj = (RelocM != Reloc::PIC_) > ? 0 : (Subtarget->isThumb() ? 4 : 8); > - // Save off the LSDA name for the AsmPrinter to use when it's > time > - // to emit the table > - std::string LSDAName = "L_lsda_"; > - LSDAName += MF.getFunction()->getName(); > ARMConstantPoolValue *CPV = > - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str(), > - ARMPCLabelIndex, PCAdj); > + new ARMConstantPoolValue(MF.getFunction(), ARMPCLabelIndex, > + ARMCP::CPLSDA, PCAdj); > CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); > CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); > SDValue Result = > > Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug > 31 20:57:56 2009 > @@ -44,6 +44,7 @@ > #include "llvm/Support/MathExtras.h" > #include "llvm/Support/FormattedStream.h" > #include > +#include > using namespace llvm; > > STATISTIC(EmittedInsts, "Number of machine instrs printed"); > @@ -159,8 +160,13 @@ > ARMConstantPoolValue *ACPV = > static_cast(MCPV); > GlobalValue *GV = ACPV->getGV(); > std::string Name; > - > - if (GV) { > + > + if (ACPV->isLSDA()) { > + std::stringstream out; > + out << getFunctionNumber(); > + Name = Mang->makeNameProper(std::string("LSDA_") + out.str(), > + Mangler::Private); > + } else if (GV) { > bool isIndirect = Subtarget->isTargetDarwin() && > Subtarget->GVIsIndirectSymbol(GV, > TM.getRelocationModel() == > Reloc::Static); > @@ -175,9 +181,7 @@ > else > GVNonLazyPtrs[SymName] = Name; > } > - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) > - Name = ACPV->getSymbol(); > - else > + } else > Name = Mang->makeNameProper(ACPV->getSymbol()); > O << Name; > > > Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) > +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug 31 > 20:57:56 2009 > @@ -0,0 +1,103 @@ > +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s > + > +%struct.A = type { i32* } > + > +define arm_apcscc void @"\01-[MyFunction Name:]"() { > +entry: > + %save_filt.1 = alloca i32 ; [#uses=2] > + %save_eptr.0 = alloca i8* ; [#uses=2] > + %a = alloca %struct.A ; <%struct.A*> > [#uses=3] > + %eh_exception = alloca i8* ; [#uses=5] > + %eh_selector = alloca i32 ; [#uses=3] > + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] > + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) > + invoke arm_apcscc void @_Z3barv() > + to label %invcont unwind label %lpad > + > +invcont: ; preds = %entry > + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind > + br label %return > + > +bb: ; preds = %ppad > + %eh_select = load i32* %eh_selector ; [#uses=1] > + store i32 %eh_select, i32* %save_filt.1, align 4 > + %eh_value = load i8** %eh_exception ; [#uses=1] > + store i8* %eh_value, i8** %save_eptr.0, align 4 > + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind > + %0 = load i8** %save_eptr.0, align 4 ; [#uses=1] > + store i8* %0, i8** %eh_exception, align 4 > + %1 = load i32* %save_filt.1, align 4 ; [#uses=1] > + store i32 %1, i32* %eh_selector, align 4 > + br label %Unwind > + > +return: ; preds = %invcont > + ret void > + > +lpad: ; preds = %entry > + %eh_ptr = call i8* @llvm.eh.exception() ; [#uses=1] > + store i8* %eh_ptr, i8** %eh_exception > + %eh_ptr1 = load i8** %eh_exception ; [#uses=1] > + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* > %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*), > i32 0) ; [#uses=1] > + store i32 %eh_select2, i32* %eh_selector > + br label %ppad > + > +ppad: ; preds = %lpad > + br label %bb > + > +Unwind: ; preds = %bb > + %eh_ptr3 = load i8** %eh_exception ; [#uses=1] > + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) > + unreachable > +} > + > +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* %this) { > +entry: > + %this_addr = alloca %struct.A* ; <%struct.A**> > [#uses=2] > + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] > + store %struct.A* %this, %struct.A** %this_addr > + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; [#uses=1] > + %1 = bitcast i8* %0 to i32* ; [#uses=1] > + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> > [#uses=1] > + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; > [#uses=1] > + store i32* %1, i32** %3, align 4 > + br label %return > + > +return: ; preds = %entry > + ret void > +} > + > +declare arm_apcscc i8* @_Znwm(i32) > + > +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) > nounwind { > +entry: > + %this_addr = alloca %struct.A* ; <%struct.A**> > [#uses=2] > + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] > + store %struct.A* %this, %struct.A** %this_addr > + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> > [#uses=1] > + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; > [#uses=1] > + %2 = load i32** %1, align 4 ; [#uses=1] > + %3 = bitcast i32* %2 to i8* ; [#uses=1] > + call arm_apcscc void @_ZdlPv(i8* %3) nounwind > + br label %bb > + > +bb: ; preds = %entry > + br label %return > + > +return: ; preds = %bb > + ret void > +} > +;CHECK: L_LSDA_1: > + > +declare arm_apcscc void @_ZdlPv(i8*) nounwind > + > +declare arm_apcscc void @_Z3barv() > + > +declare i8* @llvm.eh.exception() nounwind > + > +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind > + > +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind > + > +declare arm_apcscc i32 @__gxx_personality_sj0(...) > + > +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From benny.kra at googlemail.com Tue Sep 1 05:24:10 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Tue, 01 Sep 2009 10:24:10 -0000 Subject: [llvm-commits] [llvm] r80669 - /llvm/trunk/lib/Analysis/CMakeLists.txt Message-ID: <200909011024.n81AOA08021091@zion.cs.uiuc.edu> Author: d0k Date: Tue Sep 1 05:24:10 2009 New Revision: 80669 URL: http://llvm.org/viewvc/llvm-project?rev=80669&view=rev Log: Update CMakeLists. Modified: llvm/trunk/lib/Analysis/CMakeLists.txt Modified: llvm/trunk/lib/Analysis/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CMakeLists.txt?rev=80669&r1=80668&r2=80669&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/CMakeLists.txt (original) +++ llvm/trunk/lib/Analysis/CMakeLists.txt Tue Sep 1 05:24:10 2009 @@ -29,6 +29,7 @@ ProfileInfo.cpp ProfileInfoLoader.cpp ProfileInfoLoaderPass.cpp + ProfileVerifierPass.cpp ScalarEvolution.cpp ScalarEvolutionAliasAnalysis.cpp ScalarEvolutionExpander.cpp From sanjiv.gupta at microchip.com Tue Sep 1 05:47:31 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Tue, 01 Sep 2009 10:47:31 -0000 Subject: [llvm-commits] [llvm] r80670 - in /llvm/trunk/lib/Target/PIC16: MCSectionPIC16.h PIC16TargetObjectFile.cpp PIC16TargetObjectFile.h Message-ID: <200909011047.n81AlWqq024459@zion.cs.uiuc.edu> Author: sgupta Date: Tue Sep 1 05:47:31 2009 New Revision: 80670 URL: http://llvm.org/viewvc/llvm-project?rev=80670&view=rev Log: Further refactoring of PIC16 Obj file code. Modified: llvm/trunk/lib/Target/PIC16/MCSectionPIC16.h llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h Modified: llvm/trunk/lib/Target/PIC16/MCSectionPIC16.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/MCSectionPIC16.h?rev=80670&r1=80669&r2=80670&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/MCSectionPIC16.h (original) +++ llvm/trunk/lib/Target/PIC16/MCSectionPIC16.h Tue Sep 1 05:47:31 2009 @@ -29,10 +29,9 @@ /// Negative value here means user hasn't specified any. int Address; - /// FIXME: Keep overlay information here. uncomment the decl below. /// Overlay information - Sections with same color can be overlaid on /// one another. - /// std::string Color; + int Color; /// Conatined data objects. std::vectorItems; @@ -40,8 +39,8 @@ /// Total size of all data objects contained here. unsigned Size; - MCSectionPIC16(const StringRef &name, SectionKind K, int addr) - : MCSection(K), Name(name), Address(addr) { + MCSectionPIC16(const StringRef &name, SectionKind K, int addr, int color) + : MCSection(K), Name(name), Address(addr), Color(color) { } public: @@ -51,6 +50,9 @@ /// Return the Address of the section. int getAddress() const { return Address; } + /// Return the Color of the section. + int getColor() const { return Color; } + /// PIC16 Terminology for section kinds is as below. /// UDATA - BSS /// IDATA - initialized data (equiv to Metadata) @@ -73,7 +75,7 @@ /// This would be the only way to create a section. static MCSectionPIC16 *Create(const StringRef &Name, SectionKind K, - int Address, MCContext &Ctx); + int Address, int Color, MCContext &Ctx); /// Override this as PIC16 has its own way of printing switching /// to a section. Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp?rev=80670&r1=80669&r2=80670&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp Tue Sep 1 05:47:31 2009 @@ -20,8 +20,8 @@ MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name, SectionKind K, - int Address, MCContext &Ctx) { - return new (Ctx) MCSectionPIC16(Name, K, Address); + int Address, int Color, MCContext &Ctx) { + return new (Ctx) MCSectionPIC16(Name, K, Address, Color); } @@ -38,12 +38,14 @@ } const MCSectionPIC16 *PIC16TargetObjectFile:: -getPIC16Section(const char *Name, SectionKind Kind, int Address) const { +getPIC16Section(const char *Name, SectionKind Kind, + int Address, int Color) const { MCSectionPIC16 *&Entry = SectionsByName[Name]; if (Entry) return Entry; - return Entry = MCSectionPIC16::Create(Name, Kind, Address, getContext()); + return Entry = MCSectionPIC16::Create(Name, Kind, Address, Color, + getContext()); } @@ -51,10 +53,10 @@ TargetLoweringObjectFile::Initialize(Ctx, tm); TM = &tm; - BSSSection = getPIC16Section("udata.# UDATA", SectionKind::getBSS()); + BSSSection = getPIC16Section("udata.# UDATA", MCSectionPIC16::UDATA_Kind()); ReadOnlySection = getPIC16Section("romdata.# ROMDATA", - SectionKind::getReadOnly()); - DataSection = getPIC16Section("idata.# IDATA", SectionKind::getDataRel()); + MCSectionPIC16::ROMDATA_Kind()); + DataSection = getPIC16Section("idata.# IDATA", MCSectionPIC16::IDATA_Kind()); // Need because otherwise a .text symbol is emitted by DwarfWriter // in BeginModule, and gpasm cribbs for that .text symbol. @@ -63,6 +65,8 @@ ROSections.push_back(new PIC16Section((MCSectionPIC16*)ReadOnlySection)); // FIXME: I don't know what the classification of these sections really is. + // These aren't really objects belonging to any section. Just emit them + // in AsmPrinter and remove this code from here. ExternalVarDecls = new PIC16Section(getPIC16Section("ExternalVarDecls", SectionKind::getMetadata())); ExternalVarDefs = new PIC16Section(getPIC16Section("ExternalVarDefs", @@ -107,7 +111,7 @@ if (!FoundBSS) { std::string name = PAN::getUdataSectionName(BSSSections.size()); const MCSectionPIC16 *NewSection - = getPIC16Section(name.c_str(), /*FIXME*/ SectionKind::getMetadata()); + = getPIC16Section(name.c_str(), MCSectionPIC16::UDATA_Kind()); FoundBSS = new PIC16Section(NewSection); @@ -148,7 +152,7 @@ if (!FoundIDATA) { std::string name = PAN::getIdataSectionName(IDATASections.size()); const MCSectionPIC16 *NewSection = - getPIC16Section(name.c_str(), /*FIXME*/ SectionKind::getMetadata()); + getPIC16Section(name.c_str(), MCSectionPIC16::IDATA_Kind()); FoundIDATA = new PIC16Section(NewSection); @@ -182,7 +186,7 @@ // No Auto section was found. Crate a new one. if (!FoundAutoSec) { const MCSectionPIC16 *NewSection = - getPIC16Section(name.c_str(), /*FIXME*/ SectionKind::getMetadata()); + getPIC16Section(name.c_str(), MCSectionPIC16::UDATA_OVR_Kind()); FoundAutoSec = new PIC16Section(NewSection); @@ -333,7 +337,7 @@ PIC16Section *NewBSS = FoundBSS; if (NewBSS == NULL) { const MCSectionPIC16 *NewSection = - getPIC16Section(Name.c_str(), SectionKind::getBSS()); + getPIC16Section(Name.c_str(), MCSectionPIC16::UDATA_Kind()); NewBSS = new PIC16Section(NewSection); BSSSections.push_back(NewBSS); } @@ -385,7 +389,7 @@ PIC16Section *NewIDATASec = FoundIDATASec; if (NewIDATASec == NULL) { const MCSectionPIC16 *NewSection = - getPIC16Section(Name.c_str(), /* FIXME */SectionKind::getMetadata()); + getPIC16Section(Name.c_str(), MCSectionPIC16::IDATA_Kind()); NewIDATASec = new PIC16Section(NewSection); IDATASections.push_back(NewIDATASec); } @@ -424,7 +428,7 @@ PIC16Section *NewRomSec = FoundROSec; if (NewRomSec == NULL) { const MCSectionPIC16 *NewSection = - getPIC16Section(Name.c_str(), SectionKind::getReadOnly()); + getPIC16Section(Name.c_str(), MCSectionPIC16::ROMDATA_Kind()); NewRomSec = new PIC16Section(NewSection); ROSections.push_back(NewRomSec); } Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h?rev=80670&r1=80669&r2=80670&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h Tue Sep 1 05:47:31 2009 @@ -54,7 +54,8 @@ const MCSectionPIC16 *getPIC16Section(const char *Name, SectionKind K, - int Address = -1) const; + int Address = -1, + int Color = -1) const; public: mutable std::vector BSSSections; mutable std::vector IDATASections; From e0325716 at student.tuwien.ac.at Tue Sep 1 06:25:56 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 13:25:56 +0200 Subject: [llvm-commits] [llvm] r80669 - /llvm/trunk/lib/Analysis/CMakeLists.txt In-Reply-To: <200909011024.n81AOA08021091@zion.cs.uiuc.edu> References: <200909011024.n81AOA08021091@zion.cs.uiuc.edu> Message-ID: <4A9D04C4.7010108@student.tuwien.ac.at> Thanks! Benjamin Kramer wrote: > Author: d0k > Date: Tue Sep 1 05:24:10 2009 > New Revision: 80669 > > URL: http://llvm.org/viewvc/llvm-project?rev=80669&view=rev > Log: > Update CMakeLists. > > Modified: > llvm/trunk/lib/Analysis/CMakeLists.txt > > Modified: llvm/trunk/lib/Analysis/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CMakeLists.txt?rev=80669&r1=80668&r2=80669&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/CMakeLists.txt (original) > +++ llvm/trunk/lib/Analysis/CMakeLists.txt Tue Sep 1 05:24:10 2009 > @@ -29,6 +29,7 @@ > ProfileInfo.cpp > ProfileInfoLoader.cpp > ProfileInfoLoaderPass.cpp > + ProfileVerifierPass.cpp > ScalarEvolution.cpp > ScalarEvolutionAliasAnalysis.cpp > ScalarEvolutionExpander.cpp > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- ========================================================================== This email is signed, for more information see http://web.student.tuwien.ac.at/~e0325716/gpg.html From astifter at gmx.at Tue Sep 1 03:48:44 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 08:48:44 -0000 Subject: [llvm-commits] [llvm] r80666 - in /llvm/trunk: include/llvm/Analysis/Passes.h include/llvm/LinkAllPasses.h lib/Analysis/ProfileVerifierPass.cpp Message-ID: <200909010848.n818miJV007938@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 03:48:42 2009 New Revision: 80666 URL: http://llvm.org/viewvc/llvm-project?rev=80666&view=rev Log: Preparation for Optimal Edge Profiling: This adds a pass to verify the current profile against the flow conditions. This is very helpful when later on trying to perserve the profiling information during all passes. Added: llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp Modified: llvm/trunk/include/llvm/Analysis/Passes.h llvm/trunk/include/llvm/LinkAllPasses.h Modified: llvm/trunk/include/llvm/Analysis/Passes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Passes.h?rev=80666&r1=80665&r2=80666&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Passes.h (original) +++ llvm/trunk/include/llvm/Analysis/Passes.h Tue Sep 1 03:48:42 2009 @@ -109,6 +109,12 @@ //===--------------------------------------------------------------------===// // + // createProfileVerifierPass - This pass verifies profiling information. + // + FunctionPass *createProfileVerifierPass(); + + //===--------------------------------------------------------------------===// + // // createDSAAPass - This pass implements simple context sensitive alias // analysis. // Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=80666&r1=80665&r2=80666&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Tue Sep 1 03:48:42 2009 @@ -94,6 +94,7 @@ (void) llvm::createNoAAPass(); (void) llvm::createNoProfileInfoPass(); (void) llvm::createProfileEstimatorPass(); + (void) llvm::createProfileVerifierPass(); (void) llvm::createProfileLoaderPass(); (void) llvm::createPromoteMemoryToRegisterPass(); (void) llvm::createDemoteRegisterToMemoryPass(); Added: llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp?rev=80666&view=auto ============================================================================== --- llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp (added) +++ llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp Tue Sep 1 03:48:42 2009 @@ -0,0 +1,228 @@ +//===- ProfileVerifierPass.cpp - LLVM Pass to estimate profile info -------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements a pass that checks profiling information for +// plausibility. +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "profile-verifier" +#include "llvm/Pass.h" +#include "llvm/Analysis/ProfileInfo.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/CFG.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Debug.h" +#include +using namespace llvm; + +static bool DisableAssertions = false; +static cl::opt +ProfileVerifierDisableAssertions("profile-verifier-noassert", + cl::location(DisableAssertions), cl::desc("Disable assertions")); +bool PrintedDebugTree = false; + +namespace { + class VISIBILITY_HIDDEN ProfileVerifierPass : public FunctionPass { + ProfileInfo *PI; + std::set BBisVisited; +#ifndef NDEBUG + std::set BBisPrinted; + void debugEntry(const BasicBlock* BB, double w, double inw, int inc, + double outw, int outc, double d); + void printDebugInfo(const BasicBlock *BB); +#endif + public: + static char ID; // Class identification, replacement for typeinfo + + explicit ProfileVerifierPass () : FunctionPass(&ID) { + DisableAssertions = ProfileVerifierDisableAssertions; + } + + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired(); + } + + const char *getPassName() const { + return "Profiling information verifier"; + } + + /// run - Verify the profile information. + bool runOnFunction(Function &F); + void recurseBasicBlock(const BasicBlock *BB); + }; +} // End of anonymous namespace + +char ProfileVerifierPass::ID = 0; +static RegisterPass +X("profile-verifier", "Verify profiling information", false, true); + +namespace llvm { + FunctionPass *createProfileVerifierPass() { + return new ProfileVerifierPass(); + } +} + +#ifndef NDEBUG +void ProfileVerifierPass::printDebugInfo(const BasicBlock *BB) { + + if (BBisPrinted.find(BB) != BBisPrinted.end()) return; + + double BBWeight = PI->getExecutionCount(BB); + if (BBWeight == ProfileInfo::MissingValue) { BBWeight = 0; } + double inWeight = 0; + int inCount = 0; + std::set ProcessedPreds; + for ( pred_const_iterator bbi = pred_begin(BB), bbe = pred_end(BB); + bbi != bbe; ++bbi ) { + if (ProcessedPreds.insert(*bbi).second) { + double EdgeWeight = PI->getEdgeWeight(PI->getEdge(*bbi,BB)); + if (EdgeWeight == ProfileInfo::MissingValue) { EdgeWeight = 0; } + DEBUG(errs()<<"calculated in-edge ("<<(*bbi)->getNameStr()<<","<getNameStr() + <<"): "< ProcessedSuccs; + for ( succ_const_iterator bbi = succ_begin(BB), bbe = succ_end(BB); + bbi != bbe; ++bbi ) { + if (ProcessedSuccs.insert(*bbi).second) { + double EdgeWeight = PI->getEdgeWeight(PI->getEdge(BB,*bbi)); + if (EdgeWeight == ProfileInfo::MissingValue) { EdgeWeight = 0; } + DEBUG(errs()<<"calculated out-edge ("<getNameStr()<<","<<(*bbi)->getNameStr() + <<"): "<getNameStr()<<" in "<getParent()->getNameStr() + <<",BBWeight="<getNameStr()<<" in "<getParent()->getNameStr() + <<",BBWeight="<getParent()->getEntryBlock())); + } +} +#endif + +// compare with relative error +static bool dcmp(double A, double B) { + double maxRelativeError = 0.0000001; + if (A == B) + return true; + double relativeError; + if (fabs(B) > fabs(A)) + relativeError = fabs((A - B) / B); + else + relativeError = fabs((A - B) / A); + if (relativeError <= maxRelativeError) return true; + return false; +} + +#define CHECK(C,M) \ +if (C) { \ + if (DisableAssertions) { errs()<<(M)<<"\n"; } else { assert((!(C)) && (M)); } \ +} + +#define CHECKDEBUG(C,M,D) \ +if (C) { \ + DEBUG(debugEntry(BB, BBWeight, inWeight, inCount, \ + outWeight, outCount, (D))); \ + if (DisableAssertions) { errs()<<(M)<<"\n"; } else { assert((!(C)) && (M)); } \ +} + +void ProfileVerifierPass::recurseBasicBlock(const BasicBlock *BB) { + + if (BBisVisited.find(BB) != BBisVisited.end()) return; + + double inWeight = 0; + int inCount = 0; + std::set ProcessedPreds; + for ( pred_const_iterator bbi = pred_begin(BB), bbe = pred_end(BB); + bbi != bbe; ++bbi ) { + if (ProcessedPreds.insert(*bbi).second) { + double EdgeWeight = PI->getEdgeWeight(PI->getEdge(*bbi,BB)); + CHECK(EdgeWeight == ProfileInfo::MissingValue, + "ASSERT:Edge has missing value"); + inWeight += EdgeWeight; inCount++; + } + } + + double outWeight = 0; + int outCount = 0; + std::set ProcessedSuccs; + for ( succ_const_iterator bbi = succ_begin(BB), bbe = succ_end(BB); + bbi != bbe; ++bbi ) { + if (ProcessedSuccs.insert(*bbi).second) { + double EdgeWeight = PI->getEdgeWeight(PI->getEdge(BB,*bbi)); + CHECK(EdgeWeight == ProfileInfo::MissingValue, + "ASSERT:Edge has missing value"); + outWeight += EdgeWeight; outCount++; + } + } + + double BBWeight = PI->getExecutionCount(BB); + CHECKDEBUG(BBWeight == ProfileInfo::MissingValue, + "ASSERT:BasicBlock has missing value",-1); + + if (inCount > 0) { + CHECKDEBUG(!dcmp(inWeight,BBWeight), + "ASSERT:inWeight and BBWeight do not match",inWeight-BBWeight); + } + if (outCount > 0) { + CHECKDEBUG(!dcmp(outWeight,BBWeight), + "ASSERT:outWeight and BBWeight do not match",outWeight-BBWeight); + } + + // mark as visited and recurse into subnodes + BBisVisited.insert(BB); + for ( succ_const_iterator bbi = succ_begin(BB), bbe = succ_end(BB); + bbi != bbe; ++bbi ) { + recurseBasicBlock(*bbi); + } +} + +bool ProfileVerifierPass::runOnFunction(Function &F) { + PI = &getAnalysis(); + + if (PI->getExecutionCount(&F) == ProfileInfo::MissingValue) { + DEBUG(errs()<<"Function "<getExecutionCount(&F)==PI->getExecutionCount(entry)) && + "Function count and entry block count do not match"); + return false; +} From astifter at gmx.at Tue Sep 1 05:06:06 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 10:06:06 -0000 Subject: [llvm-commits] [llvm] r80667 - in /llvm/trunk: include/llvm/Analysis/ProfileInfo.h lib/Analysis/ProfileEstimatorPass.cpp Message-ID: <200909011006.n81A66HJ018595@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 05:06:05 2009 New Revision: 80667 URL: http://llvm.org/viewvc/llvm-project?rev=80667&view=rev Log: Preparation for Optimal Edge Profiling: Optimal edge profiling is only possible when blocks with no predecessors get an virtual edge (BB,0) that counts the execution frequencies of this function-exiting blocks. This patch makes the necessary changes before actually enabling optimal edge profiling. Modified: llvm/trunk/include/llvm/Analysis/ProfileInfo.h llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Modified: llvm/trunk/include/llvm/Analysis/ProfileInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileInfo.h?rev=80667&r1=80666&r2=80667&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ProfileInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/ProfileInfo.h Tue Sep 1 05:06:05 2009 @@ -63,8 +63,13 @@ // getFunction() - Returns the Function for an Edge, checking for validity. static const Function* getFunction(Edge e) { - assert(e.second && "Invalid ProfileInfo::Edge"); - return e.second->getParent(); + if (e.first) { + return e.first->getParent(); + } else if (e.second) { + return e.second->getParent(); + } + assert(0 && "Invalid ProfileInfo::Edge"); + return (const Function*)0; } // getEdge() - Creates an Edge from two BasicBlocks. Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp?rev=80667&r1=80666&r2=80667&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Tue Sep 1 05:06:05 2009 @@ -168,7 +168,14 @@ std::set ProcessedSuccs; // Otherwise consider weight of outgoing edges and store them for - // distribution of remaining weight. + // distribution of remaining weight. In case the block has no successors + // create a (BB,0) edge. + succ_iterator bbi = succ_begin(BB), bbe = succ_end(BB); + if (bbi == bbe) { + Edge edge = getEdge(BB,0); + EdgeInformation[BB->getParent()][edge] = BBWeight; + printEdgeWeight(edge); + } for ( succ_iterator bbi = succ_begin(BB), bbe = succ_end(BB); bbi != bbe; ++bbi ) { if (ProcessedSuccs.insert(*bbi).second) { From astifter at gmx.at Tue Sep 1 05:08:39 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 10:08:39 -0000 Subject: [llvm-commits] [llvm] r80668 - /llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Message-ID: <200909011008.n81A8dwQ018937@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 05:08:39 2009 New Revision: 80668 URL: http://llvm.org/viewvc/llvm-project?rev=80668&view=rev Log: Preparation for Optimal Edge Profiling: Add statistics for regular edge profiling, this enables the comparation of the number of edges inserted by regular and optimal edge profiling. Modified: llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Modified: llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp?rev=80668&r1=80667&r2=80668&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp (original) +++ llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Tue Sep 1 05:08:39 2009 @@ -16,7 +16,7 @@ // number of counters inserted. // //===----------------------------------------------------------------------===// - +#define DEBUG_TYPE "insert-edge-profiling" #include "ProfilingUtils.h" #include "llvm/Module.h" #include "llvm/Pass.h" @@ -24,15 +24,22 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Instrumentation.h" +#include "llvm/ADT/Statistic.h" #include using namespace llvm; +STATISTIC(NumEdgesInserted, "The # of edges inserted."); + namespace { class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass { bool runOnModule(Module &M); public: static char ID; // Pass identification, replacement for typeid EdgeProfiler() : ModulePass(&ID) {} + + virtual const char *getPassName() const { + return "Edge Profiler"; + } }; } @@ -69,6 +76,7 @@ GlobalVariable *Counters = new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "EdgeProfCounters"); + NumEdgesInserted = NumEdges; // Instrument all of the edges... unsigned i = 0; From grosbach at apple.com Tue Sep 1 09:58:59 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 07:58:59 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> Message-ID: <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> On Sep 1, 2009, at 12:56 AM, Evan Cheng wrote: > Comments below. > > On Aug 31, 2009, at 6:57 PM, Jim Grosbach wrote: > >> Author: grosbach >> Date: Mon Aug 31 20:57:56 2009 >> New Revision: 80649 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80649&view=rev >> Log: >> Clean up LSDA name generation and use for SJLJ exception handling. >> This >> makes an eggregious hack somewhat more palatable. Bringing the LSDA >> forward >> and making it a GV available for reference would be even better, >> but is >> beyond the scope of what I'm looking to solve at this point. >> >> Objective C++ code could generate function names that broke the >> previous >> scheme. This fixes that. >> >> Added: >> llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >> Modified: >> llvm/trunk/include/llvm/CodeGen/AsmPrinter.h >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >> llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >> llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >> llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >> llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >> >> Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Aug 31 >> 20:57:56 2009 >> @@ -172,6 +172,10 @@ >> /// >> std::string getCurrentFunctionEHName(const MachineFunction *MF) >> const; >> >> + /// getFunctionNumber - Return a unique ID for the current >> function. >> + /// >> + unsigned getFunctionNumber() const { return FunctionNumber; } >> + >> protected: >> /// getAnalysisUsage - Record analysis usage. >> /// >> @@ -217,10 +221,6 @@ >> /// is being processed from runOnMachineFunction. >> void SetupMachineFunction(MachineFunction &MF); >> >> - /// getFunctionNumber - Return a unique ID for the current >> function. >> - /// >> - unsigned getFunctionNumber() const { return FunctionNumber; } >> - > > Is this necessary? DwarfException should be using SubprogramCount, no? I'd turn the question around. Why is DwarfException adding its own function counter when one is already available? Is there a reason we need two that are doing the same thing? The constant pool entry is part of the ARM AsmPrinter, which has the getFunctionNumber() directly. It's the most straightforward solution for the Dwarf writer to use the same interface to output the table itself. > > >> /// IncrementFunctionNumber - Increase Function Number. >> AsmPrinters should >> /// not normally call this, as the counter is automatically >> bumped by >> /// SetupMachineFunction. >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 31 >> 20:57:56 2009 >> @@ -25,9 +25,11 @@ >> #include "llvm/Target/TargetOptions.h" >> #include "llvm/Target/TargetRegisterInfo.h" >> #include "llvm/Support/Dwarf.h" >> +#include "llvm/Support/Mangler.h" >> #include "llvm/Support/Timer.h" >> #include "llvm/Support/raw_ostream.h" >> #include "llvm/ADT/StringExtras.h" >> +#include >> using namespace llvm; >> >> static TimerGroup &getDwarfTimerGroup() { >> @@ -599,9 +601,12 @@ >> >> EmitLabel("exception", SubprogramCount); >> if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { >> - std::string SjLjName = "_lsda_"; >> - SjLjName += MF->getFunction()->getName().str(); >> - EmitLabel(SjLjName.c_str(), 0); >> + std::stringstream out; >> + out << Asm->getFunctionNumber(); > > SubprogramCount? > >> + std::string LSDAName = >> + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), >> + Mangler::Private); >> + EmitLabel(LSDAName.c_str(), 0, false); > > Rather than making arbitrary change Dwarf::PrintLabelName and > Dwarf::EmitLabel to accommodate this, why not just do > out << LSDAName << 0 << ":\n"; Simply consistency that labels get printed via EmitLabel. No strong preference either way. I'll change it. > > Evan > >> } >> >> // Emit the header. >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 >> 20:57:56 2009 >> @@ -43,21 +43,27 @@ >> >> /// PrintLabelName - Print label name in form used by Dwarf writer. >> /// >> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { >> - O << MAI->getPrivateGlobalPrefix() << Tag; >> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >> + bool ForcePrivate) const { >> + if (ForcePrivate) >> + O << MAI->getPrivateGlobalPrefix(); >> + O << Tag; >> if (Number) O << Number; >> } >> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >> - const char *Suffix) const { >> - O << MAI->getPrivateGlobalPrefix() << Tag; >> + const char *Suffix, bool ForcePrivate) >> const { >> + if (ForcePrivate) >> + O << MAI->getPrivateGlobalPrefix(); >> + O << Tag; >> if (Number) O << Number; >> O << Suffix; >> } >> >> /// EmitLabel - Emit location label for internal use by Dwarf. >> /// >> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { >> - PrintLabelName(Tag, Number); >> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >> + bool ForcePrivate) const { >> + PrintLabelName(Tag, Number, ForcePrivate); >> O << ":\n"; >> } >> >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >> 20:57:56 2009 >> @@ -100,16 +100,18 @@ >> void PrintLabelName(const DWLabel &Label) const { >> PrintLabelName(Label.getTag(), Label.getNumber()); >> } >> - void PrintLabelName(const char *Tag, unsigned Number) const; >> void PrintLabelName(const char *Tag, unsigned Number, >> - const char *Suffix) const; >> + bool ForcePrivate = true) const; >> + void PrintLabelName(const char *Tag, unsigned Number, >> + const char *Suffix, bool ForcePrivate = >> true) const; >> >> /// EmitLabel - Emit location label for internal use by Dwarf. >> /// >> void EmitLabel(const DWLabel &Label) const { >> EmitLabel(Label.getTag(), Label.getNumber()); >> } >> - void EmitLabel(const char *Tag, unsigned Number) const; >> + void EmitLabel(const char *Tag, unsigned Number, >> + bool ForcePrivate = true) const; >> >> /// EmitReference - Emit a reference to a label. >> /// >> >> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 >> 20:57:56 2009 >> @@ -20,11 +20,12 @@ >> using namespace llvm; >> >> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >> unsigned id, >> + ARMCP::ARMCPKind K, >> unsigned char PCAdj, >> const char *Modif, >> bool AddCA) >> : MachineConstantPoolValue((const Type*)gv->getType()), >> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >> Modifier(Modif), AddCurrentAddress(AddCA) {} >> >> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >> @@ -33,12 +34,12 @@ >> const char *Modif, >> bool AddCA) >> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >> PCAdjust(PCAdj), >> Modifier(Modif), AddCurrentAddress(AddCA) {} >> >> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const >> char *Modif) >> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >> >getContext())), >> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust(0), >> Modifier(Modif) {} >> >> int ARMConstantPoolValue::getExistingMachineCPValue >> (MachineConstantPool *CP, >> >> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >> 20:57:56 2009 >> @@ -21,12 +21,20 @@ >> class GlobalValue; >> class LLVMContext; >> >> +namespace ARMCP { >> + enum ARMCPKind { >> + CPValue, >> + CPLSDA >> + }; >> +} >> + >> /// ARMConstantPoolValue - ARM specific constantpool value. This is >> used to >> /// represent PC relative displacement between the address of the >> load >> /// instruction and the global value being loaded, i.e. (&GV-(LPIC >> +8)). >> class ARMConstantPoolValue : public MachineConstantPoolValue { >> GlobalValue *GV; // GlobalValue being loaded. >> const char *S; // ExtSymbol being loaded. >> + ARMCP::ARMCPKind Kind; // Value or LSDA? >> unsigned LabelId; // Label id of the load. >> unsigned char PCAdjust; // Extra adjustment if constantpool is pc >> relative. >> // 8 for ARM, 4 for Thumb. >> @@ -35,6 +43,7 @@ >> >> public: >> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >> unsigned char PCAdj = 0, const char *Modifier >> = NULL, >> bool AddCurrentAddress = false); >> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, >> @@ -52,6 +61,7 @@ >> bool mustAddCurrentAddress() const { return AddCurrentAddress; } >> unsigned getLabelId() const { return LabelId; } >> unsigned char getPCAdjustment() const { return PCAdjust; } >> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >> >> virtual unsigned getRelocationInfo() const { >> // FIXME: This is conservatively claiming that these entries >> require a >> >> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >> 20:57:56 2009 >> @@ -40,6 +40,7 @@ >> #include "llvm/ADT/VectorExtras.h" >> #include "llvm/Support/ErrorHandling.h" >> #include "llvm/Support/MathExtras.h" >> +#include >> using namespace llvm; >> >> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, EVT >> &LocVT, >> @@ -969,7 +970,8 @@ >> // tBX takes a register source operand. >> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >> >hasV5TOps()) { >> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >> - >> ARMPCLabelIndex, 4); >> + >> ARMPCLabelIndex, >> + >> ARMCP::CPValue, 4); >> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >> (), 4); >> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >> Callee = DAG.getLoad(getPointerTy(), dl, >> @@ -1166,7 +1168,7 @@ >> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >> ARMConstantPoolValue *CPV = >> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >> - PCAdj, "tlsgd", true); >> + ARMCP::CPValue, PCAdj, "tlsgd", true); >> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); >> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >> NULL, 0); >> @@ -1208,7 +1210,7 @@ >> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >> ARMConstantPoolValue *CPV = >> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >> - PCAdj, "gottpoff", true); >> + ARMCP::CPValue, PCAdj, "gottpoff", >> true); >> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >> @@ -1284,7 +1286,7 @@ >> else { >> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >> >isThumb()?4:8); >> ARMConstantPoolValue *CPV = >> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >> ARMCP::CPValue, PCAdj); >> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >> } >> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >> @@ -1375,10 +1377,6 @@ >> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >> } >> case Intrinsic::eh_sjlj_lsda: { >> - // blah. horrible, horrible hack with the forced magic name. >> - // really need to clean this up. It belongs in the target- >> independent >> - // layer somehow that doesn't require the coupling with the asm >> - // printer. >> MachineFunction &MF = DAG.getMachineFunction(); >> EVT PtrVT = getPointerTy(); >> DebugLoc dl = Op.getDebugLoc(); >> @@ -1386,13 +1384,9 @@ >> SDValue CPAddr; >> unsigned PCAdj = (RelocM != Reloc::PIC_) >> ? 0 : (Subtarget->isThumb() ? 4 : 8); >> - // Save off the LSDA name for the AsmPrinter to use when it's >> time >> - // to emit the table >> - std::string LSDAName = "L_lsda_"; >> - LSDAName += MF.getFunction()->getName(); >> ARMConstantPoolValue *CPV = >> - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str(), >> - ARMPCLabelIndex, PCAdj); >> + new ARMConstantPoolValue(MF.getFunction(), ARMPCLabelIndex, >> + ARMCP::CPLSDA, PCAdj); >> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >> SDValue Result = >> >> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug >> 31 20:57:56 2009 >> @@ -44,6 +44,7 @@ >> #include "llvm/Support/MathExtras.h" >> #include "llvm/Support/FormattedStream.h" >> #include >> +#include >> using namespace llvm; >> >> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >> @@ -159,8 +160,13 @@ >> ARMConstantPoolValue *ACPV = static_cast >> (MCPV); >> GlobalValue *GV = ACPV->getGV(); >> std::string Name; >> - >> - if (GV) { >> + >> + if (ACPV->isLSDA()) { >> + std::stringstream out; >> + out << getFunctionNumber(); >> + Name = Mang->makeNameProper(std::string("LSDA_") + out.str >> (), >> + Mangler::Private); >> + } else if (GV) { >> bool isIndirect = Subtarget->isTargetDarwin() && >> Subtarget->GVIsIndirectSymbol(GV, >> TM.getRelocationModel() == >> Reloc::Static); >> @@ -175,9 +181,7 @@ >> else >> GVNonLazyPtrs[SymName] = Name; >> } >> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >> - Name = ACPV->getSymbol(); >> - else >> + } else >> Name = Mang->makeNameProper(ACPV->getSymbol()); >> O << Name; >> >> >> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug 31 >> 20:57:56 2009 >> @@ -0,0 +1,103 @@ >> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >> + >> +%struct.A = type { i32* } >> + >> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >> +entry: >> + %save_filt.1 = alloca i32 ; [#uses=2] >> + %save_eptr.0 = alloca i8* ; [#uses=2] >> + %a = alloca %struct.A ; <%struct.A*> >> [#uses=3] >> + %eh_exception = alloca i8* ; [#uses=5] >> + %eh_selector = alloca i32 ; [#uses=3] >> + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] >> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >> + invoke arm_apcscc void @_Z3barv() >> + to label %invcont unwind label %lpad >> + >> +invcont: ; preds = %entry >> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >> + br label %return >> + >> +bb: ; preds = %ppad >> + %eh_select = load i32* %eh_selector ; [#uses=1] >> + store i32 %eh_select, i32* %save_filt.1, align 4 >> + %eh_value = load i8** %eh_exception ; [#uses=1] >> + store i8* %eh_value, i8** %save_eptr.0, align 4 >> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >> + %0 = load i8** %save_eptr.0, align 4 ; [#uses=1] >> + store i8* %0, i8** %eh_exception, align 4 >> + %1 = load i32* %save_filt.1, align 4 ; [#uses=1] >> + store i32 %1, i32* %eh_selector, align 4 >> + br label %Unwind >> + >> +return: ; preds = %invcont >> + ret void >> + >> +lpad: ; preds = %entry >> + %eh_ptr = call i8* @llvm.eh.exception() ; [#uses=1] >> + store i8* %eh_ptr, i8** %eh_exception >> + %eh_ptr1 = load i8** %eh_exception ; [#uses=1] >> + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32 >> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to >> i8*), i32 0) ; [#uses=1] >> + store i32 %eh_select2, i32* %eh_selector >> + br label %ppad >> + >> +ppad: ; preds = %lpad >> + br label %bb >> + >> +Unwind: ; preds = %bb >> + %eh_ptr3 = load i8** %eh_exception ; [#uses=1] >> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >> + unreachable >> +} >> + >> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* %this) { >> +entry: >> + %this_addr = alloca %struct.A* ; <%struct.A**> >> [#uses=2] >> + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] >> + store %struct.A* %this, %struct.A** %this_addr >> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; [#uses=1] >> + %1 = bitcast i8* %0 to i32* ; [#uses=1] >> + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >> [#uses=1] >> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >> [#uses=1] >> + store i32* %1, i32** %3, align 4 >> + br label %return >> + >> +return: ; preds = %entry >> + ret void >> +} >> + >> +declare arm_apcscc i8* @_Znwm(i32) >> + >> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) >> nounwind { >> +entry: >> + %this_addr = alloca %struct.A* ; <%struct.A**> >> [#uses=2] >> + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] >> + store %struct.A* %this, %struct.A** %this_addr >> + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >> [#uses=1] >> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >> [#uses=1] >> + %2 = load i32** %1, align 4 ; [#uses=1] >> + %3 = bitcast i32* %2 to i8* ; [#uses=1] >> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >> + br label %bb >> + >> +bb: ; preds = %entry >> + br label %return >> + >> +return: ; preds = %bb >> + ret void >> +} >> +;CHECK: L_LSDA_1: >> + >> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >> + >> +declare arm_apcscc void @_Z3barv() >> + >> +declare i8* @llvm.eh.exception() nounwind >> + >> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >> + >> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >> + >> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >> + >> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From baldrick at free.fr Tue Sep 1 10:13:03 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Sep 2009 15:13:03 -0000 Subject: [llvm-commits] [llvm] r80671 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909011513.n81FD3ES027647@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 1 10:13:02 2009 New Revision: 80671 URL: http://llvm.org/viewvc/llvm-project?rev=80671&view=rev Log: Do not manipulate invalid iterators. This fixes the llvm-gcc build when expensive checking is turned on. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80671&r1=80670&r2=80671&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 10:13:02 2009 @@ -143,11 +143,16 @@ // Walk the function body looking for call sites. Sync up the call sites in // CGN with those actually in the function. - + // Get the set of call sites currently in the function. - for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ++I){ + bool isLast = CGN->empty(); + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(), N; !isLast;){ + // Take care not to use singular iterators. + N = I + 1; + isLast = N == E; + // If this call site is null, then the function pass deleted the call - // entirely and the WeakVH nulled it out. + // entirely and the WeakVH nulled it out. if (I->first == 0 || // If we've already seen this call site, then the FunctionPass RAUW'd // one call with another, which resulted in two "uses" in the edge @@ -161,15 +166,15 @@ // Just remove the edge from the set of callees. CGN->removeCallEdge(I); E = CGN->end(); - --I; continue; } - + assert(!CallSites.count(I->first) && "Call site occurs in node multiple times"); CallSites.insert(std::make_pair(I->first, I->second)); + I = N; } - + // Loop over all of the instructions in the function, getting the callsites. for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { From snaroff at apple.com Tue Sep 1 11:20:39 2009 From: snaroff at apple.com (Steve Naroff) Date: Tue, 01 Sep 2009 16:20:39 -0000 Subject: [llvm-commits] [llvm] r80675 - /llvm/tags/cremebrulee/cremebrulee-2/ Message-ID: <200909011620.n81GKd9h005094@zion.cs.uiuc.edu> Author: snaroff Date: Tue Sep 1 11:20:39 2009 New Revision: 80675 URL: http://llvm.org/viewvc/llvm-project?rev=80675&view=rev Log: Tagging cremebrulee-2. Added: llvm/tags/cremebrulee/cremebrulee-2/ - copied from r80674, llvm/trunk/ From grosbach at apple.com Tue Sep 1 11:43:36 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 16:43:36 -0000 Subject: [llvm-commits] [llvm] r80677 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfPrinter.cpp DwarfPrinter.h Message-ID: <200909011643.n81Ghage008166@zion.cs.uiuc.edu> Author: grosbach Date: Tue Sep 1 11:43:35 2009 New Revision: 80677 URL: http://llvm.org/viewvc/llvm-project?rev=80677&view=rev Log: Simply LSDA lable emission to use a direct special-case output instead of EmitLabel() Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80677&r1=80676&r2=80677&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 1 11:43:35 2009 @@ -459,9 +459,8 @@ FirstActions[P.PadIndex] }; - // Try to merge with the previous call-site. SJLJ doesn't do this - if (PreviousIsInvoke && - MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) { + // Try to merge with the previous call-site. + if (PreviousIsInvoke) { CallSiteEntry &Prev = CallSites.back(); if (Site.PadLabel == Prev.PadLabel && Site.Action == Prev.Action) { // Extend the range of the previous entry. @@ -606,7 +605,7 @@ std::string LSDAName = Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), Mangler::Private); - EmitLabel(LSDAName.c_str(), 0, false); + O << LSDAName << ":\n"; } // Emit the header. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80677&r1=80676&r2=80677&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Tue Sep 1 11:43:35 2009 @@ -43,27 +43,21 @@ /// PrintLabelName - Print label name in form used by Dwarf writer. /// -void Dwarf::PrintLabelName(const char *Tag, unsigned Number, - bool ForcePrivate) const { - if (ForcePrivate) - O << MAI->getPrivateGlobalPrefix(); - O << Tag; +void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { + O << MAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; } void Dwarf::PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix, bool ForcePrivate) const { - if (ForcePrivate) - O << MAI->getPrivateGlobalPrefix(); - O << Tag; + const char *Suffix) const { + O << MAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; O << Suffix; } /// EmitLabel - Emit location label for internal use by Dwarf. /// -void Dwarf::EmitLabel(const char *Tag, unsigned Number, - bool ForcePrivate) const { - PrintLabelName(Tag, Number, ForcePrivate); +void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { + PrintLabelName(Tag, Number); O << ":\n"; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80677&r1=80676&r2=80677&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Tue Sep 1 11:43:35 2009 @@ -100,18 +100,16 @@ void PrintLabelName(const DWLabel &Label) const { PrintLabelName(Label.getTag(), Label.getNumber()); } + void PrintLabelName(const char *Tag, unsigned Number) const; void PrintLabelName(const char *Tag, unsigned Number, - bool ForcePrivate = true) const; - void PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix, bool ForcePrivate = true) const; + const char *Suffix) const; /// EmitLabel - Emit location label for internal use by Dwarf. /// void EmitLabel(const DWLabel &Label) const { EmitLabel(Label.getTag(), Label.getNumber()); } - void EmitLabel(const char *Tag, unsigned Number, - bool ForcePrivate = true) const; + void EmitLabel(const char *Tag, unsigned Number) const; /// EmitReference - Emit a reference to a label. /// From evan.cheng at apple.com Tue Sep 1 11:57:58 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 09:57:58 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> Message-ID: <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> On Sep 1, 2009, at 7:58 AM, Jim Grosbach wrote: > O >> >> >> Is this necessary? DwarfException should be using SubprogramCount, >> no? > > I'd turn the question around. Why is DwarfException adding its own > function counter when one is already available? Is there a reason we > need two that are doing the same thing? These counters should stay private within the class. It's implementation detail, not to be exposed publicly. DwarfException and AsmPrinter counter do not have to be the same, right? Evan > > The constant pool entry is part of the ARM AsmPrinter, which has the > getFunctionNumber() directly. It's the most straightforward solution > for the Dwarf writer to use the same interface to output the table > itself. > >> >> >>> /// IncrementFunctionNumber - Increase Function Number. >>> AsmPrinters should >>> /// not normally call this, as the counter is automatically >>> bumped by >>> /// SetupMachineFunction. >>> >>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug >>> 31 20:57:56 2009 >>> @@ -25,9 +25,11 @@ >>> #include "llvm/Target/TargetOptions.h" >>> #include "llvm/Target/TargetRegisterInfo.h" >>> #include "llvm/Support/Dwarf.h" >>> +#include "llvm/Support/Mangler.h" >>> #include "llvm/Support/Timer.h" >>> #include "llvm/Support/raw_ostream.h" >>> #include "llvm/ADT/StringExtras.h" >>> +#include >>> using namespace llvm; >>> >>> static TimerGroup &getDwarfTimerGroup() { >>> @@ -599,9 +601,12 @@ >>> >>> EmitLabel("exception", SubprogramCount); >>> if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { >>> - std::string SjLjName = "_lsda_"; >>> - SjLjName += MF->getFunction()->getName().str(); >>> - EmitLabel(SjLjName.c_str(), 0); >>> + std::stringstream out; >>> + out << Asm->getFunctionNumber(); >> >> SubprogramCount? >> >>> + std::string LSDAName = >>> + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), >>> + Mangler::Private); >>> + EmitLabel(LSDAName.c_str(), 0, false); >> >> Rather than making arbitrary change Dwarf::PrintLabelName and >> Dwarf::EmitLabel to accommodate this, why not just do >> out << LSDAName << 0 << ":\n"; > > Simply consistency that labels get printed via EmitLabel. No strong > preference either way. I'll change it. > >> >> Evan >> >>> } >>> >>> // Emit the header. >>> >>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 >>> 20:57:56 2009 >>> @@ -43,21 +43,27 @@ >>> >>> /// PrintLabelName - Print label name in form used by Dwarf writer. >>> /// >>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>> const { >>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>> + bool ForcePrivate) const { >>> + if (ForcePrivate) >>> + O << MAI->getPrivateGlobalPrefix(); >>> + O << Tag; >>> if (Number) O << Number; >>> } >>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>> - const char *Suffix) const { >>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>> + const char *Suffix, bool ForcePrivate) >>> const { >>> + if (ForcePrivate) >>> + O << MAI->getPrivateGlobalPrefix(); >>> + O << Tag; >>> if (Number) O << Number; >>> O << Suffix; >>> } >>> >>> /// EmitLabel - Emit location label for internal use by Dwarf. >>> /// >>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { >>> - PrintLabelName(Tag, Number); >>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>> + bool ForcePrivate) const { >>> + PrintLabelName(Tag, Number, ForcePrivate); >>> O << ":\n"; >>> } >>> >>> >>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >>> 20:57:56 2009 >>> @@ -100,16 +100,18 @@ >>> void PrintLabelName(const DWLabel &Label) const { >>> PrintLabelName(Label.getTag(), Label.getNumber()); >>> } >>> - void PrintLabelName(const char *Tag, unsigned Number) const; >>> void PrintLabelName(const char *Tag, unsigned Number, >>> - const char *Suffix) const; >>> + bool ForcePrivate = true) const; >>> + void PrintLabelName(const char *Tag, unsigned Number, >>> + const char *Suffix, bool ForcePrivate = >>> true) const; >>> >>> /// EmitLabel - Emit location label for internal use by Dwarf. >>> /// >>> void EmitLabel(const DWLabel &Label) const { >>> EmitLabel(Label.getTag(), Label.getNumber()); >>> } >>> - void EmitLabel(const char *Tag, unsigned Number) const; >>> + void EmitLabel(const char *Tag, unsigned Number, >>> + bool ForcePrivate = true) const; >>> >>> /// EmitReference - Emit a reference to a label. >>> /// >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 >>> 20:57:56 2009 >>> @@ -20,11 +20,12 @@ >>> using namespace llvm; >>> >>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>> unsigned id, >>> + ARMCP::ARMCPKind K, >>> unsigned char PCAdj, >>> const char *Modif, >>> bool AddCA) >>> : MachineConstantPoolValue((const Type*)gv->getType()), >>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>> >>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>> @@ -33,12 +34,12 @@ >>> const char *Modif, >>> bool AddCA) >>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >>> PCAdjust(PCAdj), >>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>> >>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const >>> char *Modif) >>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>> >getContext())), >>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust(0), >>> Modifier(Modif) {} >>> >>> int >>> ARMConstantPoolValue >>> ::getExistingMachineCPValue(MachineConstantPool *CP, >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >>> 20:57:56 2009 >>> @@ -21,12 +21,20 @@ >>> class GlobalValue; >>> class LLVMContext; >>> >>> +namespace ARMCP { >>> + enum ARMCPKind { >>> + CPValue, >>> + CPLSDA >>> + }; >>> +} >>> + >>> /// ARMConstantPoolValue - ARM specific constantpool value. This >>> is used to >>> /// represent PC relative displacement between the address of the >>> load >>> /// instruction and the global value being loaded, i.e. (&GV-(LPIC >>> +8)). >>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>> GlobalValue *GV; // GlobalValue being loaded. >>> const char *S; // ExtSymbol being loaded. >>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>> unsigned LabelId; // Label id of the load. >>> unsigned char PCAdjust; // Extra adjustment if constantpool is pc >>> relative. >>> // 8 for ARM, 4 for Thumb. >>> @@ -35,6 +43,7 @@ >>> >>> public: >>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >>> unsigned char PCAdj = 0, const char *Modifier >>> = NULL, >>> bool AddCurrentAddress = false); >>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, >>> @@ -52,6 +61,7 @@ >>> bool mustAddCurrentAddress() const { return AddCurrentAddress; } >>> unsigned getLabelId() const { return LabelId; } >>> unsigned char getPCAdjustment() const { return PCAdjust; } >>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>> >>> virtual unsigned getRelocationInfo() const { >>> // FIXME: This is conservatively claiming that these entries >>> require a >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>> 20:57:56 2009 >>> @@ -40,6 +40,7 @@ >>> #include "llvm/ADT/VectorExtras.h" >>> #include "llvm/Support/ErrorHandling.h" >>> #include "llvm/Support/MathExtras.h" >>> +#include >>> using namespace llvm; >>> >>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, >>> EVT &LocVT, >>> @@ -969,7 +970,8 @@ >>> // tBX takes a register source operand. >>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>> >hasV5TOps()) { >>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>> - >>> ARMPCLabelIndex, 4); >>> + >>> ARMPCLabelIndex, >>> + >>> ARMCP::CPValue, 4); >>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, >>> getPointerTy(), 4); >>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>> Callee = DAG.getLoad(getPointerTy(), dl, >>> @@ -1166,7 +1168,7 @@ >>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>> ARMConstantPoolValue *CPV = >>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>> - PCAdj, "tlsgd", true); >>> + ARMCP::CPValue, PCAdj, "tlsgd", true); >>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); >>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >>> NULL, 0); >>> @@ -1208,7 +1210,7 @@ >>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>> ARMConstantPoolValue *CPV = >>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>> - PCAdj, "gottpoff", true); >>> + ARMCP::CPValue, PCAdj, "gottpoff", >>> true); >>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>> @@ -1284,7 +1286,7 @@ >>> else { >>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>> >isThumb()?4:8); >>> ARMConstantPoolValue *CPV = >>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>> ARMCP::CPValue, PCAdj); >>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>> } >>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>> @@ -1375,10 +1377,6 @@ >>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>> } >>> case Intrinsic::eh_sjlj_lsda: { >>> - // blah. horrible, horrible hack with the forced magic name. >>> - // really need to clean this up. It belongs in the target- >>> independent >>> - // layer somehow that doesn't require the coupling with the asm >>> - // printer. >>> MachineFunction &MF = DAG.getMachineFunction(); >>> EVT PtrVT = getPointerTy(); >>> DebugLoc dl = Op.getDebugLoc(); >>> @@ -1386,13 +1384,9 @@ >>> SDValue CPAddr; >>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>> - // Save off the LSDA name for the AsmPrinter to use when it's >>> time >>> - // to emit the table >>> - std::string LSDAName = "L_lsda_"; >>> - LSDAName += MF.getFunction()->getName(); >>> ARMConstantPoolValue *CPV = >>> - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str(), >>> - ARMPCLabelIndex, PCAdj); >>> + new ARMConstantPoolValue(MF.getFunction(), ARMPCLabelIndex, >>> + ARMCP::CPLSDA, PCAdj); >>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>> SDValue Result = >>> >>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>> (original) >>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug >>> 31 20:57:56 2009 >>> @@ -44,6 +44,7 @@ >>> #include "llvm/Support/MathExtras.h" >>> #include "llvm/Support/FormattedStream.h" >>> #include >>> +#include >>> using namespace llvm; >>> >>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>> @@ -159,8 +160,13 @@ >>> ARMConstantPoolValue *ACPV = >>> static_cast(MCPV); >>> GlobalValue *GV = ACPV->getGV(); >>> std::string Name; >>> - >>> - if (GV) { >>> + >>> + if (ACPV->isLSDA()) { >>> + std::stringstream out; >>> + out << getFunctionNumber(); >>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>> out.str(), >>> + Mangler::Private); >>> + } else if (GV) { >>> bool isIndirect = Subtarget->isTargetDarwin() && >>> Subtarget->GVIsIndirectSymbol(GV, >>> TM.getRelocationModel() == >>> Reloc::Static); >>> @@ -175,9 +181,7 @@ >>> else >>> GVNonLazyPtrs[SymName] = Name; >>> } >>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>> - Name = ACPV->getSymbol(); >>> - else >>> + } else >>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>> O << Name; >>> >>> >>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug 31 >>> 20:57:56 2009 >>> @@ -0,0 +1,103 @@ >>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>> + >>> +%struct.A = type { i32* } >>> + >>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>> +entry: >>> + %save_filt.1 = alloca i32 ; >>> [#uses=2] >>> + %save_eptr.0 = alloca i8* ; >>> [#uses=2] >>> + %a = alloca %struct.A ; <%struct.A*> >>> [#uses=3] >>> + %eh_exception = alloca i8* ; >>> [#uses=5] >>> + %eh_selector = alloca i32 ; >>> [#uses=3] >>> + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] >>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>> + invoke arm_apcscc void @_Z3barv() >>> + to label %invcont unwind label %lpad >>> + >>> +invcont: ; preds = %entry >>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>> + br label %return >>> + >>> +bb: ; preds = %ppad >>> + %eh_select = load i32* %eh_selector ; [#uses=1] >>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>> + %eh_value = load i8** %eh_exception ; [#uses=1] >>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>> + %0 = load i8** %save_eptr.0, align 4 ; [#uses=1] >>> + store i8* %0, i8** %eh_exception, align 4 >>> + %1 = load i32* %save_filt.1, align 4 ; [#uses=1] >>> + store i32 %1, i32* %eh_selector, align 4 >>> + br label %Unwind >>> + >>> +return: ; preds = >>> %invcont >>> + ret void >>> + >>> +lpad: ; preds = %entry >>> + %eh_ptr = call i8* @llvm.eh.exception() ; [#uses=1] >>> + store i8* %eh_ptr, i8** %eh_exception >>> + %eh_ptr1 = load i8** %eh_exception ; [#uses=1] >>> + %eh_select2 = call i32 (i8*, i8*, ...)* >>> @llvm.eh.selector.i32(i8* %eh_ptr1, i8* bitcast (i32 (...)* >>> @__gxx_personality_sj0 to i8*), i32 0) ; [#uses=1] >>> + store i32 %eh_select2, i32* %eh_selector >>> + br label %ppad >>> + >>> +ppad: ; preds = %lpad >>> + br label %bb >>> + >>> +Unwind: ; preds = %bb >>> + %eh_ptr3 = load i8** %eh_exception ; [#uses=1] >>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>> + unreachable >>> +} >>> + >>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* %this) { >>> +entry: >>> + %this_addr = alloca %struct.A* ; <%struct.A**> >>> [#uses=2] >>> + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] >>> + store %struct.A* %this, %struct.A** %this_addr >>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; [#uses=1] >>> + %1 = bitcast i8* %0 to i32* ; >>> [#uses=1] >>> + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>> [#uses=1] >>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>> [#uses=1] >>> + store i32* %1, i32** %3, align 4 >>> + br label %return >>> + >>> +return: ; preds = %entry >>> + ret void >>> +} >>> + >>> +declare arm_apcscc i8* @_Znwm(i32) >>> + >>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) >>> nounwind { >>> +entry: >>> + %this_addr = alloca %struct.A* ; <%struct.A**> >>> [#uses=2] >>> + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] >>> + store %struct.A* %this, %struct.A** %this_addr >>> + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>> [#uses=1] >>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>> [#uses=1] >>> + %2 = load i32** %1, align 4 ; >>> [#uses=1] >>> + %3 = bitcast i32* %2 to i8* ; [#uses=1] >>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>> + br label %bb >>> + >>> +bb: ; preds = %entry >>> + br label %return >>> + >>> +return: ; preds = %bb >>> + ret void >>> +} >>> +;CHECK: L_LSDA_1: >>> + >>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>> + >>> +declare arm_apcscc void @_Z3barv() >>> + >>> +declare i8* @llvm.eh.exception() nounwind >>> + >>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>> + >>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>> + >>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>> + >>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > From kremenek at apple.com Tue Sep 1 12:01:02 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Sep 2009 17:01:02 -0000 Subject: [llvm-commits] [llvm] r80680 - in /llvm/trunk/lib: Support/CMakeLists.txt Transforms/Instrumentation/CMakeLists.txt Message-ID: <200909011701.n81H12TP010635@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 1 12:01:02 2009 New Revision: 80680 URL: http://llvm.org/viewvc/llvm-project?rev=80680&view=rev Log: Update CMake files. Modified: llvm/trunk/lib/Support/CMakeLists.txt llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt Modified: llvm/trunk/lib/Support/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=80680&r1=80679&r2=80680&view=diff ============================================================================== --- llvm/trunk/lib/Support/CMakeLists.txt (original) +++ llvm/trunk/lib/Support/CMakeLists.txt Tue Sep 1 12:01:02 2009 @@ -18,6 +18,7 @@ MemoryBuffer.cpp PluginLoader.cpp PrettyStackTrace.cpp + Regex.cpp SlowOperationInformer.cpp SmallPtrSet.cpp SourceMgr.cpp @@ -32,7 +33,6 @@ Twine.cpp raw_os_ostream.cpp raw_ostream.cpp - Regex.cpp regcomp.c regerror.c regexec.c Modified: llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt?rev=80680&r1=80679&r2=80680&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt Tue Sep 1 12:01:02 2009 @@ -1,6 +1,7 @@ add_llvm_library(LLVMInstrumentation BlockProfiling.cpp EdgeProfiling.cpp + MaximumSpanningTree.cpp ProfilingUtils.cpp RSProfiling.cpp ) From sabre at nondot.org Tue Sep 1 12:09:56 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 17:09:56 -0000 Subject: [llvm-commits] [llvm] r80682 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Message-ID: <200909011709.n81H9uAU012121@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 12:09:55 2009 New Revision: 80682 URL: http://llvm.org/viewvc/llvm-project?rev=80682&view=rev Log: random code cleanups, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=80682&r1=80681&r2=80682&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Tue Sep 1 12:09:55 2009 @@ -37,7 +37,7 @@ /// true for all i8 values obviously, but is also true for i32 0, i32 -1, /// i16 0xF0F0, double 0.0 etc. If the value can't be handled with a repeated /// byte store (e.g. i16 0x1234), return null. -static Value *isBytewiseValue(Value *V, LLVMContext& Context) { +static Value *isBytewiseValue(Value *V, LLVMContext &Context) { // All byte-wide stores are splatable, even of arbitrary variables. if (V->getType() == Type::getInt8Ty(Context)) return V; @@ -315,9 +315,9 @@ } // Helper fuctions - bool processStore(StoreInst *SI, BasicBlock::iterator& BBI); - bool processMemCpy(MemCpyInst* M); - bool performCallSlotOptzn(MemCpyInst* cpy, CallInst* C); + bool processStore(StoreInst *SI, BasicBlock::iterator &BBI); + bool processMemCpy(MemCpyInst *M); + bool performCallSlotOptzn(MemCpyInst *cpy, CallInst *C); bool iterateOnFunction(Function &F); }; @@ -336,7 +336,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, BasicBlock::iterator& BBI) { +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 @@ -495,26 +495,26 @@ // Deliberately get the source and destination with bitcasts stripped away, // because we'll need to do type comparisons based on the underlying type. - Value* cpyDest = cpy->getDest(); - Value* cpySrc = cpy->getSource(); + Value *cpyDest = cpy->getDest(); + Value *cpySrc = cpy->getSource(); CallSite CS = CallSite::get(C); // We need to be able to reason about the size of the memcpy, so we require // that it be a constant. - ConstantInt* cpyLength = dyn_cast(cpy->getLength()); + ConstantInt *cpyLength = dyn_cast(cpy->getLength()); if (!cpyLength) return false; // Require that src be an alloca. This simplifies the reasoning considerably. - AllocaInst* srcAlloca = dyn_cast(cpySrc); + AllocaInst *srcAlloca = dyn_cast(cpySrc); if (!srcAlloca) return false; // Check that all of src is copied to dest. - TargetData* TD = getAnalysisIfAvailable(); + TargetData *TD = getAnalysisIfAvailable(); if (!TD) return false; - ConstantInt* srcArraySize = dyn_cast(srcAlloca->getArraySize()); + ConstantInt *srcArraySize = dyn_cast(srcAlloca->getArraySize()); if (!srcArraySize) return false; @@ -527,9 +527,9 @@ // Check that accessing the first srcSize bytes of dest will not cause a // trap. Otherwise the transform is invalid since it might cause a trap // to occur earlier than it otherwise would. - if (AllocaInst* A = dyn_cast(cpyDest)) { + if (AllocaInst *A = dyn_cast(cpyDest)) { // The destination is an alloca. Check it is larger than srcSize. - ConstantInt* destArraySize = dyn_cast(A->getArraySize()); + ConstantInt *destArraySize = dyn_cast(A->getArraySize()); if (!destArraySize) return false; @@ -538,13 +538,13 @@ if (destSize < srcSize) return false; - } else if (Argument* A = dyn_cast(cpyDest)) { + } else if (Argument *A = dyn_cast(cpyDest)) { // If the destination is an sret parameter then only accesses that are // outside of the returned struct type can trap. if (!A->hasStructRetAttr()) return false; - const Type* StructTy = cast(A->getType())->getElementType(); + const Type *StructTy = cast(A->getType())->getElementType(); uint64_t destSize = TD->getTypeAllocSize(StructTy); if (destSize < srcSize) @@ -560,14 +560,14 @@ SmallVector srcUseList(srcAlloca->use_begin(), srcAlloca->use_end()); while (!srcUseList.empty()) { - User* UI = srcUseList.back(); + User *UI = srcUseList.back(); srcUseList.pop_back(); if (isa(UI)) { for (User::use_iterator I = UI->use_begin(), E = UI->use_end(); I != E; ++I) srcUseList.push_back(*I); - } else if (GetElementPtrInst* G = dyn_cast(UI)) { + } else if (GetElementPtrInst *G = dyn_cast(UI)) { if (G->hasAllZeroIndices()) for (User::use_iterator I = UI->use_begin(), E = UI->use_end(); I != E; ++I) @@ -581,8 +581,8 @@ // Since we're changing the parameter to the callsite, we need to make sure // that what would be the new parameter dominates the callsite. - DominatorTree& DT = getAnalysis(); - if (Instruction* cpyDestInst = dyn_cast(cpyDest)) + DominatorTree &DT = getAnalysis(); + if (Instruction *cpyDestInst = dyn_cast(cpyDest)) if (!DT.dominates(cpyDestInst, C)) return false; @@ -590,7 +590,7 @@ // unexpected manner, for example via a global, which we deduce from // the use analysis, we also need to know that it does not sneakily // access dest. We rely on AA to figure this out for us. - AliasAnalysis& AA = getAnalysis(); + AliasAnalysis &AA = getAnalysis(); if (AA.getModRefInfo(C, cpy->getRawDest(), srcSize) != AliasAnalysis::NoModRef) return false; @@ -603,11 +603,11 @@ cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(), cpyDest->getName(), C); changedArgument = true; - if (CS.getArgument(i)->getType() != cpyDest->getType()) - CS.setArgument(i, CastInst::CreatePointerCast(cpyDest, - CS.getArgument(i)->getType(), cpyDest->getName(), C)); - else + if (CS.getArgument(i)->getType() == cpyDest->getType()) CS.setArgument(i, cpyDest); + else + CS.setArgument(i, CastInst::CreatePointerCast(cpyDest, + CS.getArgument(i)->getType(), cpyDest->getName(), C)); } if (!changedArgument) @@ -615,7 +615,7 @@ // Drop any cached information about the call, because we may have changed // its dependence information by changing its parameter. - MemoryDependenceAnalysis& MD = getAnalysis(); + MemoryDependenceAnalysis &MD = getAnalysis(); MD.removeInstruction(C); // Remove the memcpy @@ -630,22 +630,22 @@ /// 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) { - MemoryDependenceAnalysis& MD = getAnalysis(); +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 + // a) memcpy-memcpy xform which exposes redundance for DSE. + // b) call-memcpy xform for return slot optimization. MemDepResult dep = MD.getDependency(M); if (!dep.isClobber()) return false; if (!isa(dep.getInst())) { - if (CallInst* C = dyn_cast(dep.getInst())) + if (CallInst *C = dyn_cast(dep.getInst())) return performCallSlotOptzn(M, C); return false; } - MemCpyInst* MDep = cast(dep.getInst()); + MemCpyInst *MDep = cast(dep.getInst()); // We can only transforms memcpy's where the dest of one is the source of the // other @@ -654,8 +654,8 @@ // Second, the length of the memcpy's must be the same, or the preceeding one // must be larger than the following one. - ConstantInt* C1 = dyn_cast(MDep->getLength()); - ConstantInt* C2 = dyn_cast(M->getLength()); + ConstantInt *C1 = dyn_cast(MDep->getLength()); + ConstantInt *C2 = dyn_cast(M->getLength()); if (!C1 || !C2) return false; @@ -667,7 +667,7 @@ // Finally, we have to make sure that the dest of the second does not // alias the source of the first - AliasAnalysis& AA = getAnalysis(); + AliasAnalysis &AA = getAnalysis(); if (AA.alias(M->getRawDest(), CpySize, MDep->getRawSource(), DepSize) != AliasAnalysis::NoAlias) return false; @@ -681,7 +681,7 @@ // If all checks passed, then we can transform these memcpy's const Type *Tys[1]; Tys[0] = M->getLength()->getType(); - Function* MemCpyFun = Intrinsic::getDeclaration( + Function *MemCpyFun = Intrinsic::getDeclaration( M->getParent()->getParent()->getParent(), M->getIntrinsicID(), Tys, 1); @@ -689,7 +689,7 @@ M->getRawDest(), MDep->getRawSource(), M->getLength(), M->getAlignmentCst() }; - CallInst* C = CallInst::Create(MemCpyFun, Args, Args+4, "", M); + CallInst *C = CallInst::Create(MemCpyFun, Args, Args+4, "", M); // If C and M don't interfere, then this is a valid transformation. If they @@ -708,41 +708,40 @@ return false; } -// MemCpyOpt::runOnFunction - This is the main transformation entry point for a -// function. -// -bool MemCpyOpt::runOnFunction(Function& F) { - - bool changed = false; - bool shouldContinue = true; - - while (shouldContinue) { - shouldContinue = iterateOnFunction(F); - changed |= shouldContinue; - } - - return changed; -} - - -// MemCpyOpt::iterateOnFunction - Executes one iteration of GVN +// MemCpyOpt::iterateOnFunction - Executes one iteration of GVN. bool MemCpyOpt::iterateOnFunction(Function &F) { - bool changed_function = false; + bool MadeChange = false; - // Walk all instruction in the function + // 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;) { - // Avoid invalidating the iterator - Instruction* I = BI++; + // Avoid invalidating the iterator. + Instruction *I = BI++; if (StoreInst *SI = dyn_cast(I)) - changed_function |= processStore(SI, BI); - else if (MemCpyInst* M = dyn_cast(I)) { - changed_function |= processMemCpy(M); - } + MadeChange |= processStore(SI, BI); + else if (MemCpyInst *M = dyn_cast(I)) + MadeChange |= processMemCpy(M); } } - return changed_function; + return MadeChange; } + +// MemCpyOpt::runOnFunction - This is the main transformation entry point for a +// function. +// +bool MemCpyOpt::runOnFunction(Function &F) { + bool MadeChange = false; + while (1) { + if (!iterateOnFunction(F)) + break; + MadeChange = true; + } + + return MadeChange; +} + + + From snaroff at apple.com Tue Sep 1 12:15:29 2009 From: snaroff at apple.com (Steve Naroff) Date: Tue, 01 Sep 2009 17:15:29 -0000 Subject: [llvm-commits] [llvm] r80685 - /llvm/tags/cremebrulee/cremebrulee-2/ Message-ID: <200909011715.n81HFTZH012954@zion.cs.uiuc.edu> Author: snaroff Date: Tue Sep 1 12:15:29 2009 New Revision: 80685 URL: http://llvm.org/viewvc/llvm-project?rev=80685&view=rev Log: Removing cremebrulee-2. Removed: llvm/tags/cremebrulee/cremebrulee-2/ From baldrick at free.fr Tue Sep 1 12:15:48 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Sep 2009 19:15:48 +0200 Subject: [llvm-commits] [llvm] r80677 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfPrinter.cpp DwarfPrinter.h In-Reply-To: <200909011643.n81Ghage008166@zion.cs.uiuc.edu> References: <200909011643.n81Ghage008166@zion.cs.uiuc.edu> Message-ID: <4A9D56C4.2090804@free.fr> Hi Jim, > Simply LSDA lable emission to use a direct special-case output instead of > EmitLabel() ... > - // Try to merge with the previous call-site. SJLJ doesn't do this > - if (PreviousIsInvoke && > - MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) { > + // Try to merge with the previous call-site. > + if (PreviousIsInvoke) { did you mean to commit this bit? Ciao, Duncan. From snaroff at apple.com Tue Sep 1 12:16:32 2009 From: snaroff at apple.com (Steve Naroff) Date: Tue, 01 Sep 2009 17:16:32 -0000 Subject: [llvm-commits] [llvm] r80687 - /llvm/tags/cremebrulee/cremebrulee-3/ Message-ID: <200909011716.n81HGWBP013120@zion.cs.uiuc.edu> Author: snaroff Date: Tue Sep 1 12:16:32 2009 New Revision: 80687 URL: http://llvm.org/viewvc/llvm-project?rev=80687&view=rev Log: Tagging cremebrulee-3. Added: llvm/tags/cremebrulee/cremebrulee-3/ - copied from r80686, llvm/trunk/ From grosbach at apple.com Tue Sep 1 12:19:13 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 17:19:13 -0000 Subject: [llvm-commits] [llvm] r80689 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200909011719.n81HJDnZ013542@zion.cs.uiuc.edu> Author: grosbach Date: Tue Sep 1 12:19:13 2009 New Revision: 80689 URL: http://llvm.org/viewvc/llvm-project?rev=80689&view=rev Log: revert inadvertant change from previous commit Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80689&r1=80688&r2=80689&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 1 12:19:13 2009 @@ -459,8 +459,9 @@ FirstActions[P.PadIndex] }; - // Try to merge with the previous call-site. - if (PreviousIsInvoke) { + // Try to merge with the previous call-site. SJLJ doesn't do this + if (PreviousIsInvoke && + MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) { CallSiteEntry &Prev = CallSites.back(); if (Site.PadLabel == Prev.PadLabel && Site.Action == Prev.Action) { // Extend the range of the previous entry. From grosbach at apple.com Tue Sep 1 12:19:14 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 10:19:14 -0700 Subject: [llvm-commits] [llvm] r80677 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfPrinter.cpp DwarfPrinter.h In-Reply-To: <4A9D56C4.2090804@free.fr> References: <200909011643.n81Ghage008166@zion.cs.uiuc.edu> <4A9D56C4.2090804@free.fr> Message-ID: <5C9F89EB-6274-48C7-9F8A-0919004CAA65@apple.com> On Sep 1, 2009, at 10:15 AM, Duncan Sands wrote: > Hi Jim, > >> Simply LSDA lable emission to use a direct special-case output >> instead of >> EmitLabel() > ... >> - // Try to merge with the previous call-site. SJLJ doesn't >> do this >> - if (PreviousIsInvoke && >> - MAI->getExceptionHandlingType() == >> ExceptionHandling::Dwarf) { >> + // Try to merge with the previous call-site. >> + if (PreviousIsInvoke) { > > did you mean to commit this bit? > Yikes. No. Thanks for the catch! > Ciao, > > Duncan. From grosbach at apple.com Tue Sep 1 12:23:13 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 10:23:13 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> Message-ID: On Sep 1, 2009, at 9:57 AM, Evan Cheng wrote: > > On Sep 1, 2009, at 7:58 AM, Jim Grosbach wrote: > >> O >>> >>> >>> Is this necessary? DwarfException should be using SubprogramCount, >>> no? >> >> I'd turn the question around. Why is DwarfException adding its own >> function counter when one is already available? Is there a reason >> we need two that are doing the same thing? > > These counters should stay private within the class. It's > implementation detail, not to be exposed publicly. DwarfException > and AsmPrinter counter do not have to be the same, right? I could use FunctionNumber in the ARM AsmPrinter, and then use SubprogramCount in the DwarfException printer. That makes me nervous, though, as there's no guarantee, beyond details of the implementation, that those two values will always stay in sync. It would introduce an additional level of coupling between the two that I'd prefer to avoid. Note that the SubprogramCount is not visible to the containing AsmPrinter, either. In the ARM AsmPrinter, the DwarfException is opaque. Exposing that value to the rest of the AsmPrinter would be more significant changes than exposing the FunctionNumber. I want to make sure that both bits of code pulled the information from the same place. Exposing the FunctionNumber seems the way to do that. > Evan > >> >> The constant pool entry is part of the ARM AsmPrinter, which has >> the getFunctionNumber() directly. It's the most straightforward >> solution for the Dwarf writer to use the same interface to output >> the table itself. >> >>> >>> >>>> /// IncrementFunctionNumber - Increase Function Number. >>>> AsmPrinters should >>>> /// not normally call this, as the counter is automatically >>>> bumped by >>>> /// SetupMachineFunction. >>>> >>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) >>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug >>>> 31 20:57:56 2009 >>>> @@ -25,9 +25,11 @@ >>>> #include "llvm/Target/TargetOptions.h" >>>> #include "llvm/Target/TargetRegisterInfo.h" >>>> #include "llvm/Support/Dwarf.h" >>>> +#include "llvm/Support/Mangler.h" >>>> #include "llvm/Support/Timer.h" >>>> #include "llvm/Support/raw_ostream.h" >>>> #include "llvm/ADT/StringExtras.h" >>>> +#include >>>> using namespace llvm; >>>> >>>> static TimerGroup &getDwarfTimerGroup() { >>>> @@ -599,9 +601,12 @@ >>>> >>>> EmitLabel("exception", SubprogramCount); >>>> if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { >>>> - std::string SjLjName = "_lsda_"; >>>> - SjLjName += MF->getFunction()->getName().str(); >>>> - EmitLabel(SjLjName.c_str(), 0); >>>> + std::stringstream out; >>>> + out << Asm->getFunctionNumber(); >>> >>> SubprogramCount? >>> >>>> + std::string LSDAName = >>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), >>>> + Mangler::Private); >>>> + EmitLabel(LSDAName.c_str(), 0, false); >>> >>> Rather than making arbitrary change Dwarf::PrintLabelName and >>> Dwarf::EmitLabel to accommodate this, why not just do >>> out << LSDAName << 0 << ":\n"; >> >> Simply consistency that labels get printed via EmitLabel. No strong >> preference either way. I'll change it. >> >>> >>> Evan >>> >>>> } >>>> >>>> // Emit the header. >>>> >>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) >>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 >>>> 20:57:56 2009 >>>> @@ -43,21 +43,27 @@ >>>> >>>> /// PrintLabelName - Print label name in form used by Dwarf writer. >>>> /// >>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>> const { >>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>> + bool ForcePrivate) const { >>>> + if (ForcePrivate) >>>> + O << MAI->getPrivateGlobalPrefix(); >>>> + O << Tag; >>>> if (Number) O << Number; >>>> } >>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>> - const char *Suffix) const { >>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>> + const char *Suffix, bool >>>> ForcePrivate) const { >>>> + if (ForcePrivate) >>>> + O << MAI->getPrivateGlobalPrefix(); >>>> + O << Tag; >>>> if (Number) O << Number; >>>> O << Suffix; >>>> } >>>> >>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>> /// >>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { >>>> - PrintLabelName(Tag, Number); >>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>> + bool ForcePrivate) const { >>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>> O << ":\n"; >>>> } >>>> >>>> >>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >>>> 20:57:56 2009 >>>> @@ -100,16 +100,18 @@ >>>> void PrintLabelName(const DWLabel &Label) const { >>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>> } >>>> - void PrintLabelName(const char *Tag, unsigned Number) const; >>>> void PrintLabelName(const char *Tag, unsigned Number, >>>> - const char *Suffix) const; >>>> + bool ForcePrivate = true) const; >>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>> + const char *Suffix, bool ForcePrivate = >>>> true) const; >>>> >>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>> /// >>>> void EmitLabel(const DWLabel &Label) const { >>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>> } >>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>> + void EmitLabel(const char *Tag, unsigned Number, >>>> + bool ForcePrivate = true) const; >>>> >>>> /// EmitReference - Emit a reference to a label. >>>> /// >>>> >>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) >>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 >>>> 20:57:56 2009 >>>> @@ -20,11 +20,12 @@ >>>> using namespace llvm; >>>> >>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>> unsigned id, >>>> + ARMCP::ARMCPKind K, >>>> unsigned char PCAdj, >>>> const char *Modif, >>>> bool AddCA) >>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>> >>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>> @@ -33,12 +34,12 @@ >>>> const char *Modif, >>>> bool AddCA) >>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >>>> PCAdjust(PCAdj), >>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>> >>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const >>>> char *Modif) >>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>> >getContext())), >>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust >>>> (0), >>>> Modifier(Modif) {} >>>> >>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>> (MachineConstantPool *CP, >>>> >>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >>>> 20:57:56 2009 >>>> @@ -21,12 +21,20 @@ >>>> class GlobalValue; >>>> class LLVMContext; >>>> >>>> +namespace ARMCP { >>>> + enum ARMCPKind { >>>> + CPValue, >>>> + CPLSDA >>>> + }; >>>> +} >>>> + >>>> /// ARMConstantPoolValue - ARM specific constantpool value. This >>>> is used to >>>> /// represent PC relative displacement between the address of the >>>> load >>>> /// instruction and the global value being loaded, i.e. (&GV-(LPIC >>>> +8)). >>>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>>> GlobalValue *GV; // GlobalValue being loaded. >>>> const char *S; // ExtSymbol being loaded. >>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>> unsigned LabelId; // Label id of the load. >>>> unsigned char PCAdjust; // Extra adjustment if constantpool is >>>> pc relative. >>>> // 8 for ARM, 4 for Thumb. >>>> @@ -35,6 +43,7 @@ >>>> >>>> public: >>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >>>> unsigned char PCAdj = 0, const char *Modifier >>>> = NULL, >>>> bool AddCurrentAddress = false); >>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, >>>> @@ -52,6 +61,7 @@ >>>> bool mustAddCurrentAddress() const { return AddCurrentAddress; } >>>> unsigned getLabelId() const { return LabelId; } >>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>> >>>> virtual unsigned getRelocationInfo() const { >>>> // FIXME: This is conservatively claiming that these entries >>>> require a >>>> >>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>> 20:57:56 2009 >>>> @@ -40,6 +40,7 @@ >>>> #include "llvm/ADT/VectorExtras.h" >>>> #include "llvm/Support/ErrorHandling.h" >>>> #include "llvm/Support/MathExtras.h" >>>> +#include >>>> using namespace llvm; >>>> >>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, >>>> EVT &LocVT, >>>> @@ -969,7 +970,8 @@ >>>> // tBX takes a register source operand. >>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>> >hasV5TOps()) { >>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>> - >>>> ARMPCLabelIndex, 4); >>>> + >>>> ARMPCLabelIndex, >>>> + >>>> ARMCP::CPValue, 4); >>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>> (), 4); >>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>> @@ -1166,7 +1168,7 @@ >>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>> ARMConstantPoolValue *CPV = >>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>> - PCAdj, "tlsgd", true); >>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>> true); >>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); >>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >>>> NULL, 0); >>>> @@ -1208,7 +1210,7 @@ >>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>> ARMConstantPoolValue *CPV = >>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>> - PCAdj, "gottpoff", true); >>>> + ARMCP::CPValue, PCAdj, >>>> "gottpoff", true); >>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>> @@ -1284,7 +1286,7 @@ >>>> else { >>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>> >isThumb()?4:8); >>>> ARMConstantPoolValue *CPV = >>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>> ARMCP::CPValue, PCAdj); >>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>> } >>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>> @@ -1375,10 +1377,6 @@ >>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>> } >>>> case Intrinsic::eh_sjlj_lsda: { >>>> - // blah. horrible, horrible hack with the forced magic name. >>>> - // really need to clean this up. It belongs in the target- >>>> independent >>>> - // layer somehow that doesn't require the coupling with the >>>> asm >>>> - // printer. >>>> MachineFunction &MF = DAG.getMachineFunction(); >>>> EVT PtrVT = getPointerTy(); >>>> DebugLoc dl = Op.getDebugLoc(); >>>> @@ -1386,13 +1384,9 @@ >>>> SDValue CPAddr; >>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>> - // Save off the LSDA name for the AsmPrinter to use when >>>> it's time >>>> - // to emit the table >>>> - std::string LSDAName = "L_lsda_"; >>>> - LSDAName += MF.getFunction()->getName(); >>>> ARMConstantPoolValue *CPV = >>>> - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str >>>> (), >>>> - ARMPCLabelIndex, PCAdj); >>>> + new ARMConstantPoolValue(MF.getFunction(), ARMPCLabelIndex, >>>> + ARMCP::CPLSDA, PCAdj); >>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>> SDValue Result = >>>> >>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>> (original) >>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon >>>> Aug 31 20:57:56 2009 >>>> @@ -44,6 +44,7 @@ >>>> #include "llvm/Support/MathExtras.h" >>>> #include "llvm/Support/FormattedStream.h" >>>> #include >>>> +#include >>>> using namespace llvm; >>>> >>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>> @@ -159,8 +160,13 @@ >>>> ARMConstantPoolValue *ACPV = static_cast >>>> (MCPV); >>>> GlobalValue *GV = ACPV->getGV(); >>>> std::string Name; >>>> - >>>> - if (GV) { >>>> + >>>> + if (ACPV->isLSDA()) { >>>> + std::stringstream out; >>>> + out << getFunctionNumber(); >>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>> out.str(), >>>> + Mangler::Private); >>>> + } else if (GV) { >>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>> Subtarget->GVIsIndirectSymbol(GV, >>>> TM.getRelocationModel() == >>>> Reloc::Static); >>>> @@ -175,9 +181,7 @@ >>>> else >>>> GVNonLazyPtrs[SymName] = Name; >>>> } >>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>> - Name = ACPV->getSymbol(); >>>> - else >>>> + } else >>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>> O << Name; >>>> >>>> >>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug >>>> 31 20:57:56 2009 >>>> @@ -0,0 +1,103 @@ >>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>> + >>>> +%struct.A = type { i32* } >>>> + >>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>> +entry: >>>> + %save_filt.1 = alloca i32 ; >>>> [#uses=2] >>>> + %save_eptr.0 = alloca i8* ; >>>> [#uses=2] >>>> + %a = alloca %struct.A ; <%struct.A*> >>>> [#uses=3] >>>> + %eh_exception = alloca i8* ; >>>> [#uses=5] >>>> + %eh_selector = alloca i32 ; >>>> [#uses=3] >>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>> [#uses=0] >>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>> + invoke arm_apcscc void @_Z3barv() >>>> + to label %invcont unwind label %lpad >>>> + >>>> +invcont: ; preds = %entry >>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>> + br label %return >>>> + >>>> +bb: ; preds = %ppad >>>> + %eh_select = load i32* %eh_selector ; >>>> [#uses=1] >>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>> + %eh_value = load i8** %eh_exception ; >>>> [#uses=1] >>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>> [#uses=1] >>>> + store i8* %0, i8** %eh_exception, align 4 >>>> + %1 = load i32* %save_filt.1, align 4 ; >>>> [#uses=1] >>>> + store i32 %1, i32* %eh_selector, align 4 >>>> + br label %Unwind >>>> + >>>> +return: ; preds = >>>> %invcont >>>> + ret void >>>> + >>>> +lpad: ; preds = %entry >>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>> [#uses=1] >>>> + store i8* %eh_ptr, i8** %eh_exception >>>> + %eh_ptr1 = load i8** %eh_exception ; >>>> [#uses=1] >>>> + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32 >>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to >>>> i8*), i32 0) ; [#uses=1] >>>> + store i32 %eh_select2, i32* %eh_selector >>>> + br label %ppad >>>> + >>>> +ppad: ; preds = %lpad >>>> + br label %bb >>>> + >>>> +Unwind: ; preds = %bb >>>> + %eh_ptr3 = load i8** %eh_exception ; >>>> [#uses=1] >>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>> + unreachable >>>> +} >>>> + >>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* %this) { >>>> +entry: >>>> + %this_addr = alloca %struct.A* ; < >>>> %struct.A**> [#uses=2] >>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>> [#uses=0] >>>> + store %struct.A* %this, %struct.A** %this_addr >>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>> [#uses=1] >>>> + %1 = bitcast i8* %0 to i32* ; >>>> [#uses=1] >>>> + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>>> [#uses=1] >>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>> [#uses=1] >>>> + store i32* %1, i32** %3, align 4 >>>> + br label %return >>>> + >>>> +return: ; preds = %entry >>>> + ret void >>>> +} >>>> + >>>> +declare arm_apcscc i8* @_Znwm(i32) >>>> + >>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) >>>> nounwind { >>>> +entry: >>>> + %this_addr = alloca %struct.A* ; < >>>> %struct.A**> [#uses=2] >>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>> [#uses=0] >>>> + store %struct.A* %this, %struct.A** %this_addr >>>> + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>>> [#uses=1] >>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>> [#uses=1] >>>> + %2 = load i32** %1, align 4 ; >>>> [#uses=1] >>>> + %3 = bitcast i32* %2 to i8* ; >>>> [#uses=1] >>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>> + br label %bb >>>> + >>>> +bb: ; preds = %entry >>>> + br label %return >>>> + >>>> +return: ; preds = %bb >>>> + ret void >>>> +} >>>> +;CHECK: L_LSDA_1: >>>> + >>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>> + >>>> +declare arm_apcscc void @_Z3barv() >>>> + >>>> +declare i8* @llvm.eh.exception() nounwind >>>> + >>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>> + >>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>> + >>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>> + >>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> > From bruno.cardoso at gmail.com Tue Sep 1 12:27:58 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 01 Sep 2009 17:27:58 -0000 Subject: [llvm-commits] [llvm] r80691 - in /llvm/trunk/lib/Target/Mips: AsmPrinter/MipsAsmPrinter.cpp MipsISelDAGToDAG.cpp MipsISelLowering.cpp MipsInstrInfo.h Message-ID: <200909011727.n81HRwXx014808@zion.cs.uiuc.edu> Author: bruno Date: Tue Sep 1 12:27:58 2009 New Revision: 80691 URL: http://llvm.org/viewvc/llvm-project?rev=80691&view=rev Log: Reapply 80278 Add MO flags to simplify the printing of relocations. Remove the support for printing large code model relocs (which aren't supported anyway). Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsInstrInfo.h Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=80691&r1=80690&r2=80691&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Sep 1 12:27:58 2009 @@ -306,44 +306,27 @@ const MachineOperand &MO = MI->getOperand(opNum); const TargetRegisterInfo &RI = *TM.getRegisterInfo(); bool closeP = false; - bool isPIC = (TM.getRelocationModel() == Reloc::PIC_); - bool isCodeLarge = (TM.getCodeModel() == CodeModel::Large); - // %hi and %lo used on mips gas to load global addresses on - // static code. %got is used to load global addresses when - // using PIC_. %call16 is used to load direct call targets - // on PIC_ and small code size. %call_lo and %call_hi load - // direct call targets on PIC_ and large code size. - if (MI->getOpcode() == Mips::LUi && !MO.isReg() && !MO.isImm()) { - if ((isPIC) && (isCodeLarge)) - O << "%call_hi("; - else - O << "%hi("; + if (MO.getTargetFlags()) closeP = true; - } else if ((MI->getOpcode() == Mips::ADDiu) && !MO.isReg() && !MO.isImm()) { - const MachineOperand &firstMO = MI->getOperand(opNum-1); - if (firstMO.getReg() == Mips::GP) - O << "%gp_rel("; + + switch(MO.getTargetFlags()) { + case MipsII::MO_GPREL: O << "%gp_rel("; break; + case MipsII::MO_GOT_CALL: O << "%call16("; break; + case MipsII::MO_GOT: + if (MI->getOpcode() == Mips::LW) + O << "%got("; else O << "%lo("; - closeP = true; - } else if ((isPIC) && (MI->getOpcode() == Mips::LW) && - (!MO.isReg()) && (!MO.isImm())) { - const MachineOperand &firstMO = MI->getOperand(opNum-1); - const MachineOperand &lastMO = MI->getOperand(opNum+1); - if ((firstMO.isReg()) && (lastMO.isReg())) { - if ((firstMO.getReg() == Mips::T9) && (lastMO.getReg() == Mips::GP) - && (!isCodeLarge)) - O << "%call16("; - else if ((firstMO.getReg() != Mips::T9) && (lastMO.getReg() == Mips::GP)) - O << "%got("; - else if ((firstMO.getReg() == Mips::T9) && (lastMO.getReg() != Mips::GP) - && (isCodeLarge)) - O << "%call_lo("; - closeP = true; - } + break; + case MipsII::MO_ABS_HILO: + if (MI->getOpcode() == Mips::LUi) + O << "%hi("; + else + O << "%lo("; + break; } - + switch (MO.getType()) { case MachineOperand::MO_Register: Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=80691&r1=80690&r2=80691&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Tue Sep 1 12:27:58 2009 @@ -322,7 +322,6 @@ /// be loaded with 3 instructions. case MipsISD::JmpLink: { if (TM.getRelocationModel() == Reloc::PIC_) { - //bool isCodeLarge = (TM.getCodeModel() == CodeModel::Large); SDValue Chain = Node->getOperand(0); SDValue Callee = Node->getOperand(1); SDValue T9Reg = CurDAG->getRegister(Mips::T9, MVT::i32); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=80691&r1=80690&r2=80691&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Sep 1 12:27:58 2009 @@ -488,7 +488,6 @@ // FIXME there isn't actually debug info here DebugLoc dl = Op.getDebugLoc(); GlobalValue *GV = cast(Op)->getGlobal(); - SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32); if (getTargetMachine().getRelocationModel() != Reloc::PIC_) { SDVTList VTs = DAG.getVTList(MVT::i32); @@ -497,16 +496,22 @@ // %gp_rel relocation if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) { + SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, 0, + MipsII::MO_GPREL); SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl, VTs, &GA, 1); SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(MVT::i32); return DAG.getNode(ISD::ADD, dl, MVT::i32, GOT, GPRelNode); } // %hi/%lo relocation + SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, 0, + MipsII::MO_ABS_HILO); SDValue HiPart = DAG.getNode(MipsISD::Hi, dl, VTs, &GA, 1); SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, GA); return DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo); - } else { // Abicall relocations, TODO: make this cleaner. + } else { + SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, 0, + MipsII::MO_GOT); SDValue ResNode = DAG.getLoad(MVT::i32, dl, DAG.getEntryNode(), GA, NULL, 0); // On functions and global targets not internal linked only @@ -535,15 +540,17 @@ SDValue HiPart; // FIXME there isn't actually debug info here DebugLoc dl = Op.getDebugLoc(); + bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_; + unsigned char OpFlag = IsPIC ? MipsII::MO_GOT : MipsII::MO_ABS_HILO; EVT PtrVT = Op.getValueType(); JumpTableSDNode *JT = cast(Op); - SDValue JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT); - if (getTargetMachine().getRelocationModel() != Reloc::PIC_) { - SDVTList VTs = DAG.getVTList(MVT::i32); + SDValue JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OpFlag); + + if (IsPIC) { SDValue Ops[] = { JTI }; - HiPart = DAG.getNode(MipsISD::Hi, dl, VTs, Ops, 1); + HiPart = DAG.getNode(MipsISD::Hi, dl, DAG.getVTList(MVT::i32), Ops, 1); } else // Emit Load from Global Pointer HiPart = DAG.getLoad(MVT::i32, dl, DAG.getEntryNode(), JTI, NULL, 0); @@ -559,7 +566,8 @@ SDValue ResNode; ConstantPoolSDNode *N = cast(Op); Constant *C = N->getConstVal(); - SDValue CP = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment()); + SDValue CP = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(), + MipsII::MO_ABS_HILO); // FIXME there isn't actually debug info here DebugLoc dl = Op.getDebugLoc(); @@ -684,6 +692,7 @@ MachineFunction &MF = DAG.getMachineFunction(); MachineFrameInfo *MFI = MF.getFrameInfo(); + bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_; // Analyze operands of the call, assigning locations to each operand. SmallVector ArgLocs; @@ -792,10 +801,13 @@ // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol // node so that legalize doesn't hack it. + unsigned char OpFlag = IsPIC ? MipsII::MO_GOT_CALL : MipsII::MO_NO_FLAG; if (GlobalAddressSDNode *G = dyn_cast(Callee)) - Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); + Callee = DAG.getTargetGlobalAddress(G->getGlobal(), + getPointerTy(), 0, OpFlag); else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) - Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); + Callee = DAG.getTargetExternalSymbol(S->getSymbol(), + getPointerTy(), OpFlag); // MipsJmpLink = #chain, #target_address, #opt_in_flags... // = Chain, Callee, Reg#1, Reg#2, ... @@ -826,7 +838,7 @@ // Create a stack location to hold GP when PIC is used. This stack // location is used on function prologue to save GP and also after all // emited CALL's to restore GP. - if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { + if (IsPIC) { // Function can have an arbitrary number of calls, so // hold the LastArgStackLoc with the biggest offset. int FI; Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.h?rev=80691&r1=80690&r2=80691&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.h Tue Sep 1 12:27:58 2009 @@ -130,6 +130,38 @@ } } +/// MipsII - This namespace holds all of the target specific flags that +/// instruction info tracks. +/// +namespace MipsII { + /// Target Operand Flag enum. + enum TOF { + //===------------------------------------------------------------------===// + // Mips Specific MachineOperand flags. + + MO_NO_FLAG = 0, + + /// MO_GOT - Represents the offset into the global offset table at which + /// the address the relocation entry symbol resides during execution. + MO_GOT = 1, + + /// MO_GOT_CALL - Represents the offset into the global offset table at + /// which the address of a call site relocation entry symbol resides + /// during execution. This is different from the above since this flag + /// can only be present in call instructions. + MO_GOT_CALL = 2, + + /// MO_GPREL - Represents the offset from the current gp value to be used + /// for the relocatable object file being produced. + MO_GPREL = 3, + + /// MO_ABS_HILO - Represents the hi or low part of an absolute symbol + /// address. + MO_ABS_HILO = 4 + + }; +} + class MipsInstrInfo : public TargetInstrInfoImpl { MipsTargetMachine &TM; const MipsRegisterInfo RI; From bob.wilson at apple.com Tue Sep 1 12:50:36 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 1 Sep 2009 10:50:36 -0700 Subject: [llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll In-Reply-To: References: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> Message-ID: <30323D1C-7F02-4F6A-9ABD-9B5D5210DC8F@apple.com> On Sep 1, 2009, at 12:37 AM, Evan Cheng wrote: > Hi Bob, > > I am taking issues with this patch. The two-address pass is starting > to get too complicated (my fault). No arguments about the complexity. I made a few minor simplifications yesterday, but I'm sure there are more substantial improvements that could be made. > I've been thinking about restructuring the code. This patch is > making the code even harder to read. I tried pretty hard to simplify it. This was the best I could come up with. Maybe you understand more of the context and can suggest ways to simplify it further. > It also potentially calls removeVirtualRegisterKilled() multiple > times for each source register. I don't think that can happen. It calls removeVirtualRegisterKilled when: KillMO is set and FirstKeptMO is false, i.e., the register is killed in this instruction, and none of the uses are tied to other destination registers. Under those circumstances, all the uses of the register will be replaced. Subsequent iterations cannot call removeVirtualRegisterKilled for the same register because all references to that register will be gone. > Each of the call ends up scanning the entire operand list. That > seems inefficient to me. See comments below. > Also, what happens to the code the calls LV- > >removeVirtualRegisterDead(regB, mi)? Sorry, I should have removed that in a separate patch. We're modifying register uses here. Uses have kill markers. Defs have death markers. If we don't change the defs, why would we need to call removeVirtualRegisterDead? Am I missing something here? I searched back through the svn history to see if this was added to fix a problem but it seems to go all the way back to the origins of this code. I concluded that it is not needed, but I should have submitted this change separately. > > if (KillMO) { > if (!FirstKeptMO) { > // All uses of regB are being replaced; move the kill to prevMI. > if (LV && LV->removeVirtualRegisterKilled(regB, mi)) > > When KillMO is not null, it shouldn't be necessary to call > removeVirtualRegisterKilled, right? KillMO is the machine operand that currently has a kill marker on it. If all of the register uses are being replaced, we want to move the kill to the preceding copy instruction. This is no different than the previous code. > > Also notice we are scanning the operands twice: > > for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { > ... > } > > // Replace uses of regB with regA. > for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { > ... > } > > Please scan the operands just once. If it sees any other source > operand of the same virtual register tied to another def, then it > should not update the other operands of the same virtual register. > The next iteration will deal with them. The first scan collects information. The second modifies the operands. I first tried to do it in one scan but I could not come up with a reasonable way to make that work. Note that removeVirtualRegisterKilled needs to be called before you update the registers, and since I didn't want to leave the instruction with incorrect kill information in between iterations, I needed to first check whether all the uses of the register should be replaced. > As for the kill marker, it should move it to the previous > instruction the first time it is processed. All you have to ensure > is the later iteration does not insert any instruction between the > kill marker and the mi being processed. That should be pretty > straight forward. Just add a iterator which is the instruction > insertion location. The first time you insert a copy, it should then > be moved to the copy instruction, etc. e.g. > > a, b = op c, c // insert pos > > => > > a = c // insert pos > a, b = op a, c > > => > > b = c > a = c > a, b = op a, b That seems unsafe to me. You're leaving the instruction in an inconsistent state. After the first copy is inserted, you've moved the kill marker but there is still a use of c after the point where it is killed. There is a lot of code inside this loop that is looking at register uses and kill markers. On the next iteration, it seems like things may get confused. It may be safe but I'm not able to easily convince myself of that, and even if it is safe now, it seems likely to be fragile in the future. This seems like the root of your objections. I am trying to keep the kill information up to date in between iterations. Given that goal, I don't see a better way to write the code. If you are certain that it is OK to leave the kill information in an incorrect state, I can change it as you suggest. I would rather be safe here. > > Since you are working on this code, could be please clean it up a > bit. Can you factor this if statement: > if (mi->getOperand(ti).isDead() && > isSafeToDelete(mi, regB, TII, Kills)) { > > to a separate function? Like this (in the attached patch)? Checking mi->getOperand(ti).isDead() is completely redundant with isSafeToDelete() so I assume it is only there to guard against calling a relatively expensive function in the common case. If we're going to call a function anyway, maybe it would be better to just remove the isDead() check altogether. I'd leave it as-is but I don't mind changing it if you tell me your preference. -------------- next part -------------- A non-text attachment was scrubbed... Name: safeToDelete.patch Type: application/octet-stream Size: 1370 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090901/a52560cf/attachment.obj From sabre at nondot.org Tue Sep 1 12:56:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 17:56:32 -0000 Subject: [llvm-commits] [llvm] r80693 - in /llvm/trunk: lib/Transforms/Scalar/MemCpyOptimizer.cpp test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll test/Transforms/MemCpyOpt/memmove.ll Message-ID: <200909011756.n81HuWw7018501@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 12:56:32 2009 New Revision: 80693 URL: http://llvm.org/viewvc/llvm-project?rev=80693&view=rev Log: enhance memcpy opt to turn memmoves into memcpy when the src/dest don't alias. Remove an old and poorly reduced testcase that fails with this transform for reasons unrelated to the original test. Added: llvm/trunk/test/Transforms/MemCpyOpt/memmove.ll Removed: llvm/trunk/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=80693&r1=80692&r2=80693&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Tue Sep 1 12:56:32 2009 @@ -317,6 +317,7 @@ // Helper fuctions bool processStore(StoreInst *SI, BasicBlock::iterator &BBI); bool processMemCpy(MemCpyInst *M); + bool processMemMove(MemMoveInst *M); bool performCallSlotOptzn(MemCpyInst *cpy, CallInst *C); bool iterateOnFunction(Function &F); }; @@ -431,9 +432,8 @@ BasicBlock::iterator InsertPt = BI; if (MemSetF == 0) { - const Type *Tys[] = {Type::getInt64Ty(SI->getContext())}; - MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset, - Tys, 1); + const Type *Ty = Type::getInt64Ty(SI->getContext()); + MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset, &Ty, 1); } // Get the starting pointer of the block. @@ -679,11 +679,10 @@ return false; // If all checks passed, then we can transform these memcpy's - const Type *Tys[1]; - Tys[0] = M->getLength()->getType(); + const Type *Ty = M->getLength()->getType(); Function *MemCpyFun = Intrinsic::getDeclaration( M->getParent()->getParent()->getParent(), - M->getIntrinsicID(), Tys, 1); + M->getIntrinsicID(), &Ty, 1); Value *Args[4] = { M->getRawDest(), MDep->getRawSource(), M->getLength(), M->getAlignmentCst() @@ -708,6 +707,36 @@ return false; } +/// processMemMove - Transforms memmove calls to memcpy calls when the src/dst +/// are guaranteed not to alias. +bool MemCpyOpt::processMemMove(MemMoveInst *M) { + AliasAnalysis &AA = getAnalysis(); + + // If the memmove is a constant size, use it for the alias query, this allows + // us to optimize things like: memmove(P, P+64, 64); + uint64_t MemMoveSize = ~0ULL; + if (ConstantInt *Len = dyn_cast(M->getLength())) + MemMoveSize = Len->getZExtValue(); + + // See if the pointers alias. + if (AA.alias(M->getRawDest(), MemMoveSize, M->getRawSource(), MemMoveSize) != + AliasAnalysis::NoAlias) + return false; + + DEBUG(errs() << "MemCpyOpt: Optimizing memmove -> memcpy: " << *M << "\n"); + + // If not, then we know we can transform this. + Module *Mod = M->getParent()->getParent()->getParent(); + const Type *Ty = M->getLength()->getType(); + M->setOperand(0, Intrinsic::getDeclaration(Mod, Intrinsic::memcpy, &Ty, 1)); + + // MemDep may have over conservative information about this instruction, just + // conservatively flush it from the cache. + getAnalysis().removeInstruction(M); + return true; +} + + // MemCpyOpt::iterateOnFunction - Executes one iteration of GVN. bool MemCpyOpt::iterateOnFunction(Function &F) { bool MadeChange = false; @@ -723,6 +752,12 @@ MadeChange |= processStore(SI, BI); else if (MemCpyInst *M = dyn_cast(I)) MadeChange |= processMemCpy(M); + else if (MemMoveInst *M = dyn_cast(I)) { + if (processMemMove(M)) { + --BI; // Reprocess the new memcpy. + MadeChange = true; + } + } } } Removed: llvm/trunk/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll?rev=80692&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll (original) +++ llvm/trunk/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll (removed) @@ -1,107 +0,0 @@ -; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memmove.*arg1.*} -; PR2401 - -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:32:32" -target triple = "i686-pc-linux-gnu" - %struct.Info = type <{ i32, i32, i8*, i8*, i8*, [32 x i8*], i32, [32 x i32], i32, i32, i32, [32 x i32] }> - %struct.S98 = type <{ [31 x double] }> - %struct._IO_FILE = type <{ i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }> - %struct._IO_marker = type <{ %struct._IO_marker*, %struct._IO_FILE*, i32 }> - %struct.anon = type <{ }> - %union.anon = type { } - at info = common global %struct.Info zeroinitializer, align 4 ; <%struct.Info*> [#uses=13] - at fails = common global i32 0, align 4 ; [#uses=37] - at s98 = common global %struct.S98 zeroinitializer, align 4 ; <%struct.S98*> [#uses=2] - at a98 = common global [5 x %struct.S98] zeroinitializer, align 4 ; <[5 x %struct.S98]*> [#uses=5] - at stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1] - -declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind - -define void @test98() nounwind { -entry: - %arg = alloca %struct.S98, align 8 ; <%struct.S98*> [#uses=2] - %tmp13 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] - %tmp14 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] - %tmp15 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] - %tmp17 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] - %tmp21 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - %tmp23 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - %tmp25 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - %tmp27 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - %tmp29 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - %tmp31 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - %tmp33 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] - call void @llvm.memset.i32( i8* bitcast (%struct.S98* @s98 to i8*), i8 0, i32 248, i32 4 ) - call void @llvm.memset.i32( i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8 0, i32 1240, i32 4 ) - call void @llvm.memset.i32( i8* bitcast (%struct.Info* @info to i8*), i8 0, i32 420, i32 4 ) - store i8* bitcast (%struct.S98* @s98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 2) - store i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 3) - store i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 4) - store i32 248, i32* getelementptr (%struct.Info* @info, i32 0, i32 6) - store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 8) - store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 9) - store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 10) - %tmp = load i32* getelementptr (%struct.Info* @info, i32 0, i32 8) ; [#uses=1] - %sub = add i32 %tmp, -1 ; [#uses=1] - %and = and i32 %sub, ptrtoint (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i32) ; [#uses=1] - %tobool = icmp eq i32 %and, 0 ; [#uses=1] - br i1 %tobool, label %ifend, label %ifthen - -ifthen: ; preds = %entry - %tmp3 = load i32* @fails ; [#uses=1] - %inc = add i32 %tmp3, 1 ; [#uses=1] - store i32 %inc, i32* @fails - br label %ifend - -ifend: ; preds = %ifthen, %entry - store i8* bitcast (double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 5, i32 0) - store i32 8, i32* getelementptr (%struct.Info* @info, i32 0, i32 7, i32 0) - store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 11, i32 0) - store double 0xC1075E4620000000, double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) - store double 0x410CD219E0000000, double* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2, i32 0, i32 18) - store i32 1, i32* getelementptr (%struct.Info* @info, i32 0, i32 0) - store i32 0, i32* getelementptr (%struct.Info* @info, i32 0, i32 1) - %tmp16 = bitcast %struct.S98* %tmp15 to i8* ; [#uses=1] - call void @llvm.memmove.i32( i8* %tmp16, i8* bitcast (%struct.S98* @s98 to i8*), i32 248, i32 4 ) - %tmp18 = bitcast %struct.S98* %tmp17 to i8* ; [#uses=1] - call void @llvm.memmove.i32( i8* %tmp18, i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2) to i8*), i32 248, i32 4 ) - call void @check98( %struct.S98* sret %tmp14, %struct.S98* byval %tmp15, %struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 1), %struct.S98* byval %tmp17 ) - %tmp19 = bitcast %struct.S98* %tmp13 to i8* ; [#uses=1] - %tmp20 = bitcast %struct.S98* %tmp14 to i8* ; [#uses=1] - call void @llvm.memmove.i32( i8* %tmp19, i8* %tmp20, i32 248, i32 8 ) - %tmp1 = bitcast %struct.S98* %arg to i8* ; [#uses=1] - %tmp2 = bitcast %struct.S98* %tmp13 to i8* ; [#uses=1] - call void @llvm.memcpy.i64( i8* %tmp1, i8* %tmp2, i64 248, i32 8 ) - %arrayidx.i = getelementptr %struct.S98* %arg, i32 0, i32 0, i32 18 ; [#uses=1] - %tmp1.i = load double* %arrayidx.i, align 8 ; [#uses=1] - %tmp2.i = load double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) ; [#uses=1] - %cmp.i = fcmp une double %tmp1.i, %tmp2.i ; [#uses=1] - br i1 %cmp.i, label %ifthen.i, label %checkx98.exit - -ifthen.i: ; preds = %ifend - %tmp3.i = load i32* @fails ; [#uses=1] - %inc.i = add i32 %tmp3.i, 1 ; [#uses=1] - store i32 %inc.i, i32* @fails - br label %checkx98.exit - -checkx98.exit: ; preds = %ifthen.i, %ifend - ret void -} - -declare void @check98(%struct.S98* sret %agg.result, %struct.S98* byval %arg0, %struct.S98* %arg1, %struct.S98* byval %arg2) nounwind - -declare void @llvm.va_start(i8*) nounwind - -declare void @llvm.va_end(i8*) nounwind - -declare i32 @main() noreturn - -declare i32 @fflush(%struct._IO_FILE*) - -declare void @abort() noreturn nounwind - -declare void @exit(i32) noreturn nounwind - -declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind - -declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind Added: llvm/trunk/test/Transforms/MemCpyOpt/memmove.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/memmove.ll?rev=80693&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MemCpyOpt/memmove.ll (added) +++ llvm/trunk/test/Transforms/MemCpyOpt/memmove.ll Tue Sep 1 12:56:32 2009 @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | FileCheck %s +; These memmoves should get optimized to memcpys. + +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.0" + +declare void @llvm.memmove.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind + +define i8* @test1(i8* nocapture %src) nounwind { +entry: +; CHECK: @test1 +; CHECK: call void @llvm.memcpy + + %call3 = malloc [13 x i8] ; <[13 x i8]*> [#uses=1] + %call3.sub = getelementptr inbounds [13 x i8]* %call3, i64 0, i64 0 ; [#uses=2] + tail call void @llvm.memmove.i64(i8* %call3.sub, i8* %src, i64 13, i32 1) + ret i8* %call3.sub +} + +define void @test2(i8* %P) nounwind { +entry: +; CHECK: @test2 +; CHECK: call void @llvm.memcpy + %add.ptr = getelementptr i8* %P, i64 16 ; [#uses=1] + tail call void @llvm.memmove.i64(i8* %P, i8* %add.ptr, i64 16, i32 1) + ret void +} + +; This cannot be optimize because the src/dst really do overlap. +define void @test3(i8* %P) nounwind { +entry: +; CHECK: @test3 +; CHECK: call void @llvm.memmove + %add.ptr = getelementptr i8* %P, i64 16 ; [#uses=1] + tail call void @llvm.memmove.i64(i8* %P, i8* %add.ptr, i64 17, i32 1) + ret void +} From ctice at apple.com Tue Sep 1 13:07:48 2009 From: ctice at apple.com (Caroline Tice) Date: Tue, 01 Sep 2009 18:07:48 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80694 - in /llvm-gcc-4.2/trunk/gcc: tree.c tree.h Message-ID: <200909011807.n81I7nlN019995@zion.cs.uiuc.edu> Author: ctice Date: Tue Sep 1 13:07:48 2009 New Revision: 80694 URL: http://llvm.org/viewvc/llvm-project?rev=80694&view=rev Log: Change "APPLE LOCAL" to "LLVM LOCAL" in comments around the function type_is_block_byref_struct. Modified: llvm-gcc-4.2/trunk/gcc/tree.c llvm-gcc-4.2/trunk/gcc/tree.h Modified: llvm-gcc-4.2/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=80694&r1=80693&r2=80694&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree.c Tue Sep 1 13:07:48 2009 @@ -7975,7 +7975,7 @@ } /* APPLE LOCAL end weak_import on property 6676828 */ -/* APPLE LOCAL begin radar 6419781 */ +/* LLVM LOCAL begin radar 6419781 */ bool type_is_block_byref_struct (tree type) { @@ -8004,6 +8004,6 @@ else return false; } -/* APPLE LOCAL begin end 6419781 */ +/* LLVM LOCAL begin end 6419781 */ #include "gt-tree.h" Modified: llvm-gcc-4.2/trunk/gcc/tree.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=80694&r1=80693&r2=80694&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.h (original) +++ llvm-gcc-4.2/trunk/gcc/tree.h Tue Sep 1 13:07:48 2009 @@ -4892,8 +4892,8 @@ /* APPLE LOCAL end radar 6300081 */ -/* APPLE LOCAL begin radar 6419781 */ +/* LLVM LOCAL begin radar 6419781 */ extern bool type_is_block_byref_struct (tree); -/* APPLE LOCAL end radar 6419781 */ +/* LLVM LOCAL end radar 6419781 */ #endif /* GCC_TREE_H */ From sabre at nondot.org Tue Sep 1 13:13:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 18:13:40 -0000 Subject: [llvm-commits] [llvm] r80695 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909011813.n81IDetT020790@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 13:13:40 2009 New Revision: 80695 URL: http://llvm.org/viewvc/llvm-project?rev=80695&view=rev Log: simpler solution to iterator invalidation "problem" found by expensive checking. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80695&r1=80694&r2=80695&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 13:13:40 2009 @@ -143,16 +143,11 @@ // Walk the function body looking for call sites. Sync up the call sites in // CGN with those actually in the function. - + // Get the set of call sites currently in the function. - bool isLast = CGN->empty(); - for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(), N; !isLast;){ - // Take care not to use singular iterators. - N = I + 1; - isLast = N == E; - + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ){ // If this call site is null, then the function pass deleted the call - // entirely and the WeakVH nulled it out. + // entirely and the WeakVH nulled it out. if (I->first == 0 || // If we've already seen this call site, then the FunctionPass RAUW'd // one call with another, which resulted in two "uses" in the edge @@ -168,13 +163,13 @@ E = CGN->end(); continue; } - + assert(!CallSites.count(I->first) && "Call site occurs in node multiple times"); CallSites.insert(std::make_pair(I->first, I->second)); - I = N; + ++I; } - + // Loop over all of the instructions in the function, getting the callsites. for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { From scallanan at apple.com Tue Sep 1 13:14:18 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 01 Sep 2009 18:14:18 -0000 Subject: [llvm-commits] [llvm] r80696 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <200909011814.n81IEJeQ020874@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 1 13:14:18 2009 New Revision: 80696 URL: http://llvm.org/viewvc/llvm-project?rev=80696&view=rev Log: Added TEST %rAX, $imm instructions to the Intel tables. These are required for the X86 disassembler. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=80696&r1=80695&r2=80696&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 1 13:14:18 2009 @@ -984,6 +984,8 @@ // Integer comparison let Defs = [EFLAGS] in { +def TEST64i32 : RI<0xa9, RawFrm, (outs), (ins i32imm:$src), + "test{q}\t{$src, %rax|%rax, $src}", []>; let isCommutable = 1 in def TEST64rr : RI<0x85, MRMDestReg, (outs), (ins GR64:$src1, GR64:$src2), "test{q}\t{$src2, $src1|$src1, $src2}", Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=80696&r1=80695&r2=80696&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 1 13:14:18 2009 @@ -2753,6 +2753,13 @@ (implicit EFLAGS)]>; } +def TEST8i8 : Ii8<0xA8, RawFrm, (outs), (ins i8imm:$src), + "test{b}\t{$src, %al|%al, $src}", []>; +def TEST16i16 : Ii16<0xA9, RawFrm, (outs), (ins i16imm:$src), + "test{w}\t{$src, %ax|%ax, $src}", []>, OpSize; +def TEST32i32 : Ii32<0xA9, RawFrm, (outs), (ins i32imm:$src), + "test{l}\t{$src, %eax|%eax, $src}", []>; + def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2), "test{b}\t{$src2, $src1|$src1, $src2}", [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0), From clattner at apple.com Tue Sep 1 13:16:54 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Sep 2009 11:16:54 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> Message-ID: <95EDA303-F28F-47C1-A4CB-65112C987B31@apple.com> On Aug 31, 2009, at 6:57 PM, Jim Grosbach wrote: > Author: grosbach > Date: Mon Aug 31 20:57:56 2009 > New Revision: 80649 > > URL: http://llvm.org/viewvc/llvm-project?rev=80649&view=rev > Log: > Clean up LSDA name generation and use for SJLJ exception handling. > This > makes an eggregious hack somewhat more palatable. Bringing the LSDA > forward > and making it a GV available for reference would be even better, but > is > beyond the scope of what I'm looking to solve at this point. > > Objective C++ code could generate function names that broke the > previous > scheme. This fixes that. In addition to Evan's comments, please do not use , use raw_ostream.h instead. -Chris From grosbach at apple.com Tue Sep 1 13:19:22 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 11:19:22 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <95EDA303-F28F-47C1-A4CB-65112C987B31@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <95EDA303-F28F-47C1-A4CB-65112C987B31@apple.com> Message-ID: <91C10903-213D-4F32-839D-B8D0CC91521E@apple.com> On Sep 1, 2009, at 11:16 AM, Chris Lattner wrote: > > On Aug 31, 2009, at 6:57 PM, Jim Grosbach wrote: > >> Author: grosbach >> Date: Mon Aug 31 20:57:56 2009 >> New Revision: 80649 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80649&view=rev >> Log: >> Clean up LSDA name generation and use for SJLJ exception handling. >> This >> makes an eggregious hack somewhat more palatable. Bringing the LSDA >> forward >> and making it a GV available for reference would be even better, >> but is >> beyond the scope of what I'm looking to solve at this point. >> >> Objective C++ code could generate function names that broke the >> previous >> scheme. This fixes that. > > In addition to Evan's comments, please do not use , use > raw_ostream.h instead. > Sure thing. From gohman at apple.com Tue Sep 1 13:29:01 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 01 Sep 2009 18:29:01 -0000 Subject: [llvm-commits] [llvm] r80697 - /llvm/trunk/include/llvm/Pass.h Message-ID: <200909011829.n81IT1A0022917@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 1 13:29:01 2009 New Revision: 80697 URL: http://llvm.org/viewvc/llvm-project?rev=80697&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/include/llvm/Pass.h Modified: llvm/trunk/include/llvm/Pass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=80697&r1=80696&r2=80697&view=diff ============================================================================== --- llvm/trunk/include/llvm/Pass.h (original) +++ llvm/trunk/include/llvm/Pass.h Tue Sep 1 13:29:01 2009 @@ -191,7 +191,7 @@ AnalysisType &getAnalysis() const; // Defined in PassAnalysisSupport.h template - AnalysisType &getAnalysis(Function &F); // Defined in PassanalysisSupport.h + AnalysisType &getAnalysis(Function &F); // Defined in PassAnalysisSupport.h template AnalysisType &getAnalysisID(const PassInfo *PI) const; From sabre at nondot.org Tue Sep 1 13:32:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 18:32:04 -0000 Subject: [llvm-commits] [llvm] r80698 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909011832.n81IW48a023408@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 13:32:03 2009 New Revision: 80698 URL: http://llvm.org/viewvc/llvm-project?rev=80698&view=rev Log: doxygenate RefreshCallGraph, add a new 'verification mode', and run it after CGSCC passes make change to ensure they are updating the callgraph correctly (when assertions are enabled). Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80698&r1=80697&r2=80698&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 13:32:03 2009 @@ -78,7 +78,8 @@ private: bool RunPassOnSCC(Pass *P, std::vector &CurSCC, CallGraph &CG, bool &CallGraphUpToDate); - void RefreshCallGraph(std::vector &CurSCC, CallGraph &CG); + void RefreshCallGraph(std::vector &CurSCC, CallGraph &CG, + bool IsCheckingMode); }; } // end anonymous namespace. @@ -90,13 +91,21 @@ bool Changed = false; if (CallGraphSCCPass *CGSP = dynamic_cast(P)) { if (!CallGraphUpToDate) { - RefreshCallGraph(CurSCC, CG); + RefreshCallGraph(CurSCC, CG, false); CallGraphUpToDate = true; } StartPassTimer(P); Changed = CGSP->runOnSCC(CurSCC); StopPassTimer(P); + + // After the CGSCCPass is done, when assertions are enabled, use + // RefreshCallGraph to verify that the callgraph was correctly updated. +#ifndef NDEBUG + if (Changed) + RefreshCallGraph(CurSCC, CG, true); +#endif + return Changed; } @@ -123,8 +132,14 @@ return Changed; } + +/// RefreshCallGraph - Scan the functions in the specified CFG and resync the +/// callgraph with the call sites found in it. This is used after +/// FunctionPasses have potentially munged the callgraph, and can be used after +/// CallGraphSCC passes to verify that they correctly updated the callgraph. +/// void CGPassManager::RefreshCallGraph(std::vector &CurSCC, - CallGraph &CG) { + CallGraph &CG, bool CheckingMode) { DenseMap CallSites; DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() @@ -158,6 +173,9 @@ // pass RAUW'd a call with another value. This can happen when // constant folding happens of well known functions etc. CallSite::get(I->first).getInstruction() == 0) { + assert(!CheckingMode && + "CallGraphSCCPass did not update the CallGraph correctly!"); + // Just remove the edge from the set of callees. CGN->removeCallEdge(I); E = CGN->end(); @@ -190,6 +208,18 @@ if (ExistingNode->getFunction() == CS.getCalledFunction()) continue; + // If we are in checking mode, we are not allowed to actually mutate + // the callgraph. If this is a case where we can infer that the + // callgraph is less precise than it could be (e.g. an indirect call + // site could be turned direct), don't reject it in checking mode, and + // don't tweak it to be more precise. + if (CheckingMode && CS.getCalledFunction() && + ExistingNode->getFunction() == 0) + continue; + + assert(!CheckingMode && + "CallGraphSCCPass did not update the CallGraph correctly!"); + // If not, we either went from a direct call to indirect, indirect to // direct, or direct to different direct. CallGraphNode *CalleeNode; @@ -203,6 +233,9 @@ continue; } + assert(!CheckingMode && + "CallGraphSCCPass did not update the CallGraph correctly!"); + // If the call site didn't exist in the CGN yet, add it. We assume that // newly introduced call sites won't be indirect. This could be fixed // in the future. @@ -289,7 +322,7 @@ // If the callgraph was left out of date (because the last pass run was a // functionpass), refresh it before we move on to the next SCC. if (!CallGraphUpToDate) - RefreshCallGraph(CurSCC, CG); + RefreshCallGraph(CurSCC, CG, false); } Changed |= doFinalization(CG); return Changed; From david_goodwin at apple.com Tue Sep 1 13:32:09 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 01 Sep 2009 18:32:09 -0000 Subject: [llvm-commits] [llvm] r80699 - in /llvm/trunk/lib/Target/ARM: ARMInstrInfo.td ARMInstrThumb2.td Message-ID: <200909011832.n81IW9sH023432@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Sep 1 13:32:09 2009 New Revision: 80699 URL: http://llvm.org/viewvc/llvm-project?rev=80699&view=rev Log: RRX reads CPSR. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=80699&r1=80698&r2=80699&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Tue Sep 1 13:32:09 2009 @@ -906,6 +906,7 @@ def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm, IIC_iMOVi, "mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>, UnaryDP; +let Uses = [CPSR] in def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, IIC_iMOVsi, "mov", " $dst, $src, rrx", [(set GPR:$dst, (ARMrrx GPR:$src))]>, UnaryDP; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=80699&r1=80698&r2=80699&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Sep 1 13:32:09 2009 @@ -756,9 +756,11 @@ defm t2ASR : T2I_sh_ir<"asr", BinOpFrag<(sra node:$LHS, node:$RHS)>>; defm t2ROR : T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node:$RHS)>>; +let Uses = [CPSR] in { def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, - "rrx", ".w $dst, $src", + "rrx", " $dst, $src", [(set GPR:$dst, (ARMrrx GPR:$src))]>; +} let Defs = [CPSR] in { def t2MOVsrl_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, From david_goodwin at apple.com Tue Sep 1 13:34:03 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 01 Sep 2009 18:34:03 -0000 Subject: [llvm-commits] [llvm] r80702 - /llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Message-ID: <200909011834.n81IY3mQ023784@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Sep 1 13:34:03 2009 New Revision: 80702 URL: http://llvm.org/viewvc/llvm-project?rev=80702&view=rev Log: Add hidden flags to allow binary search of post-RA scheduling errors. Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=80702&r1=80701&r2=80702&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original) +++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Tue Sep 1 13:34:03 2009 @@ -56,6 +56,16 @@ cl::desc("Enable exact hazard avoidance"), cl::init(false), cl::Hidden); +// If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod +static cl::opt +DebugDiv("postra-sched-debugdiv", + cl::desc("Debug control MBBs that are scheduled"), + cl::init(0), cl::Hidden); +static cl::opt +DebugMod("postra-sched-debugmod", + cl::desc("Debug control MBBs that are scheduled"), + cl::init(0), cl::Hidden); + namespace { class VISIBILITY_HIDDEN PostRAScheduler : public MachineFunctionPass { public: @@ -212,6 +222,17 @@ // Loop over all of the basic blocks for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end(); MBB != MBBe; ++MBB) { +#ifndef NDEBUG + // If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod + if (DebugDiv > 0) { + static int bbcnt = 0; + if (bbcnt++ % DebugDiv != DebugMod) + continue; + errs() << "*** DEBUG scheduling " << Fn.getFunction()->getNameStr() << + ":MBB ID#" << MBB->getNumber() << " ***\n"; + } +#endif + // Initialize register live-range state for scheduling in this block. Scheduler.GenerateLivenessForKills = false; Scheduler.StartBlock(MBB); From rnk at mit.edu Tue Sep 1 13:38:26 2009 From: rnk at mit.edu (Reid Kleckner) Date: Tue, 1 Sep 2009 14:38:26 -0400 Subject: [llvm-commits] Add option to emit ELF symbol files for debugging the LLVM JIT with GDB In-Reply-To: <001636284afcf4fa490471af918f@google.com> References: <001636284afcf4fa490471af918f@google.com> Message-ID: <9a9942200909011138v325b0a35g3fe3d72b426585b5@mail.gmail.com> Ping? Please review. My internship is over and I'd like to finish this up before I start classes. Reid On Fri, Aug 21, 2009 at 7:53 PM, wrote: > Hello LLVM devs, > > I've been working on a debugging interface between GDB and LLVM, and I'd > like to get comments on the LLVM side of the interface now that the GDB > side has been committed. ?I don't plan to check this in until after the > code freeze. ?Please take a look on Rietveld. ?I expect to iterate on > this a couple more times. > > Here's the description of the change from Rietveld: > --------------------- > > This patch implements the JIT side of the GDB JIT debugging interface > that I added to GDB. ?To enable this feature, either build the JIT in > debug mode to enable it by default or pass -jit-emit-debug to lli. > > Right now, the only debug information that this communicates to GDB is > call frame information, since it's already being generated to support > exceptions in the JIT. ?Eventually, when DWARF generation isn't tied so > tightly to AsmPrinter, it will be easy to push that information to GDB > through this interface. > > Here's a step-by-step breakdown of how the feature works: > - The JIT generates the machine code and DWARF call frame info > (.eh_frame/.debug_frame) for a function into memory. > - The JIT copies that info into an in-memory ELF file with a symbol for > the function. > - The JIT creates a code entry pointing to the ELF buffer and adds it to > a linked list hanging off of a global descriptor at a special symbol > that GDB knows about. > - The JIT calls a function marked noinline that GDB knows about and has > put an internal breakpoint in. > - GDB catches the breakpoint and reads the global descriptor to look for > new code. > - When sees there is new code, it reads the ELF from the inferior's > memory and adds it to itself as an object file. > - The JIT continues, and the next time we stop the program, we are able > to produce a proper backtrace. > > Consider running the following program through the JIT: > > #include > void baz(short z) { > ?long w = z + 1; > ?printf("%d, %x\n", w, *((int*)NULL)); ?// SEGFAULT here > } > void bar(short y) { > ?int z = y + 1; > ?baz(z); > } > void foo(char x) { > ?short y = x + 1; > ?bar(y); > } > int main(int argc, char** argv) { > ?char x = 1; > ?foo(x); > } > > Here is a backtrace before this patch: > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0x2aaaabdfbd10 (LWP 25476)] > 0x00002aaaabe7d1a8 in ?? () > (gdb) bt > #0 ?0x00002aaaabe7d1a8 in ?? () > #1 ?0x0000000000000003 in ?? () > #2 ?0x0000000000000004 in ?? () > #3 ?0x00032aaaabe7cfd0 in ?? () > #4 ?0x00002aaaabe7d12c in ?? () > #5 ?0x00022aaa00000003 in ?? () > #6 ?0x00002aaaabe7d0aa in ?? () > #7 ?0x01000002abe7cff0 in ?? () > #8 ?0x00002aaaabe7d02c in ?? () > #9 ?0x0100000000000001 in ?? () > #10 0x00000000014388e0 in ?? () > #11 0x00007fff00000001 in ?? () > #12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, > F=0x14024e0, ArgValues=@0x7fffffffe050) > ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 > #13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain > (this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0) > ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 > #14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398, > envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 > > And a backtrace after this patch: > Program received signal SIGSEGV, Segmentation fault. > 0x00002aaaabe7d1a8 in baz () > (gdb) bt > #0 ?0x00002aaaabe7d1a8 in baz () > #1 ?0x00002aaaabe7d12c in bar () > #2 ?0x00002aaaabe7d0aa in foo () > #3 ?0x00002aaaabe7d02c in main () > #4 ?0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, > F=0x14024e0, ArgValues=...) > ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 > #5 ?0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain > (this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0) > ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 > #6 ?0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8, > envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 > > ---------------- > > Thanks! > Reid > > http://codereview.appspot.com/91042 > From evan.cheng at apple.com Tue Sep 1 13:43:08 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 11:43:08 -0700 Subject: [llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll In-Reply-To: <30323D1C-7F02-4F6A-9ABD-9B5D5210DC8F@apple.com> References: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> <30323D1C-7F02-4F6A-9ABD-9B5D5210DC8F@apple.com> Message-ID: On Sep 1, 2009, at 10:50 AM, Bob Wilson wrote: > > On Sep 1, 2009, at 12:37 AM, Evan Cheng wrote: > >> Hi Bob, >> >> I am taking issues with this patch. The two-address pass is >> starting to get too complicated (my fault). > > No arguments about the complexity. I made a few minor > simplifications yesterday, but I'm sure there are more substantial > improvements that could be made. > >> I've been thinking about restructuring the code. This patch is >> making the code even harder to read. > > I tried pretty hard to simplify it. This was the best I could come > up with. Maybe you understand more of the context and can suggest > ways to simplify it further. > >> It also potentially calls removeVirtualRegisterKilled() multiple >> times for each source register. > > I don't think that can happen. It calls removeVirtualRegisterKilled > when: KillMO is set and FirstKeptMO is false, i.e., the register is > killed in this instruction, and none of the uses are tied to other > destination registers. Under those circumstances, all the uses of > the register will be replaced. Subsequent iterations cannot call > removeVirtualRegisterKilled for the same register because all > references to that register will be gone. Ok. The logic is now getting fairly convoluted. I think it's time to consider overhauling it. > >> Each of the call ends up scanning the entire operand list. That >> seems inefficient to me. > > See comments below. > >> Also, what happens to the code the calls LV- >> >removeVirtualRegisterDead(regB, mi)? > > Sorry, I should have removed that in a separate patch. We're > modifying register uses here. Uses have kill markers. Defs have > death markers. If we don't change the defs, why would we need to > call removeVirtualRegisterDead? Am I missing something here? I > searched back through the svn history to see if this was added to > fix a problem but it seems to go all the way back to the origins of > this code. I concluded that it is not needed, but I should have > submitted this change separately. Ok. > >> >> if (KillMO) { >> if (!FirstKeptMO) { >> // All uses of regB are being replaced; move the kill to prevMI. >> if (LV && LV->removeVirtualRegisterKilled(regB, mi)) >> >> When KillMO is not null, it shouldn't be necessary to call >> removeVirtualRegisterKilled, right? > > KillMO is the machine operand that currently has a kill marker on > it. If all of the register uses are being replaced, we want to move > the kill to the preceding copy instruction. This is no different > than the previous code. Since you have already found the KillMO, there is no need to call removeVirtualRegisterKilled() which would scan the operands again. Just update LV varinfo and unset the kill marker. > >> >> Also notice we are scanning the operands twice: >> >> for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { >> ... >> } >> >> // Replace uses of regB with regA. >> for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { >> ... >> } >> >> Please scan the operands just once. If it sees any other source >> operand of the same virtual register tied to another def, then it >> should not update the other operands of the same virtual register. >> The next iteration will deal with them. > > The first scan collects information. The second modifies the > operands. I first tried to do it in one scan but I could not come up > with a reasonable way to make that work. Note that > removeVirtualRegisterKilled needs to be called before you update the > registers, and since I didn't want to leave the instruction with > incorrect kill information in between iterations, I needed to first > check whether all the uses of the register should be replaced. I'll describe how I think the code should be restructured in a bit. > >> As for the kill marker, it should move it to the previous >> instruction the first time it is processed. All you have to ensure >> is the later iteration does not insert any instruction between the >> kill marker and the mi being processed. That should be pretty >> straight forward. Just add a iterator which is the instruction >> insertion location. The first time you insert a copy, it should >> then be moved to the copy instruction, etc. e.g. >> >> a, b = op c, c // insert pos >> >> => >> >> a = c // insert pos >> a, b = op a, c >> >> => >> >> b = c >> a = c >> a, b = op a, b > > That seems unsafe to me. You're leaving the instruction in an > inconsistent state. After the first copy is inserted, you've moved > the kill marker but there is still a use of c after the point where > it is killed. There is a lot of code inside this loop that is > looking at register uses and kill markers. On the next iteration, > it seems like things may get confused. It may be safe but I'm not > able to easily convince myself of that, and even if it is safe now, > it seems likely to be fragile in the future. > > This seems like the root of your objections. I am trying to keep > the kill information up to date in between iterations. Given that > goal, I don't see a better way to write the code. If you are > certain that it is OK to leave the kill information in an incorrect > state, I can change it as you suggest. I would rather be safe here. Ok. Good point. Let's consider a more extensive instead. How about something like this: 1. Scan an instruction. Look at all the operands. Keep a list of source registers that are tied to one or more def registers. 2. For each source register, track which def registers it is being tied to. It should also track the kill operand index. 3. Consider each source register. If it is only tied to one def register, we can consider performing the usual optimizations. If it is tied to multiple def, I don't think the current optimizations are useful. 4. If it is tied to multiple def, process it separately. For each of the tied def, add a copy (or remat the def). Move the kill marker to the last copy. This should make the code more understandable. > >> >> Since you are working on this code, could be please clean it up a >> bit. Can you factor this if statement: >> if (mi->getOperand(ti).isDead() && >> isSafeToDelete(mi, regB, TII, Kills)) { >> >> to a separate function? > > Like this (in the attached patch)? Sorry, I meant factoring out lines 827 to 880 to a separate function. Evan > > Checking mi->getOperand(ti).isDead() is completely redundant with > isSafeToDelete() so I assume it is only there to guard against > calling a relatively expensive function in the common case. If > we're going to call a function anyway, maybe it would be better to > just remove the isDead() check altogether. > > I'd leave it as-is but I don't mind changing it if you tell me your > preference. > > From sabre at nondot.org Tue Sep 1 13:44:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 18:44:07 -0000 Subject: [llvm-commits] [llvm] r80703 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Message-ID: <200909011844.n81Ii7Ix025405@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 13:44:06 2009 New Revision: 80703 URL: http://llvm.org/viewvc/llvm-project?rev=80703&view=rev Log: remove a bunch of explicit code previously needed to update the callgraph. This is now dead because RAUW does the job. 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=80703&r1=80702&r2=80703&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Tue Sep 1 13:44:06 2009 @@ -43,13 +43,11 @@ /// an invoke, we have to check all of all of the calls that can throw into /// invokes. This function analyze BB to see if there are any calls, and if so, /// it rewrites them to be invokes that jump to InvokeDest and fills in the PHI -/// nodes in that block with the values specified in InvokeDestPHIValues. If -/// CallerCGN is specified, this function updates the call graph. +/// nodes in that block with the values specified in InvokeDestPHIValues. /// static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, BasicBlock *InvokeDest, - const SmallVectorImpl &InvokeDestPHIValues, - CallGraphNode *CallerCGN) { + const SmallVectorImpl &InvokeDestPHIValues) { for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { Instruction *I = BBI++; @@ -76,24 +74,10 @@ II->setCallingConv(CI->getCallingConv()); II->setAttributes(CI->getAttributes()); - // Make sure that anything using the call now uses the invoke! + // Make sure that anything using the call now uses the invoke! This also + // updates the CallGraph if present. CI->replaceAllUsesWith(II); - // Update the callgraph if present. - if (CallerCGN) { - // We should be able to do this: - // (*CG)[Caller]->replaceCallSite(CI, II); - // but that fails if the old call site isn't in the call graph, - // which, because of LLVM bug 3601, it sometimes isn't. - for (CallGraphNode::iterator NI = CallerCGN->begin(), NE = CallerCGN->end(); - NI != NE; ++NI) { - if (NI->first == CI) { - NI->first = II; - break; - } - } - } - // Delete the unconditional branch inserted by splitBasicBlock BB->getInstList().pop_back(); Split->getInstList().pop_front(); // Delete the original call @@ -120,8 +104,7 @@ /// block of the inlined code (the last block is the end of the function), /// and InlineCodeInfo is information about the code that got inlined. static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock, - ClonedCodeInfo &InlinedCodeInfo, - CallGraph *CG) { + ClonedCodeInfo &InlinedCodeInfo) { BasicBlock *InvokeDest = II->getUnwindDest(); SmallVector InvokeDestPHIValues; @@ -150,13 +133,10 @@ return; } - CallGraphNode *CallerCGN = 0; - if (CG) CallerCGN = (*CG)[Caller]; - for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E; ++BB){ if (InlinedCodeInfo.ContainsCalls) HandleCallsInBlockInlinedThroughInvoke(BB, InvokeDest, - InvokeDestPHIValues, CallerCGN); + InvokeDestPHIValues); if (UnwindInst *UI = dyn_cast(BB->getTerminator())) { // An UnwindInst requires special handling when it gets inlined into an @@ -539,7 +519,7 @@ // any inlined 'unwind' instructions into branches to the invoke exception // destination, and call instructions into invoke instructions. if (InvokeInst *II = dyn_cast(TheCall)) - HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo, CG); + HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo); // If we cloned in _exactly one_ basic block, and if that block ends in a // return instruction, we splice the body of the inlined callee directly into From grosbach at apple.com Tue Sep 1 13:49:12 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 18:49:12 -0000 Subject: [llvm-commits] [llvm] r80704 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfException.cpp Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Message-ID: <200909011849.n81InCmp026060@zion.cs.uiuc.edu> Author: grosbach Date: Tue Sep 1 13:49:12 2009 New Revision: 80704 URL: http://llvm.org/viewvc/llvm-project?rev=80704&view=rev Log: Use raw_ostream instead of sstream Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80704&r1=80703&r2=80704&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 1 13:49:12 2009 @@ -28,8 +28,8 @@ #include "llvm/Support/Mangler.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" -#include using namespace llvm; static TimerGroup &getDwarfTimerGroup() { @@ -601,12 +601,10 @@ EmitLabel("exception", SubprogramCount); if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { - std::stringstream out; - out << Asm->getFunctionNumber(); - std::string LSDAName = - Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), - Mangler::Private); - O << LSDAName << ":\n"; + SmallString<256> LSDAName; + raw_svector_ostream(LSDAName) << MAI->getPrivateGlobalPrefix() << + "_LSDA_" << Asm->getFunctionNumber(); + O << LSDAName.str() << ":\n"; } // Emit the header. Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80704&r1=80703&r2=80704&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Sep 1 13:49:12 2009 @@ -1,5 +1,3 @@ -//===-- ARMAsmPrinter.cpp - ARM LLVM assembly writer ----------------------===// -// // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source @@ -36,6 +34,7 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/Compiler.h" @@ -44,7 +43,6 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/FormattedStream.h" #include -#include using namespace llvm; STATISTIC(EmittedInsts, "Number of machine instrs printed"); @@ -162,10 +160,10 @@ std::string Name; if (ACPV->isLSDA()) { - std::stringstream out; - out << getFunctionNumber(); - Name = Mang->makeNameProper(std::string("LSDA_") + out.str(), - Mangler::Private); + SmallString<256> LSDAName; + raw_svector_ostream(LSDAName) << MAI->getPrivateGlobalPrefix() << + "_LSDA_" << getFunctionNumber(); + Name = LSDAName.str(); } else if (GV) { bool isIndirect = Subtarget->isTargetDarwin() && Subtarget->GVIsIndirectSymbol(GV, From bob.wilson at apple.com Tue Sep 1 13:50:43 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 18:50:43 -0000 Subject: [llvm-commits] [llvm] r80705 - /llvm/trunk/test/CodeGen/ARM/vldlane.ll Message-ID: <200909011850.n81IoiCS026269@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 1 13:50:43 2009 New Revision: 80705 URL: http://llvm.org/viewvc/llvm-project?rev=80705&view=rev Log: Fix incorrect declarations of intrinsics in this test. Modified: llvm/trunk/test/CodeGen/ARM/vldlane.ll Modified: llvm/trunk/test/CodeGen/ARM/vldlane.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vldlane.ll?rev=80705&r1=80704&r2=80705&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vldlane.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vldlane.ll Tue Sep 1 13:50:43 2009 @@ -49,10 +49,10 @@ ret <2 x float> %tmp5 } -declare %struct.__builtin_neon_v8qi2 @llvm.arm.neon.vld2lane.v8i8(i8*) nounwind readonly -declare %struct.__builtin_neon_v4hi2 @llvm.arm.neon.vld2lane.v4i16(i8*) nounwind readonly -declare %struct.__builtin_neon_v2si2 @llvm.arm.neon.vld2lane.v2i32(i8*) nounwind readonly -declare %struct.__builtin_neon_v2sf2 @llvm.arm.neon.vld2lane.v2f32(i8*) nounwind readonly +declare %struct.__builtin_neon_v8qi2 @llvm.arm.neon.vld2lane.v8i8(i8*, <8 x i8>, <8 x i8>, i32) nounwind readonly +declare %struct.__builtin_neon_v4hi2 @llvm.arm.neon.vld2lane.v4i16(i8*, <4 x i16>, <4 x i16>, i32) nounwind readonly +declare %struct.__builtin_neon_v2si2 @llvm.arm.neon.vld2lane.v2i32(i8*, <2 x i32>, <2 x i32>, i32) nounwind readonly +declare %struct.__builtin_neon_v2sf2 @llvm.arm.neon.vld2lane.v2f32(i8*, <2 x float>, <2 x float>, i32) nounwind readonly %struct.__builtin_neon_v8qi3 = type { <8 x i8>, <8 x i8>, <8 x i8> } %struct.__builtin_neon_v4hi3 = type { <4 x i16>, <4 x i16>, <4 x i16> } @@ -111,10 +111,10 @@ ret <2 x float> %tmp7 } -declare %struct.__builtin_neon_v8qi3 @llvm.arm.neon.vld3lane.v8i8(i8*) nounwind readonly -declare %struct.__builtin_neon_v4hi3 @llvm.arm.neon.vld3lane.v4i16(i8*) nounwind readonly -declare %struct.__builtin_neon_v2si3 @llvm.arm.neon.vld3lane.v2i32(i8*) nounwind readonly -declare %struct.__builtin_neon_v2sf3 @llvm.arm.neon.vld3lane.v2f32(i8*) nounwind readonly +declare %struct.__builtin_neon_v8qi3 @llvm.arm.neon.vld3lane.v8i8(i8*, <8 x i8>, <8 x i8>, <8 x i8>, i32) nounwind readonly +declare %struct.__builtin_neon_v4hi3 @llvm.arm.neon.vld3lane.v4i16(i8*, <4 x i16>, <4 x i16>, <4 x i16>, i32) nounwind readonly +declare %struct.__builtin_neon_v2si3 @llvm.arm.neon.vld3lane.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, i32) nounwind readonly +declare %struct.__builtin_neon_v2sf3 @llvm.arm.neon.vld3lane.v2f32(i8*, <2 x float>, <2 x float>, <2 x float>, i32) nounwind readonly %struct.__builtin_neon_v8qi4 = type { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } %struct.__builtin_neon_v4hi4 = type { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @@ -181,7 +181,7 @@ ret <2 x float> %tmp9 } -declare %struct.__builtin_neon_v8qi4 @llvm.arm.neon.vld4lane.v8i8(i8*) nounwind readonly -declare %struct.__builtin_neon_v4hi4 @llvm.arm.neon.vld4lane.v4i16(i8*) nounwind readonly -declare %struct.__builtin_neon_v2si4 @llvm.arm.neon.vld4lane.v2i32(i8*) nounwind readonly -declare %struct.__builtin_neon_v2sf4 @llvm.arm.neon.vld4lane.v2f32(i8*) nounwind readonly +declare %struct.__builtin_neon_v8qi4 @llvm.arm.neon.vld4lane.v8i8(i8*, <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8>, i32) nounwind readonly +declare %struct.__builtin_neon_v4hi4 @llvm.arm.neon.vld4lane.v4i16(i8*, <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16>, i32) nounwind readonly +declare %struct.__builtin_neon_v2si4 @llvm.arm.neon.vld4lane.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, i32) nounwind readonly +declare %struct.__builtin_neon_v2sf4 @llvm.arm.neon.vld4lane.v2f32(i8*, <2 x float>, <2 x float>, <2 x float>, <2 x float>, i32) nounwind readonly From sabre at nondot.org Tue Sep 1 13:50:55 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 18:50:55 -0000 Subject: [llvm-commits] [llvm] r80706 - /llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Message-ID: <200909011850.n81IotJi026302@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 13:50:55 2009 New Revision: 80706 URL: http://llvm.org/viewvc/llvm-project?rev=80706&view=rev Log: cleanup/simplify Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=80706&r1=80705&r2=80706&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Tue Sep 1 13:50:55 2009 @@ -322,7 +322,7 @@ // Update the callgraph to know that the callsite has been transformed. CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN); - + // Update all users of sret parameter to extract value using extractvalue. for (Value::use_iterator UI = FirstCArg->use_begin(), UE = FirstCArg->use_end(); UI != UE; ) { @@ -331,23 +331,19 @@ if (C2 && (C2 == Call)) continue; - if (GetElementPtrInst *UGEP = dyn_cast(U2)) { - ConstantInt *Idx = dyn_cast(UGEP->getOperand(2)); - assert (Idx && "Unexpected getelementptr index!"); - Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(), - "evi", UGEP); - while(!UGEP->use_empty()) { - // isSafeToUpdateAllCallers has checked that all GEP uses are - // LoadInsts - LoadInst *L = cast(*UGEP->use_begin()); - L->replaceAllUsesWith(GR); - L->eraseFromParent(); - } - UGEP->eraseFromParent(); - continue; + GetElementPtrInst *UGEP = cast(U2); + ConstantInt *Idx = cast(UGEP->getOperand(2)); + Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(), + "evi", UGEP); + while(!UGEP->use_empty()) { + // isSafeToUpdateAllCallers has checked that all GEP uses are + // LoadInsts + LoadInst *L = cast(*UGEP->use_begin()); + L->replaceAllUsesWith(GR); + L->eraseFromParent(); } - - assert(0 && "Unexpected sret parameter use"); + UGEP->eraseFromParent(); + continue; } Call->eraseFromParent(); } From bob.wilson at apple.com Tue Sep 1 13:51:56 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 18:51:56 -0000 Subject: [llvm-commits] [llvm] r80707 - in /llvm/trunk: lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMInstrNEON.td lib/Target/ARM/NEONPreAllocPass.cpp test/CodeGen/ARM/vstlane.ll Message-ID: <200909011851.n81IpvqV026463@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 1 13:51:56 2009 New Revision: 80707 URL: http://llvm.org/viewvc/llvm-project?rev=80707&view=rev Log: Add support for generating code for vst{234}lane intrinsics. Added: llvm/trunk/test/CodeGen/ARM/vstlane.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=80707&r1=80706&r2=80707&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Sep 1 13:51:56 2009 @@ -1484,6 +1484,61 @@ N->getOperand(5), N->getOperand(6), Chain }; return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8); } + + case Intrinsic::arm_neon_vst2lane: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (N->getOperand(3).getValueType().getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vst2lane type"); + case MVT::v8i8: Opc = ARM::VST2LNd8; break; + case MVT::v4i16: Opc = ARM::VST2LNd16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VST2LNd32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), Chain }; + return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 7); + } + + case Intrinsic::arm_neon_vst3lane: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (N->getOperand(3).getValueType().getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vst3lane type"); + case MVT::v8i8: Opc = ARM::VST3LNd8; break; + case MVT::v4i16: Opc = ARM::VST3LNd16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VST3LNd32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), N->getOperand(6), Chain }; + return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8); + } + + case Intrinsic::arm_neon_vst4lane: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (N->getOperand(3).getValueType().getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vst4lane type"); + case MVT::v8i8: Opc = ARM::VST4LNd8; break; + case MVT::v4i16: Opc = ARM::VST4LNd16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VST4LNd32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), N->getOperand(6), + N->getOperand(7), Chain }; + return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 9); + } } } } Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80707&r1=80706&r2=80707&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 1 13:51:56 2009 @@ -1370,6 +1370,26 @@ return DAG.UpdateNodeOperands(Op, &Ops[0], Ops.size()); } +static SDValue LowerNeonVSTLaneIntrinsic(SDValue Op, SelectionDAG &DAG, + unsigned NumVecs) { + SDNode *Node = Op.getNode(); + EVT VT = Node->getOperand(3).getValueType(); + + if (!VT.is64BitVector()) + return SDValue(); // unimplemented + + // Change the lane number operand to be a TargetConstant; otherwise it + // will be legalized into a register. + ConstantSDNode *Lane = dyn_cast(Node->getOperand(NumVecs+3)); + if (!Lane) { + assert(false && "vst lane number must be a constant"); + return SDValue(); + } + SmallVector Ops(Node->op_begin(), Node->op_end()); + Ops[NumVecs+3] = DAG.getTargetConstant(Lane->getZExtValue(), MVT::i32); + return DAG.UpdateNodeOperands(Op, &Ops[0], Ops.size()); +} + SDValue ARMTargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) { unsigned IntNo = cast(Op.getOperand(1))->getZExtValue(); @@ -1388,6 +1408,12 @@ return LowerNeonVSTIntrinsic(Op, DAG, 3); case Intrinsic::arm_neon_vst4: return LowerNeonVSTIntrinsic(Op, DAG, 4); + case Intrinsic::arm_neon_vst2lane: + return LowerNeonVSTLaneIntrinsic(Op, DAG, 2); + case Intrinsic::arm_neon_vst3lane: + return LowerNeonVSTLaneIntrinsic(Op, DAG, 3); + case Intrinsic::arm_neon_vst4lane: + return LowerNeonVSTLaneIntrinsic(Op, DAG, 4); default: return SDValue(); // Don't custom lower most intrinsics. } } Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=80707&r1=80706&r2=80707&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Tue Sep 1 13:51:56 2009 @@ -300,6 +300,40 @@ def VST4d8 : VST4D<"vst4.8">; def VST4d16 : VST4D<"vst4.16">; def VST4d32 : VST4D<"vst4.32">; + +// VST2LN : Vector Store (single 2-element structure from one lane) +class VST2LND + : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane), + NoItinerary, + !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"), + "", []>; + +def VST2LNd8 : VST2LND<"vst2.8">; +def VST2LNd16 : VST2LND<"vst2.16">; +def VST2LNd32 : VST2LND<"vst2.32">; + +// VST3LN : Vector Store (single 3-element structure from one lane) +class VST3LND + : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, + nohash_imm:$lane), NoItinerary, + !strconcat(OpcodeStr, + "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>; + +def VST3LNd8 : VST3LND<"vst3.8">; +def VST3LNd16 : VST3LND<"vst3.16">; +def VST3LNd32 : VST3LND<"vst3.32">; + +// VST4LN : Vector Store (single 4-element structure from one lane) +class VST4LND + : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, + DPR:$src4, nohash_imm:$lane), NoItinerary, + !strconcat(OpcodeStr, + "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"), + "", []>; + +def VST4LNd8 : VST4LND<"vst4.8">; +def VST4LNd16 : VST4LND<"vst4.16">; +def VST4LNd32 : VST4LND<"vst4.32">; } Modified: llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp?rev=80707&r1=80706&r2=80707&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Tue Sep 1 13:51:56 2009 @@ -75,6 +75,9 @@ case ARM::VST2d8: case ARM::VST2d16: case ARM::VST2d32: + case ARM::VST2LNd8: + case ARM::VST2LNd16: + case ARM::VST2LNd32: FirstOpnd = 3; NumRegs = 2; return true; @@ -82,6 +85,9 @@ case ARM::VST3d8: case ARM::VST3d16: case ARM::VST3d32: + case ARM::VST3LNd8: + case ARM::VST3LNd16: + case ARM::VST3LNd32: FirstOpnd = 3; NumRegs = 3; return true; @@ -89,6 +95,9 @@ case ARM::VST4d8: case ARM::VST4d16: case ARM::VST4d32: + case ARM::VST4LNd8: + case ARM::VST4LNd16: + case ARM::VST4LNd32: FirstOpnd = 3; NumRegs = 4; return true; Added: llvm/trunk/test/CodeGen/ARM/vstlane.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vstlane.ll?rev=80707&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vstlane.ll (added) +++ llvm/trunk/test/CodeGen/ARM/vstlane.ll Tue Sep 1 13:51:56 2009 @@ -0,0 +1,113 @@ +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s + +define void @vst2lanei8(i8* %A, <8 x i8>* %B) nounwind { +;CHECK: vst2lanei8: +;CHECK: vst2.8 + %tmp1 = load <8 x i8>* %B + call void @llvm.arm.neon.vst2lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1) + ret void +} + +define void @vst2lanei16(i16* %A, <4 x i16>* %B) nounwind { +;CHECK: vst2lanei16: +;CHECK: vst2.16 + %tmp1 = load <4 x i16>* %B + call void @llvm.arm.neon.vst2lane.v4i16(i16* %A, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1) + ret void +} + +define void @vst2lanei32(i32* %A, <2 x i32>* %B) nounwind { +;CHECK: vst2lanei32: +;CHECK: vst2.32 + %tmp1 = load <2 x i32>* %B + call void @llvm.arm.neon.vst2lane.v2i32(i32* %A, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1) + ret void +} + +define void @vst2lanef(float* %A, <2 x float>* %B) nounwind { +;CHECK: vst2lanef: +;CHECK: vst2.32 + %tmp1 = load <2 x float>* %B + call void @llvm.arm.neon.vst2lane.v2f32(float* %A, <2 x float> %tmp1, <2 x float> %tmp1, i32 1) + ret void +} + +declare void @llvm.arm.neon.vst2lane.v8i8(i8*, <8 x i8>, <8 x i8>, i32) nounwind +declare void @llvm.arm.neon.vst2lane.v4i16(i8*, <4 x i16>, <4 x i16>, i32) nounwind +declare void @llvm.arm.neon.vst2lane.v2i32(i8*, <2 x i32>, <2 x i32>, i32) nounwind +declare void @llvm.arm.neon.vst2lane.v2f32(i8*, <2 x float>, <2 x float>, i32) nounwind + +define void @vst3lanei8(i8* %A, <8 x i8>* %B) nounwind { +;CHECK: vst3lanei8: +;CHECK: vst3.8 + %tmp1 = load <8 x i8>* %B + call void @llvm.arm.neon.vst3lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1) + ret void +} + +define void @vst3lanei16(i16* %A, <4 x i16>* %B) nounwind { +;CHECK: vst3lanei16: +;CHECK: vst3.16 + %tmp1 = load <4 x i16>* %B + call void @llvm.arm.neon.vst3lane.v4i16(i16* %A, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1) + ret void +} + +define void @vst3lanei32(i32* %A, <2 x i32>* %B) nounwind { +;CHECK: vst3lanei32: +;CHECK: vst3.32 + %tmp1 = load <2 x i32>* %B + call void @llvm.arm.neon.vst3lane.v2i32(i32* %A, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1) + ret void +} + +define void @vst3lanef(float* %A, <2 x float>* %B) nounwind { +;CHECK: vst3lanef: +;CHECK: vst3.32 + %tmp1 = load <2 x float>* %B + call void @llvm.arm.neon.vst3lane.v2f32(float* %A, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, i32 1) + ret void +} + +declare void @llvm.arm.neon.vst3lane.v8i8(i8*, <8 x i8>, <8 x i8>, <8 x i8>, i32) nounwind +declare void @llvm.arm.neon.vst3lane.v4i16(i8*, <4 x i16>, <4 x i16>, <4 x i16>, i32) nounwind +declare void @llvm.arm.neon.vst3lane.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, i32) nounwind +declare void @llvm.arm.neon.vst3lane.v2f32(i8*, <2 x float>, <2 x float>, <2 x float>, i32) nounwind + + +define void @vst4lanei8(i8* %A, <8 x i8>* %B) nounwind { +;CHECK: vst4lanei8: +;CHECK: vst4.8 + %tmp1 = load <8 x i8>* %B + call void @llvm.arm.neon.vst4lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1) + ret void +} + +define void @vst4lanei16(i16* %A, <4 x i16>* %B) nounwind { +;CHECK: vst4lanei16: +;CHECK: vst4.16 + %tmp1 = load <4 x i16>* %B + call void @llvm.arm.neon.vst4lane.v4i16(i16* %A, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1) + ret void +} + +define void @vst4lanei32(i32* %A, <2 x i32>* %B) nounwind { +;CHECK: vst4lanei32: +;CHECK: vst4.32 + %tmp1 = load <2 x i32>* %B + call void @llvm.arm.neon.vst4lane.v2i32(i32* %A, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1) + ret void +} + +define void @vst4lanef(float* %A, <2 x float>* %B) nounwind { +;CHECK: vst4lanef: +;CHECK: vst4.32 + %tmp1 = load <2 x float>* %B + call void @llvm.arm.neon.vst4lane.v2f32(float* %A, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, i32 1) + ret void +} + +declare void @llvm.arm.neon.vst4lane.v8i8(i8*, <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8>, i32) nounwind +declare void @llvm.arm.neon.vst4lane.v4i16(i8*, <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16>, i32) nounwind +declare void @llvm.arm.neon.vst4lane.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, i32) nounwind +declare void @llvm.arm.neon.vst4lane.v2f32(i8*, <2 x float>, <2 x float>, <2 x float>, <2 x float>, i32) nounwind From sabre at nondot.org Tue Sep 1 13:52:39 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 18:52:39 -0000 Subject: [llvm-commits] [llvm] r80708 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Analysis/IPA/CallGraphSCCPass.cpp lib/Transforms/IPO/ArgumentPromotion.cpp lib/Transforms/IPO/StructRetPromotion.cpp Message-ID: <200909011852.n81IqdMk026562@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 13:52:39 2009 New Revision: 80708 URL: http://llvm.org/viewvc/llvm-project?rev=80708&view=rev Log: remove CallGraphNode::replaceCallSite, it is redundant with other APIs. Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h llvm/trunk/lib/Analysis/IPA/CallGraph.cpp llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=80708&r1=80707&r2=80708&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/CallGraph.h (original) +++ llvm/trunk/include/llvm/Analysis/CallGraph.h Tue Sep 1 13:52:39 2009 @@ -270,11 +270,6 @@ /// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite /// from this node to the specified callee function. void removeOneAbstractEdgeTo(CallGraphNode *Callee); - - /// replaceCallSite - Make the edge in the node for Old CallSite be for - /// New CallSite instead. Note that this method takes linear time, so it - /// should be used sparingly. - void replaceCallSite(CallSite Old, CallSite New, CallGraphNode *NewCallee); }; //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=80708&r1=80707&r2=80708&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Tue Sep 1 13:52:39 2009 @@ -279,27 +279,5 @@ } } -/// replaceCallSite - Make the edge in the node for Old CallSite be for -/// New CallSite instead. Note that this method takes linear time, so it -/// should be used sparingly. -void CallGraphNode::replaceCallSite(CallSite Old, CallSite New, - CallGraphNode *NewCallee) { - for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { - assert(I != CalledFunctions.end() && "Cannot find callsite to replace!"); - if (I->first != Old.getInstruction()) continue; - - I->first = New.getInstruction(); - - // If the callee is changing, not just the callsite, then update it as - // well. - if (NewCallee) { - I->second->DropRef(); - I->second = NewCallee; - I->second->AddRef(); - } - return; - } -} - // Enuse that users of CallGraph.h also link with this file DEFINING_FILE_FOR(CallGraph) Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80708&r1=80707&r2=80708&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 13:52:39 2009 @@ -228,7 +228,7 @@ else CalleeNode = CG.getCallsExternalNode(); - CGN->replaceCallSite(CS, CS, CalleeNode); + ExistingIt->second = CalleeNode; MadeChange = true; continue; } Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=80708&r1=80707&r2=80708&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Tue Sep 1 13:52:39 2009 @@ -728,7 +728,9 @@ AA.replaceWithNewValue(Call, New); // Update the callgraph to know that the callsite has been transformed. - CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN); + CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()]; + CalleeNode->removeCallEdgeFor(Call); + CalleeNode->addCalledFunction(New, NF_CGN); if (!Call->use_empty()) { Call->replaceAllUsesWith(New); Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=80708&r1=80707&r2=80708&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Tue Sep 1 13:52:39 2009 @@ -321,7 +321,9 @@ New->takeName(Call); // Update the callgraph to know that the callsite has been transformed. - CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN); + CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()]; + CalleeNode->removeCallEdgeFor(Call); + CalleeNode->addCalledFunction(New, NF_CGN); // Update all users of sret parameter to extract value using extractvalue. for (Value::use_iterator UI = FirstCArg->use_begin(), From grosbach at apple.com Tue Sep 1 13:55:08 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 01 Sep 2009 18:55:08 -0000 Subject: [llvm-commits] [llvm] r80710 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfException.cpp Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Message-ID: <200909011855.n81It8kt026907@zion.cs.uiuc.edu> Author: grosbach Date: Tue Sep 1 13:55:08 2009 New Revision: 80710 URL: http://llvm.org/viewvc/llvm-project?rev=80710&view=rev Log: reduce size of SmallString to something more reasonable Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80710&r1=80709&r2=80710&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Sep 1 13:55:08 2009 @@ -601,7 +601,7 @@ EmitLabel("exception", SubprogramCount); if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { - SmallString<256> LSDAName; + SmallString<16> LSDAName; raw_svector_ostream(LSDAName) << MAI->getPrivateGlobalPrefix() << "_LSDA_" << Asm->getFunctionNumber(); O << LSDAName.str() << ":\n"; Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80710&r1=80709&r2=80710&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Sep 1 13:55:08 2009 @@ -160,7 +160,7 @@ std::string Name; if (ACPV->isLSDA()) { - SmallString<256> LSDAName; + SmallString<16> LSDAName; raw_svector_ostream(LSDAName) << MAI->getPrivateGlobalPrefix() << "_LSDA_" << getFunctionNumber(); Name = LSDAName.str(); From edwintorok at gmail.com Tue Sep 1 14:00:58 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 01 Sep 2009 22:00:58 +0300 Subject: [llvm-commits] Add option to emit ELF symbol files for debugging the LLVM JIT with GDB In-Reply-To: <9a9942200909011138v325b0a35g3fe3d72b426585b5@mail.gmail.com> References: <001636284afcf4fa490471af918f@google.com> <9a9942200909011138v325b0a35g3fe3d72b426585b5@mail.gmail.com> Message-ID: <4A9D6F6A.5060609@gmail.com> On 2009-09-01 21:38, Reid Kleckner wrote: > Ping? Please review. My internship is over and I'd like to finish > this up before I start classes. > > Reid > > On Fri, Aug 21, 2009 at 7:53 PM, wrote: > >> Hello LLVM devs, >> >> I've been working on a debugging interface between GDB and LLVM, and I'd >> like to get comments on the LLVM side of the interface now that the GDB >> side has been committed. I don't plan to check this in until after the >> code freeze. Please take a look on Rietveld. I expect to iterate on >> this a couple more times. >> >> Here's the description of the change from Rietveld: >> --------------------- >> >> This patch implements the JIT side of the GDB JIT debugging interface >> that I added to GDB. To enable this feature, either build the JIT in >> debug mode to enable it by default or pass -jit-emit-debug to lli. >> >> Right now, the only debug information that this communicates to GDB is >> call frame information, since it's already being generated to support >> exceptions in the JIT. Eventually, when DWARF generation isn't tied so >> tightly to AsmPrinter, it will be easy to push that information to GDB >> through this interface. >> OProfileJITEventListener is already able to send file:line number information to oprofile. Although it does this via the opagent library, and doesn't have to emit an ELF itself, the debug info you need for line numbers is there. I think there could be a global function in LLVM, that given an address will print filename:sourceline info. One could manually call that from gdb, just as you would call Module->dump(), and could be an aid in debugging, until full DWARF debug info can be emitted for JITed code. This could be independent from your GDB <-> JIT interface, for example as another JITEventListener. >> Here's a step-by-step breakdown of how the feature works: >> - The JIT generates the machine code and DWARF call frame info >> (.eh_frame/.debug_frame) for a function into memory. >> - The JIT copies that info into an in-memory ELF file with a symbol for >> the function. >> It seems you create a new ELF for each function being JITed, could this be a single ELF for the entire program? Best regards, --Edwin From bob.wilson at apple.com Tue Sep 1 14:00:49 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 1 Sep 2009 12:00:49 -0700 Subject: [llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll In-Reply-To: References: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> <30323D1C-7F02-4F6A-9ABD-9B5D5210DC8F@apple.com> Message-ID: On Sep 1, 2009, at 11:43 AM, Evan Cheng wrote: > Since you have already found the KillMO, there is no need to call > removeVirtualRegisterKilled() which would scan the operands again. > Just update LV varinfo and unset the kill marker. Oh, I see what you mean. That makes sense. > Let's consider a more extensive instead. How about something like > this: > > 1. Scan an instruction. Look at all the operands. Keep a list of > source registers that are tied to one or more def registers. > 2. For each source register, track which def registers it is being > tied to. It should also track the kill operand index. > 3. Consider each source register. If it is only tied to one def > register, we can consider performing the usual optimizations. If it > is tied to multiple def, I don't think the current optimizations are > useful. > 4. If it is tied to multiple def, process it separately. For each of > the tied def, add a copy (or remat the def). Move the kill marker to > the last copy. > > This should make the code more understandable. That sounds like a good approach. I'll give it a try.... > >> >>> >>> Since you are working on this code, could be please clean it up a >>> bit. Can you factor this if statement: >>> if (mi->getOperand(ti).isDead() && >>> isSafeToDelete(mi, regB, TII, Kills)) { >>> >>> to a separate function? >> >> Like this (in the attached patch)? > > Sorry, I meant factoring out lines 827 to 880 to a separate function. Ah! (I knew I must have been missing something there.) I can certainly take care of that. From astifter at gmx.at Tue Sep 1 14:01:59 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 19:01:59 -0000 Subject: [llvm-commits] [llvm] r80711 - /llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Message-ID: <200909011901.n81J1xn8027810@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 14:01:59 2009 New Revision: 80711 URL: http://llvm.org/viewvc/llvm-project?rev=80711&view=rev Log: Small fix in ProfileEstimator that eliminates duplicated code. Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp?rev=80711&r1=80710&r2=80711&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Tue Sep 1 14:01:59 2009 @@ -176,8 +176,7 @@ EdgeInformation[BB->getParent()][edge] = BBWeight; printEdgeWeight(edge); } - for ( succ_iterator bbi = succ_begin(BB), bbe = succ_end(BB); - bbi != bbe; ++bbi ) { + for ( ; bbi != bbe; ++bbi ) { if (ProcessedSuccs.insert(*bbi).second) { Edge edge = getEdge(BB,*bbi); double w = getEdgeWeight(edge); From astifter at gmx.at Tue Sep 1 14:03:44 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 19:03:44 -0000 Subject: [llvm-commits] [llvm] r80712 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoTypes.h lib/Transforms/Instrumentation/CMakeLists.txt lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp runtime/libprofile/OptimalEdgeProfiling.c runtime/libprofile/exported_symbols.lst Message-ID: <200909011903.n81J3iEN028095@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 14:03:44 2009 New Revision: 80712 URL: http://llvm.org/viewvc/llvm-project?rev=80712&view=rev Log: OptimalEdgeProfiling: Creation of profiles. This adds the instrumentation and runtime part of OptimalEdgeProfiling. Added: llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c Modified: llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt llvm/trunk/runtime/libprofile/exported_symbols.lst Modified: llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h?rev=80712&r1=80711&r2=80712&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h (original) +++ llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h Tue Sep 1 14:03:44 2009 @@ -22,7 +22,8 @@ BlockInfo = 3, /* Block profiling information */ EdgeInfo = 4, /* Edge profiling information */ PathInfo = 5, /* Path profiling information */ - BBTraceInfo = 6 /* Basic block trace information */ + BBTraceInfo = 6, /* Basic block trace information */ + OptEdgeInfo = 7 /* Edge profiling information, optimal version */ }; #endif /* LLVM_ANALYSIS_PROFILEINFOTYPES_H */ Modified: llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt?rev=80712&r1=80711&r2=80712&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt Tue Sep 1 14:03:44 2009 @@ -2,6 +2,7 @@ BlockProfiling.cpp EdgeProfiling.cpp MaximumSpanningTree.cpp + OptimalEdgeProfiling.cpp ProfilingUtils.cpp RSProfiling.cpp ) Added: llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp?rev=80712&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp (added) +++ llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp Tue Sep 1 14:03:44 2009 @@ -0,0 +1,186 @@ +//===- OptimalEdgeProfiling.cpp - Insert counters for opt. edge profiling -===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass instruments the specified program with counters for edge profiling. +// Edge profiling can give a reasonable approximation of the hot paths through a +// program, and is used for a wide variety of program transformations. +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "insert-optimal-edge-profiling" +#include "ProfilingUtils.h" +#include "llvm/Constants.h" +#include "llvm/Function.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Analysis/Passes.h" +#include "llvm/Analysis/ProfileInfo.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Instrumentation.h" +#include "llvm/ADT/Statistic.h" +#include "MaximumSpanningTree.h" +#include +using namespace llvm; + +STATISTIC(NumEdgesInserted, "The # of edges inserted."); + +namespace { + class VISIBILITY_HIDDEN OptimalEdgeProfiler : public ModulePass { + bool runOnModule(Module &M); + ProfileInfo *PI; + public: + static char ID; // Pass identification, replacement for typeid + OptimalEdgeProfiler() : ModulePass(&ID) {} + + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequiredID(ProfileEstimatorPassID); + AU.addRequired(); + } + + virtual const char *getPassName() const { + return "Optimal Edge Profiler"; + } + }; +} + +char OptimalEdgeProfiler::ID = 0; +static RegisterPass +X("insert-optimal-edge-profiling", + "Insert optimal instrumentation for edge profiling"); + +ModulePass *llvm::createOptimalEdgeProfilerPass() { + return new OptimalEdgeProfiler(); +} + +inline static void printEdgeCounter(ProfileInfo::Edge e, + BasicBlock* b, + unsigned i) { + DEBUG(errs() << "--Edge Counter for " << (e) << " in " \ + << ((b)?(b)->getNameStr():"0") << " (# " << (i) << ")\n"); +} + +bool OptimalEdgeProfiler::runOnModule(Module &M) { + Function *Main = M.getFunction("main"); + if (Main == 0) { + errs() << "WARNING: cannot insert edge profiling into a module" + << " with no main function!\n"; + return false; // No main, no instrumentation! + } + + std::set BlocksToInstrument; + unsigned NumEdges = 0; + for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { + if (F->isDeclaration()) continue; + // Reserve space for (0,entry) edge. + ++NumEdges; + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { + // Keep track of which blocks need to be instrumented. We don't want to + // instrument blocks that are added as the result of breaking critical + // edges! + BlocksToInstrument.insert(BB); + if (BB->getTerminator()->getNumSuccessors() == 0) { + // Reserve space for (BB,0) edge. + ++NumEdges; + } else { + NumEdges += BB->getTerminator()->getNumSuccessors(); + } + } + } + + const Type *Int32 = Type::getInt32Ty(M.getContext()); + const ArrayType *ATy = ArrayType::get(Int32, NumEdges); + GlobalVariable *Counters = + new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage, + Constant::getNullValue(ATy), "OptEdgeProfCounters"); + NumEdgesInserted = 0; + + std::vector Initializer(NumEdges); + Constant* zeroc = ConstantInt::get(Int32, 0); + Constant* minusonec = ConstantInt::get(Int32, ProfileInfo::MissingValue); + + // Instrument all of the edges not in MST... + unsigned i = 0; + for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { + if (F->isDeclaration()) continue; + DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); + + PI = &getAnalysisID(ProfileEstimatorPassID,*F); + MaximumSpanningTree MST = MaximumSpanningTree(&(*F),PI,true); + + // Create counter for (0,entry) edge. + BasicBlock *entry = &(F->getEntryBlock()); + ProfileInfo::Edge edge = ProfileInfo::getEdge(0,entry); + if (std::binary_search(MST.begin(),MST.end(),edge)) { + printEdgeCounter(edge,entry,i); + IncrementCounterInBlock(entry, i, Counters); NumEdgesInserted++; + Initializer[i++] = (zeroc); + } else{ + Initializer[i++] = (minusonec); + } + + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { + if (!BlocksToInstrument.count(BB)) continue; // Don't count new blocks + // Okay, we have to add a counter of each outgoing edge not in MST. If + // the outgoing edge is not critical don't split it, just insert the + // counter in the source or destination of the edge. + TerminatorInst *TI = BB->getTerminator(); + if (TI->getNumSuccessors() == 0) { + // Create counter for (BB,0), edge. + ProfileInfo::Edge edge = ProfileInfo::getEdge(BB,0); + if (std::binary_search(MST.begin(),MST.end(),edge)) { + printEdgeCounter(edge,BB,i); + IncrementCounterInBlock(BB, i, Counters); NumEdgesInserted++; + Initializer[i++] = (zeroc); + } else{ + Initializer[i++] = (minusonec); + } + } + for (unsigned s = 0, e = TI->getNumSuccessors(); s != e; ++s) { + BasicBlock *Succ = TI->getSuccessor(s); + ProfileInfo::Edge edge = ProfileInfo::getEdge(BB,Succ); + if (std::binary_search(MST.begin(),MST.end(),edge)) { + + // If the edge is critical, split it. + SplitCriticalEdge(TI,s,this); + Succ = TI->getSuccessor(s); + + // Okay, we are guaranteed that the edge is no longer critical. If we + // only have a single successor, insert the counter in this block, + // otherwise insert it in the successor block. + if (TI->getNumSuccessors() == 1) { + // Insert counter at the start of the block + printEdgeCounter(edge,BB,i); + IncrementCounterInBlock(BB, i, Counters); NumEdgesInserted++; + } else { + // Insert counter at the start of the block + printEdgeCounter(edge,Succ,i); + IncrementCounterInBlock(Succ, i, Counters); NumEdgesInserted++; + } + Initializer[i++] = (zeroc); + } else { + Initializer[i++] = (minusonec); + } + } + } + } + + // check if indeed all counters have been used + assert(i==NumEdges && "the number of edges in counting array is wrong"); + + // assign initialiser to array + Constant *init = ConstantArray::get(ATy, Initializer); + Counters->setInitializer(init); + + // Add the initialization call to main. + InsertProfilingInitCall(Main, "llvm_start_opt_edge_profiling", Counters); + return true; +} + Added: llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c?rev=80712&view=auto ============================================================================== --- llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c (added) +++ llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c Tue Sep 1 14:03:44 2009 @@ -0,0 +1,45 @@ +/*===-- OptimalEdgeProfiling.c - Support library for opt. edge profiling --===*\ +|* +|* 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 call back routines for the edge profiling +|* instrumentation pass. This should be used with the +|* -insert-opt-edge-profiling LLVM pass. +|* +\*===----------------------------------------------------------------------===*/ + +#include "Profiling.h" +#include + +static unsigned *ArrayStart; +static unsigned NumElements; + +/* OptEdgeProfAtExitHandler - When the program exits, just write out the + * profiling data. + */ +static void OptEdgeProfAtExitHandler() { + /* Note that, although the array has a counter for each edge, not all + * counters are updated, the ones that are not used are initialised with -1. + * When loading this information the counters with value -1 have to be + * recalculated, it is guranteed that this is possible. + */ + write_profiling_data(OptEdgeInfo, ArrayStart, NumElements); +} + + +/* llvm_start_opt_edge_profiling - This is the main entry point of the edge + * profiling library. It is responsible for setting up the atexit handler. + */ +int llvm_start_opt_edge_profiling(int argc, const char **argv, + unsigned *arrayStart, unsigned numElements) { + int Ret = save_arguments(argc, argv); + ArrayStart = arrayStart; + NumElements = numElements; + atexit(OptEdgeProfAtExitHandler); + return Ret; +} Modified: llvm/trunk/runtime/libprofile/exported_symbols.lst URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/exported_symbols.lst?rev=80712&r1=80711&r2=80712&view=diff ============================================================================== --- llvm/trunk/runtime/libprofile/exported_symbols.lst (original) +++ llvm/trunk/runtime/libprofile/exported_symbols.lst Tue Sep 1 14:03:44 2009 @@ -2,5 +2,6 @@ llvm_start_func_profiling llvm_start_block_profiling llvm_start_edge_profiling +llvm_start_opt_edge_profiling llvm_start_basic_block_tracing llvm_trace_basic_block From astifter at gmx.at Tue Sep 1 14:05:58 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 19:05:58 -0000 Subject: [llvm-commits] [llvm] r80713 - in /llvm/trunk/include/llvm: LinkAllPasses.h Transforms/Instrumentation.h Message-ID: <200909011905.n81J5wHX028452@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 14:05:58 2009 New Revision: 80713 URL: http://llvm.org/viewvc/llvm-project?rev=80713&view=rev Log: Addedum to r80712, forgot to add files. Modified: llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Transforms/Instrumentation.h Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=80713&r1=80712&r2=80713&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Tue Sep 1 14:05:58 2009 @@ -64,6 +64,7 @@ (void) llvm::createDeadStoreEliminationPass(); (void) llvm::createDeadTypeEliminationPass(); (void) llvm::createEdgeProfilerPass(); + (void) llvm::createOptimalEdgeProfilerPass(); (void) llvm::createFunctionInliningPass(); (void) llvm::createAlwaysInlinerPass(); (void) llvm::createFunctionProfilerPass(); Modified: llvm/trunk/include/llvm/Transforms/Instrumentation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=80713&r1=80712&r2=80713&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Instrumentation.h (original) +++ llvm/trunk/include/llvm/Transforms/Instrumentation.h Tue Sep 1 14:05:58 2009 @@ -28,6 +28,9 @@ // Insert edge profiling instrumentation ModulePass *createEdgeProfilerPass(); +// Insert optimal edge profiling instrumentation +ModulePass *createOptimalEdgeProfilerPass(); + // Random Sampling Profiling Framework ModulePass* createNullProfilerRSPass(); FunctionPass* createRSProfilingPass(); From astifter at gmx.at Tue Sep 1 14:08:51 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 19:08:51 -0000 Subject: [llvm-commits] [llvm] r80715 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoLoader.h lib/Analysis/ProfileInfoLoader.cpp lib/Analysis/ProfileInfoLoaderPass.cpp Message-ID: <200909011908.n81J8p9c028897@zion.cs.uiuc.edu> Author: astifter Date: Tue Sep 1 14:08:51 2009 New Revision: 80715 URL: http://llvm.org/viewvc/llvm-project?rev=80715&view=rev Log: OptimalEdgeProfiling: Reading in Profiles. This enables LLVM to read the OptimalEdgeProfiles. Modified: llvm/trunk/include/llvm/Analysis/ProfileInfoLoader.h llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Modified: llvm/trunk/include/llvm/Analysis/ProfileInfoLoader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileInfoLoader.h?rev=80715&r1=80714&r2=80715&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ProfileInfoLoader.h (original) +++ llvm/trunk/include/llvm/Analysis/ProfileInfoLoader.h Tue Sep 1 14:08:51 2009 @@ -33,6 +33,7 @@ std::vector FunctionCounts; std::vector BlockCounts; std::vector EdgeCounts; + std::vector OptimalEdgeCounts; std::vector BBTrace; bool Warned; public: @@ -66,6 +67,14 @@ const std::vector &getRawEdgeCounts() const { return EdgeCounts; } + + // getEdgeOptimalCounts - This method is used by consumers of optimal edge + // counting information. + // + const std::vector &getRawOptimalEdgeCounts() const { + return OptimalEdgeCounts; + } + }; } // End llvm namespace Modified: llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp?rev=80715&r1=80714&r2=80715&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp Tue Sep 1 14:08:51 2009 @@ -54,17 +54,34 @@ exit(1); } - // Make sure we have enough space... + // Make sure we have enough space... The space is initialised to -1 to + // facitiltate the loading of missing values for OptimalEdgeProfiling. if (Data.size() < NumEntries) - Data.resize(NumEntries); + Data.resize(NumEntries, -1); // Accumulate the data we just read into the data. if (!ShouldByteSwap) { - for (unsigned i = 0; i != NumEntries; ++i) - Data[i] += TempSpace[i]; + for (unsigned i = 0; i != NumEntries; ++i) { + unsigned data = TempSpace[i]; + if (data != (unsigned)-1) { // only load data if its not MissingVal + if (Data[i] == (unsigned)-1) { + Data[i] = data; // if data is still initialised + } else { + Data[i] += data; + } + } + } } else { - for (unsigned i = 0; i != NumEntries; ++i) - Data[i] += ByteSwap(TempSpace[i], true); + for (unsigned i = 0; i != NumEntries; ++i) { + unsigned data = ByteSwap(TempSpace[i], true); + if (data != (unsigned)-1) { // only load data if its not MissingVal + if (Data[i] == (unsigned)-1) { + Data[i] = data; + } else { + Data[i] += data; + } + } + } } } @@ -127,6 +144,10 @@ ReadProfilingBlock(ToolName, F, ShouldByteSwap, EdgeCounts); break; + case OptEdgeInfo: + ReadProfilingBlock(ToolName, F, ShouldByteSwap, OptimalEdgeCounts); + break; + case BBTraceInfo: ReadProfilingBlock(ToolName, F, ShouldByteSwap, BBTrace); break; Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp?rev=80715&r1=80714&r2=80715&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Tue Sep 1 14:08:51 2009 @@ -11,7 +11,7 @@ // loads the information from a profile dump file. // //===----------------------------------------------------------------------===// - +#define DEBUG_TYPE "profile-loader" #include "llvm/BasicBlock.h" #include "llvm/InstrTypes.h" #include "llvm/Module.h" @@ -21,9 +21,17 @@ #include "llvm/Analysis/ProfileInfoLoader.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/CFG.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Format.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SmallSet.h" +#include using namespace llvm; +STATISTIC(NumEdgesRead, "The # of edges read."); + static cl::opt ProfileInfoFilename("profile-info-file", cl::init("llvmprof.out"), cl::value_desc("filename"), @@ -32,6 +40,8 @@ namespace { class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo { std::string Filename; + std::set SpanningTree; + std::set BBisUnvisited; public: static char ID; // Class identification, replacement for typeinfo explicit LoaderPass(const std::string &filename = "") @@ -47,6 +57,13 @@ return "Profiling information loader"; } + // recurseBasicBlock() - Calculates the edge weights for as much basic + // blocks as possbile. + virtual void recurseBasicBlock(const BasicBlock *BB); + virtual void readEdgeOrRemember(Edge, Edge&, unsigned &, unsigned &); + virtual void readOrRememberEdge(ProfileInfo::Edge, unsigned, + unsigned, Function*); + /// run - Load the profile information from the specified file. virtual bool runOnModule(Module &M); }; @@ -67,6 +84,90 @@ return new LoaderPass(Filename); } +void LoaderPass::readEdgeOrRemember(Edge edge, Edge &tocalc, + unsigned &uncalc, unsigned &count) { + double w; + if ((w = getEdgeWeight(edge)) == MissingValue) { + tocalc = edge; + uncalc++; + } else { + count+=w; + } +} + +// recurseBasicBlock - Visits all neighbours of a block and then tries to +// calculate the missing edge values. +void LoaderPass::recurseBasicBlock(const BasicBlock *BB) { + + // break recursion if already visited + if (BBisUnvisited.find(BB) == BBisUnvisited.end()) return; + BBisUnvisited.erase(BB); + if (!BB) return; + + for (succ_const_iterator bbi = succ_begin(BB), bbe = succ_end(BB); + bbi != bbe; ++bbi) { + recurseBasicBlock(*bbi); + } + for (pred_const_iterator bbi = pred_begin(BB), bbe = pred_end(BB); + bbi != bbe; ++bbi) { + recurseBasicBlock(*bbi); + } + + Edge edgetocalc; + unsigned uncalculated = 0; + + // collect weights of all incoming and outgoing edges, rememer edges that + // have no value + unsigned incount = 0; + SmallSet pred_visited; + pred_const_iterator bbi = pred_begin(BB), bbe = pred_end(BB); + if (bbi==bbe) { + readEdgeOrRemember(getEdge(0, BB),edgetocalc,uncalculated,incount); + } + for (;bbi != bbe; ++bbi) { + if (pred_visited.insert(*bbi)) { + readEdgeOrRemember(getEdge(*bbi, BB),edgetocalc,uncalculated,incount); + } + } + + unsigned outcount = 0; + SmallSet succ_visited; + succ_const_iterator sbbi = succ_begin(BB), sbbe = succ_end(BB); + if (sbbi==sbbe) { + readEdgeOrRemember(getEdge(BB, 0),edgetocalc,uncalculated,outcount); + } + for (;sbbi != sbbe; ++sbbi) { + if (succ_visited.insert(*sbbi)) { + readEdgeOrRemember(getEdge(BB, *sbbi),edgetocalc,uncalculated,outcount); + } + } + + // if exactly one edge weight was missing, calculate it and remove it from + // spanning tree + if (uncalculated == 1) { + if (incount < outcount) { + EdgeInformation[BB->getParent()][edgetocalc] = outcount-incount; + } else { + EdgeInformation[BB->getParent()][edgetocalc] = incount-outcount; + } + DEBUG(errs() << "--Calc Edge Counter for " << edgetocalc << ": " + << format("%g", getEdgeWeight(edgetocalc)) << "\n"); + SpanningTree.erase(edgetocalc); + } +} + +void LoaderPass::readOrRememberEdge(ProfileInfo::Edge e, + unsigned weight, unsigned ei, + Function *F) { + if (weight != (unsigned)MissingValue) { + EdgeInformation[F][e] += weight; + DEBUG(errs()<<"--Read Edge Counter for " << e + <<" (# "< 0) { + unsigned ei = 0; + for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { + if (F->isDeclaration()) continue; + DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); + if (ei < ECs.size()) { + readOrRememberEdge(getEdge(0,&F->getEntryBlock()), ECs[ei], ei, F); + ei++; + } + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { + TerminatorInst *TI = BB->getTerminator(); + if (TI->getNumSuccessors() == 0) { + if (ei < ECs.size()) { + readOrRememberEdge(getEdge(BB,0), ECs[ei], ei, F); ei++; + } + } + for (unsigned s = 0, e = TI->getNumSuccessors(); s != e; ++s) { + if (ei < ECs.size()) { + readOrRememberEdge(getEdge(BB,TI->getSuccessor(s)), ECs[ei], ei, F); + ei++; + } + } + } + while (SpanningTree.size() > 0) { +#if 0 + unsigned size = SpanningTree.size(); +#endif + BBisUnvisited.clear(); + for (std::set::iterator ei = SpanningTree.begin(), + ee = SpanningTree.end(); ei != ee; ++ei) { + BBisUnvisited.insert(ei->first); + BBisUnvisited.insert(ei->second); + } + while (BBisUnvisited.size() > 0) { + recurseBasicBlock(*BBisUnvisited.begin()); + } +#if 0 + if (SpanningTree.size() == size) { + DEBUG(errs()<<"{"); + for (std::set::iterator ei = SpanningTree.begin(), + ee = SpanningTree.end(); ei != ee; ++ei) { + DEBUG(errs()<<"("<<(ei->first?ei->first->getName():"0")<<"," + <<(ei->second?ei->second->getName():"0")<<"),"); + } + assert(0 && "No edge calculated!"); + } +#endif + } + } + if (ei != ECs.size()) { + errs() << "WARNING: profile information is inconsistent with " + << "the current program!\n"; + } + NumEdgesRead = ei; } BlockInformation.clear(); From evan.cheng at apple.com Tue Sep 1 14:24:50 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 12:24:50 -0700 Subject: [llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll In-Reply-To: References: <200909010418.n814Ie0Z024268@zion.cs.uiuc.edu> <30323D1C-7F02-4F6A-9ABD-9B5D5210DC8F@apple.com> Message-ID: <758EEFB4-1F9F-40B0-BBB9-6BC0F0DC528F@apple.com> On Sep 1, 2009, at 12:00 PM, Bob Wilson wrote: > > On Sep 1, 2009, at 11:43 AM, Evan Cheng wrote: >> Since you have already found the KillMO, there is no need to call >> removeVirtualRegisterKilled() which would scan the operands again. >> Just update LV varinfo and unset the kill marker. > > Oh, I see what you mean. That makes sense. > >> Let's consider a more extensive instead. How about something like >> this: >> >> 1. Scan an instruction. Look at all the operands. Keep a list of >> source registers that are tied to one or more def registers. >> 2. For each source register, track which def registers it is being >> tied to. It should also track the kill operand index. >> 3. Consider each source register. If it is only tied to one def >> register, we can consider performing the usual optimizations. If it >> is tied to multiple def, I don't think the current optimizations >> are useful. >> 4. If it is tied to multiple def, process it separately. For each >> of the tied def, add a copy (or remat the def). Move the kill >> marker to the last copy. >> >> This should make the code more understandable. > > That sounds like a good approach. I'll give it a try.... Thanks! Sorry to expand it into a bigger project. But I think this is the right way to go. Evan > >> >>> >>>> >>>> Since you are working on this code, could be please clean it up a >>>> bit. Can you factor this if statement: >>>> if (mi->getOperand(ti).isDead() && >>>> isSafeToDelete(mi, regB, TII, Kills)) { >>>> >>>> to a separate function? >>> >>> Like this (in the attached patch)? >> >> Sorry, I meant factoring out lines 827 to 880 to a separate function. > > Ah! (I knew I must have been missing something there.) I can > certainly take care of that. From bruno.cardoso at gmail.com Tue Sep 1 14:25:52 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 01 Sep 2009 19:25:52 -0000 Subject: [llvm-commits] [llvm] r80717 - /llvm/trunk/lib/CodeGen/ELFWriter.cpp Message-ID: <200909011925.n81JPqRf031369@zion.cs.uiuc.edu> Author: bruno Date: Tue Sep 1 14:25:52 2009 New Revision: 80717 URL: http://llvm.org/viewvc/llvm-project?rev=80717&view=rev Log: Fix ELF Writter related memory leaks Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=80717&r1=80716&r2=80717&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Tue Sep 1 14:25:52 2009 @@ -93,6 +93,24 @@ ELFWriter::~ELFWriter() { delete ElfCE; delete &OutContext; + + while(!SymbolList.empty()) { + delete SymbolList.back(); + SymbolList.pop_back(); + } + + while(!PrivateSyms.empty()) { + delete PrivateSyms.back(); + PrivateSyms.pop_back(); + } + + while(!SectionList.empty()) { + delete SectionList.back(); + SectionList.pop_back(); + } + + // Release the name mangler object. + delete Mang; Mang = 0; } // doInitialization - Emit the file header and all of the global variables for @@ -714,13 +732,6 @@ // Dump the sections and section table to the .o file. OutputSectionsAndSectionTable(); - // We are done with the abstract symbols. - SymbolList.clear(); - SectionList.clear(); - NumSections = 0; - - // Release the name mangler object. - delete Mang; Mang = 0; return false; } From bruno.cardoso at gmail.com Tue Sep 1 14:28:18 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 1 Sep 2009 16:28:18 -0300 Subject: [llvm-commits] [llvm] r75828 - in /llvm/trunk/lib: CodeGen/ELF.h CodeGen/ELFCodeEmitter.cpp CodeGen/ELFWriter.cpp CodeGen/ELFWriter.h Target/X86/X86ELFWriterInfo.cpp In-Reply-To: <275e64e40908191122g765aa929k6adb768b8809b2ee@mail.gmail.com> References: <200907152049.n6FKnAiE002699@zion.cs.uiuc.edu> <16e5fdf90907151621o45abc01dkc493c6e1fa9eed94@mail.gmail.com> <275e64e40907152033n32d71457p485084b17a6e856f@mail.gmail.com> <9a9942200908190944p52139527j576263a308a6678c@mail.gmail.com> <275e64e40908191122g765aa929k6adb768b8809b2ee@mail.gmail.com> Message-ID: <275e64e40909011228u6009262bof90b94a214f2d79f@mail.gmail.com> On Wed, Aug 19, 2009 at 3:22 PM, Bruno Cardoso Lopes wrote: > On Wed, Aug 19, 2009 at 1:44 PM, Reid Kleckner wrote: >> I just noticed that this patch introduces a memory leak for the ELFSym >> objects. ?When you clear out the vector, you need to delete all the >> pointers, or you could switch it back to being pass-by-value. > > Ok, I'll investigate it! Thanks Reid Hopefully fixed. :) -- Bruno Cardoso Lopes http://www.brunocardoso.cc From bruno.cardoso at gmail.com Tue Sep 1 14:29:32 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 1 Sep 2009 16:29:32 -0300 Subject: [llvm-commits] Add option to emit ELF symbol files for debugging the LLVM JIT with GDB In-Reply-To: <9a9942200909011138v325b0a35g3fe3d72b426585b5@mail.gmail.com> References: <001636284afcf4fa490471af918f@google.com> <9a9942200909011138v325b0a35g3fe3d72b426585b5@mail.gmail.com> Message-ID: <275e64e40909011229w6ae127e0i7fc6a67871d23e9c@mail.gmail.com> On Tue, Sep 1, 2009 at 3:38 PM, Reid Kleckner wrote: > Ping? ?Please review. ?My internship is over and I'd like to finish > this up before I start classes. You can remove the "leak comment" now > Reid > > On Fri, Aug 21, 2009 at 7:53 PM, wrote: >> Hello LLVM devs, >> >> I've been working on a debugging interface between GDB and LLVM, and I'd >> like to get comments on the LLVM side of the interface now that the GDB >> side has been committed. ?I don't plan to check this in until after the >> code freeze. ?Please take a look on Rietveld. ?I expect to iterate on >> this a couple more times. >> >> Here's the description of the change from Rietveld: >> --------------------- >> >> This patch implements the JIT side of the GDB JIT debugging interface >> that I added to GDB. ?To enable this feature, either build the JIT in >> debug mode to enable it by default or pass -jit-emit-debug to lli. >> >> Right now, the only debug information that this communicates to GDB is >> call frame information, since it's already being generated to support >> exceptions in the JIT. ?Eventually, when DWARF generation isn't tied so >> tightly to AsmPrinter, it will be easy to push that information to GDB >> through this interface. >> >> Here's a step-by-step breakdown of how the feature works: >> - The JIT generates the machine code and DWARF call frame info >> (.eh_frame/.debug_frame) for a function into memory. >> - The JIT copies that info into an in-memory ELF file with a symbol for >> the function. >> - The JIT creates a code entry pointing to the ELF buffer and adds it to >> a linked list hanging off of a global descriptor at a special symbol >> that GDB knows about. >> - The JIT calls a function marked noinline that GDB knows about and has >> put an internal breakpoint in. >> - GDB catches the breakpoint and reads the global descriptor to look for >> new code. >> - When sees there is new code, it reads the ELF from the inferior's >> memory and adds it to itself as an object file. >> - The JIT continues, and the next time we stop the program, we are able >> to produce a proper backtrace. >> >> Consider running the following program through the JIT: >> >> #include >> void baz(short z) { >> ?long w = z + 1; >> ?printf("%d, %x\n", w, *((int*)NULL)); ?// SEGFAULT here >> } >> void bar(short y) { >> ?int z = y + 1; >> ?baz(z); >> } >> void foo(char x) { >> ?short y = x + 1; >> ?bar(y); >> } >> int main(int argc, char** argv) { >> ?char x = 1; >> ?foo(x); >> } >> >> Here is a backtrace before this patch: >> Program received signal SIGSEGV, Segmentation fault. >> [Switching to Thread 0x2aaaabdfbd10 (LWP 25476)] >> 0x00002aaaabe7d1a8 in ?? () >> (gdb) bt >> #0 ?0x00002aaaabe7d1a8 in ?? () >> #1 ?0x0000000000000003 in ?? () >> #2 ?0x0000000000000004 in ?? () >> #3 ?0x00032aaaabe7cfd0 in ?? () >> #4 ?0x00002aaaabe7d12c in ?? () >> #5 ?0x00022aaa00000003 in ?? () >> #6 ?0x00002aaaabe7d0aa in ?? () >> #7 ?0x01000002abe7cff0 in ?? () >> #8 ?0x00002aaaabe7d02c in ?? () >> #9 ?0x0100000000000001 in ?? () >> #10 0x00000000014388e0 in ?? () >> #11 0x00007fff00000001 in ?? () >> #12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, >> F=0x14024e0, ArgValues=@0x7fffffffe050) >> ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 >> #13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain >> (this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0) >> ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 >> #14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398, >> envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 >> >> And a backtrace after this patch: >> Program received signal SIGSEGV, Segmentation fault. >> 0x00002aaaabe7d1a8 in baz () >> (gdb) bt >> #0 ?0x00002aaaabe7d1a8 in baz () >> #1 ?0x00002aaaabe7d12c in bar () >> #2 ?0x00002aaaabe7d0aa in foo () >> #3 ?0x00002aaaabe7d02c in main () >> #4 ?0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, >> F=0x14024e0, ArgValues=...) >> ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 >> #5 ?0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain >> (this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0) >> ? at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 >> #6 ?0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8, >> envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 >> >> ---------------- >> >> Thanks! >> Reid >> >> http://codereview.appspot.com/91042 >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- Bruno Cardoso Lopes http://www.brunocardoso.cc From baldrick at free.fr Tue Sep 1 14:59:33 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Sep 2009 21:59:33 +0200 Subject: [llvm-commits] [llvm] r80695 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <200909011813.n81IDetT020790@zion.cs.uiuc.edu> References: <200909011813.n81IDetT020790@zion.cs.uiuc.edu> Message-ID: <4A9D7D25.3090103@free.fr> Hi Chris, > simpler solution to iterator invalidation "problem" found > by expensive checking. nice try, I tried it too :) Sadly, it's not enough to beat the expensive checking :( > + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ){ > // If this call site is null, then the function pass deleted the call > - // entirely and the WeakVH nulled it out. > + // entirely and the WeakVH nulled it out. > if (I->first == 0 || > // If we've already seen this call site, then the FunctionPass RAUW'd > // one call with another, which resulted in two "uses" in the edge > @@ -168,13 +163,13 @@ Suppose I was the last element. Then since at this point you just deleted the last element, I is now a "singular" iterator. > E = CGN->end(); > continue; Here you do "I != E", comparing a singular iterator with E. The expensive checking thinks doing a comparison (or anything else, such as assignment) with a singular iterator is naughty, and barfs. Because of this issue you are pretty much forced to check if I+1==E before doing the deletion, which is the essence of what my patch did. I don't like my patch either, but there you go. Ciao, Duncan. PS: With your patch applied: FAIL: /home/duncan/LLVM/llvm.top/llvm/test/Transforms/Inline/crash.ll Failed with signal(SIGABRT) at line 1 while running: llvm-as < /home/duncan/LLVM/llvm.top/llvm/test/Transforms/Inline/crash.ll | opt -inline -argpromotion -instcombine -disable-output /usr/include/c++/4.4/debug/safe_iterator.h:460:error: attempt to compare a singular iterator to a past-the-end iterator. FAIL: /home/duncan/LLVM/llvm.top/llvm/test/Transforms/LoopIndexSplit/non-iv-cmp-operand.ll for PR4471 Failed with signal(SIGABRT) at line 1 while running: llvm-as < /home/duncan/LLVM/llvm.top/llvm/test/Transforms/LoopIndexSplit/non-iv-cmp-operand.ll | opt -inline -reassociate -loop-rotate -loop-index-split -indvars -simplifycfg -verify /usr/include/c++/4.4/debug/safe_iterator.h:460:error: attempt to compare a singular iterator to a past-the-end iterator. From astifter-llvm at gmx.at Tue Sep 1 15:17:54 2009 From: astifter-llvm at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 22:17:54 +0200 Subject: [llvm-commits] [llvm] r80712 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoTypes.h lib/Transforms/Instrumentation/CMakeLists.txt lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp runtime/libprofile/OptimalEdgeProfiling.c runtime/libprofile/exported_symbols.lst In-Reply-To: <200909011903.n81J3iEN028095@zion.cs.uiuc.edu> References: <200909011903.n81J3iEN028095@zion.cs.uiuc.edu> Message-ID: <4A9D8172.5030207@gmx.at> Hi, since this is quite a big patch, I will give a quick walk-trough. Andreas Neustifter wrote: > [...[ > Modified: llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h?rev=80712&r1=80711&r2=80712&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h (original) > +++ llvm/trunk/include/llvm/Analysis/ProfileInfoTypes.h Tue Sep 1 14:03:44 2009 > @@ -22,7 +22,8 @@ > BlockInfo = 3, /* Block profiling information */ > EdgeInfo = 4, /* Edge profiling information */ > PathInfo = 5, /* Path profiling information */ > - BBTraceInfo = 6 /* Basic block trace information */ > + BBTraceInfo = 6, /* Basic block trace information */ > + OptEdgeInfo = 7 /* Edge profiling information, optimal version */ > }; > > #endif /* LLVM_ANALYSIS_PROFILEINFOTYPES_H */ > This simply adds a new ID for the fields in the llvmprof.out (the profiling output). > [...] > Added: llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp?rev=80712&view=auto > > [...] > +inline static void printEdgeCounter(ProfileInfo::Edge e, > + BasicBlock* b, > + unsigned i) { > + DEBUG(errs() << "--Edge Counter for " << (e) << " in " \ > + << ((b)?(b)->getNameStr():"0") << " (# " << (i) << ")\n"); > +} A function to print out debug info, this is used several times in the code so its factored out. > +bool OptimalEdgeProfiler::runOnModule(Module &M) { > + Function *Main = M.getFunction("main"); > + if (Main == 0) { > + errs() << "WARNING: cannot insert edge profiling into a module" > + << " with no main function!\n"; > + return false; // No main, no instrumentation! > + } > + > + std::set BlocksToInstrument; > + unsigned NumEdges = 0; > + for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { > + if (F->isDeclaration()) continue; > + // Reserve space for (0,entry) edge. > + ++NumEdges; > + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { > + // Keep track of which blocks need to be instrumented. We don't want to > + // instrument blocks that are added as the result of breaking critical > + // edges! > + BlocksToInstrument.insert(BB); > + if (BB->getTerminator()->getNumSuccessors() == 0) { > + // Reserve space for (BB,0) edge. > + ++NumEdges; > + } else { > + NumEdges += BB->getTerminator()->getNumSuccessors(); > + } > + } > + } Okay, so here it gets interessting: The BlocksToInstrument stores all blocks that are in the function prior to instrumenting, since the spliting of critical edges adds new blocks (which have not to be instrumented), we have to remember them for later. NumEdges counts all the edges that may be instrumented. Later on its decided which edges to actually instrument, to achieve optimal profiling. For the entry block a virtual edge (0,entry) is reserved, for each block with no successors an edge (BB,0) is reserved. These edges are necessary to calculate a truly optimal maximum spanning tree and thus an optimal instrumentation. > + const Type *Int32 = Type::getInt32Ty(M.getContext()); > + const ArrayType *ATy = ArrayType::get(Int32, NumEdges); > + GlobalVariable *Counters = > + new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage, > + Constant::getNullValue(ATy), "OptEdgeProfCounters"); > + NumEdgesInserted = 0; > + > + std::vector Initializer(NumEdges); > + Constant* zeroc = ConstantInt::get(Int32, 0); > + Constant* minusonec = ConstantInt::get(Int32, ProfileInfo::MissingValue); In the profiling output a counter for each edge is reserved, but only few are used. This is done to be able to read in the profile without calulating the maximum spanning tree again, instead each edge counter that is not used is initialised with -1 to signal that this edge counter has to be calculated from other edge counters on reading the profile info back in. > + // Instrument all of the edges not in MST... > + unsigned i = 0; > + for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { > + if (F->isDeclaration()) continue; > + DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); > + > + PI = &getAnalysisID(ProfileEstimatorPassID,*F); > + MaximumSpanningTree MST = MaximumSpanningTree(&(*F),PI,true); Calculate a Maximum Spanning Tree with the edge weights determined by ProfileEstimator. ProfileEstimator also assign weights to the virtual edges (0,entry) and (BB,0) (for blocks with no successors) and this edges also participate in the maximum spanning tree calculation. The third parameter of MaximumSpanningTree() has the effect that not the actual MST is returned but the edges _not_ in the MST. > + // Create counter for (0,entry) edge. > + BasicBlock *entry = &(F->getEntryBlock()); > + ProfileInfo::Edge edge = ProfileInfo::getEdge(0,entry); > + if (std::binary_search(MST.begin(),MST.end(),edge)) { > + printEdgeCounter(edge,entry,i); > + IncrementCounterInBlock(entry, i, Counters); NumEdgesInserted++; > + Initializer[i++] = (zeroc); > + } else{ > + Initializer[i++] = (minusonec); > + } Check if (0,entry) not in the MST (and thus its in the MST set). If not, instrument edge (IncrementCounterInBlock()) and set the counter initially to zero, if the edge is in the MST the counter is initialised to -1. (Note to self: Okay, this source code is really hard to read, I have to change that.) > + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { > + if (!BlocksToInstrument.count(BB)) continue; // Don't count new blocks Here its checked if the block was in the function initially or if it was introduced by SplitCriticalEdge(). (Note to self: Maybe its easier to store blocks that are introduced instead of the initial blocks in the function.) > + // Okay, we have to add a counter of each outgoing edge not in MST. If > + // the outgoing edge is not critical don't split it, just insert the > + // counter in the source or destination of the edge. > + TerminatorInst *TI = BB->getTerminator(); > + if (TI->getNumSuccessors() == 0) { > + // Create counter for (BB,0), edge. > + ProfileInfo::Edge edge = ProfileInfo::getEdge(BB,0); > + if (std::binary_search(MST.begin(),MST.end(),edge)) { > + printEdgeCounter(edge,BB,i); > + IncrementCounterInBlock(BB, i, Counters); NumEdgesInserted++; > + Initializer[i++] = (zeroc); > + } else{ > + Initializer[i++] = (minusonec); > + } Same as for (0,entry) but for (BB,0) in case the block has no successors. > + } > + for (unsigned s = 0, e = TI->getNumSuccessors(); s != e; ++s) { Iterate for each Block over the exiting edges, this ensures that each edge is visited. > + BasicBlock *Succ = TI->getSuccessor(s); > + ProfileInfo::Edge edge = ProfileInfo::getEdge(BB,Succ); > + if (std::binary_search(MST.begin(),MST.end(),edge)) { > + > + // If the edge is critical, split it. > + SplitCriticalEdge(TI,s,this); > + Succ = TI->getSuccessor(s); > + > + // Okay, we are guaranteed that the edge is no longer critical. If we > + // only have a single successor, insert the counter in this block, > + // otherwise insert it in the successor block. > + if (TI->getNumSuccessors() == 1) { > + // Insert counter at the start of the block > + printEdgeCounter(edge,BB,i); > + IncrementCounterInBlock(BB, i, Counters); NumEdgesInserted++; > + } else { > + // Insert counter at the start of the block > + printEdgeCounter(edge,Succ,i); > + IncrementCounterInBlock(Succ, i, Counters); NumEdgesInserted++; > + } > + Initializer[i++] = (zeroc); > + } else { > + Initializer[i++] = (minusonec); > + } > + } Each edge that is not in MST (and thus in set MST, how weird is that...), has to be checked if its an critical edge. If yes, it is split because we need a block right on this edge to put the counter in, otherwise the counter is placed in the source or destination block. > + } > + } > + > + // check if indeed all counters have been used > + assert(i==NumEdges && "the number of edges in counting array is wrong"); Check if the number of edges counted at first was the number of edges we considered for instrumentation. > + // assign initialiser to array > + Constant *init = ConstantArray::get(ATy, Initializer); > + Counters->setInitializer(init); At last the created initialiser is assigned to the counter array. > + > + // Add the initialization call to main. > + InsertProfilingInitCall(Main, "llvm_start_opt_edge_profiling", Counters); This places the call to the runtime library into the byte code that manages the initialisation and writing of the llvmprof.out file. > [...] > Added: llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/OptimalEdgeProfiling.c?rev=80712&view=auto This adds wrappers around the generic functions in CommonProfiling.c in the runtime library. > [...] > Modified: llvm/trunk/runtime/libprofile/exported_symbols.lst > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/exported_symbols.lst?rev=80712&r1=80711&r2=80712&view=diff Add the OptimalEdgeProfiling to the exported symbols of the profiling library. So thats it, I will plan on commenting the other commits tomorrow. Andi -- ========================================================================== This email is signed, for more information see http://web.student.tuwien.ac.at/~e0325716/gpg.html From edwintorok at gmail.com Tue Sep 1 15:20:35 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 01 Sep 2009 23:20:35 +0300 Subject: [llvm-commits] [llvm] r80712 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoTypes.h lib/Transforms/Instrumentation/CMakeLists.txt lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp runtime/libprofile/OptimalEdgeProfiling.c runtime/libprofile/exported_symbols.lst In-Reply-To: <4A9D8172.5030207@gmx.at> References: <200909011903.n81J3iEN028095@zion.cs.uiuc.edu> <4A9D8172.5030207@gmx.at> Message-ID: <4A9D8213.2000307@gmail.com> On 2009-09-01 23:17, Andreas Neustifter wrote: > Hi, > > since this is quite a big patch, I will give a quick walk-trough. > How about putting the relevant parts of this walk-through as comments in the code? That way when someone wants to modify this code, they don't have to dig up this thread explaining what it does ;) Best regards, --Edwin From rnk at mit.edu Tue Sep 1 15:32:57 2009 From: rnk at mit.edu (Reid Kleckner) Date: Tue, 1 Sep 2009 16:32:57 -0400 Subject: [llvm-commits] Add option to emit ELF symbol files for debugging the LLVM JIT with GDB In-Reply-To: <4A9D6F6A.5060609@gmail.com> References: <001636284afcf4fa490471af918f@google.com> <9a9942200909011138v325b0a35g3fe3d72b426585b5@mail.gmail.com> <4A9D6F6A.5060609@gmail.com> Message-ID: <9a9942200909011332p32c6ebbdi85a9bef2a5385768@mail.gmail.com> 2009/9/1 T?r?k Edwin : > On 2009-09-01 21:38, Reid Kleckner wrote: >> Ping? ?Please review. ?My internship is over and I'd like to finish >> this up before I start classes. >> >> Reid >> >> On Fri, Aug 21, 2009 at 7:53 PM, wrote: >> >>> Hello LLVM devs, >>> >>> I've been working on a debugging interface between GDB and LLVM, and I'd >>> like to get comments on the LLVM side of the interface now that the GDB >>> side has been committed. ?I don't plan to check this in until after the >>> code freeze. ?Please take a look on Rietveld. ?I expect to iterate on >>> this a couple more times. >>> >>> Here's the description of the change from Rietveld: >>> --------------------- >>> >>> This patch implements the JIT side of the GDB JIT debugging interface >>> that I added to GDB. ?To enable this feature, either build the JIT in >>> debug mode to enable it by default or pass -jit-emit-debug to lli. >>> >>> Right now, the only debug information that this communicates to GDB is >>> call frame information, since it's already being generated to support >>> exceptions in the JIT. ?Eventually, when DWARF generation isn't tied so >>> tightly to AsmPrinter, it will be easy to push that information to GDB >>> through this interface. >>> > > OProfileJITEventListener is already able to send file:line number > information > to oprofile. Although it does this via the opagent library, and doesn't > have to emit an ELF itself, > the debug info you need for line numbers is there. > I think there could be a global function in LLVM, that given an address > will print filename:sourceline info. > One could manually call that from gdb, just as you would call > Module->dump(), and could be an aid in debugging, > until full DWARF debug info can be emitted for JITed code. > This could be independent from your GDB <-> JIT interface, for example > as another JITEventListener. Speaking of which, the JITDebugRegisterer should be a JITEventListener. I think that would be useful for debugging, but for this change I'm mostly concerned with getting proper backtraces, since that is what you need to debug 95% of the time. >>> Here's a step-by-step breakdown of how the feature works: >>> - The JIT generates the machine code and DWARF call frame info >>> (.eh_frame/.debug_frame) for a function into memory. >>> - The JIT copies that info into an in-memory ELF file with a symbol for >>> the function. >>> > > It seems you create a new ELF for each function being JITed, could this > be a single ELF for the entire program? The interface supports multiple functions in the ELF, but since GDB can stop the program at any time, we figured it was best to tell GDB about each function as soon as it is created. GDB only needs the debug info when it tries to produce a trace or set a breakpoint, so it could be generated lazily, but we decided that this was more trouble than it was worth. Reid From sabre at nondot.org Tue Sep 1 15:33:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 20:33:43 -0000 Subject: [llvm-commits] [llvm] r80718 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909012033.n81KXhi2008003@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 15:33:43 2009 New Revision: 80718 URL: http://llvm.org/viewvc/llvm-project?rev=80718&view=rev Log: Fix a regression I introduced in r80708, found by llvm-test. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80718&r1=80717&r2=80718&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 15:33:43 2009 @@ -94,10 +94,10 @@ RefreshCallGraph(CurSCC, CG, false); CallGraphUpToDate = true; } - - StartPassTimer(P); + + StartPassTimer(CGSP); Changed = CGSP->runOnSCC(CurSCC); - StopPassTimer(P); + StopPassTimer(CGSP); // After the CGSCCPass is done, when assertions are enabled, use // RefreshCallGraph to verify that the callgraph was correctly updated. @@ -227,8 +227,15 @@ CalleeNode = CG.getOrInsertFunction(Callee); else CalleeNode = CG.getCallsExternalNode(); - - ExistingIt->second = CalleeNode; + + // Update the edge target in CGN. + for (CallGraphNode::iterator I = CGN->begin(); ; ++I) { + assert(I != CGN->end() && "Didn't find call entry"); + if (I->first == CS.getInstruction()) { + I->second = CalleeNode; + break; + } + } MadeChange = true; continue; } From grosbach at apple.com Tue Sep 1 15:39:24 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 13:39:24 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> Message-ID: On Sep 1, 2009, at 10:23 AM, Jim Grosbach wrote: > > On Sep 1, 2009, at 9:57 AM, Evan Cheng wrote: > >> >> On Sep 1, 2009, at 7:58 AM, Jim Grosbach wrote: >> >>> O >>>> >>>> >>>> Is this necessary? DwarfException should be using SubprogramCount, >>>> no? >>> >>> I'd turn the question around. Why is DwarfException adding its own >>> function counter when one is already available? Is there a reason >>> we need two that are doing the same thing? >> >> These counters should stay private within the class. It's >> implementation detail, not to be exposed publicly. DwarfException >> and AsmPrinter counter do not have to be the same, right? > > I could use FunctionNumber in the ARM AsmPrinter, and then use > SubprogramCount in the DwarfException printer. That makes me nervous, > though, as there's no guarantee, beyond details of the implementation, > that those two values will always stay in sync. It would introduce an > additional level of coupling between the two that I'd prefer to avoid. > > Note that the SubprogramCount is not visible to the containing > AsmPrinter, either. In the ARM AsmPrinter, the DwarfException is > opaque. Exposing that value to the rest of the AsmPrinter would be > more significant changes than exposing the FunctionNumber. > > I want to make sure that both bits of code pulled the information from > the same place. Exposing the FunctionNumber seems the way to do that. > Just to clarify and make sure we're on the same page... I do agree that exposing getFunctionNumber() is not a perfect solution. I just think relying on the SubprogramCount staying in sync with the FunctionNumber is even less attractive. I would prefer to have a single source for that information rather than duplicating the counter. I really don't have any strong feelings about where that belongs. Exposing getFunctionNumber() was simply the least intrusive mechanism. Perhaps there's an appropriate place for a private API that both the AsmPrinter and the DwarfWriter can use? If you have a preference for an alternative, I'm glad to revisit and work things differently. -j > >> Evan >> >>> >>> The constant pool entry is part of the ARM AsmPrinter, which has >>> the getFunctionNumber() directly. It's the most straightforward >>> solution for the Dwarf writer to use the same interface to output >>> the table itself. >>> >>>> >>>> >>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>> AsmPrinters should >>>>> /// not normally call this, as the counter is automatically >>>>> bumped by >>>>> /// SetupMachineFunction. >>>>> >>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>> (original) >>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug >>>>> 31 20:57:56 2009 >>>>> @@ -25,9 +25,11 @@ >>>>> #include "llvm/Target/TargetOptions.h" >>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>> #include "llvm/Support/Dwarf.h" >>>>> +#include "llvm/Support/Mangler.h" >>>>> #include "llvm/Support/Timer.h" >>>>> #include "llvm/Support/raw_ostream.h" >>>>> #include "llvm/ADT/StringExtras.h" >>>>> +#include >>>>> using namespace llvm; >>>>> >>>>> static TimerGroup &getDwarfTimerGroup() { >>>>> @@ -599,9 +601,12 @@ >>>>> >>>>> EmitLabel("exception", SubprogramCount); >>>>> if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { >>>>> - std::string SjLjName = "_lsda_"; >>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>> + std::stringstream out; >>>>> + out << Asm->getFunctionNumber(); >>>> >>>> SubprogramCount? >>>> >>>>> + std::string LSDAName = >>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), >>>>> + Mangler::Private); >>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>> >>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>> Dwarf::EmitLabel to accommodate this, why not just do >>>> out << LSDAName << 0 << ":\n"; >>> >>> Simply consistency that labels get printed via EmitLabel. No strong >>> preference either way. I'll change it. >>> >>>> >>>> Evan >>>> >>>>> } >>>>> >>>>> // Emit the header. >>>>> >>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) >>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 >>>>> 20:57:56 2009 >>>>> @@ -43,21 +43,27 @@ >>>>> >>>>> /// PrintLabelName - Print label name in form used by Dwarf >>>>> writer. >>>>> /// >>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>>> const { >>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>> + bool ForcePrivate) const { >>>>> + if (ForcePrivate) >>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>> + O << Tag; >>>>> if (Number) O << Number; >>>>> } >>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>> - const char *Suffix) const { >>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>> + const char *Suffix, bool >>>>> ForcePrivate) const { >>>>> + if (ForcePrivate) >>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>> + O << Tag; >>>>> if (Number) O << Number; >>>>> O << Suffix; >>>>> } >>>>> >>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>> /// >>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { >>>>> - PrintLabelName(Tag, Number); >>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>> + bool ForcePrivate) const { >>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>> O << ":\n"; >>>>> } >>>>> >>>>> >>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >>>>> 20:57:56 2009 >>>>> @@ -100,16 +100,18 @@ >>>>> void PrintLabelName(const DWLabel &Label) const { >>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>> } >>>>> - void PrintLabelName(const char *Tag, unsigned Number) const; >>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>> - const char *Suffix) const; >>>>> + bool ForcePrivate = true) const; >>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>> + const char *Suffix, bool ForcePrivate = >>>>> true) const; >>>>> >>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>> /// >>>>> void EmitLabel(const DWLabel &Label) const { >>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>> } >>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>> + bool ForcePrivate = true) const; >>>>> >>>>> /// EmitReference - Emit a reference to a label. >>>>> /// >>>>> >>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) >>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 >>>>> 20:57:56 2009 >>>>> @@ -20,11 +20,12 @@ >>>>> using namespace llvm; >>>>> >>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>> unsigned id, >>>>> + ARMCP::ARMCPKind K, >>>>> unsigned char PCAdj, >>>>> const char *Modif, >>>>> bool AddCA) >>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>> >>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>> @@ -33,12 +34,12 @@ >>>>> const char *Modif, >>>>> bool AddCA) >>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >>>>> PCAdjust(PCAdj), >>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>> >>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const >>>>> char *Modif) >>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>> getContext())), >>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust >>>>> (0), >>>>> Modifier(Modif) {} >>>>> >>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>> (MachineConstantPool *CP, >>>>> >>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >>>>> 20:57:56 2009 >>>>> @@ -21,12 +21,20 @@ >>>>> class GlobalValue; >>>>> class LLVMContext; >>>>> >>>>> +namespace ARMCP { >>>>> + enum ARMCPKind { >>>>> + CPValue, >>>>> + CPLSDA >>>>> + }; >>>>> +} >>>>> + >>>>> /// ARMConstantPoolValue - ARM specific constantpool value. This >>>>> is used to >>>>> /// represent PC relative displacement between the address of the >>>>> load >>>>> /// instruction and the global value being loaded, i.e. (&GV-(LPIC >>>>> +8)). >>>>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>> const char *S; // ExtSymbol being loaded. >>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>> unsigned LabelId; // Label id of the load. >>>>> unsigned char PCAdjust; // Extra adjustment if constantpool is >>>>> pc relative. >>>>> // 8 for ARM, 4 for Thumb. >>>>> @@ -35,6 +43,7 @@ >>>>> >>>>> public: >>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >>>>> unsigned char PCAdj = 0, const char *Modifier >>>>> = NULL, >>>>> bool AddCurrentAddress = false); >>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, >>>>> @@ -52,6 +61,7 @@ >>>>> bool mustAddCurrentAddress() const { return AddCurrentAddress; } >>>>> unsigned getLabelId() const { return LabelId; } >>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>> >>>>> virtual unsigned getRelocationInfo() const { >>>>> // FIXME: This is conservatively claiming that these entries >>>>> require a >>>>> >>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>> 20:57:56 2009 >>>>> @@ -40,6 +40,7 @@ >>>>> #include "llvm/ADT/VectorExtras.h" >>>>> #include "llvm/Support/ErrorHandling.h" >>>>> #include "llvm/Support/MathExtras.h" >>>>> +#include >>>>> using namespace llvm; >>>>> >>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, >>>>> EVT &LocVT, >>>>> @@ -969,7 +970,8 @@ >>>>> // tBX takes a register source operand. >>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>> hasV5TOps()) { >>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>> - >>>>> ARMPCLabelIndex, 4); >>>>> + >>>>> ARMPCLabelIndex, >>>>> + >>>>> ARMCP::CPValue, 4); >>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>> (), 4); >>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>> @@ -1166,7 +1168,7 @@ >>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>> ARMConstantPoolValue *CPV = >>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>> - PCAdj, "tlsgd", true); >>>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>>> true); >>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); >>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >>>>> NULL, 0); >>>>> @@ -1208,7 +1210,7 @@ >>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>> ARMConstantPoolValue *CPV = >>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>> - PCAdj, "gottpoff", true); >>>>> + ARMCP::CPValue, PCAdj, >>>>> "gottpoff", true); >>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>> @@ -1284,7 +1286,7 @@ >>>>> else { >>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>> isThumb()?4:8); >>>>> ARMConstantPoolValue *CPV = >>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>> ARMCP::CPValue, PCAdj); >>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>> } >>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>> @@ -1375,10 +1377,6 @@ >>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>> } >>>>> case Intrinsic::eh_sjlj_lsda: { >>>>> - // blah. horrible, horrible hack with the forced magic name. >>>>> - // really need to clean this up. It belongs in the target- >>>>> independent >>>>> - // layer somehow that doesn't require the coupling with the >>>>> asm >>>>> - // printer. >>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>> EVT PtrVT = getPointerTy(); >>>>> DebugLoc dl = Op.getDebugLoc(); >>>>> @@ -1386,13 +1384,9 @@ >>>>> SDValue CPAddr; >>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>> - // Save off the LSDA name for the AsmPrinter to use when >>>>> it's time >>>>> - // to emit the table >>>>> - std::string LSDAName = "L_lsda_"; >>>>> - LSDAName += MF.getFunction()->getName(); >>>>> ARMConstantPoolValue *CPV = >>>>> - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str >>>>> (), >>>>> - ARMPCLabelIndex, PCAdj); >>>>> + new ARMConstantPoolValue(MF.getFunction(), ARMPCLabelIndex, >>>>> + ARMCP::CPLSDA, PCAdj); >>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>> SDValue Result = >>>>> >>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>> (original) >>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon >>>>> Aug 31 20:57:56 2009 >>>>> @@ -44,6 +44,7 @@ >>>>> #include "llvm/Support/MathExtras.h" >>>>> #include "llvm/Support/FormattedStream.h" >>>>> #include >>>>> +#include >>>>> using namespace llvm; >>>>> >>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>> @@ -159,8 +160,13 @@ >>>>> ARMConstantPoolValue *ACPV = static_cast >>>>> (MCPV); >>>>> GlobalValue *GV = ACPV->getGV(); >>>>> std::string Name; >>>>> - >>>>> - if (GV) { >>>>> + >>>>> + if (ACPV->isLSDA()) { >>>>> + std::stringstream out; >>>>> + out << getFunctionNumber(); >>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>> out.str(), >>>>> + Mangler::Private); >>>>> + } else if (GV) { >>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>> TM.getRelocationModel() == >>>>> Reloc::Static); >>>>> @@ -175,9 +181,7 @@ >>>>> else >>>>> GVNonLazyPtrs[SymName] = Name; >>>>> } >>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>> - Name = ACPV->getSymbol(); >>>>> - else >>>>> + } else >>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>> O << Name; >>>>> >>>>> >>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> ================================================================== >>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug >>>>> 31 20:57:56 2009 >>>>> @@ -0,0 +1,103 @@ >>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>> + >>>>> +%struct.A = type { i32* } >>>>> + >>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>> +entry: >>>>> + %save_filt.1 = alloca i32 ; >>>>> [#uses=2] >>>>> + %save_eptr.0 = alloca i8* ; >>>>> [#uses=2] >>>>> + %a = alloca %struct.A ; <%struct.A*> >>>>> [#uses=3] >>>>> + %eh_exception = alloca i8* ; >>>>> [#uses=5] >>>>> + %eh_selector = alloca i32 ; >>>>> [#uses=3] >>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>> [#uses=0] >>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>> + invoke arm_apcscc void @_Z3barv() >>>>> + to label %invcont unwind label %lpad >>>>> + >>>>> +invcont: ; preds = >>>>> %entry >>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>> + br label %return >>>>> + >>>>> +bb: ; preds = %ppad >>>>> + %eh_select = load i32* %eh_selector ; >>>>> [#uses=1] >>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>> + %eh_value = load i8** %eh_exception ; >>>>> [#uses=1] >>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>> [#uses=1] >>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>> [#uses=1] >>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>> + br label %Unwind >>>>> + >>>>> +return: ; preds = >>>>> %invcont >>>>> + ret void >>>>> + >>>>> +lpad: ; preds = >>>>> %entry >>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>> [#uses=1] >>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>> [#uses=1] >>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32 >>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to >>>>> i8*), i32 0) ; [#uses=1] >>>>> + store i32 %eh_select2, i32* %eh_selector >>>>> + br label %ppad >>>>> + >>>>> +ppad: ; preds = %lpad >>>>> + br label %bb >>>>> + >>>>> +Unwind: ; preds = %bb >>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>> [#uses=1] >>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>> + unreachable >>>>> +} >>>>> + >>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>> %this) { >>>>> +entry: >>>>> + %this_addr = alloca %struct.A* ; < >>>>> %struct.A**> [#uses=2] >>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>> [#uses=0] >>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>> [#uses=1] >>>>> + %1 = bitcast i8* %0 to i32* ; >>>>> [#uses=1] >>>>> + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>>>> [#uses=1] >>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>> [#uses=1] >>>>> + store i32* %1, i32** %3, align 4 >>>>> + br label %return >>>>> + >>>>> +return: ; preds = >>>>> %entry >>>>> + ret void >>>>> +} >>>>> + >>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>> + >>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) >>>>> nounwind { >>>>> +entry: >>>>> + %this_addr = alloca %struct.A* ; < >>>>> %struct.A**> [#uses=2] >>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>> [#uses=0] >>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>> + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>>>> [#uses=1] >>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>> [#uses=1] >>>>> + %2 = load i32** %1, align 4 ; >>>>> [#uses=1] >>>>> + %3 = bitcast i32* %2 to i8* ; >>>>> [#uses=1] >>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>> + br label %bb >>>>> + >>>>> +bb: ; preds = >>>>> %entry >>>>> + br label %return >>>>> + >>>>> +return: ; preds = %bb >>>>> + ret void >>>>> +} >>>>> +;CHECK: L_LSDA_1: >>>>> + >>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>> + >>>>> +declare arm_apcscc void @_Z3barv() >>>>> + >>>>> +declare i8* @llvm.eh.exception() nounwind >>>>> + >>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>> + >>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>> + >>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>> + >>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>> >>>>> >>>>> _______________________________________________ >>>>> 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 astifter-llvm at gmx.at Tue Sep 1 15:46:37 2009 From: astifter-llvm at gmx.at (Andreas Neustifter) Date: Tue, 01 Sep 2009 22:46:37 +0200 Subject: [llvm-commits] [llvm] r80712 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoTypes.h lib/Transforms/Instrumentation/CMakeLists.txt lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp runtime/libprofile/OptimalEdgeProfiling.c runtime/libprofile/exported_symbols.lst In-Reply-To: <4A9D8213.2000307@gmail.com> References: <200909011903.n81J3iEN028095@zion.cs.uiuc.edu> <4A9D8172.5030207@gmx.at> <4A9D8213.2000307@gmail.com> Message-ID: <4A9D882D.4050000@gmx.at> Hi! T?r?k Edwin wrote: > On 2009-09-01 23:17, Andreas Neustifter wrote: >> >> since this is quite a big patch, I will give a quick walk-trough. >> > > How about putting the relevant parts of this walk-through as comments in > the code? > That way when someone wants to modify this code, they don't have to dig > up this thread explaining what it does ;) I was actually thinking about this, its there an amount of comments in LLVM that is considered too much? If not I will indeed add this as comments. Andi -- ========================================================================== This email is signed, for more information see http://web.student.tuwien.ac.at/~e0325716/gpg.html From evan.cheng at apple.com Tue Sep 1 15:54:22 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 13:54:22 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> Message-ID: On Sep 1, 2009, at 1:39 PM, Jim Grosbach wrote: > > On Sep 1, 2009, at 10:23 AM, Jim Grosbach wrote: > >> >> On Sep 1, 2009, at 9:57 AM, Evan Cheng wrote: >> >>> >>> On Sep 1, 2009, at 7:58 AM, Jim Grosbach wrote: >>> >>>> O >>>>> >>>>> >>>>> Is this necessary? DwarfException should be using SubprogramCount, >>>>> no? >>>> >>>> I'd turn the question around. Why is DwarfException adding its own >>>> function counter when one is already available? Is there a reason >>>> we need two that are doing the same thing? >>> >>> These counters should stay private within the class. It's >>> implementation detail, not to be exposed publicly. DwarfException >>> and AsmPrinter counter do not have to be the same, right? >> >> I could use FunctionNumber in the ARM AsmPrinter, and then use >> SubprogramCount in the DwarfException printer. That makes me nervous, >> though, as there's no guarantee, beyond details of the >> implementation, >> that those two values will always stay in sync. It would introduce an >> additional level of coupling between the two that I'd prefer to >> avoid. >> >> Note that the SubprogramCount is not visible to the containing >> AsmPrinter, either. In the ARM AsmPrinter, the DwarfException is >> opaque. Exposing that value to the rest of the AsmPrinter would be >> more significant changes than exposing the FunctionNumber. >> >> I want to make sure that both bits of code pulled the information >> from >> the same place. Exposing the FunctionNumber seems the way to do that. >> > > Just to clarify and make sure we're on the same page... > > I do agree that exposing getFunctionNumber() is not a perfect > solution. I just think relying on the SubprogramCount staying in > sync with the FunctionNumber is even less attractive. > > I would prefer to have a single source for that information rather > than duplicating the counter. I really don't have any strong > feelings about where that belongs. Exposing getFunctionNumber() was > simply the least intrusive mechanism. Perhaps there's an appropriate > place for a private API that both the AsmPrinter and the DwarfWriter > can use? > > If you have a preference for an alternative, I'm glad to revisit and > work things differently. Can you give an example of what the .s looks like? I don't think I understand why the function number is needed. Evan > > -j > > > >> >>> Evan >>> >>>> >>>> The constant pool entry is part of the ARM AsmPrinter, which has >>>> the getFunctionNumber() directly. It's the most straightforward >>>> solution for the Dwarf writer to use the same interface to output >>>> the table itself. >>>> >>>>> >>>>> >>>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>>> AsmPrinters should >>>>>> /// not normally call this, as the counter is automatically >>>>>> bumped by >>>>>> /// SetupMachineFunction. >>>>>> >>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>> (original) >>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug >>>>>> 31 20:57:56 2009 >>>>>> @@ -25,9 +25,11 @@ >>>>>> #include "llvm/Target/TargetOptions.h" >>>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>>> #include "llvm/Support/Dwarf.h" >>>>>> +#include "llvm/Support/Mangler.h" >>>>>> #include "llvm/Support/Timer.h" >>>>>> #include "llvm/Support/raw_ostream.h" >>>>>> #include "llvm/ADT/StringExtras.h" >>>>>> +#include >>>>>> using namespace llvm; >>>>>> >>>>>> static TimerGroup &getDwarfTimerGroup() { >>>>>> @@ -599,9 +601,12 @@ >>>>>> >>>>>> EmitLabel("exception", SubprogramCount); >>>>>> if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { >>>>>> - std::string SjLjName = "_lsda_"; >>>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>>> + std::stringstream out; >>>>>> + out << Asm->getFunctionNumber(); >>>>> >>>>> SubprogramCount? >>>>> >>>>>> + std::string LSDAName = >>>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + >>>>>> out.str(), >>>>>> + Mangler::Private); >>>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>>> >>>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>>> Dwarf::EmitLabel to accommodate this, why not just do >>>>> out << LSDAName << 0 << ":\n"; >>>> >>>> Simply consistency that labels get printed via EmitLabel. No strong >>>> preference either way. I'll change it. >>>> >>>>> >>>>> Evan >>>>> >>>>>> } >>>>>> >>>>>> // Emit the header. >>>>>> >>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) >>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31 >>>>>> 20:57:56 2009 >>>>>> @@ -43,21 +43,27 @@ >>>>>> >>>>>> /// PrintLabelName - Print label name in form used by Dwarf >>>>>> writer. >>>>>> /// >>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>>>> const { >>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>> + bool ForcePrivate) const { >>>>>> + if (ForcePrivate) >>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>> + O << Tag; >>>>>> if (Number) O << Number; >>>>>> } >>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>> - const char *Suffix) const { >>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>> + const char *Suffix, bool >>>>>> ForcePrivate) const { >>>>>> + if (ForcePrivate) >>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>> + O << Tag; >>>>>> if (Number) O << Number; >>>>>> O << Suffix; >>>>>> } >>>>>> >>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>> /// >>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { >>>>>> - PrintLabelName(Tag, Number); >>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>>> + bool ForcePrivate) const { >>>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>>> O << ":\n"; >>>>>> } >>>>>> >>>>>> >>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >>>>>> 20:57:56 2009 >>>>>> @@ -100,16 +100,18 @@ >>>>>> void PrintLabelName(const DWLabel &Label) const { >>>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>>> } >>>>>> - void PrintLabelName(const char *Tag, unsigned Number) const; >>>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>>> - const char *Suffix) const; >>>>>> + bool ForcePrivate = true) const; >>>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>>> + const char *Suffix, bool ForcePrivate = >>>>>> true) const; >>>>>> >>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>> /// >>>>>> void EmitLabel(const DWLabel &Label) const { >>>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>>> } >>>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>>> + bool ForcePrivate = true) const; >>>>>> >>>>>> /// EmitReference - Emit a reference to a label. >>>>>> /// >>>>>> >>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) >>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31 >>>>>> 20:57:56 2009 >>>>>> @@ -20,11 +20,12 @@ >>>>>> using namespace llvm; >>>>>> >>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>> unsigned id, >>>>>> + ARMCP::ARMCPKind K, >>>>>> unsigned char PCAdj, >>>>>> const char *Modif, >>>>>> bool AddCA) >>>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>> >>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>>> @@ -33,12 +34,12 @@ >>>>>> const char *Modif, >>>>>> bool AddCA) >>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >>>>>> PCAdjust(PCAdj), >>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>> >>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const >>>>>> char *Modif) >>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>>> getContext())), >>>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust >>>>>> (0), >>>>>> Modifier(Modif) {} >>>>>> >>>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>>> (MachineConstantPool *CP, >>>>>> >>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >>>>>> 20:57:56 2009 >>>>>> @@ -21,12 +21,20 @@ >>>>>> class GlobalValue; >>>>>> class LLVMContext; >>>>>> >>>>>> +namespace ARMCP { >>>>>> + enum ARMCPKind { >>>>>> + CPValue, >>>>>> + CPLSDA >>>>>> + }; >>>>>> +} >>>>>> + >>>>>> /// ARMConstantPoolValue - ARM specific constantpool value. This >>>>>> is used to >>>>>> /// represent PC relative displacement between the address of the >>>>>> load >>>>>> /// instruction and the global value being loaded, i.e. (&GV- >>>>>> (LPIC >>>>>> +8)). >>>>>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>>> const char *S; // ExtSymbol being loaded. >>>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>>> unsigned LabelId; // Label id of the load. >>>>>> unsigned char PCAdjust; // Extra adjustment if constantpool is >>>>>> pc relative. >>>>>> // 8 for ARM, 4 for Thumb. >>>>>> @@ -35,6 +43,7 @@ >>>>>> >>>>>> public: >>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>>> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >>>>>> unsigned char PCAdj = 0, const char *Modifier >>>>>> = NULL, >>>>>> bool AddCurrentAddress = false); >>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, >>>>>> @@ -52,6 +61,7 @@ >>>>>> bool mustAddCurrentAddress() const { return AddCurrentAddress; } >>>>>> unsigned getLabelId() const { return LabelId; } >>>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>>> >>>>>> virtual unsigned getRelocationInfo() const { >>>>>> // FIXME: This is conservatively claiming that these entries >>>>>> require a >>>>>> >>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>>> 20:57:56 2009 >>>>>> @@ -40,6 +40,7 @@ >>>>>> #include "llvm/ADT/VectorExtras.h" >>>>>> #include "llvm/Support/ErrorHandling.h" >>>>>> #include "llvm/Support/MathExtras.h" >>>>>> +#include >>>>>> using namespace llvm; >>>>>> >>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, >>>>>> EVT &LocVT, >>>>>> @@ -969,7 +970,8 @@ >>>>>> // tBX takes a register source operand. >>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>>> hasV5TOps()) { >>>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>>> - >>>>>> ARMPCLabelIndex, 4); >>>>>> + >>>>>> ARMPCLabelIndex, >>>>>> + >>>>>> ARMCP::CPValue, 4); >>>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>>> (), 4); >>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>>> @@ -1166,7 +1168,7 @@ >>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>> ARMConstantPoolValue *CPV = >>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>> - PCAdj, "tlsgd", true); >>>>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>>>> true); >>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); >>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >>>>>> NULL, 0); >>>>>> @@ -1208,7 +1210,7 @@ >>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>> ARMConstantPoolValue *CPV = >>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>> - PCAdj, "gottpoff", true); >>>>>> + ARMCP::CPValue, PCAdj, >>>>>> "gottpoff", true); >>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>>> @@ -1284,7 +1286,7 @@ >>>>>> else { >>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>>> isThumb()?4:8); >>>>>> ARMConstantPoolValue *CPV = >>>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>>> ARMCP::CPValue, PCAdj); >>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>> } >>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>> @@ -1375,10 +1377,6 @@ >>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>>> } >>>>>> case Intrinsic::eh_sjlj_lsda: { >>>>>> - // blah. horrible, horrible hack with the forced magic name. >>>>>> - // really need to clean this up. It belongs in the target- >>>>>> independent >>>>>> - // layer somehow that doesn't require the coupling with the >>>>>> asm >>>>>> - // printer. >>>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>>> EVT PtrVT = getPointerTy(); >>>>>> DebugLoc dl = Op.getDebugLoc(); >>>>>> @@ -1386,13 +1384,9 @@ >>>>>> SDValue CPAddr; >>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>>> - // Save off the LSDA name for the AsmPrinter to use when >>>>>> it's time >>>>>> - // to emit the table >>>>>> - std::string LSDAName = "L_lsda_"; >>>>>> - LSDAName += MF.getFunction()->getName(); >>>>>> ARMConstantPoolValue *CPV = >>>>>> - new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str >>>>>> (), >>>>>> - ARMPCLabelIndex, PCAdj); >>>>>> + new ARMConstantPoolValue(MF.getFunction(), >>>>>> ARMPCLabelIndex, >>>>>> + ARMCP::CPLSDA, PCAdj); >>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>> SDValue Result = >>>>>> >>>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>> (original) >>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon >>>>>> Aug 31 20:57:56 2009 >>>>>> @@ -44,6 +44,7 @@ >>>>>> #include "llvm/Support/MathExtras.h" >>>>>> #include "llvm/Support/FormattedStream.h" >>>>>> #include >>>>>> +#include >>>>>> using namespace llvm; >>>>>> >>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>>> @@ -159,8 +160,13 @@ >>>>>> ARMConstantPoolValue *ACPV = static_cast >>>>>> (MCPV); >>>>>> GlobalValue *GV = ACPV->getGV(); >>>>>> std::string Name; >>>>>> - >>>>>> - if (GV) { >>>>>> + >>>>>> + if (ACPV->isLSDA()) { >>>>>> + std::stringstream out; >>>>>> + out << getFunctionNumber(); >>>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>>> out.str(), >>>>>> + Mangler::Private); >>>>>> + } else if (GV) { >>>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>>> TM.getRelocationModel() == >>>>>> Reloc::Static); >>>>>> @@ -175,9 +181,7 @@ >>>>>> else >>>>>> GVNonLazyPtrs[SymName] = Name; >>>>>> } >>>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>>> - Name = ACPV->getSymbol(); >>>>>> - else >>>>>> + } else >>>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>>> O << Name; >>>>>> >>>>>> >>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>>> >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> = >>>>>> ================================================================= >>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug >>>>>> 31 20:57:56 2009 >>>>>> @@ -0,0 +1,103 @@ >>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>>> + >>>>>> +%struct.A = type { i32* } >>>>>> + >>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>>> +entry: >>>>>> + %save_filt.1 = alloca i32 ; >>>>>> [#uses=2] >>>>>> + %save_eptr.0 = alloca i8* ; >>>>>> [#uses=2] >>>>>> + %a = alloca %struct.A ; <%struct.A*> >>>>>> [#uses=3] >>>>>> + %eh_exception = alloca i8* ; >>>>>> [#uses=5] >>>>>> + %eh_selector = alloca i32 ; >>>>>> [#uses=3] >>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>> [#uses=0] >>>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>>> + invoke arm_apcscc void @_Z3barv() >>>>>> + to label %invcont unwind label %lpad >>>>>> + >>>>>> +invcont: ; preds = >>>>>> %entry >>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>> + br label %return >>>>>> + >>>>>> +bb: ; preds = >>>>>> %ppad >>>>>> + %eh_select = load i32* %eh_selector ; >>>>>> [#uses=1] >>>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>>> + %eh_value = load i8** %eh_exception ; >>>>>> [#uses=1] >>>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>>> [#uses=1] >>>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>>> [#uses=1] >>>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>>> + br label %Unwind >>>>>> + >>>>>> +return: ; preds = >>>>>> %invcont >>>>>> + ret void >>>>>> + >>>>>> +lpad: ; preds = >>>>>> %entry >>>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>>> [#uses=1] >>>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>>> [#uses=1] >>>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32 >>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to >>>>>> i8*), i32 0) ; [#uses=1] >>>>>> + store i32 %eh_select2, i32* %eh_selector >>>>>> + br label %ppad >>>>>> + >>>>>> +ppad: ; preds = >>>>>> %lpad >>>>>> + br label %bb >>>>>> + >>>>>> +Unwind: ; preds = %bb >>>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>>> [#uses=1] >>>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>>> + unreachable >>>>>> +} >>>>>> + >>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>>> %this) { >>>>>> +entry: >>>>>> + %this_addr = alloca %struct.A* ; < >>>>>> %struct.A**> [#uses=2] >>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>> [#uses=0] >>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>>> [#uses=1] >>>>>> + %1 = bitcast i8* %0 to i32* ; >>>>>> [#uses=1] >>>>>> + %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>>>>> [#uses=1] >>>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>>> [#uses=1] >>>>>> + store i32* %1, i32** %3, align 4 >>>>>> + br label %return >>>>>> + >>>>>> +return: ; preds = >>>>>> %entry >>>>>> + ret void >>>>>> +} >>>>>> + >>>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>>> + >>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) >>>>>> nounwind { >>>>>> +entry: >>>>>> + %this_addr = alloca %struct.A* ; < >>>>>> %struct.A**> [#uses=2] >>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>> [#uses=0] >>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>> + %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> >>>>>> [#uses=1] >>>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>>> [#uses=1] >>>>>> + %2 = load i32** %1, align 4 ; >>>>>> [#uses=1] >>>>>> + %3 = bitcast i32* %2 to i8* ; >>>>>> [#uses=1] >>>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>>> + br label %bb >>>>>> + >>>>>> +bb: ; preds = >>>>>> %entry >>>>>> + br label %return >>>>>> + >>>>>> +return: ; preds = %bb >>>>>> + ret void >>>>>> +} >>>>>> +;CHECK: L_LSDA_1: >>>>>> + >>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>>> + >>>>>> +declare arm_apcscc void @_Z3barv() >>>>>> + >>>>>> +declare i8* @llvm.eh.exception() nounwind >>>>>> + >>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>>> + >>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>>> + >>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>>> + >>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> 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 grosbach at apple.com Tue Sep 1 16:18:29 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 14:18:29 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> Message-ID: <9CB9E538-BF9E-458A-B42D-2BF07831C571@apple.com> On Sep 1, 2009, at 1:54 PM, Evan Cheng wrote: > > On Sep 1, 2009, at 1:39 PM, Jim Grosbach wrote: > >> >> On Sep 1, 2009, at 10:23 AM, Jim Grosbach wrote: >> >>> >>> On Sep 1, 2009, at 9:57 AM, Evan Cheng wrote: >>> >>>> >>>> On Sep 1, 2009, at 7:58 AM, Jim Grosbach wrote: >>>> >>>>> O >>>>>> >>>>>> >>>>>> Is this necessary? DwarfException should be using >>>>>> SubprogramCount, >>>>>> no? >>>>> >>>>> I'd turn the question around. Why is DwarfException adding its own >>>>> function counter when one is already available? Is there a reason >>>>> we need two that are doing the same thing? >>>> >>>> These counters should stay private within the class. It's >>>> implementation detail, not to be exposed publicly. DwarfException >>>> and AsmPrinter counter do not have to be the same, right? >>> >>> I could use FunctionNumber in the ARM AsmPrinter, and then use >>> SubprogramCount in the DwarfException printer. That makes me >>> nervous, >>> though, as there's no guarantee, beyond details of the >>> implementation, >>> that those two values will always stay in sync. It would introduce >>> an >>> additional level of coupling between the two that I'd prefer to >>> avoid. >>> >>> Note that the SubprogramCount is not visible to the containing >>> AsmPrinter, either. In the ARM AsmPrinter, the DwarfException is >>> opaque. Exposing that value to the rest of the AsmPrinter would be >>> more significant changes than exposing the FunctionNumber. >>> >>> I want to make sure that both bits of code pulled the information >>> from >>> the same place. Exposing the FunctionNumber seems the way to do >>> that. >>> >> >> Just to clarify and make sure we're on the same page... >> >> I do agree that exposing getFunctionNumber() is not a perfect >> solution. I just think relying on the SubprogramCount staying in >> sync with the FunctionNumber is even less attractive. >> >> I would prefer to have a single source for that information rather >> than duplicating the counter. I really don't have any strong >> feelings about where that belongs. Exposing getFunctionNumber() was >> simply the least intrusive mechanism. Perhaps there's an >> appropriate place for a private API that both the AsmPrinter and >> the DwarfWriter can use? >> >> If you have a preference for an alternative, I'm glad to revisit >> and work things differently. > > Can you give an example of what the .s looks like? I don't think I > understand why the function number is needed. > Sure. Here's a snipped from a test case that contains the constant pool entry for the lsda (at LCPI7_0). At the end, the LSDA label which the constant pool entry is referencing is emitted. .align 2 LCPI7_0: .long L_LSDA_7-(LPC20+4) Leh_func_end5: .section __DATA,__gcc_except_tab .align 2 GCC_except_table5: .byte 0x0 @ Padding Lexception5: L_LSDA_7: .byte 0xFF @ @LPStart format (DW_EH_PE_omit) The labels suffixed by '5' are from the DwarfWriter using the SubprogramCount. The documentation entry for Subprogram counts is slightly inaccurate when it says it's a running count of all functions being compiled; it's actually a count only of those functions which emit EH information (in DwarfException::BeginFunction()). Thus, FunctionNumber and SubprogramCount do indeed get out of sync currently. There's nothing magic about using the FunctionNumber as the suffix. Anything that's a reproducible way to generate a unique one-per- function label name will do. Using the function name, even mangled, doesn't work well due to the strangeness that is Objective-C++, which is what gave rise to the current implementation. We could, for a silly example, generate a random string and use that for the label name so long as we could guarantee no repetition in the sequence. The name would need to either be easily rematerializable, or stored off someplace to be retrieved and used by the DwarfException table printer later. The latter would need a new API to support storing and retrieving the name. Keeping that properly hidden away is roughly equivalent to handling the FunctionNumber API reasonably. -Jim >>>> >>>>> >>>>> The constant pool entry is part of the ARM AsmPrinter, which has >>>>> the getFunctionNumber() directly. It's the most straightforward >>>>> solution for the Dwarf writer to use the same interface to output >>>>> the table itself. >>>>> >>>>>> >>>>>> >>>>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>>>> AsmPrinters should >>>>>>> /// not normally call this, as the counter is automatically >>>>>>> bumped by >>>>>>> /// SetupMachineFunction. >>>>>>> >>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>> (original) >>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug >>>>>>> 31 20:57:56 2009 >>>>>>> @@ -25,9 +25,11 @@ >>>>>>> #include "llvm/Target/TargetOptions.h" >>>>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>>>> #include "llvm/Support/Dwarf.h" >>>>>>> +#include "llvm/Support/Mangler.h" >>>>>>> #include "llvm/Support/Timer.h" >>>>>>> #include "llvm/Support/raw_ostream.h" >>>>>>> #include "llvm/ADT/StringExtras.h" >>>>>>> +#include >>>>>>> using namespace llvm; >>>>>>> >>>>>>> static TimerGroup &getDwarfTimerGroup() { >>>>>>> @@ -599,9 +601,12 @@ >>>>>>> >>>>>>> EmitLabel("exception", SubprogramCount); >>>>>>> if (MAI->getExceptionHandlingType() == >>>>>>> ExceptionHandling::SjLj) { >>>>>>> - std::string SjLjName = "_lsda_"; >>>>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>>>> + std::stringstream out; >>>>>>> + out << Asm->getFunctionNumber(); >>>>>> >>>>>> SubprogramCount? >>>>>> >>>>>>> + std::string LSDAName = >>>>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str >>>>>>> (), >>>>>>> + Mangler::Private); >>>>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>>>> >>>>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>>>> Dwarf::EmitLabel to accommodate this, why not just do >>>>>> out << LSDAName << 0 << ":\n"; >>>>> >>>>> Simply consistency that labels get printed via EmitLabel. No >>>>> strong >>>>> preference either way. I'll change it. >>>>> >>>>>> >>>>>> Evan >>>>>> >>>>>>> } >>>>>>> >>>>>>> // Emit the header. >>>>>>> >>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>> (original) >>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug >>>>>>> 31 >>>>>>> 20:57:56 2009 >>>>>>> @@ -43,21 +43,27 @@ >>>>>>> >>>>>>> /// PrintLabelName - Print label name in form used by Dwarf >>>>>>> writer. >>>>>>> /// >>>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>>>>> const { >>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>> + bool ForcePrivate) const { >>>>>>> + if (ForcePrivate) >>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>> + O << Tag; >>>>>>> if (Number) O << Number; >>>>>>> } >>>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>> - const char *Suffix) const { >>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>> + const char *Suffix, bool >>>>>>> ForcePrivate) const { >>>>>>> + if (ForcePrivate) >>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>> + O << Tag; >>>>>>> if (Number) O << Number; >>>>>>> O << Suffix; >>>>>>> } >>>>>>> >>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>>> /// >>>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { >>>>>>> - PrintLabelName(Tag, Number); >>>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>>>> + bool ForcePrivate) const { >>>>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>>>> O << ":\n"; >>>>>>> } >>>>>>> >>>>>>> >>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >>>>>>> 20:57:56 2009 >>>>>>> @@ -100,16 +100,18 @@ >>>>>>> void PrintLabelName(const DWLabel &Label) const { >>>>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>>>> } >>>>>>> - void PrintLabelName(const char *Tag, unsigned Number) >>>>>>> const; >>>>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>>>> - const char *Suffix) const; >>>>>>> + bool ForcePrivate = true) const; >>>>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>>>> + const char *Suffix, bool ForcePrivate = >>>>>>> true) const; >>>>>>> >>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>>> /// >>>>>>> void EmitLabel(const DWLabel &Label) const { >>>>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>>>> } >>>>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>>>> + bool ForcePrivate = true) const; >>>>>>> >>>>>>> /// EmitReference - Emit a reference to a label. >>>>>>> /// >>>>>>> >>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>> (original) >>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug >>>>>>> 31 >>>>>>> 20:57:56 2009 >>>>>>> @@ -20,11 +20,12 @@ >>>>>>> using namespace llvm; >>>>>>> >>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>> unsigned id, >>>>>>> + ARMCP::ARMCPKind K, >>>>>>> unsigned char PCAdj, >>>>>>> const char *Modif, >>>>>>> bool AddCA) >>>>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>> >>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>>>> @@ -33,12 +34,12 @@ >>>>>>> const char *Modif, >>>>>>> bool AddCA) >>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >>>>>>> PCAdjust(PCAdj), >>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>> >>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>> const >>>>>>> char *Modif) >>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>>>> getContext())), >>>>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust >>>>>>> (0), >>>>>>> Modifier(Modif) {} >>>>>>> >>>>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>>>> (MachineConstantPool *CP, >>>>>>> >>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >>>>>>> 20:57:56 2009 >>>>>>> @@ -21,12 +21,20 @@ >>>>>>> class GlobalValue; >>>>>>> class LLVMContext; >>>>>>> >>>>>>> +namespace ARMCP { >>>>>>> + enum ARMCPKind { >>>>>>> + CPValue, >>>>>>> + CPLSDA >>>>>>> + }; >>>>>>> +} >>>>>>> + >>>>>>> /// ARMConstantPoolValue - ARM specific constantpool value. This >>>>>>> is used to >>>>>>> /// represent PC relative displacement between the address of >>>>>>> the >>>>>>> load >>>>>>> /// instruction and the global value being loaded, i.e. (&GV- >>>>>>> (LPIC >>>>>>> +8)). >>>>>>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>>>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>>>> const char *S; // ExtSymbol being loaded. >>>>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>>>> unsigned LabelId; // Label id of the load. >>>>>>> unsigned char PCAdjust; // Extra adjustment if constantpool is >>>>>>> pc relative. >>>>>>> // 8 for ARM, 4 for Thumb. >>>>>>> @@ -35,6 +43,7 @@ >>>>>>> >>>>>>> public: >>>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>>>> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >>>>>>> unsigned char PCAdj = 0, const char *Modifier >>>>>>> = NULL, >>>>>>> bool AddCurrentAddress = false); >>>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, >>>>>>> @@ -52,6 +61,7 @@ >>>>>>> bool mustAddCurrentAddress() const { return AddCurrentAddress; } >>>>>>> unsigned getLabelId() const { return LabelId; } >>>>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>>>> >>>>>>> virtual unsigned getRelocationInfo() const { >>>>>>> // FIXME: This is conservatively claiming that these entries >>>>>>> require a >>>>>>> >>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>>>> 20:57:56 2009 >>>>>>> @@ -40,6 +40,7 @@ >>>>>>> #include "llvm/ADT/VectorExtras.h" >>>>>>> #include "llvm/Support/ErrorHandling.h" >>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>> +#include >>>>>>> using namespace llvm; >>>>>>> >>>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, >>>>>>> EVT &LocVT, >>>>>>> @@ -969,7 +970,8 @@ >>>>>>> // tBX takes a register source operand. >>>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>>>> hasV5TOps()) { >>>>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>>>> - >>>>>>> ARMPCLabelIndex, 4); >>>>>>> + >>>>>>> ARMPCLabelIndex, >>>>>>> + >>>>>>> ARMCP::CPValue, 4); >>>>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>>>> (), 4); >>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>>>> @@ -1166,7 +1168,7 @@ >>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>> ARMConstantPoolValue *CPV = >>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>> - PCAdj, "tlsgd", true); >>>>>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>>>>> true); >>>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); >>>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >>>>>>> NULL, 0); >>>>>>> @@ -1208,7 +1210,7 @@ >>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>> ARMConstantPoolValue *CPV = >>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>> - PCAdj, "gottpoff", true); >>>>>>> + ARMCP::CPValue, PCAdj, >>>>>>> "gottpoff", true); >>>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>>>> @@ -1284,7 +1286,7 @@ >>>>>>> else { >>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>>>> isThumb()?4:8); >>>>>>> ARMConstantPoolValue *CPV = >>>>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>>>> ARMCP::CPValue, PCAdj); >>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>> } >>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>> @@ -1375,10 +1377,6 @@ >>>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>>>> } >>>>>>> case Intrinsic::eh_sjlj_lsda: { >>>>>>> - // blah. horrible, horrible hack with the forced magic >>>>>>> name. >>>>>>> - // really need to clean this up. It belongs in the target- >>>>>>> independent >>>>>>> - // layer somehow that doesn't require the coupling with the >>>>>>> asm >>>>>>> - // printer. >>>>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>>>> EVT PtrVT = getPointerTy(); >>>>>>> DebugLoc dl = Op.getDebugLoc(); >>>>>>> @@ -1386,13 +1384,9 @@ >>>>>>> SDValue CPAddr; >>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>>>> - // Save off the LSDA name for the AsmPrinter to use when >>>>>>> it's time >>>>>>> - // to emit the table >>>>>>> - std::string LSDAName = "L_lsda_"; >>>>>>> - LSDAName += MF.getFunction()->getName(); >>>>>>> ARMConstantPoolValue *CPV = >>>>>>> - new ARMConstantPoolValue(*DAG.getContext(), >>>>>>> LSDAName.c_str >>>>>>> (), >>>>>>> - ARMPCLabelIndex, PCAdj); >>>>>>> + new ARMConstantPoolValue(MF.getFunction(), >>>>>>> ARMPCLabelIndex, >>>>>>> + ARMCP::CPLSDA, PCAdj); >>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>> SDValue Result = >>>>>>> >>>>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>> (original) >>>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon >>>>>>> Aug 31 20:57:56 2009 >>>>>>> @@ -44,6 +44,7 @@ >>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>> #include "llvm/Support/FormattedStream.h" >>>>>>> #include >>>>>>> +#include >>>>>>> using namespace llvm; >>>>>>> >>>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>>>> @@ -159,8 +160,13 @@ >>>>>>> ARMConstantPoolValue *ACPV = static_cast >>>>>>> (MCPV); >>>>>>> GlobalValue *GV = ACPV->getGV(); >>>>>>> std::string Name; >>>>>>> - >>>>>>> - if (GV) { >>>>>>> + >>>>>>> + if (ACPV->isLSDA()) { >>>>>>> + std::stringstream out; >>>>>>> + out << getFunctionNumber(); >>>>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>>>> out.str(), >>>>>>> + Mangler::Private); >>>>>>> + } else if (GV) { >>>>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>>>> TM.getRelocationModel() == >>>>>>> Reloc::Static); >>>>>>> @@ -175,9 +181,7 @@ >>>>>>> else >>>>>>> GVNonLazyPtrs[SymName] = Name; >>>>>>> } >>>>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>>>> - Name = ACPV->getSymbol(); >>>>>>> - else >>>>>>> + } else >>>>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>>>> O << Name; >>>>>>> >>>>>>> >>>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>>>> >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> = >>>>>>> ================================================================ >>>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >>>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug >>>>>>> 31 20:57:56 2009 >>>>>>> @@ -0,0 +1,103 @@ >>>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>>>> + >>>>>>> +%struct.A = type { i32* } >>>>>>> + >>>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>>>> +entry: >>>>>>> + %save_filt.1 = alloca i32 ; >>>>>>> [#uses=2] >>>>>>> + %save_eptr.0 = alloca i8* ; >>>>>>> [#uses=2] >>>>>>> + %a = alloca %struct.A ; < >>>>>>> %struct.A*> >>>>>>> [#uses=3] >>>>>>> + %eh_exception = alloca i8* ; >>>>>>> [#uses=5] >>>>>>> + %eh_selector = alloca i32 ; >>>>>>> [#uses=3] >>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>> [#uses=0] >>>>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>>>> + invoke arm_apcscc void @_Z3barv() >>>>>>> + to label %invcont unwind label %lpad >>>>>>> + >>>>>>> +invcont: ; preds = >>>>>>> %entry >>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>> + br label %return >>>>>>> + >>>>>>> +bb: ; preds = >>>>>>> %ppad >>>>>>> + %eh_select = load i32* %eh_selector ; >>>>>>> [#uses=1] >>>>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>>>> + %eh_value = load i8** %eh_exception ; >>>>>>> [#uses=1] >>>>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>>>> [#uses=1] >>>>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>>>> [#uses=1] >>>>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>>>> + br label %Unwind >>>>>>> + >>>>>>> +return: ; preds = >>>>>>> %invcont >>>>>>> + ret void >>>>>>> + >>>>>>> +lpad: ; preds = >>>>>>> %entry >>>>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>>>> [#uses=1] >>>>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>>>> [#uses=1] >>>>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32 >>>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to >>>>>>> i8*), i32 0) ; [#uses=1] >>>>>>> + store i32 %eh_select2, i32* %eh_selector >>>>>>> + br label %ppad >>>>>>> + >>>>>>> +ppad: ; preds = >>>>>>> %lpad >>>>>>> + br label %bb >>>>>>> + >>>>>>> +Unwind: ; preds = %bb >>>>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>>>> [#uses=1] >>>>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>>>> + unreachable >>>>>>> +} >>>>>>> + >>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>>>> %this) { >>>>>>> +entry: >>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>> %struct.A**> [#uses=2] >>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>> [#uses=0] >>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>>>> [#uses=1] >>>>>>> + %1 = bitcast i8* %0 to i32* ; >>>>>>> [#uses=1] >>>>>>> + %2 = load %struct.A** %this_addr, align 4 ; < >>>>>>> %struct.A*> >>>>>>> [#uses=1] >>>>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>>>> [#uses=1] >>>>>>> + store i32* %1, i32** %3, align 4 >>>>>>> + br label %return >>>>>>> + >>>>>>> +return: ; preds = >>>>>>> %entry >>>>>>> + ret void >>>>>>> +} >>>>>>> + >>>>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>>>> + >>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* >>>>>>> %this) >>>>>>> nounwind { >>>>>>> +entry: >>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>> %struct.A**> [#uses=2] >>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>> [#uses=0] >>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>> + %0 = load %struct.A** %this_addr, align 4 ; < >>>>>>> %struct.A*> >>>>>>> [#uses=1] >>>>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>>>> [#uses=1] >>>>>>> + %2 = load i32** %1, align 4 ; >>>>>>> [#uses=1] >>>>>>> + %3 = bitcast i32* %2 to i8* ; >>>>>>> [#uses=1] >>>>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>>>> + br label %bb >>>>>>> + >>>>>>> +bb: ; preds = >>>>>>> %entry >>>>>>> + br label %return >>>>>>> + >>>>>>> +return: ; preds = %bb >>>>>>> + ret void >>>>>>> +} >>>>>>> +;CHECK: L_LSDA_1: >>>>>>> + >>>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>>>> + >>>>>>> +declare arm_apcscc void @_Z3barv() >>>>>>> + >>>>>>> +declare i8* @llvm.eh.exception() nounwind >>>>>>> + >>>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>>>> + >>>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>>>> + >>>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>>>> + >>>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 mrs at apple.com Tue Sep 1 16:26:13 2009 From: mrs at apple.com (Mike Stump) Date: Tue, 1 Sep 2009 14:26:13 -0700 Subject: [llvm-commits] [llvm] r80698 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <200909011832.n81IW48a023408@zion.cs.uiuc.edu> References: <200909011832.n81IW48a023408@zion.cs.uiuc.edu> Message-ID: On Sep 1, 2009, at 11:32 AM, Chris Lattner wrote: > Author: lattner > Date: Tue Sep 1 13:32:03 2009 > New Revision: 80698 > > URL: http://llvm.org/viewvc/llvm-project?rev=80698&view=rev > Log: > doxygenate RefreshCallGraph, add a new 'verification mode', and run > it after > CGSCC passes make change to ensure they are updating the callgraph > correctly > (when assertions are enabled). This breaks CodeGen/blocks-2.c and CodeGen/mmintrin-test.c from the clang testsuite on i386-darwin9. :-( Also shows up on x86_64 darwin10. From evan at fallingsnow.net Tue Sep 1 16:34:47 2009 From: evan at fallingsnow.net (Evan Phoenix) Date: Tue, 1 Sep 2009 14:34:47 -0700 Subject: [llvm-commits] [PATCH] Reduce number of stubs used in 64bit code Message-ID: <381539BB-D0CA-435E-B426-A2AD3E6489B3@fallingsnow.net> Currently the JIT running on a x86_64 platform can only call an external function through a stub. This is because of a conservative decision about how the encoding of a pc-relative address would should up in the machine code stream. These stubs incur a penalty, so any stubs that can be eliminated should be. The attached patch allows the JITEmitter to override the CodeGen's decision to use a stub by validating if a stub is actually needed. Thus any calling functions who's pc-relative offset fits directly in a call instruction are used the same as they would on a 32bit platform. "Long" calls are still done via the stub mechanism. This only effects the calling of externally defined functions. It changes nothing with regard to lazy/future JIT'd LLVM functions. Thanks, - Evan Phoenix -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-64bit-stubs5.diff Type: application/octet-stream Size: 10154 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090901/258cdb43/attachment.obj From sabre at nondot.org Tue Sep 1 16:37:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 01 Sep 2009 21:37:51 -0000 Subject: [llvm-commits] [llvm] r80724 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909012137.n81Lbp1U017000@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 16:37:50 2009 New Revision: 80724 URL: http://llvm.org/viewvc/llvm-project?rev=80724&view=rev Log: debug intrinsics do not go in the callgraph, this fixes a couple clang regtest failures. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80724&r1=80723&r2=80724&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 16:37:50 2009 @@ -22,6 +22,7 @@ #include "llvm/PassManagers.h" #include "llvm/Function.h" #include "llvm/Support/Debug.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -192,7 +193,7 @@ for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { CallSite CS = CallSite::get(I); - if (!CS.getInstruction()) continue; + if (!CS.getInstruction() || isa(I)) continue; // If this call site already existed in the callgraph, just verify it // matches up to expectations and remove it from CallSites. From clattner at apple.com Tue Sep 1 16:39:19 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Sep 2009 14:39:19 -0700 Subject: [llvm-commits] [llvm] r80698 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: References: <200909011832.n81IW48a023408@zion.cs.uiuc.edu> Message-ID: <2B7B7646-D5F7-4F42-9203-4B0AB4B450AF@apple.com> On Sep 1, 2009, at 2:26 PM, Mike Stump wrote: > On Sep 1, 2009, at 11:32 AM, Chris Lattner wrote: >> Author: lattner >> Date: Tue Sep 1 13:32:03 2009 >> New Revision: 80698 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80698&view=rev >> Log: >> doxygenate RefreshCallGraph, add a new 'verification mode', and run >> it after >> CGSCC passes make change to ensure they are updating the callgraph >> correctly >> (when assertions are enabled). > > This breaks CodeGen/blocks-2.c and CodeGen/mmintrin-test.c from the > clang testsuite on i386-darwin9. :-( Also shows up on x86_64 > darwin10. Fixed in r80724, sorry about that. I didn't notice this because the buildbot didn't send me mail :( -Chris From wendling at apple.com Tue Sep 1 16:58:01 2009 From: wendling at apple.com (Bill Wendling) Date: Tue, 1 Sep 2009 14:58:01 -0700 Subject: [llvm-commits] [llvm] r80698 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <2B7B7646-D5F7-4F42-9203-4B0AB4B450AF@apple.com> References: <200909011832.n81IW48a023408@zion.cs.uiuc.edu> <2B7B7646-D5F7-4F42-9203-4B0AB4B450AF@apple.com> Message-ID: On Sep 1, 2009, at 2:39 PM, Chris Lattner wrote: > On Sep 1, 2009, at 2:26 PM, Mike Stump wrote: > >> On Sep 1, 2009, at 11:32 AM, Chris Lattner wrote: >>> Author: lattner >>> Date: Tue Sep 1 13:32:03 2009 >>> New Revision: 80698 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=80698&view=rev >>> Log: >>> doxygenate RefreshCallGraph, add a new 'verification mode', and run >>> it after >>> CGSCC passes make change to ensure they are updating the callgraph >>> correctly >>> (when assertions are enabled). >> >> This breaks CodeGen/blocks-2.c and CodeGen/mmintrin-test.c from the >> clang testsuite on i386-darwin9. :-( Also shows up on x86_64 >> darwin10. > > Fixed in r80724, sorry about that. I didn't notice this because the > buildbot didn't send me mail :( > Unfortunately, they don't send emails when the build is already broken. :-( -bw From daniel at zuster.org Tue Sep 1 17:04:51 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 1 Sep 2009 15:04:51 -0700 Subject: [llvm-commits] [llvm] r80715 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoLoader.h lib/Analysis/ProfileInfoLoader.cpp lib/Analysis/ProfileInfoLoaderPass.cpp In-Reply-To: <200909011908.n81J8p9c028897@zion.cs.uiuc.edu> References: <200909011908.n81J8p9c028897@zion.cs.uiuc.edu> Message-ID: <6a8523d60909011504m5df57bdfl18e9197e07662ce6@mail.gmail.com> Hi Andreas, One minor comment, On Tue, Sep 1, 2009 at 12:08 PM, Andreas Neustifter wrote: > - ?// Make sure we have enough space... > + ?// Make sure we have enough space... The space is initialised to -1 to > + ?// facitiltate the loading of missing values for OptimalEdgeProfiling. > ? if (Data.size() < NumEntries) > - ? ?Data.resize(NumEntries); > + ? ?Data.resize(NumEntries, -1); FYI I changed this to ~0U to fix a build warning. > ? // Accumulate the data we just read into the data. > ? if (!ShouldByteSwap) { > - ? ?for (unsigned i = 0; i != NumEntries; ++i) > - ? ? ?Data[i] += TempSpace[i]; > + ? ?for (unsigned i = 0; i != NumEntries; ++i) { > + ? ? ?unsigned data = TempSpace[i]; > + ? ? ?if (data != (unsigned)-1) { ? ? ? // only load data if its not MissingVal > + ? ? ? ?if (Data[i] == (unsigned)-1) { > + ? ? ? ? ?Data[i] = data; ? ? ? ? ? ? ? // if data is still initialised > + ? ? ? ?} else { > + ? ? ? ? ?Data[i] += data; > + ? ? ? ?} > + ? ? ?} > + ? ?} > ? } else { > - ? ?for (unsigned i = 0; i != NumEntries; ++i) > - ? ? ?Data[i] += ByteSwap(TempSpace[i], true); > + ? ?for (unsigned i = 0; i != NumEntries; ++i) { > + ? ? ?unsigned data = ByteSwap(TempSpace[i], true); > + ? ? ?if (data != (unsigned)-1) { ? ? ? // only load data if its not MissingVal > + ? ? ? ?if (Data[i] == (unsigned)-1) { > + ? ? ? ? ?Data[i] = data; > + ? ? ? ?} else { > + ? ? ? ? ?Data[i] += data; > + ? ? ? ?} > + ? ? ?} > + ? ?} This would be simpler if there was a: -- static const unsigned AddCounts(unsigned A, unsigned B) { // If either value is undefined, use the other. if (A == ~0U) return B; if (B == ~0U) return A; return A + B; } -- helper earlier, then it becomes obvious what the loops are doing: -- for (unsigned i = 0; i != NumEntries; ++i) Data[i] = AddCounts(Data[i], TempSpace[i]); -- Do these values need to become uint64_t at some point? - Daniel From alenhar2 at cs.uiuc.edu Tue Sep 1 14:08:18 2009 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 01 Sep 2009 19:08:18 -0000 Subject: [llvm-commits] [poolalloc] r80714 - in /poolalloc/trunk: include/rdsa/DataStructure.h lib/Makefile lib/rDSA/Basic.cpp lib/rDSA/DataStructure.cpp Message-ID: <200909011908.n81J8IkH028797@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 1 14:08:18 2009 New Revision: 80714 URL: http://llvm.org/viewvc/llvm-project?rev=80714&view=rev Log: bring rDSA up to 2.6 Removed: poolalloc/trunk/lib/rDSA/Basic.cpp Modified: poolalloc/trunk/include/rdsa/DataStructure.h poolalloc/trunk/lib/Makefile poolalloc/trunk/lib/rDSA/DataStructure.cpp Modified: poolalloc/trunk/include/rdsa/DataStructure.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DataStructure.h?rev=80714&r1=80713&r2=80714&view=diff ============================================================================== --- poolalloc/trunk/include/rdsa/DataStructure.h (original) +++ poolalloc/trunk/include/rdsa/DataStructure.h Tue Sep 1 14:08:18 2009 @@ -171,25 +171,6 @@ void copyValue(Value *From, Value *To); }; -// BasicDataStructures - The analysis is a dummy one -- all pointers can points -// to all possible locations. -// -class BasicDataStructures : public DataStructures { -public: - static char ID; - BasicDataStructures() : DataStructures((intptr_t)&ID, "basic.") {} - ~BasicDataStructures() { releaseMemory(); } - - virtual bool runOnModule(Module &M); - - /// getAnalysisUsage - This obviously provides a data structure graph. - /// - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); - AU.setPreservesAll(); - } -}; - // LocalDataStructures - The analysis that computes the local data structure // graphs for all of the functions in the program. // Modified: poolalloc/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/Makefile?rev=80714&r1=80713&r2=80714&view=diff ============================================================================== --- poolalloc/trunk/lib/Makefile (original) +++ poolalloc/trunk/lib/Makefile Tue Sep 1 14:08:18 2009 @@ -6,6 +6,6 @@ # # List all of the subdirectories that we will compile. # -DIRS=DSA PoolAllocate AssistDS +DIRS=DSA PoolAllocate AssistDS rDSA include $(LEVEL)/Makefile.common Removed: poolalloc/trunk/lib/rDSA/Basic.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Basic.cpp?rev=80713&view=auto ============================================================================== --- poolalloc/trunk/lib/rDSA/Basic.cpp (original) +++ poolalloc/trunk/lib/rDSA/Basic.cpp (removed) @@ -1,85 +0,0 @@ -//===- Basic.cpp ----------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Implementation of the basic data structure analysis pass. It simply assumes -// that all pointers can points to all possible locations. -// -//===----------------------------------------------------------------------===// - -#include "rdsa/DataStructure.h" -#include "rdsa/DSGraph.h" - -#include "llvm/Module.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Constants.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" -#include "llvm/Support/InstIterator.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" - -using namespace llvm; - -static RegisterPass -X("dsa-basic", "Basic Data Structure Analysis(No Analysis)"); - -char BasicDataStructures::ID = 0; - -bool BasicDataStructures::runOnModule(Module &M) { - init(&getAnalysis()); - - DSNode * GVNodeInternal = new DSNode(PointerType::getUnqual(Type::Int8Ty), GlobalsGraph); - DSNode * GVNodeExternal = new DSNode(PointerType::getUnqual(Type::Int8Ty), GlobalsGraph); - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - if (I->isDeclaration()) { - GlobalsGraph->getNodeForValue(&*I).mergeWith(GVNodeExternal); - } else { - GlobalsGraph->getNodeForValue(&*I).mergeWith(GVNodeInternal); - } - } - - GVNodeInternal->foldNodeCompletely(); - GVNodeInternal->maskNodeTypes(DSNode::IncompleteNode); - - GVNodeExternal->foldNodeCompletely(); - - // Next step, iterate through the nodes in the globals graph, unioning - // together the globals into equivalence classes. - formGlobalECs(); - - for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { - if (!F->isDeclaration()) { - DSGraph* G = new DSGraph(GlobalECs, getTargetData(), GlobalsGraph); - DSNode * Node = new DSNode(PointerType::getUnqual(Type::Int8Ty), G); - - if (!F->hasInternalLinkage()) - Node->setExternalMarker(); - - // Create scalar nodes for all pointer arguments... - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); - I != E; ++I) { - if (isa(I->getType())) { - G->getNodeForValue(&*I).mergeWith(Node); - } - } - - for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) { - G->getNodeForValue(&*I).mergeWith(Node); - } - - Node->foldNodeCompletely(); - Node->maskNodeTypes(DSNode::IncompleteNode); - - setDSGraph(F, G); - } - } - - return false; -} Modified: poolalloc/trunk/lib/rDSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/DataStructure.cpp?rev=80714&r1=80713&r2=80714&view=diff ============================================================================== --- poolalloc/trunk/lib/rDSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/rDSA/DataStructure.cpp Tue Sep 1 14:08:18 2009 @@ -120,7 +120,7 @@ //===----------------------------------------------------------------------===// DSNode::DSNode(const Type *T, DSGraph *G) - : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::VoidTy), NodeType(0) { + : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::getVoidTy(getGlobalContext())), NodeType(0) { // Add the type entry if it is specified... if (T) mergeTypeInfo(T, 0); if (G) G->addNode(this); @@ -162,8 +162,8 @@ } void DSNode::assertOK() const { - assert((Ty != Type::VoidTy || - (Ty == Type::VoidTy && (Size == 0 || + assert((Ty != Type::getVoidTy(getGlobalContext()) || + (Ty == Type::getVoidTy(getGlobalContext()) && (Size == 0 || (NodeType & DSNode::ArrayNode)))) && "Node not OK!"); @@ -187,7 +187,7 @@ ForwardNH.setTo(To, Offset); NodeType = DeadNode; Size = 0; - Ty = Type::VoidTy; + Ty = Type::getVoidTy(getGlobalContext()); // Remove this node from the parent graph's Nodes list. ParentGraph->unlinkNode(this); @@ -243,7 +243,7 @@ // node. if (getSize() <= 1) { NodeType |= DSNode::ArrayNode; - Ty = Type::VoidTy; + Ty = Type::getVoidTy(getGlobalContext()); Size = 1; assert(Links.size() <= 1 && "Size is 1, but has more links?"); Links.resize(1); @@ -253,7 +253,7 @@ // forward, the forwarder has the opportunity to correct the offset. DSNode *DestNode = new DSNode(0, ParentGraph); DestNode->NodeType = NodeType|DSNode::ArrayNode; - DestNode->Ty = Type::VoidTy; + DestNode->Ty = Type::getVoidTy(getGlobalContext()); DestNode->Size = 1; DestNode->Globals.swap(Globals); @@ -295,7 +295,7 @@ /// all of the field sensitivity that may be present in the node. /// bool DSNode::isNodeCompletelyFolded() const { - return getSize() == 1 && Ty == Type::VoidTy && isArray(); + return getSize() == 1 && Ty == Type::getVoidTy(getGlobalContext()) && isArray(); } /// addFullGlobalsList - Compute the full set of global values that are @@ -474,13 +474,13 @@ // Size = 1, Ty = Void, Array = 1: The node is collapsed // Otherwise, sizeof(Ty) = Size // - assert(((Size == 0 && Ty == Type::VoidTy && !isArray()) || + assert(((Size == 0 && Ty == Type::getVoidTy(getGlobalContext()) && !isArray()) || (Size == 0 && !Ty->isSized() && !isArray()) || - (Size == 1 && Ty == Type::VoidTy && isArray()) || + (Size == 1 && Ty == Type::getVoidTy(getGlobalContext()) && isArray()) || (Size == 0 && !Ty->isSized() && !isArray()) || (TD.getTypeAllocSize(Ty) == Size)) && "Size member of DSNode doesn't match the type structure!"); - assert(NewTy != Type::VoidTy && "Cannot merge void type into DSNode!"); + assert(NewTy != Type::getVoidTy(getGlobalContext()) && "Cannot merge void type into DSNode!"); if (Offset == 0 && NewTy == Ty) return false; // This should be a common case, handle it efficiently @@ -507,7 +507,7 @@ // we can't, we fold the node completely, if we can, we potentially update our // internal state. // - if (Ty == Type::VoidTy) { + if (Ty == Type::getVoidTy(getGlobalContext())) { // If this is the first type that this node has seen, just accept it without // question.... assert(Offset == 0 && !isArray() && @@ -892,7 +892,7 @@ } #endif // Merge the type entries of the two nodes together... - if (NH.getNode()->Ty != Type::VoidTy) + if (NH.getNode()->Ty != Type::getVoidTy(getGlobalContext())) CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset); assert(!CurNodeH.getNode()->isDeadNode()); @@ -1154,7 +1154,7 @@ } // Merge the type entries of the two nodes together... - if (SN->getType() != Type::VoidTy && !DN->isNodeCompletelyFolded()) { + if (SN->getType() != Type::getVoidTy(getGlobalContext()) && !DN->isNodeCompletelyFolded()) { DN->mergeTypeInfo(SN->getType(), NH.getOffset()-SrcNH.getOffset()); DN = NH.getNode(); } @@ -1980,7 +1980,7 @@ if (N->getNumReferrers() == 1) // Does it point to a lonely node? // No interesting info? if ((N->getNodeFlags() & ~DSNode::IncompleteNode) == 0 && - N->getType() == Type::VoidTy && !N->isNodeCompletelyFolded()) + N->getType() == Type::getVoidTy(getGlobalContext()) && !N->isNodeCompletelyFolded()) Edge.setTo(0, 0); // Kill the edge! } From alenhar2 at cs.uiuc.edu Tue Sep 1 14:17:36 2009 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 01 Sep 2009 19:17:36 -0000 Subject: [llvm-commits] [poolalloc] r80716 - /poolalloc/trunk/lib/rDSA/Local.cpp Message-ID: <200909011917.n81JHaMv030175@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 1 14:17:36 2009 New Revision: 80716 URL: http://llvm.org/viewvc/llvm-project?rev=80716&view=rev Log: ignore prefetch intrisic Modified: poolalloc/trunk/lib/rDSA/Local.cpp Modified: poolalloc/trunk/lib/rDSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Local.cpp?rev=80716&r1=80715&r2=80716&view=diff ============================================================================== --- poolalloc/trunk/lib/rDSA/Local.cpp (original) +++ poolalloc/trunk/lib/rDSA/Local.cpp Tue Sep 1 14:17:36 2009 @@ -721,6 +721,7 @@ case Intrinsic::eh_selector_i64: case Intrinsic::eh_typeid_for_i32: case Intrinsic::eh_typeid_for_i64: + case Intrinsic::prefetch: return true; // From daniel at zuster.org Tue Sep 1 17:06:46 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 22:06:46 -0000 Subject: [llvm-commits] [llvm] r80726 - in /llvm/trunk: include/llvm/CodeGen/MachineInstrBuilder.h include/llvm/CodeGen/MachineOperand.h lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp lib/Target/X86/X86InstrInfo.cpp Message-ID: <200909012206.n81M6kjx021008@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 1 17:06:46 2009 New Revision: 80726 URL: http://llvm.org/viewvc/llvm-project?rev=80726&view=rev Log: Remove Offset from ExternalSybmol MachineOperands, this is unused (and at least partly unsupported, in X86 encoding at least). Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h llvm/trunk/include/llvm/CodeGen/MachineOperand.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=80726&r1=80725&r2=80726&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Tue Sep 1 17:06:46 2009 @@ -116,9 +116,8 @@ } const MachineInstrBuilder &addExternalSymbol(const char *FnName, - int64_t Offset = 0, unsigned char TargetFlags = 0) const { - MI->addOperand(MachineOperand::CreateES(FnName, Offset, TargetFlags)); + MI->addOperand(MachineOperand::CreateES(FnName, TargetFlags)); return *this; } Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=80726&r1=80725&r2=80726&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Tue Sep 1 17:06:46 2009 @@ -432,11 +432,11 @@ Op.setTargetFlags(TargetFlags); return Op; } - static MachineOperand CreateES(const char *SymName, int64_t Offset = 0, + static MachineOperand CreateES(const char *SymName, unsigned char TargetFlags = 0) { MachineOperand Op(MachineOperand::MO_ExternalSymbol); Op.Contents.OffsetedInfo.Val.SymbolName = SymName; - Op.setOffset(Offset); + Op.setOffset(0); // Offset is always 0. Op.setTargetFlags(TargetFlags); return Op; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp?rev=80726&r1=80725&r2=80726&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp Tue Sep 1 17:06:46 2009 @@ -319,7 +319,7 @@ MI->addOperand(MachineOperand::CreateCPI(Idx, Offset, CP->getTargetFlags())); } else if (ExternalSymbolSDNode *ES = dyn_cast(Op)) { - MI->addOperand(MachineOperand::CreateES(ES->getSymbol(), 0, + MI->addOperand(MachineOperand::CreateES(ES->getSymbol(), ES->getTargetFlags())); } else { assert(Op.getValueType() != MVT::Other && Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=80726&r1=80725&r2=80726&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Sep 1 17:06:46 2009 @@ -3237,7 +3237,7 @@ GlobalBaseReg = RegInfo.createVirtualRegister(X86::GR32RegisterClass); // Generate addl $__GLOBAL_OFFSET_TABLE_ + [.-piclabel], %some_register BuildMI(FirstMBB, MBBI, DL, TII->get(X86::ADD32ri), GlobalBaseReg) - .addReg(PC).addExternalSymbol("_GLOBAL_OFFSET_TABLE_", 0, + .addReg(PC).addExternalSymbol("_GLOBAL_OFFSET_TABLE_", X86II::MO_GOT_ABSOLUTE_ADDRESS); } else { GlobalBaseReg = PC; From daniel at zuster.org Tue Sep 1 17:06:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 22:06:53 -0000 Subject: [llvm-commits] [llvm] r80727 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200909012206.n81M6rCF021032@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 1 17:06:53 2009 New Revision: 80727 URL: http://llvm.org/viewvc/llvm-project?rev=80727&view=rev Log: X86/Encoding: Support ExternalSymbol operands in emitDisplacementField (for consistency). Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80727&r1=80726&r2=80727&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Sep 1 17:06:53 2009 @@ -337,6 +337,11 @@ bool Indirect = gvNeedsNonLazyPtr(*RelocOp, TM); emitGlobalAddress(RelocOp->getGlobal(), rt, RelocOp->getOffset(), Adj, NeedStub, Indirect); + } else if (RelocOp->isSymbol()) { + unsigned rt = Is64BitMode ? + (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) + : (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); + emitExternalSymbolAddress(RelocOp->getSymbolName(), rt); } else if (RelocOp->isCPI()) { unsigned rt = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) @@ -364,6 +369,8 @@ // Figure out what sort of displacement we have to handle here. if (Op3.isGlobal()) { DispForReloc = &Op3; + } else if (Op3.isSymbol()) { + DispForReloc = &Op3; } else if (Op3.isCPI()) { if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) { DispForReloc = &Op3; From daniel at zuster.org Tue Sep 1 17:07:00 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 22:07:00 -0000 Subject: [llvm-commits] [llvm] r80728 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200909012207.n81M70mU021056@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 1 17:07:00 2009 New Revision: 80728 URL: http://llvm.org/viewvc/llvm-project?rev=80728&view=rev Log: Fix what I believe is a copy-n-pasto introduced in r78129. - Bruno, please check!! Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80728&r1=80727&r2=80728&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Sep 1 17:07:00 2009 @@ -340,18 +340,18 @@ } else if (RelocOp->isSymbol()) { unsigned rt = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); + : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); emitExternalSymbolAddress(RelocOp->getSymbolName(), rt); } else if (RelocOp->isCPI()) { unsigned rt = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); + : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); emitConstPoolAddress(RelocOp->getIndex(), rt, RelocOp->getOffset(), Adj); } else if (RelocOp->isJTI()) { unsigned rt = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); + : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); emitJumpTableAddress(RelocOp->getIndex(), rt, Adj); } else { llvm_unreachable("Unknown value to relocate!"); From daniel at zuster.org Tue Sep 1 17:07:06 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 22:07:06 -0000 Subject: [llvm-commits] [llvm] r80729 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200909012207.n81M763T021084@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 1 17:07:06 2009 New Revision: 80729 URL: http://llvm.org/viewvc/llvm-project?rev=80729&view=rev Log: Simplify. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80729&r1=80728&r2=80729&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Sep 1 17:07:06 2009 @@ -324,37 +324,27 @@ // Otherwise, this is something that requires a relocation. Emit it as such // now. + unsigned RelocType = Is64BitMode ? + (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) + : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); if (RelocOp->isGlobal()) { // In 64-bit static small code model, we could potentially emit absolute. // But it's probably not beneficial. If the MCE supports using RIP directly // do it, otherwise fallback to absolute (this is determined by IsPCRel). // 89 05 00 00 00 00 mov %eax,0(%rip) # PC-relative // 89 04 25 00 00 00 00 mov %eax,0x0 # Absolute - unsigned rt = Is64BitMode ? - (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); bool NeedStub = isa(RelocOp->getGlobal()); bool Indirect = gvNeedsNonLazyPtr(*RelocOp, TM); - emitGlobalAddress(RelocOp->getGlobal(), rt, RelocOp->getOffset(), + emitGlobalAddress(RelocOp->getGlobal(), RelocType, RelocOp->getOffset(), Adj, NeedStub, Indirect); } else if (RelocOp->isSymbol()) { - unsigned rt = Is64BitMode ? - (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - emitExternalSymbolAddress(RelocOp->getSymbolName(), rt); + emitExternalSymbolAddress(RelocOp->getSymbolName(), RelocType); } else if (RelocOp->isCPI()) { - unsigned rt = Is64BitMode ? - (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - emitConstPoolAddress(RelocOp->getIndex(), rt, + emitConstPoolAddress(RelocOp->getIndex(), RelocType, RelocOp->getOffset(), Adj); - } else if (RelocOp->isJTI()) { - unsigned rt = Is64BitMode ? - (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - emitJumpTableAddress(RelocOp->getIndex(), rt, Adj); } else { - llvm_unreachable("Unknown value to relocate!"); + assert(RelocOp->isJTI() && "Unexpected machine operand!"); + emitJumpTableAddress(RelocOp->getIndex(), RelocType, Adj); } } From daniel at zuster.org Tue Sep 1 17:07:12 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 01 Sep 2009 22:07:12 -0000 Subject: [llvm-commits] [llvm] r80730 - /llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp Message-ID: <200909012207.n81M7CdU021111@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 1 17:07:12 2009 New Revision: 80730 URL: http://llvm.org/viewvc/llvm-project?rev=80730&view=rev Log: Fix build warning. Modified: llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp Modified: llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp?rev=80730&r1=80729&r2=80730&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfoLoader.cpp Tue Sep 1 17:07:12 2009 @@ -57,7 +57,7 @@ // Make sure we have enough space... The space is initialised to -1 to // facitiltate the loading of missing values for OptimalEdgeProfiling. if (Data.size() < NumEntries) - Data.resize(NumEntries, -1); + Data.resize(NumEntries, ~0U); // Accumulate the data we just read into the data. if (!ShouldByteSwap) { From bob.wilson at apple.com Tue Sep 1 17:19:01 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 22:19:01 -0000 Subject: [llvm-commits] [llvm] r80731 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200909012219.n81MJ1bV022832@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 1 17:19:00 2009 New Revision: 80731 URL: http://llvm.org/viewvc/llvm-project?rev=80731&view=rev Log: Move use of LV inside condition that guards for null LV. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80731&r1=80730&r2=80731&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Sep 1 17:19:00 2009 @@ -865,12 +865,12 @@ LV->addVirtualRegisterKilled(Kill, NewKill); } } - } - // We're really going to nuke the old inst. If regB was marked - // as a kill we need to update its Kills list. - if (mi->getOperand(si).isKill()) - LV->removeVirtualRegisterKilled(regB, mi); + // We're really going to nuke the old inst. If regB was marked + // as a kill we need to update its Kills list. + if (mi->getOperand(si).isKill()) + LV->removeVirtualRegisterKilled(regB, mi); + } mbbi->erase(mi); // Nuke the old inst. mi = nmi; From bob.wilson at apple.com Tue Sep 1 17:51:08 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 22:51:08 -0000 Subject: [llvm-commits] [llvm] r80733 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200909012251.n81Mp8oP027611@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 1 17:51:08 2009 New Revision: 80733 URL: http://llvm.org/viewvc/llvm-project?rev=80733&view=rev Log: Refactor some code into separate functions. No functional changes. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80733&r1=80732&r2=80733&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Sep 1 17:51:08 2009 @@ -106,6 +106,15 @@ MachineFunction::iterator &mbbi, unsigned RegB, unsigned Dist); + typedef std::pair, MachineInstr*> NewKill; + bool canUpdateDeletedKills(SmallVector &Kills, + SmallVector &NewKills, + MachineBasicBlock *MBB, unsigned Dist); + bool DeleteUnusedInstr(MachineBasicBlock::iterator &mi, + MachineBasicBlock::iterator &nmi, + MachineFunction::iterator &mbbi, + unsigned regB, unsigned regBIdx, unsigned Dist); + void ProcessCopy(MachineInstr *MI, MachineBasicBlock *MBB, SmallPtrSet &Processed); @@ -736,6 +745,75 @@ return true; } +/// canUpdateDeletedKills - Check if all the registers listed in Kills are +/// killed by instructions in MBB preceding the current instruction at +/// position Dist. If so, return true and record information about the +/// preceding kills in NewKills. +bool TwoAddressInstructionPass:: +canUpdateDeletedKills(SmallVector &Kills, + SmallVector &NewKills, + MachineBasicBlock *MBB, unsigned Dist) { + while (!Kills.empty()) { + unsigned Kill = Kills.back(); + Kills.pop_back(); + if (TargetRegisterInfo::isPhysicalRegister(Kill)) + return false; + + MachineInstr *LastKill = FindLastUseInMBB(Kill, MBB, Dist); + if (!LastKill) + return false; + + bool isModRef = LastKill->modifiesRegister(Kill); + NewKills.push_back(std::make_pair(std::make_pair(Kill, isModRef), + LastKill)); + } + return true; +} + +/// DeleteUnusedInstr - If an instruction with a tied register operand can +/// be safely deleted, just delete it. +bool +TwoAddressInstructionPass::DeleteUnusedInstr(MachineBasicBlock::iterator &mi, + MachineBasicBlock::iterator &nmi, + MachineFunction::iterator &mbbi, + unsigned regB, unsigned regBIdx, + unsigned Dist) { + // Check if the instruction has no side effects and if all its defs are dead. + SmallVector Kills; + if (!isSafeToDelete(mi, regB, TII, Kills)) + return false; + + // If this instruction kills some virtual registers, we need to + // update the kill information. If it's not possible to do so, + // then bail out. + SmallVector NewKills; + if (!canUpdateDeletedKills(Kills, NewKills, &*mbbi, Dist)) + return false; + + if (LV) { + while (!NewKills.empty()) { + MachineInstr *NewKill = NewKills.back().second; + unsigned Kill = NewKills.back().first.first; + bool isDead = NewKills.back().first.second; + NewKills.pop_back(); + if (LV->removeVirtualRegisterKilled(Kill, mi)) { + if (isDead) + LV->addVirtualRegisterDead(Kill, NewKill); + else + LV->addVirtualRegisterKilled(Kill, NewKill); + } + } + + // If regB was marked as a kill, update its Kills list. + if (mi->getOperand(regBIdx).isKill()) + LV->removeVirtualRegisterKilled(regB, mi); + } + + mbbi->erase(mi); // Nuke the old inst. + mi = nmi; + return true; +} + /// runOnMachineFunction - Reduce two-address instructions to two operands. /// bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { @@ -822,61 +900,13 @@ // allow us to coalesce A and B together, eliminating the copy we are // about to insert. if (!isKilled(*mi, regB, MRI, TII)) { + // If regA is dead and the instruction can be deleted, just delete // it so it doesn't clobber regB. - SmallVector Kills; if (mi->getOperand(ti).isDead() && - isSafeToDelete(mi, regB, TII, Kills)) { - SmallVector - ,MachineInstr*>, 4> NewKills; - bool ReallySafe = true; - // If this instruction kills some virtual registers, we need - // update the kill information. If it's not possible to do so, - // then bail out. - while (!Kills.empty()) { - unsigned Kill = Kills.back(); - Kills.pop_back(); - if (TargetRegisterInfo::isPhysicalRegister(Kill)) { - ReallySafe = false; - break; - } - MachineInstr *LastKill = FindLastUseInMBB(Kill, &*mbbi, Dist); - if (LastKill) { - bool isModRef = LastKill->modifiesRegister(Kill); - NewKills.push_back(std::make_pair(std::make_pair(Kill,isModRef), - LastKill)); - } else { - ReallySafe = false; - break; - } - } - - if (ReallySafe) { - if (LV) { - while (!NewKills.empty()) { - MachineInstr *NewKill = NewKills.back().second; - unsigned Kill = NewKills.back().first.first; - bool isDead = NewKills.back().first.second; - NewKills.pop_back(); - if (LV->removeVirtualRegisterKilled(Kill, mi)) { - if (isDead) - LV->addVirtualRegisterDead(Kill, NewKill); - else - LV->addVirtualRegisterKilled(Kill, NewKill); - } - } - - // We're really going to nuke the old inst. If regB was marked - // as a kill we need to update its Kills list. - if (mi->getOperand(si).isKill()) - LV->removeVirtualRegisterKilled(regB, mi); - } - - mbbi->erase(mi); // Nuke the old inst. - mi = nmi; - ++NumDeletes; - break; // Done with this instruction. - } + DeleteUnusedInstr(mi, nmi, mbbi, regB, si, Dist)) { + ++NumDeletes; + break; // Done with this instruction. } // If this instruction is commutative, check to see if C dies. If From bruno.cardoso at gmail.com Tue Sep 1 17:56:12 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 1 Sep 2009 19:56:12 -0300 Subject: [llvm-commits] [llvm] r80728 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp In-Reply-To: <200909012207.n81M70mU021056@zion.cs.uiuc.edu> References: <200909012207.n81M70mU021056@zion.cs.uiuc.edu> Message-ID: <275e64e40909011556y7d642777w1c26a13d7573cc5c@mail.gmail.com> Hi Daniel, On Tue, Sep 1, 2009 at 7:07 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Tue Sep ?1 17:07:00 2009 > New Revision: 80728 > > URL: http://llvm.org/viewvc/llvm-project?rev=80728&view=rev > Log: > Fix what I believe is a copy-n-pasto introduced in r78129. > ?- Bruno, please check!! > > Modified: > ? ?llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp > > Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80728&r1=80727&r2=80728&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Sep ?1 17:07:00 2009 > @@ -340,18 +340,18 @@ > ? } else if (RelocOp->isSymbol()) { > ? ? unsigned rt = Is64BitMode ? > ? ? ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) > - ? ? ?: (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); > + ? ? ?: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); It's not a copy-n-pasto. The old behavior in r78129 was: unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_picrel_word; That is, to use reloc_picrel_word for "!Is64BitMode" even if we're not in PIC mode. > ? ? emitExternalSymbolAddress(RelocOp->getSymbolName(), rt); > ? } else if (RelocOp->isCPI()) { > ? ? unsigned rt = Is64BitMode ? > ? ? ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) > - ? ? ?: (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); > + ? ? ?: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); > ? ? emitConstPoolAddress(RelocOp->getIndex(), rt, > ? ? ? ? ? ? ? ? ? ? ? ? ?RelocOp->getOffset(), Adj); > ? } else if (RelocOp->isJTI()) { > ? ? unsigned rt = Is64BitMode ? > ? ? ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) > - ? ? ?: (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); > + ? ? ?: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); > ? ? emitJumpTableAddress(RelocOp->getIndex(), rt, Adj); > ? } else { > ? ? llvm_unreachable("Unknown value to relocate!"); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- Bruno Cardoso Lopes http://www.brunocardoso.cc From isanbard at gmail.com Tue Sep 1 18:05:43 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 01 Sep 2009 23:05:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80734 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> Author: void Date: Tue Sep 1 18:05:43 2009 New Revision: 80734 URL: http://llvm.org/viewvc/llvm-project?rev=80734&view=rev Log: Remove in favor of raw_ostream. 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=80734&r1=80733&r2=80734&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep 1 18:05:43 2009 @@ -34,13 +34,14 @@ #include "llvm/Module.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/System/Host.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/DenseMap.h" -#include #include "llvm-abi.h" #include "llvm-internal.h" @@ -792,9 +793,11 @@ switch (TREE_CODE(exp)) { default: - std::cerr << "Unhandled expression!\n" - << "TREE_CODE: " << TREE_CODE(exp) << "\n"; - debug_tree(exp); + DEBUG({ + llvm::errs() << "Unhandled expression!\n" + << "TREE_CODE: " << TREE_CODE(exp) << "\n"; + debug_tree(exp); + }); abort(); // Control flow @@ -988,8 +991,10 @@ switch (TREE_CODE(exp)) { default: - std::cerr << "Unhandled lvalue expression!\n"; - debug_tree(exp); + DEBUG({ + errs() << "Unhandled lvalue expression!\n"; + debug_tree(exp); + }); abort(); case PARM_DECL: @@ -1071,7 +1076,7 @@ //===----------------------------------------------------------------------===// void TreeToLLVM::TODO(tree exp) { - std::cerr << "Unhandled tree node\n"; + DEBUG(errs() << "Unhandled tree node\n"); if (exp) debug_tree(exp); abort(); } From evan.cheng at apple.com Tue Sep 1 18:09:32 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 16:09:32 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <9CB9E538-BF9E-458A-B42D-2BF07831C571@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> <9CB9E538-BF9E-458A-B42D-2BF07831C571@apple.com> Message-ID: <1AC42A15-0000-4659-A3ED-EC75C8C3FF09@apple.com> On Sep 1, 2009, at 2:18 PM, Jim Grosbach wrote: >>> >> >> Can you give an example of what the .s looks like? I don't think I >> understand why the function number is needed. >> > > Sure. Here's a snipped from a test case that contains the constant > pool entry for the lsda (at LCPI7_0). At the end, the LSDA label > which the constant pool entry is referencing is emitted. > > .align 2 > LCPI7_0: > .long L_LSDA_7-(LPC20+4) > > > Leh_func_end5: > .section __DATA,__gcc_except_tab > .align 2 > GCC_except_table5: > .byte 0x0 @ Padding > Lexception5: > L_LSDA_7: > .byte 0xFF @ > @LPStart format (DW_EH_PE_omit) > > The labels suffixed by '5' are from the DwarfWriter using the > SubprogramCount. The documentation entry for Subprogram counts is > slightly inaccurate when it says it's a running count of all > functions being compiled; it's actually a count only of those > functions which emit EH information (in > DwarfException::BeginFunction()). Thus, FunctionNumber and > SubprogramCount do indeed get out of sync currently. > > There's nothing magic about using the FunctionNumber as the suffix. > Anything that's a reproducible way to generate a unique one-per- > function label name will do. Using the function name, even mangled, > doesn't work well due to the strangeness that is Objective-C++, > which is what gave rise to the current implementation. > > We could, for a silly example, generate a random string and use that > for the label name so long as we could guarantee no repetition in > the sequence. The name would need to either be easily > rematerializable, or stored off someplace to be retrieved and used > by the DwarfException table printer later. The latter would need a > new API to support storing and retrieving the name. Keeping that > properly hidden away is roughly equivalent to handling the > FunctionNumber API reasonably. Ok. Before this fix you used function name instead of function number, right? Function name is guaranteed to be consistent between the two. The only problem is DwarfException is not stripping out the '001' prefix in the case of objective-c++? Why not fix that problem instead? Evan > > -Jim > >>>>> >>>>>> >>>>>> The constant pool entry is part of the ARM AsmPrinter, which has >>>>>> the getFunctionNumber() directly. It's the most straightforward >>>>>> solution for the Dwarf writer to use the same interface to output >>>>>> the table itself. >>>>>> >>>>>>> >>>>>>> >>>>>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>>>>> AsmPrinters should >>>>>>>> /// not normally call this, as the counter is automatically >>>>>>>> bumped by >>>>>>>> /// SetupMachineFunction. >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>> (original) >>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon >>>>>>>> Aug >>>>>>>> 31 20:57:56 2009 >>>>>>>> @@ -25,9 +25,11 @@ >>>>>>>> #include "llvm/Target/TargetOptions.h" >>>>>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>>>>> #include "llvm/Support/Dwarf.h" >>>>>>>> +#include "llvm/Support/Mangler.h" >>>>>>>> #include "llvm/Support/Timer.h" >>>>>>>> #include "llvm/Support/raw_ostream.h" >>>>>>>> #include "llvm/ADT/StringExtras.h" >>>>>>>> +#include >>>>>>>> using namespace llvm; >>>>>>>> >>>>>>>> static TimerGroup &getDwarfTimerGroup() { >>>>>>>> @@ -599,9 +601,12 @@ >>>>>>>> >>>>>>>> EmitLabel("exception", SubprogramCount); >>>>>>>> if (MAI->getExceptionHandlingType() == >>>>>>>> ExceptionHandling::SjLj) { >>>>>>>> - std::string SjLjName = "_lsda_"; >>>>>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>>>>> + std::stringstream out; >>>>>>>> + out << Asm->getFunctionNumber(); >>>>>>> >>>>>>> SubprogramCount? >>>>>>> >>>>>>>> + std::string LSDAName = >>>>>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + >>>>>>>> out.str(), >>>>>>>> + Mangler::Private); >>>>>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>>>>> >>>>>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>>>>> Dwarf::EmitLabel to accommodate this, why not just do >>>>>>> out << LSDAName << 0 << ":\n"; >>>>>> >>>>>> Simply consistency that labels get printed via EmitLabel. No >>>>>> strong >>>>>> preference either way. I'll change it. >>>>>> >>>>>>> >>>>>>> Evan >>>>>>> >>>>>>>> } >>>>>>>> >>>>>>>> // Emit the header. >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>> (original) >>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon >>>>>>>> Aug 31 >>>>>>>> 20:57:56 2009 >>>>>>>> @@ -43,21 +43,27 @@ >>>>>>>> >>>>>>>> /// PrintLabelName - Print label name in form used by Dwarf >>>>>>>> writer. >>>>>>>> /// >>>>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>>>>>> const { >>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>> + bool ForcePrivate) const { >>>>>>>> + if (ForcePrivate) >>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>> + O << Tag; >>>>>>>> if (Number) O << Number; >>>>>>>> } >>>>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>> - const char *Suffix) const { >>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>> + const char *Suffix, bool >>>>>>>> ForcePrivate) const { >>>>>>>> + if (ForcePrivate) >>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>> + O << Tag; >>>>>>>> if (Number) O << Number; >>>>>>>> O << Suffix; >>>>>>>> } >>>>>>>> >>>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>>>> /// >>>>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) >>>>>>>> const { >>>>>>>> - PrintLabelName(Tag, Number); >>>>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>>>>> + bool ForcePrivate) const { >>>>>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>>>>> O << ":\n"; >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original) >>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31 >>>>>>>> 20:57:56 2009 >>>>>>>> @@ -100,16 +100,18 @@ >>>>>>>> void PrintLabelName(const DWLabel &Label) const { >>>>>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>>>>> } >>>>>>>> - void PrintLabelName(const char *Tag, unsigned Number) >>>>>>>> const; >>>>>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>> - const char *Suffix) const; >>>>>>>> + bool ForcePrivate = true) const; >>>>>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>> + const char *Suffix, bool >>>>>>>> ForcePrivate = >>>>>>>> true) const; >>>>>>>> >>>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>>>> /// >>>>>>>> void EmitLabel(const DWLabel &Label) const { >>>>>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>>>>> } >>>>>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>>>>> + bool ForcePrivate = true) const; >>>>>>>> >>>>>>>> /// EmitReference - Emit a reference to a label. >>>>>>>> /// >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>> (original) >>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon >>>>>>>> Aug 31 >>>>>>>> 20:57:56 2009 >>>>>>>> @@ -20,11 +20,12 @@ >>>>>>>> using namespace llvm; >>>>>>>> >>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>> unsigned id, >>>>>>>> + ARMCP::ARMCPKind K, >>>>>>>> unsigned char PCAdj, >>>>>>>> const char *Modif, >>>>>>>> bool AddCA) >>>>>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>> >>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>>>>> @@ -33,12 +34,12 @@ >>>>>>>> const char *Modif, >>>>>>>> bool AddCA) >>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>>>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>>>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue), >>>>>>>> PCAdjust(PCAdj), >>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>> >>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>> const >>>>>>>> char *Modif) >>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>>>>> getContext())), >>>>>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), >>>>>>>> PCAdjust >>>>>>>> (0), >>>>>>>> Modifier(Modif) {} >>>>>>>> >>>>>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>>>>> (MachineConstantPool *CP, >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) >>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31 >>>>>>>> 20:57:56 2009 >>>>>>>> @@ -21,12 +21,20 @@ >>>>>>>> class GlobalValue; >>>>>>>> class LLVMContext; >>>>>>>> >>>>>>>> +namespace ARMCP { >>>>>>>> + enum ARMCPKind { >>>>>>>> + CPValue, >>>>>>>> + CPLSDA >>>>>>>> + }; >>>>>>>> +} >>>>>>>> + >>>>>>>> /// ARMConstantPoolValue - ARM specific constantpool value. >>>>>>>> This >>>>>>>> is used to >>>>>>>> /// represent PC relative displacement between the address of >>>>>>>> the >>>>>>>> load >>>>>>>> /// instruction and the global value being loaded, i.e. (&GV- >>>>>>>> (LPIC >>>>>>>> +8)). >>>>>>>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>>>>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>>>>> const char *S; // ExtSymbol being loaded. >>>>>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>>>>> unsigned LabelId; // Label id of the load. >>>>>>>> unsigned char PCAdjust; // Extra adjustment if constantpool is >>>>>>>> pc relative. >>>>>>>> // 8 for ARM, 4 for Thumb. >>>>>>>> @@ -35,6 +43,7 @@ >>>>>>>> >>>>>>>> public: >>>>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>>>>> + ARMCP::ARMCPKind Kind = ARMCP::CPValue, >>>>>>>> unsigned char PCAdj = 0, const char *Modifier >>>>>>>> = NULL, >>>>>>>> bool AddCurrentAddress = false); >>>>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned >>>>>>>> id, >>>>>>>> @@ -52,6 +61,7 @@ >>>>>>>> bool mustAddCurrentAddress() const { return >>>>>>>> AddCurrentAddress; } >>>>>>>> unsigned getLabelId() const { return LabelId; } >>>>>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>>>>> >>>>>>>> virtual unsigned getRelocationInfo() const { >>>>>>>> // FIXME: This is conservatively claiming that these entries >>>>>>>> require a >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>>>>> 20:57:56 2009 >>>>>>>> @@ -40,6 +40,7 @@ >>>>>>>> #include "llvm/ADT/VectorExtras.h" >>>>>>>> #include "llvm/Support/ErrorHandling.h" >>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>> +#include >>>>>>>> using namespace llvm; >>>>>>>> >>>>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT, >>>>>>>> EVT &LocVT, >>>>>>>> @@ -969,7 +970,8 @@ >>>>>>>> // tBX takes a register source operand. >>>>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>>>>> hasV5TOps()) { >>>>>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>>>>> - >>>>>>>> ARMPCLabelIndex, 4); >>>>>>>> + >>>>>>>> ARMPCLabelIndex, >>>>>>>> + >>>>>>>> ARMCP::CPValue, 4); >>>>>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>>>>> (), 4); >>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>>>>> @@ -1166,7 +1168,7 @@ >>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>> - PCAdj, "tlsgd", true); >>>>>>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>>>>>> true); >>>>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, >>>>>>>> Argument); >>>>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument, >>>>>>>> NULL, 0); >>>>>>>> @@ -1208,7 +1210,7 @@ >>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>> - PCAdj, "gottpoff", true); >>>>>>>> + ARMCP::CPValue, PCAdj, >>>>>>>> "gottpoff", true); >>>>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>>>>> @@ -1284,7 +1286,7 @@ >>>>>>>> else { >>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>>>>> isThumb()?4:8); >>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>>>>> ARMCP::CPValue, PCAdj); >>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>> } >>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>> @@ -1375,10 +1377,6 @@ >>>>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>>>>> } >>>>>>>> case Intrinsic::eh_sjlj_lsda: { >>>>>>>> - // blah. horrible, horrible hack with the forced magic >>>>>>>> name. >>>>>>>> - // really need to clean this up. It belongs in the target- >>>>>>>> independent >>>>>>>> - // layer somehow that doesn't require the coupling with >>>>>>>> the >>>>>>>> asm >>>>>>>> - // printer. >>>>>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>>>>> EVT PtrVT = getPointerTy(); >>>>>>>> DebugLoc dl = Op.getDebugLoc(); >>>>>>>> @@ -1386,13 +1384,9 @@ >>>>>>>> SDValue CPAddr; >>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>>>>> - // Save off the LSDA name for the AsmPrinter to use when >>>>>>>> it's time >>>>>>>> - // to emit the table >>>>>>>> - std::string LSDAName = "L_lsda_"; >>>>>>>> - LSDAName += MF.getFunction()->getName(); >>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>> - new ARMConstantPoolValue(*DAG.getContext(), >>>>>>>> LSDAName.c_str >>>>>>>> (), >>>>>>>> - ARMPCLabelIndex, PCAdj); >>>>>>>> + new ARMConstantPoolValue(MF.getFunction(), >>>>>>>> ARMPCLabelIndex, >>>>>>>> + ARMCP::CPLSDA, PCAdj); >>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>> SDValue Result = >>>>>>>> >>>>>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ >>>>>>>> ARMAsmPrinter.cpp >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>>> (original) >>>>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon >>>>>>>> Aug 31 20:57:56 2009 >>>>>>>> @@ -44,6 +44,7 @@ >>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>> #include "llvm/Support/FormattedStream.h" >>>>>>>> #include >>>>>>>> +#include >>>>>>>> using namespace llvm; >>>>>>>> >>>>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>>>>> @@ -159,8 +160,13 @@ >>>>>>>> ARMConstantPoolValue *ACPV = static_cast >>>>>>>> (MCPV); >>>>>>>> GlobalValue *GV = ACPV->getGV(); >>>>>>>> std::string Name; >>>>>>>> - >>>>>>>> - if (GV) { >>>>>>>> + >>>>>>>> + if (ACPV->isLSDA()) { >>>>>>>> + std::stringstream out; >>>>>>>> + out << getFunctionNumber(); >>>>>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>>>>> out.str(), >>>>>>>> + Mangler::Private); >>>>>>>> + } else if (GV) { >>>>>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>>>>> TM.getRelocationModel() == >>>>>>>> Reloc::Static); >>>>>>>> @@ -175,9 +181,7 @@ >>>>>>>> else >>>>>>>> GVNonLazyPtrs[SymName] = Name; >>>>>>>> } >>>>>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>>>>> - Name = ACPV->getSymbol(); >>>>>>>> - else >>>>>>>> + } else >>>>>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>>>>> O << Name; >>>>>>>> >>>>>>>> >>>>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>>>>> >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> = >>>>>>>> =============================================================== >>>>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added) >>>>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug >>>>>>>> 31 20:57:56 2009 >>>>>>>> @@ -0,0 +1,103 @@ >>>>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>>>>> + >>>>>>>> +%struct.A = type { i32* } >>>>>>>> + >>>>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>>>>> +entry: >>>>>>>> + %save_filt.1 = alloca i32 ; >>>>>>>> [#uses=2] >>>>>>>> + %save_eptr.0 = alloca i8* ; >>>>>>>> [#uses=2] >>>>>>>> + %a = alloca %struct.A ; < >>>>>>>> %struct.A*> >>>>>>>> [#uses=3] >>>>>>>> + %eh_exception = alloca i8* ; >>>>>>>> [#uses=5] >>>>>>>> + %eh_selector = alloca i32 ; >>>>>>>> [#uses=3] >>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>> [#uses=0] >>>>>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>>>>> + invoke arm_apcscc void @_Z3barv() >>>>>>>> + to label %invcont unwind label %lpad >>>>>>>> + >>>>>>>> +invcont: ; preds = >>>>>>>> %entry >>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>> + br label %return >>>>>>>> + >>>>>>>> +bb: ; preds = >>>>>>>> %ppad >>>>>>>> + %eh_select = load i32* %eh_selector ; >>>>>>>> [#uses=1] >>>>>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>>>>> + %eh_value = load i8** %eh_exception ; >>>>>>>> [#uses=1] >>>>>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>>>>> [#uses=1] >>>>>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>>>>> [#uses=1] >>>>>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>>>>> + br label %Unwind >>>>>>>> + >>>>>>>> +return: ; preds = >>>>>>>> %invcont >>>>>>>> + ret void >>>>>>>> + >>>>>>>> +lpad: ; preds = >>>>>>>> %entry >>>>>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>>>>> [#uses=1] >>>>>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>>>>> [#uses=1] >>>>>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* >>>>>>>> @llvm.eh.selector.i32 >>>>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 >>>>>>>> to >>>>>>>> i8*), i32 0) ; [#uses=1] >>>>>>>> + store i32 %eh_select2, i32* %eh_selector >>>>>>>> + br label %ppad >>>>>>>> + >>>>>>>> +ppad: ; preds = >>>>>>>> %lpad >>>>>>>> + br label %bb >>>>>>>> + >>>>>>>> +Unwind: ; preds = >>>>>>>> %bb >>>>>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>>>>> [#uses=1] >>>>>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>>>>> + unreachable >>>>>>>> +} >>>>>>>> + >>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>>>>> %this) { >>>>>>>> +entry: >>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>> %struct.A**> [#uses=2] >>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>> [#uses=0] >>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>>>>> [#uses=1] >>>>>>>> + %1 = bitcast i8* %0 to i32* ; >>>>>>>> [#uses=1] >>>>>>>> + %2 = load %struct.A** %this_addr, align 4 ; < >>>>>>>> %struct.A*> >>>>>>>> [#uses=1] >>>>>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>>>>> [#uses=1] >>>>>>>> + store i32* %1, i32** %3, align 4 >>>>>>>> + br label %return >>>>>>>> + >>>>>>>> +return: ; preds = >>>>>>>> %entry >>>>>>>> + ret void >>>>>>>> +} >>>>>>>> + >>>>>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>>>>> + >>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* >>>>>>>> %this) >>>>>>>> nounwind { >>>>>>>> +entry: >>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>> %struct.A**> [#uses=2] >>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>> [#uses=0] >>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>> + %0 = load %struct.A** %this_addr, align 4 ; < >>>>>>>> %struct.A*> >>>>>>>> [#uses=1] >>>>>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>>>>> [#uses=1] >>>>>>>> + %2 = load i32** %1, align 4 ; >>>>>>>> [#uses=1] >>>>>>>> + %3 = bitcast i32* %2 to i8* ; >>>>>>>> [#uses=1] >>>>>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>>>>> + br label %bb >>>>>>>> + >>>>>>>> +bb: ; preds = >>>>>>>> %entry >>>>>>>> + br label %return >>>>>>>> + >>>>>>>> +return: ; preds = >>>>>>>> %bb >>>>>>>> + ret void >>>>>>>> +} >>>>>>>> +;CHECK: L_LSDA_1: >>>>>>>> + >>>>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>>>>> + >>>>>>>> +declare arm_apcscc void @_Z3barv() >>>>>>>> + >>>>>>>> +declare i8* @llvm.eh.exception() nounwind >>>>>>>> + >>>>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>>>>> + >>>>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>>>>> + >>>>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>>>>> + >>>>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> 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 -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090901/cdfeb15c/attachment.html From bob.wilson at apple.com Tue Sep 1 18:18:46 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Sep 2009 23:18:46 -0000 Subject: [llvm-commits] [llvm] r80736 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200909012318.n81NIlua031225@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 1 18:18:46 2009 New Revision: 80736 URL: http://llvm.org/viewvc/llvm-project?rev=80736&view=rev Log: Avoid calling removeVirtualRegisterKilled which iterates over the operands to find the kill, since we already have the operand. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80736&r1=80735&r2=80736&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Sep 1 18:18:46 2009 @@ -1032,7 +1032,8 @@ if (KillMO) { if (!FirstKeptMO) { // All uses of regB are being replaced; move the kill to prevMI. - if (LV && LV->removeVirtualRegisterKilled(regB, mi)) + KillMO->setIsKill(false); + if (LV && LV->getVarInfo(regB).removeKill(mi)) LV->addVirtualRegisterKilled(regB, prevMI); } else { if (!KillMOKept) { From grosbach at apple.com Tue Sep 1 18:42:41 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 16:42:41 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <1AC42A15-0000-4659-A3ED-EC75C8C3FF09@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> <9CB9E538-BF9E-458A-B42D-2BF07831C571@apple.com> <1AC42A15-0000-4659-A3ED-EC75C8C3FF09@apple.com> Message-ID: On Sep 1, 2009, at 4:09 PM, Evan Cheng wrote: > > On Sep 1, 2009, at 2:18 PM, Jim Grosbach wrote: > >>>> >>> >>> Can you give an example of what the .s looks like? I don't think I >>> understand why the function number is needed. >>> >> >> Sure. Here's a snipped from a test case that contains the constant >> pool entry for the lsda (at LCPI7_0). At the end, the LSDA label >> which the constant pool entry is referencing is emitted. >> >> .align 2 >> LCPI7_0: >> .long L_LSDA_7-(LPC20+4) >> >> >> Leh_func_end5: >> .section __DATA,__gcc_except_tab >> .align 2 >> GCC_except_table5: >> .byte 0x0 @ Padding >> Lexception5: >> L_LSDA_7: >> .byte 0xFF @ >> @LPStart format (DW_EH_PE_omit) >> >> The labels suffixed by '5' are from the DwarfWriter using the >> SubprogramCount. The documentation entry for Subprogram counts is >> slightly inaccurate when it says it's a running count of all >> functions being compiled; it's actually a count only of those >> functions which emit EH information (in >> DwarfException::BeginFunction()). Thus, FunctionNumber and >> SubprogramCount do indeed get out of sync currently. >> >> There's nothing magic about using the FunctionNumber as the suffix. >> Anything that's a reproducible way to generate a unique one-per- >> function label name will do. Using the function name, even mangled, >> doesn't work well due to the strangeness that is Objective-C++, >> which is what gave rise to the current implementation. >> >> We could, for a silly example, generate a random string and use >> that for the label name so long as we could guarantee no repetition >> in the sequence. The name would need to either be easily >> rematerializable, or stored off someplace to be retrieved and used >> by the DwarfException table printer later. The latter would need a >> new API to support storing and retrieving the name. Keeping that >> properly hidden away is roughly equivalent to handling the >> FunctionNumber API reasonably. > > Ok. Before this fix you used function name instead of function > number, right? Function name is guaranteed to be consistent between > the two. The only problem is DwarfException is not stripping out the > '001' prefix in the case of objective-c++? Why not fix that problem > instead? It turned out to be a touch more than just that. With the objective-c+ + names, they need to be quoted, and the mangler explicitly won't add the private label prefix to names starting with 001 when doing the makeNameProper. I could tweak the mangler, or munge the string when it comes back, to add it, but that starts to get even more special purpose and fragile. Alternatively, letting the LSDA symbol not be an assembler private label some of the time doesn't feel right either. I wanted to keep this as simple as possible, so I went with the function number instead. No other reason than that. Earlier, I'd also considered adding an attribute to the function itself for the LSDA name and generating it in the SJLJ pass, then using it in the asm printer. That added an additional member to the Function class, plus the accessor methods, though, which seems like overkill and adds public APIs for the accessors that aren't needed for anything else, which I don't like. Other than wanting to keep this as simple as possible, I really don't much care about which details we use. If you prefer a mangling of the function name, I can do that. Random question; in your opinion, how much of the awkwardness of this sort of seemingly trivial thing is a consequence of the tying of the Dwarf debug info bits and the Exception table bits? -Jim >> >>>>>> >>>>>>> >>>>>>> The constant pool entry is part of the ARM AsmPrinter, which has >>>>>>> the getFunctionNumber() directly. It's the most straightforward >>>>>>> solution for the Dwarf writer to use the same interface to >>>>>>> output >>>>>>> the table itself. >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>>>>>> AsmPrinters should >>>>>>>>> /// not normally call this, as the counter is automatically >>>>>>>>> bumped by >>>>>>>>> /// SetupMachineFunction. >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>>> (original) >>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon >>>>>>>>> Aug >>>>>>>>> 31 20:57:56 2009 >>>>>>>>> @@ -25,9 +25,11 @@ >>>>>>>>> #include "llvm/Target/TargetOptions.h" >>>>>>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>>>>>> #include "llvm/Support/Dwarf.h" >>>>>>>>> +#include "llvm/Support/Mangler.h" >>>>>>>>> #include "llvm/Support/Timer.h" >>>>>>>>> #include "llvm/Support/raw_ostream.h" >>>>>>>>> #include "llvm/ADT/StringExtras.h" >>>>>>>>> +#include >>>>>>>>> using namespace llvm; >>>>>>>>> >>>>>>>>> static TimerGroup &getDwarfTimerGroup() { >>>>>>>>> @@ -599,9 +601,12 @@ >>>>>>>>> >>>>>>>>> EmitLabel("exception", SubprogramCount); >>>>>>>>> if (MAI->getExceptionHandlingType() == >>>>>>>>> ExceptionHandling::SjLj) { >>>>>>>>> - std::string SjLjName = "_lsda_"; >>>>>>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>>>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>>>>>> + std::stringstream out; >>>>>>>>> + out << Asm->getFunctionNumber(); >>>>>>>> >>>>>>>> SubprogramCount? >>>>>>>> >>>>>>>>> + std::string LSDAName = >>>>>>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + >>>>>>>>> out.str(), >>>>>>>>> + Mangler::Private); >>>>>>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>>>>>> >>>>>>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>>>>>> Dwarf::EmitLabel to accommodate this, why not just do >>>>>>>> out << LSDAName << 0 << ":\n"; >>>>>>> >>>>>>> Simply consistency that labels get printed via EmitLabel. No >>>>>>> strong >>>>>>> preference either way. I'll change it. >>>>>>> >>>>>>>> >>>>>>>> Evan >>>>>>>> >>>>>>>>> } >>>>>>>>> >>>>>>>>> // Emit the header. >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>>> (original) >>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon >>>>>>>>> Aug 31 >>>>>>>>> 20:57:56 2009 >>>>>>>>> @@ -43,21 +43,27 @@ >>>>>>>>> >>>>>>>>> /// PrintLabelName - Print label name in form used by Dwarf >>>>>>>>> writer. >>>>>>>>> /// >>>>>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>>>>>>> const { >>>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>> + bool ForcePrivate) const { >>>>>>>>> + if (ForcePrivate) >>>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>>> + O << Tag; >>>>>>>>> if (Number) O << Number; >>>>>>>>> } >>>>>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>> - const char *Suffix) const { >>>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>>> + const char *Suffix, bool >>>>>>>>> ForcePrivate) const { >>>>>>>>> + if (ForcePrivate) >>>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>>> + O << Tag; >>>>>>>>> if (Number) O << Number; >>>>>>>>> O << Suffix; >>>>>>>>> } >>>>>>>>> >>>>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>>>>> /// >>>>>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) >>>>>>>>> const { >>>>>>>>> - PrintLabelName(Tag, Number); >>>>>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>>>>>> + bool ForcePrivate) const { >>>>>>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>>>>>> O << ":\n"; >>>>>>>>> } >>>>>>>>> >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>>> (original) >>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug >>>>>>>>> 31 >>>>>>>>> 20:57:56 2009 >>>>>>>>> @@ -100,16 +100,18 @@ >>>>>>>>> void PrintLabelName(const DWLabel &Label) const { >>>>>>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>>>>>> } >>>>>>>>> - void PrintLabelName(const char *Tag, unsigned Number) >>>>>>>>> const; >>>>>>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>> - const char *Suffix) const; >>>>>>>>> + bool ForcePrivate = true) const; >>>>>>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>> + const char *Suffix, bool >>>>>>>>> ForcePrivate = >>>>>>>>> true) const; >>>>>>>>> >>>>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf. >>>>>>>>> /// >>>>>>>>> void EmitLabel(const DWLabel &Label) const { >>>>>>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>>>>>> } >>>>>>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>>>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>>>>>> + bool ForcePrivate = true) const; >>>>>>>>> >>>>>>>>> /// EmitReference - Emit a reference to a label. >>>>>>>>> /// >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>>> (original) >>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon >>>>>>>>> Aug 31 >>>>>>>>> 20:57:56 2009 >>>>>>>>> @@ -20,11 +20,12 @@ >>>>>>>>> using namespace llvm; >>>>>>>>> >>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>>> unsigned id, >>>>>>>>> + ARMCP::ARMCPKind >>>>>>>>> K, >>>>>>>>> unsigned char PCAdj, >>>>>>>>> const char *Modif, >>>>>>>>> bool AddCA) >>>>>>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>>>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>>>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>>> >>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>>>>>> @@ -33,12 +34,12 @@ >>>>>>>>> const char *Modif, >>>>>>>>> bool AddCA) >>>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>>>>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>>>>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind >>>>>>>>> (ARMCP::CPValue), >>>>>>>>> PCAdjust(PCAdj), >>>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>>> >>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>>> const >>>>>>>>> char *Modif) >>>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>>>>>> getContext())), >>>>>>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>>>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), >>>>>>>>> PCAdjust >>>>>>>>> (0), >>>>>>>>> Modifier(Modif) {} >>>>>>>>> >>>>>>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>>>>>> (MachineConstantPool *CP, >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>>> (original) >>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug >>>>>>>>> 31 >>>>>>>>> 20:57:56 2009 >>>>>>>>> @@ -21,12 +21,20 @@ >>>>>>>>> class GlobalValue; >>>>>>>>> class LLVMContext; >>>>>>>>> >>>>>>>>> +namespace ARMCP { >>>>>>>>> + enum ARMCPKind { >>>>>>>>> + CPValue, >>>>>>>>> + CPLSDA >>>>>>>>> + }; >>>>>>>>> +} >>>>>>>>> + >>>>>>>>> /// ARMConstantPoolValue - ARM specific constantpool value. >>>>>>>>> This >>>>>>>>> is used to >>>>>>>>> /// represent PC relative displacement between the address >>>>>>>>> of the >>>>>>>>> load >>>>>>>>> /// instruction and the global value being loaded, i.e. (&GV- >>>>>>>>> (LPIC >>>>>>>>> +8)). >>>>>>>>> class ARMConstantPoolValue : public MachineConstantPoolValue { >>>>>>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>>>>>> const char *S; // ExtSymbol being loaded. >>>>>>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>>>>>> unsigned LabelId; // Label id of the load. >>>>>>>>> unsigned char PCAdjust; // Extra adjustment if constantpool >>>>>>>>> is >>>>>>>>> pc relative. >>>>>>>>> // 8 for ARM, 4 for Thumb. >>>>>>>>> @@ -35,6 +43,7 @@ >>>>>>>>> >>>>>>>>> public: >>>>>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>>>>>> + ARMCP::ARMCPKind Kind = >>>>>>>>> ARMCP::CPValue, >>>>>>>>> unsigned char PCAdj = 0, const char *Modifier >>>>>>>>> = NULL, >>>>>>>>> bool AddCurrentAddress = false); >>>>>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned >>>>>>>>> id, >>>>>>>>> @@ -52,6 +61,7 @@ >>>>>>>>> bool mustAddCurrentAddress() const { return >>>>>>>>> AddCurrentAddress; } >>>>>>>>> unsigned getLabelId() const { return LabelId; } >>>>>>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>>>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>>>>>> >>>>>>>>> virtual unsigned getRelocationInfo() const { >>>>>>>>> // FIXME: This is conservatively claiming that these entries >>>>>>>>> require a >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>>>>>> 20:57:56 2009 >>>>>>>>> @@ -40,6 +40,7 @@ >>>>>>>>> #include "llvm/ADT/VectorExtras.h" >>>>>>>>> #include "llvm/Support/ErrorHandling.h" >>>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>>> +#include >>>>>>>>> using namespace llvm; >>>>>>>>> >>>>>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT >>>>>>>>> &ValVT, >>>>>>>>> EVT &LocVT, >>>>>>>>> @@ -969,7 +970,8 @@ >>>>>>>>> // tBX takes a register source operand. >>>>>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>>>>>> hasV5TOps()) { >>>>>>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>>>>>> - >>>>>>>>> ARMPCLabelIndex, 4); >>>>>>>>> + >>>>>>>>> ARMPCLabelIndex, >>>>>>>>> + >>>>>>>>> ARMCP::CPValue, 4); >>>>>>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>>>>>> (), 4); >>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>>>>>> @@ -1166,7 +1168,7 @@ >>>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>>> - PCAdj, "tlsgd", true); >>>>>>>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>>>>>>> true); >>>>>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, >>>>>>>>> Argument); >>>>>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), >>>>>>>>> Argument, >>>>>>>>> NULL, 0); >>>>>>>>> @@ -1208,7 +1210,7 @@ >>>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>>> - PCAdj, "gottpoff", true); >>>>>>>>> + ARMCP::CPValue, PCAdj, >>>>>>>>> "gottpoff", true); >>>>>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>>>>>> @@ -1284,7 +1286,7 @@ >>>>>>>>> else { >>>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>>>>>> isThumb()?4:8); >>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>>>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>>>>>> ARMCP::CPValue, PCAdj); >>>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>> } >>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>> @@ -1375,10 +1377,6 @@ >>>>>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>>>>>> } >>>>>>>>> case Intrinsic::eh_sjlj_lsda: { >>>>>>>>> - // blah. horrible, horrible hack with the forced magic >>>>>>>>> name. >>>>>>>>> - // really need to clean this up. It belongs in the >>>>>>>>> target- >>>>>>>>> independent >>>>>>>>> - // layer somehow that doesn't require the coupling with >>>>>>>>> the >>>>>>>>> asm >>>>>>>>> - // printer. >>>>>>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>>>>>> EVT PtrVT = getPointerTy(); >>>>>>>>> DebugLoc dl = Op.getDebugLoc(); >>>>>>>>> @@ -1386,13 +1384,9 @@ >>>>>>>>> SDValue CPAddr; >>>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>>>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>>>>>> - // Save off the LSDA name for the AsmPrinter to use when >>>>>>>>> it's time >>>>>>>>> - // to emit the table >>>>>>>>> - std::string LSDAName = "L_lsda_"; >>>>>>>>> - LSDAName += MF.getFunction()->getName(); >>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>> - new ARMConstantPoolValue(*DAG.getContext(), >>>>>>>>> LSDAName.c_str >>>>>>>>> (), >>>>>>>>> - ARMPCLabelIndex, PCAdj); >>>>>>>>> + new ARMConstantPoolValue(MF.getFunction(), >>>>>>>>> ARMPCLabelIndex, >>>>>>>>> + ARMCP::CPLSDA, PCAdj); >>>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>> SDValue Result = >>>>>>>>> >>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ >>>>>>>>> ARMAsmPrinter.cpp >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>>>> (original) >>>>>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon >>>>>>>>> Aug 31 20:57:56 2009 >>>>>>>>> @@ -44,6 +44,7 @@ >>>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>>> #include "llvm/Support/FormattedStream.h" >>>>>>>>> #include >>>>>>>>> +#include >>>>>>>>> using namespace llvm; >>>>>>>>> >>>>>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>>>>>> @@ -159,8 +160,13 @@ >>>>>>>>> ARMConstantPoolValue *ACPV = >>>>>>>>> static_cast >>>>>>>>> (MCPV); >>>>>>>>> GlobalValue *GV = ACPV->getGV(); >>>>>>>>> std::string Name; >>>>>>>>> - >>>>>>>>> - if (GV) { >>>>>>>>> + >>>>>>>>> + if (ACPV->isLSDA()) { >>>>>>>>> + std::stringstream out; >>>>>>>>> + out << getFunctionNumber(); >>>>>>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>>>>>> out.str(), >>>>>>>>> + Mangler::Private); >>>>>>>>> + } else if (GV) { >>>>>>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>>>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>>>>>> TM.getRelocationModel() == >>>>>>>>> Reloc::Static); >>>>>>>>> @@ -175,9 +181,7 @@ >>>>>>>>> else >>>>>>>>> GVNonLazyPtrs[SymName] = Name; >>>>>>>>> } >>>>>>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>>>>>> - Name = ACPV->getSymbol(); >>>>>>>>> - else >>>>>>>>> + } else >>>>>>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>>>>>> O << Name; >>>>>>>>> >>>>>>>>> >>>>>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>>>>>> >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> = >>>>>>>>> ============================================================== >>>>>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>> (added) >>>>>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon >>>>>>>>> Aug >>>>>>>>> 31 20:57:56 2009 >>>>>>>>> @@ -0,0 +1,103 @@ >>>>>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>>>>>> + >>>>>>>>> +%struct.A = type { i32* } >>>>>>>>> + >>>>>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>>>>>> +entry: >>>>>>>>> + %save_filt.1 = alloca i32 ; >>>>>>>>> [#uses=2] >>>>>>>>> + %save_eptr.0 = alloca i8* ; >>>>>>>>> [#uses=2] >>>>>>>>> + %a = alloca %struct.A ; < >>>>>>>>> %struct.A*> >>>>>>>>> [#uses=3] >>>>>>>>> + %eh_exception = alloca i8* ; >>>>>>>>> [#uses=5] >>>>>>>>> + %eh_selector = alloca i32 ; >>>>>>>>> [#uses=3] >>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>> [#uses=0] >>>>>>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>>>>>> + invoke arm_apcscc void @_Z3barv() >>>>>>>>> + to label %invcont unwind label %lpad >>>>>>>>> + >>>>>>>>> +invcont: ; preds = >>>>>>>>> %entry >>>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>>> + br label %return >>>>>>>>> + >>>>>>>>> +bb: ; preds = >>>>>>>>> %ppad >>>>>>>>> + %eh_select = load i32* %eh_selector ; >>>>>>>>> [#uses=1] >>>>>>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>>>>>> + %eh_value = load i8** %eh_exception ; >>>>>>>>> [#uses=1] >>>>>>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>>>>>> [#uses=1] >>>>>>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>>>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>>>>>> [#uses=1] >>>>>>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>>>>>> + br label %Unwind >>>>>>>>> + >>>>>>>>> +return: ; preds = >>>>>>>>> %invcont >>>>>>>>> + ret void >>>>>>>>> + >>>>>>>>> +lpad: ; preds = >>>>>>>>> %entry >>>>>>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>>>>>> [#uses=1] >>>>>>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>>>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>>>>>> [#uses=1] >>>>>>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* >>>>>>>>> @llvm.eh.selector.i32 >>>>>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* >>>>>>>>> @__gxx_personality_sj0 to >>>>>>>>> i8*), i32 0) ; [#uses=1] >>>>>>>>> + store i32 %eh_select2, i32* %eh_selector >>>>>>>>> + br label %ppad >>>>>>>>> + >>>>>>>>> +ppad: ; preds = >>>>>>>>> %lpad >>>>>>>>> + br label %bb >>>>>>>>> + >>>>>>>>> +Unwind: ; preds = >>>>>>>>> %bb >>>>>>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>>>>>> [#uses=1] >>>>>>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>>>>>> + unreachable >>>>>>>>> +} >>>>>>>>> + >>>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>>>>>> %this) { >>>>>>>>> +entry: >>>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>>> %struct.A**> [#uses=2] >>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>> [#uses=0] >>>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>>>>>> [#uses=1] >>>>>>>>> + %1 = bitcast i8* %0 to i32* ; >>>>>>>>> [#uses=1] >>>>>>>>> + %2 = load %struct.A** %this_addr, align 4 ; < >>>>>>>>> %struct.A*> >>>>>>>>> [#uses=1] >>>>>>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>>>>>> [#uses=1] >>>>>>>>> + store i32* %1, i32** %3, align 4 >>>>>>>>> + br label %return >>>>>>>>> + >>>>>>>>> +return: ; preds = >>>>>>>>> %entry >>>>>>>>> + ret void >>>>>>>>> +} >>>>>>>>> + >>>>>>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>>>>>> + >>>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* >>>>>>>>> %this) >>>>>>>>> nounwind { >>>>>>>>> +entry: >>>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>>> %struct.A**> [#uses=2] >>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>> [#uses=0] >>>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>>> + %0 = load %struct.A** %this_addr, align 4 ; < >>>>>>>>> %struct.A*> >>>>>>>>> [#uses=1] >>>>>>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>>>>>> [#uses=1] >>>>>>>>> + %2 = load i32** %1, align 4 ; >>>>>>>>> [#uses=1] >>>>>>>>> + %3 = bitcast i32* %2 to i8* ; >>>>>>>>> [#uses=1] >>>>>>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>>>>>> + br label %bb >>>>>>>>> + >>>>>>>>> +bb: ; preds = >>>>>>>>> %entry >>>>>>>>> + br label %return >>>>>>>>> + >>>>>>>>> +return: ; preds = >>>>>>>>> %bb >>>>>>>>> + ret void >>>>>>>>> +} >>>>>>>>> +;CHECK: L_LSDA_1: >>>>>>>>> + >>>>>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>>>>>> + >>>>>>>>> +declare arm_apcscc void @_Z3barv() >>>>>>>>> + >>>>>>>>> +declare i8* @llvm.eh.exception() nounwind >>>>>>>>> + >>>>>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>>>>>> + >>>>>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>>>>>> + >>>>>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>>>>>> + >>>>>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> 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 dpatel at apple.com Tue Sep 1 18:56:42 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Sep 2009 23:56:42 -0000 Subject: [llvm-commits] [llvm] r80738 - in /llvm/trunk/lib/VMCore: LLVMContext.cpp LLVMContextImpl.h Metadata.cpp Message-ID: <200909012356.n81NugUa003722@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 1 18:56:42 2009 New Revision: 80738 URL: http://llvm.org/viewvc/llvm-project?rev=80738&view=rev Log: For now disable MDNode uniquing. This fixes llvm-gcc bootstrap failure on certain Mac OS X 10.5. I am working on a proper fix. Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Metadata.cpp Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=80738&r1=80737&r2=80738&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Sep 1 18:56:42 2009 @@ -48,10 +48,10 @@ bool Changed = false; while (1) { - for (LLVMContextImpl::MDNodeMapTy::MapTy::iterator - I = pImpl->MDNodes.map_begin(), - E = pImpl->MDNodes.map_end(); I != E; ++I) { - const MDNode *N = cast(I->second); + for (SmallPtrSet::iterator + I = pImpl->MDNodes.begin(), + E = pImpl->MDNodes.end(); I != E; ++I) { + const MDNode *N = cast(*I); if (N->use_empty()) DeadMDNodes.push_back(N); } Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=80738&r1=80737&r2=80738&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Sep 1 18:56:42 2009 @@ -108,10 +108,7 @@ ValueMap AggZeroConstants; - typedef ValueMap, Type, MDNode, true /*largekey*/> - MDNodeMapTy; - - MDNodeMapTy MDNodes; + SmallPtrSet MDNodes; typedef ValueMap, ArrayType, ConstantArray, true /*largekey*/> ArrayConstantsTy; Modified: llvm/trunk/lib/VMCore/Metadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=80738&r1=80737&r2=80738&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Metadata.cpp (original) +++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Sep 1 18:56:42 2009 @@ -77,13 +77,13 @@ } MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) { - LLVMContextImpl *pImpl = Context.pImpl; std::vector V; V.reserve(NumVals); for (unsigned i = 0; i < NumVals; ++i) V.push_back(Vals[i]); - return pImpl->MDNodes.getOrCreate(Type::getMetadataTy(Context), V); + // FIXME : Avoid creating duplicate node. + return new MDNode(Context, &V[0], V.size()); } /// dropAllReferences - Remove all uses and clear node vector. @@ -92,16 +92,8 @@ Node.clear(); } -static std::vector getValType(MDNode *N) { - std::vector Elements; - Elements.reserve(N->getNumElements()); - for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) - Elements.push_back(N->getElement(i)); - return Elements; -} - MDNode::~MDNode() { - getType()->getContext().pImpl->MDNodes.remove(this); + getType()->getContext().pImpl->MDNodes.erase(this); dropAllReferences(); } From dpatel at apple.com Tue Sep 1 19:16:33 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Sep 2009 00:16:33 -0000 Subject: [llvm-commits] [llvm] r80741 - /llvm/trunk/unittests/VMCore/MetadataTest.cpp Message-ID: <200909020016.n820GYC0006344@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 1 19:16:33 2009 New Revision: 80741 URL: http://llvm.org/viewvc/llvm-project?rev=80741&view=rev Log: Disable uniqueness test for now. Modified: llvm/trunk/unittests/VMCore/MetadataTest.cpp Modified: llvm/trunk/unittests/VMCore/MetadataTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/MetadataTest.cpp?rev=80741&r1=80740&r2=80741&view=diff ============================================================================== --- llvm/trunk/unittests/VMCore/MetadataTest.cpp (original) +++ llvm/trunk/unittests/VMCore/MetadataTest.cpp Tue Sep 1 19:16:33 2009 @@ -85,7 +85,7 @@ MDNode *n2 = MDNode::get(Context, &c1, 1); MDNode *n3 = MDNode::get(Context, &V[0], 3); EXPECT_NE(n1, n2); - EXPECT_EQ(n1, n3); + // FIXME: Enable uniqueness test. EXPECT_EQ(n1, n3); EXPECT_EQ(3u, n1->getNumElements()); EXPECT_EQ(s1, n1->getElement(0)); From evan.cheng at apple.com Tue Sep 1 19:19:03 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 02 Sep 2009 00:19:03 -0000 Subject: [llvm-commits] [llvm] r80742 - /llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Message-ID: <200909020019.n820J4xP006666@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 1 19:19:03 2009 New Revision: 80742 URL: http://llvm.org/viewvc/llvm-project?rev=80742&view=rev Log: Fix PR4845: r77946 completely broke x86_64 Darwin (or any situation where the desired triplet is a sub-target, e.g. thumbv7 vs. arm host). Reverting the patch isn't quite right either since the previous behavior does not allow the triplet to be overridden with -march. Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp?rev=80742&r1=80741&r2=80742&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Tue Sep 1 19:19:03 2009 @@ -43,19 +43,41 @@ /// selectTarget - Pick a target either via -march or by guessing the native /// arch. Add any CPU features specified via -mcpu or -mattr. TargetMachine *JIT::selectTarget(ModuleProvider *MP, std::string *ErrorStr) { - Triple TheTriple(sys::getHostTriple()); + Module &Mod = *MP->getModule(); + + Triple TheTriple(Mod.getTargetTriple()); + if (TheTriple.getTriple().empty()) + TheTriple.setTriple(sys::getHostTriple()); // Adjust the triple to match what the user requested. - if (!MArch.empty()) - TheTriple.setArch(Triple::getArchTypeForLLVMName(MArch)); + const Target *TheTarget = 0; + if (!MArch.empty()) { + for (TargetRegistry::iterator it = TargetRegistry::begin(), + ie = TargetRegistry::end(); it != ie; ++it) { + if (MArch == it->getName()) { + TheTarget = &*it; + break; + } + } + + if (!TheTarget) { + errs() << "JIT: error: invalid target '" << MArch << "'.\n"; + return 0; + } - std::string Error; - const Target *TheTarget = - TargetRegistry::lookupTarget(TheTriple.getTriple(), Error); - if (TheTarget == 0) { - if (ErrorStr) - *ErrorStr = Error; - return 0; + // Adjust the triple to match (if known), otherwise stick with the + // module/host triple. + Triple::ArchType Type = Triple::getArchTypeForLLVMName(MArch); + if (Type != Triple::UnknownArch) + TheTriple.setArch(Type); + } else { + std::string Error; + TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), Error); + if (TheTarget == 0) { + if (ErrorStr) + *ErrorStr = Error; + return 0; + } } if (!TheTarget->hasJIT()) { From evan.cheng at apple.com Tue Sep 1 19:38:21 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 17:38:21 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> <9CB9E538-BF9E-458A-B42D-2BF07831C571@apple.com> <1AC42A15-0000-4659-A3ED-EC75C8C3FF09@apple.com> Message-ID: <20C2C9F1-02BA-430B-966D-47E1633847A6@apple.com> On Sep 1, 2009, at 4:42 PM, Jim Grosbach wrote: > > On Sep 1, 2009, at 4:09 PM, Evan Cheng wrote: > >> >> On Sep 1, 2009, at 2:18 PM, Jim Grosbach wrote: >> >>>>> >>>> >>>> Can you give an example of what the .s looks like? I don't think >>>> I understand why the function number is needed. >>>> >>> >>> Sure. Here's a snipped from a test case that contains the >>> constant pool entry for the lsda (at LCPI7_0). At the end, the >>> LSDA label which the constant pool entry is referencing is emitted. >>> >>> .align 2 >>> LCPI7_0: >>> .long L_LSDA_7-(LPC20+4) >>> >>> >>> Leh_func_end5: >>> .section __DATA,__gcc_except_tab >>> .align 2 >>> GCC_except_table5: >>> .byte 0x0 @ Padding >>> Lexception5: >>> L_LSDA_7: >>> .byte 0xFF @ >>> @LPStart format (DW_EH_PE_omit) >>> >>> The labels suffixed by '5' are from the DwarfWriter using the >>> SubprogramCount. The documentation entry for Subprogram counts is >>> slightly inaccurate when it says it's a running count of all >>> functions being compiled; it's actually a count only of those >>> functions which emit EH information (in >>> DwarfException::BeginFunction()). Thus, FunctionNumber and >>> SubprogramCount do indeed get out of sync currently. >>> >>> There's nothing magic about using the FunctionNumber as the >>> suffix. Anything that's a reproducible way to generate a unique >>> one-per-function label name will do. Using the function name, even >>> mangled, doesn't work well due to the strangeness that is >>> Objective-C++, which is what gave rise to the current >>> implementation. >>> >>> We could, for a silly example, generate a random string and use >>> that for the label name so long as we could guarantee no >>> repetition in the sequence. The name would need to either be >>> easily rematerializable, or stored off someplace to be retrieved >>> and used by the DwarfException table printer later. The latter >>> would need a new API to support storing and retrieving the name. >>> Keeping that properly hidden away is roughly equivalent to >>> handling the FunctionNumber API reasonably. >> >> Ok. Before this fix you used function name instead of function >> number, right? Function name is guaranteed to be consistent between >> the two. The only problem is DwarfException is not stripping out >> the '001' prefix in the case of objective-c++? Why not fix that >> problem instead? > > It turned out to be a touch more than just that. With the objective-c > ++ names, they need to be quoted, and the mangler explicitly won't > add the private label prefix to names starting with 001 when doing > the makeNameProper. I could tweak the mangler, or munge the string > when it comes back, to add it, but that starts to get even more > special purpose and fragile. Alternatively, letting the LSDA symbol > not be an assembler private label some of the time doesn't feel > right either. I wanted to keep this as simple as possible, so I went > with the function number instead. No other reason than that. Ok. And the quote must be around the private label prefix? If not, then that can be easily fixed. > > Earlier, I'd also considered adding an attribute to the function > itself for the LSDA name and generating it in the SJLJ pass, then > using it in the asm printer. That added an additional member to the > Function class, plus the accessor methods, though, which seems like > overkill and adds public APIs for the accessors that aren't needed > for anything else, which I don't like. > > Other than wanting to keep this as simple as possible, I really > don't much care about which details we use. If you prefer a mangling > of the function name, I can do that. No. If it requires changing the mangler, then just leave it as it is. It's ewww but the alternative is not any better. > > Random question; in your opinion, how much of the awkwardness of > this sort of seemingly trivial thing is a consequence of the tying > of the Dwarf debug info bits and the Exception table bits? The issue here is two places are independently constructing the name of the label. The ARM asm printer should not have to do it. Evan > > -Jim > > >>> >>>>>>> >>>>>>>> >>>>>>>> The constant pool entry is part of the ARM AsmPrinter, which >>>>>>>> has >>>>>>>> the getFunctionNumber() directly. It's the most straightforward >>>>>>>> solution for the Dwarf writer to use the same interface to >>>>>>>> output >>>>>>>> the table itself. >>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>>>>>>> AsmPrinters should >>>>>>>>>> /// not normally call this, as the counter is automatically >>>>>>>>>> bumped by >>>>>>>>>> /// SetupMachineFunction. >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ >>>>>>>>>> DwarfException.cpp >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>>>> (original) >>>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>>>> Mon Aug >>>>>>>>>> 31 20:57:56 2009 >>>>>>>>>> @@ -25,9 +25,11 @@ >>>>>>>>>> #include "llvm/Target/TargetOptions.h" >>>>>>>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>>>>>>> #include "llvm/Support/Dwarf.h" >>>>>>>>>> +#include "llvm/Support/Mangler.h" >>>>>>>>>> #include "llvm/Support/Timer.h" >>>>>>>>>> #include "llvm/Support/raw_ostream.h" >>>>>>>>>> #include "llvm/ADT/StringExtras.h" >>>>>>>>>> +#include >>>>>>>>>> using namespace llvm; >>>>>>>>>> >>>>>>>>>> static TimerGroup &getDwarfTimerGroup() { >>>>>>>>>> @@ -599,9 +601,12 @@ >>>>>>>>>> >>>>>>>>>> EmitLabel("exception", SubprogramCount); >>>>>>>>>> if (MAI->getExceptionHandlingType() == >>>>>>>>>> ExceptionHandling::SjLj) { >>>>>>>>>> - std::string SjLjName = "_lsda_"; >>>>>>>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>>>>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>>>>>>> + std::stringstream out; >>>>>>>>>> + out << Asm->getFunctionNumber(); >>>>>>>>> >>>>>>>>> SubprogramCount? >>>>>>>>> >>>>>>>>>> + std::string LSDAName = >>>>>>>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + >>>>>>>>>> out.str(), >>>>>>>>>> + Mangler::Private); >>>>>>>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>>>>>>> >>>>>>>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>>>>>>> Dwarf::EmitLabel to accommodate this, why not just do >>>>>>>>> out << LSDAName << 0 << ":\n"; >>>>>>>> >>>>>>>> Simply consistency that labels get printed via EmitLabel. No >>>>>>>> strong >>>>>>>> preference either way. I'll change it. >>>>>>>> >>>>>>>>> >>>>>>>>> Evan >>>>>>>>> >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> // Emit the header. >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>>>> (original) >>>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon >>>>>>>>>> Aug 31 >>>>>>>>>> 20:57:56 2009 >>>>>>>>>> @@ -43,21 +43,27 @@ >>>>>>>>>> >>>>>>>>>> /// PrintLabelName - Print label name in form used by Dwarf >>>>>>>>>> writer. >>>>>>>>>> /// >>>>>>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) >>>>>>>>>> const { >>>>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>> + bool ForcePrivate) const { >>>>>>>>>> + if (ForcePrivate) >>>>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>>>> + O << Tag; >>>>>>>>>> if (Number) O << Number; >>>>>>>>>> } >>>>>>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>> - const char *Suffix) const { >>>>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>>>> + const char *Suffix, bool >>>>>>>>>> ForcePrivate) const { >>>>>>>>>> + if (ForcePrivate) >>>>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>>>> + O << Tag; >>>>>>>>>> if (Number) O << Number; >>>>>>>>>> O << Suffix; >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> /// EmitLabel - Emit location label for internal use by >>>>>>>>>> Dwarf. >>>>>>>>>> /// >>>>>>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) >>>>>>>>>> const { >>>>>>>>>> - PrintLabelName(Tag, Number); >>>>>>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>>>>>>> + bool ForcePrivate) const { >>>>>>>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>>>>>>> O << ":\n"; >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>>>> (original) >>>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon >>>>>>>>>> Aug 31 >>>>>>>>>> 20:57:56 2009 >>>>>>>>>> @@ -100,16 +100,18 @@ >>>>>>>>>> void PrintLabelName(const DWLabel &Label) const { >>>>>>>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>>>>>>> } >>>>>>>>>> - void PrintLabelName(const char *Tag, unsigned Number) >>>>>>>>>> const; >>>>>>>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>> - const char *Suffix) const; >>>>>>>>>> + bool ForcePrivate = true) const; >>>>>>>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>> + const char *Suffix, bool >>>>>>>>>> ForcePrivate = >>>>>>>>>> true) const; >>>>>>>>>> >>>>>>>>>> /// EmitLabel - Emit location label for internal use by >>>>>>>>>> Dwarf. >>>>>>>>>> /// >>>>>>>>>> void EmitLabel(const DWLabel &Label) const { >>>>>>>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>>>>>>> } >>>>>>>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>>>>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>>>>>>> + bool ForcePrivate = true) const; >>>>>>>>>> >>>>>>>>>> /// EmitReference - Emit a reference to a label. >>>>>>>>>> /// >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>>>> (original) >>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon >>>>>>>>>> Aug 31 >>>>>>>>>> 20:57:56 2009 >>>>>>>>>> @@ -20,11 +20,12 @@ >>>>>>>>>> using namespace llvm; >>>>>>>>>> >>>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>>>> unsigned id, >>>>>>>>>> + >>>>>>>>>> ARMCP::ARMCPKind K, >>>>>>>>>> unsigned char PCAdj, >>>>>>>>>> const char *Modif, >>>>>>>>>> bool AddCA) >>>>>>>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>>>>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>>>>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>>>> >>>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>>>>>>> @@ -33,12 +34,12 @@ >>>>>>>>>> const char *Modif, >>>>>>>>>> bool AddCA) >>>>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), >>>>>>>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>>>>>>> + GV(NULL), S(strdup(s)), LabelId(id), >>>>>>>>>> Kind(ARMCP::CPValue), >>>>>>>>>> PCAdjust(PCAdj), >>>>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>>>> >>>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>>>> const >>>>>>>>>> char *Modif) >>>>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>>>>>>> getContext())), >>>>>>>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>>>>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), >>>>>>>>>> PCAdjust >>>>>>>>>> (0), >>>>>>>>>> Modifier(Modif) {} >>>>>>>>>> >>>>>>>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>>>>>>> (MachineConstantPool *CP, >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>>>> (original) >>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon >>>>>>>>>> Aug 31 >>>>>>>>>> 20:57:56 2009 >>>>>>>>>> @@ -21,12 +21,20 @@ >>>>>>>>>> class GlobalValue; >>>>>>>>>> class LLVMContext; >>>>>>>>>> >>>>>>>>>> +namespace ARMCP { >>>>>>>>>> + enum ARMCPKind { >>>>>>>>>> + CPValue, >>>>>>>>>> + CPLSDA >>>>>>>>>> + }; >>>>>>>>>> +} >>>>>>>>>> + >>>>>>>>>> /// ARMConstantPoolValue - ARM specific constantpool value. >>>>>>>>>> This >>>>>>>>>> is used to >>>>>>>>>> /// represent PC relative displacement between the address >>>>>>>>>> of the >>>>>>>>>> load >>>>>>>>>> /// instruction and the global value being loaded, i.e. >>>>>>>>>> (&GV-(LPIC >>>>>>>>>> +8)). >>>>>>>>>> class ARMConstantPoolValue : public >>>>>>>>>> MachineConstantPoolValue { >>>>>>>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>>>>>>> const char *S; // ExtSymbol being loaded. >>>>>>>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>>>>>>> unsigned LabelId; // Label id of the load. >>>>>>>>>> unsigned char PCAdjust; // Extra adjustment if >>>>>>>>>> constantpool is >>>>>>>>>> pc relative. >>>>>>>>>> // 8 for ARM, 4 for Thumb. >>>>>>>>>> @@ -35,6 +43,7 @@ >>>>>>>>>> >>>>>>>>>> public: >>>>>>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>>>>>>> + ARMCP::ARMCPKind Kind = >>>>>>>>>> ARMCP::CPValue, >>>>>>>>>> unsigned char PCAdj = 0, const char *Modifier >>>>>>>>>> = NULL, >>>>>>>>>> bool AddCurrentAddress = false); >>>>>>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, >>>>>>>>>> unsigned id, >>>>>>>>>> @@ -52,6 +61,7 @@ >>>>>>>>>> bool mustAddCurrentAddress() const { return >>>>>>>>>> AddCurrentAddress; } >>>>>>>>>> unsigned getLabelId() const { return LabelId; } >>>>>>>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>>>>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>>>>>>> >>>>>>>>>> virtual unsigned getRelocationInfo() const { >>>>>>>>>> // FIXME: This is conservatively claiming that these entries >>>>>>>>>> require a >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>>>>>>> 20:57:56 2009 >>>>>>>>>> @@ -40,6 +40,7 @@ >>>>>>>>>> #include "llvm/ADT/VectorExtras.h" >>>>>>>>>> #include "llvm/Support/ErrorHandling.h" >>>>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>>>> +#include >>>>>>>>>> using namespace llvm; >>>>>>>>>> >>>>>>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT >>>>>>>>>> &ValVT, >>>>>>>>>> EVT &LocVT, >>>>>>>>>> @@ -969,7 +970,8 @@ >>>>>>>>>> // tBX takes a register source operand. >>>>>>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>>>>>>> hasV5TOps()) { >>>>>>>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>>>>>>> - >>>>>>>>>> ARMPCLabelIndex, 4); >>>>>>>>>> + >>>>>>>>>> ARMPCLabelIndex, >>>>>>>>>> + >>>>>>>>>> ARMCP::CPValue, 4); >>>>>>>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>>>>>>> (), 4); >>>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>>>>>>> @@ -1166,7 +1168,7 @@ >>>>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>>>> - PCAdj, "tlsgd", true); >>>>>>>>>> + ARMCP::CPValue, PCAdj, "tlsgd", >>>>>>>>>> true); >>>>>>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, >>>>>>>>>> Argument); >>>>>>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), >>>>>>>>>> Argument, >>>>>>>>>> NULL, 0); >>>>>>>>>> @@ -1208,7 +1210,7 @@ >>>>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>>>> - PCAdj, "gottpoff", true); >>>>>>>>>> + ARMCP::CPValue, PCAdj, >>>>>>>>>> "gottpoff", true); >>>>>>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>>>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>>>>>>> @@ -1284,7 +1286,7 @@ >>>>>>>>>> else { >>>>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>>>>>>> isThumb()?4:8); >>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>>>>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>>>>>>> ARMCP::CPValue, PCAdj); >>>>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>> } >>>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>>> @@ -1375,10 +1377,6 @@ >>>>>>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>>>>>>> } >>>>>>>>>> case Intrinsic::eh_sjlj_lsda: { >>>>>>>>>> - // blah. horrible, horrible hack with the forced magic >>>>>>>>>> name. >>>>>>>>>> - // really need to clean this up. It belongs in the >>>>>>>>>> target- >>>>>>>>>> independent >>>>>>>>>> - // layer somehow that doesn't require the coupling >>>>>>>>>> with the >>>>>>>>>> asm >>>>>>>>>> - // printer. >>>>>>>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>>>>>>> EVT PtrVT = getPointerTy(); >>>>>>>>>> DebugLoc dl = Op.getDebugLoc(); >>>>>>>>>> @@ -1386,13 +1384,9 @@ >>>>>>>>>> SDValue CPAddr; >>>>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>>>>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>>>>>>> - // Save off the LSDA name for the AsmPrinter to use when >>>>>>>>>> it's time >>>>>>>>>> - // to emit the table >>>>>>>>>> - std::string LSDAName = "L_lsda_"; >>>>>>>>>> - LSDAName += MF.getFunction()->getName(); >>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>> - new ARMConstantPoolValue(*DAG.getContext(), >>>>>>>>>> LSDAName.c_str >>>>>>>>>> (), >>>>>>>>>> - ARMPCLabelIndex, PCAdj); >>>>>>>>>> + new ARMConstantPoolValue(MF.getFunction(), >>>>>>>>>> ARMPCLabelIndex, >>>>>>>>>> + ARMCP::CPLSDA, PCAdj); >>>>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>>> SDValue Result = >>>>>>>>>> >>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ >>>>>>>>>> ARMAsmPrinter.cpp >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>>>>> (original) >>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>>>>> Mon >>>>>>>>>> Aug 31 20:57:56 2009 >>>>>>>>>> @@ -44,6 +44,7 @@ >>>>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>>>> #include "llvm/Support/FormattedStream.h" >>>>>>>>>> #include >>>>>>>>>> +#include >>>>>>>>>> using namespace llvm; >>>>>>>>>> >>>>>>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>>>>>>> @@ -159,8 +160,13 @@ >>>>>>>>>> ARMConstantPoolValue *ACPV = >>>>>>>>>> static_cast >>>>>>>>>> (MCPV); >>>>>>>>>> GlobalValue *GV = ACPV->getGV(); >>>>>>>>>> std::string Name; >>>>>>>>>> - >>>>>>>>>> - if (GV) { >>>>>>>>>> + >>>>>>>>>> + if (ACPV->isLSDA()) { >>>>>>>>>> + std::stringstream out; >>>>>>>>>> + out << getFunctionNumber(); >>>>>>>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>>>>>>> out.str(), >>>>>>>>>> + Mangler::Private); >>>>>>>>>> + } else if (GV) { >>>>>>>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>>>>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>>>>>>> TM.getRelocationModel() == >>>>>>>>>> Reloc::Static); >>>>>>>>>> @@ -175,9 +181,7 @@ >>>>>>>>>> else >>>>>>>>>> GVNonLazyPtrs[SymName] = Name; >>>>>>>>>> } >>>>>>>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>>>>>>> - Name = ACPV->getSymbol(); >>>>>>>>>> - else >>>>>>>>>> + } else >>>>>>>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>>>>>>> O << Name; >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>>>>>>> >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> = >>>>>>>>>> ============================================================= >>>>>>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>>> (added) >>>>>>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon >>>>>>>>>> Aug >>>>>>>>>> 31 20:57:56 2009 >>>>>>>>>> @@ -0,0 +1,103 @@ >>>>>>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>>>>>>> + >>>>>>>>>> +%struct.A = type { i32* } >>>>>>>>>> + >>>>>>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>>>>>>> +entry: >>>>>>>>>> + %save_filt.1 = alloca i32 ; >>>>>>>>>> [#uses=2] >>>>>>>>>> + %save_eptr.0 = alloca i8* ; >>>>>>>>>> [#uses=2] >>>>>>>>>> + %a = alloca %struct.A ; < >>>>>>>>>> %struct.A*> >>>>>>>>>> [#uses=3] >>>>>>>>>> + %eh_exception = alloca i8* ; >>>>>>>>>> [#uses=5] >>>>>>>>>> + %eh_selector = alloca i32 ; >>>>>>>>>> [#uses=3] >>>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>>> [#uses=0] >>>>>>>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>>>>>>> + invoke arm_apcscc void @_Z3barv() >>>>>>>>>> + to label %invcont unwind label %lpad >>>>>>>>>> + >>>>>>>>>> +invcont: ; preds >>>>>>>>>> = %entry >>>>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>>>> + br label %return >>>>>>>>>> + >>>>>>>>>> +bb: ; preds >>>>>>>>>> = %ppad >>>>>>>>>> + %eh_select = load i32* %eh_selector ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>>>>>>> + %eh_value = load i8** %eh_exception ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>>>>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>>>>>>> + br label %Unwind >>>>>>>>>> + >>>>>>>>>> +return: ; preds = >>>>>>>>>> %invcont >>>>>>>>>> + ret void >>>>>>>>>> + >>>>>>>>>> +lpad: ; preds >>>>>>>>>> = %entry >>>>>>>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>>>>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* >>>>>>>>>> @llvm.eh.selector.i32 >>>>>>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* >>>>>>>>>> @__gxx_personality_sj0 to >>>>>>>>>> i8*), i32 0) ; [#uses=1] >>>>>>>>>> + store i32 %eh_select2, i32* %eh_selector >>>>>>>>>> + br label %ppad >>>>>>>>>> + >>>>>>>>>> +ppad: ; preds >>>>>>>>>> = %lpad >>>>>>>>>> + br label %bb >>>>>>>>>> + >>>>>>>>>> +Unwind: ; preds >>>>>>>>>> = %bb >>>>>>>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>>>>>>> + unreachable >>>>>>>>>> +} >>>>>>>>>> + >>>>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>>>>>>> %this) { >>>>>>>>>> +entry: >>>>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>>>> %struct.A**> [#uses=2] >>>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>>> [#uses=0] >>>>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + %1 = bitcast i8* %0 to i32* ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + %2 = load %struct.A** %this_addr, align 4 ; < >>>>>>>>>> %struct.A*> >>>>>>>>>> [#uses=1] >>>>>>>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + store i32* %1, i32** %3, align 4 >>>>>>>>>> + br label %return >>>>>>>>>> + >>>>>>>>>> +return: ; preds >>>>>>>>>> = %entry >>>>>>>>>> + ret void >>>>>>>>>> +} >>>>>>>>>> + >>>>>>>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>>>>>>> + >>>>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* >>>>>>>>>> %this) >>>>>>>>>> nounwind { >>>>>>>>>> +entry: >>>>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>>>> %struct.A**> [#uses=2] >>>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>>> [#uses=0] >>>>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>>>> + %0 = load %struct.A** %this_addr, align 4 ; < >>>>>>>>>> %struct.A*> >>>>>>>>>> [#uses=1] >>>>>>>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + %2 = load i32** %1, align 4 ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + %3 = bitcast i32* %2 to i8* ; >>>>>>>>>> [#uses=1] >>>>>>>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>>>>>>> + br label %bb >>>>>>>>>> + >>>>>>>>>> +bb: ; preds >>>>>>>>>> = %entry >>>>>>>>>> + br label %return >>>>>>>>>> + >>>>>>>>>> +return: ; preds >>>>>>>>>> = %bb >>>>>>>>>> + ret void >>>>>>>>>> +} >>>>>>>>>> +;CHECK: L_LSDA_1: >>>>>>>>>> + >>>>>>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>>>>>>> + >>>>>>>>>> +declare arm_apcscc void @_Z3barv() >>>>>>>>>> + >>>>>>>>>> +declare i8* @llvm.eh.exception() nounwind >>>>>>>>>> + >>>>>>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>>>>>>> + >>>>>>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>>>>>>> + >>>>>>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>>>>>>> + >>>>>>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> 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 evan.cheng at apple.com Tue Sep 1 19:45:08 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 17:45:08 -0700 Subject: [llvm-commits] [llvm] r80733 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp In-Reply-To: <200909012251.n81Mp8oP027611@zion.cs.uiuc.edu> References: <200909012251.n81Mp8oP027611@zion.cs.uiuc.edu> Message-ID: <613CC49A-8E62-4223-BC30-EC4D93152D02@apple.com> Thanks. Evan On Sep 1, 2009, at 3:51 PM, Bob Wilson wrote: > Author: bwilson > Date: Tue Sep 1 17:51:08 2009 > New Revision: 80733 > > URL: http://llvm.org/viewvc/llvm-project?rev=80733&view=rev > Log: > Refactor some code into separate functions. No functional changes. > > Modified: > llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > > Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=80733&r1=80732&r2=80733&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) > +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Sep 1 > 17:51:08 2009 > @@ -106,6 +106,15 @@ > MachineFunction::iterator &mbbi, > unsigned RegB, unsigned Dist); > > + typedef std::pair, MachineInstr*> > NewKill; > + bool canUpdateDeletedKills(SmallVector &Kills, > + SmallVector &NewKills, > + MachineBasicBlock *MBB, unsigned > Dist); > + bool DeleteUnusedInstr(MachineBasicBlock::iterator &mi, > + MachineBasicBlock::iterator &nmi, > + MachineFunction::iterator &mbbi, > + unsigned regB, unsigned regBIdx, > unsigned Dist); > + > void ProcessCopy(MachineInstr *MI, MachineBasicBlock *MBB, > SmallPtrSet &Processed); > > @@ -736,6 +745,75 @@ > return true; > } > > +/// canUpdateDeletedKills - Check if all the registers listed in > Kills are > +/// killed by instructions in MBB preceding the current instruction > at > +/// position Dist. If so, return true and record information about > the > +/// preceding kills in NewKills. > +bool TwoAddressInstructionPass:: > +canUpdateDeletedKills(SmallVector &Kills, > + SmallVector &NewKills, > + MachineBasicBlock *MBB, unsigned Dist) { > + while (!Kills.empty()) { > + unsigned Kill = Kills.back(); > + Kills.pop_back(); > + if (TargetRegisterInfo::isPhysicalRegister(Kill)) > + return false; > + > + MachineInstr *LastKill = FindLastUseInMBB(Kill, MBB, Dist); > + if (!LastKill) > + return false; > + > + bool isModRef = LastKill->modifiesRegister(Kill); > + NewKills.push_back(std::make_pair(std::make_pair(Kill, isModRef), > + LastKill)); > + } > + return true; > +} > + > +/// DeleteUnusedInstr - If an instruction with a tied register > operand can > +/// be safely deleted, just delete it. > +bool > + > TwoAddressInstructionPass > ::DeleteUnusedInstr(MachineBasicBlock::iterator &mi, > + > MachineBasicBlock::iterator &nmi, > + > MachineFunction::iterator &mbbi, > + unsigned regB, > unsigned regBIdx, > + unsigned Dist) { > + // Check if the instruction has no side effects and if all its > defs are dead. > + SmallVector Kills; > + if (!isSafeToDelete(mi, regB, TII, Kills)) > + return false; > + > + // If this instruction kills some virtual registers, we need to > + // update the kill information. If it's not possible to do so, > + // then bail out. > + SmallVector NewKills; > + if (!canUpdateDeletedKills(Kills, NewKills, &*mbbi, Dist)) > + return false; > + > + if (LV) { > + while (!NewKills.empty()) { > + MachineInstr *NewKill = NewKills.back().second; > + unsigned Kill = NewKills.back().first.first; > + bool isDead = NewKills.back().first.second; > + NewKills.pop_back(); > + if (LV->removeVirtualRegisterKilled(Kill, mi)) { > + if (isDead) > + LV->addVirtualRegisterDead(Kill, NewKill); > + else > + LV->addVirtualRegisterKilled(Kill, NewKill); > + } > + } > + > + // If regB was marked as a kill, update its Kills list. > + if (mi->getOperand(regBIdx).isKill()) > + LV->removeVirtualRegisterKilled(regB, mi); > + } > + > + mbbi->erase(mi); // Nuke the old inst. > + mi = nmi; > + return true; > +} > + > /// runOnMachineFunction - Reduce two-address instructions to two > operands. > /// > bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction > &MF) { > @@ -822,61 +900,13 @@ > // allow us to coalesce A and B together, eliminating the > copy we are > // about to insert. > if (!isKilled(*mi, regB, MRI, TII)) { > + > // If regA is dead and the instruction can be deleted, > just delete > // it so it doesn't clobber regB. > - SmallVector Kills; > if (mi->getOperand(ti).isDead() && > - isSafeToDelete(mi, regB, TII, Kills)) { > - SmallVector > - ,MachineInstr*>, 4> NewKills; > - bool ReallySafe = true; > - // If this instruction kills some virtual registers, we > need > - // update the kill information. If it's not possible to > do so, > - // then bail out. > - while (!Kills.empty()) { > - unsigned Kill = Kills.back(); > - Kills.pop_back(); > - if (TargetRegisterInfo::isPhysicalRegister(Kill)) { > - ReallySafe = false; > - break; > - } > - MachineInstr *LastKill = FindLastUseInMBB(Kill, > &*mbbi, Dist); > - if (LastKill) { > - bool isModRef = LastKill->modifiesRegister(Kill); > - > NewKills.push_back(std::make_pair(std::make_pair(Kill,isModRef), > - LastKill)); > - } else { > - ReallySafe = false; > - break; > - } > - } > - > - if (ReallySafe) { > - if (LV) { > - while (!NewKills.empty()) { > - MachineInstr *NewKill = NewKills.back().second; > - unsigned Kill = NewKills.back().first.first; > - bool isDead = NewKills.back().first.second; > - NewKills.pop_back(); > - if (LV->removeVirtualRegisterKilled(Kill, mi)) { > - if (isDead) > - LV->addVirtualRegisterDead(Kill, NewKill); > - else > - LV->addVirtualRegisterKilled(Kill, NewKill); > - } > - } > - > - // We're really going to nuke the old inst. If regB > was marked > - // as a kill we need to update its Kills list. > - if (mi->getOperand(si).isKill()) > - LV->removeVirtualRegisterKilled(regB, mi); > - } > - > - mbbi->erase(mi); // Nuke the old inst. > - mi = nmi; > - ++NumDeletes; > - break; // Done with this instruction. > - } > + DeleteUnusedInstr(mi, nmi, mbbi, regB, si, Dist)) { > + ++NumDeletes; > + break; // Done with this instruction. > } > > // If this instruction is commutative, check to see if C > dies. If > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From grosbach at apple.com Tue Sep 1 19:47:11 2009 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 1 Sep 2009 17:47:11 -0700 Subject: [llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll In-Reply-To: <20C2C9F1-02BA-430B-966D-47E1633847A6@apple.com> References: <200909010157.n811vvxb006472@zion.cs.uiuc.edu> <350849CF-9AAA-4936-8732-599B84F6F882@apple.com> <357FB835-F5AD-4836-9D91-F37237CF99E3@apple.com> <380A8413-649E-4650-B122-1E3E637CF1C7@apple.com> <9CB9E538-BF9E-458A-B42D-2BF07831C571@apple.com> <1AC42A15-0000-4659-A3ED-EC75C8C3FF09@apple.com> <20C2C9F1-02BA-430B-966D-47E1633847A6@apple.com> Message-ID: <2FADC6A0-B9A4-4AC5-9ABB-24A28766F3F1@apple.com> On Sep 1, 2009, at 5:38 PM, Evan Cheng wrote: > > On Sep 1, 2009, at 4:42 PM, Jim Grosbach wrote: > >> >> On Sep 1, 2009, at 4:09 PM, Evan Cheng wrote: >> >>> >>> On Sep 1, 2009, at 2:18 PM, Jim Grosbach wrote: >>> >>>>>> >>>>> >>>>> Can you give an example of what the .s looks like? I don't think >>>>> I understand why the function number is needed. >>>>> >>>> >>>> Sure. Here's a snipped from a test case that contains the >>>> constant pool entry for the lsda (at LCPI7_0). At the end, the >>>> LSDA label which the constant pool entry is referencing is emitted. >>>> >>>> .align 2 >>>> LCPI7_0: >>>> .long L_LSDA_7-(LPC20+4) >>>> >>>> >>>> Leh_func_end5: >>>> .section __DATA,__gcc_except_tab >>>> .align 2 >>>> GCC_except_table5: >>>> .byte 0x0 @ Padding >>>> Lexception5: >>>> L_LSDA_7: >>>> .byte 0xFF @ >>>> @LPStart format (DW_EH_PE_omit) >>>> >>>> The labels suffixed by '5' are from the DwarfWriter using the >>>> SubprogramCount. The documentation entry for Subprogram counts is >>>> slightly inaccurate when it says it's a running count of all >>>> functions being compiled; it's actually a count only of those >>>> functions which emit EH information (in >>>> DwarfException::BeginFunction()). Thus, FunctionNumber and >>>> SubprogramCount do indeed get out of sync currently. >>>> >>>> There's nothing magic about using the FunctionNumber as the >>>> suffix. Anything that's a reproducible way to generate a unique >>>> one-per-function label name will do. Using the function name, >>>> even mangled, doesn't work well due to the strangeness that is >>>> Objective-C++, which is what gave rise to the current >>>> implementation. >>>> >>>> We could, for a silly example, generate a random string and use >>>> that for the label name so long as we could guarantee no >>>> repetition in the sequence. The name would need to either be >>>> easily rematerializable, or stored off someplace to be retrieved >>>> and used by the DwarfException table printer later. The latter >>>> would need a new API to support storing and retrieving the name. >>>> Keeping that properly hidden away is roughly equivalent to >>>> handling the FunctionNumber API reasonably. >>> >>> Ok. Before this fix you used function name instead of function >>> number, right? Function name is guaranteed to be consistent >>> between the two. The only problem is DwarfException is not >>> stripping out the '001' prefix in the case of objective-c++? Why >>> not fix that problem instead? >> >> It turned out to be a touch more than just that. With the objective- >> c++ names, they need to be quoted, and the mangler explicitly won't >> add the private label prefix to names starting with 001 when doing >> the makeNameProper. I could tweak the mangler, or munge the string >> when it comes back, to add it, but that starts to get even more >> special purpose and fragile. Alternatively, letting the LSDA symbol >> not be an assembler private label some of the time doesn't feel >> right either. I wanted to keep this as simple as possible, so I >> went with the function number instead. No other reason than that. > > Ok. And the quote must be around the private label prefix? If not, > then that can be easily fixed. Yes, the quote must be around the prefix. > >> >> Earlier, I'd also considered adding an attribute to the function >> itself for the LSDA name and generating it in the SJLJ pass, then >> using it in the asm printer. That added an additional member to the >> Function class, plus the accessor methods, though, which seems like >> overkill and adds public APIs for the accessors that aren't needed >> for anything else, which I don't like. >> >> Other than wanting to keep this as simple as possible, I really >> don't much care about which details we use. If you prefer a >> mangling of the function name, I can do that. > > No. If it requires changing the mangler, then just leave it as it > is. It's ewww but the alternative is not any better. > > [...] > The issue here is two places are independently constructing the name > of the label. The ARM asm printer should not have to do it. Completely agreed on both counts. Longer term, I believe the exception table should be constructed such that it's available as a GlobalValue and not constructed and emitted directly by the AsmPrinter. Then this becomes a GV constant pool reference just like any other, and the exception table goes out to the assembly file, or the object file, or whatever other emitter we have, without duplicating the logic required for constructing it. Thanks for talking through things. -Jim > > Evan > > >> >> -Jim >> >> >>>> >>>>>>>> >>>>>>>>> >>>>>>>>> The constant pool entry is part of the ARM AsmPrinter, which >>>>>>>>> has >>>>>>>>> the getFunctionNumber() directly. It's the most >>>>>>>>> straightforward >>>>>>>>> solution for the Dwarf writer to use the same interface to >>>>>>>>> output >>>>>>>>> the table itself. >>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> /// IncrementFunctionNumber - Increase Function Number. >>>>>>>>>>> AsmPrinters should >>>>>>>>>>> /// not normally call this, as the counter is automatically >>>>>>>>>>> bumped by >>>>>>>>>>> /// SetupMachineFunction. >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ >>>>>>>>>>> DwarfException.cpp >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>>>>> (original) >>>>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp >>>>>>>>>>> Mon Aug >>>>>>>>>>> 31 20:57:56 2009 >>>>>>>>>>> @@ -25,9 +25,11 @@ >>>>>>>>>>> #include "llvm/Target/TargetOptions.h" >>>>>>>>>>> #include "llvm/Target/TargetRegisterInfo.h" >>>>>>>>>>> #include "llvm/Support/Dwarf.h" >>>>>>>>>>> +#include "llvm/Support/Mangler.h" >>>>>>>>>>> #include "llvm/Support/Timer.h" >>>>>>>>>>> #include "llvm/Support/raw_ostream.h" >>>>>>>>>>> #include "llvm/ADT/StringExtras.h" >>>>>>>>>>> +#include >>>>>>>>>>> using namespace llvm; >>>>>>>>>>> >>>>>>>>>>> static TimerGroup &getDwarfTimerGroup() { >>>>>>>>>>> @@ -599,9 +601,12 @@ >>>>>>>>>>> >>>>>>>>>>> EmitLabel("exception", SubprogramCount); >>>>>>>>>>> if (MAI->getExceptionHandlingType() == >>>>>>>>>>> ExceptionHandling::SjLj) { >>>>>>>>>>> - std::string SjLjName = "_lsda_"; >>>>>>>>>>> - SjLjName += MF->getFunction()->getName().str(); >>>>>>>>>>> - EmitLabel(SjLjName.c_str(), 0); >>>>>>>>>>> + std::stringstream out; >>>>>>>>>>> + out << Asm->getFunctionNumber(); >>>>>>>>>> >>>>>>>>>> SubprogramCount? >>>>>>>>>> >>>>>>>>>>> + std::string LSDAName = >>>>>>>>>>> + Asm->Mang->makeNameProper(std::string("LSDA_") + >>>>>>>>>>> out.str(), >>>>>>>>>>> + Mangler::Private); >>>>>>>>>>> + EmitLabel(LSDAName.c_str(), 0, false); >>>>>>>>>> >>>>>>>>>> Rather than making arbitrary change Dwarf::PrintLabelName and >>>>>>>>>> Dwarf::EmitLabel to accommodate this, why not just do >>>>>>>>>> out << LSDAName << 0 << ":\n"; >>>>>>>>> >>>>>>>>> Simply consistency that labels get printed via EmitLabel. No >>>>>>>>> strong >>>>>>>>> preference either way. I'll change it. >>>>>>>>> >>>>>>>>>> >>>>>>>>>> Evan >>>>>>>>>> >>>>>>>>>>> } >>>>>>>>>>> >>>>>>>>>>> // Emit the header. >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp >>>>>>>>>>> (original) >>>>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon >>>>>>>>>>> Aug 31 >>>>>>>>>>> 20:57:56 2009 >>>>>>>>>>> @@ -43,21 +43,27 @@ >>>>>>>>>>> >>>>>>>>>>> /// PrintLabelName - Print label name in form used by >>>>>>>>>>> Dwarf writer. >>>>>>>>>>> /// >>>>>>>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned >>>>>>>>>>> Number) >>>>>>>>>>> const { >>>>>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned >>>>>>>>>>> Number, >>>>>>>>>>> + bool ForcePrivate) const { >>>>>>>>>>> + if (ForcePrivate) >>>>>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>>>>> + O << Tag; >>>>>>>>>>> if (Number) O << Number; >>>>>>>>>>> } >>>>>>>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>>> - const char *Suffix) const { >>>>>>>>>>> - O << MAI->getPrivateGlobalPrefix() << Tag; >>>>>>>>>>> + const char *Suffix, bool >>>>>>>>>>> ForcePrivate) const { >>>>>>>>>>> + if (ForcePrivate) >>>>>>>>>>> + O << MAI->getPrivateGlobalPrefix(); >>>>>>>>>>> + O << Tag; >>>>>>>>>>> if (Number) O << Number; >>>>>>>>>>> O << Suffix; >>>>>>>>>>> } >>>>>>>>>>> >>>>>>>>>>> /// EmitLabel - Emit location label for internal use by >>>>>>>>>>> Dwarf. >>>>>>>>>>> /// >>>>>>>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) >>>>>>>>>>> const { >>>>>>>>>>> - PrintLabelName(Tag, Number); >>>>>>>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number, >>>>>>>>>>> + bool ForcePrivate) const { >>>>>>>>>>> + PrintLabelName(Tag, Number, ForcePrivate); >>>>>>>>>>> O << ":\n"; >>>>>>>>>>> } >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h >>>>>>>>>>> (original) >>>>>>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon >>>>>>>>>>> Aug 31 >>>>>>>>>>> 20:57:56 2009 >>>>>>>>>>> @@ -100,16 +100,18 @@ >>>>>>>>>>> void PrintLabelName(const DWLabel &Label) const { >>>>>>>>>>> PrintLabelName(Label.getTag(), Label.getNumber()); >>>>>>>>>>> } >>>>>>>>>>> - void PrintLabelName(const char *Tag, unsigned Number) >>>>>>>>>>> const; >>>>>>>>>>> void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>>> - const char *Suffix) const; >>>>>>>>>>> + bool ForcePrivate = true) const; >>>>>>>>>>> + void PrintLabelName(const char *Tag, unsigned Number, >>>>>>>>>>> + const char *Suffix, bool >>>>>>>>>>> ForcePrivate = >>>>>>>>>>> true) const; >>>>>>>>>>> >>>>>>>>>>> /// EmitLabel - Emit location label for internal use by >>>>>>>>>>> Dwarf. >>>>>>>>>>> /// >>>>>>>>>>> void EmitLabel(const DWLabel &Label) const { >>>>>>>>>>> EmitLabel(Label.getTag(), Label.getNumber()); >>>>>>>>>>> } >>>>>>>>>>> - void EmitLabel(const char *Tag, unsigned Number) const; >>>>>>>>>>> + void EmitLabel(const char *Tag, unsigned Number, >>>>>>>>>>> + bool ForcePrivate = true) const; >>>>>>>>>>> >>>>>>>>>>> /// EmitReference - Emit a reference to a label. >>>>>>>>>>> /// >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp >>>>>>>>>>> (original) >>>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon >>>>>>>>>>> Aug 31 >>>>>>>>>>> 20:57:56 2009 >>>>>>>>>>> @@ -20,11 +20,12 @@ >>>>>>>>>>> using namespace llvm; >>>>>>>>>>> >>>>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, >>>>>>>>>>> unsigned id, >>>>>>>>>>> + >>>>>>>>>>> ARMCP::ARMCPKind K, >>>>>>>>>>> unsigned char PCAdj, >>>>>>>>>>> const char *Modif, >>>>>>>>>>> bool AddCA) >>>>>>>>>>> : MachineConstantPoolValue((const Type*)gv->getType()), >>>>>>>>>>> - GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), >>>>>>>>>>> + GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), >>>>>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>>>>> >>>>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, >>>>>>>>>>> @@ -33,12 +34,12 @@ >>>>>>>>>>> const char *Modif, >>>>>>>>>>> bool AddCA) >>>>>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty >>>>>>>>>>> (C)), >>>>>>>>>>> - GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), >>>>>>>>>>> + GV(NULL), S(strdup(s)), LabelId(id), Kind >>>>>>>>>>> (ARMCP::CPValue), >>>>>>>>>>> PCAdjust(PCAdj), >>>>>>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {} >>>>>>>>>>> >>>>>>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue >>>>>>>>>>> *gv, const >>>>>>>>>>> char *Modif) >>>>>>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv- >>>>>>>>>>>> getContext())), >>>>>>>>>>> - GV(gv), S(NULL), LabelId(0), PCAdjust(0), >>>>>>>>>>> + GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), >>>>>>>>>>> PCAdjust >>>>>>>>>>> (0), >>>>>>>>>>> Modifier(Modif) {} >>>>>>>>>>> >>>>>>>>>>> int ARMConstantPoolValue::getExistingMachineCPValue >>>>>>>>>>> (MachineConstantPool *CP, >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h >>>>>>>>>>> (original) >>>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon >>>>>>>>>>> Aug 31 >>>>>>>>>>> 20:57:56 2009 >>>>>>>>>>> @@ -21,12 +21,20 @@ >>>>>>>>>>> class GlobalValue; >>>>>>>>>>> class LLVMContext; >>>>>>>>>>> >>>>>>>>>>> +namespace ARMCP { >>>>>>>>>>> + enum ARMCPKind { >>>>>>>>>>> + CPValue, >>>>>>>>>>> + CPLSDA >>>>>>>>>>> + }; >>>>>>>>>>> +} >>>>>>>>>>> + >>>>>>>>>>> /// ARMConstantPoolValue - ARM specific constantpool >>>>>>>>>>> value. This >>>>>>>>>>> is used to >>>>>>>>>>> /// represent PC relative displacement between the address >>>>>>>>>>> of the >>>>>>>>>>> load >>>>>>>>>>> /// instruction and the global value being loaded, i.e. >>>>>>>>>>> (&GV-(LPIC >>>>>>>>>>> +8)). >>>>>>>>>>> class ARMConstantPoolValue : public >>>>>>>>>>> MachineConstantPoolValue { >>>>>>>>>>> GlobalValue *GV; // GlobalValue being loaded. >>>>>>>>>>> const char *S; // ExtSymbol being loaded. >>>>>>>>>>> + ARMCP::ARMCPKind Kind; // Value or LSDA? >>>>>>>>>>> unsigned LabelId; // Label id of the load. >>>>>>>>>>> unsigned char PCAdjust; // Extra adjustment if >>>>>>>>>>> constantpool is >>>>>>>>>>> pc relative. >>>>>>>>>>> // 8 for ARM, 4 for Thumb. >>>>>>>>>>> @@ -35,6 +43,7 @@ >>>>>>>>>>> >>>>>>>>>>> public: >>>>>>>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id, >>>>>>>>>>> + ARMCP::ARMCPKind Kind = >>>>>>>>>>> ARMCP::CPValue, >>>>>>>>>>> unsigned char PCAdj = 0, const char *Modifier >>>>>>>>>>> = NULL, >>>>>>>>>>> bool AddCurrentAddress = false); >>>>>>>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, >>>>>>>>>>> unsigned id, >>>>>>>>>>> @@ -52,6 +61,7 @@ >>>>>>>>>>> bool mustAddCurrentAddress() const { return >>>>>>>>>>> AddCurrentAddress; } >>>>>>>>>>> unsigned getLabelId() const { return LabelId; } >>>>>>>>>>> unsigned char getPCAdjustment() const { return PCAdjust; } >>>>>>>>>>> + bool isLSDA() { return Kind == ARMCP::CPLSDA; } >>>>>>>>>>> >>>>>>>>>>> virtual unsigned getRelocationInfo() const { >>>>>>>>>>> // FIXME: This is conservatively claiming that these entries >>>>>>>>>>> require a >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31 >>>>>>>>>>> 20:57:56 2009 >>>>>>>>>>> @@ -40,6 +40,7 @@ >>>>>>>>>>> #include "llvm/ADT/VectorExtras.h" >>>>>>>>>>> #include "llvm/Support/ErrorHandling.h" >>>>>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>>>>> +#include >>>>>>>>>>> using namespace llvm; >>>>>>>>>>> >>>>>>>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT >>>>>>>>>>> &ValVT, >>>>>>>>>>> EVT &LocVT, >>>>>>>>>>> @@ -969,7 +970,8 @@ >>>>>>>>>>> // tBX takes a register source operand. >>>>>>>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget- >>>>>>>>>>>> hasV5TOps()) { >>>>>>>>>>> ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, >>>>>>>>>>> - >>>>>>>>>>> ARMPCLabelIndex, 4); >>>>>>>>>>> + >>>>>>>>>>> ARMPCLabelIndex, >>>>>>>>>>> + >>>>>>>>>>> ARMCP::CPValue, 4); >>>>>>>>>>> SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy >>>>>>>>>>> (), 4); >>>>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>>>> Callee = DAG.getLoad(getPointerTy(), dl, >>>>>>>>>>> @@ -1166,7 +1168,7 @@ >>>>>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>>>>> - PCAdj, "tlsgd", true); >>>>>>>>>>> + ARMCP::CPValue, PCAdj, >>>>>>>>>>> "tlsgd", >>>>>>>>>>> true); >>>>>>>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, >>>>>>>>>>> Argument); >>>>>>>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), >>>>>>>>>>> Argument, >>>>>>>>>>> NULL, 0); >>>>>>>>>>> @@ -1208,7 +1210,7 @@ >>>>>>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; >>>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, >>>>>>>>>>> - PCAdj, "gottpoff", true); >>>>>>>>>>> + ARMCP::CPValue, PCAdj, >>>>>>>>>>> "gottpoff", true); >>>>>>>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); >>>>>>>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); >>>>>>>>>>> @@ -1284,7 +1286,7 @@ >>>>>>>>>>> else { >>>>>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget- >>>>>>>>>>>> isThumb()?4:8); >>>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>>> - new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); >>>>>>>>>>> + new ARMConstantPoolValue(GV, ARMPCLabelIndex, >>>>>>>>>>> ARMCP::CPValue, PCAdj); >>>>>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>>> } >>>>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>>>> @@ -1375,10 +1377,6 @@ >>>>>>>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT); >>>>>>>>>>> } >>>>>>>>>>> case Intrinsic::eh_sjlj_lsda: { >>>>>>>>>>> - // blah. horrible, horrible hack with the forced >>>>>>>>>>> magic name. >>>>>>>>>>> - // really need to clean this up. It belongs in the >>>>>>>>>>> target- >>>>>>>>>>> independent >>>>>>>>>>> - // layer somehow that doesn't require the coupling >>>>>>>>>>> with the >>>>>>>>>>> asm >>>>>>>>>>> - // printer. >>>>>>>>>>> MachineFunction &MF = DAG.getMachineFunction(); >>>>>>>>>>> EVT PtrVT = getPointerTy(); >>>>>>>>>>> DebugLoc dl = Op.getDebugLoc(); >>>>>>>>>>> @@ -1386,13 +1384,9 @@ >>>>>>>>>>> SDValue CPAddr; >>>>>>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) >>>>>>>>>>> ? 0 : (Subtarget->isThumb() ? 4 : 8); >>>>>>>>>>> - // Save off the LSDA name for the AsmPrinter to use >>>>>>>>>>> when >>>>>>>>>>> it's time >>>>>>>>>>> - // to emit the table >>>>>>>>>>> - std::string LSDAName = "L_lsda_"; >>>>>>>>>>> - LSDAName += MF.getFunction()->getName(); >>>>>>>>>>> ARMConstantPoolValue *CPV = >>>>>>>>>>> - new ARMConstantPoolValue(*DAG.getContext(), >>>>>>>>>>> LSDAName.c_str >>>>>>>>>>> (), >>>>>>>>>>> - ARMPCLabelIndex, PCAdj); >>>>>>>>>>> + new ARMConstantPoolValue(MF.getFunction(), >>>>>>>>>>> ARMPCLabelIndex, >>>>>>>>>>> + ARMCP::CPLSDA, PCAdj); >>>>>>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); >>>>>>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); >>>>>>>>>>> SDValue Result = >>>>>>>>>>> >>>>>>>>>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ >>>>>>>>>>> ARMAsmPrinter.cpp >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>>>>>> (original) >>>>>>>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >>>>>>>>>>> Mon >>>>>>>>>>> Aug 31 20:57:56 2009 >>>>>>>>>>> @@ -44,6 +44,7 @@ >>>>>>>>>>> #include "llvm/Support/MathExtras.h" >>>>>>>>>>> #include "llvm/Support/FormattedStream.h" >>>>>>>>>>> #include >>>>>>>>>>> +#include >>>>>>>>>>> using namespace llvm; >>>>>>>>>>> >>>>>>>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed"); >>>>>>>>>>> @@ -159,8 +160,13 @@ >>>>>>>>>>> ARMConstantPoolValue *ACPV = >>>>>>>>>>> static_cast >>>>>>>>>>> (MCPV); >>>>>>>>>>> GlobalValue *GV = ACPV->getGV(); >>>>>>>>>>> std::string Name; >>>>>>>>>>> - >>>>>>>>>>> - if (GV) { >>>>>>>>>>> + >>>>>>>>>>> + if (ACPV->isLSDA()) { >>>>>>>>>>> + std::stringstream out; >>>>>>>>>>> + out << getFunctionNumber(); >>>>>>>>>>> + Name = Mang->makeNameProper(std::string("LSDA_") + >>>>>>>>>>> out.str(), >>>>>>>>>>> + Mangler::Private); >>>>>>>>>>> + } else if (GV) { >>>>>>>>>>> bool isIndirect = Subtarget->isTargetDarwin() && >>>>>>>>>>> Subtarget->GVIsIndirectSymbol(GV, >>>>>>>>>>> TM.getRelocationModel() == >>>>>>>>>>> Reloc::Static); >>>>>>>>>>> @@ -175,9 +181,7 @@ >>>>>>>>>>> else >>>>>>>>>>> GVNonLazyPtrs[SymName] = Name; >>>>>>>>>>> } >>>>>>>>>>> - } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) >>>>>>>>>>> - Name = ACPV->getSymbol(); >>>>>>>>>>> - else >>>>>>>>>>> + } else >>>>>>>>>>> Name = Mang->makeNameProper(ACPV->getSymbol()); >>>>>>>>>>> O << Name; >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto >>>>>>>>>>> >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> = >>>>>>>>>>> ============================================================ >>>>>>>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>>>> (added) >>>>>>>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll >>>>>>>>>>> Mon Aug >>>>>>>>>>> 31 20:57:56 2009 >>>>>>>>>>> @@ -0,0 +1,103 @@ >>>>>>>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s >>>>>>>>>>> + >>>>>>>>>>> +%struct.A = type { i32* } >>>>>>>>>>> + >>>>>>>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() { >>>>>>>>>>> +entry: >>>>>>>>>>> + %save_filt.1 = alloca i32 ; >>>>>>>>>>> [#uses=2] >>>>>>>>>>> + %save_eptr.0 = alloca i8* ; >>>>>>>>>>> [#uses=2] >>>>>>>>>>> + %a = alloca %struct.A ; < >>>>>>>>>>> %struct.A*> >>>>>>>>>>> [#uses=3] >>>>>>>>>>> + %eh_exception = alloca i8* ; >>>>>>>>>>> [#uses=5] >>>>>>>>>>> + %eh_selector = alloca i32 ; >>>>>>>>>>> [#uses=3] >>>>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>>>> [#uses=0] >>>>>>>>>>> + call arm_apcscc void @_ZN1AC1Ev(%struct.A* %a) >>>>>>>>>>> + invoke arm_apcscc void @_Z3barv() >>>>>>>>>>> + to label %invcont unwind label %lpad >>>>>>>>>>> + >>>>>>>>>>> +invcont: ; preds >>>>>>>>>>> = %entry >>>>>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>>>>> + br label %return >>>>>>>>>>> + >>>>>>>>>>> +bb: ; preds >>>>>>>>>>> = %ppad >>>>>>>>>>> + %eh_select = load i32* %eh_selector ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + store i32 %eh_select, i32* %save_filt.1, align 4 >>>>>>>>>>> + %eh_value = load i8** %eh_exception ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + store i8* %eh_value, i8** %save_eptr.0, align 4 >>>>>>>>>>> + call arm_apcscc void @_ZN1AD1Ev(%struct.A* %a) nounwind >>>>>>>>>>> + %0 = load i8** %save_eptr.0, align 4 ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + store i8* %0, i8** %eh_exception, align 4 >>>>>>>>>>> + %1 = load i32* %save_filt.1, align 4 ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + store i32 %1, i32* %eh_selector, align 4 >>>>>>>>>>> + br label %Unwind >>>>>>>>>>> + >>>>>>>>>>> +return: ; preds = >>>>>>>>>>> %invcont >>>>>>>>>>> + ret void >>>>>>>>>>> + >>>>>>>>>>> +lpad: ; preds >>>>>>>>>>> = %entry >>>>>>>>>>> + %eh_ptr = call i8* @llvm.eh.exception() ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + store i8* %eh_ptr, i8** %eh_exception >>>>>>>>>>> + %eh_ptr1 = load i8** %eh_exception ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %eh_select2 = call i32 (i8*, i8*, ...)* >>>>>>>>>>> @llvm.eh.selector.i32 >>>>>>>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* >>>>>>>>>>> @__gxx_personality_sj0 to >>>>>>>>>>> i8*), i32 0) ; [#uses=1] >>>>>>>>>>> + store i32 %eh_select2, i32* %eh_selector >>>>>>>>>>> + br label %ppad >>>>>>>>>>> + >>>>>>>>>>> +ppad: ; preds >>>>>>>>>>> = %lpad >>>>>>>>>>> + br label %bb >>>>>>>>>>> + >>>>>>>>>>> +Unwind: ; preds >>>>>>>>>>> = %bb >>>>>>>>>>> + %eh_ptr3 = load i8** %eh_exception ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + call arm_apcscc void @_Unwind_SjLj_Resume(i8* %eh_ptr3) >>>>>>>>>>> + unreachable >>>>>>>>>>> +} >>>>>>>>>>> + >>>>>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* >>>>>>>>>>> %this) { >>>>>>>>>>> +entry: >>>>>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>>>>> %struct.A**> [#uses=2] >>>>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>>>> [#uses=0] >>>>>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>>>>> + %0 = call arm_apcscc i8* @_Znwm(i32 4) ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %1 = bitcast i8* %0 to i32* ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %2 = load %struct.A** %this_addr, align 4 ; < >>>>>>>>>>> %struct.A*> >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + store i32* %1, i32** %3, align 4 >>>>>>>>>>> + br label %return >>>>>>>>>>> + >>>>>>>>>>> +return: ; preds >>>>>>>>>>> = %entry >>>>>>>>>>> + ret void >>>>>>>>>>> +} >>>>>>>>>>> + >>>>>>>>>>> +declare arm_apcscc i8* @_Znwm(i32) >>>>>>>>>>> + >>>>>>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* >>>>>>>>>>> %this) >>>>>>>>>>> nounwind { >>>>>>>>>>> +entry: >>>>>>>>>>> + %this_addr = alloca %struct.A* ; < >>>>>>>>>>> %struct.A**> [#uses=2] >>>>>>>>>>> + %"alloca point" = bitcast i32 0 to i32 ; >>>>>>>>>>> [#uses=0] >>>>>>>>>>> + store %struct.A* %this, %struct.A** %this_addr >>>>>>>>>>> + %0 = load %struct.A** %this_addr, align 4 ; < >>>>>>>>>>> %struct.A*> >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %2 = load i32** %1, align 4 ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + %3 = bitcast i32* %2 to i8* ; >>>>>>>>>>> [#uses=1] >>>>>>>>>>> + call arm_apcscc void @_ZdlPv(i8* %3) nounwind >>>>>>>>>>> + br label %bb >>>>>>>>>>> + >>>>>>>>>>> +bb: ; preds >>>>>>>>>>> = %entry >>>>>>>>>>> + br label %return >>>>>>>>>>> + >>>>>>>>>>> +return: ; preds >>>>>>>>>>> = %bb >>>>>>>>>>> + ret void >>>>>>>>>>> +} >>>>>>>>>>> +;CHECK: L_LSDA_1: >>>>>>>>>>> + >>>>>>>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind >>>>>>>>>>> + >>>>>>>>>>> +declare arm_apcscc void @_Z3barv() >>>>>>>>>>> + >>>>>>>>>>> +declare i8* @llvm.eh.exception() nounwind >>>>>>>>>>> + >>>>>>>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind >>>>>>>>>>> + >>>>>>>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind >>>>>>>>>>> + >>>>>>>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...) >>>>>>>>>>> + >>>>>>>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*) >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> 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 bob.wilson at apple.com Tue Sep 1 19:49:12 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 1 Sep 2009 17:49:12 -0700 Subject: [llvm-commits] cleanup patch for TwoAddressInstructionPass Message-ID: Evan, I started looking at the overhaul you suggested. It is not done yet, but I have tried to clean up the existing optimizations for the case where a source register is only tied to one destination. There was a lot of redundancy in this code, not to mention the goto. I've rearranged it to try to clean that up. It is not exactly identical in behavior to the previous code, though. Can you review this before I commit it? I think you have a better understanding of all the issues in this code than I do. Thanks. -------------- next part -------------- A non-text attachment was scrubbed... Name: tworeg-cleanup.patch Type: application/octet-stream Size: 5692 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090901/8f77e2db/attachment.obj From scallanan at apple.com Tue Sep 1 19:55:49 2009 From: scallanan at apple.com (Sean Callanan) Date: Wed, 02 Sep 2009 00:55:49 -0000 Subject: [llvm-commits] [llvm] r80746 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <200909020055.n820tndP011520@zion.cs.uiuc.edu> Author: spyffe Date: Tue Sep 1 19:55:49 2009 New Revision: 80746 URL: http://llvm.org/viewvc/llvm-project?rev=80746&view=rev Log: Fixed the asmstrings for 8-bit, 16-bit, and 32-bit ADD %rAX, imm instructions. Added a 64-bit ADD %RAX, imm32 instruction. Added all 4 forms for AND %rAX, imm and CMP %rAX, imm. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=80746&r1=80745&r2=80746&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 1 19:55:49 2009 @@ -392,6 +392,10 @@ // let Defs = [EFLAGS] in { + +def ADD64i32 : RI<0x05, RawFrm, (outs), (ins i32imm:$src), + "add{q}\t{$src, %rax|%rax, $src}", []>; + let isTwoAddress = 1 in { let isConvertibleToThreeAddress = 1 in { let isCommutable = 1 in @@ -870,6 +874,9 @@ [(store (not (loadi64 addr:$dst)), addr:$dst)]>; let Defs = [EFLAGS] in { +def AND64i32 : RI<0x25, RawFrm, (outs), (ins i32imm:$src), + "and{q}\t{$src, %rax|%rax, $src}", []>; + let isTwoAddress = 1 in { let isCommutable = 1 in def AND64rr : RI<0x21, MRMDestReg, @@ -1006,6 +1013,9 @@ [(X86cmp (and (loadi64 addr:$src1), i64immSExt32:$src2), 0), (implicit EFLAGS)]>; + +def CMP64i32 : RI<0x3D, RawFrm, (outs), (ins i32imm:$src), + "cmp{q}\t{$src, %rax|%rax, $src}", []>; def CMP64rr : RI<0x39, MRMDestReg, (outs), (ins GR64:$src1, GR64:$src2), "cmp{q}\t{$src2, $src1|$src1, $src2}", [(X86cmp GR64:$src1, GR64:$src2), Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=80746&r1=80745&r2=80746&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 1 19:55:49 2009 @@ -1647,6 +1647,14 @@ "and{l}\t{$src, $dst|$dst, $src}", [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst), (implicit EFLAGS)]>; + + def AND8i8 : Ii8<0x24, RawFrm, (outs), (ins i8imm:$src), + "and{b}\t{$src, %al|%al, $src}", []>; + def AND16i16 : Ii16<0x25, RawFrm, (outs), (ins i16imm:$src), + "and{w}\t{$src, %ax|%ax, $src}", []>, OpSize; + def AND32i32 : Ii32<0x25, RawFrm, (outs), (ins i32imm:$src), + "and{l}\t{$src, %eax|%eax, $src}", []>; + } @@ -2396,11 +2404,11 @@ // addition to rAX def ADD8i8 : Ii8<0x04, RawFrm, (outs), (ins i8imm:$src), - "add\t{$src, %al|%al, $src}", []>; + "add{b}\t{$src, %al|%al, $src}", []>; def ADD16i16 : Ii16<0x05, RawFrm, (outs), (ins i16imm:$src), - "add\t{$src, %ax|%ax, $src}", []>, OpSize; + "add{w}\t{$src, %ax|%ax, $src}", []>, OpSize; def ADD32i32 : Ii32<0x05, RawFrm, (outs), (ins i32imm:$src), - "add\t{$src, %eax|%eax, $src}", []>; + "add{l}\t{$src, %eax|%eax, $src}", []>; } let Uses = [EFLAGS] in { @@ -2991,6 +2999,13 @@ // Integer comparisons let Defs = [EFLAGS] in { +def CMP8i8 : Ii8<0x3C, RawFrm, (outs), (ins i8imm:$src), + "cmp{b}\t{$src, %al|%al, $src}", []>; +def CMP16i16 : Ii16<0x3D, RawFrm, (outs), (ins i16imm:$src), + "cmp{w}\t{$src, %ax|%ax, $src}", []>, OpSize; +def CMP32i32 : Ii32<0x3D, RawFrm, (outs), (ins i32imm:$src), + "cmp{l}\t{$src, %eax|%eax, $src}", []>; + def CMP8rr : I<0x38, MRMDestReg, (outs), (ins GR8 :$src1, GR8 :$src2), "cmp{b}\t{$src2, $src1|$src1, $src2}", From gohman at apple.com Tue Sep 1 20:14:17 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 02 Sep 2009 01:14:17 -0000 Subject: [llvm-commits] [llvm] r80749 - /llvm/trunk/include/llvm/BasicBlock.h Message-ID: <200909020114.n821EHcI013975@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 1 20:14:16 2009 New Revision: 80749 URL: http://llvm.org/viewvc/llvm-project?rev=80749&view=rev Log: Add a comment. Modified: llvm/trunk/include/llvm/BasicBlock.h Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=80749&r1=80748&r2=80749&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Tue Sep 1 20:14:16 2009 @@ -231,6 +231,9 @@ /// cause a degenerate basic block to be formed, having a terminator inside of /// the basic block). /// + /// Also note that this doesn't preserve any passes. To split blocks while + /// keeping loop information consistent, use the SplitBlock utility function. + /// BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = ""); }; From daniel at zuster.org Tue Sep 1 20:51:41 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 1 Sep 2009 18:51:41 -0700 Subject: [llvm-commits] [llvm] r80728 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp In-Reply-To: <275e64e40909011556y7d642777w1c26a13d7573cc5c@mail.gmail.com> References: <200909012207.n81M70mU021056@zion.cs.uiuc.edu> <275e64e40909011556y7d642777w1c26a13d7573cc5c@mail.gmail.com> Message-ID: <6a8523d60909011851h2560a524yfc1e562ac74e96c0@mail.gmail.com> On Tue, Sep 1, 2009 at 3:56 PM, Bruno Cardoso Lopes wrote: > Hi Daniel, > > On Tue, Sep 1, 2009 at 7:07 PM, Daniel Dunbar wrote: >> Author: ddunbar >> Date: Tue Sep ?1 17:07:00 2009 >> New Revision: 80728 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80728&view=rev >> Log: >> Fix what I believe is a copy-n-pasto introduced in r78129. >> ?- Bruno, please check!! >> >> Modified: >> ? ?llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp >> >> Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80728&r1=80727&r2=80728&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Sep ?1 17:07:00 2009 >> @@ -340,18 +340,18 @@ >> ? } else if (RelocOp->isSymbol()) { >> ? ? unsigned rt = Is64BitMode ? >> ? ? ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) >> - ? ? ?: (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); >> + ? ? ?: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); > > It's not a copy-n-pasto. The old behavior in r78129 was: > > unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_picrel_word; > > That is, to use reloc_picrel_word for "!Is64BitMode" even if we're not > in PIC mode. Ok. Disregarding that, is it correct? :) Since the various encodings of a MachineOperand all amount to similar concepts, it seems unlikely that they should emit different relocation types. Also note that very similar code in other places, for example for the MRM?m: encodings, uses this logic: -- unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); if (Opcode == X86::MOV64mi32) rt = X86::reloc_absolute_word_sext; // FIXME: add X86II flag? if (MO.isGlobal()) { bool NeedStub = isa(MO.getGlobal()); bool Indirect = gvNeedsNonLazyPtr(MO, TM); emitGlobalAddress(MO.getGlobal(), rt, MO.getOffset(), 0, NeedStub, Indirect); -- which does check IsPIC. Similarly MRM?r encodings have a near copy of this code that uses IsPIC. One way or the other, I'm pretty sure that all copies of this code should use the same logic, I'm just not sure which is right. - Daniel From evan.cheng at apple.com Tue Sep 1 21:28:04 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Sep 2009 19:28:04 -0700 Subject: [llvm-commits] cleanup patch for TwoAddressInstructionPass In-Reply-To: References: Message-ID: Hi Bob, It looks pretty good to me. The only thing that bugs me is the extra blank lines. :-) + regB = regC; + + } else if (TID.isConvertibleTo3Addr()) { + If it passes tests, please commit. Thanks. Evan On Sep 1, 2009, at 5:49 PM, Bob Wilson wrote: > Evan, > > I started looking at the overhaul you suggested. It is not done > yet, but I have tried to clean up the existing optimizations for the > case where a source register is only tied to one destination. There > was a lot of redundancy in this code, not to mention the goto. I've > rearranged it to try to clean that up. It is not exactly identical > in behavior to the previous code, though. Can you review this > before I commit it? I think you have a better understanding of all > the issues in this code than I do. > > Thanks. > From daniel at zuster.org Tue Sep 1 21:43:11 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 02 Sep 2009 02:43:11 -0000 Subject: [llvm-commits] [llvm] r80751 - /llvm/trunk/test/Analysis/Profiling/profiling-tool-chain.ll Message-ID: <200909020243.n822hBoe025718@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 1 21:43:11 2009 New Revision: 80751 URL: http://llvm.org/viewvc/llvm-project?rev=80751&view=rev Log: Don't force the triple or data layout in this test. We just have to get them from the host and hope that works. Modified: llvm/trunk/test/Analysis/Profiling/profiling-tool-chain.ll Modified: llvm/trunk/test/Analysis/Profiling/profiling-tool-chain.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Profiling/profiling-tool-chain.ll?rev=80751&r1=80750&r2=80751&view=diff ============================================================================== --- llvm/trunk/test/Analysis/Profiling/profiling-tool-chain.ll (original) +++ llvm/trunk/test/Analysis/Profiling/profiling-tool-chain.ll Tue Sep 1 21:43:11 2009 @@ -25,8 +25,6 @@ ; PROF: 14. 2.63158% 2/76 main() - return ; ModuleID = '' -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-unknown-linux-gnu" @.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1] @.str1 = private constant [6 x i8] c"franz\00", align 1 ; <[6 x i8]*> [#uses=1] From kremenek at apple.com Tue Sep 1 21:48:08 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 02 Sep 2009 02:48:08 -0000 Subject: [llvm-commits] [llvm] r80753 - /llvm/tags/checker/checker-0.219/ Message-ID: <200909020248.n822m8ao026399@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 1 21:48:08 2009 New Revision: 80753 URL: http://llvm.org/viewvc/llvm-project?rev=80753&view=rev Log: Tagging checker-0.219. Added: llvm/tags/checker/checker-0.219/ - copied from r80752, llvm/trunk/ From baldrick at free.fr Tue Sep 1 22:04:36 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 05:04:36 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r80734 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> References: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> Message-ID: <4A9DE0C4.6080303@free.fr> Hi Bill, > + llvm::errs() << "Unhandled expression!\n" probably no need for llvm:: Ciao, Duncan. From baldrick at free.fr Tue Sep 1 22:10:04 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 03:10:04 -0000 Subject: [llvm-commits] [gcc-plugin] r80755 - /gcc-plugin/trunk/gcc-patches/gengtype.diff Message-ID: <200909020310.n823A5D9029282@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 1 22:10:04 2009 New Revision: 80755 URL: http://llvm.org/viewvc/llvm-project?rev=80755&view=rev Log: Patch by Basile STARYNKEVITCH that fixes gengtype so it actually works when used with plugins, rather than just nearly working. Added: gcc-plugin/trunk/gcc-patches/gengtype.diff Added: gcc-plugin/trunk/gcc-patches/gengtype.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/gengtype.diff?rev=80755&view=auto ============================================================================== --- gcc-plugin/trunk/gcc-patches/gengtype.diff (added) +++ gcc-plugin/trunk/gcc-patches/gengtype.diff Tue Sep 1 22:10:04 2009 @@ -0,0 +1,737 @@ +Index: lto/gcc/doc/plugins.texi +=================================================================== +--- lto.orig/gcc/doc/plugins.texi 2009-09-01 00:16:27.962891836 +0200 ++++ lto/gcc/doc/plugins.texi 2009-09-01 10:21:15.728775623 +0200 +@@ -226,12 +226,16 @@ + their own @code{GTY}-ed data. This can be done with the + @code{PLUGIN_REGISTER_GGC_ROOTS} pseudo-event with a null callback and + the extra root table as @code{user_data}. Running the @code{gengtype +--p @var{source-dir} @var{file-list} @var{plugin*.c} ...} utility +-generates this extra root table. ++-P @file{gt-plugin.h} @var{source-dir} @var{file-list} @var{plugin*.c} ++...} utility generates this extra root table, with the PCH related ++generated code kept wrapped with the @code{#ifdef ++GCC_PLUGIN_HAVE_PCH}, so disabled by default. + + You should understand the details of memory management inside GCC + before using @code{PLUGIN_GGC_MARKING} or +- at code{PLUGIN_REGISTER_GGC_ROOTS}. ++ at code{PLUGIN_REGISTER_GGC_ROOTS}. Notice that using plugins which ++need these features may break the generation of precompiled headers ++[PCH], unless these plugins take specific measures. + + + @section Giving information about a plugin +Index: lto/gcc/gengtype.c +=================================================================== +--- lto.orig/gcc/gengtype.c 2009-09-01 10:20:35.755693766 +0200 ++++ lto/gcc/gengtype.c 2009-09-01 10:21:15.732708428 +0200 +@@ -24,6 +24,7 @@ + #include "errors.h" /* for fatal */ + #include "double-int.h" + ++ + /* Data types, macros, etc. used only in this file. */ + + /* Kinds of types we can understand. */ +@@ -64,6 +65,7 @@ + type_p type; + struct fileloc line; + options_p opt; ++ bool inplugin; /* flag set if appearing inside a plugin */ + }; + + #define NUM_PARAM 10 +@@ -83,6 +85,7 @@ + type_p next; + type_p pointer_to; + enum gc_used_enum gc_used; ++ bool inplugin; + union { + type_p p; + struct { +@@ -145,6 +148,12 @@ + directory. */ + static char** plugin_files; + static int nb_plugin_files; ++/* index of first plugin file in gt_files */ ++static int first_plugin_file_ix= -1; ++/* the generated plugin output name & file */ ++static char* plugin_output_filename; ++static outf_p plugin_output; ++ + + /* The output header file that is included into pretty much every + source file. */ +@@ -167,12 +176,16 @@ + + + /* Nonzero iff an error has occurred. */ +-bool hit_error = false; ++bool hit_error = FALSE; ++/* Flag set when parsing a plugin file */ ++bool is_plugin_file = FALSE; ++ + + static void gen_rtx_next (void); + static void write_rtx_next (void); + static void open_base_files (void); + static void close_output_files (void); ++static void output_delayed_functions (void); + + /* Report an error at POS, printing MSG. */ + +@@ -465,8 +478,19 @@ + if (plugin_files) + { + int i; ++ first_plugin_file_ix = nfiles; + for (i = 0; i < nb_plugin_files; i++) +- gt_files[nfiles++] = plugin_files[i]; ++ { ++ /* Each added entry in gt_files should have additional ++ space for its lang_bitmap before. */ ++ int plugfilen = strlen (plugin_files[i]); ++ char* plugent = ++ (char*) xcalloc (1, plugfilen+1 + sizeof (lang_bitmap)); ++ plugent += sizeof (lang_bitmap); ++ strcpy(plugent, plugin_files[i]); ++ gt_files[nfiles++] = plugent; ++ /* We don't bother freeing plugent ! */ ++ } + } + num_gt_files = nfiles; + } +@@ -512,17 +536,18 @@ + /* The one and only TYPE_STRING. */ + + static struct type string_type = { +- TYPE_STRING, 0, 0, GC_USED, {0} ++ TYPE_STRING, 0, 0, GC_USED, false, {0} + }; + + /* The two and only TYPE_SCALARs. Their u.scalar_is_char flags are + set to appropriate values at the beginning of main. */ + + static struct type scalar_nonchar = { +- TYPE_SCALAR, 0, 0, GC_USED, {0} ++ TYPE_SCALAR, 0, 0, GC_USED, false, {0} + }; ++ + static struct type scalar_char = { +- TYPE_SCALAR, 0, 0, GC_USED, {0} ++ TYPE_SCALAR, 0, 0, GC_USED, false, {0} + }; + + /* Lists of various things. */ +@@ -663,8 +688,9 @@ + isunion ? "union" : "struct", s->u.s.tag); + error_at_line (&s->u.s.line, "previous definition here"); + } +- ++ + s->kind = isunion ? TYPE_UNION : TYPE_STRUCT; ++ s->inplugin = is_plugin_file; + s->u.s.tag = name; + s->u.s.line = *pos; + s->u.s.fields = fields; +@@ -709,6 +735,7 @@ + s->next = structures; + structures = s; + s->kind = isunion ? TYPE_UNION : TYPE_STRUCT; ++ s->inplugin = is_plugin_file; + s->u.s.tag = name; + structures = s; + return s; +@@ -732,6 +759,7 @@ + { + res = XCNEW (struct type); + res->kind = TYPE_PARAM_STRUCT; ++ res->inplugin = is_plugin_file; + res->next = param_structs; + param_structs = res; + res->u.param_struct.stru = t; +@@ -760,6 +788,7 @@ + { + type_p r = XCNEW (struct type); + r->kind = TYPE_POINTER; ++ r->inplugin = is_plugin_file; + r->u.p = t; + t->pointer_to = r; + } +@@ -775,6 +804,7 @@ + + v = XCNEW (struct type); + v->kind = TYPE_ARRAY; ++ v->inplugin = is_plugin_file; + v->u.a.p = t; + v->u.a.len = len; + return v; +@@ -819,6 +849,7 @@ + n->line = *pos; + n->opt = o; + n->next = variables; ++ n->inplugin = is_plugin_file; + variables = n; + } + +@@ -1492,6 +1523,9 @@ + f = XCNEW (struct outf); + f->next = output_files; + f->name = oname; ++ i = f->buflength = 4096; ++ f->buf = XNEWVEC (char, i); ++ f->bufused = 0; + output_files = f; + + oprintf (f, "/* Type information for %s.\n", name); +@@ -1508,7 +1542,7 @@ + void + oprintf (outf_p o, const char *format, ...) + { +- char *s; ++ char *s = NULL; + size_t slength; + va_list ap; + +@@ -1516,7 +1550,11 @@ + in that case. */ + if (!o) + return; +- ++ ++ gcc_assert (o->buf != NULL); ++ ++ gcc_assert (o->bufused <= o->buflength); ++ + va_start (ap, format); + slength = vasprintf (&s, format, ap); + if (s == NULL || (int)slength < 0) +@@ -1526,16 +1564,24 @@ + if (o->bufused + slength > o->buflength) + { + size_t new_len = o->buflength; ++ char *oldbuf = o->buf; + if (new_len == 0) + new_len = 1024; + do { + new_len *= 2; + } while (o->bufused + slength >= new_len); +- o->buf = XRESIZEVEC (char, o->buf, new_len); ++ o->buf = XNEWVEC (char, new_len); ++ if (oldbuf) ++ { ++ memcpy(o->buf, oldbuf, o->bufused); ++ oldbuf[0] = 0; ++ } ++ free (oldbuf); + o->buflength = new_len; + } + memcpy (o->buf + o->bufused, s, slength); + o->bufused += slength; ++ gcc_assert (o->bufused <= o->buflength); + free (s); + } + +@@ -1546,10 +1592,13 @@ + { + size_t i; + +- if (nb_plugin_files > 0 && plugin_files) ++ if (nb_plugin_files > 0 && plugin_files) + return; +- ++ ++ /* header file should be generated even in plugin mode */ + header_file = create_file ("GCC", "gtype-desc.h"); ++ ++ + + base_files = XNEWVEC (outf_p, num_lang_dirs); + +@@ -1567,7 +1616,8 @@ + "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h", + "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", + "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", +- "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", NULL ++ "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", ++ NULL + }; + const char *const *ifp; + outf_p gtype_desc_c; +@@ -1712,15 +1762,19 @@ + input_file = "system.h"; + + /* In plugin mode, return NULL unless the input_file is one of the +- plugin_files. */ ++ plugin_files or is the specified plugin_output_filename. */ + if (plugin_files && nb_plugin_files > 0) + { + int ix= -1, i; + for (i = 0; i < nb_plugin_files && ix < 0; i++) +- if (strcmp (input_file, plugin_files[i]) == 0) +- ix = i; +- if (ix < 0) ++ if (strcmp (input_file, plugin_files[i]) == 0) ++ ix = i; ++ if (ix < 0 ++ && plugin_output_filename ++ && strcmp (input_file, plugin_output_filename)) + return NULL; ++ if (plugin_output_filename) ++ return plugin_output; + } + + /* Determine the output file name. */ +@@ -1763,9 +1817,9 @@ + + if (lang_index >= 0) + return base_files[lang_index]; +- ++ + output_name = "gtype-desc.c"; +- for_name = NULL; ++ for_name = "GCC"; + } + + /* Look through to see if we've ever seen this output filename before. */ +@@ -1832,6 +1886,9 @@ + fatal ("writing output file %s: %s", of->name, strerror (errno)); + if (fclose (newfile) != 0) + fatal ("closing output file %s: %s", of->name, strerror (errno)); ++ free(of->buf); ++ of->buf = NULL; ++ of->bufused = of->buflength = 0; + } + } + +@@ -1864,6 +1921,7 @@ + const char *reorder_note_routine; + const char *comment; + int skip_hooks; /* skip hook generation if non zero */ ++ int is_pch; /* set for PCH stuff to output ifndef */ + }; + + static void output_escaped_param (struct walk_type_data *d, +@@ -1873,6 +1931,7 @@ + static void write_func_for_structure + (type_p orig_s, type_p s, type_p * param, + const struct write_types_data *wtd); ++static void delay_func_for_structure (type_p s, const struct write_types_data* wtd); + static void write_types_process_field + (type_p f, const struct walk_type_data *d); + static void write_types (type_p structures, +@@ -2587,6 +2646,8 @@ + } + oprintf (d.of, " (void *x_p)\n"); + oprintf (d.of, "{\n"); ++ if (plugin_output && d.of == plugin_output && wtd->is_pch) ++ oprintf (d.of, "#ifdef GCC_PLUGIN_HAVE_PCH\n"); + oprintf (d.of, " %s %s * %sx = (%s %s *)x_p;\n", + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag, + chain_next == NULL ? "const " : "", +@@ -2691,6 +2752,8 @@ + oprintf (d.of, " }\n"); + if (chain_circular != NULL) + oprintf (d.of, " while (x != xlimit);\n"); ++ if (plugin_output && d.of == plugin_output && wtd->is_pch) ++ oprintf (d.of, "/* end ifdef GCC_PLUGIN_HAVE_PCH*/\n#endif\n"); + oprintf (d.of, "}\n"); + } + +@@ -2701,8 +2764,9 @@ + const struct write_types_data *wtd) + { + type_p s; +- +- oprintf (header_file, "\n/* %s*/\n", wtd->comment); ++ outf_p outheadf = plugin_output_filename ? plugin_output : header_file; ++ ++ oprintf (outheadf, "\n/* %s*/\n", wtd->comment); + for (s = structures; s; s = s->next) + if (s->gc_used == GC_POINTED_TO + || s->gc_used == GC_MAYBE_POINTED_TO) +@@ -2713,13 +2777,13 @@ + && s->u.s.line.file == NULL) + continue; + +- oprintf (header_file, "#define gt_%s_", wtd->prefix); +- output_mangled_typename (header_file, s); +- oprintf (header_file, "(X) do { \\\n"); +- oprintf (header_file, ++ oprintf (outheadf, "#define gt_%s_", wtd->prefix); ++ output_mangled_typename (outheadf, s); ++ oprintf (outheadf, "(X) do { \\\n"); ++ oprintf (outheadf, + " if (X != NULL) gt_%sx_%s (X);\\\n", wtd->prefix, + s->u.s.tag); +- oprintf (header_file, ++ oprintf (outheadf, + " } while (0)\n"); + + for (opt = s->u.s.opt; opt; opt = opt->next) +@@ -2729,7 +2793,7 @@ + if (t->kind == TYPE_STRUCT + || t->kind == TYPE_UNION + || t->kind == TYPE_LANG_STRUCT) +- oprintf (header_file, ++ oprintf (outheadf, + "#define gt_%sx_%s gt_%sx_%s\n", + wtd->prefix, s->u.s.tag, wtd->prefix, t->u.s.tag); + else +@@ -2741,7 +2805,7 @@ + continue; + + /* Declare the marker procedure only once. */ +- oprintf (header_file, ++ oprintf (outheadf, + "extern void gt_%sx_%s (void *);\n", + wtd->prefix, s->u.s.tag); + +@@ -2752,7 +2816,10 @@ + continue; + } + +- if (s->kind == TYPE_LANG_STRUCT) ++ /* in plugin mode, the write_func_for_structure should be delayed */ ++ if (nb_plugin_files > 0 && plugin_output_filename) ++ delay_func_for_structure (s, wtd); ++ else if (s->kind == TYPE_LANG_STRUCT) + { + type_p ss; + for (ss = s->u.s.lang_struct; ss; ss = ss->next) +@@ -2769,9 +2836,9 @@ + type_p stru = s->u.param_struct.stru; + + /* Declare the marker procedure. */ +- oprintf (header_file, "extern void gt_%s_", wtd->prefix); +- output_mangled_typename (header_file, s); +- oprintf (header_file, " (void *);\n"); ++ oprintf (outheadf, "extern void gt_%s_", wtd->prefix); ++ output_mangled_typename (outheadf, s); ++ oprintf (outheadf, " (void *);\n"); + + if (stru->u.s.line.file == NULL) + { +@@ -2795,6 +2862,7 @@ + { + "ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL, + "GC marker procedures. ", ++ FALSE, + FALSE + }; + +@@ -2803,6 +2871,7 @@ + "pch_n", "pch_p", "gt_pch_note_object", "gt_pch_note_object", + "gt_pch_note_reorder", + "PCH type-walking procedures. ", ++ TRUE, + TRUE + }; + +@@ -2875,11 +2944,15 @@ + "\tATTRIBUTE_UNUSED gt_pointer_operator op,\n" + "\tATTRIBUTE_UNUSED void *cookie)\n"); + oprintf (d.of, "{\n"); ++ if (plugin_output && d.of == plugin_output) ++ oprintf (d.of, "#ifdef GCC_PLUGIN_HAVE_PCH\n"); + oprintf (d.of, " %s %s * const x ATTRIBUTE_UNUSED = (%s %s *)x_p;\n", + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag, + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag); + d.indent = 2; + walk_type (s, &d); ++ if (plugin_output && d.of == plugin_output) ++ oprintf (d.of, "/* end ifdef GCC_PLUGIN_HAVE_PCH */\n#endif\n"); + oprintf (d.of, "}\n"); + } + +@@ -2888,11 +2961,13 @@ + static void + write_local (type_p structures, type_p param_structs) + { ++ outf_p outheadf = plugin_output_filename ? plugin_output : header_file; ++ + type_p s; + +- if (!header_file) ++ if (!outheadf) + return; +- oprintf (header_file, "\n/* Local pointer-walking routines. */\n"); ++ oprintf (outheadf, "\n/* Local pointer-walking routines. */\n"); + for (s = structures; s; s = s->next) + if (s->gc_used == GC_POINTED_TO + || s->gc_used == GC_MAYBE_POINTED_TO) +@@ -2910,11 +2985,11 @@ + || t->kind == TYPE_UNION + || t->kind == TYPE_LANG_STRUCT) + { +- oprintf (header_file, "#define gt_pch_p_"); +- output_mangled_typename (header_file, s); +- oprintf (header_file, " gt_pch_p_"); +- output_mangled_typename (header_file, t); +- oprintf (header_file, "\n"); ++ oprintf (outheadf, "#define gt_pch_p_"); ++ output_mangled_typename (outheadf, s); ++ oprintf (outheadf, " gt_pch_p_"); ++ output_mangled_typename (outheadf, t); ++ oprintf (outheadf, "\n"); + } + else + error_at_line (&s->u.s.line, +@@ -2925,9 +3000,9 @@ + continue; + + /* Declare the marker procedure only once. */ +- oprintf (header_file, "extern void gt_pch_p_"); +- output_mangled_typename (header_file, s); +- oprintf (header_file, ++ oprintf (outheadf, "extern void gt_pch_p_"); ++ output_mangled_typename (outheadf, s); ++ oprintf (outheadf, + "\n (void *, void *, gt_pointer_operator, void *);\n"); + + if (s->kind == TYPE_LANG_STRUCT) +@@ -2947,9 +3022,9 @@ + type_p stru = s->u.param_struct.stru; + + /* Declare the marker procedure. */ +- oprintf (header_file, "extern void gt_pch_p_"); +- output_mangled_typename (header_file, s); +- oprintf (header_file, ++ oprintf (outheadf, "extern void gt_pch_p_"); ++ output_mangled_typename (outheadf, s); ++ oprintf (outheadf, + "\n (void *, void *, gt_pointer_operator, void *);\n"); + + if (stru->u.s.line.file == NULL) +@@ -2970,17 +3045,60 @@ + } + } + +-/* Write out the 'enum' definition for gt_types_enum. */ ++/* Write out only to header_file the 'enum' definition for gt_types_enum. */ + + static void + write_enum_defn (type_p structures, type_p param_structs) + { +- type_p s; +- ++ type_p s = NULL; ++ /* in plugin mode, define dynamically the enumeration values */ ++ if (plugin_output) ++ { ++ int cnt = 0; ++ oprintf (plugin_output, "\n/* Dynamic enumeration of plugin types. */\n"); ++ oprintf (plugin_output, "#ifdef GCC_PLUGIN_HAVE_PCH\n"); ++ oprintf (plugin_output, "static int gccplugin_type_base;\n"); ++ ++ for (s = structures; s; s = s->next) ++ { ++ if (!s->inplugin) ++ continue; ++ if (s->gc_used == GC_POINTED_TO ++ || s->gc_used == GC_MAYBE_POINTED_TO) ++ { ++ if (s->gc_used == GC_MAYBE_POINTED_TO ++ && s->u.s.line.file == NULL) ++ continue; ++ oprintf (plugin_output, "#define gt_ggc_e_"); ++ output_mangled_typename (plugin_output, s); ++ oprintf (plugin_output, ++ " ((gccplugin_type_base>0)?(gccplugin_type_base+%d):0)\n", ++ cnt); ++ cnt++; ++ } ++ } ++ for (s = param_structs; s; s = s->next) ++ if (s->gc_used == GC_POINTED_TO && s->inplugin) ++ { ++ oprintf (plugin_output, "#define gt_e_"); ++ output_mangled_typename (plugin_output, s); ++ oprintf (plugin_output, ++ " ((gccplugin_type_base>0)?(gccplugin_type_base+%d):0)\n", ++ cnt); ++ cnt++; ++ } ++ oprintf (plugin_output, ++ "\n#define GCCPLUGIN_TYPE_COUNT %d\n", cnt); ++ oprintf (plugin_output, "/* end ifdef GCC_PLUGIN_HAVE_PCH */\n#endif\n"); ++ return; ++ } ++ ++ /* write only to header_file */ + if (!header_file) + return; +- oprintf (header_file, "\n/* Enumeration of types known. */\n"); ++ oprintf (header_file, "\n/* Enumeration of known types. */\n"); + oprintf (header_file, "enum gt_types_enum {\n"); ++ oprintf (header_file, " gt_types_enum_firstempty,\n"); + for (s = structures; s; s = s->next) + if (s->gc_used == GC_POINTED_TO + || s->gc_used == GC_MAYBE_POINTED_TO) +@@ -3332,12 +3450,15 @@ + + for (v = variables; v; v = v->next) + { +- outf_p f = get_output_file_with_visibility (v->line.file); ++ outf_p f = NULL; + struct flist *fli; + const char *length = NULL; + int deletable_p = 0; + options_p o; +- ++ if (nb_plugin_files > 0 && plugin_output_filename && v->inplugin) ++ f = plugin_output; ++ else ++ f = get_output_file_with_visibility (v->line.file); + for (o = v->opt; o; o = o->next) + if (strcmp (o->name, "length") == 0) + length = o->info; +@@ -3629,6 +3750,74 @@ + do_typedef (astratname, new_structure (astratname, 0, pos, field, 0), pos); + } + ++ ++/* in plugin mode, the write of functions for structure is delayed to ++ the end; we keep a vector of these */ ++struct delayedstructfunc_st ++{ ++ type_p dly_s; ++ const struct write_types_data* dly_wtd; ++}; ++static struct delayedstructfunc_st* dlystructab; ++static int dlystructsiz; ++static int dlystructcnt; ++ ++ ++ ++ ++static void ++delay_func_for_structure (type_p s, const struct write_types_data* wtd) ++{ ++ gcc_assert (s != NULL); ++ gcc_assert (wtd != NULL); ++ if (dlystructcnt + 1 >= dlystructsiz) ++ { ++ struct delayedstructfunc_st* oldtab = dlystructab; ++ int oldsiz = dlystructsiz; ++ int newsiz = (32 + oldsiz) * 2; ++ int i = 0; ++ gcc_assert (newsiz > dlystructcnt); ++ dlystructab = XNEWVEC(struct delayedstructfunc_st, newsiz); ++ for (i = 0; i < dlystructcnt; i++) ++ dlystructab[i] = oldtab[i]; ++ for (i = dlystructcnt; i < newsiz; i++) ++ { ++ dlystructab[i].dly_s = NULL; ++ dlystructab[i].dly_wtd = NULL; ++ } ++ dlystructsiz = newsiz; ++ free (oldtab); ++ } ++ dlystructab[dlystructcnt].dly_s = s; ++ dlystructab[dlystructcnt].dly_wtd = wtd; ++ dlystructcnt++; ++} ++ ++ ++static void ++output_delayed_functions(void) ++{ ++ int i = 0; ++ gcc_assert (plugin_output); ++ for (i = 0; ikind == TYPE_LANG_STRUCT) ++ { ++ type_p ss; ++ for (ss = s->u.s.lang_struct; ss; ss = ss->next) ++ write_func_for_structure (s, ss, NULL, wtd); ++ } ++ else ++ write_func_for_structure (s, s, NULL, wtd); ++ } ++ free (dlystructab); ++ dlystructab = NULL; ++ dlystructcnt = dlystructsiz = 0; ++} ++ + + int + main (int argc, char **argv) +@@ -3639,20 +3828,23 @@ + /* fatal uses this */ + progname = "gengtype"; + +- if (argc >= 5 && !strcmp (argv[1], "-p")) ++ if (argc >= 6 && !strcmp (argv[1], "-P")) + { +- srcdir = argv[2]; +- inputlist = argv[3]; +- plugin_files = argv+4; +- nb_plugin_files = argc-4; ++ plugin_output_filename = argv[2]; ++ plugin_output = create_file ("GCC", plugin_output_filename); ++ srcdir = argv[3]; ++ inputlist = argv[4]; ++ plugin_files = argv + 5; ++ nb_plugin_files = argc - 5; + } ++ + else if (argc == 3) + { + srcdir = argv[1]; + inputlist = argv[2]; + } + else +- fatal ("usage: gengtype [-p] srcdir input-list [file1 file2 ... fileN]"); ++ fatal ("usage: gengtype [-P pluginout.h] srcdir input-list [file1 file2 ... fileN]"); + + srcdir_len = strlen (srcdir); + +@@ -3678,9 +3870,14 @@ + do_scalar_typedef ("void", &pos); pos.line++; + do_typedef ("PTR", create_pointer (resolve_typedef ("void", &pos)), &pos); + +- for (i = 0; i < num_gt_files; i++) +- parse_file (gt_files[i]); +- ++ for (i = 0; i < num_gt_files; i++) ++ { ++ is_plugin_file = first_plugin_file_ix >= 0 ++ && (int)i >= first_plugin_file_ix; ++ parse_file (gt_files[i]); ++ is_plugin_file = false; ++ } ++ + if (hit_error) + return 1; + +@@ -3693,6 +3890,10 @@ + write_local (structures, param_structs); + write_roots (variables); + write_rtx_next (); ++ ++ if (plugin_output) ++ output_delayed_functions (); ++ + close_output_files (); + + if (hit_error) +Index: lto/gcc/gengtype.h +=================================================================== +--- lto.orig/gcc/gengtype.h 2009-09-01 00:16:27.942856818 +0200 ++++ lto/gcc/gengtype.h 2009-09-01 10:21:15.728775623 +0200 +@@ -76,6 +76,9 @@ + extern void parse_file (const char *name); + extern bool hit_error; + ++/* flag set when parsing a plugin file */ ++extern bool is_plugin_file; ++ + /* Token codes. */ + enum { + EOF_TOKEN = 0, From baldrick at free.fr Tue Sep 1 22:29:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 03:29:16 -0000 Subject: [llvm-commits] [gcc-plugin] r80756 - in /gcc-plugin/trunk: Makefile llvm-cache.c llvm-cache.h Message-ID: <200909020329.n823TGNe031604@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 1 22:29:14 2009 New Revision: 80756 URL: http://llvm.org/viewvc/llvm-project?rev=80756&view=rev Log: Generate information needed by the garbage collector. Modified: gcc-plugin/trunk/Makefile gcc-plugin/trunk/llvm-cache.c gcc-plugin/trunk/llvm-cache.h Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=80756&r1=80755&r2=80756&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Tue Sep 1 22:29:14 2009 @@ -13,6 +13,9 @@ $(ARCH_DIR)/llvm-target.cpp llvm-types.cpp bits_and_bobs.cpp PLUGIN_OBJECT_FILES=$(C_SOURCE_FILES:.c=.o) $(CPP_SOURCE_FILES:.cpp=.o) +GTYPE_INPUT_FILE=$(PWD)/llvm-cache.c +GTYPE_OUTPUT_FILE=$(PWD)/gt-llvm-cache.h + CFLAGS+=-Wall -Werror -fPIC -g -O2 CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" \ -DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR) @@ -27,5 +30,12 @@ llvm.so: $(PLUGIN_OBJECT_FILES) $(CXX) -shared $^ -o $@ $(LDFLAGS) +llvm-cache.c: gt-llvm-cache.h + +gt-llvm-cache.h: + cd $(GCCOBJECT_DIR)/gcc && ./build/gengtype \ + -P $(GTYPE_OUTPUT_FILE) $(GCCSOURCE_DIR) gtyp-input.list \ + $(GTYPE_INPUT_FILE) + clean:: - rm -f *.o *.so $(ARCH_DIR)/*.o + rm -f *.o *.so $(ARCH_DIR)/*.o $(GTYPE_OUTPUT_FILE) Modified: gcc-plugin/trunk/llvm-cache.c URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.c?rev=80756&r1=80755&r2=80756&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-cache.c (original) +++ gcc-plugin/trunk/llvm-cache.c Tue Sep 1 22:29:14 2009 @@ -29,7 +29,7 @@ #include "llvm-cache.h" // GCC headers -#include "hashtab.h" +#include "ggc.h" #include "stdio.h" //QQ @@ -94,3 +94,5 @@ return val; } + +#include "gt-llvm-cache.h" Modified: gcc-plugin/trunk/llvm-cache.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.h?rev=80756&r1=80755&r2=80756&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-cache.h (original) +++ gcc-plugin/trunk/llvm-cache.h Tue Sep 1 22:29:14 2009 @@ -31,7 +31,6 @@ #include "config.h" #include "system.h" #include "coretypes.h" -#include "ggc.h" #include "target.h" #include "tree.h" From baldrick at free.fr Tue Sep 1 22:48:42 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 03:48:42 -0000 Subject: [llvm-commits] [llvm] r80757 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909020348.n823mgmt001575@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 1 22:48:41 2009 New Revision: 80757 URL: http://llvm.org/viewvc/llvm-project?rev=80757&view=rev Log: Complicate Chris's simplification, avoiding complaints about singular iterators when building with expensive checks turned on. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80757&r1=80756&r2=80757&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 22:48:41 2009 @@ -161,7 +161,7 @@ // CGN with those actually in the function. // Get the set of call sites currently in the function. - for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ){ + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ) { // If this call site is null, then the function pass deleted the call // entirely and the WeakVH nulled it out. if (I->first == 0 || @@ -178,7 +178,11 @@ "CallGraphSCCPass did not update the CallGraph correctly!"); // Just remove the edge from the set of callees. + bool wasLast = I + 1 == E; CGN->removeCallEdge(I); + if (wasLast) + // I is now a singular iterator, do not compare with E. + break; E = CGN->end(); continue; } From baldrick at free.fr Tue Sep 1 23:08:56 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 04:08:56 -0000 Subject: [llvm-commits] [gcc-plugin] r80758 - /gcc-plugin/trunk/ Message-ID: <200909020408.n8248uLg004324@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 1 23:08:56 2009 New Revision: 80758 URL: http://llvm.org/viewvc/llvm-project?rev=80758&view=rev Log: Ignore the generated garbage collector file. Modified: gcc-plugin/trunk/ (props changed) Propchange: gcc-plugin/trunk/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Tue Sep 1 23:08:56 2009 @@ -0,0 +1 @@ +gt-llvm-cache.h From clattner at apple.com Tue Sep 1 23:30:21 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Sep 2009 21:30:21 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80734 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> References: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> Message-ID: On Sep 1, 2009, at 4:05 PM, Bill Wendling wrote: > Author: void > Date: Tue Sep 1 18:05:43 2009 > New Revision: 80734 > > URL: http://llvm.org/viewvc/llvm-project?rev=80734&view=rev > Log: > Remove in favor of raw_ostream. Hey Bill, These "unhandled expression" messages actually do occur for some weird cases, can you take them out of the DEBUG? Thanks for helping exorcize ! -Chris > > 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=80734&r1=80733&r2=80734&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep 1 18:05:43 2009 > @@ -34,13 +34,14 @@ > #include "llvm/Module.h" > #include "llvm/Analysis/ConstantFolding.h" > #include "llvm/System/Host.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/MathExtras.h" > +#include "llvm/Support/raw_ostream.h" > #include "llvm/Target/TargetLowering.h" > #include "llvm/Target/TargetData.h" > #include "llvm/Target/TargetMachine.h" > #include "llvm/ADT/StringExtras.h" > #include "llvm/ADT/DenseMap.h" > -#include > > #include "llvm-abi.h" > #include "llvm-internal.h" > @@ -792,9 +793,11 @@ > > switch (TREE_CODE(exp)) { > default: > - std::cerr << "Unhandled expression!\n" > - << "TREE_CODE: " << TREE_CODE(exp) << "\n"; > - debug_tree(exp); > + DEBUG({ > + llvm::errs() << "Unhandled expression!\n" > + << "TREE_CODE: " << TREE_CODE(exp) << "\n"; > + debug_tree(exp); > + }); > abort(); > > // Control flow > @@ -988,8 +991,10 @@ > > switch (TREE_CODE(exp)) { > default: > - std::cerr << "Unhandled lvalue expression!\n"; > - debug_tree(exp); > + DEBUG({ > + errs() << "Unhandled lvalue expression!\n"; > + debug_tree(exp); > + }); > abort(); > > case PARM_DECL: > @@ -1071,7 +1076,7 @@ > // > = > = > = > ----------------------------------------------------------------------= > ==// > > void TreeToLLVM::TODO(tree exp) { > - std::cerr << "Unhandled tree node\n"; > + DEBUG(errs() << "Unhandled tree node\n"); > if (exp) debug_tree(exp); > abort(); > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Tue Sep 1 23:34:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 04:34:07 -0000 Subject: [llvm-commits] [llvm] r80759 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909020434.n824Y71I007709@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 23:34:06 2009 New Revision: 80759 URL: http://llvm.org/viewvc/llvm-project?rev=80759&view=rev Log: one more try at making this simpler, hopefully it won't break everything :) Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80759&r1=80758&r2=80759&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 23:34:06 2009 @@ -178,11 +178,11 @@ "CallGraphSCCPass did not update the CallGraph correctly!"); // Just remove the edge from the set of callees. - bool wasLast = I + 1 == E; CGN->removeCallEdge(I); - if (wasLast) - // I is now a singular iterator, do not compare with E. - break; + + // If we removed the last edge, get out of the loop. + if (CGN->empty()) break; + E = CGN->end(); continue; } From sabre at nondot.org Tue Sep 1 23:39:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 04:39:04 -0000 Subject: [llvm-commits] [llvm] r80760 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200909020439.n824d4Rm008330@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 1 23:39:04 2009 New Revision: 80760 URL: http://llvm.org/viewvc/llvm-project?rev=80760&view=rev Log: revert my patch, duncan points out what is wrong with my logic. Add a comment so that I don't change this in the future :) Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80760&r1=80759&r2=80760&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 23:39:04 2009 @@ -177,12 +177,16 @@ assert(!CheckingMode && "CallGraphSCCPass did not update the CallGraph correctly!"); - // Just remove the edge from the set of callees. + // Just remove the edge from the set of callees, keep track of whether + // I points to the last element of the vector. + bool WasLast = I + 1 == E; CGN->removeCallEdge(I); - // If we removed the last edge, get out of the loop. - if (CGN->empty()) break; - + // If I pointed to the last element of the vector, we have to bail out: + // iterator checking rejects comparisons of the resultant pointer with + // end. + if (WasLast) + break; E = CGN->end(); continue; } From sabre at nondot.org Wed Sep 2 00:12:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 05:12:37 -0000 Subject: [llvm-commits] [llvm] r80761 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/icmp.ll Message-ID: <200909020512.n825CbM2012654@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 00:12:37 2009 New Revision: 80761 URL: http://llvm.org/viewvc/llvm-project?rev=80761&view=rev Log: fix PR4837, some bugs folding vector compares. These return a vector of i1, not i1 itself. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/icmp.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=80761&r1=80760&r2=80761&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Sep 2 00:12:37 2009 @@ -5779,9 +5779,9 @@ // Fold trivial predicates. if (I.getPredicate() == FCmpInst::FCMP_FALSE) - return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); + return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 0)); if (I.getPredicate() == FCmpInst::FCMP_TRUE) - return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); + return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 1)); // Simplify 'fcmp pred X, X' if (Op0 == Op1) { @@ -5790,11 +5790,11 @@ case FCmpInst::FCMP_UEQ: // True if unordered or equal case FCmpInst::FCMP_UGE: // True if unordered, greater than, or equal case FCmpInst::FCMP_ULE: // True if unordered, less than, or equal - return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); + return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 1)); case FCmpInst::FCMP_OGT: // True if ordered and greater than case FCmpInst::FCMP_OLT: // True if ordered and less than case FCmpInst::FCMP_ONE: // True if ordered and operands are unequal - return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); + return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 0)); case FCmpInst::FCMP_UNO: // True if unordered: isnan(X) | isnan(Y) case FCmpInst::FCMP_ULT: // True if unordered or less than @@ -5817,7 +5817,7 @@ } if (isa(Op1)) // fcmp pred X, undef -> undef - return ReplaceInstUsesWith(I, UndefValue::get(Type::getInt1Ty(*Context))); + return ReplaceInstUsesWith(I, UndefValue::get(I.getType())); // Handle fcmp with constant RHS if (Constant *RHSC = dyn_cast(Op1)) { @@ -5885,11 +5885,11 @@ // icmp X, X if (Op0 == Op1) - return ReplaceInstUsesWith(I, ConstantInt::get(Type::getInt1Ty(*Context), + return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), I.isTrueWhenEqual())); if (isa(Op1)) // X icmp undef -> undef - return ReplaceInstUsesWith(I, UndefValue::get(Type::getInt1Ty(*Context))); + return ReplaceInstUsesWith(I, UndefValue::get(I.getType())); // icmp , - Global/Stack value // addresses never equal each other! We already know that Op0 != Op1. Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=80761&r1=80760&r2=80761&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Wed Sep 2 00:12:37 2009 @@ -28,3 +28,9 @@ ret i32 %1 } +; PR4837 +define <2 x i1> @test5(<2 x i64> %x) { +entry: + %V = icmp eq <2 x i64> %x, undef + ret <2 x i1> %V +} \ No newline at end of file From sabre at nondot.org Wed Sep 2 00:35:45 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 05:35:45 -0000 Subject: [llvm-commits] [llvm] r80762 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll Message-ID: <200909020535.n825Zjk3015674@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 00:35:45 2009 New Revision: 80762 URL: http://llvm.org/viewvc/llvm-project?rev=80762&view=rev Log: fix PR4848 an infinite loop when indexing down through a recursive gep and we get the original pointer type. This doesn't mean that we're at the first pointer being indexed. Correct the predicate. Added: llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=80762&r1=80761&r2=80762&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Sep 2 00:35:45 2009 @@ -172,7 +172,7 @@ do { if (const SequentialType *ATy = dyn_cast(Ty)) { // The only pointer indexing we'll do is on the first index of the GEP. - if (isa(ATy) && ATy != Ptr->getType()) + if (isa(ATy) && !NewIdxs.empty()) break; // Determine which element of the array the offset points into. APInt ElemSize(BitWidth, TD->getTypeAllocSize(ATy->getElementType())); Added: llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll?rev=80762&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll (added) +++ llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll Wed Sep 2 00:35:45 2009 @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -constprop | llvm-dis +; PR4848 +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-unknown-linux-gnu" + +%0 = type { %struct.anon } +%1 = type { %0, %2, [24 x i8] } +%2 = type <{ %3, %3 }> +%3 = type { %struct.hrtimer_cpu_base*, i32, %struct.rb_root, %struct.rb_node*, %struct.pgprot, i64 ()*, [16 x i8] } +%struct.anon = type { } +%struct.hrtimer_clock_base = type { %struct.hrtimer_cpu_base*, i32, %struct.rb_root, %struct.rb_node*, %struct.pgprot, i64 ()*, %struct.pgprot, %struct.pgprot } +%struct.hrtimer_cpu_base = type { %0, [2 x %struct.hrtimer_clock_base], %struct.pgprot, i32, i64 } +%struct.pgprot = type { i64 } +%struct.rb_node = type { i64, %struct.rb_node*, %struct.rb_node* } +%struct.rb_root = type { %struct.rb_node* } + + at per_cpu__hrtimer_bases = external global %1, align 8 ; <%1*> [#uses=1] + +define void @init_hrtimers_cpu(i32 %cpu) nounwind noredzone section ".cpuinit.text" { +entry: + %tmp3 = getelementptr %struct.hrtimer_cpu_base* bitcast (%1* @per_cpu__hrtimer_bases to %struct.hrtimer_cpu_base*), i32 0, i32 0 ; <%0*> [#uses=1] + %tmp5 = bitcast %0* %tmp3 to i8* ; [#uses=0] + unreachable +} From sabre at nondot.org Wed Sep 2 00:53:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 05:53:04 -0000 Subject: [llvm-commits] [llvm] r80763 - in /llvm/trunk/lib/Target/X86: X86.td X86Subtarget.cpp X86Subtarget.h Message-ID: <200909020553.n825r4MU018072@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 00:53:04 2009 New Revision: 80763 URL: http://llvm.org/viewvc/llvm-project?rev=80763&view=rev Log: Add support for modeling whether or not the processor has support for conditional moves as a subtarget feature. This is the easy part of PR4841. Modified: llvm/trunk/lib/Target/X86/X86.td llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/lib/Target/X86/X86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=80763&r1=80762&r2=80763&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.td (original) +++ llvm/trunk/lib/Target/X86/X86.td Wed Sep 2 00:53:04 2009 @@ -19,12 +19,17 @@ //===----------------------------------------------------------------------===// // X86 Subtarget features. //===----------------------------------------------------------------------===// - + +def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true", + "Enable conditional move instructions">; + def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX", "Enable MMX instructions">; def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1", "Enable SSE instructions", - [FeatureMMX]>; + // SSE codegen depends on cmovs, and all + // SSE1+ processors support them. + [FeatureMMX, FeatureCMOV]>; def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2", "Enable SSE2 instructions", [FeatureSSE1]>; @@ -76,8 +81,8 @@ def : Proc<"pentium", []>; def : Proc<"pentium-mmx", [FeatureMMX]>; def : Proc<"i686", []>; -def : Proc<"pentiumpro", []>; -def : Proc<"pentium2", [FeatureMMX]>; +def : Proc<"pentiumpro", [FeatureCMOV]>; +def : Proc<"pentium2", [FeatureMMX, FeatureCMOV]>; def : Proc<"pentium3", [FeatureSSE1]>; def : Proc<"pentium-m", [FeatureSSE2, FeatureSlowBTMem]>; def : Proc<"pentium4", [FeatureSSE2]>; Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=80763&r1=80762&r2=80763&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Wed Sep 2 00:53:04 2009 @@ -235,13 +235,14 @@ X86::GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX); - if ((EDX >> 23) & 0x1) X86SSELevel = MMX; - if ((EDX >> 25) & 0x1) X86SSELevel = SSE1; - if ((EDX >> 26) & 0x1) X86SSELevel = SSE2; + if ((EDX >> 15) & 1) HasCMov = true; + if ((EDX >> 23) & 1) X86SSELevel = MMX; + if ((EDX >> 25) & 1) X86SSELevel = SSE1; + if ((EDX >> 26) & 1) X86SSELevel = SSE2; if (ECX & 0x1) X86SSELevel = SSE3; - if ((ECX >> 9) & 0x1) X86SSELevel = SSSE3; - if ((ECX >> 19) & 0x1) X86SSELevel = SSE41; - if ((ECX >> 20) & 0x1) X86SSELevel = SSE42; + if ((ECX >> 9) & 1) X86SSELevel = SSSE3; + if ((ECX >> 19) & 1) X86SSELevel = SSE41; + if ((ECX >> 20) & 1) X86SSELevel = SSE42; bool IsIntel = memcmp(text.c, "GenuineIntel", 12) == 0; bool IsAMD = !IsIntel && memcmp(text.c, "AuthenticAMD", 12) == 0; @@ -380,6 +381,7 @@ : PICStyle(PICStyles::None) , X86SSELevel(NoMMXSSE) , X863DNowLevel(NoThreeDNow) + , HasCMov(false) , HasX86_64(false) , HasSSE4A(false) , HasAVX(false) Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=80763&r1=80762&r2=80763&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Wed Sep 2 00:53:04 2009 @@ -55,6 +55,10 @@ /// X863DNowEnum X863DNowLevel; + /// HasCMov - True if this processor has conditional move instructions + /// (generally pentium pro+). + bool HasCMov; + /// HasX86_64 - True if the processor supports X86-64 instructions. /// bool HasX86_64; From sabre at nondot.org Wed Sep 2 00:57:01 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 05:57:01 -0000 Subject: [llvm-commits] [llvm] r80764 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h Message-ID: <200909020557.n825v1bs018570@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 00:57:00 2009 New Revision: 80764 URL: http://llvm.org/viewvc/llvm-project?rev=80764&view=rev Log: refactor select 'sched insertion' out to its own method. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=80764&r1=80763&r2=80764&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Sep 2 00:57:00 2009 @@ -7703,10 +7703,66 @@ } MachineBasicBlock * +X86TargetLowering::EmitLoweredSelect(MachineInstr *MI, + MachineBasicBlock *BB) const { + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); + DebugLoc DL = MI->getDebugLoc(); + + // To "insert" a SELECT_CC instruction, we actually have to insert the + // diamond control-flow pattern. The incoming instruction knows the + // destination vreg to set, the condition code register to branch on, the + // true/false values to select between, and a branch opcode to use. + const BasicBlock *LLVM_BB = BB->getBasicBlock(); + MachineFunction::iterator It = BB; + ++It; + + // thisMBB: + // ... + // TrueVal = ... + // cmpTY ccX, r1, r2 + // bCC copy1MBB + // fallthrough --> copy0MBB + MachineBasicBlock *thisMBB = BB; + MachineFunction *F = BB->getParent(); + MachineBasicBlock *copy0MBB = F->CreateMachineBasicBlock(LLVM_BB); + MachineBasicBlock *sinkMBB = F->CreateMachineBasicBlock(LLVM_BB); + unsigned Opc = + X86::GetCondBranchFromCond((X86::CondCode)MI->getOperand(3).getImm()); + BuildMI(BB, DL, TII->get(Opc)).addMBB(sinkMBB); + F->insert(It, copy0MBB); + F->insert(It, sinkMBB); + // Update machine-CFG edges by transferring all successors of the current + // block to the new block which will contain the Phi node for the select. + sinkMBB->transferSuccessors(BB); + + // Add the true and fallthrough blocks as its successors. + BB->addSuccessor(copy0MBB); + BB->addSuccessor(sinkMBB); + + // copy0MBB: + // %FalseValue = ... + // # fallthrough to sinkMBB + BB = copy0MBB; + + // Update machine-CFG edges + BB->addSuccessor(sinkMBB); + + // sinkMBB: + // %Result = phi [ %FalseValue, copy0MBB ], [ %TrueValue, thisMBB ] + // ... + BB = sinkMBB; + BuildMI(BB, DL, TII->get(X86::PHI), MI->getOperand(0).getReg()) + .addReg(MI->getOperand(1).getReg()).addMBB(copy0MBB) + .addReg(MI->getOperand(2).getReg()).addMBB(thisMBB); + + F->DeleteMachineInstr(MI); // The pseudo instruction is gone now. + return BB; +} + + +MachineBasicBlock * X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *BB) const { - DebugLoc dl = MI->getDebugLoc(); - const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); switch (MI->getOpcode()) { default: assert(false && "Unexpected instr type to insert"); case X86::CMOV_GR8: @@ -7715,57 +7771,8 @@ case X86::CMOV_FR64: case X86::CMOV_V4F32: case X86::CMOV_V2F64: - case X86::CMOV_V2I64: { - // To "insert" a SELECT_CC instruction, we actually have to insert the - // diamond control-flow pattern. The incoming instruction knows the - // destination vreg to set, the condition code register to branch on, the - // true/false values to select between, and a branch opcode to use. - const BasicBlock *LLVM_BB = BB->getBasicBlock(); - MachineFunction::iterator It = BB; - ++It; - - // thisMBB: - // ... - // TrueVal = ... - // cmpTY ccX, r1, r2 - // bCC copy1MBB - // fallthrough --> copy0MBB - MachineBasicBlock *thisMBB = BB; - MachineFunction *F = BB->getParent(); - MachineBasicBlock *copy0MBB = F->CreateMachineBasicBlock(LLVM_BB); - MachineBasicBlock *sinkMBB = F->CreateMachineBasicBlock(LLVM_BB); - unsigned Opc = - X86::GetCondBranchFromCond((X86::CondCode)MI->getOperand(3).getImm()); - BuildMI(BB, dl, TII->get(Opc)).addMBB(sinkMBB); - F->insert(It, copy0MBB); - F->insert(It, sinkMBB); - // Update machine-CFG edges by transferring all successors of the current - // block to the new block which will contain the Phi node for the select. - sinkMBB->transferSuccessors(BB); - - // Add the true and fallthrough blocks as its successors. - BB->addSuccessor(copy0MBB); - BB->addSuccessor(sinkMBB); - - // copy0MBB: - // %FalseValue = ... - // # fallthrough to sinkMBB - BB = copy0MBB; - - // Update machine-CFG edges - BB->addSuccessor(sinkMBB); - - // sinkMBB: - // %Result = phi [ %FalseValue, copy0MBB ], [ %TrueValue, thisMBB ] - // ... - BB = sinkMBB; - BuildMI(BB, dl, TII->get(X86::PHI), MI->getOperand(0).getReg()) - .addReg(MI->getOperand(1).getReg()).addMBB(copy0MBB) - .addReg(MI->getOperand(2).getReg()).addMBB(thisMBB); - - F->DeleteMachineInstr(MI); // The pseudo instruction is gone now. - return BB; - } + case X86::CMOV_V2I64: + return EmitLoweredSelect(MI, BB); case X86::FP32_TO_INT16_IN_MEM: case X86::FP32_TO_INT32_IN_MEM: @@ -7776,27 +7783,30 @@ case X86::FP80_TO_INT16_IN_MEM: case X86::FP80_TO_INT32_IN_MEM: case X86::FP80_TO_INT64_IN_MEM: { + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); + DebugLoc DL = MI->getDebugLoc(); + // Change the floating point control register to use "round towards zero" // mode when truncating to an integer value. MachineFunction *F = BB->getParent(); int CWFrameIdx = F->getFrameInfo()->CreateStackObject(2, 2); - addFrameReference(BuildMI(BB, dl, TII->get(X86::FNSTCW16m)), CWFrameIdx); + addFrameReference(BuildMI(BB, DL, TII->get(X86::FNSTCW16m)), CWFrameIdx); // Load the old value of the high byte of the control word... unsigned OldCW = F->getRegInfo().createVirtualRegister(X86::GR16RegisterClass); - addFrameReference(BuildMI(BB, dl, TII->get(X86::MOV16rm), OldCW), + addFrameReference(BuildMI(BB, DL, TII->get(X86::MOV16rm), OldCW), CWFrameIdx); // Set the high part to be round to zero... - addFrameReference(BuildMI(BB, dl, TII->get(X86::MOV16mi)), CWFrameIdx) + addFrameReference(BuildMI(BB, DL, TII->get(X86::MOV16mi)), CWFrameIdx) .addImm(0xC7F); // Reload the modified control word now... - addFrameReference(BuildMI(BB, dl, TII->get(X86::FLDCW16m)), CWFrameIdx); + addFrameReference(BuildMI(BB, DL, TII->get(X86::FLDCW16m)), CWFrameIdx); // Restore the memory image of control word to original value - addFrameReference(BuildMI(BB, dl, TII->get(X86::MOV16mr)), CWFrameIdx) + addFrameReference(BuildMI(BB, DL, TII->get(X86::MOV16mr)), CWFrameIdx) .addReg(OldCW); // Get the X86 opcode to use. @@ -7835,11 +7845,11 @@ } else { AM.Disp = Op.getImm(); } - addFullAddress(BuildMI(BB, dl, TII->get(Opc)), AM) + addFullAddress(BuildMI(BB, DL, TII->get(Opc)), AM) .addReg(MI->getOperand(X86AddrNumOperands).getReg()); // Reload the original control word now. - addFrameReference(BuildMI(BB, dl, TII->get(X86::FLDCW16m)), CWFrameIdx); + addFrameReference(BuildMI(BB, DL, TII->get(X86::FLDCW16m)), CWFrameIdx); F->DeleteMachineInstr(MI); // The pseudo instruction is gone now. return BB; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=80764&r1=80763&r2=80764&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Wed Sep 2 00:57:00 2009 @@ -738,6 +738,9 @@ MachineInstr *BInstr, MachineBasicBlock *BB) const; + MachineBasicBlock *EmitLoweredSelect(MachineInstr *I, + MachineBasicBlock *BB) const; + /// Emit nodes that will be selected as "test Op0,Op0", or something /// equivalent, for use with the given x86 condition code. SDValue EmitTest(SDValue Op0, unsigned X86CC, SelectionDAG &DAG); From sabre at nondot.org Wed Sep 2 01:11:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 06:11:42 -0000 Subject: [llvm-commits] [llvm] r80766 - /llvm/trunk/lib/Transforms/Scalar/ Message-ID: <200909020611.n826Bhwh020576@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 01:11:42 2009 New Revision: 80766 URL: http://llvm.org/viewvc/llvm-project?rev=80766&view=rev Log: eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861 Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp llvm/trunk/lib/Transforms/Scalar/BasicBlockPlacement.cpp llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp llvm/trunk/lib/Transforms/Scalar/CondPropagate.cpp llvm/trunk/lib/Transforms/Scalar/ConstantProp.cpp llvm/trunk/lib/Transforms/Scalar/DCE.cpp llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp llvm/trunk/lib/Transforms/Scalar/LICM.cpp llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Wed Sep 2 01:11:42 2009 @@ -21,19 +21,17 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Pass.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" - using namespace llvm; STATISTIC(NumRemoved, "Number of instructions removed"); namespace { - struct VISIBILITY_HIDDEN ADCE : public FunctionPass { + struct ADCE : public FunctionPass { static char ID; // Pass identification, replacement for typeid ADCE() : FunctionPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/BasicBlockPlacement.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/BasicBlockPlacement.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/BasicBlockPlacement.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/BasicBlockPlacement.cpp Wed Sep 2 01:11:42 2009 @@ -31,7 +31,6 @@ #include "llvm/Function.h" #include "llvm/Pass.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/ADT/Statistic.h" #include "llvm/Transforms/Scalar.h" #include @@ -40,7 +39,7 @@ STATISTIC(NumMoved, "Number of basic blocks moved"); namespace { - struct VISIBILITY_HIDDEN BlockPlacement : public FunctionPass { + struct BlockPlacement : public FunctionPass { static char ID; // Pass identification, replacement for typeid BlockPlacement() : FunctionPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Sep 2 01:11:42 2009 @@ -33,7 +33,6 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/PatternMatch.h" @@ -45,7 +44,7 @@ cl::init(false), cl::Hidden); namespace { - class VISIBILITY_HIDDEN CodeGenPrepare : public FunctionPass { + class CodeGenPrepare : public FunctionPass { /// TLI - Keep a pointer of a TargetLowering to consult for determining /// transformation profitability. const TargetLowering *TLI; Modified: llvm/trunk/lib/Transforms/Scalar/CondPropagate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CondPropagate.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CondPropagate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CondPropagate.cpp Wed Sep 2 01:11:42 2009 @@ -22,14 +22,13 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Support/Compiler.h" using namespace llvm; STATISTIC(NumBrThread, "Number of CFG edges threaded through branches"); STATISTIC(NumSwThread, "Number of CFG edges threaded through switches"); namespace { - struct VISIBILITY_HIDDEN CondProp : public FunctionPass { + struct CondProp : public FunctionPass { static char ID; // Pass identification, replacement for typeid CondProp() : FunctionPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/ConstantProp.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ConstantProp.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ConstantProp.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ConstantProp.cpp Wed Sep 2 01:11:42 2009 @@ -24,7 +24,6 @@ #include "llvm/Constant.h" #include "llvm/Instruction.h" #include "llvm/Pass.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" #include "llvm/ADT/Statistic.h" #include @@ -33,7 +32,7 @@ STATISTIC(NumInstKilled, "Number of instructions killed"); namespace { - struct VISIBILITY_HIDDEN ConstantPropagation : public FunctionPass { + struct ConstantPropagation : public FunctionPass { static char ID; // Pass identification, replacement for typeid ConstantPropagation() : FunctionPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/DCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DCE.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DCE.cpp Wed Sep 2 01:11:42 2009 @@ -21,7 +21,6 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/Instruction.h" #include "llvm/Pass.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" #include "llvm/ADT/Statistic.h" #include @@ -34,7 +33,7 @@ //===--------------------------------------------------------------------===// // DeadInstElimination pass implementation // - struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass { + struct DeadInstElimination : public BasicBlockPass { static char ID; // Pass identification, replacement for typeid DeadInstElimination() : BasicBlockPass(&ID) {} virtual bool runOnBasicBlock(BasicBlock &BB) { Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Sep 2 01:11:42 2009 @@ -29,14 +29,13 @@ #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/Local.h" -#include "llvm/Support/Compiler.h" using namespace llvm; STATISTIC(NumFastStores, "Number of stores deleted"); STATISTIC(NumFastOther , "Number of other instrs removed"); namespace { - struct VISIBILITY_HIDDEN DSE : public FunctionPass { + struct DSE : public FunctionPass { TargetData *TD; static char ID; // Pass identification, replacement for typeid Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Sep 2 01:11:42 2009 @@ -35,7 +35,6 @@ #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/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" @@ -62,7 +61,7 @@ /// as an efficient mechanism to determine the expression-wise equivalence of /// two values. namespace { - struct VISIBILITY_HIDDEN Expression { + struct Expression { enum ExpressionOpcode { ADD, FADD, SUB, FSUB, MUL, FMUL, UDIV, SDIV, FDIV, UREM, SREM, FREM, SHL, LSHR, ASHR, AND, OR, XOR, ICMPEQ, @@ -119,7 +118,7 @@ } }; - class VISIBILITY_HIDDEN ValueTable { + class ValueTable { private: DenseMap valueNumbering; DenseMap expressionNumbering; @@ -678,7 +677,7 @@ //===----------------------------------------------------------------------===// namespace { - struct VISIBILITY_HIDDEN ValueNumberScope { + struct ValueNumberScope { ValueNumberScope* parent; DenseMap table; @@ -688,7 +687,7 @@ namespace { - class VISIBILITY_HIDDEN GVN : public FunctionPass { + class GVN : public FunctionPass { bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid Modified: llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Wed Sep 2 01:11:42 2009 @@ -37,7 +37,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include @@ -133,7 +132,7 @@ } namespace { - class VISIBILITY_HIDDEN ValueTable { + class ValueTable { private: DenseMap valueNumbering; DenseMap expressionNumbering; @@ -675,8 +674,7 @@ //===----------------------------------------------------------------------===// namespace { - - class VISIBILITY_HIDDEN GVNPRE : public FunctionPass { + class GVNPRE : public FunctionPass { bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Sep 2 01:11:42 2009 @@ -51,7 +51,6 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -68,7 +67,7 @@ STATISTIC(NumLFTR , "Number of loop exit tests replaced"); namespace { - class VISIBILITY_HIDDEN IndVarSimplify : public LoopPass { + class IndVarSimplify : public LoopPass { IVUsers *IU; LoopInfo *LI; ScalarEvolution *SE; Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Sep 2 01:11:42 2009 @@ -55,7 +55,6 @@ #include "llvm/Support/IRBuilder.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/PatternMatch.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" @@ -159,9 +158,8 @@ namespace { - class VISIBILITY_HIDDEN InstCombiner - : public FunctionPass, - public InstVisitor { + class InstCombiner : public FunctionPass, + public InstVisitor { TargetData *TD; bool MustPreserveLCSSA; bool MadeIRChange; Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Wed Sep 2 01:11:42 2009 @@ -26,7 +26,6 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" @@ -57,7 +56,7 @@ /// In this case, the unconditional branch at the end of the first if can be /// revectored to the false side of the second if. /// - class VISIBILITY_HIDDEN JumpThreading : public FunctionPass { + class JumpThreading : public FunctionPass { TargetData *TD; #ifdef NDEBUG SmallPtrSet LoopHeaders; Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Sep 2 01:11:42 2009 @@ -46,7 +46,6 @@ #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Debug.h" @@ -74,7 +73,7 @@ "global variables")); namespace { - struct VISIBILITY_HIDDEN LICM : public LoopPass { + struct LICM : public LoopPass { static char ID; // Pass identification, replacement for typeid LICM() : LoopPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Wed Sep 2 01:11:42 2009 @@ -15,19 +15,17 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "loop-delete" - #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallVector.h" - using namespace llvm; STATISTIC(NumDeleted, "Number of loops deleted"); namespace { - class VISIBILITY_HIDDEN LoopDeletion : public LoopPass { + class LoopDeletion : public LoopPass { public: static char ID; // Pass ID, replacement for typeid LoopDeletion() : LoopPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Wed Sep 2 01:11:42 2009 @@ -51,7 +51,6 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "loop-index-split" - #include "llvm/Transforms/Scalar.h" #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" @@ -61,7 +60,6 @@ #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Local.h" -#include "llvm/Support/Compiler.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" @@ -73,8 +71,7 @@ namespace { - class VISIBILITY_HIDDEN LoopIndexSplit : public LoopPass { - + class LoopIndexSplit : public LoopPass { public: static char ID; // Pass ID, replacement for typeid LoopIndexSplit() : LoopPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Wed Sep 2 01:11:42 2009 @@ -32,7 +32,7 @@ STATISTIC(NumRotated, "Number of loops rotated"); namespace { - class VISIBILITY_HIDDEN RenameData { + class RenameData { public: RenameData(Instruction *O, Value *P, Instruction *H) : Original(O), PreHeader(P), Header(H) { } @@ -42,8 +42,7 @@ Instruction *Header; // New header replacement }; - class VISIBILITY_HIDDEN LoopRotate : public LoopPass { - + class LoopRotate : public LoopPass { public: static char ID; // Pass ID, replacement for typeid LoopRotate() : LoopPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Sep 2 01:11:42 2009 @@ -38,7 +38,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" @@ -65,7 +64,7 @@ /// IVInfo - This structure keeps track of one IV expression inserted during /// StrengthReduceStridedIVUsers. It contains the stride, the common base, as /// well as the PHI node and increment value created for rewrite. - struct VISIBILITY_HIDDEN IVExpr { + struct IVExpr { const SCEV *Stride; const SCEV *Base; PHINode *PHI; @@ -76,7 +75,7 @@ /// IVsOfOneStride - This structure keeps track of all IV expression inserted /// during StrengthReduceStridedIVUsers for a particular stride of the IV. - struct VISIBILITY_HIDDEN IVsOfOneStride { + struct IVsOfOneStride { std::vector IVs; void addIV(const SCEV *const Stride, const SCEV *const Base, PHINode *PHI) { @@ -84,7 +83,7 @@ } }; - class VISIBILITY_HIDDEN LoopStrengthReduce : public LoopPass { + class LoopStrengthReduce : public LoopPass { IVUsers *IU; LoopInfo *LI; DominatorTree *DT; Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Wed Sep 2 01:11:42 2009 @@ -17,7 +17,6 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -40,7 +39,7 @@ "-unroll-threshold loop size is reached.")); namespace { - class VISIBILITY_HIDDEN LoopUnroll : public LoopPass { + class LoopUnroll : public LoopPass { public: static char ID; // Pass ID, replacement for typeid LoopUnroll() : LoopPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Sep 2 01:11:42 2009 @@ -44,7 +44,6 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include @@ -62,7 +61,7 @@ cl::init(10), cl::Hidden); namespace { - class VISIBILITY_HIDDEN LoopUnswitch : public LoopPass { + class LoopUnswitch : public LoopPass { LoopInfo *LI; // Loop information LPPassManager *LPM; Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Wed Sep 2 01:11:42 2009 @@ -296,8 +296,7 @@ //===----------------------------------------------------------------------===// namespace { - - class VISIBILITY_HIDDEN MemCpyOpt : public FunctionPass { + class MemCpyOpt : public FunctionPass { bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Sep 2 01:11:42 2009 @@ -93,7 +93,6 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/ConstantRange.h" #include "llvm/Support/Debug.h" #include "llvm/Support/InstVisitor.h" @@ -377,12 +376,12 @@ } /// ValueNumbering stores the scope-specific value numbers for a given Value. - class VISIBILITY_HIDDEN ValueNumbering { + class ValueNumbering { /// VNPair is a tuple of {Value, index number, DomTreeDFS::Node}. It /// includes the comparison operators necessary to allow you to store it /// in a sorted vector. - class VISIBILITY_HIDDEN VNPair { + class VNPair { public: Value *V; unsigned index; @@ -592,7 +591,7 @@ /// /// The InequalityGraph class may invalidate Node*s after any mutator call. /// @brief The InequalityGraph stores the relationships between values. - class VISIBILITY_HIDDEN InequalityGraph { + class InequalityGraph { ValueNumbering &VN; DomTreeDFS::Node *TreeRoot; @@ -608,7 +607,7 @@ /// and contains a pointer to the other end. The edge contains a lattice /// value specifying the relationship and an DomTreeDFS::Node specifying /// the root in the dominator tree to which this edge applies. - class VISIBILITY_HIDDEN Edge { + class Edge { public: Edge(unsigned T, LatticeVal V, DomTreeDFS::Node *ST) : To(T), LV(V), Subtree(ST) {} @@ -639,7 +638,7 @@ /// for the node, as well as the relationships with the neighbours. /// /// @brief A single node in the InequalityGraph. - class VISIBILITY_HIDDEN Node { + class Node { friend class InequalityGraph; typedef SmallVector RelationsType; @@ -904,12 +903,12 @@ /// ValueRanges tracks the known integer ranges and anti-ranges of the nodes /// in the InequalityGraph. - class VISIBILITY_HIDDEN ValueRanges { + class ValueRanges { ValueNumbering &VN; TargetData *TD; LLVMContext *Context; - class VISIBILITY_HIDDEN ScopedRange { + class ScopedRange { typedef std::vector > RangeListType; RangeListType RangeList; @@ -1270,7 +1269,7 @@ /// another discovered to be unreachable. This is used to cull the graph when /// analyzing instructions, and to mark blocks with the "unreachable" /// terminator instruction after the function has executed. - class VISIBILITY_HIDDEN UnreachableBlocks { + class UnreachableBlocks { private: std::vector DeadBlocks; @@ -1324,7 +1323,7 @@ /// variables, and forwards changes along to the InequalityGraph. It /// also maintains the correct choice for "canonical" in the IG. /// @brief VRPSolver calculates inferences from a new relationship. - class VISIBILITY_HIDDEN VRPSolver { + class VRPSolver { private: friend class ValueRanges; @@ -2266,7 +2265,7 @@ /// one equivalent variable with another. It also tracks what /// can't be equal and will solve setcc instructions when possible. /// @brief Root of the predicate simplifier optimization. - class VISIBILITY_HIDDEN PredicateSimplifier : public FunctionPass { + class PredicateSimplifier : public FunctionPass { DomTreeDFS *DTDFS; bool modified; ValueNumbering *VN; @@ -2295,7 +2294,7 @@ /// PredicateSimplifier::proceedToSuccessor(s) interface to enter the /// basic block. /// @brief Performs abstract execution of the program. - class VISIBILITY_HIDDEN Forwards : public InstVisitor { + class Forwards : public InstVisitor { friend class InstVisitor; PredicateSimplifier *PS; DomTreeDFS::Node *DTNode; Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Wed Sep 2 01:11:42 2009 @@ -31,7 +31,6 @@ #include "llvm/Pass.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" @@ -47,7 +46,7 @@ STATISTIC(NumFactor , "Number of multiplies factored"); namespace { - struct VISIBILITY_HIDDEN ValueEntry { + struct ValueEntry { unsigned Rank; Value *Op; ValueEntry(unsigned R, Value *O) : Rank(R), Op(O) {} @@ -72,7 +71,7 @@ #endif namespace { - class VISIBILITY_HIDDEN Reassociate : public FunctionPass { + class Reassociate : public FunctionPass { std::map RankMap; std::map, unsigned> ValueRankMap; bool MadeChange; Modified: llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp Wed Sep 2 01:11:42 2009 @@ -26,7 +26,6 @@ #include "llvm/BasicBlock.h" #include "llvm/Instructions.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/CFG.h" #include using namespace llvm; @@ -35,7 +34,7 @@ STATISTIC(NumPhisDemoted, "Number of phi-nodes demoted"); namespace { - struct VISIBILITY_HIDDEN RegToMem : public FunctionPass { + struct RegToMem : public FunctionPass { static char ID; // Pass identification, replacement for typeid RegToMem() : FunctionPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Sep 2 01:11:42 2009 @@ -33,7 +33,6 @@ #include "llvm/Analysis/ValueTracking.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Support/CallSite.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/InstVisitor.h" @@ -60,7 +59,7 @@ /// LatticeVal class - This class represents the different lattice values that /// an LLVM value may occupy. It is a simple class with value semantics. /// -class VISIBILITY_HIDDEN LatticeVal { +class LatticeVal { enum { /// undefined - This LLVM Value has no known value yet. undefined, @@ -1506,7 +1505,7 @@ /// SCCP Class - This class uses the SCCPSolver to implement a per-function /// Sparse Conditional Constant Propagator. /// - struct VISIBILITY_HIDDEN SCCP : public FunctionPass { + struct SCCP : public FunctionPass { static char ID; // Pass identification, replacement for typeid SCCP() : FunctionPass(&ID) {} @@ -1621,7 +1620,7 @@ /// IPSCCP Class - This class implements interprocedural Sparse Conditional /// Constant Propagation. /// - struct VISIBILITY_HIDDEN IPSCCP : public ModulePass { + struct IPSCCP : public ModulePass { static char ID; IPSCCP() : ModulePass(&ID) {} bool runOnModule(Module &M); Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Sep 2 01:11:42 2009 @@ -38,7 +38,6 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/IRBuilder.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" @@ -50,7 +49,7 @@ STATISTIC(NumGlobals, "Number of allocas copied from constant global"); namespace { - struct VISIBILITY_HIDDEN SROA : public FunctionPass { + struct SROA : public FunctionPass { static char ID; // Pass identification, replacement for typeid explicit SROA(signed T = -1) : FunctionPass(&ID) { if (T == -1) Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Wed Sep 2 01:11:42 2009 @@ -30,7 +30,6 @@ #include "llvm/Module.h" #include "llvm/Attributes.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" #include "llvm/Pass.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallPtrSet.h" @@ -40,7 +39,7 @@ STATISTIC(NumSimpl, "Number of blocks simplified"); namespace { - struct VISIBILITY_HIDDEN CFGSimplifyPass : public FunctionPass { + struct CFGSimplifyPass : public FunctionPass { static char ID; // Pass identification, replacement for typeid CFGSimplifyPass() : FunctionPass(&ID) {} Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp Wed Sep 2 01:11:42 2009 @@ -22,15 +22,13 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" -#include "llvm/Config/config.h" using namespace llvm; namespace { /// This pass optimizes well half_powr function calls. /// - class VISIBILITY_HIDDEN SimplifyHalfPowrLibCalls : public FunctionPass { + class SimplifyHalfPowrLibCalls : public FunctionPass { const TargetData *TD; public: static char ID; // Pass identification @@ -59,8 +57,9 @@ /// InlineHalfPowrs - Inline a sequence of adjacent half_powr calls, rearranging /// their control flow to better facilitate subsequent optimization. Instruction * -SimplifyHalfPowrLibCalls::InlineHalfPowrs(const std::vector &HalfPowrs, - Instruction *InsertPt) { +SimplifyHalfPowrLibCalls:: +InlineHalfPowrs(const std::vector &HalfPowrs, + Instruction *InsertPt) { std::vector Bodies; BasicBlock *NewBlock = 0; Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Sep 2 01:11:42 2009 @@ -30,7 +30,6 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Config/config.h" @@ -46,7 +45,7 @@ /// This class is the abstract base class for the set of optimizations that /// corresponds to one library call. namespace { -class VISIBILITY_HIDDEN LibCallOptimization { +class LibCallOptimization { protected: Function *Caller; const TargetData *TD; @@ -508,7 +507,7 @@ // 'exit' Optimizations /// ExitOpt - int main() { exit(4); } --> int main() { return 4; } -struct VISIBILITY_HIDDEN ExitOpt : public LibCallOptimization { +struct ExitOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify we have a reasonable prototype for exit. if (Callee->arg_size() == 0 || !CI->use_empty()) @@ -552,7 +551,7 @@ //===---------------------------------------===// // 'strcat' Optimizations -struct VISIBILITY_HIDDEN StrCatOpt : public LibCallOptimization { +struct StrCatOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify the "strcat" function prototype. const FunctionType *FT = Callee->getFunctionType(); @@ -602,7 +601,7 @@ //===---------------------------------------===// // 'strncat' Optimizations -struct VISIBILITY_HIDDEN StrNCatOpt : public StrCatOpt { +struct StrNCatOpt : public StrCatOpt { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify the "strncat" function prototype. const FunctionType *FT = Callee->getFunctionType(); @@ -650,7 +649,7 @@ //===---------------------------------------===// // 'strchr' Optimizations -struct VISIBILITY_HIDDEN StrChrOpt : public LibCallOptimization { +struct StrChrOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify the "strchr" function prototype. const FunctionType *FT = Callee->getFunctionType(); @@ -706,7 +705,7 @@ //===---------------------------------------===// // 'strcmp' Optimizations -struct VISIBILITY_HIDDEN StrCmpOpt : public LibCallOptimization { +struct StrCmpOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify the "strcmp" function prototype. const FunctionType *FT = Callee->getFunctionType(); @@ -753,7 +752,7 @@ //===---------------------------------------===// // 'strncmp' Optimizations -struct VISIBILITY_HIDDEN StrNCmpOpt : public LibCallOptimization { +struct StrNCmpOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify the "strncmp" function prototype. const FunctionType *FT = Callee->getFunctionType(); @@ -799,7 +798,7 @@ //===---------------------------------------===// // 'strcpy' Optimizations -struct VISIBILITY_HIDDEN StrCpyOpt : public LibCallOptimization { +struct StrCpyOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Verify the "strcpy" function prototype. const FunctionType *FT = Callee->getFunctionType(); @@ -830,7 +829,7 @@ //===---------------------------------------===// // 'strncpy' Optimizations -struct VISIBILITY_HIDDEN StrNCpyOpt : public LibCallOptimization { +struct StrNCpyOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) || @@ -879,7 +878,7 @@ //===---------------------------------------===// // 'strlen' Optimizations -struct VISIBILITY_HIDDEN StrLenOpt : public LibCallOptimization { +struct StrLenOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 1 || @@ -905,7 +904,7 @@ //===---------------------------------------===// // 'strto*' Optimizations -struct VISIBILITY_HIDDEN StrToOpt : public LibCallOptimization { +struct StrToOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); if ((FT->getNumParams() != 2 && FT->getNumParams() != 3) || @@ -927,7 +926,7 @@ //===---------------------------------------===// // 'memcmp' Optimizations -struct VISIBILITY_HIDDEN MemCmpOpt : public LibCallOptimization { +struct MemCmpOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 3 || !isa(FT->getParamType(0)) || @@ -974,7 +973,7 @@ //===---------------------------------------===// // 'memcpy' Optimizations -struct VISIBILITY_HIDDEN MemCpyOpt : public LibCallOptimization { +struct MemCpyOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // These optimizations require TargetData. if (!TD) return 0; @@ -995,7 +994,7 @@ //===---------------------------------------===// // 'memmove' Optimizations -struct VISIBILITY_HIDDEN MemMoveOpt : public LibCallOptimization { +struct MemMoveOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // These optimizations require TargetData. if (!TD) return 0; @@ -1025,7 +1024,7 @@ //===---------------------------------------===// // 'memset' Optimizations -struct VISIBILITY_HIDDEN MemSetOpt : public LibCallOptimization { +struct MemSetOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // These optimizations require TargetData. if (!TD) return 0; @@ -1051,7 +1050,7 @@ //===---------------------------------------===// // 'pow*' Optimizations -struct VISIBILITY_HIDDEN PowOpt : public LibCallOptimization { +struct PowOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // Just make sure this has 2 arguments of the same FP type, which match the @@ -1102,7 +1101,7 @@ //===---------------------------------------===// // 'exp2' Optimizations -struct VISIBILITY_HIDDEN Exp2Opt : public LibCallOptimization { +struct Exp2Opt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // Just make sure this has 1 argument of FP type, which matches the @@ -1152,7 +1151,7 @@ //===---------------------------------------===// // Double -> Float Shrinking Optimizations for Unary Functions like 'floor' -struct VISIBILITY_HIDDEN UnaryDoubleFPOpt : public LibCallOptimization { +struct UnaryDoubleFPOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 1 || FT->getReturnType() != Type::getDoubleTy(*Context) || @@ -1178,7 +1177,7 @@ //===---------------------------------------===// // 'ffs*' Optimizations -struct VISIBILITY_HIDDEN FFSOpt : public LibCallOptimization { +struct FFSOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // Just make sure this has 2 arguments of the same FP type, which match the @@ -1213,7 +1212,7 @@ //===---------------------------------------===// // 'isdigit' Optimizations -struct VISIBILITY_HIDDEN IsDigitOpt : public LibCallOptimization { +struct IsDigitOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // We require integer(i32) @@ -1234,7 +1233,7 @@ //===---------------------------------------===// // 'isascii' Optimizations -struct VISIBILITY_HIDDEN IsAsciiOpt : public LibCallOptimization { +struct IsAsciiOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // We require integer(i32) @@ -1253,7 +1252,7 @@ //===---------------------------------------===// // 'abs', 'labs', 'llabs' Optimizations -struct VISIBILITY_HIDDEN AbsOpt : public LibCallOptimization { +struct AbsOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // We require integer(integer) where the types agree. @@ -1275,7 +1274,7 @@ //===---------------------------------------===// // 'toascii' Optimizations -struct VISIBILITY_HIDDEN ToAsciiOpt : public LibCallOptimization { +struct ToAsciiOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { const FunctionType *FT = Callee->getFunctionType(); // We require i32(i32) @@ -1296,7 +1295,7 @@ //===---------------------------------------===// // 'printf' Optimizations -struct VISIBILITY_HIDDEN PrintFOpt : public LibCallOptimization { +struct PrintFOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Require one fixed pointer argument and an integer/void result. const FunctionType *FT = Callee->getFunctionType(); @@ -1359,7 +1358,7 @@ //===---------------------------------------===// // 'sprintf' Optimizations -struct VISIBILITY_HIDDEN SPrintFOpt : public LibCallOptimization { +struct SPrintFOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Require two fixed pointer arguments and an integer result. const FunctionType *FT = Callee->getFunctionType(); @@ -1431,7 +1430,7 @@ //===---------------------------------------===// // 'fwrite' Optimizations -struct VISIBILITY_HIDDEN FWriteOpt : public LibCallOptimization { +struct FWriteOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Require a pointer, an integer, an integer, a pointer, returning integer. const FunctionType *FT = Callee->getFunctionType(); @@ -1466,7 +1465,7 @@ //===---------------------------------------===// // 'fputs' Optimizations -struct VISIBILITY_HIDDEN FPutsOpt : public LibCallOptimization { +struct FPutsOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // These optimizations require TargetData. if (!TD) return 0; @@ -1491,7 +1490,7 @@ //===---------------------------------------===// // 'fprintf' Optimizations -struct VISIBILITY_HIDDEN FPrintFOpt : public LibCallOptimization { +struct FPrintFOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { // Require two fixed paramters as pointers and integer result. const FunctionType *FT = Callee->getFunctionType(); @@ -1553,7 +1552,7 @@ namespace { /// This pass optimizes well known library functions from libc and libm. /// - class VISIBILITY_HIDDEN SimplifyLibCalls : public FunctionPass { + class SimplifyLibCalls : public FunctionPass { StringMap Optimizations; // Miscellaneous LibCall Optimizations ExitOpt Exit; Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Wed Sep 2 01:11:42 2009 @@ -30,7 +30,6 @@ #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" @@ -46,7 +45,7 @@ cl::init(1), cl::Hidden); namespace { - class VISIBILITY_HIDDEN TailDup : public FunctionPass { + class TailDup : public FunctionPass { bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=80766&r1=80765&r2=80766&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Wed Sep 2 01:11:42 2009 @@ -60,14 +60,13 @@ #include "llvm/Pass.h" #include "llvm/Support/CFG.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Support/Compiler.h" using namespace llvm; STATISTIC(NumEliminated, "Number of tail calls removed"); STATISTIC(NumAccumAdded, "Number of accumulators introduced"); namespace { - struct VISIBILITY_HIDDEN TailCallElim : public FunctionPass { + struct TailCallElim : public FunctionPass { static char ID; // Pass identification, replacement for typeid TailCallElim() : FunctionPass(&ID) {} From sabre at nondot.org Wed Sep 2 01:15:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 06:15:37 -0000 Subject: [llvm-commits] [llvm] r80767 - /llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp Message-ID: <200909020615.n826Fb0M021047@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 01:15:37 2009 New Revision: 80767 URL: http://llvm.org/viewvc/llvm-project?rev=80767&view=rev Log: clean up this code a bit. Modified: llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp Modified: llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp?rev=80767&r1=80766&r2=80767&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp Wed Sep 2 01:15:37 2009 @@ -43,74 +43,17 @@ AU.addPreservedID(BreakCriticalEdgesID); } - bool valueEscapes(Instruction* i) { - BasicBlock* bb = i->getParent(); - for (Value::use_iterator ii = i->use_begin(), ie = i->use_end(); - ii != ie; ++ii) - if (cast(*ii)->getParent() != bb || - isa(*ii)) + bool valueEscapes(const Instruction *Inst) const { + const BasicBlock *BB = Inst->getParent(); + for (Value::use_const_iterator UI = Inst->use_begin(),E = Inst->use_end(); + UI != E; ++UI) + if (cast(*UI)->getParent() != BB || + isa(*UI)) return true; return false; } - virtual bool runOnFunction(Function &F) { - if (!F.isDeclaration()) { - // Insert all new allocas into entry block. - BasicBlock* BBEntry = &F.getEntryBlock(); - assert(pred_begin(BBEntry) == pred_end(BBEntry) && - "Entry block to function must not have predecessors!"); - - // Find first non-alloca instruction and create insertion point. This is - // safe if block is well-formed: it always have terminator, otherwise - // we'll get and assertion. - BasicBlock::iterator I = BBEntry->begin(); - while (isa(I)) ++I; - - CastInst *AllocaInsertionPoint = - CastInst::Create(Instruction::BitCast, - Constant::getNullValue(Type::getInt32Ty(F.getContext())), - Type::getInt32Ty(F.getContext()), - "reg2mem alloca point", I); - - // Find the escaped instructions. But don't create stack slots for - // allocas in entry block. - std::list worklist; - for (Function::iterator ibb = F.begin(), ibe = F.end(); - ibb != ibe; ++ibb) - for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end(); - iib != iie; ++iib) { - if (!(isa(iib) && iib->getParent() == BBEntry) && - valueEscapes(iib)) { - worklist.push_front(&*iib); - } - } - - // Demote escaped instructions - NumRegsDemoted += worklist.size(); - for (std::list::iterator ilb = worklist.begin(), - ile = worklist.end(); ilb != ile; ++ilb) - DemoteRegToStack(**ilb, false, AllocaInsertionPoint); - - worklist.clear(); - - // Find all phi's - for (Function::iterator ibb = F.begin(), ibe = F.end(); - ibb != ibe; ++ibb) - for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end(); - iib != iie; ++iib) - if (isa(iib)) - worklist.push_front(&*iib); - - // Demote phi nodes - NumPhisDemoted += worklist.size(); - for (std::list::iterator ilb = worklist.begin(), - ile = worklist.end(); ilb != ile; ++ilb) - DemotePHIToStack(cast(*ilb), AllocaInsertionPoint); - - return true; - } - return false; - } + virtual bool runOnFunction(Function &F); }; } @@ -118,6 +61,66 @@ static RegisterPass X("reg2mem", "Demote all values to stack slots"); + +bool RegToMem::runOnFunction(Function &F) { + if (F.isDeclaration()) + return false; + + // Insert all new allocas into entry block. + BasicBlock *BBEntry = &F.getEntryBlock(); + assert(pred_begin(BBEntry) == pred_end(BBEntry) && + "Entry block to function must not have predecessors!"); + + // Find first non-alloca instruction and create insertion point. This is + // safe if block is well-formed: it always have terminator, otherwise + // we'll get and assertion. + BasicBlock::iterator I = BBEntry->begin(); + while (isa(I)) ++I; + + CastInst *AllocaInsertionPoint = + new BitCastInst(Constant::getNullValue(Type::getInt32Ty(F.getContext())), + Type::getInt32Ty(F.getContext()), + "reg2mem alloca point", I); + + // Find the escaped instructions. But don't create stack slots for + // allocas in entry block. + std::list WorkList; + for (Function::iterator ibb = F.begin(), ibe = F.end(); + ibb != ibe; ++ibb) + for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end(); + iib != iie; ++iib) { + if (!(isa(iib) && iib->getParent() == BBEntry) && + valueEscapes(iib)) { + WorkList.push_front(&*iib); + } + } + + // Demote escaped instructions + NumRegsDemoted += WorkList.size(); + for (std::list::iterator ilb = WorkList.begin(), + ile = WorkList.end(); ilb != ile; ++ilb) + DemoteRegToStack(**ilb, false, AllocaInsertionPoint); + + WorkList.clear(); + + // Find all phi's + for (Function::iterator ibb = F.begin(), ibe = F.end(); + ibb != ibe; ++ibb) + for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end(); + iib != iie; ++iib) + if (isa(iib)) + WorkList.push_front(&*iib); + + // Demote phi nodes + NumPhisDemoted += WorkList.size(); + for (std::list::iterator ilb = WorkList.begin(), + ile = WorkList.end(); ilb != ile; ++ilb) + DemotePHIToStack(cast(*ilb), AllocaInsertionPoint); + + return true; +} + + // createDemoteRegisterToMemory - Provide an entry point to create this pass. // const PassInfo *const llvm::DemoteRegisterToMemoryID = &X; From sabre at nondot.org Wed Sep 2 01:31:02 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 06:31:02 -0000 Subject: [llvm-commits] [llvm] r80768 - in /llvm/trunk: lib/Transforms/Scalar/DeadStoreElimination.cpp test/Transforms/DeadStoreElimination/crash.ll Message-ID: <200909020631.n826V21p022980@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 01:31:02 2009 New Revision: 80768 URL: http://llvm.org/viewvc/llvm-project?rev=80768&view=rev Log: fix PR4815: some cases where DeleteDeadInstruction can delete the instruction BBI points to. Added: llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=80768&r1=80767&r2=80768&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Sep 2 01:31:02 2009 @@ -83,7 +83,7 @@ bool MadeChange = false; - // Do a top-down walk on the BB + // Do a top-down walk on the BB. for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); BBI != BBE; ) { Instruction *Inst = BBI++; @@ -124,7 +124,10 @@ DeleteDeadInstruction(DepStore); NumFastStores++; MadeChange = true; - + + // DeleteDeadInstruction can delete the current instruction in loop + // cases, reset BBI. + BBI = Inst; if (BBI != BB.begin()) --BBI; continue; @@ -135,8 +138,15 @@ if (LoadInst *DepLoad = dyn_cast(InstDep.getInst())) { if (SI->getPointerOperand() == DepLoad->getPointerOperand() && SI->getOperand(0) == DepLoad) { + // DeleteDeadInstruction can delete the current instruction. Save BBI + // in case we need it. + WeakVH NextInst(BBI); + DeleteDeadInstruction(SI); - if (BBI != BB.begin()) + + if (NextInst == 0) // Next instruction deleted. + BBI = BB.begin(); + else if (BBI != BB.begin()) // Revisit this instruction if possible. --BBI; NumFastStores++; MadeChange = true; Added: llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll?rev=80768&view=auto ============================================================================== --- llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll (added) +++ llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll Wed Sep 2 01:31:02 2009 @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | opt -dse | llvm-dis + +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-darwin10.0" + + at g80 = external global i8 ; [#uses=3] + +declare signext i8 @foo(i8 signext, i8 signext) nounwind readnone ssp + +declare i32 @func68(i32) nounwind readonly ssp + +; PR4815 +define void @test1(i32 %int32p54) noreturn nounwind ssp { +entry: + br label %bb + +bb: ; preds = %bb, %entry + %storemerge = phi i8 [ %2, %bb ], [ 1, %entry ] ; [#uses=1] + store i8 %storemerge, i8* @g80 + %0 = tail call i32 @func68(i32 1) nounwind ssp ; [#uses=1] + %1 = trunc i32 %0 to i8 ; [#uses=1] + store i8 %1, i8* @g80, align 1 + store i8 undef, i8* @g80, align 1 + %2 = tail call signext i8 @foo(i8 signext undef, i8 signext 1) nounwind ; [#uses=1] + br label %bb +} From sabre at nondot.org Wed Sep 2 01:34:22 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Sep 2009 06:34:22 -0000 Subject: [llvm-commits] [llvm] r80769 - in /llvm/trunk/test/Transforms/ConstProp: 2009-09-01-GEP-Crash.ll 2009-10-01-GEP-Crash.ll Message-ID: <200909020634.n826YNmE023431@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 2 01:34:22 2009 New Revision: 80769 URL: http://llvm.org/viewvc/llvm-project?rev=80769&view=rev Log: Fix month. Added: llvm/trunk/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll - copied unchanged from r80762, llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll Removed: llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll Removed: llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll?rev=80768&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll (original) +++ llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll (removed) @@ -1,24 +0,0 @@ -; RUN: llvm-as < %s | opt -constprop | llvm-dis -; PR4848 -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-unknown-linux-gnu" - -%0 = type { %struct.anon } -%1 = type { %0, %2, [24 x i8] } -%2 = type <{ %3, %3 }> -%3 = type { %struct.hrtimer_cpu_base*, i32, %struct.rb_root, %struct.rb_node*, %struct.pgprot, i64 ()*, [16 x i8] } -%struct.anon = type { } -%struct.hrtimer_clock_base = type { %struct.hrtimer_cpu_base*, i32, %struct.rb_root, %struct.rb_node*, %struct.pgprot, i64 ()*, %struct.pgprot, %struct.pgprot } -%struct.hrtimer_cpu_base = type { %0, [2 x %struct.hrtimer_clock_base], %struct.pgprot, i32, i64 } -%struct.pgprot = type { i64 } -%struct.rb_node = type { i64, %struct.rb_node*, %struct.rb_node* } -%struct.rb_root = type { %struct.rb_node* } - - at per_cpu__hrtimer_bases = external global %1, align 8 ; <%1*> [#uses=1] - -define void @init_hrtimers_cpu(i32 %cpu) nounwind noredzone section ".cpuinit.text" { -entry: - %tmp3 = getelementptr %struct.hrtimer_cpu_base* bitcast (%1* @per_cpu__hrtimer_bases to %struct.hrtimer_cpu_base*), i32 0, i32 0 ; <%0*> [#uses=1] - %tmp5 = bitcast %0* %tmp3 to i8* ; [#uses=0] - unreachable -} From isanbard at gmail.com Wed Sep 2 03:18:43 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 2 Sep 2009 01:18:43 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80734 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> Message-ID: On Sep 1, 2009, at 9:30 PM, Chris Lattner wrote: > On Sep 1, 2009, at 4:05 PM, Bill Wendling wrote: > >> Author: void >> Date: Tue Sep 1 18:05:43 2009 >> New Revision: 80734 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=80734&view=rev >> Log: >> Remove in favor of raw_ostream. > > Hey Bill, > > These "unhandled expression" messages actually do occur for some > weird cases, can you take them out of the DEBUG? Thanks for helping > exorcize ! > Okay. I'm also guessing that the "dump_tree" is the LLVM equivalent of vomiting LISP? I'll also remove the llvm:: from one of the errs()... -bw From isanbard at gmail.com Wed Sep 2 03:29:03 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 02 Sep 2009 08:29:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80772 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200909020829.n828T3Wr019098@zion.cs.uiuc.edu> Author: void Date: Wed Sep 2 03:29:02 2009 New Revision: 80772 URL: http://llvm.org/viewvc/llvm-project?rev=80772&view=rev Log: Don't put error messages inside of DEBUG macros. 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=80772&r1=80771&r2=80772&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Sep 2 03:29:02 2009 @@ -34,7 +34,6 @@ #include "llvm/Module.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/System/Host.h" -#include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetLowering.h" @@ -793,11 +792,9 @@ switch (TREE_CODE(exp)) { default: - DEBUG({ - llvm::errs() << "Unhandled expression!\n" - << "TREE_CODE: " << TREE_CODE(exp) << "\n"; - debug_tree(exp); - }); + errs() << "Unhandled expression!\n" + << "TREE_CODE: " << TREE_CODE(exp) << "\n"; + debug_tree(exp); abort(); // Control flow @@ -991,10 +988,8 @@ switch (TREE_CODE(exp)) { default: - DEBUG({ - errs() << "Unhandled lvalue expression!\n"; - debug_tree(exp); - }); + errs() << "Unhandled lvalue expression!\n"; + debug_tree(exp); abort(); case PARM_DECL: @@ -1076,7 +1071,7 @@ //===----------------------------------------------------------------------===// void TreeToLLVM::TODO(tree exp) { - DEBUG(errs() << "Unhandled tree node\n"); + errs() << "Unhandled tree node\n"; if (exp) debug_tree(exp); abort(); } From baldrick at free.fr Wed Sep 2 03:30:05 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 10:30:05 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r80734 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> Message-ID: <4A9E2D0D.2030400@free.fr> Hi Bill, > Okay. I'm also guessing that the "dump_tree" is the LLVM equivalent of > vomiting LISP? dump_tree is GCC's way of perverting your brain :) It dumps the tree to stderr. Ciao, Duncan. From isanbard at gmail.com Wed Sep 2 03:30:56 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 2 Sep 2009 01:30:56 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r80734 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <4A9E2D0D.2030400@free.fr> References: <200909012305.n81N5iw2029534@zion.cs.uiuc.edu> <4A9E2D0D.2030400@free.fr> Message-ID: <27D0595D-3ED2-4F2B-9EBE-D6F96FE8A9B8@gmail.com> On Sep 2, 2009, at 1:30 AM, Duncan Sands wrote: > Hi Bill, > >> Okay. I'm also guessing that the "dump_tree" is the LLVM equivalent >> of vomiting LISP? > > dump_tree is GCC's way of perverting your brain :) It dumps the > tree to stderr. > I thought that GCC was GCC's way of perverting my brain. ;-) -bw From deeppatel1987 at gmail.com Wed Sep 2 03:44:58 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Wed, 02 Sep 2009 08:44:58 -0000 Subject: [llvm-commits] [llvm] r80773 - in /llvm/trunk: include/llvm/ include/llvm/CodeGen/ include/llvm/Support/ include/llvm/Target/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/CBackend/ lib/Target/CellSPU/ lib/Target/CppBackend/ lib/Target/MSIL/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ lib/VMCore/ Message-ID: <200909020845.n828j04Y021105@zion.cs.uiuc.edu> Author: sandeep Date: Wed Sep 2 03:44:58 2009 New Revision: 80773 URL: http://llvm.org/viewvc/llvm-project?rev=80773&view=rev Log: Retype from unsigned to CallingConv::ID accordingly. Approved by Bob Wilson. Modified: llvm/trunk/include/llvm/CodeGen/CallingConvLower.h llvm/trunk/include/llvm/Function.h llvm/trunk/include/llvm/Instructions.h llvm/trunk/include/llvm/Support/CallSite.h llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.h llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.h llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.h llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/include/llvm/CodeGen/CallingConvLower.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CallingConvLower.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/CallingConvLower.h (original) +++ llvm/trunk/include/llvm/CodeGen/CallingConvLower.h Wed Sep 2 03:44:58 2009 @@ -18,6 +18,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/SelectionDAGNodes.h" +#include "llvm/CallingConv.h" namespace llvm { class TargetRegisterInfo; @@ -142,7 +143,7 @@ /// return values. It captures which registers are already assigned and which /// stack slots are used. It provides accessors to allocate these values. class CCState { - unsigned CallingConv; + CallingConv::ID CallingConv; bool IsVarArg; const TargetMachine &TM; const TargetRegisterInfo &TRI; @@ -152,7 +153,7 @@ unsigned StackOffset; SmallVector UsedRegs; public: - CCState(unsigned CC, bool isVarArg, const TargetMachine &TM, + CCState(CallingConv::ID CC, bool isVarArg, const TargetMachine &TM, SmallVector &locs, LLVMContext &C); void addLoc(const CCValAssign &V) { @@ -161,7 +162,7 @@ LLVMContext &getContext() const { return Context; } const TargetMachine &getTarget() const { return TM; } - unsigned getCallingConv() const { return CallingConv; } + CallingConv::ID getCallingConv() const { return CallingConv; } bool isVarArg() const { return IsVarArg; } unsigned getNextStackOffset() const { return StackOffset; } Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Wed Sep 2 03:44:58 2009 @@ -19,6 +19,7 @@ #define LLVM_FUNCTION_H #include "llvm/GlobalValue.h" +#include "llvm/CallingConv.h" #include "llvm/BasicBlock.h" #include "llvm/Argument.h" #include "llvm/Attributes.h" @@ -86,7 +87,7 @@ AttrListPtr AttributeList; ///< Parameter attributes // The Calling Convention is stored in Value::SubclassData. - /*unsigned CallingConvention;*/ + /*CallingConv::ID CallingConvention;*/ friend class SymbolTableListTraits; @@ -150,12 +151,14 @@ unsigned getIntrinsicID() const; bool isIntrinsic() const { return getIntrinsicID() != 0; } - /// getCallingConv()/setCallingConv(uint) - These method get and set the + /// getCallingConv()/setCallingConv(CC) - These method get and set the /// calling convention of this function. The enum values for the known /// calling conventions are defined in CallingConv.h. - unsigned getCallingConv() const { return SubclassData >> 1; } - void setCallingConv(unsigned CC) { - SubclassData = (SubclassData & 1) | (CC << 1); + CallingConv::ID getCallingConv() const { + return static_cast(SubclassData >> 1); + } + void setCallingConv(CallingConv::ID CC) { + SubclassData = (SubclassData & 1) | (static_cast(CC) << 1); } /// getAttributes - Return the attribute list for this Function. Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Wed Sep 2 03:44:58 2009 @@ -20,6 +20,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Attributes.h" #include "llvm/BasicBlock.h" +#include "llvm/CallingConv.h" #include "llvm/LLVMContext.h" #include "llvm/ADT/SmallVector.h" #include @@ -1042,9 +1043,11 @@ /// getCallingConv/setCallingConv - Get or set the calling convention of this /// function call. - unsigned getCallingConv() const { return SubclassData >> 1; } - void setCallingConv(unsigned CC) { - SubclassData = (SubclassData & 1) | (CC << 1); + CallingConv::ID getCallingConv() const { + return static_cast(SubclassData >> 1); + } + void setCallingConv(CallingConv::ID CC) { + SubclassData = (SubclassData & 1) | (static_cast(CC) << 1); } /// getAttributes - Return the parameter attributes for this call. @@ -2382,9 +2385,11 @@ /// getCallingConv/setCallingConv - Get or set the calling convention of this /// function call. - unsigned getCallingConv() const { return SubclassData; } - void setCallingConv(unsigned CC) { - SubclassData = CC; + CallingConv::ID getCallingConv() const { + return static_cast(SubclassData); + } + void setCallingConv(CallingConv::ID CC) { + SubclassData = static_cast(CC); } /// getAttributes - Return the parameter attributes for this invoke. Modified: llvm/trunk/include/llvm/Support/CallSite.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CallSite.h (original) +++ llvm/trunk/include/llvm/Support/CallSite.h Wed Sep 2 03:44:58 2009 @@ -26,6 +26,7 @@ #include "llvm/Attributes.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/BasicBlock.h" +#include "llvm/CallingConv.h" #include "llvm/Instruction.h" namespace llvm { @@ -61,8 +62,8 @@ /// getCallingConv/setCallingConv - get or set the calling convention of the /// call. - unsigned getCallingConv() const; - void setCallingConv(unsigned CC); + CallingConv::ID getCallingConv() const; + void setCallingConv(CallingConv::ID CC); /// getAttributes/setAttributes - get or set the parameter attributes of /// the call. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Sep 2 03:44:58 2009 @@ -1116,7 +1116,7 @@ /// virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -1147,8 +1147,9 @@ std::pair LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt, bool isVarArg, bool isInreg, unsigned NumFixedArgs, - unsigned CallConv, bool isTailCall, bool isReturnValueUsed, - SDValue Callee, ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl); + CallingConv::ID CallConv, bool isTailCall, + bool isReturnValueUsed, SDValue Callee, ArgListTy &Args, + SelectionDAG &DAG, DebugLoc dl); /// LowerCall - This hook must be implemented to lower calls into the /// the specified DAG. The outgoing arguments to the call are described @@ -1164,7 +1165,7 @@ /// virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -1179,7 +1180,7 @@ /// value. /// virtual SDValue - LowerReturn(SDValue Chain, unsigned CallConv, bool isVarArg, + LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { assert(0 && "Not Implemented"); @@ -1283,7 +1284,7 @@ /// should override this function. virtual bool IsEligibleForTailCallOptimization(SDValue Callee, - unsigned CalleeCC, + CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl &Ins, SelectionDAG& DAG) const { Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Sep 2 03:44:58 2009 @@ -998,7 +998,7 @@ /// ::= 'arm_aapcs_vfpcc' /// ::= 'cc' UINT /// -bool LLParser::ParseOptionalCallingConv(unsigned &CC) { +bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) { switch (Lex.getKind()) { default: CC = CallingConv::C; return false; case lltok::kw_ccc: CC = CallingConv::C; break; @@ -1009,8 +1009,18 @@ case lltok::kw_arm_apcscc: CC = CallingConv::ARM_APCS; break; case lltok::kw_arm_aapcscc: CC = CallingConv::ARM_AAPCS; break; case lltok::kw_arm_aapcs_vfpcc:CC = CallingConv::ARM_AAPCS_VFP; break; - case lltok::kw_cc: Lex.Lex(); return ParseUInt32(CC); + case lltok::kw_cc: { + unsigned ArbitraryCC; + Lex.Lex(); + if (ParseUInt32(ArbitraryCC)) { + return true; + } else + CC = static_cast(ArbitraryCC); + return false; + } + break; } + Lex.Lex(); return false; } @@ -2357,7 +2367,8 @@ LocTy LinkageLoc = Lex.getLoc(); unsigned Linkage; - unsigned Visibility, CC, RetAttrs; + unsigned Visibility, RetAttrs; + CallingConv::ID CC; PATypeHolder RetType(Type::getVoidTy(Context)); LocTy RetTypeLoc = Lex.getLoc(); if (ParseOptionalLinkage(Linkage) || @@ -2917,7 +2928,8 @@ /// OptionalAttrs 'to' TypeAndValue 'unwind' TypeAndValue bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) { LocTy CallLoc = Lex.getLoc(); - unsigned CC, RetAttrs, FnAttrs; + unsigned RetAttrs, FnAttrs; + CallingConv::ID CC; PATypeHolder RetType(Type::getVoidTy(Context)); LocTy RetTypeLoc; ValID CalleeID; @@ -3265,7 +3277,8 @@ /// ParameterList OptionalAttrs bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS, bool isTail) { - unsigned CC, RetAttrs, FnAttrs; + unsigned RetAttrs, FnAttrs; + CallingConv::ID CC; PATypeHolder RetType(Type::getVoidTy(Context)); LocTy RetTypeLoc; ValID CalleeID; Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Sep 2 03:44:58 2009 @@ -126,7 +126,7 @@ bool HasLinkage; return ParseOptionalLinkage(Linkage, HasLinkage); } bool ParseOptionalVisibility(unsigned &Visibility); - bool ParseOptionalCallingConv(unsigned &CC); + bool ParseOptionalCallingConv(CallingConv::ID &CC); bool ParseOptionalAlignment(unsigned &Alignment); bool ParseOptionalCommaAlignment(unsigned &Alignment); bool ParseIndexList(SmallVectorImpl &Indices); Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Sep 2 03:44:58 2009 @@ -1417,7 +1417,7 @@ Function *Func = Function::Create(FTy, GlobalValue::ExternalLinkage, "", TheModule); - Func->setCallingConv(Record[1]); + Func->setCallingConv(static_cast(Record[1])); bool isProto = Record[2]; Func->setLinkage(GetDecodedLinkage(Record[3])); Func->setAttributes(getAttributes(Record[4])); @@ -1918,7 +1918,8 @@ I = InvokeInst::Create(Callee, NormalBB, UnwindBB, Ops.begin(), Ops.end()); - cast(I)->setCallingConv(CCInfo); + cast(I)->setCallingConv( + static_cast(CCInfo)); cast(I)->setAttributes(PAL); break; } @@ -2056,7 +2057,8 @@ } I = CallInst::Create(Callee, Args.begin(), Args.end()); - cast(I)->setCallingConv(CCInfo>>1); + cast(I)->setCallingConv( + static_cast(CCInfo>>1)); cast(I)->setTailCall(CCInfo & 1); cast(I)->setAttributes(PAL); break; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Wed Sep 2 03:44:58 2009 @@ -20,7 +20,7 @@ #include "llvm/Target/TargetMachine.h" using namespace llvm; -CCState::CCState(unsigned CC, bool isVarArg, const TargetMachine &tm, +CCState::CCState(CallingConv::ID CC, bool isVarArg, const TargetMachine &tm, SmallVector &locs, LLVMContext &C) : CallingConv(CC), IsVarArg(isVarArg), TM(tm), TRI(*TM.getRegisterInfo()), Locs(locs), Context(C) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Sep 2 03:44:58 2009 @@ -989,7 +989,8 @@ } bool isVarArg = DAG.getMachineFunction().getFunction()->isVarArg(); - unsigned CallConv = DAG.getMachineFunction().getFunction()->getCallingConv(); + CallingConv::ID CallConv = + DAG.getMachineFunction().getFunction()->getCallingConv(); Chain = TLI.LowerReturn(Chain, CallConv, isVarArg, Outs, getCurDebugLoc(), DAG); @@ -5613,7 +5614,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt, bool isVarArg, bool isInreg, unsigned NumFixedArgs, - unsigned CallConv, bool isTailCall, + CallingConv::ID CallConv, bool isTailCall, bool isReturnValueUsed, SDValue Callee, ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl) { Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -685,7 +685,7 @@ /// CCAssignFnForNode - Selects the correct CCAssignFn for a the /// given CallingConvention value. -CCAssignFn *ARMTargetLowering::CCAssignFnForNode(unsigned CC, +CCAssignFn *ARMTargetLowering::CCAssignFnForNode(CallingConv::ID CC, bool Return, bool isVarArg) const { switch (CC) { @@ -715,7 +715,7 @@ /// appropriate copies out of appropriate physical registers. SDValue ARMTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -846,7 +846,7 @@ /// nodes. SDValue ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -1050,7 +1050,7 @@ SDValue ARMTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { @@ -1550,7 +1550,7 @@ SDValue ARMTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Wed Sep 2 03:44:58 2009 @@ -246,7 +246,7 @@ SDValue GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA, SDValue &Root, SelectionDAG &DAG, DebugLoc dl); - CCAssignFn *CCAssignFnForNode(unsigned CC, bool Return, bool isVarArg) const; + CCAssignFn *CCAssignFnForNode(CallingConv::ID CC, bool Return, bool isVarArg) const; SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg, DebugLoc dl, SelectionDAG &DAG, const CCValAssign &VA, @@ -273,21 +273,21 @@ const Value *DstSV, uint64_t DstSVOff, const Value *SrcSV, uint64_t SrcSVOff); SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -296,7 +296,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -232,7 +232,7 @@ SDValue AlphaTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -348,7 +348,7 @@ /// SDValue AlphaTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -390,7 +390,7 @@ SDValue AlphaTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -471,7 +471,7 @@ SDValue AlphaTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Wed Sep 2 03:44:58 2009 @@ -82,7 +82,7 @@ const char *getTargetNodeName(unsigned Opcode) const; SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); @@ -108,14 +108,14 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -123,7 +123,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -161,7 +161,7 @@ SDValue BlackfinTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -218,7 +218,7 @@ SDValue BlackfinTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { @@ -275,7 +275,7 @@ SDValue BlackfinTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h Wed Sep 2 03:44:58 2009 @@ -58,13 +58,13 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -72,7 +72,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Sep 2 03:44:58 2009 @@ -2283,6 +2283,8 @@ case CallingConv::X86_FastCall: Out << "__attribute__((fastcall)) "; break; + default: + break; } // Loop over the arguments, printing them... Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -1015,7 +1015,7 @@ SDValue SPUTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -1144,7 +1144,7 @@ SDValue SPUTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -1371,7 +1371,7 @@ SDValue SPUTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Wed Sep 2 03:44:58 2009 @@ -150,14 +150,14 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -166,7 +166,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original) +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Wed Sep 2 03:44:58 2009 @@ -123,7 +123,7 @@ private: void printLinkageType(GlobalValue::LinkageTypes LT); void printVisibilityType(GlobalValue::VisibilityTypes VisTypes); - void printCallingConv(unsigned cc); + void printCallingConv(CallingConv::ID cc); void printEscapedString(const std::string& str); void printCFP(const ConstantFP* CFP); @@ -268,7 +268,7 @@ Out << ")"; } - void CppWriter::printCallingConv(unsigned cc){ + void CppWriter::printCallingConv(CallingConv::ID cc){ // Print the calling convention. switch (cc) { case CallingConv::C: Out << "CallingConv::C"; break; Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Wed Sep 2 03:44:58 2009 @@ -270,7 +270,7 @@ } -std::string MSILWriter::getConvModopt(unsigned CallingConvID) { +std::string MSILWriter::getConvModopt(CallingConv::ID CallingConvID) { switch (CallingConvID) { case CallingConv::C: case CallingConv::Cold: @@ -1623,13 +1623,13 @@ const char* MSILWriter::getLibraryName(const GlobalVariable* GV) { - return getLibraryForSymbol(Mang->getMangledName(GV), false, 0); + return getLibraryForSymbol(Mang->getMangledName(GV), false, CallingConv::C); } const char* MSILWriter::getLibraryForSymbol(const StringRef &Name, bool isFunction, - unsigned CallingConv) { + CallingConv::ID CallingConv) { // TODO: Read *.def file with function and libraries definitions. return "MSVCRT.DLL"; } Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.h (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.h Wed Sep 2 03:44:58 2009 @@ -13,6 +13,7 @@ #ifndef MSILWRITER_H #define MSILWRITER_H +#include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/Instructions.h" @@ -133,7 +134,7 @@ std::string getLabelName(const std::string& Name); - std::string getConvModopt(unsigned CallingConvID); + std::string getConvModopt(CallingConv::ID CallingConvID); std::string getArrayTypeName(Type::TypeID TyID, const Type* Ty); @@ -248,7 +249,7 @@ const char* getLibraryName(const GlobalVariable* GV); const char* getLibraryForSymbol(const StringRef &Name, bool isFunction, - unsigned CallingConv); + CallingConv::ID CallingConv); void printExternals(); }; Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -196,7 +196,7 @@ SDValue MSP430TargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, @@ -215,7 +215,7 @@ SDValue MSP430TargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -238,7 +238,7 @@ // FIXME: varargs SDValue MSP430TargetLowering::LowerCCCArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, @@ -318,7 +318,7 @@ SDValue MSP430TargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { @@ -367,7 +367,7 @@ /// TODO: sret. SDValue MSP430TargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, @@ -493,7 +493,7 @@ /// SDValue MSP430TargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h Wed Sep 2 03:44:58 2009 @@ -94,7 +94,7 @@ private: SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -102,7 +102,7 @@ SmallVectorImpl &InVals); SDValue LowerCCCArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, @@ -110,20 +110,20 @@ SmallVectorImpl &InVals); SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -131,7 +131,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -683,7 +683,7 @@ /// TODO: isVarArg, isTailCall. SDValue MipsTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -874,7 +874,7 @@ /// appropriate copies out of appropriate physical registers. SDValue MipsTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -907,7 +907,7 @@ /// TODO: isVarArg SDValue MipsTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -1056,7 +1056,7 @@ SDValue MipsTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Wed Sep 2 03:44:58 2009 @@ -91,7 +91,7 @@ // Lower Operand helpers SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); @@ -110,14 +110,14 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -126,7 +126,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -1255,7 +1255,7 @@ SDValue PIC16TargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { @@ -1347,7 +1347,7 @@ SDValue PIC16TargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -1603,7 +1603,7 @@ SDValue PIC16TargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Sep 2 03:44:58 2009 @@ -132,7 +132,7 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -140,7 +140,7 @@ virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -148,7 +148,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -1484,7 +1484,7 @@ SDValue PPCTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -1501,7 +1501,7 @@ SDValue PPCTargetLowering::LowerFormalArguments_SVR4( SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -1728,7 +1728,7 @@ SDValue PPCTargetLowering::LowerFormalArguments_Darwin( SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -2164,7 +2164,7 @@ /// optimization should implement this function. bool PPCTargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, - unsigned CalleeCC, + CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl &Ins, SelectionDAG& DAG) const { @@ -2173,7 +2173,7 @@ return false; MachineFunction &MF = DAG.getMachineFunction(); - unsigned CallerCC = MF.getFunction()->getCallingConv(); + CallingConv::ID CallerCC = MF.getFunction()->getCallingConv(); if (CalleeCC == CallingConv::Fast && CallerCC == CalleeCC) { // Functions containing by val parameters are not supported. for (unsigned i = 0; i != Ins.size(); i++) { @@ -2453,7 +2453,7 @@ SDValue PPCTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -2478,8 +2478,8 @@ } SDValue -PPCTargetLowering::FinishCall(unsigned CallConv, DebugLoc dl, bool isTailCall, - bool isVarArg, +PPCTargetLowering::FinishCall(CallingConv::ID CallConv, DebugLoc dl, + bool isTailCall, bool isVarArg, SelectionDAG &DAG, SmallVector, 8> &RegsToPass, @@ -2554,7 +2554,7 @@ SDValue PPCTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -2573,7 +2573,7 @@ SDValue PPCTargetLowering::LowerCall_SVR4(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -2782,7 +2782,7 @@ SDValue PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -3116,7 +3116,7 @@ SDValue PPCTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Wed Sep 2 03:44:58 2009 @@ -332,7 +332,7 @@ virtual bool IsEligibleForTailCallOptimization(SDValue Callee, - unsigned CalleeCC, + CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl &Ins, SelectionDAG& DAG) const; @@ -391,11 +391,11 @@ SDValue LowerMUL(SDValue Op, SelectionDAG &DAG); SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); - SDValue FinishCall(unsigned CallConv, DebugLoc dl, bool isTailCall, + SDValue FinishCall(CallingConv::ID CallConv, DebugLoc dl, bool isTailCall, bool isVarArg, SelectionDAG &DAG, SmallVector, 8> @@ -408,14 +408,14 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -423,33 +423,33 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); SDValue LowerFormalArguments_Darwin(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); SDValue LowerFormalArguments_SVR4(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); SDValue LowerCall_Darwin(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); SDValue LowerCall_SVR4(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -35,7 +35,7 @@ SDValue SparcTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { @@ -81,7 +81,7 @@ /// pass FP values in FP registers for fastcc functions. SDValue SparcTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -246,7 +246,7 @@ SDValue SparcTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Wed Sep 2 03:44:58 2009 @@ -76,7 +76,7 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -84,7 +84,7 @@ virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -93,7 +93,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -217,7 +217,7 @@ SDValue SystemZTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, @@ -236,7 +236,7 @@ SDValue SystemZTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -259,7 +259,7 @@ // FIXME: varargs SDValue SystemZTargetLowering::LowerCCCArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, @@ -349,7 +349,7 @@ /// TODO: sret. SDValue SystemZTargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, @@ -484,7 +484,7 @@ /// SDValue SystemZTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -528,7 +528,7 @@ SDValue SystemZTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h Wed Sep 2 03:44:58 2009 @@ -90,7 +90,7 @@ private: SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -98,7 +98,7 @@ SmallVectorImpl &InVals); SDValue LowerCCCArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, @@ -106,20 +106,20 @@ SmallVectorImpl &InVals); SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -127,7 +127,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Sep 2 03:44:58 2009 @@ -126,7 +126,7 @@ CygMingStubs.insert(Name); // We don't want to decorate non-stdcall or non-fastcall functions right now - unsigned CC = F->getCallingConv(); + CallingConv::ID CC = F->getCallingConv(); if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) return; @@ -237,7 +237,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { const Function *F = MF.getFunction(); this->MF = &MF; - unsigned CC = F->getCallingConv(); + CallingConv::ID CC = F->getCallingConv(); SetupMachineFunction(MF); O << "\n\n"; Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Wed Sep 2 03:44:58 2009 @@ -79,7 +79,7 @@ if (!F) return; // We don't want to decorate non-stdcall or non-fastcall functions right now - unsigned CC = F->getCallingConv(); + CallingConv::ID CC = F->getCallingConv(); if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) return; @@ -134,7 +134,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - unsigned CC = F->getCallingConv(); + CallingConv::ID CC = F->getCallingConv(); unsigned FnAlign = MF.getAlignment(); // Populate function information map. Actually, We don't want to populate Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Sep 2 03:44:58 2009 @@ -118,7 +118,7 @@ bool X86VisitIntrinsicCall(IntrinsicInst &I); bool X86SelectCall(Instruction *I); - CCAssignFn *CCAssignFnForCall(unsigned CC, bool isTailCall = false); + CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool isTailCall = false); const X86InstrInfo *getInstrInfo() const { return getTargetMachine()->getInstrInfo(); @@ -169,7 +169,8 @@ /// CCAssignFnForCall - Selects the correct CCAssignFn for a given calling /// convention. -CCAssignFn *X86FastISel::CCAssignFnForCall(unsigned CC, bool isTaillCall) { +CCAssignFn *X86FastISel::CCAssignFnForCall(CallingConv::ID CC, + bool isTaillCall) { if (Subtarget->is64Bit()) { if (Subtarget->isTargetWin64()) return CC_X86_Win64_C; @@ -1223,7 +1224,7 @@ // Handle only C and fastcc calling conventions for now. CallSite CS(CI); - unsigned CC = CS.getCallingConv(); + CallingConv::ID CC = CS.getCallingConv(); if (CC != CallingConv::C && CC != CallingConv::Fast && CC != CallingConv::X86_FastCall) Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -1063,7 +1063,7 @@ SDValue X86TargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { @@ -1155,7 +1155,7 @@ /// SDValue X86TargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -1255,7 +1255,7 @@ /// IsCalleePop - Determines whether the callee is required to pop its /// own arguments. Callee pop is necessary to support tail calls. -bool X86TargetLowering::IsCalleePop(bool IsVarArg, unsigned CallingConv) { +bool X86TargetLowering::IsCalleePop(bool IsVarArg, CallingConv::ID CallingConv){ if (IsVarArg) return false; @@ -1273,7 +1273,7 @@ /// CCAssignFnForNode - Selects the correct CCAssignFn for a the /// given CallingConvention value. -CCAssignFn *X86TargetLowering::CCAssignFnForNode(unsigned CC) const { +CCAssignFn *X86TargetLowering::CCAssignFnForNode(CallingConv::ID CC) const { if (Subtarget->is64Bit()) { if (Subtarget->isTargetWin64()) return CC_X86_Win64_C; @@ -1292,7 +1292,7 @@ /// NameDecorationForCallConv - Selects the appropriate decoration to /// apply to a MachineFunction containing a given calling convention. NameDecorationStyle -X86TargetLowering::NameDecorationForCallConv(unsigned CallConv) { +X86TargetLowering::NameDecorationForCallConv(CallingConv::ID CallConv) { if (CallConv == CallingConv::X86_FastCall) return FastCall; else if (CallConv == CallingConv::X86_StdCall) @@ -1316,7 +1316,7 @@ SDValue X86TargetLowering::LowerMemArgument(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, const CCValAssign &VA, @@ -1351,7 +1351,7 @@ SDValue X86TargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, @@ -1652,7 +1652,8 @@ SDValue X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, + bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -2097,12 +2098,12 @@ /// optimization should implement this function. bool X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, - unsigned CalleeCC, + CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl &Ins, SelectionDAG& DAG) const { MachineFunction &MF = DAG.getMachineFunction(); - unsigned CallerCC = MF.getFunction()->getCallingConv(); + CallingConv::ID CallerCC = MF.getFunction()->getCallingConv(); return CalleeCC == CallingConv::Fast && CallerCC == CalleeCC; } @@ -6476,7 +6477,7 @@ } else { const Function *Func = cast(cast(Op.getOperand(5))->getValue()); - unsigned CC = Func->getCallingConv(); + CallingConv::ID CC = Func->getCallingConv(); unsigned NestReg; switch (CC) { Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Wed Sep 2 03:44:58 2009 @@ -521,7 +521,7 @@ /// optimization should implement this function. virtual bool IsEligibleForTailCallOptimization(SDValue Callee, - unsigned CalleeCC, + CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl &Ins, SelectionDAG& DAG) const; @@ -578,12 +578,12 @@ bool X86ScalarSSEf64; SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); SDValue LowerMemArgument(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, const SmallVectorImpl &ArgInfo, DebugLoc dl, SelectionDAG &DAG, const CCValAssign &VA, MachineFrameInfo *MFI, @@ -594,13 +594,13 @@ ISD::ArgFlagsTy Flags); // Call lowering helpers. - bool IsCalleePop(bool isVarArg, unsigned CallConv); + bool IsCalleePop(bool isVarArg, CallingConv::ID CallConv); SDValue EmitTailCallLoadRetAddr(SelectionDAG &DAG, SDValue &OutRetAddr, SDValue Chain, bool IsTailCall, bool Is64Bit, int FPDiff, DebugLoc dl); - CCAssignFn *CCAssignFnForNode(unsigned CallConv) const; - NameDecorationStyle NameDecorationForCallConv(unsigned CallConv); + CCAssignFn *CCAssignFnForNode(CallingConv::ID CallConv) const; + NameDecorationStyle NameDecorationForCallConv(CallingConv::ID CallConv); unsigned GetAlignedArgumentStackSize(unsigned StackSize, SelectionDAG &DAG); std::pair FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, @@ -659,13 +659,13 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, bool isTailCall, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -673,7 +673,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Sep 2 03:44:58 2009 @@ -611,7 +611,7 @@ /// XCore call implementation SDValue XCoreTargetLowering::LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -636,7 +636,7 @@ /// TODO: isTailCall, sret. SDValue XCoreTargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -761,7 +761,7 @@ /// appropriate copies out of appropriate physical registers. SDValue XCoreTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals) { @@ -791,7 +791,7 @@ /// XCore formal arguments implementation SDValue XCoreTargetLowering::LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, @@ -814,7 +814,7 @@ /// TODO: sret SDValue XCoreTargetLowering::LowerCCCArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, @@ -928,7 +928,7 @@ SDValue XCoreTargetLowering::LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Wed Sep 2 03:44:58 2009 @@ -93,20 +93,20 @@ // Lower Operand helpers SDValue LowerCCCArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); SDValue LowerCallResult(SDValue Chain, SDValue InFlag, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, SmallVectorImpl &InVals); @@ -138,7 +138,7 @@ virtual SDValue LowerFormalArguments(SDValue Chain, - unsigned CallConv, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Ins, DebugLoc dl, SelectionDAG &DAG, @@ -146,7 +146,7 @@ virtual SDValue LowerCall(SDValue Chain, SDValue Callee, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, bool isTailCall, const SmallVectorImpl &Outs, const SmallVectorImpl &Ins, @@ -155,7 +155,7 @@ virtual SDValue LowerReturn(SDValue Chain, - unsigned CallConv, bool isVarArg, + CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl &Outs, DebugLoc dl, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Wed Sep 2 03:44:58 2009 @@ -1118,7 +1118,8 @@ } void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC) { - return unwrap(Fn)->setCallingConv(CC); + return unwrap(Fn)->setCallingConv( + static_cast(CC)); } const char *LLVMGetGC(LLVMValueRef Fn) { @@ -1362,9 +1363,9 @@ void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC) { Value *V = unwrap(Instr); if (CallInst *CI = dyn_cast(V)) - return CI->setCallingConv(CC); + return CI->setCallingConv(static_cast(CC)); else if (InvokeInst *II = dyn_cast(V)) - return II->setCallingConv(CC); + return II->setCallingConv(static_cast(CC)); llvm_unreachable("LLVMSetInstructionCallConv applies only to call and invoke!"); } Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=80773&r1=80772&r2=80773&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Wed Sep 2 03:44:58 2009 @@ -45,10 +45,10 @@ I.setPointer(C); I.setInt(isa(C)); } -unsigned CallSite::getCallingConv() const { +CallingConv::ID CallSite::getCallingConv() const { CALLSITE_DELEGATE_GETTER(getCallingConv()); } -void CallSite::setCallingConv(unsigned CC) { +void CallSite::setCallingConv(CallingConv::ID CC) { CALLSITE_DELEGATE_SETTER(setCallingConv(CC)); } const AttrListPtr &CallSite::getAttributes() const { From deeppatel1987 at gmail.com Wed Sep 2 04:18:49 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Wed, 02 Sep 2009 09:18:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80774 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Message-ID: <200909020918.n829In3x025781@zion.cs.uiuc.edu> Author: sandeep Date: Wed Sep 2 04:18:48 2009 New Revision: 80774 URL: http://llvm.org/viewvc/llvm-project?rev=80774&view=rev Log: Fix warning on non-Darwin. Approved by Bob Wilson and Nick Lewycky. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=80774&r1=80773&r2=80774&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Wed Sep 2 04:18:48 2009 @@ -23527,8 +23527,9 @@ /* APPLE LOCAL end ARM MACH assembler */ /* APPLE LOCAL begin ARM darwin optimization defaults */ +/* LLVM LOCAL fix warning on non-Darwin */ void -optimization_options (int level, int size ATTRIBUTE_UNUSED) +optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED) { /* disable strict aliasing; breaks too much existing code. */ #if TARGET_MACHO From baldrick at free.fr Wed Sep 2 04:31:33 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 09:31:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80775 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-debug.h llvm-internal.h Message-ID: <200909020931.n829VXWx027465@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 2 04:31:33 2009 New Revision: 80775 URL: http://llvm.org/viewvc/llvm-project?rev=80775&view=rev Log: Comment the terminating endif in these files. Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h llvm-gcc-4.2/trunk/gcc/llvm-debug.h llvm-gcc-4.2/trunk/gcc/llvm-internal.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=80775&r1=80774&r2=80775&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Wed Sep 2 04:31:33 2009 @@ -1147,5 +1147,5 @@ } }; -#endif +#endif /* LLVM_ABI_H */ /* LLVM LOCAL end (ENTIRE FILE!) */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=80775&r1=80774&r2=80775&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Wed Sep 2 04:31:33 2009 @@ -140,5 +140,5 @@ } // end namespace llvm -#endif +#endif /* LLVM_DEBUG_H */ /* LLVM LOCAL end (ENTIRE FILE!) */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80775&r1=80774&r2=80775&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Wed Sep 2 04:31:33 2009 @@ -645,5 +645,5 @@ }; -#endif +#endif /* LLVM_INTERNAL_H */ /* LLVM LOCAL end (ENTIRE FILE!) */ From baldrick at free.fr Wed Sep 2 05:23:57 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 10:23:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r80776 - /llvm-gcc-4.2/trunk/gcc/llvm-internal.h Message-ID: <200909021023.n82ANvnO001717@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 2 05:23:57 2009 New Revision: 80776 URL: http://llvm.org/viewvc/llvm-project?rev=80776&view=rev Log: Remove unused declaration. Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=80776&r1=80775&r2=80776&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Wed Sep 2 05:23:57 2009 @@ -47,10 +47,6 @@ #include "llvm.h" } -/// Internal gcc structure describing an exception handling region. Declared -/// here to avoid including all of except.h. -struct eh_region; - namespace llvm { class Module; class GlobalVariable; From baldrick at free.fr Wed Sep 2 05:38:07 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Sep 2009 10:38:07 -0000 Subject: [llvm-commits] [gcc-plugin] r80777 - in /gcc-plugin/trunk: llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-debug.h llvm-internal.h llvm-types.cpp Message-ID: <200909021038.n82Ac8Bf003522@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 2 05:38:07 2009 New Revision: 80777 URL: http://llvm.org/viewvc/llvm-project?rev=80777&view=rev Log: Synchronize with llvm-gcc revision 80776. Modified: gcc-plugin/trunk/llvm-abi.h gcc-plugin/trunk/llvm-backend.cpp gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-debug.cpp gcc-plugin/trunk/llvm-debug.h gcc-plugin/trunk/llvm-internal.h gcc-plugin/trunk/llvm-types.cpp Modified: gcc-plugin/trunk/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-abi.h?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-abi.h (original) +++ gcc-plugin/trunk/llvm-abi.h Wed Sep 2 05:38:07 2009 @@ -30,6 +30,7 @@ // LLVM headers #include "llvm/Attributes.h" +#include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Target/TargetData.h" Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Wed Sep 2 05:38:07 2009 @@ -355,28 +355,13 @@ } //TODO// GuessAtInliningThreshold - Figure out a reasonable threshold to pass llvm's -//TODO// inliner. There are 12 user-settable gcc params that affect inlining. llvm -//TODO// (so far) only has one knob; the param that corresponds most closely, and -//TODO// which we use, is max-inline-insns-auto (set by -finline-limit, which is -//TODO// what most users actually use). This maps only very approximately to what -//TODO// llvm's inliner is doing, but it's the best we've got. +//TODO// inliner. gcc has many options that control inlining, but we have decided +//TODO// not to support anything like that for llvm-gcc. //TODOstatic unsigned GuessAtInliningThreshold() { //TODO unsigned threshold = 200; -//TODO // Get the default value for gcc's max-inline-insns-auto. This is the value -//TODO // after all language and target dependent changes to the global default are -//TODO // applied, but before parsing the command line. -//TODO unsigned default_miia = default_max_inline_insns_auto; -//TODO // See if the actual value is the same as the default. -//TODO unsigned miia = MAX_INLINE_INSNS_AUTO; -//TODO if (miia == default_miia) { -//TODO if (optimize_size || optimize < 3) -//TODO // Reduce inline limit. -//TODO threshold = 50; -//TODO } else { -//TODO // We have an overriding user-specified value. Multiply by 20/9, which is -//TODO // the Magic Number converting 90 to 200. -//TODO threshold = miia * 20 / 9; -//TODO } +//TODO if (optimize_size || optimize < 3) +//TODO // Reduce inline limit. +//TODO threshold = 50; //TODO return threshold; //TODO} Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Wed Sep 2 05:38:07 2009 @@ -34,8 +34,10 @@ #include "llvm/Module.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/System/Host.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" @@ -44,7 +46,6 @@ // System headers #include -#include // GCC headers #undef VISIBILITY_HIDDEN @@ -832,9 +833,11 @@ switch (TREE_CODE(exp)) { default: - std::cerr << "Unhandled expression!\n" - << "TREE_CODE: " << TREE_CODE(exp) << "\n"; - debug_tree(exp); + DEBUG({ + llvm::errs() << "Unhandled expression!\n" + << "TREE_CODE: " << TREE_CODE(exp) << "\n"; + debug_tree(exp); + }); abort(); // Control flow @@ -1028,8 +1031,10 @@ switch (TREE_CODE(exp)) { default: - std::cerr << "Unhandled lvalue expression!\n"; - debug_tree(exp); + DEBUG({ + errs() << "Unhandled lvalue expression!\n"; + debug_tree(exp); + }); abort(); case PARM_DECL: @@ -1111,7 +1116,7 @@ //===----------------------------------------------------------------------===// void TreeToLLVM::TODO(tree exp) { - std::cerr << "Unhandled tree node\n"; + DEBUG(errs() << "Unhandled tree node\n"); if (exp) debug_tree(exp); abort(); } @@ -4534,6 +4539,17 @@ unsigned OTyBits = TD.getTypeSizeInBits(OTy); unsigned OpTyBits = TD.getTypeSizeInBits(OpTy); if (OTyBits == 0 || OpTyBits == 0 || OTyBits < OpTyBits) { + // It's tempting to implement the OTyBits < OpTyBits case by truncating + // Op down to OTy, however that breaks in the case of an inline asm + // constraint that corresponds to a single register, because the + // user can write code that assumes the whole register is defined, + // despite the output operand being only a subset of the register. For + // example: + // + // asm ("sarl $10, %%eax" : "=a"(c) : "0"(1000000)); + // + // The expected behavior is for %eax to be fully defined with the value + // 1000000 immediately before the asm. error_at(EXPR_LOCATION(exp), "unsupported inline asm: input constraint with a matching " "output constraint of incompatible type!"); @@ -7145,7 +7161,7 @@ } else if (ElTy == Type::getInt32Ty(Context)) { assert((Len&3) == 0 && "Length in bytes should be a multiple of element size"); - const uint32_t *InStr = (const unsigned *)TREE_STRING_POINTER(exp); + const uint32_t *InStr = (const uint32_t *)TREE_STRING_POINTER(exp); for (unsigned i = 0; i != Len/4; ++i) { // gcc has constructed the initializer elements in the target endianness, // but we're going to treat them as ordinary ints from here, with Modified: gcc-plugin/trunk/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-debug.cpp?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-debug.cpp (original) +++ gcc-plugin/trunk/llvm-debug.cpp Wed Sep 2 05:38:07 2009 @@ -287,7 +287,7 @@ llvm::DIDescriptor D; if (!RegionStack.empty()) D = RegionStack.back(); - D = DebugFactory.CreateBlock(D); + D = DebugFactory.CreateLexicalBlock(D); RegionStack.push_back(D); DebugFactory.InsertRegionStart(D, CurBB); } @@ -416,6 +416,7 @@ break; } } + return DebugFactory.CreateBasicType(getOrCreateCompileUnit(main_input_filename), TypeName, @@ -455,17 +456,20 @@ DIType FromTy = getOrCreateType(TREE_TYPE(type)); // type* and type& // FIXME: Should BLOCK_POINTER_TYP have its own DW_TAG? - unsigned Tag = (TREE_CODE(type) == POINTER_TYPE) ? + unsigned Tag = TREE_CODE(type) == POINTER_TYPE ? DW_TAG_pointer_type : DW_TAG_reference_type; expanded_location Loc = GetNodeLocation(type); - return DebugFactory.CreateDerivedType(Tag, findRegion(type), "", + + std::string PName; + FromTy.getName(PName); + return DebugFactory.CreateDerivedType(Tag, findRegion(type), PName, getOrCreateCompileUnit(NULL), 0 /*line no*/, NodeSizeInBits(type), NodeAlignInBits(type), 0 /*offset */, - 0 /* flags */, + 0, FromTy); } @@ -590,13 +594,22 @@ // recursive) and replace all uses of the forward declaration with the // final definition. expanded_location Loc = GetNodeLocation(TREE_CHAIN(type), false); + // FIXME: findRegion() is not able to find context all the time. This + // means when type names in different context match then FwdDecl is + // reused because MDNodes are uniqued. To avoid this, use type context + /// also while creating FwdDecl for now. + std::string FwdName; + if (TYPE_CONTEXT(type)) + FwdName = GetNodeName(TYPE_CONTEXT(type)); + FwdName = FwdName + GetNodeName(type); + unsigned Flags = llvm::DIType::FlagFwdDecl; llvm::DICompositeType FwdDecl = DebugFactory.CreateCompositeType(Tag, findRegion(type), - GetNodeName(type), + FwdName, getOrCreateCompileUnit(Loc.file), Loc.line, - 0, 0, 0, llvm::DIType::FlagFwdDecl, + 0, 0, 0, Flags, llvm::DIType(), llvm::DIArray(), RunTimeLang); @@ -605,7 +618,7 @@ return FwdDecl; // Insert into the TypeCache so that recursive uses will find it. - TypeCache[type] = FwdDecl; + TypeCache[type] = FwdDecl.getNode(); // Convert all the elements. llvm::SmallVector EltTys; @@ -616,7 +629,6 @@ tree BInfoType = BINFO_TYPE (BInfo); DIType BaseClass = getOrCreateType(BInfoType); - expanded_location loc = GetNodeLocation(type); // FIXME : name, size, align etc... DIType DTy = DebugFactory.CreateDerivedType(DW_TAG_inheritance, @@ -696,14 +708,14 @@ llvm::DIArray Elements = DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size()); - + llvm::DICompositeType RealDecl = DebugFactory.CreateCompositeType(Tag, findRegion(type), GetNodeName(type), getOrCreateCompileUnit(Loc.file), Loc.line, NodeSizeInBits(type), NodeAlignInBits(type), - 0, 0, llvm::DIType(), Elements, + 0, Flags, llvm::DIType(), Elements, RunTimeLang); // Now that we have a real decl for the struct, replace anything using the @@ -716,11 +728,14 @@ DIType DebugInfo::createVariantType(tree type, DIType MainTy) { DIType Ty; - if (tree Name = TYPE_NAME(type)) { - if (TREE_CODE(Name) == TYPE_DECL && DECL_ORIGINAL_TYPE(Name)) { - expanded_location TypeDefLoc = GetNodeLocation(Name); - Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, findRegion(type), - GetNodeName(Name), + if (tree TyDef = TYPE_NAME(type)) { + std::map::iterator I = TypeCache.find(TyDef); + if (I != TypeCache.end()) + return DIType(I->second); + if (TREE_CODE(TyDef) == TYPE_DECL && DECL_ORIGINAL_TYPE(TyDef)) { + expanded_location TypeDefLoc = GetNodeLocation(TyDef); + Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, findRegion(TyDef), + GetNodeName(TyDef), getOrCreateCompileUnit(TypeDefLoc.file), TypeDefLoc.line, 0 /*size*/, @@ -728,8 +743,7 @@ 0 /*offset */, 0 /*flags*/, MainTy); - // Set the slot early to prevent recursion difficulties. - TypeCache[type] = Ty; + TypeCache[TyDef] = Ty.getNode(); return Ty; } } @@ -759,7 +773,7 @@ MainTy); if (TYPE_VOLATILE(type) || TYPE_READONLY(type)) { - TypeCache[type] = Ty; + TypeCache[type] = Ty.getNode(); return Ty; } @@ -779,17 +793,13 @@ if (TREE_CODE(type) == VOID_TYPE) return DIType(); // Check to see if the compile unit already has created this type. - DIType &Slot = TypeCache[type]; - if (!Slot.isNull()) - return Slot; - + std::map::iterator I = TypeCache.find(type); + if (I != TypeCache.end()) + return DIType(I->second); + DIType MainTy; - if (type != TYPE_MAIN_VARIANT(type)) { - if (TYPE_NEXT_VARIANT(type) && type != TYPE_NEXT_VARIANT(type)) - MainTy = getOrCreateType(TYPE_NEXT_VARIANT(type)); - else if (TYPE_MAIN_VARIANT(type)) - MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type)); - } + if (type != TYPE_MAIN_VARIANT(type) && TYPE_MAIN_VARIANT(type)) + MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type)); DIType Ty = createVariantType(type, MainTy); if (!Ty.isNull()) @@ -809,7 +819,7 @@ case REFERENCE_TYPE: Ty = createPointerType(type); break; - + case OFFSET_TYPE: { // gen_type_die(TYPE_OFFSET_BASETYPE(type), context_die); // gen_type_die(TREE_TYPE(type), context_die); @@ -844,7 +854,7 @@ Ty = createBasicType(type); break; } - TypeCache[type] = Ty; + TypeCache[type] = Ty.getNode(); return Ty; } @@ -870,7 +880,7 @@ bool isMain) { if (!FullPath) FullPath = main_input_filename; - GlobalVariable *&CU = CUCache[FullPath]; + MDNode *&CU = CUCache[FullPath]; if (CU) return DICompileUnit(CU); @@ -911,6 +921,6 @@ version_string, isMain, optimize, "", ObjcRunTimeVer); - CU = NewCU.getGV(); + CU = NewCU.getNode(); return NewCU; } Modified: gcc-plugin/trunk/llvm-debug.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-debug.h?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-debug.h (original) +++ gcc-plugin/trunk/llvm-debug.h Wed Sep 2 05:38:07 2009 @@ -56,8 +56,8 @@ const char *PrevFullPath; // Previous location file encountered. int PrevLineNo; // Previous location line# encountered. BasicBlock *PrevBB; // Last basic block encountered. - std::map CUCache; - std::map TypeCache; + std::map CUCache; + std::map TypeCache; // Cache of previously constructed // Types. std::vector RegionStack; Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Wed Sep 2 05:38:07 2009 @@ -442,12 +442,6 @@ Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align); Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align); - /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher - void EmitSjLjDispatcher(); - - /// EmitSjLjLandingPads - Emit SJLJ EH landing pads. - void EmitSjLjLandingPads(); - /// EmitLandingPads - Emit EH landing pads. void EmitLandingPads(); Modified: gcc-plugin/trunk/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-types.cpp?rev=80777&r1=80776&r2=80777&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-types.cpp (original) +++ gcc-plugin/trunk/llvm-types.cpp Wed Sep 2 05:38:07 2009 @@ -724,8 +724,8 @@ case 128: #ifdef TARGET_POWERPC return SET_TYPE_LLVM(type, Type::getPPC_FP128Ty(Context)); -#elif 0 - // This is for IEEE double extended, e.g. Sparc +#elif defined(TARGET_ZARCH) || defined(TARGET_CPU_sparc) // FIXME: Use some generic define. + // This is for IEEE double extended, e.g. Sparc return SET_TYPE_LLVM(type, Type::getFP128Ty(Context)); #else // 128-bit long doubles map onto { double, double }. From astifter-llvm at gmx.at Wed Sep 2 05:49:49 2009 From: astifter-llvm at gmx.at (Andreas Neustifter) Date: Wed, 02 Sep 2009 12:49:49 +0200 Subject: [llvm-commits] [llvm] r80715 - in /llvm/trunk: include/llvm/Analysis/ProfileInfoLoader.h lib/Analysis/ProfileInfoLoader.cpp lib/Analysis/ProfileInfoLoaderPass.cpp In-Reply-To: <6a8523d60909011504m5df57bdfl18e9197e07662ce6@mail.gmail.com> References: <200909011908.n81J8p9c028897@zion.cs.uiuc.edu> <6a8523d60909011504m5df57bdfl18e9197e07662ce6@mail.gmail.com> Message-ID: <4A9E4DCD.5090007@gmx.at> Hi, Daniel Dunbar wrote: > Hi Andreas, > > One minor comment, > > On Tue, Sep 1, 2009 at 12:08 PM, Andreas Neustifter wrote: >> - // Make sure we have enough space... >> + // Make sure we have enough space... The space is initialised to -1 to >> + // facitiltate the loading of missing values for OptimalEdgeProfiling. >> if (Data.size() < NumEntries) >> - Data.resize(NumEntries); >> + Data.resize(NumEntries, -1); > > FYI I changed this to ~0U to fix a build warning. Thanks! >> // Accumulate the data we just read into the data. >> if (!ShouldByteSwap) { >> - for (unsigned i = 0; i != NumEntries; ++i) >> - Data[i] += TempSpace[i]; >> + for (unsigned i = 0; i != NumEntries; ++i) { >> + unsigned data = TempSpace[i]; >> + if (data != (unsigned)-1) { // only load data if its not MissingVal >> + if (Data[i] == (unsigned)-1) { >> + Data[i] = data; // if data is still initialised >> + } else { >> + Data[i] += data; >> + } >> + } >> + } >> } else { >> - for (unsigned i = 0; i != NumEntries; ++i) >> - Data[i] += ByteSwap(TempSpace[i], true); >> + for (unsigned i = 0; i != NumEntries; ++i) { >> + unsigned data = ByteSwap(TempSpace[i], true); >> + if (data != (unsigned)-1) { // only load data if its not MissingVal >> + if (Data[i] == (unsigned)-1) { >> + Data[i] = data; >> + } else { >> + Data[i] += data; >> + } >> + } >> + } > > This would be simpler if there was a: > -- > static const unsigned AddCounts(unsigned A, unsigned B) { > // If either value is undefined, use the other. > if (A == ~0U) return B; > if (B == ~0U) return A; > return A + B; > } > -- > helper earlier, then it becomes obvious what the loops are doing: > -- > for (unsigned i = 0; i != NumEntries; ++i) > Data[i] = AddCounts(Data[i], TempSpace[i]); > -- I found this code _very_ ugly myself, is was planing on cleaning it up today, thanks for the hints! > Do these values need to become uint64_t at some point? Was thinking about that because there is no gurantee that the counters do not overflow. But this would be a major change, in the complete tool chain, but I will look into this. Andi From edwintorok at gmail.com Wed Sep 2 06:13:56 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Wed, 02 Sep 2009 11:13:56 -0000 Subject: [llvm-commits] [llvm] r80778 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp lib/VMCore/IntrinsicInst.cpp test/DebugInfo/printdbginfo2.ll Message-ID: <200909021113.n82BDu43008088@zion.cs.uiuc.edu> Author: edwin Date: Wed Sep 2 06:13:56 2009 New Revision: 80778 URL: http://llvm.org/viewvc/llvm-project?rev=80778&view=rev Log: Fix DbgStopPointInst->getFileName/getDirectory, broken by the MDNodification in r80406, and readd a -print-dbginfo test. Added: llvm/trunk/test/DebugInfo/printdbginfo2.ll Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/VMCore/IntrinsicInst.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=80778&r1=80777&r2=80778&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Sep 2 06:13:56 2009 @@ -1058,6 +1058,11 @@ StopAtNul); } + if (MDString *MDStr = dyn_cast(V)) { + Str = MDStr->getString(); + return true; + } + // The GEP instruction, constant or instruction, must reference a global // variable that is a constant and is initialized. The referenced constant // initializer is the array that we'll use for optimization. Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=80778&r1=80777&r2=80778&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original) +++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Wed Sep 2 06:13:56 2009 @@ -61,17 +61,11 @@ Value *DbgStopPointInst::getFileName() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); - GlobalVariable *GV = cast(getContext()); - if (!GV->hasInitializer()) return NULL; - ConstantStruct *CS = cast(GV->getInitializer()); - return CS->getOperand(3); + return getContext()->getElement(3); } Value *DbgStopPointInst::getDirectory() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); - GlobalVariable *GV = cast(getContext()); - if (!GV->hasInitializer()) return NULL; - ConstantStruct *CS = cast(GV->getInitializer()); - return CS->getOperand(4); + return getContext()->getElement(4); } Added: llvm/trunk/test/DebugInfo/printdbginfo2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/printdbginfo2.ll?rev=80778&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/printdbginfo2.ll (added) +++ llvm/trunk/test/DebugInfo/printdbginfo2.ll Wed Sep 2 06:13:56 2009 @@ -0,0 +1,73 @@ +; RUN: llvm-as < %s | opt -print-dbginfo -disable-output | FileCheck %s +; grep {%b is variable b of type x declared at x.c:7} %t1 +; grep {%2 is variable b of type x declared at x.c:7} %t1 +; grep {@c.1442 is variable c of type int declared at x.c:4} %t1 + +%struct.foo = type { i32 } + + at main.c = internal global i32 5 ; [#uses=1] + +define i32 @main() nounwind { +entry: +; CHECK:; (x.c:6:3) + %retval = alloca i32 ; [#uses=3] + %b = alloca %struct.foo, align 4 ; <%struct.foo*> [#uses=2] +; CHECK:; %b is variable b of type foo declared at x.c:7 + %a = alloca [4 x i32], align 4 ; <[4 x i32]*> [#uses=1] +; CHECK:; %a is variable a of type declared at x.c:8 + call void @llvm.dbg.func.start(metadata !3) +; CHECK:; fully qualified function name: main return type: int at line 5 + store i32 0, i32* %retval + call void @llvm.dbg.stoppoint(i32 6, i32 3, metadata !1) +; CHECK:; x.c:7:3 + call void @llvm.dbg.stoppoint(i32 7, i32 3, metadata !1) + %0 = bitcast %struct.foo* %b to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %0, metadata !4) +; CHECK:; %0 is variable b of type foo declared at x.c:7 + call void @llvm.dbg.stoppoint(i32 8, i32 3, metadata !1) +; CHECK:; x.c:8:3 + %1 = bitcast [4 x i32]* %a to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %1, metadata !8) +; CHECK:; %1 is variable a of type declared at x.c:8 + call void @llvm.dbg.stoppoint(i32 9, i32 3, metadata !1) +; CHECK:; x.c:9:3 + %tmp = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 ; [#uses=1] +; CHECK:; %tmp is variable b of type foo declared at x.c:7 + store i32 5, i32* %tmp +; CHECK:; x.c:10:3 + call void @llvm.dbg.stoppoint(i32 10, i32 3, metadata !1) + %tmp1 = load i32* @main.c ; [#uses=1] +; CHECK:; @main.c is variable c of type int declared at x.c:6 + store i32 %tmp1, i32* %retval + br label %2 + +;